@cosmicdrift/kumiko-renderer 0.413.1 → 0.415.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (369) hide show
  1. package/dist/app/action-form-support.js +4 -0
  2. package/dist/app/content-previews.d.ts +39 -0
  3. package/dist/app/content-previews.js +28 -0
  4. package/dist/app/entity-edit-screen.js +2 -5
  5. package/dist/app/entity-list-screen.js +42 -59
  6. package/dist/app/form-schema.d.ts +1 -0
  7. package/dist/app/form-schema.js +24 -0
  8. package/dist/app/list-facets.d.ts +1 -0
  9. package/dist/app/list-facets.js +10 -1
  10. package/dist/app/list-sort-options.d.ts +4 -0
  11. package/dist/app/list-sort-options.js +11 -0
  12. package/dist/app/named-filter-facet.d.ts +16 -3
  13. package/dist/app/named-filter-facet.js +97 -5
  14. package/dist/app/projection-detail-body.d.ts +2 -4
  15. package/dist/app/projection-detail-body.js +7 -1
  16. package/dist/app/projection-detail-guidance-data.d.ts +7 -0
  17. package/dist/app/projection-detail-guidance-data.js +103 -0
  18. package/dist/app/projection-detail-guidance.d.ts +13 -0
  19. package/dist/app/projection-detail-guidance.js +197 -0
  20. package/dist/app/projection-detail-header-model.d.ts +1 -3
  21. package/dist/app/projection-detail-header-model.js +4 -8
  22. package/dist/app/projection-detail-header-region.d.ts +2 -1
  23. package/dist/app/projection-detail-header-region.js +63 -23
  24. package/dist/app/projection-detail-header.d.ts +6 -1
  25. package/dist/app/projection-detail-header.js +76 -18
  26. package/dist/app/projection-detail-navigation.d.ts +2 -0
  27. package/dist/app/projection-detail-navigation.js +13 -3
  28. package/dist/app/projection-detail-states.d.ts +3 -3
  29. package/dist/app/projection-list-body.js +4 -2
  30. package/dist/app/projection-list-render.js +3 -1
  31. package/dist/app/projection-list-shim.d.ts +4 -1
  32. package/dist/app/projection-list-shim.js +35 -8
  33. package/dist/app/reference-link.d.ts +3 -2
  34. package/dist/app/reference-link.js +19 -4
  35. package/dist/app/row-actions.js +3 -3
  36. package/dist/app/screen-access.d.ts +4 -0
  37. package/dist/app/screen-access.js +18 -0
  38. package/dist/app/screen-shared.js +3 -1
  39. package/dist/app/unique-label-keys.d.ts +1 -0
  40. package/dist/app/unique-label-keys.js +9 -0
  41. package/dist/app/use-entity-list-payload.d.ts +26 -0
  42. package/dist/app/use-entity-list-payload.js +59 -0
  43. package/dist/app/use-entity-range-facets.js +2 -3
  44. package/dist/app/use-facet-counts.d.ts +5 -0
  45. package/dist/app/use-facet-counts.js +7 -0
  46. package/dist/app/use-list-summary-row.d.ts +10 -0
  47. package/dist/app/use-list-summary-row.js +33 -0
  48. package/dist/app/use-named-filter-queue.d.ts +20 -0
  49. package/dist/app/use-named-filter-queue.js +9 -0
  50. package/dist/app/use-projection-detail-actions.d.ts +5 -4
  51. package/dist/app/use-projection-detail-actions.js +42 -1
  52. package/dist/app/use-projection-list-data.d.ts +5 -0
  53. package/dist/app/use-projection-list-data.js +35 -6
  54. package/dist/app/use-projection-list-query.d.ts +2 -0
  55. package/dist/app/use-projection-list-query.js +29 -16
  56. package/dist/app/use-related-list-tab-counts.js +5 -1
  57. package/dist/app/use-row-decoration.d.ts +13 -0
  58. package/dist/app/use-row-decoration.js +103 -0
  59. package/dist/app/use-screen-list-rows.d.ts +4 -1
  60. package/dist/app/use-screen-list-rows.js +14 -5
  61. package/dist/app/use-screen-list-table.d.ts +3 -1
  62. package/dist/app/use-screen-list-table.js +10 -1
  63. package/dist/app/write-failed-error.d.ts +1 -0
  64. package/dist/app/write-failed-error.js +10 -0
  65. package/dist/card-options.d.ts +25 -0
  66. package/dist/card-options.js +1 -0
  67. package/dist/compact-tap-classes.d.ts +1 -0
  68. package/dist/compact-tap-classes.js +3 -0
  69. package/dist/components/embedded-list-field.js +13 -12
  70. package/dist/components/list-empty-state.d.ts +13 -1
  71. package/dist/components/list-empty-state.js +20 -1
  72. package/dist/components/list-group-page-bridges.d.ts +1 -1
  73. package/dist/components/list-group-page-bridges.js +2 -2
  74. package/dist/components/related-list-section.js +4 -22
  75. package/dist/components/render-edit-action-button.d.ts +3 -1
  76. package/dist/components/render-edit-action-button.js +5 -3
  77. package/dist/components/render-edit-render-model.d.ts +2 -2
  78. package/dist/components/render-edit-types.d.ts +4 -2
  79. package/dist/components/render-edit.js +3 -1
  80. package/dist/components/render-list-hint-columns.d.ts +9 -0
  81. package/dist/components/render-list-hint-columns.js +87 -0
  82. package/dist/components/render-list-reference-columns.js +4 -2
  83. package/dist/components/render-list-row-tone.d.ts +3 -0
  84. package/dist/components/render-list-row-tone.js +10 -0
  85. package/dist/components/render-list-table-props.d.ts +9 -1
  86. package/dist/components/render-list-table-props.js +4 -1
  87. package/dist/components/render-list-toolbar-action.d.ts +1 -2
  88. package/dist/components/render-list-toolbar-model.d.ts +4 -1
  89. package/dist/components/render-list-toolbar-model.js +21 -6
  90. package/dist/components/render-list-toolbar.d.ts +3 -2
  91. package/dist/components/render-list-toolbar.js +8 -6
  92. package/dist/components/render-list-types.d.ts +6 -1
  93. package/dist/components/render-list.js +26 -7
  94. package/dist/components/use-render-edit-controlled-sync.js +3 -5
  95. package/dist/components/use-render-edit-draft-save.js +7 -9
  96. package/dist/components/use-render-edit-schema.d.ts +3 -0
  97. package/dist/components/use-render-edit-schema.js +15 -0
  98. package/dist/components/use-render-edit-state.d.ts +1 -0
  99. package/dist/components/use-render-edit-state.js +4 -1
  100. package/dist/components/use-render-edit-steps.js +2 -3
  101. package/dist/components/use-render-list-columns.d.ts +3 -1
  102. package/dist/components/use-render-list-columns.js +22 -10
  103. package/dist/context/screen-focus-context.d.ts +14 -0
  104. package/dist/context/screen-focus-context.js +28 -0
  105. package/dist/data-table-facet-types.d.ts +6 -0
  106. package/dist/data-table-view-types.d.ts +20 -1
  107. package/dist/headless/form/form-controller.js +3 -1
  108. package/dist/headless/form/zod-bridge.d.ts +7 -1
  109. package/dist/headless/form/zod-bridge.js +10 -0
  110. package/dist/headless/index.d.ts +2 -1
  111. package/dist/headless/index.js +1 -0
  112. package/dist/headless/pwa-service-worker-meta.d.ts +4 -0
  113. package/dist/headless/pwa-service-worker-meta.js +13 -0
  114. package/dist/headless/view-model/index.d.ts +1 -1
  115. package/dist/headless/view-model/list-file-display.js +3 -2
  116. package/dist/headless/view-model/list.js +16 -0
  117. package/dist/headless/view-model/types.d.ts +37 -0
  118. package/dist/hooks/list-column-layout.js +2 -1
  119. package/dist/hooks/list-server-groups.js +14 -1
  120. package/dist/hooks/list-state-schema.d.ts +1 -0
  121. package/dist/hooks/list-state-schema.js +9 -1
  122. package/dist/hooks/use-debounced-value.d.ts +1 -0
  123. package/dist/hooks/use-debounced-value.js +11 -0
  124. package/dist/hooks/use-list-aggregates.d.ts +5 -1
  125. package/dist/hooks/use-list-aggregates.js +9 -5
  126. package/dist/hooks/use-list-table.d.ts +2 -1
  127. package/dist/hooks/use-list-table.js +3 -9
  128. package/dist/hooks/use-list-url-state.d.ts +2 -0
  129. package/dist/hooks/use-list-url-state.js +12 -4
  130. package/dist/hooks/use-list-view-state.js +23 -3
  131. package/dist/hooks/use-reference-lookup.js +7 -2
  132. package/dist/hooks/use-remembered-list-params.d.ts +6 -2
  133. package/dist/hooks/use-remembered-list-params.js +18 -3
  134. package/dist/hooks/use-store.js +0 -1
  135. package/dist/i18n-defaults.js +39 -3
  136. package/dist/index.d.ts +7 -2
  137. package/dist/index.js +4 -1
  138. package/dist/live/dispatcher-live.js +2 -0
  139. package/dist/metric-types.d.ts +4 -0
  140. package/dist/primitives-record-guidance.d.ts +55 -0
  141. package/dist/primitives-record-guidance.js +1 -0
  142. package/dist/primitives.d.ts +47 -54
  143. package/dist/server-clock.d.ts +6 -0
  144. package/dist/server-clock.js +20 -0
  145. package/dist/session/session-ended.d.ts +1 -0
  146. package/dist/session/session-ended.js +2 -2
  147. package/dist/status-tone.d.ts +1 -0
  148. package/dist/status-tone.js +5 -0
  149. package/dist/web/app/browser-locale.js +1 -1
  150. package/dist/web/app/client-plugin.d.ts +6 -1
  151. package/dist/web/app/create-app.d.ts +2 -1
  152. package/dist/web/app/create-app.js +15 -5
  153. package/dist/web/app/dashboard-body.js +25 -11
  154. package/dist/web/app/dashboard-header.d.ts +2 -1
  155. package/dist/web/app/dashboard-header.js +19 -7
  156. package/dist/web/app/dashboard-list-panel.d.ts +12 -0
  157. package/dist/web/app/dashboard-list-panel.js +144 -0
  158. package/dist/web/app/dashboard-narrow-gate.d.ts +6 -0
  159. package/dist/web/app/dashboard-narrow-gate.js +6 -0
  160. package/dist/web/app/dashboard-narrow-order.d.ts +3 -0
  161. package/dist/web/app/dashboard-narrow-order.js +6 -0
  162. package/dist/web/app/dashboard-navigation-link.d.ts +12 -0
  163. package/dist/web/app/dashboard-navigation-link.js +21 -0
  164. package/dist/web/app/dashboard-panels.d.ts +7 -23
  165. package/dist/web/app/dashboard-panels.js +55 -123
  166. package/dist/web/app/dashboard-reference-list-table.d.ts +5 -1
  167. package/dist/web/app/dashboard-reference-list-table.js +13 -4
  168. package/dist/web/app/dashboard-shared.d.ts +23 -7
  169. package/dist/web/app/dashboard-shared.js +45 -17
  170. package/dist/web/app/dashboard-stat-group-panel.d.ts +14 -0
  171. package/dist/web/app/dashboard-stat-group-panel.js +74 -0
  172. package/dist/web/app/dashboard-text-panel.d.ts +12 -0
  173. package/dist/web/app/dashboard-text-panel.js +167 -0
  174. package/dist/web/app/dashboard-text.d.ts +2 -0
  175. package/dist/web/app/dashboard-text.js +1 -1
  176. package/dist/web/app/dashboard-visibility.js +1 -1
  177. package/dist/web/app/relative-time.js +2 -1
  178. package/dist/web/drawn-icons.d.ts +6 -0
  179. package/dist/web/drawn-icons.js +30 -0
  180. package/dist/web/editor/editor-footer.d.ts +28 -0
  181. package/dist/web/editor/editor-footer.js +23 -0
  182. package/dist/web/editor/editor-frame.d.ts +23 -0
  183. package/dist/web/editor/editor-frame.js +24 -0
  184. package/dist/web/editor/editor-header.d.ts +36 -0
  185. package/dist/web/editor/editor-header.js +30 -0
  186. package/dist/web/editor/editor-rail.d.ts +32 -0
  187. package/dist/web/editor/editor-rail.js +37 -0
  188. package/dist/web/editor/editor-workbench.d.ts +34 -0
  189. package/dist/web/editor/editor-workbench.js +19 -0
  190. package/dist/web/editor/index.d.ts +6 -0
  191. package/dist/web/editor/index.js +6 -0
  192. package/dist/web/editor/relative-when.d.ts +1 -0
  193. package/dist/web/editor/relative-when.js +18 -0
  194. package/dist/web/icons.js +6 -5
  195. package/dist/web/index.d.ts +9 -1
  196. package/dist/web/index.js +7 -1
  197. package/dist/web/layout/default-app-shell.js +6 -4
  198. package/dist/web/layout/focus-aware-sidebar.d.ts +4 -7
  199. package/dist/web/layout/focus-aware-sidebar.js +5 -7
  200. package/dist/web/layout/header-action-pinned.d.ts +8 -0
  201. package/dist/web/layout/header-action-pinned.js +25 -0
  202. package/dist/web/layout/nav-collapse-state.d.ts +7 -0
  203. package/dist/web/layout/nav-collapse-state.js +76 -0
  204. package/dist/web/layout/nav-tree.js +71 -28
  205. package/dist/web/layout/notification-bell.d.ts +7 -2
  206. package/dist/web/layout/notification-bell.js +16 -5
  207. package/dist/web/layout/page-header-slot.d.ts +2 -0
  208. package/dist/web/layout/page-header-slot.js +4 -0
  209. package/dist/web/layout/screen-focus.d.ts +8 -0
  210. package/dist/web/layout/screen-focus.js +42 -0
  211. package/dist/web/layout/shell-focus.d.ts +5 -4
  212. package/dist/web/layout/shell-focus.js +14 -7
  213. package/dist/web/layout/shell-header.d.ts +2 -1
  214. package/dist/web/layout/shell-header.js +84 -27
  215. package/dist/web/layout/shell-style.d.ts +3 -0
  216. package/dist/web/layout/shell-style.js +6 -0
  217. package/dist/web/layout/sidebar-open-state.d.ts +6 -0
  218. package/dist/web/layout/sidebar-open-state.js +28 -0
  219. package/dist/web/layout/uniform-bar-controls.d.ts +2 -2
  220. package/dist/web/layout/uniform-bar-controls.js +4 -3
  221. package/dist/web/layout/use-in-app-inbox.js +8 -1
  222. package/dist/web/layout/workspace-shell.d.ts +11 -1
  223. package/dist/web/layout/workspace-shell.js +9 -5
  224. package/dist/web/lib/upload-file-ref.d.ts +2 -2
  225. package/dist/web/lib/upload-file-ref.js +4 -9
  226. package/dist/web/presence/use-presence.js +7 -2
  227. package/dist/web/primitives/banner.d.ts +1 -1
  228. package/dist/web/primitives/banner.js +22 -9
  229. package/dist/web/primitives/calendar-day-picker.js +24 -5
  230. package/dist/web/primitives/card.js +18 -8
  231. package/dist/web/primitives/code-input.js +6 -1
  232. package/dist/web/primitives/data-table/actions-column.d.ts +2 -1
  233. package/dist/web/primitives/data-table/actions-column.js +7 -3
  234. package/dist/web/primitives/data-table/card-body.d.ts +6 -1
  235. package/dist/web/primitives/data-table/card-body.js +53 -6
  236. package/dist/web/primitives/data-table/card-frame.d.ts +8 -0
  237. package/dist/web/primitives/data-table/card-frame.js +9 -0
  238. package/dist/web/primitives/data-table/card-row.js +44 -7
  239. package/dist/web/primitives/data-table/card-sort-select.d.ts +6 -2
  240. package/dist/web/primitives/data-table/card-sort-select.js +10 -7
  241. package/dist/web/primitives/data-table/card-view.js +12 -2
  242. package/dist/web/primitives/data-table/column-picker-section.js +9 -2
  243. package/dist/web/primitives/data-table/column-resize-handle.js +3 -4
  244. package/dist/web/primitives/data-table/column-role.d.ts +1 -0
  245. package/dist/web/primitives/data-table/column-role.js +1 -0
  246. package/dist/web/primitives/data-table/data-cell-props.d.ts +5 -0
  247. package/dist/web/primitives/data-table/data-cell-props.js +5 -0
  248. package/dist/web/primitives/data-table/density.js +1 -0
  249. package/dist/web/primitives/data-table/facet-cluster.d.ts +2 -1
  250. package/dist/web/primitives/data-table/facet-cluster.js +2 -2
  251. package/dist/web/primitives/data-table/group-band.js +4 -0
  252. package/dist/web/primitives/data-table/hint-cell.d.ts +14 -0
  253. package/dist/web/primitives/data-table/hint-cell.js +68 -0
  254. package/dist/web/primitives/data-table/hint-column-width.d.ts +3 -0
  255. package/dist/web/primitives/data-table/hint-column-width.js +11 -0
  256. package/dist/web/primitives/data-table/measure-value.js +2 -3
  257. package/dist/web/primitives/data-table/row-action-column.d.ts +3 -0
  258. package/dist/web/primitives/data-table/row-action-column.js +4 -0
  259. package/dist/web/primitives/data-table/row-render-parts.d.ts +1 -1
  260. package/dist/web/primitives/data-table/row-render-parts.js +3 -2
  261. package/dist/web/primitives/data-table/sort-options-select.d.ts +22 -0
  262. package/dist/web/primitives/data-table/sort-options-select.js +46 -0
  263. package/dist/web/primitives/data-table/sortable-header.d.ts +3 -1
  264. package/dist/web/primitives/data-table/sortable-header.js +5 -3
  265. package/dist/web/primitives/data-table/table-body.d.ts +1 -1
  266. package/dist/web/primitives/data-table/table-body.js +5 -3
  267. package/dist/web/primitives/data-table/table-chrome.js +3 -1
  268. package/dist/web/primitives/data-table/table-content.js +12 -7
  269. package/dist/web/primitives/data-table/table-data-cell.js +9 -3
  270. package/dist/web/primitives/data-table/table-header-row.js +5 -2
  271. package/dist/web/primitives/data-table/table-view.js +22 -3
  272. package/dist/web/primitives/data-table/toolbar-end-cluster.js +1 -1
  273. package/dist/web/primitives/data-table/toolbar.d.ts +2 -0
  274. package/dist/web/primitives/data-table/toolbar.js +70 -7
  275. package/dist/web/primitives/data-table/totals-footer.d.ts +20 -0
  276. package/dist/web/primitives/data-table/totals-footer.js +41 -9
  277. package/dist/web/primitives/data-table/use-bulk-selection.js +2 -1
  278. package/dist/web/primitives/data-table/use-column-pins.js +4 -0
  279. package/dist/web/primitives/data-table/use-data-table-state.d.ts +1 -0
  280. package/dist/web/primitives/data-table/use-data-table-state.js +9 -5
  281. package/dist/web/primitives/data-table/use-measured-column-widths.js +5 -4
  282. package/dist/web/primitives/data-table/use-row-selection.js +22 -11
  283. package/dist/web/primitives/data-table/view-menu.js +7 -1
  284. package/dist/web/primitives/data-table-cell.d.ts +21 -2
  285. package/dist/web/primitives/data-table-cell.js +129 -26
  286. package/dist/web/primitives/embedded-file-cell.js +3 -2
  287. package/dist/web/primitives/embedded-list-cards.js +3 -4
  288. package/dist/web/primitives/facet-filter.d.ts +5 -3
  289. package/dist/web/primitives/facet-filter.js +36 -5
  290. package/dist/web/primitives/facet-search-filter.d.ts +2 -1
  291. package/dist/web/primitives/facet-search-filter.js +3 -2
  292. package/dist/web/primitives/facet-trigger-label.d.ts +8 -0
  293. package/dist/web/primitives/facet-trigger-label.js +9 -0
  294. package/dist/web/primitives/file-thumbnail.d.ts +6 -2
  295. package/dist/web/primitives/file-thumbnail.js +13 -6
  296. package/dist/web/primitives/file-upload.js +3 -2
  297. package/dist/web/primitives/file-view-action.d.ts +6 -0
  298. package/dist/web/primitives/file-view-action.js +22 -0
  299. package/dist/web/primitives/files-dropzone.js +20 -9
  300. package/dist/web/primitives/form-footer-parts.d.ts +0 -1
  301. package/dist/web/primitives/form.js +0 -1
  302. package/dist/web/primitives/hint-reason-row.d.ts +32 -0
  303. package/dist/web/primitives/hint-reason-row.js +45 -0
  304. package/dist/web/primitives/index.js +6 -0
  305. package/dist/web/primitives/layout-elements.d.ts +1 -1
  306. package/dist/web/primitives/layout-elements.js +3 -3
  307. package/dist/web/primitives/metric.js +20 -6
  308. package/dist/web/primitives/page-header.d.ts +1 -1
  309. package/dist/web/primitives/page-header.js +10 -2
  310. package/dist/web/primitives/pager.d.ts +3 -2
  311. package/dist/web/primitives/pager.js +31 -24
  312. package/dist/web/primitives/reason-box.d.ts +20 -0
  313. package/dist/web/primitives/reason-box.js +13 -0
  314. package/dist/web/primitives/record-breadcrumb.d.ts +3 -0
  315. package/dist/web/primitives/record-breadcrumb.js +11 -0
  316. package/dist/web/primitives/record-steps.d.ts +3 -0
  317. package/dist/web/primitives/record-steps.js +50 -0
  318. package/dist/web/primitives/record-summary.d.ts +3 -0
  319. package/dist/web/primitives/record-summary.js +18 -0
  320. package/dist/web/primitives/row-actions.d.ts +3 -1
  321. package/dist/web/primitives/row-actions.js +14 -5
  322. package/dist/web/primitives/segmented-select.js +10 -9
  323. package/dist/web/primitives/tabs.js +6 -1
  324. package/dist/web/pwa/pwa-support.d.ts +4 -0
  325. package/dist/web/pwa/pwa-support.js +131 -0
  326. package/dist/web/sse/live-events.js +2 -2
  327. package/dist/web/tokens.js +0 -3
  328. package/dist/web/ui/sidebar.d.ts +2 -1
  329. package/dist/web/ui/sidebar.js +4 -3
  330. package/dist/web/widgets/ai-text-field.js +3 -2
  331. package/dist/web/widgets/chart-parts.d.ts +7 -1
  332. package/dist/web/widgets/chart-parts.js +10 -4
  333. package/dist/web/widgets/collapsible-section.js +1 -1
  334. package/dist/web/widgets/dashboard-list-cards.d.ts +17 -0
  335. package/dist/web/widgets/dashboard-list-cards.js +46 -0
  336. package/dist/web/widgets/dashboard-list.d.ts +45 -5
  337. package/dist/web/widgets/dashboard-list.js +126 -25
  338. package/dist/web/widgets/drawer-panel-class.d.ts +1 -0
  339. package/dist/web/widgets/drawer-panel-class.js +9 -1
  340. package/dist/web/widgets/drawer-sizing.js +1 -1
  341. package/dist/web/widgets/drawer.js +2 -2
  342. package/dist/web/widgets/floating-panel.js +4 -2
  343. package/dist/web/widgets/index.d.ts +2 -0
  344. package/dist/web/widgets/index.js +2 -0
  345. package/dist/web/widgets/infinity-list.js +18 -11
  346. package/dist/web/widgets/pdf-viewer-toolbar.js +3 -2
  347. package/dist/web/widgets/preview-width-frame.d.ts +7 -0
  348. package/dist/web/widgets/preview-width-frame.js +10 -0
  349. package/dist/web/widgets/section-card.d.ts +1 -1
  350. package/dist/web/widgets/sheet-parts.js +3 -1
  351. package/dist/web/widgets/stacked-area-chrome.js +3 -3
  352. package/dist/web/widgets/stacked-area-tooltip.js +2 -10
  353. package/dist/web/widgets/stat-box-cell.d.ts +19 -0
  354. package/dist/web/widgets/stat-box-cell.js +10 -0
  355. package/dist/web/widgets/stat.d.ts +16 -1
  356. package/dist/web/widgets/stat.js +24 -7
  357. package/dist/web/widgets/status-badge.d.ts +7 -5
  358. package/dist/web/widgets/status-badge.js +2 -2
  359. package/dist/web/widgets/step-bar.d.ts +1 -1
  360. package/dist/web/widgets/step-bar.js +37 -7
  361. package/dist/web/widgets/step-list-row.d.ts +4 -0
  362. package/dist/web/widgets/step-list-row.js +22 -14
  363. package/dist/web/widgets/step-list.d.ts +12 -4
  364. package/dist/web/widgets/step-list.js +38 -20
  365. package/dist/web/widgets/upload-zone.d.ts +8 -1
  366. package/dist/web/widgets/upload-zone.js +13 -3
  367. package/package.json +5 -5
  368. package/src/changes.json +289 -0
  369. package/src/web/styles.css +15 -0
