@cosmicdrift/kumiko-renderer 0.414.0 → 0.416.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 (209) hide show
  1. package/dist/app/action-form-body.d.ts +1 -1
  2. package/dist/app/action-form-body.js +43 -16
  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 +13 -4
  7. package/dist/app/entity-list-screen.js +12 -9
  8. package/dist/app/extension-sections.d.ts +2 -0
  9. package/dist/app/list-facets.d.ts +1 -0
  10. package/dist/app/list-facets.js +10 -1
  11. package/dist/app/named-filter-facet.d.ts +0 -1
  12. package/dist/app/named-filter-facet.js +19 -10
  13. package/dist/app/projection-detail-body.js +8 -6
  14. package/dist/app/projection-detail-guidance-data.js +3 -1
  15. package/dist/app/projection-detail-guidance.d.ts +1 -1
  16. package/dist/app/projection-detail-guidance.js +45 -33
  17. package/dist/app/projection-detail-header-model.d.ts +1 -1
  18. package/dist/app/projection-detail-header-model.js +10 -5
  19. package/dist/app/projection-detail-header.js +5 -4
  20. package/dist/app/projection-detail-navigation.d.ts +6 -0
  21. package/dist/app/projection-detail-navigation.js +18 -4
  22. package/dist/app/screen-access.js +1 -2
  23. package/dist/app/screen-shared.d.ts +1 -0
  24. package/dist/app/screen-shared.js +23 -3
  25. package/dist/app/use-entity-list-payload.d.ts +2 -1
  26. package/dist/app/use-entity-list-payload.js +4 -2
  27. package/dist/app/use-projection-detail-actions.d.ts +14 -0
  28. package/dist/app/use-projection-detail-actions.js +40 -16
  29. package/dist/app/use-projection-detail-data.d.ts +2 -0
  30. package/dist/app/use-projection-detail-data.js +37 -10
  31. package/dist/app/use-row-decoration.d.ts +6 -4
  32. package/dist/app/use-row-decoration.js +67 -19
  33. package/dist/app/use-screen-list-rows.js +1 -1
  34. package/dist/card-options.d.ts +25 -0
  35. package/dist/card-options.js +1 -0
  36. package/dist/components/ai-assist-payload.d.ts +2 -0
  37. package/dist/components/ai-assist-payload.js +8 -0
  38. package/dist/components/edit-mounts.d.ts +3 -2
  39. package/dist/components/edit-mounts.js +2 -2
  40. package/dist/components/list-empty-state.d.ts +5 -0
  41. package/dist/components/list-empty-state.js +17 -1
  42. package/dist/components/multi-select-chips.d.ts +10 -0
  43. package/dist/components/multi-select-chips.js +18 -0
  44. package/dist/components/related-list-section.js +44 -32
  45. package/dist/components/related-photo-grid.d.ts +11 -0
  46. package/dist/components/related-photo-grid.js +40 -0
  47. package/dist/components/render-edit-action-button.d.ts +2 -2
  48. package/dist/components/render-edit-field-grid.js +3 -3
  49. package/dist/components/render-edit-header-actions.d.ts +2 -1
  50. package/dist/components/render-edit-header-actions.js +18 -1
  51. package/dist/components/render-edit-layout.js +2 -2
  52. package/dist/components/render-edit-logic.js +1 -0
  53. package/dist/components/render-edit-section-kinds.js +11 -0
  54. package/dist/components/render-edit-types.d.ts +11 -1
  55. package/dist/components/render-field-ai-assist.d.ts +13 -0
  56. package/dist/components/render-field-ai-assist.js +89 -0
  57. package/dist/components/render-field-choice-inputs.js +4 -0
  58. package/dist/components/render-field-control.d.ts +1 -1
  59. package/dist/components/render-field-control.js +18 -8
  60. package/dist/components/render-field-value-chips.d.ts +9 -0
  61. package/dist/components/render-field-value-chips.js +45 -0
  62. package/dist/components/render-field-write-only.js +12 -4
  63. package/dist/components/render-list-hint-columns.d.ts +2 -0
  64. package/dist/components/render-list-hint-columns.js +23 -0
  65. package/dist/components/render-list-toolbar-model.d.ts +2 -2
  66. package/dist/components/use-render-edit-sections.js +5 -1
  67. package/dist/components/use-render-list-columns.js +3 -3
  68. package/dist/context/screen-focus-context.d.ts +1 -1
  69. package/dist/context/screen-focus-context.js +3 -3
  70. package/dist/data-table-facet-types.d.ts +4 -0
  71. package/dist/headless/format/index.d.ts +1 -0
  72. package/dist/headless/format/index.js +20 -0
  73. package/dist/headless/format/phone.d.ts +1 -0
  74. package/dist/headless/format/phone.js +8 -0
  75. package/dist/headless/format/relative-time.d.ts +13 -0
  76. package/dist/headless/format/relative-time.js +60 -0
  77. package/dist/headless/format/safe-locale.d.ts +1 -0
  78. package/dist/headless/format/safe-locale.js +13 -0
  79. package/dist/headless/index.d.ts +3 -3
  80. package/dist/headless/index.js +3 -3
  81. package/dist/headless/pwa-service-worker-meta.d.ts +3 -0
  82. package/dist/headless/pwa-service-worker-meta.js +10 -0
  83. package/dist/headless/view-model/edit.d.ts +3 -2
  84. package/dist/headless/view-model/edit.js +78 -2
  85. package/dist/headless/view-model/field-text.d.ts +9 -0
  86. package/dist/headless/view-model/field-text.js +19 -0
  87. package/dist/headless/view-model/index.d.ts +1 -0
  88. package/dist/headless/view-model/index.js +1 -0
  89. package/dist/headless/view-model/types.d.ts +33 -3
  90. package/dist/i18n-defaults.js +4 -1
  91. package/dist/index.d.ts +1 -1
  92. package/dist/metric-types.d.ts +2 -0
  93. package/dist/primitives-record-guidance.d.ts +30 -1
  94. package/dist/primitives.d.ts +17 -27
  95. package/dist/web/app/dashboard-body.js +3 -2
  96. package/dist/web/app/dashboard-header.js +1 -1
  97. package/dist/web/app/dashboard-list-panel.js +9 -13
  98. package/dist/web/app/dashboard-panel-columns.d.ts +9 -0
  99. package/dist/web/app/dashboard-panel-columns.js +14 -0
  100. package/dist/web/app/dashboard-panels.d.ts +1 -0
  101. package/dist/web/app/dashboard-panels.js +9 -7
  102. package/dist/web/app/dashboard-reference-list-table.js +1 -0
  103. package/dist/web/app/dashboard-shared.js +3 -2
  104. package/dist/web/app/dashboard-stat-group-panel.d.ts +1 -0
  105. package/dist/web/app/dashboard-stat-group-panel.js +22 -8
  106. package/dist/web/app/dashboard-text-panel.d.ts +1 -0
  107. package/dist/web/app/dashboard-text-panel.js +18 -12
  108. package/dist/web/app/relative-time.d.ts +0 -5
  109. package/dist/web/app/relative-time.js +1 -20
  110. package/dist/web/drawn-icons.d.ts +6 -0
  111. package/dist/web/drawn-icons.js +30 -0
  112. package/dist/web/icons.js +6 -5
  113. package/dist/web/index.d.ts +2 -0
  114. package/dist/web/index.js +2 -0
  115. package/dist/web/layout/default-app-shell.js +3 -3
  116. package/dist/web/layout/nav-collapse-state.d.ts +2 -0
  117. package/dist/web/layout/nav-collapse-state.js +10 -0
  118. package/dist/web/layout/nav-tree.js +46 -23
  119. package/dist/web/layout/notification-bell.d.ts +7 -2
  120. package/dist/web/layout/notification-bell.js +16 -5
  121. package/dist/web/layout/shell-focus.d.ts +2 -2
  122. package/dist/web/layout/shell-focus.js +7 -3
  123. package/dist/web/layout/shell-header.d.ts +2 -1
  124. package/dist/web/layout/shell-header.js +56 -27
  125. package/dist/web/layout/shell-style.d.ts +3 -0
  126. package/dist/web/layout/shell-style.js +6 -0
  127. package/dist/web/layout/workspace-shell.d.ts +11 -1
  128. package/dist/web/layout/workspace-shell.js +6 -4
  129. package/dist/web/primitives/banner.d.ts +1 -1
  130. package/dist/web/primitives/banner.js +19 -9
  131. package/dist/web/primitives/card.js +18 -8
  132. package/dist/web/primitives/data-table/actions-column.d.ts +1 -1
  133. package/dist/web/primitives/data-table/actions-column.js +3 -1
  134. package/dist/web/primitives/data-table/card-body.d.ts +1 -1
  135. package/dist/web/primitives/data-table/card-body.js +11 -6
  136. package/dist/web/primitives/data-table/card-row.js +27 -18
  137. package/dist/web/primitives/data-table/data-cell-props.d.ts +2 -0
  138. package/dist/web/primitives/data-table/data-cell-props.js +2 -0
  139. package/dist/web/primitives/data-table/hint-cell.d.ts +1 -3
  140. package/dist/web/primitives/data-table/hint-cell.js +4 -10
  141. package/dist/web/primitives/data-table/row-click-guard.d.ts +2 -0
  142. package/dist/web/primitives/data-table/row-click-guard.js +19 -0
  143. package/dist/web/primitives/data-table/row-render-parts.d.ts +1 -1
  144. package/dist/web/primitives/data-table/row-render-parts.js +3 -2
  145. package/dist/web/primitives/data-table/sort-options-select.js +3 -3
  146. package/dist/web/primitives/data-table/table-body.js +2 -1
  147. package/dist/web/primitives/data-table/table-content.js +10 -6
  148. package/dist/web/primitives/data-table/table-view.js +8 -3
  149. package/dist/web/primitives/data-table/toolbar.d.ts +2 -0
  150. package/dist/web/primitives/data-table/toolbar.js +44 -9
  151. package/dist/web/primitives/data-table/totals-footer.js +4 -3
  152. package/dist/web/primitives/data-table-cell.d.ts +4 -1
  153. package/dist/web/primitives/data-table-cell.js +60 -20
  154. package/dist/web/primitives/default-form.js +6 -3
  155. package/dist/web/primitives/drawer.js +5 -1
  156. package/dist/web/primitives/facet-filter.d.ts +1 -1
  157. package/dist/web/primitives/facet-filter.js +16 -8
  158. package/dist/web/primitives/facet-search-filter.d.ts +2 -1
  159. package/dist/web/primitives/facet-search-filter.js +3 -2
  160. package/dist/web/primitives/facet-trigger-label.d.ts +8 -0
  161. package/dist/web/primitives/facet-trigger-label.js +9 -0
  162. package/dist/web/primitives/file-view-action.js +4 -1
  163. package/dist/web/primitives/form-footer-parts.js +4 -1
  164. package/dist/web/primitives/form.js +6 -8
  165. package/dist/web/primitives/index.js +4 -0
  166. package/dist/web/primitives/layout-elements.d.ts +1 -1
  167. package/dist/web/primitives/layout-elements.js +3 -3
  168. package/dist/web/primitives/locale-number.d.ts +0 -1
  169. package/dist/web/primitives/locale-number.js +1 -13
  170. package/dist/web/primitives/metric.js +17 -5
  171. package/dist/web/primitives/money-input.js +2 -1
  172. package/dist/web/primitives/narrow-pinned-footer.js +7 -3
  173. package/dist/web/primitives/number-input.js +2 -1
  174. package/dist/web/primitives/page-header.js +3 -2
  175. package/dist/web/primitives/pager.d.ts +3 -2
  176. package/dist/web/primitives/pager.js +16 -20
  177. package/dist/web/primitives/photo-grid.d.ts +3 -0
  178. package/dist/web/primitives/photo-grid.js +5 -0
  179. package/dist/web/primitives/record-breadcrumb.js +1 -1
  180. package/dist/web/primitives/record-steps.d.ts +1 -1
  181. package/dist/web/primitives/record-steps.js +11 -6
  182. package/dist/web/primitives/record-summary.d.ts +1 -1
  183. package/dist/web/primitives/record-summary.js +8 -3
  184. package/dist/web/primitives/segmented-select.js +6 -3
  185. package/dist/web/primitives/step-list.d.ts +3 -0
  186. package/dist/web/primitives/step-list.js +11 -0
  187. package/dist/web/primitives/tabs.js +6 -1
  188. package/dist/web/pwa/pwa-support.js +19 -1
  189. package/dist/web/ui/sidebar.d.ts +2 -1
  190. package/dist/web/ui/sidebar.js +4 -3
  191. package/dist/web/widgets/ai-text-field.js +3 -2
  192. package/dist/web/widgets/dashboard-list-cards.js +6 -14
  193. package/dist/web/widgets/dashboard-list.d.ts +10 -0
  194. package/dist/web/widgets/dashboard-list.js +36 -10
  195. package/dist/web/widgets/drawer-panel-class.d.ts +1 -0
  196. package/dist/web/widgets/drawer-panel-class.js +9 -1
  197. package/dist/web/widgets/drawer.js +2 -2
  198. package/dist/web/widgets/pdf-viewer-toolbar.js +3 -2
  199. package/dist/web/widgets/sheet-parts.js +3 -1
  200. package/dist/web/widgets/stat-box-cell.js +1 -1
  201. package/dist/web/widgets/stat.d.ts +7 -1
  202. package/dist/web/widgets/stat.js +12 -4
  203. package/dist/web/widgets/step-list-row.d.ts +4 -0
  204. package/dist/web/widgets/step-list-row.js +22 -14
  205. package/dist/web/widgets/step-list.d.ts +12 -4
  206. package/dist/web/widgets/step-list.js +38 -20
  207. package/package.json +5 -5
  208. package/src/changes.json +126 -0
  209. package/src/web/styles.css +6 -0
