@cosmicdrift/kumiko-renderer 0.415.0 → 0.417.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 (221) hide show
  1. package/dist/app/action-form-body.d.ts +2 -5
  2. package/dist/app/action-form-body.js +50 -22
  3. package/dist/app/action-form-support.d.ts +4 -1
  4. package/dist/app/action-form-support.js +8 -4
  5. package/dist/app/client-actions.js +6 -4
  6. package/dist/app/config-edit-body.js +83 -82
  7. package/dist/app/entity-list-screen.js +1 -1
  8. package/dist/app/extension-sections.d.ts +2 -0
  9. package/dist/app/header-actions-bar.d.ts +3 -1
  10. package/dist/app/header-actions-bar.js +12 -4
  11. package/dist/app/locked-screen-header.d.ts +2 -0
  12. package/dist/app/locked-screen-header.js +8 -1
  13. package/dist/app/projection-detail-body.js +29 -8
  14. package/dist/app/projection-detail-guidance.d.ts +2 -1
  15. package/dist/app/projection-detail-guidance.js +45 -30
  16. package/dist/app/projection-detail-header-model.d.ts +1 -1
  17. package/dist/app/projection-detail-header-model.js +14 -6
  18. package/dist/app/projection-detail-header-region.js +25 -9
  19. package/dist/app/projection-detail-header.d.ts +2 -0
  20. package/dist/app/projection-detail-header.js +31 -4
  21. package/dist/app/projection-detail-navigation.d.ts +4 -0
  22. package/dist/app/projection-detail-navigation.js +5 -1
  23. package/dist/app/projection-list-shim.js +1 -0
  24. package/dist/app/row-actions.d.ts +4 -0
  25. package/dist/app/row-actions.js +19 -3
  26. package/dist/app/screen-shared.d.ts +1 -0
  27. package/dist/app/screen-shared.js +23 -3
  28. package/dist/app/use-projection-detail-actions.d.ts +16 -1
  29. package/dist/app/use-projection-detail-actions.js +23 -3
  30. package/dist/app/use-projection-detail-data.d.ts +2 -0
  31. package/dist/app/use-projection-detail-data.js +53 -10
  32. package/dist/app/use-projection-list-data.js +1 -1
  33. package/dist/card-options.d.ts +2 -0
  34. package/dist/components/ai-assist-payload.d.ts +2 -0
  35. package/dist/components/ai-assist-payload.js +8 -0
  36. package/dist/components/choice-chip-class.d.ts +1 -0
  37. package/dist/components/choice-chip-class.js +9 -0
  38. package/dist/components/edit-mounts.d.ts +3 -2
  39. package/dist/components/edit-mounts.js +2 -2
  40. package/dist/components/grid-cell-for-field.js +1 -1
  41. package/dist/components/multi-select-chips.d.ts +10 -0
  42. package/dist/components/multi-select-chips.js +19 -0
  43. package/dist/components/narrow-description.d.ts +3 -0
  44. package/dist/components/narrow-description.js +12 -0
  45. package/dist/components/related-list-section.d.ts +5 -3
  46. package/dist/components/related-list-section.js +52 -35
  47. package/dist/components/related-photo-grid.d.ts +11 -0
  48. package/dist/components/related-photo-grid.js +54 -0
  49. package/dist/components/render-edit-action-button.d.ts +2 -2
  50. package/dist/components/render-edit-field-grid.d.ts +12 -3
  51. package/dist/components/render-edit-field-grid.js +60 -18
  52. package/dist/components/render-edit-fields-section.js +45 -11
  53. package/dist/components/render-edit-header-actions.d.ts +2 -1
  54. package/dist/components/render-edit-header-actions.js +18 -1
  55. package/dist/components/render-edit-layout.js +5 -3
  56. package/dist/components/render-edit-logic.js +1 -0
  57. package/dist/components/render-edit-section-kinds.js +59 -10
  58. package/dist/components/render-edit-titles.js +1 -1
  59. package/dist/components/render-edit-types.d.ts +22 -1
  60. package/dist/components/render-field-ai-assist.d.ts +13 -0
  61. package/dist/components/render-field-ai-assist.js +90 -0
  62. package/dist/components/render-field-choice-inputs.js +4 -0
  63. package/dist/components/render-field-control.d.ts +1 -1
  64. package/dist/components/render-field-control.js +19 -9
  65. package/dist/components/render-field-value-chips.d.ts +9 -0
  66. package/dist/components/render-field-value-chips.js +47 -0
  67. package/dist/components/render-field-write-only.js +12 -4
  68. package/dist/components/render-list-hint-columns.d.ts +2 -0
  69. package/dist/components/render-list-hint-columns.js +43 -5
  70. package/dist/components/render-list-reference-columns.js +2 -4
  71. package/dist/components/render-list-row-tone.d.ts +2 -0
  72. package/dist/components/render-list-row-tone.js +6 -0
  73. package/dist/components/render-list-table-props.d.ts +13 -2
  74. package/dist/components/render-list-table-props.js +9 -3
  75. package/dist/components/render-list-types.d.ts +4 -0
  76. package/dist/components/render-list.js +12 -4
  77. package/dist/components/use-render-edit-sections.js +5 -1
  78. package/dist/components/use-render-list-columns.js +3 -3
  79. package/dist/components/write-form-registry.d.ts +13 -0
  80. package/dist/components/write-form-registry.js +6 -0
  81. package/dist/components/write-form-section.d.ts +5 -1
  82. package/dist/components/write-form-section.js +55 -16
  83. package/dist/headless/form/form-controller.d.ts +1 -0
  84. package/dist/headless/form/form-controller.js +1 -1
  85. package/dist/headless/format/index.d.ts +1 -0
  86. package/dist/headless/format/index.js +21 -0
  87. package/dist/headless/format/phone.d.ts +1 -0
  88. package/dist/headless/format/phone.js +8 -0
  89. package/dist/headless/format/relative-time.d.ts +15 -0
  90. package/dist/headless/format/relative-time.js +63 -0
  91. package/dist/headless/format/safe-locale.d.ts +1 -0
  92. package/dist/headless/format/safe-locale.js +13 -0
  93. package/dist/headless/index.d.ts +2 -2
  94. package/dist/headless/index.js +2 -2
  95. package/dist/headless/view-model/edit.d.ts +3 -2
  96. package/dist/headless/view-model/edit.js +162 -36
  97. package/dist/headless/view-model/field-text.d.ts +9 -0
  98. package/dist/headless/view-model/field-text.js +19 -0
  99. package/dist/headless/view-model/index.d.ts +1 -0
  100. package/dist/headless/view-model/index.js +1 -0
  101. package/dist/headless/view-model/list.js +6 -0
  102. package/dist/headless/view-model/types.d.ts +76 -5
  103. package/dist/hooks/use-list-table.js +11 -6
  104. package/dist/i18n-defaults.js +9 -2
  105. package/dist/index.d.ts +1 -1
  106. package/dist/primitives-record-guidance.d.ts +32 -1
  107. package/dist/primitives-share-types.d.ts +82 -0
  108. package/dist/primitives-share-types.js +1 -0
  109. package/dist/primitives.d.ts +44 -86
  110. package/dist/web/app/bold-markup.d.ts +3 -0
  111. package/dist/web/app/bold-markup.js +14 -0
  112. package/dist/web/app/dashboard-body.js +8 -3
  113. package/dist/web/app/dashboard-list-panel.js +8 -4
  114. package/dist/web/app/dashboard-panel-columns.d.ts +9 -0
  115. package/dist/web/app/dashboard-panel-columns.js +14 -0
  116. package/dist/web/app/dashboard-panels.js +31 -3
  117. package/dist/web/app/dashboard-shared.d.ts +3 -1
  118. package/dist/web/app/dashboard-shared.js +4 -4
  119. package/dist/web/app/dashboard-stat-group-panel.d.ts +1 -1
  120. package/dist/web/app/dashboard-stat-group-panel.js +24 -3
  121. package/dist/web/app/dashboard-text-panel.d.ts +1 -0
  122. package/dist/web/app/dashboard-text-panel.js +18 -11
  123. package/dist/web/app/relative-time.d.ts +0 -5
  124. package/dist/web/app/relative-time.js +11 -21
  125. package/dist/web/components/config-cascade.d.ts +2 -1
  126. package/dist/web/components/config-cascade.js +16 -4
  127. package/dist/web/drawn-icons.js +2 -1
  128. package/dist/web/layout/header-action-pinned.d.ts +4 -2
  129. package/dist/web/layout/header-action-pinned.js +13 -4
  130. package/dist/web/layout/header-overflow-menu.d.ts +2 -0
  131. package/dist/web/layout/header-overflow-menu.js +2 -0
  132. package/dist/web/layout/notification-bell.js +12 -3
  133. package/dist/web/layout/page-header-slot.d.ts +2 -0
  134. package/dist/web/layout/page-header-slot.js +4 -0
  135. package/dist/web/layout/screen-focus.js +4 -1
  136. package/dist/web/layout/shell-header.js +13 -5
  137. package/dist/web/primitives/banner.js +24 -8
  138. package/dist/web/primitives/card.js +5 -3
  139. package/dist/web/primitives/combobox.js +2 -2
  140. package/dist/web/primitives/data-table/actions-column.js +1 -1
  141. package/dist/web/primitives/data-table/card-body.d.ts +1 -1
  142. package/dist/web/primitives/data-table/card-body.js +37 -14
  143. package/dist/web/primitives/data-table/card-frame.d.ts +2 -0
  144. package/dist/web/primitives/data-table/card-frame.js +3 -0
  145. package/dist/web/primitives/data-table/card-row.js +34 -10
  146. package/dist/web/primitives/data-table/card-sort-select.js +1 -1
  147. package/dist/web/primitives/data-table/card-view.js +1 -1
  148. package/dist/web/primitives/data-table/data-cell-props.d.ts +4 -1
  149. package/dist/web/primitives/data-table/data-cell-props.js +3 -0
  150. package/dist/web/primitives/data-table/density.d.ts +3 -1
  151. package/dist/web/primitives/data-table/density.js +11 -4
  152. package/dist/web/primitives/data-table/row-click-guard.d.ts +2 -0
  153. package/dist/web/primitives/data-table/row-click-guard.js +19 -0
  154. package/dist/web/primitives/data-table/row-render-parts.d.ts +1 -1
  155. package/dist/web/primitives/data-table/row-render-parts.js +3 -5
  156. package/dist/web/primitives/data-table/sort-options-select.js +2 -2
  157. package/dist/web/primitives/data-table/sortable-header.js +4 -4
  158. package/dist/web/primitives/data-table/table-body.js +3 -1
  159. package/dist/web/primitives/data-table/table-chrome.js +1 -3
  160. package/dist/web/primitives/data-table/table-content.js +6 -6
  161. package/dist/web/primitives/data-table/table-data-cell.js +31 -17
  162. package/dist/web/primitives/data-table/table-header-row.js +1 -1
  163. package/dist/web/primitives/data-table/table-view.js +1 -1
  164. package/dist/web/primitives/data-table/toolbar.js +6 -7
  165. package/dist/web/primitives/data-table/use-data-table-state.d.ts +6 -1
  166. package/dist/web/primitives/data-table/use-data-table-state.js +12 -2
  167. package/dist/web/primitives/data-table-cell.d.ts +17 -3
  168. package/dist/web/primitives/data-table-cell.js +130 -36
  169. package/dist/web/primitives/data-table.js +1 -1
  170. package/dist/web/primitives/default-form.d.ts +1 -1
  171. package/dist/web/primitives/default-form.js +15 -11
  172. package/dist/web/primitives/drawer.js +2 -3
  173. package/dist/web/primitives/facet-filter.d.ts +1 -1
  174. package/dist/web/primitives/facet-filter.js +2 -5
  175. package/dist/web/primitives/facet-search-filter.js +1 -1
  176. package/dist/web/primitives/facet-trigger-label.d.ts +1 -4
  177. package/dist/web/primitives/facet-trigger-label.js +4 -7
  178. package/dist/web/primitives/field.js +15 -8
  179. package/dist/web/primitives/form-footer-parts.js +6 -3
  180. package/dist/web/primitives/form.js +6 -8
  181. package/dist/web/primitives/index.js +4 -0
  182. package/dist/web/primitives/inline-suffix.d.ts +2 -0
  183. package/dist/web/primitives/inline-suffix.js +5 -0
  184. package/dist/web/primitives/input-choice-kinds.js +12 -2
  185. package/dist/web/primitives/input-number-kinds.js +2 -2
  186. package/dist/web/primitives/input-text-kinds.js +1 -1
  187. package/dist/web/primitives/layout-elements.d.ts +4 -4
  188. package/dist/web/primitives/layout-elements.js +50 -13
  189. package/dist/web/primitives/layout.d.ts +1 -1
  190. package/dist/web/primitives/layout.js +1 -1
  191. package/dist/web/primitives/locale-number.d.ts +0 -1
  192. package/dist/web/primitives/locale-number.js +1 -13
  193. package/dist/web/primitives/money-input.js +10 -8
  194. package/dist/web/primitives/narrow-pinned-footer.js +7 -3
  195. package/dist/web/primitives/number-input.d.ts +2 -1
  196. package/dist/web/primitives/number-input.js +11 -5
  197. package/dist/web/primitives/page-header.d.ts +1 -1
  198. package/dist/web/primitives/page-header.js +8 -1
  199. package/dist/web/primitives/pager.js +12 -21
  200. package/dist/web/primitives/photo-grid.d.ts +3 -0
  201. package/dist/web/primitives/photo-grid.js +6 -0
  202. package/dist/web/primitives/record-steps.d.ts +1 -1
  203. package/dist/web/primitives/record-steps.js +7 -16
  204. package/dist/web/primitives/record-summary.d.ts +1 -1
  205. package/dist/web/primitives/record-summary.js +8 -3
  206. package/dist/web/primitives/row-actions.js +38 -24
  207. package/dist/web/primitives/step-list.d.ts +3 -0
  208. package/dist/web/primitives/step-list.js +11 -0
  209. package/dist/web/primitives/use-container-narrow.d.ts +12 -0
  210. package/dist/web/primitives/use-container-narrow.js +42 -0
  211. package/dist/web/ui/input.js +1 -1
  212. package/dist/web/ui/textarea.js +1 -1
  213. package/dist/web/widgets/dashboard-list-cards.js +6 -3
  214. package/dist/web/widgets/dashboard-list.d.ts +6 -1
  215. package/dist/web/widgets/dashboard-list.js +12 -7
  216. package/dist/web/widgets/drawer-panel-class.js +1 -1
  217. package/dist/web/widgets/progress-list.js +1 -1
  218. package/dist/web/widgets/stat-box-cell.js +1 -1
  219. package/package.json +5 -5
  220. package/src/changes.json +105 -0
  221. package/src/web/styles.css +3 -2
