@cosmicdrift/kumiko-renderer 0.414.0 → 0.415.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/dist/app/entity-list-screen.js +12 -9
  2. package/dist/app/list-facets.d.ts +1 -0
  3. package/dist/app/list-facets.js +10 -1
  4. package/dist/app/named-filter-facet.d.ts +0 -1
  5. package/dist/app/named-filter-facet.js +19 -10
  6. package/dist/app/projection-detail-guidance-data.js +3 -1
  7. package/dist/app/projection-detail-guidance.js +9 -9
  8. package/dist/app/projection-detail-header.js +4 -3
  9. package/dist/app/projection-detail-navigation.d.ts +2 -0
  10. package/dist/app/projection-detail-navigation.js +13 -3
  11. package/dist/app/screen-access.js +1 -2
  12. package/dist/app/use-entity-list-payload.d.ts +2 -1
  13. package/dist/app/use-entity-list-payload.js +4 -2
  14. package/dist/app/use-projection-detail-actions.d.ts +1 -0
  15. package/dist/app/use-projection-detail-actions.js +26 -14
  16. package/dist/app/use-row-decoration.d.ts +6 -4
  17. package/dist/app/use-row-decoration.js +67 -19
  18. package/dist/app/use-screen-list-rows.js +1 -1
  19. package/dist/card-options.d.ts +25 -0
  20. package/dist/card-options.js +1 -0
  21. package/dist/components/list-empty-state.d.ts +5 -0
  22. package/dist/components/list-empty-state.js +17 -1
  23. package/dist/components/render-list-hint-columns.d.ts +1 -0
  24. package/dist/components/render-list-hint-columns.js +10 -0
  25. package/dist/components/render-list-toolbar-model.d.ts +2 -2
  26. package/dist/components/use-render-list-columns.js +3 -3
  27. package/dist/context/screen-focus-context.d.ts +1 -1
  28. package/dist/context/screen-focus-context.js +3 -3
  29. package/dist/data-table-facet-types.d.ts +4 -0
  30. package/dist/headless/index.d.ts +1 -1
  31. package/dist/headless/index.js +1 -1
  32. package/dist/headless/pwa-service-worker-meta.d.ts +3 -0
  33. package/dist/headless/pwa-service-worker-meta.js +10 -0
  34. package/dist/headless/view-model/types.d.ts +4 -0
  35. package/dist/i18n-defaults.js +2 -1
  36. package/dist/metric-types.d.ts +2 -0
  37. package/dist/primitives-record-guidance.d.ts +2 -0
  38. package/dist/primitives.d.ts +7 -24
  39. package/dist/web/app/dashboard-header.js +1 -1
  40. package/dist/web/app/dashboard-list-panel.js +8 -13
  41. package/dist/web/app/dashboard-panels.d.ts +1 -0
  42. package/dist/web/app/dashboard-panels.js +9 -7
  43. package/dist/web/app/dashboard-reference-list-table.js +1 -0
  44. package/dist/web/app/dashboard-shared.js +2 -1
  45. package/dist/web/app/dashboard-stat-group-panel.d.ts +1 -0
  46. package/dist/web/app/dashboard-stat-group-panel.js +14 -7
  47. package/dist/web/app/dashboard-text-panel.js +8 -4
  48. package/dist/web/drawn-icons.d.ts +6 -0
  49. package/dist/web/drawn-icons.js +30 -0
  50. package/dist/web/icons.js +6 -5
  51. package/dist/web/index.d.ts +2 -0
  52. package/dist/web/index.js +2 -0
  53. package/dist/web/layout/default-app-shell.js +3 -3
  54. package/dist/web/layout/nav-collapse-state.d.ts +2 -0
  55. package/dist/web/layout/nav-collapse-state.js +10 -0
  56. package/dist/web/layout/nav-tree.js +46 -23
  57. package/dist/web/layout/notification-bell.d.ts +7 -2
  58. package/dist/web/layout/notification-bell.js +16 -5
  59. package/dist/web/layout/shell-focus.d.ts +2 -2
  60. package/dist/web/layout/shell-focus.js +7 -3
  61. package/dist/web/layout/shell-header.d.ts +2 -1
  62. package/dist/web/layout/shell-header.js +56 -27
  63. package/dist/web/layout/shell-style.d.ts +3 -0
  64. package/dist/web/layout/shell-style.js +6 -0
  65. package/dist/web/layout/workspace-shell.d.ts +11 -1
  66. package/dist/web/layout/workspace-shell.js +6 -4
  67. package/dist/web/primitives/banner.d.ts +1 -1
  68. package/dist/web/primitives/banner.js +12 -7
  69. package/dist/web/primitives/card.js +18 -8
  70. package/dist/web/primitives/data-table/actions-column.d.ts +1 -1
  71. package/dist/web/primitives/data-table/actions-column.js +3 -1
  72. package/dist/web/primitives/data-table/card-body.d.ts +1 -1
  73. package/dist/web/primitives/data-table/card-body.js +11 -6
  74. package/dist/web/primitives/data-table/card-row.js +21 -17
  75. package/dist/web/primitives/data-table/hint-cell.d.ts +1 -3
  76. package/dist/web/primitives/data-table/hint-cell.js +4 -10
  77. package/dist/web/primitives/data-table/row-render-parts.d.ts +1 -1
  78. package/dist/web/primitives/data-table/row-render-parts.js +3 -2
  79. package/dist/web/primitives/data-table/sort-options-select.js +3 -3
  80. package/dist/web/primitives/data-table/table-content.js +4 -4
  81. package/dist/web/primitives/data-table/table-view.js +8 -3
  82. package/dist/web/primitives/data-table/toolbar.d.ts +2 -0
  83. package/dist/web/primitives/data-table/toolbar.js +44 -9
  84. package/dist/web/primitives/data-table/totals-footer.js +4 -3
  85. package/dist/web/primitives/data-table-cell.js +44 -18
  86. package/dist/web/primitives/facet-filter.d.ts +1 -1
  87. package/dist/web/primitives/facet-filter.js +16 -8
  88. package/dist/web/primitives/facet-search-filter.d.ts +2 -1
  89. package/dist/web/primitives/facet-search-filter.js +3 -2
  90. package/dist/web/primitives/facet-trigger-label.d.ts +8 -0
  91. package/dist/web/primitives/facet-trigger-label.js +9 -0
  92. package/dist/web/primitives/file-view-action.js +4 -1
  93. package/dist/web/primitives/layout-elements.js +1 -1
  94. package/dist/web/primitives/metric.js +17 -5
  95. package/dist/web/primitives/page-header.js +3 -2
  96. package/dist/web/primitives/pager.d.ts +3 -2
  97. package/dist/web/primitives/pager.js +16 -20
  98. package/dist/web/primitives/record-breadcrumb.js +1 -1
  99. package/dist/web/primitives/record-steps.js +9 -4
  100. package/dist/web/primitives/record-summary.js +1 -1
  101. package/dist/web/primitives/segmented-select.js +6 -3
  102. package/dist/web/primitives/tabs.js +6 -1
  103. package/dist/web/pwa/pwa-support.js +19 -1
  104. package/dist/web/ui/sidebar.d.ts +2 -1
  105. package/dist/web/ui/sidebar.js +4 -3
  106. package/dist/web/widgets/ai-text-field.js +3 -2
  107. package/dist/web/widgets/dashboard-list-cards.js +6 -14
  108. package/dist/web/widgets/dashboard-list.d.ts +8 -0
  109. package/dist/web/widgets/dashboard-list.js +34 -8
  110. package/dist/web/widgets/drawer-panel-class.d.ts +1 -0
  111. package/dist/web/widgets/drawer-panel-class.js +9 -1
  112. package/dist/web/widgets/drawer.js +2 -2
  113. package/dist/web/widgets/pdf-viewer-toolbar.js +3 -2
  114. package/dist/web/widgets/sheet-parts.js +3 -1
  115. package/dist/web/widgets/stat-box-cell.js +1 -1
  116. package/dist/web/widgets/stat.d.ts +7 -1
  117. package/dist/web/widgets/stat.js +12 -4
  118. package/dist/web/widgets/step-list-row.d.ts +4 -0
  119. package/dist/web/widgets/step-list-row.js +22 -14
  120. package/dist/web/widgets/step-list.d.ts +12 -4
  121. package/dist/web/widgets/step-list.js +38 -20
  122. package/package.json +5 -5
  123. package/src/changes.json +72 -0
  124. package/src/web/styles.css +6 -0
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { ChevronDown } from "lucide-react";
3
3
  import { useOptionalTranslation } from "../../../index.js";