@@ -1,14 +1,36 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Search, SlidersHorizontal } from "lucide-react";
2
+ import { DrawnFilter, DrawnSearch } from "../../drawn-icons.js";
3
3
  import { UNIFORM_BAR_CONTROLS_CLASSES } from "../../layout/uniform-bar-controls.js";
4
4
  import { cn } from "../../lib/cn.js";
5
5
  import { Button as UiButton } from "../../ui/button.js";
6
6
  import { buildFacetCluster } from "./facet-cluster.js";
7
7
  import { hasSortOptionsSelect, SortOptionsSelect } from "./sort-options-select.js";
8
8
  import { ToolbarEndCluster, toolbarEndHasContent } from "./toolbar-end-cluster.js";
9
+ function isBehindFilter(m, facet) {
10
+ return facet.narrowPlacement === "behind-filter" && m.belowSm;
11
+ }
12
+ function hasBehindFilterFacets(m) {
13
+ return (m.filterFacets ?? []).some((facet) => isBehindFilter(m, facet));
14
+ }
15
+ function hasActiveBehindFilterFacet(m) {
16
+ return (m.filterFacets ?? []).some((facet) => isBehindFilter(m, facet) && (m.filterValues?.[facet.field]?.length ?? 0) > 0);
17
+ }
18
+ /** Facets that open behind the filter icon on a phone; the rest stays in the inline cluster. */
19
+ export function buildBehindFilterCluster(m) {
20
+ const behind = (m.filterFacets ?? []).filter((facet) => isBehindFilter(m, facet));
21
+ if (behind.length === 0)
22
+ return undefined;
23
+ return buildFacetCluster({
24
+ filterFacets: behind,
25
+ filterValues: m.filterValues,
26
+ onFilterChange: m.onFilterChange,
27
+ dense: false,
28
+ pills: false,
29
+ });
30
+ }
9
31
  export function buildModelFacetCluster(m) {
10
32
  return buildFacetCluster({
11
- filterFacets: m.filterFacets,
33
+ filterFacets: m.filterFacets?.filter((facet) => !isBehindFilter(m, facet)),
12
34
  filterValues: m.filterValues,
13
35
  onFilterChange: m.onFilterChange,
14
36
  onFilterReset: m.onFilterReset,
@@ -25,6 +47,7 @@ export function buildModelFacetCluster(m) {
25
47
  export function hasToolbarContent(m, facetCluster) {
26
48
  return (m.toolbarStart !== undefined ||
27
49
  facetCluster !== undefined ||
50
+ hasBehindFilterFacets(m) ||
28
51
  hasVisibleSortOptions(m) ||
29
52
  toolbarEndHasContent(m.view, m.exportList, m.toolbarEnd));
30
53
  }
@@ -43,11 +66,14 @@ function toolbarClassName({ fillsHeight, isNarrow }) {
43
66
  function renderToolbarStart(m, toolbarStart) {
44
67
  return (_jsxs("div", { className: cn(m.fillsHeight
45
68
  ? "relative w-full md:w-[300px] max-md:flex-1 [&_input]:border-border-strong [&_input]:pl-8 [&_input]:max-md:h-11"
46
- : "flex-1 min-w-48 max-w-sm"), children: [m.fillsHeight && (_jsx(Search, { className: "pointer-events-none absolute left-2.5 top-1/2 z-10 size-4 -translate-y-1/2 text-muted-foreground", "aria-hidden": "true" })), toolbarStart] }));
69
+ : cn("flex-1 min-w-48 max-w-sm", hasBehindFilterFacets(m) && "max-sm:max-w-none")), children: [m.fillsHeight && (_jsx(DrawnSearch, { className: "pointer-events-none absolute left-2.5 top-1/2 z-10 size-4 -translate-y-1/2 text-muted-foreground", "aria-hidden": "true" })), toolbarStart] }));
47
70
  }
48
71
  function renderFacetToggle(m, facetCluster) {
49
72
  const { testId, facetsOpenNarrow, setFacetsOpenNarrow } = m;
50
- return (_jsxs(_Fragment, { children: [_jsx(UiButton, { type: "button", variant: "outline", size: "icon", className: "size-11", "aria-label": m.tableTranslate?.("kumiko.list.filter.toggle") ?? "Filter", "aria-expanded": facetsOpenNarrow, "data-testid": testId !== undefined ? `${testId}-filter-toggle` : "filter-toggle", onClick: () => setFacetsOpenNarrow((open) => !open), children: _jsx(SlidersHorizontal, { className: "size-4", "aria-hidden": "true" }) }), facetsOpenNarrow && _jsx("div", { className: "w-full", children: facetCluster })] }));
73
+ const hasActiveFacet = hasActiveBehindFilterFacet(m);
74
+ return (_jsxs(_Fragment, { children: [_jsx(UiButton, { type: "button", variant: "outline", size: "icon",
75
+ // Like a set select pill: a facet that waits behind the toggle stays visible while the panel is closed.
76
+ className: cn("size-11", hasActiveFacet && "border-primary text-primary"), "data-active": hasActiveFacet, "aria-label": m.tableTranslate?.("kumiko.list.filter.toggle") ?? "Filter", "aria-expanded": facetsOpenNarrow, "data-testid": testId !== undefined ? `${testId}-filter-toggle` : "filter-toggle", onClick: () => setFacetsOpenNarrow((open) => !open), children: _jsx(DrawnFilter, { className: "size-4", "aria-hidden": "true" }) }), facetsOpenNarrow && _jsx("div", { className: "w-full", children: facetCluster })] }));
51
77
  }
52
78
  // With only end content (no search, no facets) the row has room for the description,
53
79
  // so both share one line instead of stacking the description under the actions.
@@ -65,17 +91,26 @@ function renderSortOptions(m) {
65
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 }));
66
92
  }