@@ -8,11 +8,10 @@ import { DataTableFooter } from "./table-footer.js";
8
8
  import { renderTableView } from "./table-view.js";
9
9
  // The pager is ALWAYS rendered below the table (even with rows=[]) so the
10
10
  // user can page back on a filter hit of zero without losing the list.
11
- // Except total === 0: then there is nothing to paginate. Incompatible with
12
- // infinite scroll: the caller sets either pager OR onReachEnd.
11
+ // Incompatible with infinite scroll: the caller sets either pager OR onReachEnd.
13
12
  function renderPager(m) {
14
13
  const { pager, serverGroups, testId } = m;
15
- if (pager === undefined || !(pager.total > 0) || serverGroups !== undefined)
14
+ if (pager === undefined || serverGroups !== undefined)
16
15
  return undefined;
17
16
  return (_jsx(Pager, { page: pager.page, limit: pager.limit, total: pager.total, onPageChange: pager.onPageChange, ...(pager.pageSizeOptions !== undefined && { pageSizeOptions: pager.pageSizeOptions }), ...(pager.onPageSizeChange !== undefined && { onPageSizeChange: pager.onPageSizeChange }), testId: testId !== undefined ? `${testId}-pager` : "render-list-pager", pinned: m.fillsHeight || isInsideCardFrame(m), plain: m.isNarrow && hasSeparateCardRows(m) }));
18
17
  }