@@ -1,22 +1,21 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { normalizeListColumn } from "@cosmicdrift/kumiko-framework/ui-types";
3
2
  import { DASHBOARD_STAT_TONES } from "@cosmicdrift/kumiko-types/screen";
4
3
  import { isOneOf } from "@cosmicdrift/kumiko-types/type-guards";
5
4
  import { useEffect, useState } from "react";
5
+ import { namedFilterNavigateAllows, navigateTargetAllows } from "../../app/screen-access.js";
6
6
  import { rendererWarn } from "../../dev-console.js";
7
7
  import { EMPTY_VALUE_PLACEHOLDER } from "../../headless/index.js";
8
- import { listNamedFilterUrlKey } from "../../hooks/use-list-url-state.js";
9
- import { extensionSectionName, lastSegment, useExtensionSectionComponent, useNav, usePrimitives, useTranslation, useUserRoles, } from "../../index.js";
8
+ import { extensionSectionName, useAppFeatures, useExtensionSectionComponent, useNav, useTranslation, useUserRoles, } from "../../index.js";
10
9
  import { initialWindowSelection, } from "../widgets/chart-window.js";
11
10
  import { chartToneColor, SegmentBarChart, StackedAreaChart, StackedBarChart, TimeseriesChart, } from "../widgets/charts.js";