67
93
  function hasOnlySelectFacets(m) {
68
- return ((m.filterFacets?.length ?? 0) > 0 &&
94
+ return ((m.filterFacets ?? []).some((facet) => !isBehindFilter(m, facet)) &&
69
95
  (m.dateRangeFacets?.length ?? 0) === 0 &&
70
96
  (m.rangeFacets?.length ?? 0) === 0);
71
97
  }
98
+ // Facets that wait behind the filter icon and the rest of the cluster share one toggle panel,
99
+ // never two toggles.
72
100
  function renderFacetArea(m, facetCluster) {
73
- if (!m.belowSm || facetCluster === undefined)
101
+ const behindFilter = buildBehindFilterCluster(m);
102
+ if (!m.belowSm || (facetCluster === undefined && behindFilter === undefined)) {
74
103
  return facetCluster;
75
- if (hasOnlySelectFacets(m)) {
76
- return _jsx("div", { className: "flex w-full flex-wrap gap-2", children: facetCluster });
77
104
  }
78
- return m.fillsHeight ? renderFacetToggle(m, facetCluster) : facetCluster;
105
+ if (facetCluster !== undefined && hasOnlySelectFacets(m)) {
106
+ const inline = _jsx("div", { className: "flex w-full flex-wrap gap-2", children: facetCluster });
107
+ if (behindFilter === undefined)
108
+ return inline;
109
+ return (_jsxs(_Fragment, { children: [renderFacetToggle(m, behindFilter), inline] }));
110
+ }
111
+ if (!m.fillsHeight && behindFilter === undefined)
112
+ return facetCluster;
113
+ return renderFacetToggle(m, _jsxs(_Fragment, { children: [behindFilter, facetCluster] }));
79
114
  }
80
115
  export function renderToolbar(m, facetCluster) {
81
116
  const { testId, toolbarStart } = m;
@@ -33,7 +33,8 @@ function SummaryItems({ summary }) {
33
33
  return (_jsx("span", { className: "text-sm text-muted-foreground", children: summary.items.map((item, index) => (_jsxs("span", { "data-testid": "list-summary-item", children: [index > 0 && " · ", item.label !== undefined && `${item.label} `, _jsx("span", { className: cn("font-medium tabular-nums text-foreground", item.tone !== undefined && HINT_TONE_TEXT_CLASS[item.tone]), children: item.value })] }, keys[index]))) }));
34
34
  }
35
35
  function SummaryCellValues({ items }) {
36
- return items.map((item) => (_jsx("span", { "data-testid": "list-summary-item", className: cn("me-2 font-medium tabular-nums text-foreground", item.tone !== undefined && HINT_TONE_TEXT_CLASS[item.tone]), children: item.value }, `${item.column ?? ""}-${item.label ?? ""}-${item.value}`)));
36
+ const keys = uniqueLabelKeys(items.map((item) => `${item.column ?? ""}-${item.label ?? ""}-${item.value}`));
37
+ return items.map((item, index) => (_jsx("span", { "data-testid": "list-summary-item", className: cn("me-2 font-medium tabular-nums text-foreground", item.tone !== undefined && HINT_TONE_TEXT_CLASS[item.tone]), children: item.value }, keys[index])));
37
38
  }
38
39
  /** Full-width row above the totals row, inside the same tfoot; the summary query's "label value · label value" pairs.
39
40
  * When an item names a `column`, the row is drawn as table cells under their columns instead, without labels. */
@@ -50,7 +51,7 @@ export function SummaryFooterRow({ summary, colSpan, cellClassName, columns, cel
50
51
  const pin = cellPin(column.field);
51
52
  const items = summary.items.filter((item) => columnOf(item) === column.field);
52
53
  return (_jsx(TableCell, { "data-testid": `list-summary-${column.field}`, className: cn(NUMERIC_COLUMN_TYPES.has(column.type) && "text-right", cellClassName, pin.className), style: pin.style, children: _jsx(SummaryCellValues, { items: items }) }, column.field));
53
- }), actionsCell !== undefined && (_jsx(TableCell, { className: stickyActionsCellClass(actionsCell.fillsHeight) }))] }));
54
+ }), actionsCell !== undefined && (_jsx(TableCell, { className: stickyActionsCellClass(actionsCell.fillsHeight, true) }))] }));
54
55
  }