@@ -25,7 +24,7 @@ function renderSentinel(m, pagerElement) {
25
24
  }
26
25
  function renderTableBodyContent(m) {
27
26
  if (m.isEmpty)
28
- return isInsideCardFrame(m) ? renderTableView(m) : renderEmptyBlock(m);
27
+ return renderEmptyBlock(m);
29
28
  return m.isNarrow ? renderCardsView(m) : renderTableView(m);
30
29
  }
31
30
  export function renderTableContent(m) {
@@ -33,13 +32,14 @@ export function renderTableContent(m) {
33
32
  const tableContent = renderTableBodyContent(m);
34
33
  const pagerElement = renderPager(m);
35
34
  const sentinelElement = renderSentinel(m, pagerElement);
36
- const framed = isInsideCardFrame(m);
35
+ // An empty list is only the dashed empty block, with no card frame around it.
36
+ const framed = isInsideCardFrame(m) && !m.isEmpty;
37
37
  // With scrollBody the footer (pager, else the entry count) sits OUTSIDE the
38
38
  // scroll surface so it stays put at any row count; the infinite sentinel
39
39
  // stays INSIDE, or it would never intersect the scrollport.
40
40
  const content = m.fillsHeight ? (_jsxs("div", { "data-testid": testId !== undefined ? `${testId}-scroll` : "render-list-scroll", className: cn("min-h-0 flex-1 overflow-auto bg-card", !framed && "border-t border-border"), children: [tableContent, sentinelElement] })) : (_jsxs(_Fragment, { children: [tableContent, sentinelElement] }));
41
41
  const footer = pagerElement ??
42
- (m.fillsHeight ? (_jsx(DataTableFooter, { count: serverGroups?.totalCount ?? m.rows.length, ...(itemNoun !== undefined && { itemNoun }), testId: testId !== undefined ? `${testId}-footer` : "render-list-footer" })) : undefined);
42
+ (m.fillsHeight && m.hideCountFooter !== true ? (_jsx(DataTableFooter, { count: serverGroups?.totalCount ?? m.rows.length, ...(itemNoun !== undefined && { itemNoun }), testId: testId !== undefined ? `${testId}-footer` : "render-list-footer" })) : undefined);
43
43
  // Frame card: content and footer share one bordered card. A fill-height card is as tall as
44
44
  // its rows and shrinks into the scroll container; the 24px sides match the toolbar's inset.
45
45
  return (_jsxs(_Fragment, { children: [m.selection.bar, framed ? (_jsxs("div", { "data-testid": testId !== undefined ? `${testId}-frame` : "render-list-frame", className: cn(CARD_SURFACE_CLASS, "overflow-hidden", m.fillsHeight && "mx-6 mb-6 flex min-h-0 flex-col"), children: [content, footer] })) : (_jsxs(_Fragment, { children: [content, footer] }))] }));
@@ -5,16 +5,9 @@ import { cellLinkProp, cellTitle, DataTableCell, FIT_CONTENT_CELL_CLASS, FirstCe
5
5
  import { columnCellPresentationProps } from "./data-cell-props.js";
6
6
  import { hintColumnWidthStyle } from "./hint-column-width.js";
7
7
  import { isRowActionColumn } from "./row-action-column.js";
8
- // Text wraps instead of truncating: nowrap cells keep their
9
- // full width, so a wide table scrolled sideways and its
10
- // last column slid under the sticky actions column with
11
- // nothing visibly cut off. max-w-xs bounds a single column;
12
- // badges and dates stay nowrap by their own classes.
13
- // A resizable table sizes by content until the user drags a column. Its
14
- // first column names the row and gets the room it needs: it breaks anywhere
15
- // only when the table runs out of width, so a long identifier stays on one
16
- // line on a wide screen instead of wrapping at 20rem. Dates and timestamps
17
- // keep one line there too; a narrow screen scrolls the table sideways.
8
+ // Cells stay on one line and end in "…" when the text does not fit (the full text is the
9
+ // cell's `title`); max-w-* bounds a column in the auto layout, where truncation needs a width.
10
+ // Hint cells wrap: their sentence and detail line are the row's content.
18
11
  const ONE_LINE_COLUMN_TYPES = new Set(["timestamp", "date"]);
19
12
  // Projection lists synthesize every column as type "text"; their dates carry a format spec.
20
13
  function isDateColumn(col) {
@@ -30,26 +23,47 @@ function isDateColumn(col) {
30
23
  function autoLayoutCellClassName(m, col, colIndex) {
31
24
  if (m.sizing !== undefined && isDateColumn(col))
32
25
  return "whitespace-nowrap";
26
+ if (col.multiline === true)
27
+ return "max-w-md whitespace-pre-line break-words";
33
28
  // max-w-xs would cap a hint column that states a wider width.
34
29
  if (col.hint !== undefined && col.width !== undefined)
35
30
  return "whitespace-normal break-words";
36
- return colIndex === 0 && m.sizing !== undefined
37
- ? "whitespace-normal [overflow-wrap:anywhere]"
38
- : "max-w-xs whitespace-normal break-words";
31
+ if (col.hint !== undefined)
32
+ return "max-w-xs whitespace-normal break-words";
33
+ return colIndex === 0 ? "max-w-md truncate" : "max-w-xs truncate";
39
34
  }
40
- function dataCellClassName(m, col, colIndex, pinClassName) {
35
+ function fixedLayoutCellClassName(col) {
36
+ return col.hint !== undefined || col.multiline === true
37
+ ? "overflow-hidden whitespace-normal break-words"
38
+ : "overflow-hidden truncate";
39
+ }
40
+ function dataCellClassName(m, row, col, colIndex, pinClassName) {
41
41
  return cn(col.fileDisplay === undefined
42
42
  ? m.sizing?.fixed === true
43
- ? "overflow-hidden whitespace-normal break-words"
43
+ ? fixedLayoutCellClassName(col)
44
44
  : autoLayoutCellClassName(m, col, colIndex)
45
- : FIT_CONTENT_CELL_CLASS, colIndex === 0 ? "font-medium text-foreground" : "text-foreground-secondary", NUMERIC_COLUMN_TYPES.has(col.type) && "text-right", isRowActionColumn(col) && "sm:text-right", TABULAR_COLUMN_TYPES.has(col.type) && "tabular-nums", col.highlighted === true && "bg-accent/40", m.density.cell, pinClassName);
45
+ : FIT_CONTENT_CELL_CLASS, "px-3 first:pl-6 last:pr-[34px]", cellTextClass(m, row, col, colIndex), col.ellipsis === true && "truncate", col.multiline === true && "whitespace-pre-line", NUMERIC_COLUMN_TYPES.has(col.type) && "text-right", isRowActionColumn(col) && "sm:text-right", TABULAR_COLUMN_TYPES.has(col.type) && "tabular-nums", col.highlighted === true && "bg-accent/40", m.density.cell, m.density.cellHeight, pinClassName);
46
+ }
47
+ function isMutedRow(m, row) {
48
+ return m.rowMuted?.(row) === true;
49
+ }
50
+ function cellTextClass(m, row, col, colIndex) {
51
+ if (col.tone === "muted")
52
+ return "text-muted-foreground";
53
+ if (col.emphasis === true)
54
+ return "font-semibold text-foreground";
55
+ if (isMutedRow(m, row))
56
+ return "text-muted-foreground";
57
+ if (colIndex === 0 && !m.hasEmphasisColumn)
58
+ return "font-medium text-foreground";
59
+ return "text-foreground";
46
60
  }
47
61
  export function renderDataCell(m, row, col, colIndex, opensOnClick) {
48
62
  const { getCellTestId, onCellChange, onRowClick, tableTranslate, tableLocale } = m;
49
63
  const bodyPin = m.pins.bodyCell(col.field);
50
64
  const linksFirstCell = colIndex === 0 && opensOnClick && onCellChange === undefined;
51
65
  const wrapsCellInOpener = linksFirstCell && col.hint === undefined;
52
- return (_jsx(TableCell, { "data-testid": getCellTestId?.(row, col.field) ?? `cell-${row.id}-${col.field}`, "data-highlighted": col.highlighted === true ? "true" : undefined, className: dataCellClassName(m, col, colIndex, bodyPin.className), style: { ...bodyPin.style, ...hintColumnWidthStyle(col, m.sizing !== undefined) }, title: cellTitle(row.values[col.field]), children: _jsx(FirstCellLink, { enabled: wrapsCellInOpener, onOpen: () => onRowClick?.(row), empty: col.hint === undefined && isEmptyCellValue(row.values[col.field]), emptyLabel: m.rowClickLabel, children: _jsx(DataTableCell, { value: row.values[col.field], row: row.values, field: col.field, type: col.type, renderer: col.renderer, translate: tableTranslate, locale: tableLocale, ...columnCellPresentationProps(col), ...(col.fileDisplay !== undefined && {
66
+ return (_jsx(TableCell, { "data-testid": getCellTestId?.(row, col.field) ?? `cell-${row.id}-${col.field}`, "data-highlighted": col.highlighted === true ? "true" : undefined, className: dataCellClassName(m, row, col, colIndex, bodyPin.className), style: { ...bodyPin.style, ...hintColumnWidthStyle(col, m.sizing !== undefined) }, title: cellTitle(row.values[col.field]), children: _jsx(FirstCellLink, { enabled: wrapsCellInOpener, onOpen: () => onRowClick?.(row), empty: col.hint === undefined && isEmptyCellValue(row.values[col.field]), emptyLabel: m.rowClickLabel, emptyPlaceholder: col.emptyPlaceholder, children: _jsx(DataTableCell, { value: row.values[col.field], row: row.values, field: col.field, type: col.type, renderer: col.renderer, translate: tableTranslate, locale: tableLocale, ...columnCellPresentationProps(col), ...(col.fileDisplay !== undefined && {
53
67
  fileDisplay: col.fileDisplay,
54
68
  }), ...(onCellChange !== undefined && {
55
69
  onChange: (value) => onCellChange(row.id, col.field, value),
@@ -20,5 +20,5 @@ function renderExpandHeaderCell(m) {
20
20
  return (_jsx(TableHead, { "data-testid": "column-expand", [COLUMN_ROLE_ATTRIBUTE]: "expand", className: cn(EXPAND_TOGGLE_CELL_CLASS, expandHeaderPin.className), style: expandHeaderPin.style }));
21
21
  }
22
22
  export function renderTableHeader(m) {
23
- return (_jsx(TableHeader, { className: "bg-muted", children: _jsxs(TableRow, { ref: m.headerRowRef, className: "hover:bg-transparent", children: [m.selection.headerCell(m.pins.headerCell(SELECT_COLUMN_KEY)), m.expansion !== undefined && renderExpandHeaderCell(m), m.columns.map((col) => renderColumnHeader(m, col)), m.hasTableActions && (_jsx(ActionsHeaderCell, { label: m.tableTranslate?.("kumiko.list.actions") ?? "Actions", style: m.pins.actionsHeaderStyle, absorbsLeftover: m.sizing?.fixed === true }))] }) }));
23
+ return (_jsx(TableHeader, { className: "bg-background", children: _jsxs(TableRow, { ref: m.headerRowRef, className: "hover:bg-transparent", children: [m.selection.headerCell(m.pins.headerCell(SELECT_COLUMN_KEY)), m.expansion !== undefined && renderExpandHeaderCell(m), m.columns.map((col) => renderColumnHeader(m, col)), m.hasTableActions && (_jsx(ActionsHeaderCell, { label: m.tableTranslate?.("kumiko.list.actions") ?? "Actions", style: m.pins.actionsHeaderStyle, absorbsLeftover: m.sizing?.fixed === true }))] }) }));
24
24
  }
@@ -35,7 +35,7 @@ function renderTableFooter(m) {
35
35
  }
36
36
  // A framed list that is empty keeps its header row; the empty state fills one spanning row below it.
37
37
  function renderEmptyBody(m) {
38
- return (_jsx(TableBody, { children: _jsx(TableRow, { className: "hover:bg-transparent", children: _jsx(TableCell, { colSpan: m.fullColSpan, className: "p-0", children: renderEmptyBlock(m, true) }) }) }));
38
+ return (_jsx(TableBody, { children: _jsx(TableRow, { className: "hover:bg-transparent", children: _jsx(TableCell, { colSpan: m.fullColSpan, className: "p-0", children: renderEmptyBlock(m) }) }) }));
39
39
  }
40
40
  export function renderTableView(m) {
41
41
  const { fillsHeight, chromeless, sizing, testId } = m;
@@ -51,11 +51,10 @@ export function hasToolbarContent(m, facetCluster) {
51
51
  hasVisibleSortOptions(m) ||
52
52
  toolbarEndHasContent(m.view, m.exportList, m.toolbarEnd));
53
53
  }
54
- // The toolbar select is max-md:hidden; below md the card sort bar owns sorting, so a toolbar
55
- // holding only the hidden select would render an empty row.
54
+ // Desktop sorts through the column headers; the toolbar select is an opt-in (`toolbarSort`),
55
+ // and below sm the card sort bar owns sorting.
56
56
  function hasVisibleSortOptions(m) {
57
- return (!(m.toolbarSort === true ? m.belowSm : m.isNarrow) &&
58
- hasSortOptionsSelect(m.sortOptions, m.onSortChange));
57
+ return (m.toolbarSort === true && !m.belowSm && hasSortOptionsSelect(m.sortOptions, m.onSortChange));
59
58
  }
60
59
  function toolbarClassName({ fillsHeight, isNarrow }) {
61
60
  if (!fillsHeight)
@@ -85,10 +84,10 @@ export function toolbarMergesDescription(m, facetCluster) {
85
84
  }
86
85
  function renderSortOptions(m) {
87
86
  const { sortOptions, onSortChange, testId } = m;
88
- if (onSortChange === undefined || !hasSortOptionsSelect(sortOptions, onSortChange)) {
87
+ if (onSortChange === undefined || !hasVisibleSortOptions(m) || sortOptions === undefined) {
89
88
  return null;
90
89
  }
91
- return (_jsx(SortOptionsSelect, { options: sortOptions, sort: m.sort, onSortChange: onSortChange, testId: testId !== undefined ? `${testId}-sort-options` : "render-list-sort-options", className: m.toolbarSort === true ? "max-sm:hidden" : "max-md:hidden", bordered: m.toolbarSort === true }));
90
+ return (_jsx(SortOptionsSelect, { options: sortOptions, sort: m.sort, onSortChange: onSortChange, testId: testId !== undefined ? `${testId}-sort-options` : "render-list-sort-options", bordered: true }));
92
91
  }
93
92
  function hasOnlySelectFacets(m) {
94
93
  return ((m.filterFacets ?? []).some((facet) => !isBehindFilter(m, facet)) &&
@@ -102,7 +101,7 @@ function renderFacetArea(m, facetCluster) {
102
101
  if (!m.belowSm || (facetCluster === undefined && behindFilter === undefined)) {
103
102
  return facetCluster;
104
103
  }
105
- if (facetCluster !== undefined && hasOnlySelectFacets(m)) {
104
+ if (facetCluster !== undefined && m.narrowFacets === "pills" && hasOnlySelectFacets(m)) {
106
105
  const inline = _jsx("div", { className: "flex w-full flex-wrap gap-2", children: facetCluster });
107
106
  if (behindFilter === undefined)
108
107
  return inline;
@@ -1,4 +1,4 @@
1
- import { type Dispatch, type SetStateAction } from "react";
1
+ import { type Dispatch, type RefObject, type SetStateAction } from "react";
2
2
  import type { ListColumnViewModel, ListRowViewModel } from "../../../headless/index.ts";
3
3
  import { type DataTableProps, useOptionalLocale, useOptionalTranslation } from "../../../index.ts";
4
4
  import { densityClasses } from "./density.ts";
@@ -14,10 +14,15 @@ type RowExpansion = {
14
14
  };
15
15
  export type DataTableModel = Omit<DataTableProps, "columns"> & {
16
16
  readonly schemaColumns: readonly ListColumnViewModel[];
17
+ /** With an emphasis column the first column is plain: the emphasised one carries the row. */
18
+ readonly hasEmphasisColumn: boolean;
17
19
  readonly columns: ColumnPins<ListColumnViewModel>["columns"];
18
20
  readonly tableTranslate: ReturnType<typeof useOptionalTranslation>;
19
21
  readonly tableLocale: ReturnType<typeof useOptionalLocale>;
20
22
  readonly isNarrow: boolean;
23
+ readonly containerRef: RefObject<HTMLDivElement | null>;
24
+ /** Row the assistant currently sees (the screen focus names its record); drawn highlighted. */
25
+ readonly focusedRowId: string | undefined;
21
26
  readonly belowSm: boolean;
22
27
  readonly density: ReturnType<typeof densityClasses>;
23
28
  readonly facetsOpenNarrow: boolean;
@@ -1,6 +1,8 @@
1
- import { useId, useMemo, useState } from "react";
1
+ import { useId, useMemo, useState, } from "react";
2
2
  import { useIsEmbeddedScreen } from "../../../context/embedded-screen-context.js";
3
+ import { useScreenFocus } from "../../../context/screen-focus-context.js";
3
4
  import { useOptionalLocale, useOptionalTranslation } from "../../../index.js";
5
+ import { useContainerSqueeze } from "../use-container-narrow.js";
4
6
  import { useIsBelowSmViewport, useIsNarrowViewport } from "../use-narrow-viewport.js";
5
7
  import { isPinningActive, isResizingActive } from "./column-layout-mode.js";
6
8
  import { densityClasses } from "./density.js";
@@ -47,7 +49,12 @@ export function useDataTableState(props) {
47
49
  // single-mount pattern as EmbeddedListInput/embedded-list-input.tsx.
48
50
  const isNarrow = useIsNarrowViewport();
49
51
  const belowSm = useIsBelowSmViewport();
50
- const schemaColumns = useMemo(() => (isNarrow ? allColumns : allColumns.filter((col) => col.showOnNarrowOnly !== true)), [allColumns, isNarrow]);
52
+ const focusedRowId = useScreenFocus()?.recordId;
53
+ const [containerRef, squeeze] = useContainerSqueeze();
54
+ const containerNarrow = squeeze.narrow || squeeze.docked;
55
+ const schemaColumns = useMemo(() => isNarrow
56
+ ? allColumns
57
+ : allColumns.filter((col) => col.showOnNarrowOnly !== true && !(containerNarrow && col.hideWhenDocked === true)), [allColumns, isNarrow, containerNarrow]);
51
58
  const viewColumns = useViewColumns(schemaColumns, view, isNarrow);
52
59
  const density = densityClasses(view, scrollBody === true);
53
60
  const [facetsOpenNarrow, setFacetsOpenNarrow] = useState(false);
@@ -99,11 +106,14 @@ export function useDataTableState(props) {
99
106
  return {
100
107
  ...props,
101
108
  schemaColumns,
109
+ hasEmphasisColumn: schemaColumns.some((column) => column.emphasis === true),
102
110
  columns,
103
111
  tableTranslate,
104
112
  tableLocale,
105
113
  isNarrow,
106
114
  belowSm,
115
+ containerRef,
116
+ focusedRowId,
107
117
  density,
108
118
  facetsOpenNarrow,
109
119
  setFacetsOpenNarrow,
@@ -11,9 +11,10 @@ export declare function isBadgeColumn(col: {
11
11
  readonly type: string;
12
12
  readonly renderer?: unknown;
13
13
  }): boolean;
14
- export declare function FirstCellLink({ enabled, empty, emptyLabel, onOpen, children, }: {
14
+ export declare function FirstCellLink({ enabled, empty, emptyLabel, emptyPlaceholder, onOpen, children, }: {
15
15
  readonly enabled: boolean;
16
16
  readonly empty: boolean;
17
+ readonly emptyPlaceholder?: string | false | undefined;
17
18
  readonly emptyLabel?: string | undefined;
18
19
  readonly onOpen: () => void;
19
20
  readonly children: ReactNode;
@@ -45,11 +46,18 @@ type DataTableCellProps = {
45
46
  readonly display?: ListColumnCellDisplay;
46
47
  readonly badgeToneField?: string;
47
48
  readonly badgeDot?: false;
48
- readonly emptyPlaceholder?: false;
49
+ readonly pillField?: string;
50
+ readonly pillToneField?: string;
51
+ readonly emptyPlaceholder?: string | false;
52
+ readonly dateOnlyAfterDays?: number;
49
53
  readonly onOpenRow?: () => void;
50
54
  };
55
+ export declare function EmptyCell({ placeholder, }: {
56
+ readonly placeholder: string | false | undefined;
57
+ }): ReactNode;
51
58
  /** `display: "button"` draws a cell link as a small outline button. */
52
59
  export declare const LINK_BUTTON_CLASS: string;
60
+ export declare const LINK_BUTTON_PRIMARY_CLASS: string;
53
61
  /** Badge tones by the list-wide ListBadgeTone words. */
54
62
  export declare const LIST_BADGE_TONE: Readonly<Record<string, StatusBadgeTone>>;
55
63
  export declare function cellLinkProp(col: {
@@ -71,5 +79,11 @@ export declare function CellTextLink({ link, children, className, }: {
71
79
  readonly children: ReactNode;
72
80
  readonly className?: string;
73
81
  }): ReactNode;
74
- export declare function DataTableCell({ value, row, field, type, renderer, optionLabels, optionTones, onChange, translate, locale, grouping, fileDisplay, compactFile, link, linkItems, hint, display, badgeToneField, badgeDot, emptyPlaceholder, onOpenRow, }: DataTableCellProps): ReactNode;
82
+ /** The extra pill a column draws beside its value in a table row, or in the header line of a phone card. */
83
+ export declare function CellPill({ row, pillField, pillToneField, }: {
84
+ readonly row: Readonly<Record<string, unknown>>;
85
+ readonly pillField: string | undefined;
86
+ readonly pillToneField: string | undefined;
87
+ }): ReactNode;
88
+ export declare function DataTableCell(props: DataTableCellProps): ReactNode;
75
89
  export {};
@@ -5,8 +5,9 @@ import { Check } from "lucide-react";
5
5
  import { Fragment } from "react";
6
6
  import { rendererWarn } from "../../dev-console.js";
7
7
  import { fileIdsOf } from "../../file-ids-of.js";
8
- import { applyFormatSpec, EMPTY_VALUE_PLACEHOLDER, isSafeHref } from "../../headless/index.js";
8
+ import { applyFormatSpec, EMPTY_VALUE_PLACEHOLDER, isSafeHref, telHref, } from "../../headless/index.js";
9
9
  import { statusToneForOptionTone, statusToneForValue, useColumnRenderer, useOptionalPrimitives, } from "../../index.js";
10
+ import { serverNowMs } from "../../server-clock.js";
10
11
  import { isSelectOptionTone } from "../../status-tone.js";
11
12
  import { Badge } from "../ui/badge.js";
12
13
  import { buttonVariants } from "../ui/button.js";
@@ -16,6 +17,7 @@ import { FileDisplayCell } from "./file-thumbnail.js";
16
17
  import { FileViewAction } from "./file-view-action.js";
17
18
  import { currencyDecimals, formatMoney } from "./money-input.js";
18
19
  import "../react-css-custom-properties.js";
20
+ import { useOptionalTranslation } from "../../index.js";
19
21
  import { isPlainPrimaryClick } from "./layout-elements.js";
20
22
  export function isEmptyCellValue(value) {
21
23
  return (value === null || value === undefined || (typeof value === "string" && value.trim() === ""));
@@ -77,10 +79,10 @@ export function isBadgeColumn(col) {
77
79
  // The first cell is the keyboard-reachable entry point of a clickable row; the
78
80
  // row's own onClick keeps serving the mouse. Enter is handled explicitly so
79
81
  // it also opens the row where a button does not synthesize a click.
80
- export function FirstCellLink({ enabled, empty, emptyLabel, onOpen, children, }) {
82
+ export function FirstCellLink({ enabled, empty, emptyLabel, emptyPlaceholder, onOpen, children, }) {
81
83
  if (!enabled || (empty && emptyLabel === undefined))
82
84
  return children;
83
- return (_jsx("button", { type: "button", className: "max-w-full cursor-pointer bg-transparent p-0 text-left font-medium text-foreground hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring", onClick: (e) => {
85
+ return (_jsx("button", { type: "button", className: "max-w-full cursor-pointer bg-transparent p-0 text-left font-medium text-inherit hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring", onClick: (e) => {
84
86
  e.stopPropagation();
85
87
  onOpen();
86
88
  }, onKeyDown: (e) => {
@@ -89,7 +91,7 @@ export function FirstCellLink({ enabled, empty, emptyLabel, onOpen, children, })
89
91
  e.preventDefault();
90
92
  e.stopPropagation();
91
93
  onOpen();
92
- }, children: empty ? _jsx("span", { className: "sr-only", children: emptyLabel }) : children }));
94
+ }, children: empty ? (_jsxs(_Fragment, { children: [_jsx("span", { className: "sr-only", children: emptyLabel }), _jsx(EmptyCell, { placeholder: emptyPlaceholder })] })) : (children) }));
93
95
  }
94
96
  // w-px on an auto-layout table cell shrinks the column to its content (the
95
97
  // actions column relies on the same behaviour).
@@ -235,17 +237,48 @@ function enumOptionTones(spec) {
235
237
  }
236
238
  return out;
237
239
  }
238
- function EmptyCell({ placeholder }) {
239
- return (_jsx("span", { "data-empty-cell": "true", className: "text-muted-foreground", children: placeholder === false ? null : EMPTY_VALUE_PLACEHOLDER }));
240
+ const MS_PER_DAY = 86_400_000;
241
+ function dateOnlyWhenOlderThan(value, days, locale, renderer) {
242
+ if (typeof value !== "string" && typeof value !== "number")
243
+ return undefined;
244
+ const atMs = typeof value === "number" ? value : Date.parse(value);
245
+ // An unparsable or out-of-range value falls back to the plain cell text.
246
+ if (Number.isNaN(new Date(atMs).getTime()))
247
+ return undefined;
248
+ if (serverNowMs() - atMs <= days * MS_PER_DAY)
249
+ return undefined;
250
+ const timeZone = typeof renderer === "object" &&
251
+ renderer !== null &&
252
+ "timeZone" in renderer &&
253
+ typeof renderer.timeZone === "string"
254
+ ? renderer.timeZone
255
+ : undefined;
256
+ return applyFormatSpec({
257
+ format: "date",
258
+ dateStyle: "long",
259
+ ...(locale !== undefined && { locale }),
260
+ ...(timeZone !== undefined && { timeZone }),
261
+ }, new Date(atMs).toISOString());
262
+ }
263
+ export function EmptyCell({ placeholder, }) {
264
+ const t = useOptionalTranslation();
265
+ // translate returns an unknown key (a literal like "No vehicle") unchanged.
266
+ const text = typeof placeholder === "string" ? (t?.(placeholder) ?? placeholder) : null;
267
+ return (_jsx("span", { "data-empty-cell": "true", className: "text-muted-foreground", children: text }));
240
268
  }
241
269
  /** `display: "button"` draws a cell link as a small outline button. */
242
270
  export const LINK_BUTTON_CLASS = buttonVariants({ variant: "outline", size: "sm" });
271
+ export const LINK_BUTTON_PRIMARY_CLASS = buttonVariants({ variant: "default", size: "sm" });
243
272
  /** Badge tones by the list-wide ListBadgeTone words. */
244
273
  export const LIST_BADGE_TONE = {
245
274
  positive: "ok",
246
275
  warn: "warn",
247
276
  negative: "bad",
248
277
  neutral: "muted",
278
+ ok: "ok",
279
+ bad: "bad",
280
+ critical: "bad",
281
+ accent: "muted",
249
282
  };
250
283
  // A multi reference may list the same id twice; the occurrence count keeps React keys unique.
251
284
  function uniqueLinkItemKeys(items) {
@@ -281,8 +314,8 @@ const ROW_TONE_STRIPE_CLASS = {
281
314
  accent: `${ROW_STRIPE_SHADOW_CLASS} [&>td:first-child]:[--row-stripe:var(--color-primary)]`,
282
315
  neutral: "",
283
316
  };
284
- // Inner 4px stripe (board .m-card): the card keeps its own border, the stripe sits inside the padding.
285
- const CARD_STRIPE_BASE = "relative pl-6 before:absolute before:inset-y-2.5 before:left-2.5 before:w-1 before:rounded-[2px] before:content-['']";
317
+ // Inner 3px edge stripe (board .card.cw): sits inside the card border, rounded with the card corners.
318
+ const CARD_STRIPE_BASE = "relative pl-5 before:absolute before:inset-y-0 before:left-0 before:w-[3px] before:rounded-l-[7px] before:content-['']";
286
319
  const CARD_TONE_STRIPE_CLASS = {
287
320
  bad: `${CARD_STRIPE_BASE} before:bg-status-bad`,
288
321
  warn: `${CARD_STRIPE_BASE} before:bg-status-warn`,
@@ -380,14 +413,37 @@ function renderFileCell({ value, fileDisplay, compactFile, translate, }) {
380
413
  // "X" via useColumnRenderer and renders `<X value row column/>`.
381
414
  // Not registered -> one-time warning + default fallback.
382
415
  // 4. Otherwise -> defaultCellRender (type-based string renderer).
383
- export function DataTableCell({ value, row, field, type, renderer, optionLabels, optionTones, onChange, translate, locale, grouping = true, fileDisplay, compactFile = false, link, linkItems, hint, display, badgeToneField, badgeDot, emptyPlaceholder, onOpenRow, }) {
416
+ /** The extra pill a column draws beside its value in a table row, or in the header line of a phone card. */
417
+ export function CellPill({ row, pillField, pillToneField, }) {
418
+ const pillText = pillField === undefined ? undefined : row[pillField];
419
+ if (typeof pillText !== "string" || pillText === "")
420
+ return null;
421
+ const toneKey = pillToneField === undefined ? undefined : row[pillToneField];
422
+ const tone = (typeof toneKey === "string" ? LIST_BADGE_TONE[toneKey] : undefined) ?? "muted";
423
+ return _jsx(StatusBadge, { tone: tone, children: pillText });
424
+ }
425
+ export function DataTableCell(props) {
426
+ const { pillField, pillToneField, row } = props;
427
+ if (pillField === undefined)
428
+ return _jsx(DataTableCellBody, { ...props });
429
+ const pill = _jsx(CellPill, { row: row, pillField: pillField, pillToneField: pillToneField });
430
+ if (isEmptyCellValue(row[pillField]))
431
+ return _jsx(DataTableCellBody, { ...props });
432
+ return (_jsxs("span", { className: "inline-flex items-center gap-2", children: [_jsx(DataTableCellBody, { ...props }), pill] }));
433
+ }
434
+ function DataTableCellBody({ value, row, field, type, renderer, optionLabels, optionTones, onChange, translate, locale, grouping = true, fileDisplay, compactFile = false, link, linkItems, hint, display, badgeToneField, badgeDot, emptyPlaceholder, dateOnlyAfterDays, onOpenRow, }) {
384
435
  const componentRef = isComponentRendererRef(renderer);
385
436
  const ResolvedComponent = useColumnRenderer(componentRef?.name);
386
437
  const RegisteredStatusBadge = useOptionalPrimitives()?.StatusBadge;
387
438
  if (hint !== undefined) {
388
439
  return (_jsx(HintCell, { value: value, row: row, hint: hint, ...(onOpenRow !== undefined && { onOpen: onOpenRow }) }));
389
440
  }
390
- if (isEmptyCellValue(value) && typeof renderer !== "function" && componentRef === undefined) {
441
+ // A function renderer formats its own values; only an explicit `emptyPlaceholder` takes an empty value over.
442
+ const showsPlaceholder = typeof renderer !== "function"
443
+ ? isEmptyCellValue(value)
444
+ : typeof emptyPlaceholder === "string" &&
445
+ (isEmptyCellValue(value) || (Array.isArray(value) && value.length === 0));
446
+ if (showsPlaceholder && componentRef === undefined) {
391
447
  return _jsx(EmptyCell, { placeholder: emptyPlaceholder });
392
448
  }
393
449
  if (value === PII_ERASED_SENTINEL && translate !== undefined) {
@@ -415,6 +471,12 @@ export function DataTableCell({ value, row, field, type, renderer, optionLabels,
415
471
  });
416
472
  if (displayCell !== undefined)
417
473
  return displayCell;
474
+ const dateOnlyText = dateOnlyAfterDays === undefined
475
+ ? undefined
476
+ : dateOnlyWhenOlderThan(value, dateOnlyAfterDays, locale, renderer);
477
+ if (dateOnlyText !== undefined) {
478
+ return link === undefined ? (dateOnlyText) : (_jsx(CellTextLink, { link: link, children: dateOnlyText }));
479
+ }
418
480
  if (typeof value === "boolean" &&
419
481
  isBooleanColumn(type, renderer) &&
420
482
  (renderer === undefined || isUnlabeledBooleanFormat(renderer))) {
@@ -426,30 +488,21 @@ export function DataTableCell({ value, row, field, type, renderer, optionLabels,
426
488
  return renderFileCell({ value, fileDisplay, compactFile, translate });
427
489
  }
428
490
  if (isFormatSpecRenderer(renderer)) {
429
- const text = applyFormatSpec({ ...renderer, locale: renderer.locale ?? locale }, value, translate);
430
- const tones = enumOptionTones(renderer);
431
- if (tones !== undefined && typeof value === "string") {
432
- return selectPill(value, { [value]: text }, tones, locale, RegisteredStatusBadge);
433
- }
434
- return link === undefined ? text : _jsx(CellTextLink, { link: link, children: text });
491
+ return renderFormatSpecCell({
492
+ renderer,
493
+ value,
494
+ translate,
495
+ locale,
496
+ link,
497
+ RegisteredStatusBadge,
498
+ });
435
499
  }
436
500
  if (isFunctionRenderer(renderer)) {
437
- if (linkItems !== undefined) {
438
- const linkItemKeys = uniqueLinkItemKeys(linkItems);
439
- return (_jsx(_Fragment, { children: linkItems.map((item, index) => (_jsxs(Fragment, { children: [index > 0 && ", ", item.link === undefined ? (item.label) : (_jsx(CellTextLink, { link: item.link, children: item.label }))] }, linkItemKeys[index]))) }));
440
- }
441
- const text = renderer(value, row);
442
- return link === undefined ? text : _jsx(CellTextLink, { link: link, children: text });
501
+ return renderFunctionRendererCell({ renderer, value, row, link, linkItems });
443
502
  }
444
503
  if (componentRef !== undefined) {
445
504
  if (ResolvedComponent !== undefined) {
446
- const node = (_jsx(ResolvedComponent, { value: value, row: row, column: { field }, ...(onChange !== undefined && { onChange }) }));
447
- // stopPropagation only on the editable branch — plain cells must still
448
- // fire row onClick when onCellChange is set for sibling editable cells.
449
- if (onChange !== undefined) {
450
- return (_jsx("span", { className: "contents", onClick: (e) => e.stopPropagation(), onKeyDown: (e) => e.stopPropagation(), children: node }));
451
- }
452
- return node;
505
+ return renderResolvedComponentCell({ ResolvedComponent, value, row, field, onChange });
453
506
  }
454
507
  // Renderer referenced in the schema but no map entry client-side —
455
508
  // typical case: clientFeatures.columnRenderers forgotten or a typo in the
@@ -457,11 +510,53 @@ export function DataTableCell({ value, row, field, type, renderer, optionLabels,
457
510
  // (the default type renderer takes over).
458
511
  rendererWarn(`[kumiko] columnRenderer "${componentRef.name}" not registered`);
459
512
  }
460
- // A select value renders as a pill instead of plain text. When the raw
461
- // value is a known status word, it carries the same tone as the
462
- // projectionDetail header badge — a status column stayed grey while the
463
- // detail view of the same value was coloured. Unknown values
464
- // keep the neutral outline pill.
513
+ const selectCell = renderSelectTypeCell({
514
+ type,
515
+ value,
516
+ optionLabels,
517
+ optionTones,
518
+ locale,
519
+ RegisteredStatusBadge,
520
+ });
521
+ if (selectCell !== undefined)
522
+ return selectCell;
523
+ const text = defaultCellRender(value, type, optionLabels, locale, field, grouping);
524
+ return link === undefined ? text : _jsx(CellTextLink, { link: link, children: text });
525
+ }
526
+ function renderFormatSpecCell({ renderer, value, translate, locale, link, RegisteredStatusBadge, }) {
527
+ const text = applyFormatSpec({ ...renderer, locale: renderer.locale ?? locale }, value, translate);
528
+ const phoneHref = renderer.format === "phone" ? telHref(text) : undefined;
529
+ if (phoneHref !== undefined) {
530
+ return (_jsx(CellTextLink, { link: { href: phoneHref, onPress: () => window.location.assign(phoneHref) }, children: text }));
531
+ }
532
+ const tones = enumOptionTones(renderer);
533
+ if (tones !== undefined && typeof value === "string") {
534
+ return selectPill(value, { [value]: text }, tones, locale, RegisteredStatusBadge);
535
+ }
536
+ return link === undefined ? text : _jsx(CellTextLink, { link: link, children: text });
537
+ }
538
+ function renderFunctionRendererCell({ renderer, value, row, link, linkItems, }) {
539
+ if (linkItems !== undefined) {
540
+ const linkItemKeys = uniqueLinkItemKeys(linkItems);
541
+ return (_jsx(_Fragment, { children: linkItems.map((item, index) => (_jsxs(Fragment, { children: [index > 0 && ", ", item.link === undefined ? (item.label) : (_jsx(CellTextLink, { link: item.link, children: item.label }))] }, linkItemKeys[index]))) }));
542
+ }
543
+ const text = renderer(value, row);
544
+ return link === undefined ? text : _jsx(CellTextLink, { link: link, children: text });
545
+ }
546
+ function renderResolvedComponentCell({ ResolvedComponent, value, row, field, onChange, }) {
547
+ const node = (_jsx(ResolvedComponent, { value: value, row: row, column: { field }, ...(onChange !== undefined && { onChange }) }));
548
+ // stopPropagation only on the editable branch — plain cells must still
549
+ // fire row onClick when onCellChange is set for sibling editable cells.
550
+ if (onChange === undefined)
551
+ return node;
552
+ return (_jsx("span", { className: "contents", onClick: (e) => e.stopPropagation(), onKeyDown: (e) => e.stopPropagation(), children: node }));
553
+ }
554
+ // A select value renders as a pill instead of plain text. When the raw
555
+ // value is a known status word, it carries the same tone as the
556
+ // projectionDetail header badge — a status column stayed grey while the
557
+ // detail view of the same value was coloured. Unknown values
558
+ // keep the neutral outline pill.
559
+ function renderSelectTypeCell({ type, value, optionLabels, optionTones, locale, RegisteredStatusBadge, }) {
465
560
  if (type === "select" && value !== null && value !== undefined && value !== "") {
466
561
  return selectPill(value, optionLabels, optionTones, locale, RegisteredStatusBadge);
467
562
  }
@@ -469,6 +564,5 @@ export function DataTableCell({ value, row, field, type, renderer, optionLabels,
469
564
  if (type === "multiSelect" && Array.isArray(value) && value.length > 0) {
470
565
  return (_jsx("span", { className: "flex flex-wrap gap-1", children: value.map((entry) => (_jsx(Fragment, { children: selectPill(entry, optionLabels, optionTones, locale, RegisteredStatusBadge) }, String(entry)))) }));
471
566
  }
472
- const text = defaultCellRender(value, type, optionLabels, locale, field, grouping);
473
- return link === undefined ? text : _jsx(CellTextLink, { link: link, children: text });
567
+ return undefined;
474
568
  }
@@ -34,5 +34,5 @@ export function DefaultDataTable(props) {
34
34
  // (that lives in the shell's breadcrumb). The toolbar is NOT sticky: lists
35
35
  // typically scroll with the page container, not internally. Sticky would
36
36
  // compete with the topbar.
37
- return (_jsxs("div", { className: wrapperClassName(model), children: [!mergesDescription && !model.fillsHeight && renderToolbarDescription(model, hasToolbar), hasToolbar && renderToolbar(model, facetCluster), !mergesDescription && model.fillsHeight && renderToolbarDescription(model, hasToolbar), renderTableContent(model)] }));
37
+ return (_jsxs("div", { ref: model.containerRef, className: wrapperClassName(model), children: [!mergesDescription && !model.fillsHeight && renderToolbarDescription(model, hasToolbar), hasToolbar && renderToolbar(model, facetCluster), !mergesDescription && model.fillsHeight && renderToolbarDescription(model, hasToolbar), renderTableContent(model)] }));
38
38
  }
@@ -1,4 +1,4 @@
1
1
  import { type ReactNode } from "react";
2
2
  import { type FormProps } from "../../index.ts";
3
3
  import "../react-css-custom-properties.ts";
4
- export declare function DefaultForm({ onSubmit, focusFirstErrorKey, children, title, subtitle, actions, secondaryActions, testId, width, stickyActions, headerRegion, titleAction, fillHeight, chromeless, screenForm, unsavedCount, sectionNav, sideRail, summary, }: FormProps): ReactNode;
4
+ export declare function DefaultForm({ onSubmit, focusFirstErrorKey, children, title, subtitle, actions, secondaryActions, testId, width, stickyActions, headerRegion, titleAction, fillHeight, chromeless, screenForm, unsavedCount, sectionNav, sideRail, summary, topBanner, }: FormProps): ReactNode;