4
4
  import { cn } from "../../lib/cn.js";
@@ -24,7 +24,7 @@ export function sortSummaryText(m) {
24
24
  const total = m.pager?.total ?? m.rows.length;
25
25
  const noun = m.itemNoun?.(total) ?? "";
26
26
  const direction = active.dir === "asc" ? "↑" : "↓";
27
- const count = total.toLocaleString();
27
+ const count = total.toLocaleString(m.tableLocale);
28
28
  return (m.tableTranslate?.("kumiko.list.sort.summary", {
29
29
  sort: active.label,
30
30
  direction,
@@ -38,7 +38,7 @@ export function SortOptionsSelect({ options, sort, onSortChange, testId, classNa
38
38
  const translate = useOptionalTranslation();
39
39
  const active = activeSortOption(options, sort);
40
40
  const prefix = translate?.("kumiko.list.sort.prefix") ?? "Sorted by";
41
- return (_jsxs("div", { className: cn("relative flex h-9 items-center gap-1.5 rounded-md text-[13px] text-foreground-secondary focus-within:ring-1 focus-within:ring-ring", bordered && "rounded-md border border-border-strong bg-background px-2.5 text-foreground", className), children: [_jsx("span", { "aria-hidden": "true", "data-testid": `${testId}-label`, children: summary ?? (active !== undefined ? `${prefix}: ${active.label}` : prefix) }), chevron && _jsx(ChevronDown, { className: "size-3.5", "aria-hidden": "true" }), _jsxs("select", { "aria-label": prefix, "data-testid": testId, value: active !== undefined ? sortOptionValue(active) : "", onChange: (e) => {
41
+ return (_jsxs("div", { className: cn("relative flex h-9 items-center gap-1.5 rounded-md text-[13px] text-foreground-secondary focus-within:ring-1 focus-within:ring-ring", summary !== undefined && !bordered && "h-6 text-xs text-muted-foreground", bordered && "rounded-md border border-border-strong bg-background px-2.5 text-foreground", className), children: [_jsx("span", { "aria-hidden": "true", "data-testid": `${testId}-label`, className: summary === undefined && active !== undefined ? "inline-flex gap-1.5" : undefined, children: summary !== undefined || active === undefined ? ((summary ?? prefix)) : (_jsxs(_Fragment, { children: [_jsx("span", { className: "text-muted-foreground", children: `${prefix}: ` }), _jsx("span", { "data-testid": `${testId}-value`, children: active.label })] })) }), chevron && _jsx(ChevronDown, { className: "size-3.5", "aria-hidden": "true" }), _jsxs("select", { "aria-label": prefix, "data-testid": testId, value: active !== undefined ? sortOptionValue(active) : "", onChange: (e) => {
42
42
  const picked = options.find((option) => sortOptionValue(option) === e.target.value);
43
43
  if (picked !== undefined)
44
44
  onSortChange({ field: picked.field, dir: picked.dir });
@@ -1,7 +1,7 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { cn } from "../../lib/cn.js";
3
3
  import { InfiniteSentinel, Pager } from "../pager.js";
4
- import { CARD_SURFACE_CLASS, isInsideCardFrame } from "./card-frame.js";
4
+ import { CARD_SURFACE_CLASS, hasSeparateCardRows, isInsideCardFrame } from "./card-frame.js";
5
5
  import { renderCardsView } from "./card-view.js";
6
6
  import { renderEmptyBlock } from "./row-render-parts.js";
7
7
  import { DataTableFooter } from "./table-footer.js";
@@ -11,10 +11,10 @@ import { renderTableView } from "./table-view.js";
11
11
  // Except total === 0: then there is nothing to paginate. Incompatible with
12
12
  // infinite scroll: the caller sets either pager OR onReachEnd.
13
13
  function renderPager(m) {
14
- const { pager, serverGroups, itemNoun, testId } = m;
14
+ const { pager, serverGroups, testId } = m;
15
15
  if (pager === undefined || !(pager.total > 0) || serverGroups !== undefined)
16
16
  return undefined;
17
- 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 }), ...(itemNoun !== undefined && { itemNoun }), testId: testId !== undefined ? `${testId}-pager` : "render-list-pager", pinned: m.fillsHeight || isInsideCardFrame(m) }));
17
+ 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
18
  }
19
19
  function renderSentinel(m, pagerElement) {
20
20
  const { onReachEnd, serverGroups, testId } = m;
@@ -25,7 +25,7 @@ function renderSentinel(m, pagerElement) {
25
25
  }
26
26
  function renderTableBodyContent(m) {
27
27
  if (m.isEmpty)
28
- return renderEmptyBlock(m);
28
+ return isInsideCardFrame(m) ? renderTableView(m) : renderEmptyBlock(m);
29
29
  return m.isNarrow ? renderCardsView(m) : renderTableView(m);
30
30
  }
31
31
  export function renderTableContent(m) {
@@ -1,8 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { cn } from "../../lib/cn.js";
3
- import { Table, TableFooter } from "../../ui/table.js";
3
+ import { Table, TableBody, TableCell, TableFooter, TableRow } from "../../ui/table.js";
4
4
  import { isInsideCardFrame } from "./card-frame.js";
5
5
  import { ColumnWidthGroup } from "./column-resize-handle.js";
6
+ import { renderEmptyBlock } from "./row-render-parts.js";
6
7
  import { renderTableBody } from "./table-body.js";
7
8
  import { FILL_TABLE_CLASS, FlushTable } from "./table-chrome.js";
8
9
  import { renderTableHeader } from "./table-header-row.js";
@@ -30,10 +31,14 @@ function renderTableFooter(m) {
30
31
  const totals = renderTotalsRow(m);
31
32
  if (summary === null && totals === null)
32
33
  return null;
33
- return (_jsxs(TableFooter, { children: [summary, totals] }));
34
+ return (_jsxs(TableFooter, { className: "bg-muted text-[12.5px]", children: [summary, totals] }));
35
+ }
36
+ // A framed list that is empty keeps its header row; the empty state fills one spanning row below it.
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) }) }) }));
34
39
  }
35
40
  export function renderTableView(m) {
36
41
  const { fillsHeight, chromeless, sizing, testId } = m;
37
42
  const TableRoot = fillsHeight ? FlushTable : Table;
38
- return (_jsx("div", { className: cn(!fillsHeight && "overflow-hidden", !fillsHeight && chromeless !== true && !isInsideCardFrame(m) && "rounded-lg border bg-card"), children: _jsxs(TableRoot, { "data-testid": testId, className: fillsHeight ? FILL_TABLE_CLASS : undefined, ...(sizing?.tableStyle !== undefined && { style: sizing.tableStyle }), children: [renderColumnWidths(m), renderTableHeader(m), renderTableBody(m), renderTableFooter(m)] }) }));
43
+ return (_jsx("div", { className: cn(!fillsHeight && "overflow-hidden", !fillsHeight && chromeless !== true && !isInsideCardFrame(m) && "rounded-lg border bg-card"), children: _jsxs(TableRoot, { "data-testid": testId, className: fillsHeight ? FILL_TABLE_CLASS : undefined, ...(sizing?.tableStyle !== undefined && { style: sizing.tableStyle }), children: [renderColumnWidths(m), renderTableHeader(m), m.isEmpty ? renderEmptyBody(m) : renderTableBody(m), m.isEmpty ? null : renderTableFooter(m)] }) }));
39
44
  }
@@ -1,5 +1,7 @@
1
1
  import type { ReactNode } from "react";
2
2
  import type { DataTableModel } from "./use-data-table-state.ts";
3
+ /** Facets that open behind the filter icon on a phone; the rest stays in the inline cluster. */
4
+ export declare function buildBehindFilterCluster(m: DataTableModel): ReactNode;
3
5
  export declare function buildModelFacetCluster(m: DataTableModel): ReactNode;
4
6
  export declare function hasToolbarContent(m: DataTableModel, facetCluster: ReactNode): boolean;
5
7
  export declare function toolbarMergesDescription(m: DataTableModel, facetCluster: ReactNode): boolean;
@@ -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, }) {
@@ -272,7 +272,7 @@ export function cellLinkProp(col, row, allowed) {
272
272
  // opaque sticky actions cell. Rows draw it as an inset shadow on the first cell (a border on a
273
273
  // <tr> collapses away), cards as a real border. The colour also lands in --row-stripe because a
274
274
  // 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)]";
275
+ const ROW_STRIPE_SHADOW_CLASS = "[&>td:first-child]:shadow-[inset_4px_0_0_var(--row-stripe)]";
276
276
  const ROW_TONE_STRIPE_CLASS = {
277
277
  bad: `${ROW_STRIPE_SHADOW_CLASS} [&>td:first-child]:[--row-stripe:var(--color-status-bad)]`,
278
278
  warn: `${ROW_STRIPE_SHADOW_CLASS} [&>td:first-child]:[--row-stripe:var(--color-status-warn)]`,
@@ -281,13 +281,15 @@ const ROW_TONE_STRIPE_CLASS = {
281
281
  accent: `${ROW_STRIPE_SHADOW_CLASS} [&>td:first-child]:[--row-stripe:var(--color-primary)]`,
282
282
  neutral: "",
283
283
  };
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-['']";
284
286
  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: "",
287
+ bad: `${CARD_STRIPE_BASE} before:bg-status-bad`,
288
+ warn: `${CARD_STRIPE_BASE} before:bg-status-warn`,
289
+ ok: `${CARD_STRIPE_BASE} before:bg-status-ok`,
290
+ critical: `${CARD_STRIPE_BASE} before:bg-status-critical`,
291
+ accent: `${CARD_STRIPE_BASE} before:bg-primary`,
292
+ neutral: `${CARD_STRIPE_BASE} before:bg-border-strong`,
291
293
  };
292
294
  export function rowToneClass(tone) {
293
295
  return tone === undefined ? "" : ROW_TONE_STRIPE_CLASS[tone];
@@ -331,8 +333,24 @@ export function CellTextLink({ link, children, className = "text-primary underli
331
333
  link.onPress();
332
334
  }, children: children }));
333
335
  }
336
+ function isFunctionRenderer(renderer) {
337
+ return typeof renderer === "function";
338
+ }
339
+ function isFormatSpecRenderer(renderer) {
340
+ return typeof renderer === "object" && renderer !== null && "format" in renderer;
341
+ }
342
+ // Same text the cell shows without `display`: a reference-lookup renderer or FormatSpec must win over the raw value.
343
+ function plainCellText({ value, row, type, renderer, optionLabels, locale, field, grouping, translate, }) {
344
+ if (isFunctionRenderer(renderer)) {
345
+ return renderer(value, row);
346
+ }
347
+ if (isFormatSpecRenderer(renderer)) {
348
+ return applyFormatSpec({ ...renderer, locale: renderer.locale ?? locale }, value, translate);
349
+ }
350
+ return defaultCellRender(value, type, optionLabels, locale, field, grouping);
351
+ }
334
352
  // 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, }) {
353
+ function renderDisplayCell({ display, value, textOf, row, badgeToneField, badgeDot, emptyPlaceholder, link, }) {
336
354
  // A column renderer skips the generic empty-cell path, so a pill or button would otherwise wrap nothing.
337
355
  if ((display === "badge" || display === "button") && isEmptyCellValue(value)) {
338
356
  return _jsx(EmptyCell, { placeholder: emptyPlaceholder });
@@ -340,10 +358,10 @@ function renderDisplayCell({ display, value, text, row, badgeToneField, badgeDot
340
358
  if (display === "badge") {
341
359
  const toneKey = badgeToneField === undefined ? undefined : row[badgeToneField];
342
360
  const tone = (typeof toneKey === "string" ? LIST_BADGE_TONE[toneKey] : undefined) ?? "muted";
343
- return (_jsx(StatusBadge, { tone: tone, dot: badgeDot !== false, children: text }));
361
+ return (_jsx(StatusBadge, { tone: tone, dot: badgeDot !== false, children: textOf() }));
344
362
  }
345
363
  if (display === "button" && link !== undefined) {
346
- return (_jsx(CellTextLink, { link: link, className: LINK_BUTTON_CLASS, children: text }));
364
+ return (_jsx(CellTextLink, { link: link, className: LINK_BUTTON_CLASS, children: textOf() }));
347
365
  }
348
366
  return undefined;
349
367
  }
@@ -378,7 +396,17 @@ export function DataTableCell({ value, row, field, type, renderer, optionLabels,
378
396
  const displayCell = renderDisplayCell({
379
397
  display,
380
398
  value,
381
- text: defaultCellRender(value, type, optionLabels, locale, field, grouping),
399
+ textOf: () => plainCellText({
400
+ value,
401
+ row,
402
+ type,
403
+ renderer,
404
+ optionLabels,
405
+ locale,
406
+ field,
407
+ grouping,
408
+ translate,
409
+ }),
382
410
  row,
383
411
  badgeToneField,
384
412
  badgeDot,
@@ -397,22 +425,20 @@ export function DataTableCell({ value, row, field, type, renderer, optionLabels,
397
425
  if (fileDisplay !== undefined) {
398
426
  return renderFileCell({ value, fileDisplay, compactFile, translate });
399
427
  }
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);
428
+ if (isFormatSpecRenderer(renderer)) {
429
+ const text = applyFormatSpec({ ...renderer, locale: renderer.locale ?? locale }, value, translate);
430
+ const tones = enumOptionTones(renderer);
404
431
  if (tones !== undefined && typeof value === "string") {
405
432
  return selectPill(value, { [value]: text }, tones, locale, RegisteredStatusBadge);
406
433
  }
407
434
  return link === undefined ? text : _jsx(CellTextLink, { link: link, children: text });
408
435
  }
409
- if (typeof renderer === "function") {
436
+ if (isFunctionRenderer(renderer)) {
410
437
  if (linkItems !== undefined) {
411
438
  const linkItemKeys = uniqueLinkItemKeys(linkItems);
412
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]))) }));
413
440
  }
414
- const fn = renderer;
415
- const text = fn(value, row);
441
+ const text = renderer(value, row);
416
442
  return link === undefined ? text : _jsx(CellTextLink, { link: link, children: text });
417
443
  }
418
444
  if (componentRef !== undefined) {
@@ -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
  }
@@ -193,5 +193,5 @@ export function DefaultHeading({ variant = "page", children, testId }) {
193
193
  if (variant === "group") {
194
194
  return (_jsx("h2", { "data-testid": testId, className: "text-base font-semibold text-foreground", children: children }));
195
195
  }
196
- return (_jsx("h1", { "data-testid": testId, className: "text-2xl font-semibold tracking-tight", children: children }));
196
+ return (_jsx("h1", { "data-testid": testId, className: "text-xl font-semibold tracking-tight sm:text-2xl", children: children }));
197
197
  }
@@ -3,8 +3,9 @@ import { Children, createContext, useContext } from "react";
3
3
  import { Icon } from "../icons.js";
4
4
  import { cn } from "../lib/cn.js";
5
5
  import { StatCard } from "../widgets/stat.js";
6
+ import { useIsBelowSmViewport } from "./use-narrow-viewport.js";
6
7
  // Two tiles per row on phones, then the dashboard stat-group fill.
7
- const METRIC_TILE_GRID_CLASSES = "grid grid-cols-2 gap-3 md:grid-cols-[repeat(auto-fit,minmax(min(12rem,100%),1fr))]";
8
+ const METRIC_TILE_GRID_CLASSES = "grid grid-cols-2 gap-2 sm:gap-3 md:grid-cols-[repeat(auto-fit,minmax(min(12rem,100%),1fr))]";
8
9
  const InsideMetricBandContext = createContext(false);
9
10
  // The screen-form column already insets and spaces its children; a band in its
10
11
  // header region must not add its own padding on top. DefaultCard resets this
@@ -14,18 +15,29 @@ export const InsideScreenFormColumnContext = createContext(false);
14
15
  export function DefaultMetricBand({ lead, subtitle, children, testId, tiles, }) {
15
16
  const insideScreenFormColumn = useContext(InsideScreenFormColumnContext);
16
17
  const hasMetrics = Children.toArray(children).length > 0;
17
- return (_jsxs("div", { className: cn("flex shrink-0 flex-col gap-3", !insideScreenFormColumn && "px-6 pb-4 pt-3.5"), "data-testid": testId, children: [lead !== undefined && _jsx("div", { "data-kumiko-layout": "metric-band-lead", children: lead }), subtitle !== undefined && (_jsx("div", { className: "flex flex-wrap items-center gap-x-2 text-[13px] text-foreground-secondary [&_a]:text-primary", children: subtitle })), hasMetrics &&
18
+ return (_jsxs("div", { className: cn("flex shrink-0 flex-col gap-3", !insideScreenFormColumn && "px-6 pb-4 pt-3.5 max-sm:px-4"), "data-testid": testId, children: [lead !== undefined && _jsx("div", { "data-kumiko-layout": "metric-band-lead", children: lead }), subtitle !== undefined && (_jsx("div", { className: "flex flex-wrap items-center gap-x-2 text-[13px] text-foreground-secondary [&_a]:text-primary", children: subtitle })), hasMetrics &&
18
19
  (tiles === true ? (_jsx("div", { className: METRIC_TILE_GRID_CLASSES, children: children })) : (_jsx(InsideMetricBandContext.Provider, { value: true, children: _jsx("dl", { className: "m-0 grid grid-cols-2 gap-6 md:grid-cols-3 lg:grid-cols-5", children: children }) })))] }));
19
20
  }
20
- function MetricTile({ label, value, testId, onPress, tone, icon, sub }) {
21
- const card = (_jsx(StatCard, { label: label, value: value, ...(sub !== undefined && { sub }), ...(onPress !== undefined && { navigable: true }), ...(icon !== undefined && { icon: _jsx(Icon, { name: icon, className: "size-4" }) }), ...(tone !== undefined && { tone }), ...(testId !== undefined && { testId }) }));
21
+ // Below sm the narrow sub line replaces the regular one (board phone metrics are shorter).
22
+ function useMetricSub({ sub, narrowSub }) {
23
+ const narrow = useIsBelowSmViewport();
24
+ return narrow && narrowSub !== undefined ? narrowSub : sub;
25
+ }
26
+ function MetricTile(props) {
27
+ const { label, value, testId, onPress, tone, icon } = props;
28
+ const sub = useMetricSub(props);
29
+ const narrow = useIsBelowSmViewport();
30
+ // The phone's short sub line ("of 2,850") stands beside the value like the board; the full one sits below.
31
+ const subBeside = narrow && props.narrowSub !== undefined;
32
+ const card = (_jsx(StatCard, { label: label, value: value, boardPadding: true, ...(sub !== undefined && { sub, subBelow: !subBeside }), ...(onPress !== undefined && { navigable: true }), ...(icon !== undefined && { icon: _jsx(Icon, { name: icon, className: "size-4" }) }), ...(tone !== undefined && { tone }), ...(testId !== undefined && { testId }) }));
22
33
  return onPress !== undefined ? (_jsx("button", { type: "button", className: "text-left", onClick: onPress, children: card })) : (card);
23
34
  }
24
35
  export function DefaultMetric(props) {
25
36
  const insideBand = useContext(InsideMetricBandContext);
37
+ const sub = useMetricSub(props);
26
38
  if (props.tile === true)
27
39
  return _jsx(MetricTile, { ...props });
28
- const { label, value, testId, onPress, sub } = props;
40
+ const { label, value, testId, onPress } = props;
29
41
  const item = (_jsxs("div", { "data-testid": testId, className: cn("flex min-w-0 flex-col gap-0.5", onPress !== undefined && "cursor-pointer"), ...(onPress !== undefined && { onClick: onPress }), children: [_jsx("dt", { className: "text-xs text-muted-foreground", "data-testid": testId !== undefined ? `${testId}-label` : undefined, children: label }), _jsxs("dd", { className: "m-0 text-base font-medium tabular-nums text-foreground", "data-testid": testId !== undefined ? `${testId}-value` : undefined, children: [onPress !== undefined ? (_jsx("button", { type: "button", className: "text-left hover:underline", children: value })) : (value), sub !== undefined && (_jsx("span", { className: "block text-xs font-normal text-muted-foreground", "data-testid": testId !== undefined ? `${testId}-sub` : undefined, children: sub }))] })] }));
30
42
  return insideBand ? item : _jsx("dl", { className: "m-0", children: item });
31
43
  }
@@ -1,5 +1,5 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect } from "react";
2
+ import { useEffect, useLayoutEffect } from "react";
3
3
  import { createPortal } from "react-dom";
4
4
  import { usePageHeaderSlot } from "../layout/page-header-slot.js";
5
5
  import { UNIFORM_BAR_CONTROLS_CLASSES } from "../layout/uniform-bar-controls.js";
@@ -24,7 +24,8 @@ export function DefaultPageHeader({ title, recordTitle, status, actions, bodyTit
24
24
  setBreadcrumbScreenId(breadcrumbScreenId);
25
25
  return () => setBreadcrumbScreenId(undefined);
26
26
  }, [setBreadcrumbScreenId, breadcrumbScreenId]);
27
- useEffect(() => {
27
+ // Layout effect: a passive one lets the shell paint its own h1 next to the body's for a frame.
28
+ useLayoutEffect(() => {
28
29
  if (setBodyTitle === undefined || bodyTitle !== true)
29
30
  return;
30
31
  setBodyTitle(true);
@@ -9,14 +9,15 @@ export declare function InfiniteSentinel({ onReachEnd, loadingMore, hasMore, row
9
9
  readonly rowsCount: number;
10
10
  readonly testId?: string;
11
11
  }): ReactNode;
12
- export declare function Pager({ page, limit, total, onPageChange, pageSizeOptions, onPageSizeChange, itemNoun, testId, pinned, }: {
12
+ export declare function Pager({ page, limit, total, onPageChange, pageSizeOptions, onPageSizeChange, testId, pinned, plain, }: {
13
13
  readonly page: number;
14
14
  readonly limit: number;
15
15
  readonly total: number;
16
16
  readonly onPageChange: (next: number) => void;
17
17
  readonly pageSizeOptions?: readonly number[];
18
18
  readonly onPageSizeChange?: (next: number) => void;
19
- readonly itemNoun?: (count: number) => string;
20
19
  readonly testId?: string;
21
20
  readonly pinned?: boolean;
21
+ /** Phone cards: no bar, border or background; the footer sits on the page like the card list. */
22
+ readonly plain?: boolean;
22
23
  }): ReactNode;