55
56
  return (_jsx(TableRow, { "data-testid": "list-summary", className: "hover:bg-transparent", children: _jsx(TableCell, { colSpan: colSpan, className: cn("text-left", cellClassName), children: _jsx(SummaryItems, { summary: summary }) }) }));
56
57
  }
@@ -67,7 +68,7 @@ export function TotalsFooterRow({ totals, columns, cellPin, leadingCells, action
67
68
  const measures = measuresOf(totals, column.field);
68
69
  const pin = cellPin(column.field);
69
70
  return (_jsx(TableCell, { "data-testid": `list-totals-${column.field}`, className: cn("tabular-nums", NUMERIC_COLUMN_TYPES.has(column.type) && "text-right", cellClassName, pin.className), style: pin.style, children: measures.length > 0 ? (_jsx(FooterMeasures, { measures: measures, column: column })) : index === 0 ? (totalsLabel(translate)) : null }, column.field));
70
- }), actionsCell !== undefined && (_jsx(TableCell, { className: stickyActionsCellClass(actionsCell.fillsHeight) }))] }));
71
+ }), actionsCell !== undefined && (_jsx(TableCell, { className: stickyActionsCellClass(actionsCell.fillsHeight, true) }))] }));
71
72
  }
72
73
  /** Card layout: the totals as a labelled list under the cards. */
