@cosmicdrift/kumiko-renderer 0.413.0 → 0.414.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 (339) 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 +30 -50
  6. package/dist/app/form-schema.d.ts +1 -0
  7. package/dist/app/form-schema.js +24 -0
  8. package/dist/app/list-sort-options.d.ts +4 -0
  9. package/dist/app/list-sort-options.js +11 -0
  10. package/dist/app/named-filter-facet.d.ts +17 -3
  11. package/dist/app/named-filter-facet.js +88 -5
  12. package/dist/app/projection-detail-body.d.ts +2 -4
  13. package/dist/app/projection-detail-body.js +7 -1
  14. package/dist/app/projection-detail-guidance-data.d.ts +7 -0
  15. package/dist/app/projection-detail-guidance-data.js +101 -0
  16. package/dist/app/projection-detail-guidance.d.ts +13 -0
  17. package/dist/app/projection-detail-guidance.js +197 -0
  18. package/dist/app/projection-detail-header-model.d.ts +1 -3
  19. package/dist/app/projection-detail-header-model.js +4 -8
  20. package/dist/app/projection-detail-header-region.d.ts +2 -1
  21. package/dist/app/projection-detail-header-region.js +63 -23
  22. package/dist/app/projection-detail-header.d.ts +6 -1
  23. package/dist/app/projection-detail-header.js +75 -18
  24. package/dist/app/projection-detail-states.d.ts +3 -3
  25. package/dist/app/projection-list-body.js +4 -2
  26. package/dist/app/projection-list-render.js +3 -1
  27. package/dist/app/projection-list-shim.d.ts +4 -1
  28. package/dist/app/projection-list-shim.js +35 -8
  29. package/dist/app/reference-link.d.ts +3 -2
  30. package/dist/app/reference-link.js +19 -4
  31. package/dist/app/row-actions.js +3 -3
  32. package/dist/app/screen-access.d.ts +4 -0
  33. package/dist/app/screen-access.js +19 -0
  34. package/dist/app/screen-shared.js +3 -1
  35. package/dist/app/unique-label-keys.d.ts +1 -0
  36. package/dist/app/unique-label-keys.js +9 -0
  37. package/dist/app/use-entity-list-payload.d.ts +25 -0
  38. package/dist/app/use-entity-list-payload.js +57 -0
  39. package/dist/app/use-entity-range-facets.js +2 -3
  40. package/dist/app/use-facet-counts.d.ts +5 -0
  41. package/dist/app/use-facet-counts.js +7 -0
  42. package/dist/app/use-list-summary-row.d.ts +10 -0
  43. package/dist/app/use-list-summary-row.js +33 -0
  44. package/dist/app/use-named-filter-queue.d.ts +20 -0
  45. package/dist/app/use-named-filter-queue.js +9 -0
  46. package/dist/app/use-projection-detail-actions.d.ts +4 -4
  47. package/dist/app/use-projection-detail-actions.js +30 -1
  48. package/dist/app/use-projection-list-data.d.ts +5 -0
  49. package/dist/app/use-projection-list-data.js +35 -6
  50. package/dist/app/use-projection-list-query.d.ts +2 -0
  51. package/dist/app/use-projection-list-query.js +29 -16
  52. package/dist/app/use-related-list-tab-counts.js +5 -1
  53. package/dist/app/use-row-decoration.d.ts +11 -0
  54. package/dist/app/use-row-decoration.js +55 -0
  55. package/dist/app/use-screen-list-rows.d.ts +4 -1
  56. package/dist/app/use-screen-list-rows.js +14 -5
  57. package/dist/app/use-screen-list-table.d.ts +3 -1
  58. package/dist/app/use-screen-list-table.js +10 -1
  59. package/dist/app/write-failed-error.d.ts +1 -0
  60. package/dist/app/write-failed-error.js +10 -0
  61. package/dist/compact-tap-classes.d.ts +1 -0
  62. package/dist/compact-tap-classes.js +3 -0
  63. package/dist/components/embedded-list-field.js +13 -12
  64. package/dist/components/form-pending-uploads.d.ts +8 -0
  65. package/dist/components/form-pending-uploads.js +27 -0
  66. package/dist/components/list-empty-state.d.ts +8 -1
  67. package/dist/components/list-empty-state.js +4 -1
  68. package/dist/components/list-group-page-bridges.d.ts +1 -1
  69. package/dist/components/list-group-page-bridges.js +2 -2
  70. package/dist/components/related-list-section.js +4 -22
  71. package/dist/components/render-edit-action-button.d.ts +3 -1
  72. package/dist/components/render-edit-action-button.js +5 -3
  73. package/dist/components/render-edit-form-actions.js +6 -3
  74. package/dist/components/render-edit-layout.js +2 -1
  75. package/dist/components/render-edit-render-model.d.ts +2 -2
  76. package/dist/components/render-edit-submit.js +2 -1
  77. package/dist/components/render-edit-types.d.ts +4 -2
  78. package/dist/components/render-edit.js +3 -1
  79. package/dist/components/render-list-hint-columns.d.ts +8 -0
  80. package/dist/components/render-list-hint-columns.js +77 -0
  81. package/dist/components/render-list-reference-columns.js +4 -2
  82. package/dist/components/render-list-row-tone.d.ts +3 -0
  83. package/dist/components/render-list-row-tone.js +10 -0
  84. package/dist/components/render-list-table-props.d.ts +9 -1
  85. package/dist/components/render-list-table-props.js +4 -1
  86. package/dist/components/render-list-toolbar-action.d.ts +1 -2
  87. package/dist/components/render-list-toolbar-model.d.ts +3 -0
  88. package/dist/components/render-list-toolbar-model.js +21 -6
  89. package/dist/components/render-list-toolbar.d.ts +3 -2
  90. package/dist/components/render-list-toolbar.js +8 -6
  91. package/dist/components/render-list-types.d.ts +6 -1
  92. package/dist/components/render-list.js +26 -7
  93. package/dist/components/use-render-edit-controlled-sync.js +5 -4
  94. package/dist/components/use-render-edit-draft-save.js +7 -9
  95. package/dist/components/use-render-edit-schema.d.ts +3 -0
  96. package/dist/components/use-render-edit-schema.js +15 -0
  97. package/dist/components/use-render-edit-state.d.ts +4 -0
  98. package/dist/components/use-render-edit-state.js +9 -1
  99. package/dist/components/use-render-edit-steps.js +2 -3
  100. package/dist/components/use-render-list-columns.d.ts +3 -1
  101. package/dist/components/use-render-list-columns.js +22 -10
  102. package/dist/context/screen-focus-context.d.ts +14 -0
  103. package/dist/context/screen-focus-context.js +28 -0
  104. package/dist/data-table-facet-types.d.ts +2 -0
  105. package/dist/data-table-view-types.d.ts +20 -1
  106. package/dist/headless/form/form-controller.js +3 -1
  107. package/dist/headless/form/zod-bridge.d.ts +7 -1
  108. package/dist/headless/form/zod-bridge.js +10 -0
  109. package/dist/headless/index.d.ts +2 -1
  110. package/dist/headless/index.js +1 -0
  111. package/dist/headless/pwa-service-worker-meta.d.ts +1 -0
  112. package/dist/headless/pwa-service-worker-meta.js +3 -0
  113. package/dist/headless/view-model/index.d.ts +1 -1
  114. package/dist/headless/view-model/list-file-display.js +3 -2
  115. package/dist/headless/view-model/list.js +16 -0
  116. package/dist/headless/view-model/types.d.ts +33 -0
  117. package/dist/hooks/list-column-layout.js +2 -1
  118. package/dist/hooks/list-server-groups.js +14 -1
  119. package/dist/hooks/list-state-schema.d.ts +1 -0
  120. package/dist/hooks/list-state-schema.js +9 -1
  121. package/dist/hooks/use-debounced-value.d.ts +1 -0
  122. package/dist/hooks/use-debounced-value.js +11 -0
  123. package/dist/hooks/use-list-aggregates.d.ts +5 -1
  124. package/dist/hooks/use-list-aggregates.js +9 -5
  125. package/dist/hooks/use-list-table.d.ts +2 -1
  126. package/dist/hooks/use-list-table.js +3 -9
  127. package/dist/hooks/use-list-url-state.d.ts +2 -0
  128. package/dist/hooks/use-list-url-state.js +12 -4
  129. package/dist/hooks/use-list-view-state.js +23 -3
  130. package/dist/hooks/use-reference-lookup.js +7 -2
  131. package/dist/hooks/use-remembered-list-params.d.ts +6 -2
  132. package/dist/hooks/use-remembered-list-params.js +18 -3
  133. package/dist/hooks/use-store.js +0 -1
  134. package/dist/i18n-defaults.js +37 -2
  135. package/dist/index.d.ts +8 -2
  136. package/dist/index.js +5 -1
  137. package/dist/live/dispatcher-live.js +2 -0
  138. package/dist/metric-types.d.ts +2 -0
  139. package/dist/primitives-record-guidance.d.ts +53 -0
  140. package/dist/primitives-record-guidance.js +1 -0
  141. package/dist/primitives.d.ts +41 -31
  142. package/dist/server-clock.d.ts +6 -0
  143. package/dist/server-clock.js +20 -0
  144. package/dist/session/session-ended.d.ts +1 -0
  145. package/dist/session/session-ended.js +2 -2
  146. package/dist/status-tone.d.ts +1 -0
  147. package/dist/status-tone.js +5 -0
  148. package/dist/web/app/browser-locale.js +1 -1
  149. package/dist/web/app/client-plugin.d.ts +6 -1
  150. package/dist/web/app/create-app.d.ts +2 -1
  151. package/dist/web/app/create-app.js +15 -5
  152. package/dist/web/app/dashboard-body.js +25 -11
  153. package/dist/web/app/dashboard-header.d.ts +2 -1
  154. package/dist/web/app/dashboard-header.js +19 -7
  155. package/dist/web/app/dashboard-list-panel.d.ts +12 -0
  156. package/dist/web/app/dashboard-list-panel.js +149 -0
  157. package/dist/web/app/dashboard-narrow-gate.d.ts +6 -0
  158. package/dist/web/app/dashboard-narrow-gate.js +6 -0
  159. package/dist/web/app/dashboard-narrow-order.d.ts +3 -0
  160. package/dist/web/app/dashboard-narrow-order.js +6 -0
  161. package/dist/web/app/dashboard-navigation-link.d.ts +12 -0
  162. package/dist/web/app/dashboard-navigation-link.js +21 -0
  163. package/dist/web/app/dashboard-panels.d.ts +6 -23
  164. package/dist/web/app/dashboard-panels.js +53 -123
  165. package/dist/web/app/dashboard-reference-list-table.d.ts +5 -1
  166. package/dist/web/app/dashboard-reference-list-table.js +12 -4
  167. package/dist/web/app/dashboard-shared.d.ts +23 -7
  168. package/dist/web/app/dashboard-shared.js +44 -17
  169. package/dist/web/app/dashboard-stat-group-panel.d.ts +13 -0
  170. package/dist/web/app/dashboard-stat-group-panel.js +67 -0
  171. package/dist/web/app/dashboard-text-panel.d.ts +12 -0
  172. package/dist/web/app/dashboard-text-panel.js +163 -0
  173. package/dist/web/app/dashboard-text.d.ts +2 -0
  174. package/dist/web/app/dashboard-text.js +1 -1
  175. package/dist/web/app/dashboard-visibility.js +1 -1
  176. package/dist/web/app/relative-time.js +2 -1
  177. package/dist/web/editor/editor-footer.d.ts +28 -0
  178. package/dist/web/editor/editor-footer.js +23 -0
  179. package/dist/web/editor/editor-frame.d.ts +23 -0
  180. package/dist/web/editor/editor-frame.js +24 -0
  181. package/dist/web/editor/editor-header.d.ts +36 -0
  182. package/dist/web/editor/editor-header.js +30 -0
  183. package/dist/web/editor/editor-rail.d.ts +32 -0
  184. package/dist/web/editor/editor-rail.js +37 -0
  185. package/dist/web/editor/editor-workbench.d.ts +34 -0
  186. package/dist/web/editor/editor-workbench.js +19 -0
  187. package/dist/web/editor/index.d.ts +6 -0
  188. package/dist/web/editor/index.js +6 -0
  189. package/dist/web/editor/relative-when.d.ts +1 -0
  190. package/dist/web/editor/relative-when.js +18 -0
  191. package/dist/web/index.d.ts +7 -1
  192. package/dist/web/index.js +5 -1
  193. package/dist/web/layout/default-app-shell.js +6 -4
  194. package/dist/web/layout/focus-aware-sidebar.d.ts +4 -7
  195. package/dist/web/layout/focus-aware-sidebar.js +5 -7
  196. package/dist/web/layout/header-action-pinned.d.ts +8 -0
  197. package/dist/web/layout/header-action-pinned.js +25 -0
  198. package/dist/web/layout/nav-collapse-state.d.ts +5 -0
  199. package/dist/web/layout/nav-collapse-state.js +66 -0
  200. package/dist/web/layout/nav-tree.js +25 -5
  201. package/dist/web/layout/page-header-slot.d.ts +2 -0
  202. package/dist/web/layout/page-header-slot.js +4 -0
  203. package/dist/web/layout/screen-focus.d.ts +8 -0
  204. package/dist/web/layout/screen-focus.js +42 -0
  205. package/dist/web/layout/shell-focus.d.ts +6 -5
  206. package/dist/web/layout/shell-focus.js +12 -9
  207. package/dist/web/layout/shell-header.js +38 -10
  208. package/dist/web/layout/sidebar-open-state.d.ts +6 -0
  209. package/dist/web/layout/sidebar-open-state.js +28 -0
  210. package/dist/web/layout/uniform-bar-controls.d.ts +2 -2
  211. package/dist/web/layout/uniform-bar-controls.js +4 -3
  212. package/dist/web/layout/use-in-app-inbox.js +8 -1
  213. package/dist/web/layout/workspace-shell.js +6 -4
  214. package/dist/web/lib/upload-file-ref.d.ts +2 -2
  215. package/dist/web/lib/upload-file-ref.js +4 -9
  216. package/dist/web/presence/use-presence.js +7 -2
  217. package/dist/web/primitives/banner.d.ts +1 -1
  218. package/dist/web/primitives/banner.js +14 -6
  219. package/dist/web/primitives/calendar-day-picker.js +24 -5
  220. package/dist/web/primitives/card.js +1 -1
  221. package/dist/web/primitives/code-input.js +6 -1
  222. package/dist/web/primitives/data-table/actions-column.d.ts +1 -0
  223. package/dist/web/primitives/data-table/actions-column.js +4 -2
  224. package/dist/web/primitives/data-table/card-body.d.ts +5 -0
  225. package/dist/web/primitives/data-table/card-body.js +47 -5
  226. package/dist/web/primitives/data-table/card-frame.d.ts +8 -0
  227. package/dist/web/primitives/data-table/card-frame.js +9 -0
  228. package/dist/web/primitives/data-table/card-row.js +40 -7
  229. package/dist/web/primitives/data-table/card-sort-select.d.ts +6 -2
  230. package/dist/web/primitives/data-table/card-sort-select.js +10 -7
  231. package/dist/web/primitives/data-table/card-view.js +12 -2
  232. package/dist/web/primitives/data-table/column-picker-section.js +9 -2
  233. package/dist/web/primitives/data-table/column-resize-handle.js +3 -4
  234. package/dist/web/primitives/data-table/column-role.d.ts +1 -0
  235. package/dist/web/primitives/data-table/column-role.js +1 -0
  236. package/dist/web/primitives/data-table/data-cell-props.d.ts +5 -0
  237. package/dist/web/primitives/data-table/data-cell-props.js +5 -0
  238. package/dist/web/primitives/data-table/density.js +1 -0
  239. package/dist/web/primitives/data-table/facet-cluster.d.ts +2 -1
  240. package/dist/web/primitives/data-table/facet-cluster.js +2 -2
  241. package/dist/web/primitives/data-table/group-band.js +4 -0
  242. package/dist/web/primitives/data-table/hint-cell.d.ts +16 -0
  243. package/dist/web/primitives/data-table/hint-cell.js +74 -0
  244. package/dist/web/primitives/data-table/hint-column-width.d.ts +3 -0
  245. package/dist/web/primitives/data-table/hint-column-width.js +11 -0
  246. package/dist/web/primitives/data-table/measure-value.js +2 -3
  247. package/dist/web/primitives/data-table/row-action-column.d.ts +3 -0
  248. package/dist/web/primitives/data-table/row-action-column.js +4 -0
  249. package/dist/web/primitives/data-table/sort-options-select.d.ts +22 -0
  250. package/dist/web/primitives/data-table/sort-options-select.js +46 -0
  251. package/dist/web/primitives/data-table/sortable-header.d.ts +3 -1
  252. package/dist/web/primitives/data-table/sortable-header.js +5 -3
  253. package/dist/web/primitives/data-table/table-body.d.ts +1 -1
  254. package/dist/web/primitives/data-table/table-body.js +5 -3
  255. package/dist/web/primitives/data-table/table-chrome.js +3 -1
  256. package/dist/web/primitives/data-table/table-content.js +10 -5
  257. package/dist/web/primitives/data-table/table-data-cell.js +9 -3
  258. package/dist/web/primitives/data-table/table-header-row.js +5 -2
  259. package/dist/web/primitives/data-table/table-view.js +17 -3
  260. package/dist/web/primitives/data-table/toolbar-end-cluster.js +1 -1
  261. package/dist/web/primitives/data-table/toolbar.js +31 -3
  262. package/dist/web/primitives/data-table/totals-footer.d.ts +20 -0
  263. package/dist/web/primitives/data-table/totals-footer.js +40 -9
  264. package/dist/web/primitives/data-table/use-bulk-selection.js +2 -1
  265. package/dist/web/primitives/data-table/use-column-pins.js +4 -0
  266. package/dist/web/primitives/data-table/use-data-table-state.d.ts +1 -0
  267. package/dist/web/primitives/data-table/use-data-table-state.js +9 -5
  268. package/dist/web/primitives/data-table/use-measured-column-widths.js +5 -4
  269. package/dist/web/primitives/data-table/use-row-selection.js +22 -11
  270. package/dist/web/primitives/data-table/view-menu.js +7 -1
  271. package/dist/web/primitives/data-table-cell.d.ts +21 -2
  272. package/dist/web/primitives/data-table-cell.js +96 -19
  273. package/dist/web/primitives/embedded-file-cell.js +10 -6
  274. package/dist/web/primitives/embedded-list-cards.js +3 -4
  275. package/dist/web/primitives/facet-filter.d.ts +4 -2
  276. package/dist/web/primitives/facet-filter.js +26 -3
  277. package/dist/web/primitives/facet-search-filter.js +1 -1
  278. package/dist/web/primitives/file-thumbnail.d.ts +6 -2
  279. package/dist/web/primitives/file-thumbnail.js +13 -6
  280. package/dist/web/primitives/file-upload.js +15 -11
  281. package/dist/web/primitives/file-view-action.d.ts +6 -0
  282. package/dist/web/primitives/file-view-action.js +19 -0
  283. package/dist/web/primitives/files-dropzone.js +18 -4
  284. package/dist/web/primitives/form-footer-parts.d.ts +0 -1
  285. package/dist/web/primitives/form.js +0 -1
  286. package/dist/web/primitives/hint-reason-row.d.ts +32 -0
  287. package/dist/web/primitives/hint-reason-row.js +45 -0
  288. package/dist/web/primitives/index.js +6 -0
  289. package/dist/web/primitives/layout-elements.d.ts +1 -1
  290. package/dist/web/primitives/layout-elements.js +2 -2
  291. package/dist/web/primitives/metric.js +8 -6
  292. package/dist/web/primitives/page-header.d.ts +1 -1
  293. package/dist/web/primitives/page-header.js +8 -1
  294. package/dist/web/primitives/pager.js +29 -18
  295. package/dist/web/primitives/reason-box.d.ts +20 -0
  296. package/dist/web/primitives/reason-box.js +13 -0
  297. package/dist/web/primitives/record-breadcrumb.d.ts +3 -0
  298. package/dist/web/primitives/record-breadcrumb.js +11 -0
  299. package/dist/web/primitives/record-steps.d.ts +3 -0
  300. package/dist/web/primitives/record-steps.js +45 -0
  301. package/dist/web/primitives/record-summary.d.ts +3 -0
  302. package/dist/web/primitives/record-summary.js +18 -0
  303. package/dist/web/primitives/row-actions.d.ts +3 -1
  304. package/dist/web/primitives/row-actions.js +14 -5
  305. package/dist/web/primitives/segmented-select.js +5 -7
  306. package/dist/web/pwa/pwa-support.d.ts +4 -0
  307. package/dist/web/pwa/pwa-support.js +113 -0
  308. package/dist/web/sse/live-events.js +2 -2
  309. package/dist/web/tokens.js +0 -3
  310. package/dist/web/widgets/chart-parts.d.ts +7 -1
  311. package/dist/web/widgets/chart-parts.js +10 -4
  312. package/dist/web/widgets/collapsible-section.js +1 -1
  313. package/dist/web/widgets/dashboard-list-cards.d.ts +17 -0
  314. package/dist/web/widgets/dashboard-list-cards.js +54 -0
  315. package/dist/web/widgets/dashboard-list.d.ts +37 -5
  316. package/dist/web/widgets/dashboard-list.js +95 -20
  317. package/dist/web/widgets/drawer-sizing.js +1 -1
  318. package/dist/web/widgets/floating-panel.js +4 -2
  319. package/dist/web/widgets/index.d.ts +2 -0
  320. package/dist/web/widgets/index.js +2 -0
  321. package/dist/web/widgets/infinity-list.js +18 -11
  322. package/dist/web/widgets/preview-width-frame.d.ts +7 -0
  323. package/dist/web/widgets/preview-width-frame.js +10 -0
  324. package/dist/web/widgets/section-card.d.ts +1 -1
  325. package/dist/web/widgets/stacked-area-chrome.js +3 -3
  326. package/dist/web/widgets/stacked-area-tooltip.js +2 -10
  327. package/dist/web/widgets/stat-box-cell.d.ts +19 -0
  328. package/dist/web/widgets/stat-box-cell.js +10 -0
  329. package/dist/web/widgets/stat.d.ts +10 -1
  330. package/dist/web/widgets/stat.js +14 -5
  331. package/dist/web/widgets/status-badge.d.ts +7 -5
  332. package/dist/web/widgets/status-badge.js +2 -2
  333. package/dist/web/widgets/step-bar.d.ts +1 -1
  334. package/dist/web/widgets/step-bar.js +37 -7
  335. package/dist/web/widgets/upload-zone.d.ts +8 -1
  336. package/dist/web/widgets/upload-zone.js +13 -3
  337. package/package.json +5 -5
  338. package/src/changes.json +223 -0
  339. package/src/web/styles.css +9 -0