12
11
  import { FeedList } from "../widgets/feed-list.js";
13
12
  import { ModeSwitch } from "../widgets/mode-switch.js";
14
13
  import { ProgressList } from "../widgets/progress-list.js";
15
- import { SectionCard } from "../widgets/section-card.js";
16
- import { STAT_CARD_GRID_CLASSES, StatCard, StatStripCell, } from "../widgets/stat.js";
14
+ import { StatCard, StatStripCell, } from "../widgets/stat.js";
15
+ import { StatBoxCell } from "../widgets/stat-box-cell.js";
17
16
  import { EmptyState, LoadingState } from "../widgets/states.js";
18
- import { DashboardReferenceListTable } from "./dashboard-reference-list-table.js";
19
- import { DAY_MS, HOUR_MS, PanelError, PanelShell, panelPayload, QueryPanel, useDashboardFormats, useDashboardQuery, useReportPanelLoaded, } from "./dashboard-shared.js";
17
+ import { optionalDashboardNavigationLink } from "./dashboard-navigation-link.js";
18
+ import { DAY_MS, HOUR_MS, PanelError, panelPayload, QueryPanel, useDashboardFormats, useDashboardQuery, useReportPanelLoaded, } from "./dashboard-shared.js";
20
19
  import { isRecord, resolveDashboardText } from "./dashboard-text.js";