73
74
  export function TotalsCard({ totals, columnOf, }) {
@@ -45,11 +45,14 @@ type DataTableCellProps = {
45
45
  readonly display?: ListColumnCellDisplay;
46
46
  readonly badgeToneField?: string;
47
47
  readonly badgeDot?: false;
48
+ readonly pillField?: string;
49
+ readonly pillToneField?: string;
48
50
  readonly emptyPlaceholder?: false;
49
51
  readonly onOpenRow?: () => void;
50
52
  };
51
53
  /** `display: "button"` draws a cell link as a small outline button. */
52
54
  export declare const LINK_BUTTON_CLASS: string;
55
+ export declare const LINK_BUTTON_PRIMARY_CLASS: string;
53
56
  /** Badge tones by the list-wide ListBadgeTone words. */
54
57
  export declare const LIST_BADGE_TONE: Readonly<Record<string, StatusBadgeTone>>;
55
58
  export declare function cellLinkProp(col: {
@@ -71,5 +74,5 @@ export declare function CellTextLink({ link, children, className, }: {
71
74
  readonly children: ReactNode;
72
75
  readonly className?: string;
73
76
  }): 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;
77
+ export declare function DataTableCell(props: DataTableCellProps): ReactNode;
75
78
  export {};
@@ -5,7 +5,7 @@ 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
10
  import { isSelectOptionTone } from "../../status-tone.js";
11
11
  import { Badge } from "../ui/badge.js";
@@ -240,6 +240,7 @@ function EmptyCell({ placeholder }) {
240
240
  }
241
241
  /** `display: "button"` draws a cell link as a small outline button. */
242
242
  export const LINK_BUTTON_CLASS = buttonVariants({ variant: "outline", size: "sm" });
243
+ export const LINK_BUTTON_PRIMARY_CLASS = buttonVariants({ variant: "default", size: "sm" });
243
244
  /** Badge tones by the list-wide ListBadgeTone words. */
244
245
  export const LIST_BADGE_TONE = {
245
246
  positive: "ok",
@@ -272,7 +273,7 @@ export function cellLinkProp(col, row, allowed) {
272
273
  // opaque sticky actions cell. Rows draw it as an inset shadow on the first cell (a border on a
273
274
  // <tr> collapses away), cards as a real border. The colour also lands in --row-stripe because a
274
275
  // pinned cell sets its own inline box-shadow, which would otherwise replace the stripe.
275
- const ROW_STRIPE_SHADOW_CLASS = "[&>td:first-child]:shadow-[inset_3px_0_0_var(--row-stripe)]";
276
+ const ROW_STRIPE_SHADOW_CLASS = "[&>td:first-child]:shadow-[inset_4px_0_0_var(--row-stripe)]";
276
277
  const ROW_TONE_STRIPE_CLASS = {
277
278
  bad: `${ROW_STRIPE_SHADOW_CLASS} [&>td:first-child]:[--row-stripe:var(--color-status-bad)]`,
278
279
  warn: `${ROW_STRIPE_SHADOW_CLASS} [&>td:first-child]:[--row-stripe:var(--color-status-warn)]`,
@@ -281,13 +282,15 @@ const ROW_TONE_STRIPE_CLASS = {
281
282
  accent: `${ROW_STRIPE_SHADOW_CLASS} [&>td:first-child]:[--row-stripe:var(--color-primary)]`,
282
283
  neutral: "",
283
284
  };
285
+ // Inner 4px stripe (board .m-card): the card keeps its own border, the stripe sits inside the padding.
286
+ 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-['']";
284
287
  const CARD_TONE_STRIPE_CLASS = {
285
- bad: "border-l-[3px] border-l-status-bad",
286
- warn: "border-l-[3px] border-l-status-warn",
287
- ok: "border-l-[3px] border-l-status-ok",
288
- critical: "border-l-[3px] border-l-status-critical",
289
- accent: "border-l-[3px] border-l-primary",
290
- neutral: "",
288
+ bad: `${CARD_STRIPE_BASE} before:bg-status-bad`,
289
+ warn: `${CARD_STRIPE_BASE} before:bg-status-warn`,
290
+ ok: `${CARD_STRIPE_BASE} before:bg-status-ok`,
291
+ critical: `${CARD_STRIPE_BASE} before:bg-status-critical`,
292
+ accent: `${CARD_STRIPE_BASE} before:bg-primary`,
293
+ neutral: `${CARD_STRIPE_BASE} before:bg-border-strong`,
291
294
  };
292
295
  export function rowToneClass(tone) {
293
296
  return tone === undefined ? "" : ROW_TONE_STRIPE_CLASS[tone];
@@ -331,8 +334,24 @@ export function CellTextLink({ link, children, className = "text-primary underli
331
334
  link.onPress();
332
335
  }, children: children }));
333
336
  }
337
+ function isFunctionRenderer(renderer) {
338
+ return typeof renderer === "function";
339
+ }
340
+ function isFormatSpecRenderer(renderer) {
341
+ return typeof renderer === "object" && renderer !== null && "format" in renderer;
342
+ }
343
+ // Same text the cell shows without `display`: a reference-lookup renderer or FormatSpec must win over the raw value.
344
+ function plainCellText({ value, row, type, renderer, optionLabels, locale, field, grouping, translate, }) {
345
+ if (isFunctionRenderer(renderer)) {
346
+ return renderer(value, row);
347
+ }
348
+ if (isFormatSpecRenderer(renderer)) {
349
+ return applyFormatSpec({ ...renderer, locale: renderer.locale ?? locale }, value, translate);
350
+ }
351
+ return defaultCellRender(value, type, optionLabels, locale, field, grouping);
352
+ }
334
353
  // A list column's `display` (badge pill, outline link button); undefined = fall through to the normal paths.
335
- function renderDisplayCell({ display, value, text, row, badgeToneField, badgeDot, emptyPlaceholder, link, }) {
354
+ function renderDisplayCell({ display, value, textOf, row, badgeToneField, badgeDot, emptyPlaceholder, link, }) {
336
355
  // A column renderer skips the generic empty-cell path, so a pill or button would otherwise wrap nothing.
337
356
  if ((display === "badge" || display === "button") && isEmptyCellValue(value)) {
338
357
  return _jsx(EmptyCell, { placeholder: emptyPlaceholder });
@@ -340,10 +359,10 @@ function renderDisplayCell({ display, value, text, row, badgeToneField, badgeDot
340
359
  if (display === "badge") {
341
360
  const toneKey = badgeToneField === undefined ? undefined : row[badgeToneField];
342
361
  const tone = (typeof toneKey === "string" ? LIST_BADGE_TONE[toneKey] : undefined) ?? "muted";
343
- return (_jsx(StatusBadge, { tone: tone, dot: badgeDot !== false, children: text }));
362
+ return (_jsx(StatusBadge, { tone: tone, dot: badgeDot !== false, children: textOf() }));
344
363
  }
345
364
  if (display === "button" && link !== undefined) {
346
- return (_jsx(CellTextLink, { link: link, className: LINK_BUTTON_CLASS, children: text }));
365
+ return (_jsx(CellTextLink, { link: link, className: LINK_BUTTON_CLASS, children: textOf() }));
347
366
  }
348
367
  return undefined;
349
368
  }
@@ -362,7 +381,16 @@ function renderFileCell({ value, fileDisplay, compactFile, translate, }) {
362
381
  // "X" via useColumnRenderer and renders `<X value row column/>`.
363
382
  // Not registered -> one-time warning + default fallback.
364
383
  // 4. Otherwise -> defaultCellRender (type-based string renderer).
365
- 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, }) {
384
+ export function DataTableCell(props) {
385
+ const { pillField, pillToneField, row } = props;
386
+ const pillText = pillField === undefined ? undefined : row[pillField];
387
+ if (typeof pillText !== "string" || pillText === "")
388
+ return _jsx(DataTableCellBody, { ...props });
389
+ const toneKey = pillToneField === undefined ? undefined : row[pillToneField];
390
+ const tone = (typeof toneKey === "string" ? LIST_BADGE_TONE[toneKey] : undefined) ?? "muted";
391
+ return (_jsxs("span", { className: "inline-flex items-center gap-2", children: [_jsx(DataTableCellBody, { ...props }), _jsx(StatusBadge, { tone: tone, dot: false, children: pillText })] }));
392
+ }
393
+ function DataTableCellBody({ value, row, field, type, renderer, optionLabels, optionTones, onChange, translate, locale, grouping = true, fileDisplay, compactFile = false, link, linkItems, hint, display, badgeToneField, badgeDot, emptyPlaceholder, onOpenRow, }) {
366
394
  const componentRef = isComponentRendererRef(renderer);
367
395
  const ResolvedComponent = useColumnRenderer(componentRef?.name);
368
396
  const RegisteredStatusBadge = useOptionalPrimitives()?.StatusBadge;
@@ -378,7 +406,17 @@ export function DataTableCell({ value, row, field, type, renderer, optionLabels,
378
406
  const displayCell = renderDisplayCell({
379
407
  display,
380
408
  value,
381
- text: defaultCellRender(value, type, optionLabels, locale, field, grouping),
409
+ textOf: () => plainCellText({
410
+ value,
411
+ row,
412
+ type,
413
+ renderer,
414
+ optionLabels,
415
+ locale,
416
+ field,
417
+ grouping,
418
+ translate,
419
+ }),
382
420
  row,
383
421
  badgeToneField,
384
422
  badgeDot,
@@ -397,22 +435,24 @@ export function DataTableCell({ value, row, field, type, renderer, optionLabels,
397
435
  if (fileDisplay !== undefined) {
398
436
  return renderFileCell({ value, fileDisplay, compactFile, translate });
399
437
  }
400
- if (typeof renderer === "object" && renderer !== null && "format" in renderer) {
401
- const spec = renderer;
402
- const text = applyFormatSpec({ ...spec, locale: spec.locale ?? locale }, value, translate);
403
- const tones = enumOptionTones(spec);
438
+ if (isFormatSpecRenderer(renderer)) {
439
+ const text = applyFormatSpec({ ...renderer, locale: renderer.locale ?? locale }, value, translate);
440
+ const phoneHref = renderer.format === "phone" ? telHref(text) : undefined;
441
+ if (phoneHref !== undefined) {
442
+ return (_jsx(CellTextLink, { link: { href: phoneHref, onPress: () => window.location.assign(phoneHref) }, children: text }));
443
+ }
444
+ const tones = enumOptionTones(renderer);
404
445
  if (tones !== undefined && typeof value === "string") {
405
446
  return selectPill(value, { [value]: text }, tones, locale, RegisteredStatusBadge);
406
447
  }
407
448
  return link === undefined ? text : _jsx(CellTextLink, { link: link, children: text });
408
449
  }
409
- if (typeof renderer === "function") {
450
+ if (isFunctionRenderer(renderer)) {
410
451
  if (linkItems !== undefined) {
411
452
  const linkItemKeys = uniqueLinkItemKeys(linkItems);
412
453
  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]))) }));
413
454
  }
414
- const fn = renderer;
415
- const text = fn(value, row);
455
+ const text = renderer(value, row);
416
456
  return link === undefined ? text : _jsx(CellTextLink, { link: link, children: text });
417
457
  }
418
458
  if (componentRef !== undefined) {
@@ -20,9 +20,12 @@ function FormSummaryBox({ summary, testId }) {
20
20
  function DrawerFormLayout({ onSubmit, focusFirstErrorKey, subtitle, actions, secondaryActions, summary, testId, children, }) {
21
21
  return (_jsxs(FormRoot, { onSubmit: onSubmit, focusFirstErrorKey: focusFirstErrorKey, testId: testId, className: "flex h-full min-h-0 w-full flex-col", children: [_jsxs("div", { "data-testid": testId !== undefined ? `${testId}-scroll` : undefined, className: "flex min-h-0 flex-1 flex-col gap-5 overflow-y-auto px-6 py-5", children: [_jsx(FormSummaryBox, { summary: summary, testId: testId }), subtitle !== undefined && (_jsx("p", { "data-testid": testId !== undefined ? `${testId}-subtitle` : undefined, className: "text-[13px] text-foreground-secondary", children: subtitle })), _jsx(InsideFormContext.Provider, { value: true, children: _jsx(ScreenFormContext.Provider, { value: true, children: _jsx(InsideDrawerProvider, { value: false, children: _jsx(DrawerBodyContext.Provider, { value: true, children: _jsx("div", { className: "flex flex-col gap-5", children: children }) }) }) }) })] }), (actions !== undefined || secondaryActions !== undefined) && (_jsxs("div", { "data-testid": testId !== undefined ? `${testId}-footer` : undefined, className: "flex h-16 shrink-0 items-center justify-end gap-2 border-t border-border px-6", children: [secondaryActions, actions] }))] }));
22
22
  }
23
+ function EmbeddedFormLayout({ onSubmit, focusFirstErrorKey, actions, secondaryActions, unsavedCount, testId, children, }) {
24
+ const t = useTranslation();
25
+ return (_jsxs(FormRoot, { onSubmit: onSubmit, focusFirstErrorKey: focusFirstErrorKey, testId: testId, className: "flex w-full flex-col gap-6", children: [_jsx(FormSections, { chromeless: true, stickyActions: undefined, fillHeight: false, screenForm: true, children: children }), (actions !== undefined || secondaryActions !== undefined) && (_jsxs("div", { "data-testid": testId !== undefined ? `${testId}-footer` : undefined, className: "flex flex-wrap items-center gap-2", children: [actions, secondaryActions, unsavedCount !== undefined && unsavedCount > 0 && (_jsxs("span", { "data-testid": testId !== undefined ? `${testId}-unsaved` : undefined, className: "flex items-center gap-2 text-[13px] text-foreground-secondary", children: [_jsx("span", { className: "size-1.5 shrink-0 rounded-full bg-status-active", "aria-hidden": "true" }), unsavedStatusText(t, unsavedCount)] }))] }))] }));
26
+ }
23
27
  export function DefaultForm({ onSubmit, focusFirstErrorKey, children, title, subtitle, actions, secondaryActions, testId, width, stickyActions, headerRegion, titleAction, fillHeight, chromeless, screenForm, unsavedCount, sectionNav, sideRail, summary, }) {
24
28
  const insideDrawer = useInsideDrawer();
25
- const t = useTranslation();
26
29
  const isEmbeddedForm = useContext(EmbeddedFormContext);
27
30
  const contextWidth = useContext(ScreenWidthContext);
28
31
  // Embedded (AuthCard etc.): bare <form>, stacked fields with gap; the
@@ -37,7 +40,7 @@ export function DefaultForm({ onSubmit, focusFirstErrorKey, children, title, sub
37
40
  return (_jsx(DrawerFormLayout, { onSubmit: onSubmit, focusFirstErrorKey: focusFirstErrorKey, subtitle: subtitle, actions: actions, secondaryActions: secondaryActions, summary: summary, testId: testId, children: children }));
38
41
  }
39
42
  if (isEmbeddedForm) {
40
- return (_jsxs(FormRoot, { onSubmit: onSubmit, focusFirstErrorKey: focusFirstErrorKey, testId: testId, className: "flex w-full flex-col gap-6", children: [_jsx(FormSections, { chromeless: true, stickyActions: undefined, fillHeight: false, screenForm: true, children: children }), (actions !== undefined || secondaryActions !== undefined) && (_jsxs("div", { "data-testid": testId !== undefined ? `${testId}-footer` : undefined, className: "flex flex-wrap items-center gap-2", children: [actions, secondaryActions, unsavedCount !== undefined && unsavedCount > 0 && (_jsxs("span", { "data-testid": testId !== undefined ? `${testId}-unsaved` : undefined, className: "flex items-center gap-2 text-[13px] text-foreground-secondary", children: [_jsx("span", { className: "size-1.5 shrink-0 rounded-full bg-status-active", "aria-hidden": "true" }), unsavedStatusText(t, unsavedCount)] }))] }))] }));
43
+ return (_jsx(EmbeddedFormLayout, { onSubmit: onSubmit, focusFirstErrorKey: focusFirstErrorKey, actions: actions, secondaryActions: secondaryActions, unsavedCount: unsavedCount, testId: testId, children: children }));
41
44
  }
42
45
  const isScreenForm = screenForm === true && fillHeight === true && chromeless !== true;
43
46
  const screenFormWidth = width ?? contextWidth;
@@ -49,7 +52,7 @@ export function DefaultForm({ onSubmit, focusFirstErrorKey, children, title, sub
49
52
  const showsSectionNav = sectionNav !== undefined && sectionNav.length >= SECTION_NAV_MIN_ITEMS;
50
53
  return (_jsxs(FormRoot, { onSubmit: onSubmit, focusFirstErrorKey: focusFirstErrorKey, testId: testId, className: "flex h-full min-h-0 w-full flex-col", children: [_jsxs("div", { className: "flex min-h-0 flex-1 flex-col lg:flex-row", children: [sideRail, _jsx("div", { "data-testid": testId !== undefined ? `${testId}-scroll` : undefined, className: cn("min-h-0 flex-1 overflow-y-auto", screenPaddingClassName), children: _jsxs("div", { className: "flex gap-18", children: [_jsxs("div", { className: cn("flex w-full min-w-0 flex-col gap-9", screenFormWidth !== undefined
51
54
  ? screenFormColumnWidthClassName[screenFormWidth]
52
- : "max-w-[640px]"), children: [_jsx(InsideScreenFormColumnContext.Provider, { value: true, children: headerRegion }), _jsx(FormTitleBlock, { title: title, subtitle: subtitle, titleAction: titleAction, testId: testId, bordered: false, fillHeight: false }), _jsx(FormSummaryBox, { summary: summary, testId: testId }), sections] }), showsSectionNav && _jsx(FormSectionNav, { items: sectionNav })] }) })] }), footer] }));
55
+ : "max-w-[640px]"), children: [headerRegion !== undefined && (_jsx("div", { className: "flex flex-col gap-9", children: _jsx(InsideScreenFormColumnContext.Provider, { value: true, children: headerRegion }) })), _jsx(FormTitleBlock, { title: title, subtitle: subtitle, titleAction: titleAction, testId: testId, bordered: false, fillHeight: false }), _jsx(FormSummaryBox, { summary: summary, testId: testId }), sections] }), showsSectionNav && _jsx(FormSectionNav, { items: sectionNav })] }) })] }), footer] }));
53
56
  }