@@ -5,16 +5,18 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
5
5
  import { Loader2, Plus, X } from "lucide-react";
6
6
  import { useRef, useState } from "react";
7
7
  import { fileIdsOf } from "../../file-ids-of.js";
8
- import { useSessionEndedSignal, useTranslation } from "../../index.js";
8
+ import { useSessionEndedSignal, useTrackFormUpload, useTranslation } from "../../index.js";
9
+ import { isSessionEndedCause } from "../../session/session-ended.js";
9
10
  import { toAcceptAttr } from "../lib/accept-attr.js";
10
11
  import { cn } from "../lib/cn.js";
11
12
  import { resizeImageBeforeUpload } from "../lib/resize-image.js";
12
13
  import { uploadErrorKey } from "../lib/upload-error-key.js";
13
- import { isSessionEndedUploadError, uploadFileRef } from "../lib/upload-file-ref.js";
14
+ import { uploadFileRef } from "../lib/upload-file-ref.js";
14
15
  import { FileNameLink, FileThumbnail } from "./file-thumbnail.js";
15
16
  export function EmbeddedFileCell({ cellId, label, column, value, readOnly, uploadTarget, onChange, }) {
16
17
  const t = useTranslation();
17
18
  const sessionEnded = useSessionEndedSignal();
19
+ const trackFormUpload = useTrackFormUpload();
18
20
  const inputRef = useRef(null);
19
21
  const [uploading, setUploading] = useState(false);
20
22
  const [error, setError] = useState(null);
@@ -31,12 +33,14 @@ export function EmbeddedFileCell({ cellId, label, column, value, readOnly, uploa
31
33
  setUploading(true);
32
34
  setError(null);
33
35
  try {
34
- const uploadFile = await resizeImageBeforeUpload(file);
35
- const id = await uploadFileRef(uploadFile, { ...uploadTarget, subField: column.field });
36
- onChange([...ids, id]);
36
+ await trackFormUpload(async () => {
37
+ const uploadFile = await resizeImageBeforeUpload(file);
38
+ const id = await uploadFileRef(uploadFile, { ...uploadTarget, subField: column.field });
39
+ onChange([...ids, id]);
40
+ });
37
41
  }
38
42
  catch (cause) {
39
- if (isSessionEndedUploadError(cause))
43
+ if (isSessionEndedCause(cause))
40
44
  sessionEnded?.notify();
41
45
  setError(t(uploadErrorKey(cause)));
42
46
  }
@@ -33,9 +33,8 @@ export function EmbeddedListCards(props) {
33
33
  return (_jsxs("div", { "data-testid": testIdFor("mobile"), className: "md:hidden flex flex-col gap-3", children: [rows.map((row, rowIndex) => {
34
34
  const isLastRow = rowIndex === rows.length - 1;
35
35
  const rowIssuesForRow = rowIssues?.[rowIndex];
36
- const isVisible = (column) => column !== titleColumn &&
37
- column.hiddenInCard !== true &&
38
- column.isHiddenInRow?.(row) !== true;
36
+ const isShownInRow = (column) => column.hiddenInCard !== true && column.isHiddenInRow?.(row) !== true;
37
+ const isVisible = (column) => column !== titleColumn && isShownInRow(column);
39
38
  const renderControl = (column) => renderCellControl({
40
39
  cellId: cellId(rowIndex, column.field),
41
40
  label: cellLabel(column, rowIndex),
@@ -51,7 +50,7 @@ export function EmbeddedListCards(props) {
51
50
  });
52
51
  const renderIssues = (column) => (_jsx(IssueMessages, { issues: cellIssues?.[`${rowIndex}.${column.field}`], testId: testIdFor(`cell-${rowIndex}-${column.field}-errors`) }));
53
52
  const anchorHasAttachment = (anchor) => columns.find((other) => other.cardAttachedTo === anchor.field &&
54
- other.hiddenInCard !== true &&
53
+ isShownInRow(other) &&
55
54
  other.field !== anchor.field);
56
55
  return (_jsxs("div", { "data-testid": testIdFor(`row-${rowIndex}`), className: "flex flex-col gap-3 rounded-lg border bg-card p-4", children: [titleColumn !== undefined && (_jsxs("div", { "data-testid": testIdFor(`row-${rowIndex}-title`), className: "font-medium", children: [rowIndex + 1, " ", readOnlyCellText(titleColumn, row[titleColumn.field], currency, locale)] })), columns.map((column, columnIndex) => {
57
56
  if (!isVisible(column))
@@ -1,12 +1,14 @@
1
1
  import type { ReactNode } from "react";
2
- import type { DataTableDateRangeFacet, DataTableFacet } from "../../index.ts";
2
+ import { type DataTableDateRangeFacet, type DataTableFacet } from "../../index.ts";
3
3
  import "../react-css-custom-properties.ts";
4
- export declare function FacetFilter({ facet, selected, onChange, dense, }: {
4
+ export declare function FacetFilter({ facet, selected, onChange, dense, pill, }: {
5
5
  facet: DataTableFacet;
6
6
  selected: readonly string[];
7
7
  onChange: (field: string, values: readonly string[]) => void;
8
8
  /** Toolbar of a scrollBody table: h32 with the stronger border. */
9
9
  dense?: boolean;
10
+ /** Compact pill trigger for the dropdown facets: rounded, auto width. */
11
+ pill?: boolean;
10
12
  }): ReactNode;
11
13
  export declare function DateRangeFacetFilter({ facet, onChange, }: {
12
14
  facet: DataTableDateRangeFacet;
@@ -1,13 +1,15 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { ChevronDown } from "lucide-react";
3
+ import { useOptionalTranslation, } from "../../index.js";
3
4
  import { cn } from "../lib/cn.js";
4
5
  import { Badge } from "../ui/badge.js";
5
6
  import { Button as UiButton } from "../ui/button.js";
6
- import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuTrigger, } from "./dropdown-menu.js";
7
+ import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuTrigger, } from "./dropdown-menu.js";
7
8
  import "../react-css-custom-properties.js";
8
9
  import { DefaultButton } from "./button.js";
9
10
  import { FacetSearchFilter } from "./facet-search-filter.js";
10
11
  // ---- DataTable (shadcn: Table) ----
12
+ const PILL_CLASSES = "h-9 rounded-full border-border-strong px-3";
11
13
  function sameValueSet(a, b) {
12
14
  return a.length === b.length && a.every((value) => b.includes(value));
13
15
  }
@@ -17,20 +19,41 @@ function FacetChips({ facet, selected, onChange, }) {
17
19
  const chips = (facet.chips ?? []).filter((chip) => facet.hideEmpty !== true || chip.count !== 0 || sameValueSet(selected, chip.values));
18
20
  return (_jsx("div", { role: "group", "aria-label": facet.label, className: "flex flex-wrap items-center gap-1.5", "data-testid": `facet-${facet.field}`, children: chips.map((chip) => (_jsxs(DefaultButton, { variant: "secondary", size: "sm", pressed: sameValueSet(selected, chip.values), onClick: () => onChange(facet.field, chip.values), testId: `facet-${facet.field}-${chip.id}`, className: "rounded-full", children: [chip.label, facet.showCounts === true && chip.count !== undefined && (_jsx("span", { className: "tabular-nums text-muted-foreground", children: chip.count }))] }, chip.id))) }));
19
21
  }
22
+ // Single-choice dropdown for a chips facet with display "select": the trigger names the
23
+ // active entry, and turns primary-bordered once a chip other than the empty selection is on.
24
+ function FacetSelect({ facet, selected, onChange, dense, pill, }) {
25
+ const chips = facet.chips ?? [];
26
+ const isFiltered = selected.length > 0;
27
+ // A stale URL can name an entry the facet does not offer; showing "all" then would misstate the list.
28
+ const active = chips.find((chip) => sameValueSet(selected, chip.values)) ??
29
+ (isFiltered ? undefined : chips[0]);
30
+ return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(UiButton, { variant: "outline", size: "sm", className: cn("h-9", dense && "border-border-strong px-2.5", pill && PILL_CLASSES, isFiltered && "border-primary text-foreground"), "data-testid": `facet-${facet.field}`, children: [active === undefined ? facet.label : `${facet.label}: ${active.label}`, _jsx(ChevronDown, { className: "text-muted-foreground" })] }) }), _jsx(DropdownMenuContent, { align: "start", className: "max-h-[var(--radix-dropdown-menu-content-available-height)] w-56 overflow-y-auto", children: _jsx(DropdownMenuRadioGroup, { value: active?.id ?? "", onValueChange: (id) => {
31
+ if (id === active?.id)
32
+ return;
33
+ const chip = chips.find((candidate) => candidate.id === id);
34
+ if (chip !== undefined)
35
+ onChange(facet.field, chip.values);
36
+ }, children: chips.map((chip) => (_jsxs(DropdownMenuRadioItem, { value: chip.id, "data-testid": `facet-${facet.field}-${chip.id}`, children: [_jsx("span", { className: "flex-1", children: chip.label }), facet.showCounts === true && chip.count !== undefined && (_jsx("span", { className: "ml-4 tabular-nums text-muted-foreground", children: chip.count }))] }, chip.id))) }) })] }));
37
+ }
20
38
  // Faceted filter dropdown: outline button (like shadcn's "Columns" toggle) +
21
39
  // multi-select checkboxes. Active selection -> count badge on the button.
22
- export function FacetFilter({ facet, selected, onChange, dense = false, }) {
40
+ export function FacetFilter({ facet, selected, onChange, dense = false, pill = false, }) {
41
+ const translate = useOptionalTranslation();
42
+ const allLabel = translate?.("kumiko.list.filter.all") ?? "All";
23
43
  const toggle = (value, checked) => {
24
44
  const next = checked ? [...selected, value] : selected.filter((v) => v !== value);
25
45
  onChange(facet.field, next);
26
46
  };
47
+ if (facet.chips !== undefined && facet.display === "select") {
48
+ return (_jsx(FacetSelect, { facet: facet, selected: selected, onChange: onChange, dense: dense, pill: pill }));
49
+ }
27
50
  if (facet.chips !== undefined) {
28
51
  return _jsx(FacetChips, { facet: facet, selected: selected, onChange: onChange });
29
52
  }
30
53
  if (facet.onSearchChange !== undefined) {
31
54
  return (_jsx(FacetSearchFilter, { facet: facet, onSearchChange: facet.onSearchChange, selected: selected, onChange: onChange, dense: dense }));
32
55
  }
33
- return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(UiButton, { variant: "outline", size: "sm", className: cn("h-9", dense && "border-border-strong px-2.5"), "data-testid": `facet-${facet.field}`, children: [facet.label, selected.length > 0 && (_jsx(Badge, { variant: "secondary", className: "ml-1 rounded-sm px-1 font-normal tabular-nums", children: selected.length })), _jsx(ChevronDown, { className: "text-muted-foreground" })] }) }), _jsx(DropdownMenuContent, { align: "start", className: "max-h-[var(--radix-dropdown-menu-content-available-height)] w-44 overflow-y-auto", children: facet.options.map((opt) => (_jsx(DropdownMenuCheckboxItem, { checked: selected.includes(opt.value), onCheckedChange: (checked) => toggle(opt.value, checked), onSelect: (e) => e.preventDefault(), "data-testid": `facet-${facet.field}-${opt.value}`, children: opt.label }, opt.value))) })] }));
56
+ return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(UiButton, { variant: "outline", size: "sm", className: cn("h-9", dense && "border-border-strong px-2.5", pill && PILL_CLASSES), "data-testid": `facet-${facet.field}`, children: [selected.length === 0 ? `${facet.label}: ${allLabel}` : facet.label, selected.length > 0 && (_jsx(Badge, { variant: "secondary", className: "ml-1 rounded-sm px-1 font-normal tabular-nums", children: selected.length })), _jsx(ChevronDown, { className: "text-muted-foreground" })] }) }), _jsx(DropdownMenuContent, { align: "start", className: "max-h-[var(--radix-dropdown-menu-content-available-height)] w-44 overflow-y-auto", children: facet.options.map((opt) => (_jsx(DropdownMenuCheckboxItem, { checked: selected.includes(opt.value), onCheckedChange: (checked) => toggle(opt.value, checked), onSelect: (e) => e.preventDefault(), "data-testid": `facet-${facet.field}-${opt.value}`, children: opt.label }, opt.value))) })] }));
34
57
  }
35
58
  // Time-range filter: two native <input type="date"> instead of a
36
59
  // dropdown — the browser supplies the calendar, the locale and the keyboard
@@ -25,7 +25,7 @@ export function FacetSearchFilter({ facet, onSearchChange, selected, onChange, d
25
25
  const toggle = (value) => {
26
26
  onChange(facet.field, selected.includes(value) ? selected.filter((v) => v !== value) : [...selected, value]);
27
27
  };
28
- return (_jsxs(PopoverPrimitive.Root, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverPrimitive.Trigger, { asChild: true, children: _jsxs(UiButton, { variant: "outline", size: "sm", className: cn("h-9", dense && "border-border-strong px-2.5"), "data-testid": `facet-${facet.field}`, children: [facet.label, selected.length > 0 && (_jsx(Badge, { variant: "secondary", className: "ml-1 rounded-sm px-1 font-normal tabular-nums", children: selected.length })), _jsx(ChevronDown, { className: "text-muted-foreground" })] }) }), _jsx(PopoverPrimitive.Portal, { children: _jsx(PopoverPrimitive.Content, { align: "start", sideOffset: 4, className: "z-50 w-64 rounded-md border bg-popover p-0 text-popover-foreground shadow-md outline-none", children: _jsxs(Command, { shouldFilter: false, children: [_jsxs("div", { className: "relative", children: [_jsx(Command.Input, { value: searchTerm, onValueChange: setSearchTerm, placeholder: t("kumiko.combobox.search-placeholder"), "data-testid": `facet-${facet.field}-search`, className: "flex h-9 w-full border-0 border-b border-border bg-transparent px-3 py-1 text-sm outline-none placeholder:text-muted-foreground" }), facet.searching === true && (_jsx(Loader2, { className: "absolute right-2 top-2.5 h-4 w-4 animate-spin text-muted-foreground" }))] }), _jsxs(Command.List, { className: "max-h-64 overflow-y-auto p-1", children: [_jsx(Command.Empty, { className: "py-3 text-center text-sm text-muted-foreground", children: facet.searching === true
28
+ return (_jsxs(PopoverPrimitive.Root, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverPrimitive.Trigger, { asChild: true, children: _jsxs(UiButton, { variant: "outline", size: "sm", className: cn("h-9", dense && "border-border-strong px-2.5"), "data-testid": `facet-${facet.field}`, children: [selected.length === 0 ? `${facet.label}: ${t("kumiko.list.filter.all")}` : facet.label, selected.length > 0 && (_jsx(Badge, { variant: "secondary", className: "ml-1 rounded-sm px-1 font-normal tabular-nums", children: selected.length })), _jsx(ChevronDown, { className: "text-muted-foreground" })] }) }), _jsx(PopoverPrimitive.Portal, { children: _jsx(PopoverPrimitive.Content, { align: "start", sideOffset: 4, className: "z-50 w-64 rounded-md border bg-popover p-0 text-popover-foreground shadow-md outline-none", children: _jsxs(Command, { shouldFilter: false, children: [_jsxs("div", { className: "relative", children: [_jsx(Command.Input, { value: searchTerm, onValueChange: setSearchTerm, placeholder: t("kumiko.combobox.search-placeholder"), "data-testid": `facet-${facet.field}-search`, className: "flex h-9 w-full border-0 border-b border-border bg-transparent px-3 py-1 text-sm outline-none placeholder:text-muted-foreground" }), facet.searching === true && (_jsx(Loader2, { className: "absolute right-2 top-2.5 h-4 w-4 animate-spin text-muted-foreground" }))] }), _jsxs(Command.List, { className: "max-h-64 overflow-y-auto p-1", children: [_jsx(Command.Empty, { className: "py-3 text-center text-sm text-muted-foreground", children: facet.searching === true
29
29
  ? t("kumiko.combobox.loading")
30
30
  : t("kumiko.combobox.empty") }), facet.options.map((opt) => (_jsxs(Command.Item, { value: opt.value, onSelect: () => toggle(opt.value), "data-testid": `facet-${facet.field}-${opt.value}`, className: "relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground", children: [selected.includes(opt.value) && (_jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: _jsx(Check, { className: "h-4 w-4" }) })), opt.label] }, opt.value)))] })] }) }) })] }));
31
31
  }
@@ -8,13 +8,18 @@ export declare function FileThumbnail({ fileId, variant, className, testId, }: {
8
8
  readonly className?: string;
9
9
  readonly testId?: string;
10
10
  }): ReactNode;
11
- type FileMeta = {
11
+ export type FileMeta = {
12
12
  readonly fileName: string;
13
13
  readonly mimeType: string | undefined;
14
14
  };
15
15
  /** File names are per-user data and the server re-checks access per request, so
16
16
  * the cache must not outlive the session that filled it. */
17
17
  export declare function clearFileMetaCache(): void;
18
+ /** `settled` is false while the lookup runs, so "still loading" and "no meta for this id" differ. */
19
+ export declare function useFileMetaResult(fileId: string): {
20
+ readonly meta: FileMeta | null;
21
+ readonly settled: boolean;
22
+ };
18
23
  export declare function useFileMeta(fileId: string): FileMeta | null;
19
24
  export declare function FileNameLink({ fileId, fallbackLabel, className, }: {
20
25
  readonly fileId: string;
@@ -31,4 +36,3 @@ export declare function FileDisplayCell({ value, display, fallbackLabel, compact
31
36
  readonly fallbackLabel: string;
32
37
  readonly compact?: boolean;
33
38
  }): ReactNode;
34
- export {};
@@ -93,7 +93,7 @@ function flushPendingMetaIds() {
93
93
  }
94
94
  function loadFileMeta(fileId) {
95
95
  const cached = metaCache.get(fileId);
96
- if (cached)
96
+ if (cached !== undefined)
97
97
  return cached;
98
98
  const promise = new Promise((resolve) => {
99
99
  if (pendingMetaIds.size === 0)
@@ -112,23 +112,30 @@ function loadFileMeta(fileId) {
112
112
  metaCache.set(fileId, promise);
113
113
  return promise;
114
114
  }
115
- export function useFileMeta(fileId) {
116
- const [meta, setMeta] = useState(null);
115
+ /** `settled` is false while the lookup runs, so "still loading" and "no meta for this id" differ. */
116
+ export function useFileMetaResult(fileId) {
117
+ const [result, setResult] = useState({
118
+ meta: null,
119
+ settled: false,
120
+ });
117
121
  const validId = isUuid(fileId);
118
122
  useEffect(() => {
119
123
  let cancelled = false;
120
- setMeta(null);
124
+ setResult({ meta: null, settled: false });
121
125
  if (!validId)
122
126
  return;
123
127
  void loadFileMeta(fileId).then((loaded) => {
124
128
  if (!cancelled)
125
- setMeta(loaded);
129
+ setResult({ meta: loaded, settled: true });
126
130
  });
127
131
  return () => {
128
132
  cancelled = true;
129
133
  };
130
134
  }, [fileId, validId]);
131
- return meta;
135
+ return result;
136
+ }
137
+ export function useFileMeta(fileId) {
138
+ return useFileMetaResult(fileId).meta;
132
139
  }
133
140
  export function FileNameLink({ fileId, fallbackLabel, className, }) {
134
141
  const fileName = useFileMeta(fileId)?.fileName ?? null;
@@ -6,11 +6,12 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
6
6
  // file name link. A disabled input shows the value only, without controls.
7
7
  import { ImageIcon, Loader2, Upload } from "lucide-react";
8
8
  import { useRef, useState } from "react";
9
- import { useSessionEndedSignal, useTranslation } from "../../index.js";
9
+ import { useSessionEndedSignal, useTrackFormUpload, useTranslation } from "../../index.js";
10
+ import { isSessionEndedCause } from "../../session/session-ended.js";
10
11
  import { toAcceptAttr } from "../lib/accept-attr.js";
11
12
  import { resizeImageBeforeUpload } from "../lib/resize-image.js";
12
13
  import { uploadErrorKey } from "../lib/upload-error-key.js";
13
- import { isSessionEndedUploadError, uploadFileRef } from "../lib/upload-file-ref.js";
14
+ import { uploadFileRef } from "../lib/upload-file-ref.js";
14
15
  import { Button as UiButton } from "../ui/button.js";
15
16
  import { FileNameLink, FileThumbnail } from "./file-thumbnail.js";
16
17
  // React's input typings have no `webkitdirectory`; spreading keeps it typed-cast-free.
@@ -18,6 +19,7 @@ const DIRECTORY_INPUT_ATTRS = { webkitdirectory: "", multiple: true };
18
19
  export function FileUploadInput({ kind, id, value, onChange, accept, disabled, entityType, uploadActionForm, entityId, fieldName, subField, imageVariant, capture, directory, onFilesPicked, pickLabel, testId, }) {
19
20
  const t = useTranslation();
20
21
  const sessionEnded = useSessionEndedSignal();
22
+ const trackFormUpload = useTrackFormUpload();
21
23
  const inputRef = useRef(null);
22
24
  const [uploading, setUploading] = useState(false);
23
25
  const [error, setError] = useState(null);
@@ -34,17 +36,19 @@ export function FileUploadInput({ kind, id, value, onChange, accept, disabled, e
34
36
  setUploading(true);
35
37
  setError(null);
36
38
  try {
37
- const uploadFile = await resizeImageBeforeUpload(file);
38
- onChange(await uploadFileRef(uploadFile, {
39
- entityType,
40
- entityId,
41
- fieldName,
42
- subField,
43
- actionForm: uploadActionForm,
44
- }));
39
+ await trackFormUpload(async () => {
40
+ const uploadFile = await resizeImageBeforeUpload(file);
41
+ onChange(await uploadFileRef(uploadFile, {
42
+ entityType,
43
+ entityId,
44
+ fieldName,
45
+ subField,
46
+ actionForm: uploadActionForm,
47
+ }));
48
+ });
45
49
  }
46
50
  catch (cause) {
47
- if (isSessionEndedUploadError(cause))
51
+ if (isSessionEndedCause(cause))
48
52
  sessionEnded?.notify();
49
53
  setError(t(uploadErrorKey(cause)));
50
54
  }
@@ -0,0 +1,6 @@
1
+ import { type ReactNode } from "react";
2
+ /** "View" action for a stored file: renders only for PDFs and opens the viewer in a drawer.
3
+ * The MIME type comes from `useFileMeta`, so a list of rows costs one batched meta request. */
4
+ export declare function FileViewAction({ fileId }: {
5
+ readonly fileId: string;
6
+ }): ReactNode;
@@ -0,0 +1,19 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { isUuid } from "@cosmicdrift/kumiko-types/identifiers";
3
+ import { useState } from "react";
4
+ import { useTranslation } from "../../index.js";
5
+ import { Button } from "../ui/button.js";
6
+ import { PdfPreview } from "../widgets/pdf-preview.js";
7
+ import { DefaultDrawer } from "./drawer.js";
8
+ import { fileOriginalUrl, useFileMeta } from "./file-thumbnail.js";
9
+ const PDF_MIME_TYPE = "application/pdf";
10
+ /** "View" action for a stored file: renders only for PDFs and opens the viewer in a drawer.
11
+ * The MIME type comes from `useFileMeta`, so a list of rows costs one batched meta request. */
12
+ export function FileViewAction({ fileId }) {
13
+ const t = useTranslation();
14
+ const meta = useFileMeta(fileId);
15
+ const [open, setOpen] = useState(false);
16
+ if (!isUuid(fileId) || meta?.mimeType !== PDF_MIME_TYPE)
17
+ return null;
18
+ return (_jsxs(_Fragment, { children: [_jsx(Button, { type: "button", variant: "link", size: "sm", onClick: () => setOpen(true), "data-testid": `file-view-${fileId}`, children: t("kumiko.field.file-list.view") }), _jsx(DefaultDrawer, { open: open, onOpenChange: setOpen, title: meta.fileName, testId: `file-view-drawer-${fileId}`, children: _jsx("div", { className: "min-h-0 flex-1", children: _jsx(PdfPreview, { variant: "viewer", fill: true, source: { url: fileOriginalUrl(fileId) }, testId: `file-view-pdf-${fileId}` }) }) })] }));
19
+ }
@@ -2,14 +2,28 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  // Drop zone for a `files` / `images` field with `display: "dropzone"`: one status row per picked
3
3
  // file, the field value is the array of FileRef ids of the files that uploaded. Failed files stay
4
4
  // out of the value; removing a row removes its id.
5
+ import { isUuid } from "@cosmicdrift/kumiko-types/identifiers";
5
6
  import { useEffect, useRef } from "react";
6
- import { useSessionEndedSignal, useTranslation } from "../../index.js";
7
+ import { useSessionEndedSignal, useTrackFormUpload, useTranslation } from "../../index.js";
8
+ import { isSessionEndedCause } from "../../session/session-ended.js";
7
9
  import { FileCountLimitError, uploadErrorKey } from "../lib/upload-error-key.js";
8
- import { isSessionEndedUploadError, uploadFileRef, } from "../lib/upload-file-ref.js";
10
+ import { uploadFileRef } from "../lib/upload-file-ref.js";
9
11
  import { UploadZone } from "../widgets/upload-zone.js";
12
+ import { useFileMetaResult } from "./file-thumbnail.js";
13
+ function FileRefName({ fileId }) {
14
+ const t = useTranslation();
15
+ const { meta, settled } = useFileMetaResult(fileId);
16
+ // A non-UUID value has no meta to resolve; show it as is.
17
+ if (!isUuid(fileId))
18
+ return fileId;
19
+ if (meta)
20
+ return meta.fileName;
21
+ return settled ? t("kumiko.field.dropzone.file-unavailable") : "…";
22
+ }
10
23
  export function FilesDropzoneInput({ id, value, onChange, accept, maxSize, maxCount, disabled, entityType, uploadActionForm, entityId, fieldName, testId, }) {
11
24
  const t = useTranslation();
12
25
  const sessionEnded = useSessionEndedSignal();
26
+ const trackFormUpload = useTrackFormUpload();
13
27
  // Uploads of one batch finish independently; building each next value from the render's
14
28
  // `value` would drop the ids of the others. Re-synced whenever the owner changes the value.
15
29
  const latestIds = useRef(value);
@@ -35,7 +49,7 @@ export function FilesDropzoneInput({ id, value, onChange, accept, maxSize, maxCo
35
49
  return fileId;
36
50
  }
37
51
  catch (cause) {
38
- if (isSessionEndedUploadError(cause))
52
+ if (isSessionEndedCause(cause))
39
53
  sessionEnded?.notify();
40
54
  throw cause;
41
55
  }
@@ -54,5 +68,5 @@ export function FilesDropzoneInput({ id, value, onChange, accept, maxSize, maxCo
54
68
  ? t("kumiko.field.dropzone.limit-count", { count: maxCount })
55
69
  : undefined,
56
70
  ].filter((part) => part !== undefined);
57
- return (_jsx(UploadZone, { testId: testId ?? `${id}-dropzone`, title: t("kumiko.field.dropzone.title"), ...(limits.length > 0 && { hint: limits.join(" · ") }), ...(accept !== undefined && { accept }), ...(disabled !== undefined && { disabled }), doneValues: value, onUpload: uploadOne, onRemove: removeOne, describeError: (cause) => t(uploadErrorKey(cause), { count: maxCount }) }));
71
+ return (_jsx(UploadZone, { testId: testId ?? `${id}-dropzone`, title: t("kumiko.field.dropzone.title"), ...(limits.length > 0 && { hint: limits.join(" · ") }), ...(accept !== undefined && { accept }), ...(disabled !== undefined && { disabled }), doneValues: value, trackUpload: trackFormUpload, labelForValue: (fileId) => _jsx(FileRefName, { fileId: fileId }), onUpload: uploadOne, onRemove: removeOne, describeError: (cause) => t(uploadErrorKey(cause), { count: maxCount }) }));
58
72
  }
@@ -10,7 +10,6 @@ export type FormFooterModel = {
10
10
  readonly unsavedCount: number | undefined;
11
11
  readonly railed: boolean;
12
12
  readonly pinned: boolean;
13
- readonly secondaryActions: ReactNode;
14
13
  readonly renderedSecondary: ReactNode;
15
14
  readonly renderedActions: ReactNode;
16
15
  readonly hasNonPrimaryOverflow: boolean;
@@ -185,7 +185,6 @@ export function FormFooter({ actions, secondaryActions, testId, chromeless, stic
185
185
  unsavedCount,
186
186
  railed,
187
187
  pinned,
188
- secondaryActions,
189
188
  renderedSecondary,
190
189
  renderedActions,
191
190
  hasNonPrimaryOverflow,
@@ -0,0 +1,32 @@
1
+ import { type ReactNode } from "react";
2
+ import type { ListColumnHintViewModel } from "../../headless/index.ts";
3
+ export type HintReasonRowControl = {
4
+ readonly hint: ListColumnHintViewModel;
5
+ readonly open: boolean;
6
+ readonly onToggle: () => void;
7
+ readonly boxId: string;
8
+ };
9
+ /**
10
+ * Set when the row of `hint` owns the reason state, because it draws the box as a row of its own.
11
+ * The match is by object identity: the scope and the cell must both take `hint` from the same
12
+ * `m.columns` entry, so a copy such as `cardHint` deliberately does not match.
13
+ */
14
+ export declare function useHintReasonRowControl(hint: ListColumnHintViewModel): HintReasonRowControl | undefined;
15
+ export declare function nonEmptyText(value: unknown): string | undefined;
16
+ export type HintReason = {
17
+ readonly text: string;
18
+ readonly title: string | undefined;
19
+ };
20
+ export declare function hintReasonOf(hint: ListColumnHintViewModel, row: Readonly<Record<string, unknown>>): HintReason | undefined;
21
+ export declare function isReasonOpenByDefault(hint: ListColumnHintViewModel, row: Readonly<Record<string, unknown>>): boolean;
22
+ /**
23
+ * Keeps the open state of a row's reason and draws the box as a row below the row, over its full
24
+ * width. Without a `hint` it only renders its children, so the row does not remount when a reason
25
+ * appears or disappears. The default-open state counts at the first render only, and not below sm.
26
+ */
27
+ export declare function HintReasonRowScope({ hint, row, renderBoxRow, children, }: {
28
+ readonly hint: ListColumnHintViewModel | undefined;
29
+ readonly row: Readonly<Record<string, unknown>>;
30
+ readonly renderBoxRow: (box: ReactNode) => ReactNode;
31
+ readonly children: ReactNode;
32
+ }): ReactNode;
@@ -0,0 +1,45 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { createContext, useContext, useId, useState } from "react";
3
+ import { ReasonBox } from "./reason-box.js";
4
+ import { useIsBelowSmViewport } from "./use-narrow-viewport.js";
5
+ const HintReasonRowContext = createContext(undefined);
6
+ /**
7
+ * Set when the row of `hint` owns the reason state, because it draws the box as a row of its own.
8
+ * The match is by object identity: the scope and the cell must both take `hint` from the same
9
+ * `m.columns` entry, so a copy such as `cardHint` deliberately does not match.
10
+ */
11
+ export function useHintReasonRowControl(hint) {
12
+ const control = useContext(HintReasonRowContext);
13
+ return control?.hint === hint ? control : undefined;
14
+ }
15
+ export function nonEmptyText(value) {
16
+ if (typeof value !== "string")
17
+ return undefined;
18
+ const trimmed = value.trim();
19
+ return trimmed === "" ? undefined : trimmed;
20
+ }
21
+ export function hintReasonOf(hint, row) {
22
+ const text = hint.reasonField === undefined ? undefined : nonEmptyText(row[hint.reasonField]);
23
+ if (text === undefined)
24
+ return undefined;
25
+ const title = hint.reasonTitleField === undefined ? undefined : nonEmptyText(row[hint.reasonTitleField]);
26
+ return { text, title };
27
+ }
28
+ export function isReasonOpenByDefault(hint, row) {
29
+ return hint.reasonOpenField !== undefined && row[hint.reasonOpenField] === true;
30
+ }
31
+ /**
32
+ * Keeps the open state of a row's reason and draws the box as a row below the row, over its full
33
+ * width. Without a `hint` it only renders its children, so the row does not remount when a reason
34
+ * appears or disappears. The default-open state counts at the first render only, and not below sm.
35
+ */
36
+ export function HintReasonRowScope({ hint, row, renderBoxRow, children, }) {
37
+ const belowSm = useIsBelowSmViewport();
38
+ const boxId = useId();
39
+ const [open, setOpen] = useState(() => hint !== undefined && !belowSm && isReasonOpenByDefault(hint, row));
40
+ const reason = hint === undefined ? undefined : hintReasonOf(hint, row);
41
+ const control = hint === undefined ? undefined : { hint, open, onToggle: () => setOpen((was) => !was), boxId };
42
+ return (_jsxs(HintReasonRowContext.Provider, { value: control, children: [children, open &&
43
+ reason !== undefined &&
44
+ renderBoxRow(_jsx(ReasonBox, { id: boxId, "data-hint-reason": "true", ...(reason.title !== undefined && { title: reason.title }), children: reason.text }))] }));
45
+ }
@@ -16,6 +16,9 @@ import { DefaultMetric, DefaultMetricBand } from "./metric.js";
16
16
  import { DefaultModal } from "./modal.js";
17
17
  import { DefaultPageHeader } from "./page-header.js";
18
18
  import { PromoPanel } from "./promo-panel.js";
19
+ import { DefaultRecordBreadcrumb } from "./record-breadcrumb.js";
20
+ import { DefaultRecordSteps } from "./record-steps.js";
21
+ import { DefaultRecordSummary } from "./record-summary.js";
19
22
  import { CopyButton, ShareButton } from "./share-actions.js";
20
23
  import { DefaultStatusBadge } from "./status-badge.js";
21
24
  import { StickyActionBar } from "./sticky-action-bar.js";
@@ -68,6 +71,9 @@ export const defaultPrimitives = {
68
71
  StatusBadge: DefaultStatusBadge,
69
72
  Metric: DefaultMetric,
70
73
  MetricBand: DefaultMetricBand,
74
+ RecordBreadcrumb: DefaultRecordBreadcrumb,
75
+ RecordSummary: DefaultRecordSummary,
76
+ RecordSteps: DefaultRecordSteps,
71
77
  PageHeader: DefaultPageHeader,
72
78
  JsonView: DefaultJsonView,
73
79
  FileValueList,
@@ -2,7 +2,7 @@ import { type MouseEvent, type ReactNode } from "react";
2
2
  import type { FillContainerProps, GridCellProps, GridProps, HeadingProps, LinkProps, ProgressProps, SectionProps, StepBarProps, TextProps, WizardStepGroupProps } from "../../index.ts";
3
3
  import "../react-css-custom-properties.ts";
4
4
  export declare function DefaultSection({ id, title, subtitle, subtitleBelowLgOnly, children, actions, variant, layout, testId, icon, }: SectionProps): ReactNode;
5
- export declare function DefaultFillContainer({ children, testId, grow }: FillContainerProps): ReactNode;
5
+ export declare function DefaultFillContainer({ children, testId, grow, className, }: FillContainerProps): ReactNode;
6
6
  export declare function DefaultGrid({ columns, children, testId, maxRows, flow, list, ariaLabelledBy, }: GridProps): ReactNode;
7
7
  export declare function DefaultGridCell({ span, width, children }: GridCellProps): ReactNode;
8
8
  export declare function DefaultText({ variant, decorative, children, testId, }: TextProps): ReactNode;
@@ -45,11 +45,11 @@ export function DefaultSection({ id, title, subtitle, subtitleBelowLgOnly, child
45
45
  // non-portaled overlay.
46
46
  return (_jsx("div", { "data-slot": "card", "data-testid": testId, className: cn(cardSurface(), "overflow-hidden", variant === "destructive" && "border-destructive/40"), children: _jsxs("div", { className: "flex flex-col gap-4 px-6 py-6", children: [header, children] }) }));
47
47
  }
48
- export function DefaultFillContainer({ children, testId, grow }) {
48
+ export function DefaultFillContainer({ children, testId, grow, className, }) {
49
49
  // flex-1 only on request (`grow`, set under fillScreenHeight): without it the
50
50
  // container sizes to its content and only shrinks (min-h-0), so a two-row
51
51
  // table in a non-fixed-height screen does not stretch.
52
- return (_jsx("div", { "data-testid": testId, className: cn("flex min-h-0 flex-col", grow === true && "flex-1"), children: children }));
52
+ return (_jsx("div", { "data-testid": testId, className: cn("flex min-h-0 flex-col", grow === true && "flex-1", className), children: children }));
53
53
  }
54
54
  const DRAWER_FIELD_CELL_WIDTH_CLASS = {
55
55
  money: "w-full sm:w-[200px] [&_label]:whitespace-nowrap",
@@ -2,7 +2,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Children, createContext, useContext } from "react";
3
3
  import { Icon } from "../icons.js";
4
4
  import { cn } from "../lib/cn.js";
5
- import { STAT_CARD_GRID_CLASSES, StatCard } from "../widgets/stat.js";
5
+ import { StatCard } from "../widgets/stat.js";
6
+ // Two tiles per row on phones, then the dashboard stat-group fill.
7
+ const METRIC_TILE_GRID_CLASSES = "grid grid-cols-2 gap-3 md:grid-cols-[repeat(auto-fit,minmax(min(12rem,100%),1fr))]";
6
8
  const InsideMetricBandContext = createContext(false);
7
9
  // The screen-form column already insets and spaces its children; a band in its
8
10
  // header region must not add its own padding on top. DefaultCard resets this
@@ -13,17 +15,17 @@ export function DefaultMetricBand({ lead, subtitle, children, testId, tiles, })
13
15
  const insideScreenFormColumn = useContext(InsideScreenFormColumnContext);
14
16
  const hasMetrics = Children.toArray(children).length > 0;
15
17
  return (_jsxs("div", { className: cn("flex shrink-0 flex-col gap-3", !insideScreenFormColumn && "px-6 pb-4 pt-3.5"), "data-testid": testId, children: [lead !== undefined && _jsx("div", { "data-kumiko-layout": "metric-band-lead", children: lead }), subtitle !== undefined && (_jsx("div", { className: "flex flex-wrap items-center gap-x-2 text-[13px] text-foreground-secondary [&_a]:text-primary", children: subtitle })), hasMetrics &&
16
- (tiles === true ? (_jsx("div", { className: STAT_CARD_GRID_CLASSES, children: children })) : (_jsx(InsideMetricBandContext.Provider, { value: true, children: _jsx("dl", { className: "m-0 grid grid-cols-2 gap-6 md:grid-cols-3 lg:grid-cols-5", children: children }) })))] }));
18
+ (tiles === true ? (_jsx("div", { className: METRIC_TILE_GRID_CLASSES, children: children })) : (_jsx(InsideMetricBandContext.Provider, { value: true, children: _jsx("dl", { className: "m-0 grid grid-cols-2 gap-6 md:grid-cols-3 lg:grid-cols-5", children: children }) })))] }));
17
19
  }
18
- function MetricTile({ label, value, testId, onPress, tone, icon }) {
19
- const card = (_jsx(StatCard, { label: label, value: value, ...(icon !== undefined && { icon: _jsx(Icon, { name: icon, className: "size-4" }) }), ...(tone !== undefined && { tone }), ...(testId !== undefined && { testId }) }));
20
+ function MetricTile({ label, value, testId, onPress, tone, icon, sub }) {
21
+ const card = (_jsx(StatCard, { label: label, value: value, ...(sub !== undefined && { sub }), ...(onPress !== undefined && { navigable: true }), ...(icon !== undefined && { icon: _jsx(Icon, { name: icon, className: "size-4" }) }), ...(tone !== undefined && { tone }), ...(testId !== undefined && { testId }) }));
20
22
  return onPress !== undefined ? (_jsx("button", { type: "button", className: "text-left", onClick: onPress, children: card })) : (card);
21
23
  }
22
24
  export function DefaultMetric(props) {
23
25
  const insideBand = useContext(InsideMetricBandContext);
24
26
  if (props.tile === true)
25
27
  return _jsx(MetricTile, { ...props });
26
- const { label, value, testId, onPress } = props;
27
- const item = (_jsxs("div", { "data-testid": testId, className: cn("flex min-w-0 flex-col gap-0.5", onPress !== undefined && "cursor-pointer"), ...(onPress !== undefined && { onClick: onPress }), children: [_jsx("dt", { className: "text-xs text-muted-foreground", "data-testid": testId !== undefined ? `${testId}-label` : undefined, children: label }), _jsx("dd", { className: "m-0 text-base font-medium tabular-nums text-foreground", "data-testid": testId !== undefined ? `${testId}-value` : undefined, children: onPress !== undefined ? (_jsx("button", { type: "button", className: "text-left hover:underline", children: value })) : (value) })] }));
28
+ const { label, value, testId, onPress, sub } = props;
29
+ const item = (_jsxs("div", { "data-testid": testId, className: cn("flex min-w-0 flex-col gap-0.5", onPress !== undefined && "cursor-pointer"), ...(onPress !== undefined && { onClick: onPress }), children: [_jsx("dt", { className: "text-xs text-muted-foreground", "data-testid": testId !== undefined ? `${testId}-label` : undefined, children: label }), _jsxs("dd", { className: "m-0 text-base font-medium tabular-nums text-foreground", "data-testid": testId !== undefined ? `${testId}-value` : undefined, children: [onPress !== undefined ? (_jsx("button", { type: "button", className: "text-left hover:underline", children: value })) : (value), sub !== undefined && (_jsx("span", { className: "block text-xs font-normal text-muted-foreground", "data-testid": testId !== undefined ? `${testId}-sub` : undefined, children: sub }))] })] }));
28
30
  return insideBand ? item : _jsx("dl", { className: "m-0", children: item });
29
31
  }
@@ -1,3 +1,3 @@
1
1
  import { type ReactNode } from "react";
2
2
  import type { PageHeaderProps } from "../../index.ts";
3
- export declare function DefaultPageHeader({ title, recordTitle, status, actions, overflowItems, hideBreadcrumb, breadcrumbScreenId, }: PageHeaderProps): ReactNode;
3
+ export declare function DefaultPageHeader({ title, recordTitle, status, actions, bodyTitle, overflowItems, hideBreadcrumb, breadcrumbScreenId, }: PageHeaderProps): ReactNode;
@@ -4,11 +4,12 @@ import { createPortal } from "react-dom";
4
4
  import { usePageHeaderSlot } from "../layout/page-header-slot.js";
5
5
  import { UNIFORM_BAR_CONTROLS_CLASSES } from "../layout/uniform-bar-controls.js";
6
6
  import { cn } from "../lib/cn.js";
7
- export function DefaultPageHeader({ title, recordTitle, status, actions, overflowItems, hideBreadcrumb, breadcrumbScreenId, }) {
7
+ export function DefaultPageHeader({ title, recordTitle, status, actions, bodyTitle, overflowItems, hideBreadcrumb, breadcrumbScreenId, }) {
8
8
  const slot = usePageHeaderSlot();
9
9
  const setOverflowItems = slot?.setOverflowItems;
10
10
  const setTitle = slot?.setTitle;
11
11
  const setRecordTitle = slot?.setRecordTitle;
12
+ const setBodyTitle = slot?.setBodyTitle;
12
13
  const setBreadcrumbHidden = slot?.setBreadcrumbHidden;
13
14
  const setBreadcrumbScreenId = slot?.setBreadcrumbScreenId;
14
15
  useEffect(() => {
@@ -23,6 +24,12 @@ export function DefaultPageHeader({ title, recordTitle, status, actions, overflo
23
24
  setBreadcrumbScreenId(breadcrumbScreenId);
24
25
  return () => setBreadcrumbScreenId(undefined);
25
26
  }, [setBreadcrumbScreenId, breadcrumbScreenId]);
27
+ useEffect(() => {
28
+ if (setBodyTitle === undefined || bodyTitle !== true)
29
+ return;
30
+ setBodyTitle(true);
31
+ return () => setBodyTitle(false);
32
+ }, [setBodyTitle, bodyTitle]);
26
33
  useEffect(() => {
27
34
  if (setRecordTitle === undefined || recordTitle === undefined)
28
35
  return;