21
20
  function isSparkPoint(value) {
22
21
  return (typeof value === "object" &&
@@ -40,10 +39,24 @@ function fallbackText(raw, placeholder) {
40
39
  return placeholder;
41
40
  return String(raw);
42
41
  }
43
- export function StatPanelBody({ panel, label, screenId, screenParams, translate, variant, }) {
42
+ // Hidden before any query hook runs: the tile's own count query would be refused for this user.
43
+ export function useStatNavigateAllowed() {
44
+ const appFeatures = useAppFeatures();
45
+ const userRoles = useUserRoles();
46
+ return ({ navigate }) => navigate === undefined ||
47
+ (navigateTargetAllows({ screen: navigate.screen }, appFeatures, userRoles) &&
48
+ namedFilterNavigateAllows(navigate, appFeatures, userRoles));
49
+ }
50
+ export function StatPanelBody(props) {
51
+ const navigateAllowed = useStatNavigateAllowed();
52
+ if (!navigateAllowed(props.panel))
53
+ return null;
54
+ return _jsx(StatPanelContent, { ...props });
55
+ }
56
+ function StatPanelContent({ panel, label, screenId, screenParams, translate, variant, }) {
44
57
  const formats = useDashboardFormats();
45
58
  const nav = useNav();
46
- const link = statNavigationLink(nav, panel.navigate);
59
+ const link = optionalDashboardNavigationLink(nav, panel.navigate);
47
60
  // Resolved HERE (not in a separate always-rendered child) so `icon` on
48
61
  // <StatCard> is `undefined` — not a React element that renders empty —
49
62
  // when the icon name isn't registered. StatCard gates its accent chip on
@@ -60,7 +73,7 @@ export function StatPanelBody({ panel, label, screenId, screenParams, translate,
60
73
  const { data, error, loading, refetch } = useDashboardQuery(panel.query,
61
74
  // A navigate tile counts exactly what its target list can reproduce from the URL.
62
75
  panel.navigate === undefined ? panelPayload(panel, screenParams) : (panel.params ?? {}));
63
- useReportPanelLoaded(data);
76
+ useReportPanelLoaded(data, loading);
64
77
  if (loading && data === null)
65
78
  return _jsx(LoadingState, { rows: 2 });
66
79
  if (error !== null) {
@@ -72,40 +85,45 @@ export function StatPanelBody({ panel, label, screenId, screenParams, translate,
72
85
  // A fixed tone must not paint an all-clear "0" as an alarm.
73
86
  (rawValue === 0 ? undefined : panel.tone);
74
87
  const sub = panel.subField !== undefined ? record[panel.subField] : undefined;
88
+ const dynamicLabel = panel.labelField !== undefined ? record[panel.labelField] : undefined;
89
+ const shownLabel = typeof dynamicLabel === "string" && dynamicLabel !== "" ? dynamicLabel : label;
75
90
  const delta = readDelta(panel, record);
76
- const valueFormat = panel.valueFormat;
77
- let value;
78
- if (typeof rawValue !== "number") {
79
- value =
80
- resolveDashboardText(rawValue, translate, formats) ??
81
- fallbackText(rawValue, EMPTY_VALUE_PLACEHOLDER);
82
- }
83
- else if (valueFormat?.kind === "relativeTime") {
84
- value = formats.formatRelative(rawValue);
85
- }
86
- else {
87
- value = formats.formatPanelValue(valueFormat)(rawValue);
88
- }
91
+ const value = statValueText(rawValue, panel.valueFormat, translate, formats);
89
92
  const spark = readSparkline(panel, record);
90
93
  const testId = `dashboard-panel-${panel.id}`;
91
94
  const subText = resolveDashboardText(sub, translate, formats) ?? fallbackText(sub, undefined);
92
95
  const icon = Icon !== undefined ? (_jsx(Icon, { entityName: screenId, entityId: null, screenId: screenId, filterParams: screenParams.filterParams })) : undefined;
93
- if (variant === "strip") {
94
- return (_jsx(StatStripCell, { icon: icon, label: label, value: value, tone: tone ?? "default", ...(Icon !== undefined && { accentColor: panel.accentColor }), ...(subText !== undefined && { sub: subText }), ...(delta !== undefined && { delta }), ...(spark !== undefined && { spark }), testId: testId, ...(link !== undefined && { link }) }));
96
+ const narrowLabel = panel.narrowLabel !== undefined ? translate(panel.narrowLabel) : undefined;
97
+ return (_jsx(StatVariantCell, { variant: variant, cell: {
98
+ icon,
99
+ label: shownLabel,
100
+ value,
101
+ tone: tone ?? "default",
102
+ testId,
103
+ ...(narrowLabel !== undefined && { narrowLabel }),
104
+ ...(Icon !== undefined && { accentColor: panel.accentColor }),
105
+ ...(subText !== undefined && { sub: subText }),
106
+ ...(delta !== undefined && { delta }),
107
+ ...(spark !== undefined && { spark }),
108
+ ...(link !== undefined && { link }),
109
+ } }));
110
+ }
111
+ function StatVariantCell({ variant, cell, }) {
112
+ if (variant === "strip-compact") {
113
+ const { accentColor: _unused, ...boxCell } = cell;
114
+ return _jsx(StatBoxCell, { ...boxCell });
95
115
  }
96
- return (_jsx(StatCard, { icon: icon, label: label, value: value, tone: tone ?? "default", ...(Icon !== undefined && { accentColor: panel.accentColor }), ...(subText !== undefined && { sub: subText }), ...(delta !== undefined && { delta }), ...(spark !== undefined && { spark }), testId: testId, ...(link !== undefined && { link }) }));
116
+ const { narrowLabel: _narrow, ...tileCell } = cell;
117
+ return variant === "strip" ? _jsx(StatStripCell, { ...tileCell }) : _jsx(StatCard, { ...tileCell, inset: true });
97
118
  }
98
- function statNavigationLink(nav, navigate) {
99
- if (navigate === undefined)
100
- return undefined;
101
- const target = { screenId: lastSegment(navigate.screen) };
102
- const options = navigate.namedFilter === undefined
103
- ? undefined
104
- : { searchParams: { [listNamedFilterUrlKey(target.screenId)]: navigate.namedFilter } };
105
- return {
106
- href: nav.hrefFor(target, options),
107
- onPress: () => nav.navigate(target, options),
108
- };
119
+ function statValueText(rawValue, valueFormat, translate, formats) {
120
+ if (typeof rawValue !== "number") {
121
+ return (resolveDashboardText(rawValue, translate, formats) ??
122
+ fallbackText(rawValue, EMPTY_VALUE_PLACEHOLDER));
123
+ }
124
+ if (valueFormat?.kind === "relativeTime")
125
+ return formats.formatRelative(rawValue);
126
+ return formats.formatPanelValue(valueFormat)(rawValue);
109
127
  }
110
128
  function readDelta(panel, record) {
111
129
  if (panel.deltaField === undefined || panel.deltaDirectionField === undefined)
@@ -119,13 +137,6 @@ function readDelta(panel, record) {
119
137
  const tone = readTone(panel.deltaToneField !== undefined ? record[panel.deltaToneField] : undefined);
120
138
  return { value: String(value), direction, ...(tone !== undefined && { tone }) };
121
139
  }
122
- export function StatGroupPanelBody({ panel, label, screenId, screenParams, translate, }) {
123
- const testId = `dashboard-panel-${panel.id}`;
124
- if (label === undefined) {
125
- return (_jsx("div", { "data-testid": testId, className: "grid grid-cols-2 gap-y-2 rounded-lg border border-border bg-card py-1 lg:auto-cols-fr lg:grid-flow-col lg:divide-x lg:divide-border-row", children: panel.stats.map((stat) => (_jsx(StatPanelBody, { panel: stat, label: translate(stat.label), screenId: screenId, screenParams: screenParams, translate: translate, variant: "strip" }, stat.id))) }));
126
- }
127
- return (_jsx(SectionCard, { title: label, ...(panel.subtitle !== undefined && { subtitle: translate(panel.subtitle) }), testId: testId, children: _jsx("section", { className: STAT_CARD_GRID_CLASSES, children: panel.stats.map((stat) => (_jsx(StatPanelBody, { panel: stat, label: translate(stat.label), screenId: screenId, screenParams: screenParams, translate: translate, variant: "card" }, stat.id))) }) }));
128
- }
129
140
  function markerKindColor(kind) {
130
141
  if (kind === undefined)
131
142
  return undefined;
@@ -239,29 +250,6 @@ export function ChartPanelBody({ panel, label, screenParams, translate, }) {
239
250
  }), ariaLabel: label, testId: testId }));
240
251
  } }));
241
252
  }
242
- export function ListPanelBody({ panel, label, featureName, screenParams, translate, }) {
243
- const { formatPercent, formatNumber, formatDateTime } = useDashboardFormats();
244
- const columns = panel.columns.map((c) => {
245
- const normalized = normalizeListColumn(c);
246
- return {
247
- field: normalized.field,
248
- label: translate(normalized.label ?? normalized.field),
249
- ...(normalized.display !== undefined && { display: normalized.display }),
250
- ...(normalized.badgeToneField !== undefined && {
251
- badgeToneField: normalized.badgeToneField,
252
- }),
253
- ...(normalized.refEntity !== undefined && {
254
- reference: {
255
- refEntity: normalized.refEntity,
256
- ...(normalized.refLabelField !== undefined && {
257
- refLabelField: normalized.refLabelField,
258
- }),
259
- },
260
- }),
261
- };
262
- });
263
- return (_jsx(QueryPanel, { panel: panel, label: label, screenParams: screenParams, translate: translate, skeleton: "rows", isEmpty: (data) => (data.rows ?? []).length === 0, children: (data) => (_jsx(DashboardReferenceListTable, { columns: columns, rows: data.rows ?? [], featureName: featureName, formatPercent: formatPercent, formatNumber: formatNumber, formatDateTime: formatDateTime, translate: translate })) }));
264
- }
265
253
  export function FeedPanelBody({ panel, label, screenParams, translate, }) {
266
254
  return (_jsx(QueryPanel, { panel: panel, label: label, screenParams: screenParams, translate: translate, skeleton: "rows", isEmpty: (data) => (data.rows ?? []).length === 0, children: (data, formats) => {
267
255
  const rows = (data.rows ?? []).map((row, i) => {
@@ -327,62 +315,6 @@ export function ProgressListPanelBody({ panel, label, screenParams, translate, }
327
315
  return _jsx(ProgressList, { rows: rows });
328
316
  } }));
329
317
  }
330
- function TextBlockView({ block, translate, }) {
331
- switch (block.kind) {
332
- case "heading":
333
- return (_jsx("h3", { "data-block": "heading", className: "text-sm font-semibold text-foreground", children: translate(block.text) }));
334
- case "paragraph":
335
- return (_jsx("p", { "data-block": "paragraph", className: block.emphasis === "strong"
336
- ? "text-sm font-medium text-foreground"
337
- : "text-sm text-muted-foreground", children: translate(block.text) }));
338
- case "list":
339
- return (_jsx("ul", { "data-block": "list", className: "list-disc space-y-1 pl-5 text-sm text-muted-foreground", children: withOccurrenceKeys(block.items, (item) => item).map(({ entry, key }) => (_jsx("li", { children: translate(entry) }, key))) }));
340
- case "code":
341
- return (_jsx("pre", { "data-block": "code", className: "overflow-x-auto rounded-md bg-muted p-3 text-xs", children: _jsx("code", { children: block.code }) }));
342
- case "hint":
343
- return (_jsx("p", { "data-block": "hint", className: "text-xs text-muted-foreground", children: translate(block.text) }));
344
- case "link":
345
- return _jsx(TextBlockLink, { block: block, translate: translate });
346
- }
347
- }
348
- function TextBlockLink({ block, translate, }) {
349
- const { Link } = usePrimitives();
350
- const nav = useNav();
351
- const userRoles = useUserRoles();
352
- if (block.roles !== undefined && !block.roles.some((role) => userRoles?.includes(role))) {
353
- return null;
354
- }
355
- const target = { screenId: lastSegment(block.screen) };
356
- return (_jsx(Link, { href: nav.hrefFor(target), onPress: () => nav.navigate(target), testId: `dashboard-text-link-${target.screenId}`, children: translate(block.text) }));
357
- }
358
- // Content-derived keys collide for identical entries; the occurrence count keeps them unique.
359
- function withOccurrenceKeys(entries, contentKey) {
360
- const seen = new Map();
361
- return entries.map((entry) => {
362
- const content = contentKey(entry);
363
- const occurrence = seen.get(content) ?? 0;
364
- seen.set(content, occurrence + 1);
365
- return { entry, key: `${content}#${occurrence}` };
366
- });
367
- }
368
- function textBlockKey(block) {
369
- switch (block.kind) {
370
- case "list":
371
- return `list:${block.items.join("|")}`;
372
- case "code":
373
- return `code:${block.code}`;
374
- default:
375
- return `${block.kind}:${block.text}`;
376
- }
377
- }
378
- export function TextPanelBody({ panel, label, translate, }) {
379
- const blocks = (_jsx("div", { className: "flex flex-col gap-3", children: withOccurrenceKeys(panel.blocks, textBlockKey).map(({ entry, key }) => (_jsx(TextBlockView, { block: entry, translate: translate }, key))) }));
380
- const testId = `dashboard-panel-${panel.id}`;
381
- if (label !== undefined) {
382
- return (_jsx(PanelShell, { testId: testId, title: label, children: blocks }));
383
- }
384
- return (_jsx("section", { "data-testid": testId, className: "h-full rounded-lg border border-border bg-card p-4 text-card-foreground", children: blocks }));
385
- }
386
318
  // Resolves panel.component through the same extensionSectionComponents
387
319
  // registry as entityEdit extension sections and list header slots; it
388
320
  // stays at its array position instead of moving into a separate slot (see
@@ -12,6 +12,10 @@ type Props = Omit<ComponentProps<typeof DashboardListTable>, "columns"> & {
12
12
  readonly columns: readonly DashboardListTableColumn[];
13
13
  readonly featureName: string;
14
14
  readonly translate: Translate;
15
+ /** Phone layout: one card per row instead of the table. */
16
+ readonly narrowCards?: boolean;
17
+ /** Row field whose text replaces the card title in the phone layout. */
18
+ readonly titleField?: string;
15
19
  };
16
- export declare function DashboardReferenceListTable({ columns, rows, featureName, translate, ...tableProps }: Props): ReactNode;
20
+ export declare function DashboardReferenceListTable({ columns, rows, featureName, translate, narrowCards, titleField, ...tableProps }: Props): ReactNode;
17
21
  export {};
@@ -6,6 +6,7 @@ import { renderReferenceLookupBridges } from "../../components/render-list-refer
6
6
  import { enrichReferenceColumns, selectReferenceColumns, } from "../../components/render-list-reference-columns.js";
7
7
  import { useReferenceColumnLookups } from "../../components/use-reference-column-lookups.js";
8
8
  import { DashboardListTable } from "../widgets/dashboard-list.js";
9
+ import { DashboardListCards } from "../widgets/dashboard-list-cards.js";
9
10
  function toReferenceViewColumn(column, featureName) {
10
11
  if (column.reference === undefined)
11
12
  return undefined;
@@ -18,11 +19,12 @@ function toReferenceViewColumn(column, featureName) {
18
19
  refEntity: target.entityName,
19
20
  refFeature: target.featureName,
20
21
  refLabelField: column.reference.refLabelField ?? "id",
22
+ ...(column.emptyPlaceholder !== undefined && { emptyPlaceholder: column.emptyPlaceholder }),
21
23
  };
22
24
  }
23
25
  // Dashboard list rows carry raw ids; reference columns resolve them to the target's label
24
26
  // the way entity lists do.
25
- export function DashboardReferenceListTable({ columns, rows, featureName, translate, ...tableProps }) {
27
+ export function DashboardReferenceListTable({ columns, rows, featureName, translate, narrowCards = false, titleField, ...tableProps }) {
26
28
  const viewColumns = useMemo(() => columns.flatMap((column) => {
27
29
  const viewColumn = toReferenceViewColumn(column, featureName);
28
30
  return viewColumn === undefined ? [] : [viewColumn];
@@ -39,9 +41,16 @@ export function DashboardReferenceListTable({ columns, rows, featureName, transl
39
41
  translate,
40
42
  }), [viewColumns, referenceColumns, referenceLookups, resolveReferenceLink, featureName, translate]);
41
43
  const tableColumns = columns.map((column) => {
42
- const renderer = enriched.find((c) => c.field === column.field)?.renderer;
44
+ const enrichedColumn = enriched.find((c) => c.field === column.field);
45
+ const renderer = enrichedColumn?.renderer;
43
46
  const { reference: _reference, ...base } = column;
44
- return typeof renderer === "function" ? { ...base, renderValue: renderer } : base;
47
+ if (typeof renderer !== "function")
48
+ return base;
49
+ return {
50
+ ...base,
51
+ renderValue: renderer,
52
+ ...(enrichedColumn?.linkFor !== undefined && { linkFor: enrichedColumn.linkFor }),
53
+ };
45
54
  });
46
- return (_jsxs(_Fragment, { children: [renderReferenceLookupBridges(referenceRequests, handleLookupMap), _jsx(DashboardListTable, { columns: tableColumns, rows: rows, translate: translate, ...tableProps })] }));
55
+ return (_jsxs(_Fragment, { children: [renderReferenceLookupBridges(referenceRequests, handleLookupMap), narrowCards ? (_jsx(DashboardListCards, { columns: tableColumns, rows: rows, translate: translate, formatPercent: tableProps.formatPercent, formatNumber: tableProps.formatNumber, formatDateTime: tableProps.formatDateTime, ...(tableProps.testId !== undefined && { testId: tableProps.testId }), ...(tableProps.rowToneField !== undefined && { rowToneField: tableProps.rowToneField }), ...(titleField !== undefined && { titleField }) })) : (_jsx(DashboardListTable, { columns: tableColumns, rows: rows, translate: translate, ...tableProps }))] }));
47
56
  }
@@ -2,8 +2,11 @@ import type { DashboardCurrencyFormat, DashboardPanelEmptyState, DashboardPanelQ
2
2
  import { type ReactNode } from "react";
3
3
  import { type Translate } from "../../headless/index.ts";
4
4
  import { dispatcherErrorText, type UseQueryResult } from "../../index.ts";
5
- export declare const WIDE_PANEL = "sm:col-span-2 lg:col-span-4";
6
- export declare const HALF_PANEL = "sm:col-span-2 lg:col-span-2";
5
+ export declare const STAT_PANEL = "lg:col-span-3";
6
+ export declare const WIDE_PANEL = "sm:col-span-2 lg:col-span-12";
7
+ export declare const HALF_PANEL = "sm:col-span-2 lg:col-span-6";
8
+ export declare const THIRD_PANEL = "lg:col-span-4";
9
+ export declare const TWO_THIRDS_PANEL = "sm:col-span-2 lg:col-span-8";
7
10
  export declare const HOUR_MS = 3600000;
8
11
  export declare const DAY_MS: number;
9
12
  export type ScreenParams = {
@@ -41,6 +44,8 @@ export type DashboardFormats = {
41
44
  readonly formatMonth: (atMs: number) => string;
42
45
  readonly formatHour: (atMs: number) => string;
43
46
  readonly formatDateTime: (atMs: number) => string;
47
+ /** Weekday and full date, no time: "Tuesday, 3 November 2026". */
48
+ readonly formatLongDate: (atMs: number) => string;
44
49
  readonly formatMedium: (atMs: number) => string;
45
50
  readonly formatMinor: (amountMinor: number, currency: string, fractionDigits?: number) => string;
46
51
  /** "5 minutes ago"; the component that called `useDashboardFormats` redraws on a
@@ -52,11 +57,13 @@ export type DashboardFormats = {
52
57
  readonly formatPanelAxisValue: (valueFormat: DashboardCurrencyFormat | undefined) => (value: number) => string;
53
58
  };
54
59
  export declare function useDashboardFormats(): DashboardFormats;
55
- export declare function PanelShell({ testId, title, subtitle, action, children, }: {
60
+ export declare function PanelShell({ testId, title, subtitle, action, footer, children, }: {
56
61
  readonly testId: string;
57
- readonly title: string;
62
+ /** Without a title the panel has no header (a titleless stat-group). */
63
+ readonly title?: string;
58
64
  readonly subtitle?: string;
59
65
  readonly action?: ReactNode;
66
+ readonly footer?: ReactNode;
60
67
  readonly children: ReactNode;
61
68
  }): ReactNode;
62
69
  export declare function PanelError({ label, error, onRetry, testId, }: {
@@ -66,14 +73,23 @@ export declare function PanelError({ label, error, onRetry, testId, }: {
66
73
  readonly testId?: string;
67
74
  }): ReactNode;
68
75
  type SkeletonShape = "bars" | "segments" | "rows";
76
+ export declare function PanelSkeleton({ shape }: {
77
+ readonly shape: SkeletonShape;
78
+ }): ReactNode;
69
79
  type QueryPanelProps<TData> = {
70
80
  readonly panel: DashboardPanelQueryOptions & DashboardPanelEmptyState & {
71
81
  readonly id: string;
72
82
  readonly query: string;
73
83
  };
74
84
  readonly label: string;
75
- readonly subtitle?: string;
85
+ /** A function derives the line from the loaded data (e.g. "n of m"); `staticSubtitle` stands in until then. */
86
+ readonly subtitle?: string | ((data: TData) => string | undefined);
87
+ readonly staticSubtitle?: string;
76
88
  readonly action?: ReactNode;
89
+ /** Rendered under the body, only once data is shown. */
90
+ readonly footer?: (data: TData) => ReactNode;
91
+ /** Replaces the whole panel shell once data is shown, e.g. a one-line summary on phones. */
92
+ readonly replaceShell?: (data: TData) => ReactNode;
77
93
  readonly screenParams: ScreenParams;
78
94
  readonly translate: Translate;
79
95
  readonly skeleton: SkeletonShape;
@@ -82,11 +98,11 @@ type QueryPanelProps<TData> = {
82
98
  * redraws this panel and nothing else. */
83
99
  readonly children: (data: TData, formats: DashboardFormats) => ReactNode;
84
100
  };
85
- export declare function QueryPanel<TData>({ panel, label, subtitle, action, screenParams, translate, skeleton, isEmpty, children, }: QueryPanelProps<TData>): ReactNode;
101
+ export declare function QueryPanel<TData>({ panel, label, subtitle, staticSubtitle, action, footer, replaceShell, screenParams, translate, skeleton, isEmpty, children, }: QueryPanelProps<TData>): ReactNode;
86
102
  export declare function useLoadedAt(screenParams: ScreenParams): {
87
103
  readonly loadedAtMs: number;
88
104
  readonly reportLoaded: (atMs: number) => void;
89
105
  };
90
106
  export declare const PanelLoadedContext: import("react").Context<(atMs: number) => void>;
91
- export declare function useReportPanelLoaded(data: unknown): void;
107
+ export declare function useReportPanelLoaded(data: unknown, loading: boolean): void;
92
108
  export {};
@@ -2,14 +2,20 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { createContext, useCallback, useContext, useEffect, useRef, useState, } from "react";
3
3
  import { currencyDecimals } from "../../headless/index.js";
4
4
  import { dispatcherErrorText, useLocale, usePrimitives, useQuery, useTranslation, } from "../../index.js";
5
+ import { serverNowMs } from "../../server-clock.js";
6
+ import { cn } from "../lib/cn.js";
5
7
  import { resolveSafeLocale } from "../primitives/locale-number.js";
6
8
  import { formatMoney } from "../primitives/money-input.js";
7
9
  import { Skeleton } from "../ui/skeleton.js";
8
10
  import { EmptyState, LoadingState } from "../widgets/states.js";
9
11
  import { useRelativeTimeFormatter } from "./relative-time.js";
10
12
  const SKELETON_SEGMENT_WIDTHS = ["100%", "72%", "48%"];
11
- export const WIDE_PANEL = "sm:col-span-2 lg:col-span-4";
12
- export const HALF_PANEL = "sm:col-span-2 lg:col-span-2";
13
+ // The dashboard grid has twelve columns on wide screens, so a stat tile is a quarter of the row.
14
+ export const STAT_PANEL = "lg:col-span-3";
15
+ export const WIDE_PANEL = "sm:col-span-2 lg:col-span-12";
16
+ export const HALF_PANEL = "sm:col-span-2 lg:col-span-6";
17
+ export const THIRD_PANEL = "lg:col-span-4";
18
+ export const TWO_THIRDS_PANEL = "sm:col-span-2 lg:col-span-8";
13
19
  const CURRENCY_CODE_PATTERN = /^[A-Za-z]{3}$/;
14
20
  export const HOUR_MS = 3_600_000;
15
21
  export const DAY_MS = 24 * HOUR_MS;
@@ -80,6 +86,7 @@ export function useDashboardFormats() {
80
86
  timeStyle: "short",
81
87
  timeZone,
82
88
  });
89
+ const longDate = new Intl.DateTimeFormat(locale, { dateStyle: "full", timeZone });
83
90
  const medium = new Intl.DateTimeFormat(locale, { dateStyle: "medium", timeZone });
84
91
  const formatMinor = (amountMinor, currency, fractionDigits) => formatMoney(amountMinor, currency, locale, fractionDigits);
85
92
  return {
@@ -108,17 +115,18 @@ export function useDashboardFormats() {
108
115
  formatMonth: (atMs) => month.format(atMs),
109
116
  formatHour: (atMs) => hour.format(atMs),
110
117
  formatDateTime: (atMs) => dateTime.format(atMs),
118
+ formatLongDate: (atMs) => longDate.format(atMs),
111
119
  };
112
120
  }
113
- export function PanelShell({ testId, title, subtitle, action, children, }) {
114
- return (_jsxs("section", { "data-testid": testId, className: "flex h-full flex-col rounded-lg border border-border bg-card text-card-foreground", children: [_jsxs("header", { className: "flex min-h-11 shrink-0 flex-wrap items-center justify-between gap-x-3 gap-y-2 border-b border-border-row px-4 py-2", children: [_jsxs("div", { className: "flex min-w-0 flex-col gap-0.5", children: [_jsx("h2", { className: "text-sm font-semibold break-words", children: title }), subtitle !== undefined && _jsx("p", { className: "text-xs text-muted-foreground", children: subtitle })] }), action !== undefined && _jsx("div", { className: "shrink-0", children: action })] }), _jsx("div", { className: "grow p-4", children: children })] }));
121
+ export function PanelShell({ testId, title, subtitle, action, footer, children, }) {
122
+ return (_jsxs("section", { "data-testid": testId, className: "flex h-full flex-col rounded-lg border border-border bg-card text-card-foreground shadow-[var(--card-shadow)]", children: [(title !== undefined || action !== undefined) && (_jsxs("header", { className: "flex shrink-0 flex-wrap items-baseline justify-between gap-x-3 gap-y-2 px-4 pt-3.5", children: [_jsxs("div", { className: "flex min-w-0 flex-col gap-0.5 sm:flex-row sm:flex-wrap sm:items-baseline sm:gap-x-2.5", children: [title !== undefined && _jsx("h2", { className: "text-sm font-semibold break-words", children: title }), subtitle !== undefined && (_jsx("p", { className: "text-[12.5px] text-muted-foreground", children: subtitle }))] }), action !== undefined && _jsx("div", { className: "shrink-0", children: action })] })), _jsx("div", { className: cn("grow px-4 pt-3", footer === undefined && "pb-4"), children: children }), footer !== undefined && (_jsx("footer", { className: "mx-4 mb-4 mt-2.5 flex shrink-0 flex-wrap items-center gap-x-1 border-t border-border-row pt-2.5 text-[12.5px] text-muted-foreground", children: footer }))] }));
115
123
  }
116
124
  export function PanelError({ label, error, onRetry, testId, }) {
117
125
  const { Button } = usePrimitives();
118
126
  const t = useTranslation();
119
127
  return (_jsxs("div", { role: "alert", "data-testid": testId, className: "flex flex-col items-start gap-2 rounded-lg border border-dashed border-status-bad/40 px-4 py-6 text-sm", children: [_jsx("div", { className: "font-medium text-status-bad", children: t("kumiko.dashboard.panel.error.title", { label }) }), _jsx("div", { className: "text-muted-foreground", children: dispatcherErrorText(error, t) }), _jsx(Button, { variant: "secondary", onClick: onRetry, children: t("kumiko.dashboard.panel.error.retry") }), _jsx("div", { className: "text-xs text-muted-foreground", children: t("kumiko.dashboard.panel.error.isolated") })] }));
120
128
  }
121
- function PanelSkeleton({ shape }) {
129
+ export function PanelSkeleton({ shape }) {
122
130
  const t = useTranslation();
123
131
  if (shape === "rows")
124
132
  return _jsx(LoadingState, { rows: 3 });
@@ -127,11 +135,19 @@ function PanelSkeleton({ shape }) {
127
135
  }
128
136
  return (_jsx("output", { "aria-label": t("kumiko.widget.loading"), className: "flex h-40 items-end gap-1", children: SKELETON_BAR_HEIGHTS.map((height) => (_jsx(Skeleton, { className: "flex-1", style: { height } }, height))) }));
129
137
  }
130
- export function QueryPanel({ panel, label, subtitle, action, screenParams, translate, skeleton, isEmpty, children, }) {
138
+ // Without loaded data the derived line cannot be computed; the static line keeps the header height
139
+ // from jumping when the data arrives.
140
+ function resolveSubtitle(subtitle, fallback, data) {
141
+ if (typeof subtitle !== "function")
142
+ return subtitle;
143
+ return data === undefined ? fallback : subtitle(data);
144
+ }
145
+ export function QueryPanel({ panel, label, subtitle, staticSubtitle, action, footer, replaceShell, screenParams, translate, skeleton, isEmpty, children, }) {
131
146
  const formats = useDashboardFormats();
132
147
  const { data, error, loading, refetch } = useDashboardQuery(panel.query, panelPayload(panel, screenParams));
133
- useReportPanelLoaded(data);
148
+ useReportPanelLoaded(data, loading);
134
149
  let body;
150
+ let shown;
135
151
  if (loading && data === null) {
136
152
  body = _jsx(PanelSkeleton, { shape: skeleton });
137
153
  }
@@ -142,30 +158,42 @@ export function QueryPanel({ panel, label, subtitle, action, screenParams, trans
142
158
  body = (_jsx(EmptyState, { title: translate(panel.emptyLabel ?? "kumiko.list.no-entries"), description: panel.emptyHint !== undefined ? translate(panel.emptyHint) : undefined }));
143
159
  }
144
160
  else {
161
+ shown = data;
145
162
  body = children(data, formats);
146
163
  }
147
- return (_jsx(PanelShell, { testId: `dashboard-panel-${panel.id}`, title: label, subtitle: subtitle, action: action, children: body }));
164
+ if (shown !== undefined && replaceShell !== undefined)
165
+ return replaceShell(shown);
166
+ return (_jsx(PanelShell, { testId: `dashboard-panel-${panel.id}`, title: label, subtitle: resolveSubtitle(subtitle, staticSubtitle, shown), action: action, footer: shown !== undefined ? footer?.(shown) : undefined, children: body }));
148
167
  }
149
168
  // Starts at render time and restarts whenever the merged query params change;
150
169
  // panels additionally report each successful (re)load, so live refetches and
151
- // retries keep the stamp current.
170
+ // retries keep the stamp current. An older report never replaces a newer answer-based stamp;
171
+ // the render-time stamp is only a guess from the device clock until the first answer, so
172
+ // that answer wins even when the app clock is pinned behind the device.
152
173
  export function useLoadedAt(screenParams) {
153
174
  const paramsKey = JSON.stringify([
154
175
  screenParams.filterParams,
155
176
  screenParams.rangeParams,
156
177
  screenParams.recordParams,
157
178
  ]);
158
- const [loaded, setLoaded] = useState(() => ({ paramsKey, atMs: Date.now() }));
159
- if (loaded.paramsKey !== paramsKey)
160
- setLoaded({ paramsKey, atMs: Date.now() });
161
- const reportLoaded = useCallback((atMs) => setLoaded((prev) => (prev.atMs >= atMs ? prev : { ...prev, atMs })), []);
179
+ const [loaded, setLoaded] = useState(() => ({
180
+ paramsKey,
181
+ atMs: serverNowMs(),
182
+ answered: false,
183
+ }));
184
+ if (loaded.paramsKey !== paramsKey) {
185
+ setLoaded({ paramsKey, atMs: serverNowMs(), answered: false });
186
+ }
187
+ const reportLoaded = useCallback((atMs) => setLoaded((prev) => prev.answered && prev.atMs >= atMs ? prev : { ...prev, atMs, answered: true }), []);
162
188
  return { loadedAtMs: loaded.atMs, reportLoaded };
163
189
  }
164
190
  export const PanelLoadedContext = createContext(() => { });
165
- export function useReportPanelLoaded(data) {
191
+ // While `loading`, `data` still holds the answer to the previous params (useQuery keeps it
192
+ // until the new one lands), so only a settled answer may stamp the header.
193
+ export function useReportPanelLoaded(data, loading) {
166
194
  const reportLoaded = useContext(PanelLoadedContext);
167
195
  useEffect(() => {
168
- if (data !== null)
169
- reportLoaded(Date.now());
170
- }, [data, reportLoaded]);
196
+ if (data !== null && !loading)
197
+ reportLoaded(serverNowMs());
198
+ }, [data, loading, reportLoaded]);
171
199
  }
@@ -0,0 +1,14 @@
1
+ import type { DashboardStatGroupPanel } from "@cosmicdrift/kumiko-framework/ui-types";
2
+ import type { ReactNode } from "react";
3
+ import type { Translate } from "../../headless/index.ts";
4
+ import "../react-css-custom-properties.ts";
5
+ import { type ScreenParams } from "./dashboard-shared.tsx";
6
+ type StatGroupProps = {
7
+ readonly panel: DashboardStatGroupPanel;
8
+ readonly label: string | undefined;
9
+ readonly screenId: string;
10
+ readonly screenParams: ScreenParams;
11
+ readonly translate: Translate;
12
+ };
13
+ export declare function StatGroupPanelBody(props: StatGroupProps): ReactNode;
14
+ export {};
@@ -0,0 +1,74 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ChevronRight } from "lucide-react";
3
+ import { useNav } from "../../app/nav.js";
4
+ import { navigateTargetAllows } from "../../app/screen-access.js";
5
+ import { extensionSectionName, useAppFeatures, useExtensionSectionComponent, usePrimitives, useUserRoles, } from "../../index.js";
6
+ import { cn } from "../lib/cn.js";
7
+ import "../react-css-custom-properties.js";
8
+ import { STAT_CARD_GRID_CLASSES } from "../widgets/stat.js";
9
+ import { dashboardNavigationLink } from "./dashboard-navigation-link.js";
10
+ import { StatPanelBody, useStatNavigateAllowed } from "./dashboard-panels.js";
11
+ import { PanelShell } from "./dashboard-shared.js";
12
+ // Literal class strings: Tailwind only emits classes it can read in the source.
13
+ const STAT_CARD_COLUMN_CLASSES = {
14
+ 2: "grid grid-cols-1 gap-3 sm:grid-cols-2",
15
+ 3: "grid grid-cols-1 gap-3 sm:grid-cols-2 md:grid-cols-3",
16
+ 4: "grid grid-cols-1 gap-3 sm:grid-cols-2 md:grid-cols-4",
17
+ };
18
+ // Literal class strings: Tailwind only emits classes it can read in the source.
19
+ const PHONE_STRIP_TONE_CLASS = {
20
+ accent: "max-sm:border-transparent max-sm:bg-primary/10",
21
+ ok: "max-sm:border-transparent max-sm:bg-status-ok-surface",
22
+ warn: "max-sm:border-transparent max-sm:bg-status-warn-surface",
23
+ bad: "max-sm:border-transparent max-sm:bg-status-bad-surface",
24
+ critical: "max-sm:border-transparent max-sm:bg-status-critical-surface",
25
+ neutral: "",
26
+ };
27
+ function StatGroupLink({ link, translate, stretchOnNarrow, }) {
28
+ const { Link } = usePrimitives();
29
+ const nav = useNav();
30
+ const appFeatures = useAppFeatures();
31
+ const userRoles = useUserRoles();
32
+ if (!navigateTargetAllows({ screen: link.screen }, appFeatures, userRoles))
33
+ return null;
34
+ const target = dashboardNavigationLink(nav, link);
35
+ return (_jsxs(Link, { href: target.href, onPress: target.onPress, testId: "dashboard-stat-group-link", className: stretchOnNarrow
36
+ ? "ml-auto flex shrink-0 items-center gap-1 text-sm font-medium max-sm:after:absolute max-sm:after:inset-0"
37
+ : "ml-auto flex shrink-0 items-center gap-1 text-sm font-medium", children: [_jsx("span", { className: stretchOnNarrow ? "max-sm:sr-only" : undefined, children: translate(link.label) }), _jsx(ChevronRight, { className: "size-4", "aria-hidden": "true" })] }));
38
+ }
39
+ function StatCells({ panel, screenId, screenParams, translate, variant, }) {
40
+ return panel.stats.map((stat) => (_jsx(StatPanelBody, { panel: stat, label: translate(stat.label), screenId: screenId, screenParams: screenParams, translate: translate, variant: variant }, stat.id)));
41
+ }
42
+ function FlatStatStrip(props) {
43
+ const { panel, translate } = props;
44
+ return (_jsxs("div", { "data-testid": `dashboard-panel-${panel.id}`, className: "rounded-lg border border-border bg-card py-1 lg:flex lg:items-center", children: [_jsx("div", { className: "grid grow grid-cols-2 gap-y-2 lg:auto-cols-fr lg:grid-flow-col lg:divide-x lg:divide-border-row", children: _jsx(StatCells, { ...props, variant: "strip" }) }), panel.link !== undefined && (_jsx("div", { className: "flex px-4 max-lg:pt-1 lg:shrink-0", children: _jsx(StatGroupLink, { link: panel.link, translate: translate, stretchOnNarrow: false }) }))] }));
45
+ }
46
+ function PhoneStripIcon({ panel, screenId, screenParams, }) {
47
+ const Icon = useExtensionSectionComponent(panel.icon !== undefined ? extensionSectionName(panel.icon) : undefined);
48
+ if (Icon === undefined)
49
+ return null;
50
+ return (_jsx("span", { className: "flex shrink-0 items-center self-center sm:hidden", children: _jsx(Icon, { entityName: screenId, entityId: null, screenId: screenId, filterParams: screenParams.filterParams }) }));
51
+ }
52
+ function TitledStatStrip(props) {
53
+ const { panel, label, translate } = props;
54
+ const navigateAllowed = useStatNavigateAllowed();
55
+ const stats = panel.stats.filter(navigateAllowed);
56
+ return (_jsxs("div", { "data-testid": `dashboard-panel-${panel.id}`, "data-narrow-tone": panel.narrow?.tone, style: { "--stat-count": stats.length }, className: cn(
57
+ // Board grid: title column, one equal column per stat, link column.
58
+ panel.link === undefined
59
+ ? "sm:[grid-template-columns:190px_repeat(var(--stat-count),minmax(0,1fr))]"
60
+ : "sm:[grid-template-columns:190px_repeat(var(--stat-count),minmax(0,1fr))_auto]", "relative flex items-center gap-x-4 rounded-lg border border-border bg-card px-4 py-3 shadow-[var(--card-shadow)] sm:grid sm:gap-x-3 max-sm:items-baseline max-sm:gap-x-2 max-sm:overflow-hidden max-sm:py-2 max-sm:font-medium", panel.narrow?.tone !== undefined && PHONE_STRIP_TONE_CLASS[panel.narrow.tone]), children: [_jsx(PhoneStripIcon, { panel: panel, screenId: props.screenId, screenParams: props.screenParams }), _jsxs("div", { className: "flex min-w-0 shrink-0 flex-col max-sm:flex-row max-sm:items-baseline", children: [_jsx("h2", { className: "text-sm font-semibold max-sm:after:ml-2 max-sm:after:font-normal max-sm:after:text-muted-foreground max-sm:after:content-['\u00B7']", children: label }), panel.subtitle !== undefined && (_jsx("p", { className: "text-xs text-muted-foreground max-sm:hidden", children: translate(panel.subtitle) }))] }), _jsx("div", { className: "flex min-w-0 items-stretch gap-3 sm:contents max-sm:block max-sm:grow max-sm:truncate max-sm:text-sm", children: stats.map((stat) => (_jsx("div", { className: `flex min-w-0 max-sm:inline max-sm:[&_a]:inline max-sm:[&:not(:last-child)]:after:mx-1.5 max-sm:[&:not(:last-child)]:after:text-muted-foreground max-sm:[&:not(:last-child)]:after:content-['·'] [&>*]:min-w-0${stat.navigate !== undefined ? " max-sm:relative max-sm:z-10" : ""}`, children: _jsx(StatPanelBody, { panel: stat, label: translate(stat.label), screenId: props.screenId, screenParams: props.screenParams, translate: translate, variant: "strip-compact" }) }, stat.id))) }), panel.link !== undefined && (_jsx(StatGroupLink, { link: panel.link, translate: translate, stretchOnNarrow: true }))] }));
61
+ }
62
+ export function StatGroupPanelBody(props) {
63
+ const { panel, label, translate } = props;
64
+ const layout = panel.layout ?? (label === undefined ? "strip" : "cards");
65
+ if (layout === "strip") {
66
+ return label === undefined ? (_jsx(FlatStatStrip, { ...props })) : (_jsx(TitledStatStrip, { ...props, label: label }));
67
+ }
68
+ const cells = (_jsx("section", { className: panel.columns === undefined
69
+ ? STAT_CARD_GRID_CLASSES
70
+ : STAT_CARD_COLUMN_CLASSES[panel.columns], children: _jsx(StatCells, { ...props, variant: "card" }) }));
71
+ return (_jsx(PanelShell, { testId: `dashboard-panel-${panel.id}`, ...(label !== undefined && { title: label }), ...(panel.subtitle !== undefined && { subtitle: translate(panel.subtitle) }), ...(panel.link !== undefined && {
72
+ action: _jsx(StatGroupLink, { link: panel.link, translate: translate, stretchOnNarrow: false }),
73
+ }), children: cells }));
74
+ }
@@ -0,0 +1,12 @@
1
+ import type { DashboardTextPanel } from "@cosmicdrift/kumiko-framework/ui-types";
2
+ import type { ReactNode } from "react";
3
+ import type { Translate } from "../../headless/index.ts";
4
+ import { type ScreenParams } from "./dashboard-shared.tsx";
5
+ type TextPanelBodyProps = {
6
+ readonly panel: DashboardTextPanel;
7
+ readonly label: string | undefined;
8
+ readonly screenParams: ScreenParams;
9
+ readonly translate: Translate;
10
+ };
11
+ export declare function TextPanelBody(props: TextPanelBodyProps): ReactNode;
12
+ export {};