54
57
  // Pinned footer (fillHeight + stickyActions): the footer is a full-bleed
55
58
  // sibling BELOW the padded shell, so the shell's bottom inset does not float
@@ -8,10 +8,14 @@ import { XIcon } from "lucide-react";
8
8
  import { useTranslation } from "../../index.js";
9
9
  import { SheetTitle } from "../ui/sheet.js";
10
10
  import { Drawer } from "../widgets/drawer.js";
11
+ import { useIsNarrowViewport } from "./use-narrow-viewport.js";
11
12
  const DRAWER_WIDTH_PX = 480;
12
13
  const DRAWER_DIM_PERCENT = 32;
13
14
  const PANEL_CLASS = "bg-card border-border-strong shadow-[-12px_0_32px_rgb(0_0_0/0.14)]";
14
15
  export function DefaultDrawer({ open, onOpenChange, title, subtitle, children, testId, }) {
15
16
  const t = useTranslation();
16
- return (_jsxs(Drawer, { open: open, onOpenChange: onOpenChange, testId: testId, variant: "flush", side: "right", width: DRAWER_WIDTH_PX, backdrop: { dimPercent: DRAWER_DIM_PERCENT }, showCloseButton: false, panelClassName: PANEL_CLASS, fillBody: true, children: [_jsxs("div", { "data-testid": testId !== undefined ? `${testId}-header` : undefined, className: "flex min-h-14 shrink-0 items-center gap-3 border-b border-border py-2 pr-3 pl-6", children: [_jsxs("div", { className: "flex min-w-0 flex-1 flex-col", children: [_jsx(SheetTitle, { className: "text-base font-semibold", children: title ?? "" }), subtitle !== undefined && (_jsx("p", { "data-testid": testId !== undefined ? `${testId}-subtitle` : undefined, className: "text-sm text-muted-foreground", children: subtitle }))] }), _jsx("button", { type: "button", "aria-label": t("kumiko.dialog.close"), onClick: () => onOpenChange(false), className: "flex size-8 items-center justify-center rounded-md text-foreground-secondary hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-hidden", children: _jsx(XIcon, { className: "size-4" }) })] }), _jsx("div", { "data-testid": testId !== undefined ? `${testId}-body` : undefined, onSubmit: (e) => e.stopPropagation(), className: "flex min-h-0 flex-1 flex-col", children: children })] }));
17
+ // On a phone the panel is a bottom sheet (up to 90% of the height, page visible above it)
18
+ // instead of a full-screen takeover.
19
+ const narrow = useIsNarrowViewport();
20
+ return (_jsxs(Drawer, { open: open, onOpenChange: onOpenChange, testId: testId, variant: "flush", side: narrow ? "bottom" : "right", width: DRAWER_WIDTH_PX, backdrop: { dimPercent: DRAWER_DIM_PERCENT }, showCloseButton: false, panelClassName: narrow ? undefined : PANEL_CLASS, fillBody: true, children: [_jsxs("div", { "data-testid": testId !== undefined ? `${testId}-header` : undefined, className: "flex min-h-14 shrink-0 items-center gap-3 border-b border-border py-2 pr-3 pl-6", children: [_jsxs("div", { className: "flex min-w-0 flex-1 flex-col", children: [_jsx(SheetTitle, { className: "text-base font-semibold", children: title ?? "" }), subtitle !== undefined && (_jsx("p", { "data-testid": testId !== undefined ? `${testId}-subtitle` : undefined, className: "text-sm text-muted-foreground", children: subtitle }))] }), _jsx("button", { type: "button", "aria-label": t("kumiko.dialog.close"), onClick: () => onOpenChange(false), className: "flex size-8 items-center justify-center rounded-md text-foreground-secondary hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-hidden", children: _jsx(XIcon, { className: "size-4" }) })] }), _jsx("div", { "data-testid": testId !== undefined ? `${testId}-body` : undefined, onSubmit: (e) => e.stopPropagation(), className: "flex min-h-0 flex-1 flex-col", children: children })] }));
17
21
  }
@@ -1,4 +1,4 @@
1
- import type { ReactNode } from "react";
1
+ import { type ReactNode } from "react";
2
2
  import { type DataTableDateRangeFacet, type DataTableFacet } from "../../index.ts";
3
3
  import "../react-css-custom-properties.ts";
4
4
  export declare function FacetFilter({ facet, selected, onChange, dense, pill, }: {
@@ -1,39 +1,47 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { ChevronDown } from "lucide-react";
3
+ import { Fragment } from "react";
3
4
  import { useOptionalTranslation, } from "../../index.js";
4
5
  import { cn } from "../lib/cn.js";
5
6
  import { Badge } from "../ui/badge.js";
6
7
  import { Button as UiButton } from "../ui/button.js";
7
- import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuTrigger, } from "./dropdown-menu.js";
8
+ import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuTrigger, } from "./dropdown-menu.js";
8
9
  import "../react-css-custom-properties.js";
9
10
  import { DefaultButton } from "./button.js";
10
11
  import { FacetSearchFilter } from "./facet-search-filter.js";
12
+ import { FACET_PILL_CLASSES, FacetTriggerLabel } from "./facet-trigger-label.js";
11
13
  // ---- DataTable (shadcn: Table) ----
12
- const PILL_CLASSES = "h-9 rounded-full border-border-strong px-3";
13
14
  function sameValueSet(a, b) {
14
15
  return a.length === b.length && a.every((value) => b.includes(value));
15
16
  }
17
+ // "All" (no values) always stays; with hideEmpty an entry at 0 only stays while it is the active selection.
18
+ function visibleChips(facet, selected) {
19
+ return (facet.chips ?? []).filter((chip) => facet.hideEmpty !== true ||
20
+ chip.values.length === 0 ||
21
+ chip.count !== 0 ||
22
+ sameValueSet(selected, chip.values));
23
+ }
16
24
  // Single-choice chip row for a facet with `chips`: a chip is pressed while the
17
25
  // current selection equals its values, a click replaces the selection.
18
26
  function FacetChips({ facet, selected, onChange, }) {
19
- const chips = (facet.chips ?? []).filter((chip) => facet.hideEmpty !== true || chip.count !== 0 || sameValueSet(selected, chip.values));
27
+ const chips = visibleChips(facet, selected);
20
28
  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))) }));
21
29
  }
22
30
  // Single-choice dropdown for a chips facet with display "select": the trigger names the
23
31
  // active entry, and turns primary-bordered once a chip other than the empty selection is on.
24
32
  function FacetSelect({ facet, selected, onChange, dense, pill, }) {
25
- const chips = facet.chips ?? [];
33
+ const chips = visibleChips(facet, selected);
26
34
  const isFiltered = selected.length > 0;
27
35
  // A stale URL can name an entry the facet does not offer; showing "all" then would misstate the list.
28
36
  const active = chips.find((chip) => sameValueSet(selected, chip.values)) ??
29
37
  (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) => {
38
+ 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 && FACET_PILL_CLASSES, isFiltered && "border-primary"), "data-testid": `facet-${facet.field}`, children: [_jsx("span", { className: "text-muted-foreground", children: active === undefined ? facet.label : `${facet.label}: ` }), active !== undefined && (_jsx("span", { "data-testid": `facet-${facet.field}-value`, className: isFiltered ? "font-medium text-primary" : "text-foreground", children: 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
39
  if (id === active?.id)
32
40
  return;
33
41
  const chip = chips.find((candidate) => candidate.id === id);
34
42
  if (chip !== undefined)
35
43
  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))) }) })] }));
44
+ }, children: chips.map((chip) => (_jsxs(Fragment, { children: [_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-auto pl-4 tabular-nums text-muted-foreground", children: chip.count }))] }), chip.separatorAfter === true && _jsx(DropdownMenuSeparator, {})] }, chip.id))) }) })] }));
37
45
  }
38
46
  // Faceted filter dropdown: outline button (like shadcn's "Columns" toggle) +
39
47
  // multi-select checkboxes. Active selection -> count badge on the button.
@@ -51,9 +59,9 @@ export function FacetFilter({ facet, selected, onChange, dense = false, pill = f
51
59
  return _jsx(FacetChips, { facet: facet, selected: selected, onChange: onChange });
52
60
  }
53
61
  if (facet.onSearchChange !== undefined) {
54
- return (_jsx(FacetSearchFilter, { facet: facet, onSearchChange: facet.onSearchChange, selected: selected, onChange: onChange, dense: dense }));
62
+ return (_jsx(FacetSearchFilter, { facet: facet, onSearchChange: facet.onSearchChange, selected: selected, onChange: onChange, dense: dense, pill: pill }));
55
63
  }
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))) })] }));
64
+ 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 && FACET_PILL_CLASSES), "data-testid": `facet-${facet.field}`, children: [selected.length === 0 ? (_jsx(FacetTriggerLabel, { field: facet.field, label: facet.label, emptyValueLabel: allLabel, showEmptyValue: !pill })) : (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))) })] }));
57
65
  }
58
66
  // Time-range filter: two native <input type="date"> instead of a
59
67
  // dropdown — the browser supplies the calendar, the locale and the keyboard
@@ -1,9 +1,10 @@
1
1
  import { type ReactNode } from "react";
2
2
  import { type DataTableFacet } from "../../index.ts";
3
- export declare function FacetSearchFilter({ facet, onSearchChange, selected, onChange, dense, }: {
3
+ export declare function FacetSearchFilter({ facet, onSearchChange, selected, onChange, dense, pill, }: {
4
4
  facet: DataTableFacet;
5
5
  onSearchChange: (query: string) => void;
6
6
  selected: readonly string[];
7
7
  onChange: (field: string, values: readonly string[]) => void;
8
8
  dense: boolean;
9
+ pill: boolean;
9
10
  }): ReactNode;
@@ -10,7 +10,8 @@ import { REFERENCE_SEARCH_DEBOUNCE_MS, useTranslation } from "../../index.js";
10
10
  import { cn } from "../lib/cn.js";
11
11
  import { Badge } from "../ui/badge.js";
12
12
  import { Button as UiButton } from "../ui/button.js";
13
- export function FacetSearchFilter({ facet, onSearchChange, selected, onChange, dense, }) {
13
+ import { FACET_PILL_CLASSES, FacetTriggerLabel } from "./facet-trigger-label.js";
14
+ export function FacetSearchFilter({ facet, onSearchChange, selected, onChange, dense, pill, }) {
14
15
  const t = useTranslation();
15
16
  const [open, setOpen] = useState(false);
16
17
  const [searchTerm, setSearchTerm] = useState("");
@@ -25,7 +26,7 @@ export function FacetSearchFilter({ facet, onSearchChange, selected, onChange, d
25
26
  const toggle = (value) => {
26
27
  onChange(facet.field, selected.includes(value) ? selected.filter((v) => v !== value) : [...selected, value]);
27
28
  };
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
+ 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", pill && FACET_PILL_CLASSES), "data-testid": `facet-${facet.field}`, children: [selected.length === 0 ? (_jsx(FacetTriggerLabel, { field: facet.field, label: facet.label, emptyValueLabel: t("kumiko.list.filter.all"), showEmptyValue: !pill })) : (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
30
  ? t("kumiko.combobox.loading")
30
31
  : 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
32
  }
@@ -0,0 +1,8 @@
1
+ import type { ReactNode } from "react";
2
+ export declare const FACET_PILL_CLASSES = "h-9 rounded-full border-border-strong px-3";
3
+ export declare function FacetTriggerLabel({ field, label, emptyValueLabel, showEmptyValue, }: {
4
+ readonly field: string;
5
+ readonly label: string;
6
+ readonly emptyValueLabel: string;
7
+ readonly showEmptyValue: boolean;
8
+ }): ReactNode;
@@ -0,0 +1,9 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ export const FACET_PILL_CLASSES = "h-9 rounded-full border-border-strong px-3";
3
+ // The label keeps its trailing ": " so textContent reads "Label: Value"; the button gap draws the space.
4
+ // A pill with nothing chosen names the facet only, like the boards ("Property ▾").
5
+ export function FacetTriggerLabel({ field, label, emptyValueLabel, showEmptyValue, }) {
6
+ if (!showEmptyValue)
7
+ return _jsx("span", { className: "text-muted-foreground", children: label });
8
+ return (_jsxs(_Fragment, { children: [_jsx("span", { className: "text-muted-foreground", children: `${label}: ` }), _jsx("span", { "data-testid": `facet-${field}-value`, className: "text-foreground", children: emptyValueLabel })] }));
9
+ }
@@ -15,5 +15,8 @@ export function FileViewAction({ fileId }) {
15
15
  const [open, setOpen] = useState(false);
16
16
  if (!isUuid(fileId) || meta?.mimeType !== PDF_MIME_TYPE)
17
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}` }) }) })] }));
18
+ return (_jsxs(_Fragment, { children: [_jsx(Button, { type: "button", variant: "link", size: "sm", onClick: (event) => {
19
+ event.stopPropagation();
20
+ setOpen(true);
21
+ }, "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
22
  }
@@ -36,7 +36,10 @@ export function renderSecondaryActionsGroup(model) {
36
36
  return (_jsx("div", { "data-testid": testId !== undefined ? `${testId}-actions-secondary` : undefined, className: cn(
37
37
  // min-h-11: link-variant buttons (Copy link) are h-auto and would fall
38
38
  // below the 24px touch-target minimum on narrow viewports.
39
- "flex flex-wrap items-center gap-2 max-sm:[&_button]:min-h-11 max-sm:[&_button]:px-2 max-sm:[&_button]:text-xs", pinned && hasNonPrimaryOverflow && "mr-auto"), children: renderedSecondary }));
39
+ "flex flex-wrap items-center gap-2 max-sm:[&_button]:min-h-11 max-sm:[&_button]:px-2 max-sm:[&_button]:text-xs", pinned && hasNonPrimaryOverflow && "mr-auto",
40
+ // An align: "start" action (marked data-footer-align) rides the group's inner mr-auto to the
41
+ // left edge, so the group has to span the free width of the pinned row.
42
+ pinned && "has-[[data-footer-align=start]]:flex-1"), children: renderedSecondary }));
40
43
  }
41
44
  export function renderPrimaryActionsGroup(model) {
42
45
  const { testId, pinned, stickyActions, fixedFooterStyle, renderedActions } = model;
@@ -128,15 +128,13 @@ function isPrimaryStickyAction(node) {
128
128
  const props = node.props;
129
129
  return props.type === "submit" || props[STICKY_PRIMARY_ACTION_PROP] === true;
130
130
  }
131
- // `actions` from render-edit.tsx arrives as a single `<>…</>` Fragment
132
- // element (not spread children) — Children.toArray only flattens fragments
133
- // nested inside an already-flattened children list, not a Fragment passed
134
- // as the whole value, so the Fragment's own children are unwrapped first.
131
+ // `actions` from render-edit.tsx arrives as a Fragment whose children are Fragments again
132
+ // (one per action group); Children.toArray keeps nested Fragments as single elements, so they
133
+ // are unwrapped recursively or the footer would see one opaque node and fold it into "…".
135
134
  function flattenActionNodes(node) {
136
- if (isValidElement(node) && node.type === Fragment) {
137
- return Children.toArray(node.props.children);
138
- }
139
- return Children.toArray(node);
135
+ return Children.toArray(node).flatMap((child) => isValidElement(child) && child.type === Fragment
136
+ ? flattenActionNodes(child.props.children)
137
+ : [child]);
140
138
  }
141
139
  function splitStickyActions(stickyActions, actions, secondaryActions) {
142
140
  // Only split when sticky: the non-sticky (regular, non-wizard) footer must
@@ -15,12 +15,14 @@ import { DefaultLightbox } from "./lightbox.js";
15
15
  import { DefaultMetric, DefaultMetricBand } from "./metric.js";
16
16
  import { DefaultModal } from "./modal.js";
17
17
  import { DefaultPageHeader } from "./page-header.js";
18
+ import { DefaultPhotoGrid } from "./photo-grid.js";
18
19
  import { PromoPanel } from "./promo-panel.js";
19
20
  import { DefaultRecordBreadcrumb } from "./record-breadcrumb.js";
20
21
  import { DefaultRecordSteps } from "./record-steps.js";
21
22
  import { DefaultRecordSummary } from "./record-summary.js";
22
23
  import { CopyButton, ShareButton } from "./share-actions.js";
23
24
  import { DefaultStatusBadge } from "./status-badge.js";
25
+ import { DefaultStepList } from "./step-list.js";
24
26
  import { StickyActionBar } from "./sticky-action-bar.js";
25
27
  import { DefaultTabs } from "./tabs.js";
26
28
  import "../react-css-custom-properties.js";
@@ -72,6 +74,8 @@ export const defaultPrimitives = {
72
74
  Metric: DefaultMetric,
73
75
  MetricBand: DefaultMetricBand,
74
76
  RecordBreadcrumb: DefaultRecordBreadcrumb,
77
+ PhotoGrid: DefaultPhotoGrid,
78
+ StepList: DefaultStepList,
75
79
  RecordSummary: DefaultRecordSummary,
76
80
  RecordSteps: DefaultRecordSteps,
77
81
  PageHeader: DefaultPageHeader,
@@ -3,7 +3,7 @@ import type { FillContainerProps, GridCellProps, GridProps, HeadingProps, LinkPr
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
5
  export declare function DefaultFillContainer({ children, testId, grow, className, }: FillContainerProps): ReactNode;
6
- export declare function DefaultGrid({ columns, children, testId, maxRows, flow, list, ariaLabelledBy, }: GridProps): ReactNode;
6
+ export declare function DefaultGrid({ columns, children, testId, maxRows, flow, list, ariaLabelledBy, tight, }: 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;
9
9
  export declare function isPlainPrimaryClick(event: MouseEvent): boolean;