@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,15 +1,10 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { isSelectOptionTone } from "../../status-tone.js";
3
3
  import { cn } from "../lib/cn.js";
4
- import { DIMMED_HINT_SENTENCE_CLASS, HINT_TONE_TEXT_CLASS, isDimmedHintSentence, } from "../primitives/data-table/hint-cell.js";
4
+ import { hintSentenceClass } from "../primitives/data-table/hint-cell.js";
5
5
  import { cardToneClass } from "../primitives/data-table-cell.js";
6
+ import { nonEmptyText } from "../primitives/hint-reason-row.js";
6
7
  import { DashboardListCell, rowToneOf, } from "./dashboard-list.js";
7
- function nonEmptyText(value) {
8
- if (typeof value !== "string")
9
- return undefined;
10
- const trimmed = value.trim();
11
- return trimmed === "" ? undefined : trimmed;
12
- }
13
8
  function hasValue(value) {
14
9
  return value !== undefined && value !== null && value !== "";
15
10
  }
@@ -23,12 +18,7 @@ function CardHeadline({ column, row, titleField, }) {
23
18
  if (sentence === undefined) {
24
19
  return (_jsx("span", { "data-hint-empty": "true", className: "text-sm text-muted-foreground", children: hint.emptyLabel }));
25
20
  }
26
- return (_jsx("span", { className: cn("text-sm", isDimmedHintSentence(tone, hint.plainSentence)
27
- ? DIMMED_HINT_SENTENCE_CLASS
28
- : [
29
- "font-semibold",
30
- hint.plainSentence !== true && tone !== undefined && HINT_TONE_TEXT_CLASS[tone],
31
- ]), children: sentence }));
21
+ return (_jsx("span", { className: cn("text-sm", hintSentenceClass(tone, hint.plainSentence, "font-semibold")), children: sentence }));
32
22
  }
33
23
  function detailOf(hint, row) {
34
24
  if (hint === undefined)
@@ -49,6 +39,8 @@ export function DashboardListCards({ columns, rows, testId, rowToneField, titleF
49
39
  const badges = badgeColumns.filter((column) => hasValue(row[column.field]));
50
40
  const buttons = buttonColumns.filter((column) => hasValue(row[column.field]));
51
41
  const others = otherColumns.filter((column) => hasValue(row[column.field]));
52
- return (_jsxs("li", { "data-testid": "dashboard-list-card", className: cn("flex flex-col gap-1 rounded-lg border border-border bg-card px-3 py-2.5", cardToneClass(rowToneOf(row, rowToneField))), children: [(badges.length > 0 || detail !== undefined) && (_jsxs("div", { className: "flex min-w-0 items-center gap-2 text-xs text-muted-foreground", children: [badges.map((column) => cell(column, row)), detail !== undefined && (_jsx("small", { "data-testid": "dashboard-list-card-detail", className: "min-w-0 truncate text-xs", children: detail }))] })), hintColumn !== undefined && (_jsx(CardHeadline, { column: hintColumn, row: row, titleField: titleField })), (others.length > 0 || buttons.length > 0) && (_jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsx("div", { className: "flex min-w-0 flex-col text-xs text-muted-foreground", children: others.map((column) => (_jsx("span", { className: "truncate", children: cell(column, row) }, column.field))) }), buttons.length > 0 && (_jsx("div", { className: "flex shrink-0 flex-wrap justify-end gap-2 [&_a]:relative [&_a]:h-8 [&_a]:px-2.5 [&_a]:text-xs [&_a]:max-md:min-h-0 [&_a]:before:absolute [&_a]:before:inset-x-0 [&_a]:before:-inset-y-1.5 [&_a]:before:content-['']", children: buttons.map((column) => cell(column, row)) }))] }))] }, typeof row["id"] === "string" ? row["id"] : index));
42
+ return (_jsxs("li", { "data-testid": "dashboard-list-card", className: cn("flex flex-col gap-1 rounded-lg border border-border bg-card px-3 py-2.5", cardToneClass(rowToneField === undefined
43
+ ? undefined
44
+ : (rowToneOf(row, rowToneField) ?? "neutral"))), children: [(badges.length > 0 || detail !== undefined) && (_jsxs("div", { className: "flex min-w-0 items-center gap-2 text-xs text-muted-foreground", children: [badges.map((column) => cell(column, row)), detail !== undefined && (_jsx("small", { "data-testid": "dashboard-list-card-detail", className: "min-w-0 truncate text-xs", children: detail }))] })), hintColumn !== undefined && (_jsx(CardHeadline, { column: hintColumn, row: row, titleField: titleField })), (others.length > 0 || buttons.length > 0) && (_jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsx("div", { className: "flex min-w-0 flex-col text-xs text-muted-foreground", children: others.map((column) => (_jsx("span", { className: "truncate", children: cell(column, row) }, column.field))) }), buttons.length > 0 && (_jsx("div", { className: "flex shrink-0 flex-wrap justify-end gap-2 [&_a]:relative [&_a]:h-8 [&_a]:px-2.5 [&_a]:text-xs [&_a]:max-md:min-h-0 [&_a]:before:absolute [&_a]:before:inset-x-0 [&_a]:before:-inset-y-1.5 [&_a]:before:content-['']", children: buttons.map((column) => cell(column, row)) }))] }))] }, typeof row["id"] === "string" ? row["id"] : index));
53
45
  }) }));
54
46
  }
@@ -6,8 +6,12 @@ export type DashboardListColumn = {
6
6
  /** Translated by the caller. */
7
7
  readonly label: string;
8
8
  readonly display?: "bar" | "badge" | "datetime" | "button";
9
+ /** `display: "button"` only: filled primary instead of outline. */
10
+ readonly buttonVariant?: "primary";
9
11
  readonly badgeToneField?: string;
10
12
  readonly badgeDot?: false;
13
+ /** `false` leaves an empty cell blank instead of drawing the placeholder. */
14
+ readonly emptyPlaceholder?: false;
11
15
  /** Resolves the raw cell value to display text, e.g. a reference id to its label. */
12
16
  readonly renderValue?: (value: unknown, row: Readonly<Record<string, unknown>>) => string;
13
17
  /** Links the rendered text to its target, e.g. a reference cell to the record's detail. */
@@ -19,6 +23,12 @@ export type DashboardListColumn = {
19
23
  };
20
24
  export type DashboardListRow = Readonly<Record<string, unknown>>;
21
25
  type Row = DashboardListRow;
26
+ /** Plain-text form of a cell value, for places that cannot render the cell itself (phone line). */
27
+ export declare function dashboardListCellText(column: Pick<DashboardListColumn, "display" | "renderValue">, row: Row, field: string, formats: {
28
+ readonly formatPercent: (fraction: number) => string;
29
+ readonly formatNumber: (value: number) => string;
30
+ readonly formatDateTime: (atMs: number) => string;
31
+ }, translate: (key: string) => string): string | undefined;
22
32
  export declare function DashboardListCell({ column, row, formatPercent, formatNumber, formatDateTime, translate, leading, }: {
23
33
  /** Only a `hint` column takes it: it stands on the sentence's line, in front of it. */
24
34
  readonly leading?: ReactNode;
@@ -4,7 +4,7 @@ import { EMPTY_VALUE_PLACEHOLDER, } from "../../headless/index.js";
4
4
  import { isSelectOptionTone } from "../../status-tone.js";
5
5
  import { cn } from "../lib/cn.js";
6
6
  import { HintCell } from "../primitives/data-table/hint-cell.js";
7
- import { CellTextLink, LINK_BUTTON_CLASS, LIST_BADGE_TONE, rowToneClass, toneDotClass, } from "../primitives/data-table-cell.js";
7
+ import { CellTextLink, LINK_BUTTON_CLASS, LINK_BUTTON_PRIMARY_CLASS, LIST_BADGE_TONE, rowToneClass, toneDotClass, } from "../primitives/data-table-cell.js";
8
8
  import { HintReasonRowScope, hintReasonOf } from "../primitives/hint-reason-row.js";
9
9
  import { StatusBadge } from "./status-badge.js";
10
10
  function fractionOf(raw) {
@@ -12,8 +12,34 @@ function fractionOf(raw) {
12
12
  }
13
13
  // Rows may carry i18n keys (quota labels, failure reasons); translate falls back to the key itself.
14
14
  const I18N_KEY_SHAPE = /^[a-z][\w-]*(?:[:.][\w-]+)+$/i;
15
+ function timestampMsOf(raw) {
16
+ return typeof raw === "number" ? raw : typeof raw === "string" ? Date.parse(raw) : Number.NaN;
17
+ }
18
+ /** Plain-text form of a cell value, for places that cannot render the cell itself (phone line). */
19
+ export function dashboardListCellText(column, row, field, formats, translate) {
20
+ const raw = row[field];
21
+ if (column.display === "bar")
22
+ return formats.formatPercent(fractionOf(raw));
23
+ if (column.display === "datetime") {
24
+ const atMs = timestampMsOf(raw);
25
+ return Number.isFinite(atMs) ? formats.formatDateTime(atMs) : undefined;
26
+ }
27
+ if (raw === undefined || raw === null || raw === "")
28
+ return undefined;
29
+ if (column.renderValue === undefined && typeof raw === "number")
30
+ return formats.formatNumber(raw);
31
+ const text = column.renderValue !== undefined
32
+ ? column.renderValue(raw, row)
33
+ : typeof raw === "string"
34
+ ? raw
35
+ : undefined;
36
+ if (text === undefined)
37
+ return undefined;
38
+ return I18N_KEY_SHAPE.test(text) ? translate(text) : text;
39
+ }
15
40
  export function DashboardListCell({ column, row, formatPercent, formatNumber, formatDateTime, translate, leading, }) {
16
41
  const raw = row[column.field];
42
+ const empty = column.emptyPlaceholder === false ? "" : EMPTY_VALUE_PLACEHOLDER;
17
43
  if (column.hint !== undefined) {
18
44
  return _jsx(HintCell, { value: raw, row: row, hint: column.hint, leading: leading });
19
45
  }
@@ -23,24 +49,24 @@ export function DashboardListCell({ column, row, formatPercent, formatNumber, fo
23
49
  }
24
50
  if (column.display === "badge") {
25
51
  if (raw === undefined || raw === null || raw === "")
26
- return EMPTY_VALUE_PLACEHOLDER;
52
+ return empty;
27
53
  const toneKey = column.badgeToneField !== undefined ? row[column.badgeToneField] : undefined;
28
54
  const tone = (typeof toneKey === "string" ? LIST_BADGE_TONE[toneKey] : undefined) ?? "muted";
29
55
  return (_jsx(StatusBadge, { tone: tone, dot: column.badgeDot !== false, children: String(raw) }));
30
56
  }
31
57
  if (column.display === "datetime") {
32
- const atMs = typeof raw === "number" ? raw : typeof raw === "string" ? Date.parse(raw) : Number.NaN;
58
+ const atMs = timestampMsOf(raw);
33
59
  if (!Number.isFinite(atMs))
34
- return EMPTY_VALUE_PLACEHOLDER;
35
- return _jsx("span", { className: "tabular-nums", children: formatDateTime(atMs) });
60
+ return empty;
61
+ return _jsx("span", { className: "font-mono text-[12.5px] tabular-nums", children: formatDateTime(atMs) });
36
62
  }
37
63
  if (column.display === "button") {
38
64
  const link = column.linkFor?.(raw, row);
39
65
  if (raw === undefined || raw === null || raw === "")
40
- return EMPTY_VALUE_PLACEHOLDER;
66
+ return empty;
41
67
  const text = column.renderValue?.(raw, row) ?? String(raw);
42
68
  const label = I18N_KEY_SHAPE.test(text) ? translate(text) : text;
43
- return link === undefined ? (label) : (_jsx(CellTextLink, { link: link, className: LINK_BUTTON_CLASS, children: label }));
69
+ return link === undefined ? (label) : (_jsx(CellTextLink, { link: link, className: column.buttonVariant === "primary" ? LINK_BUTTON_PRIMARY_CLASS : LINK_BUTTON_CLASS, children: label }));
44
70
  }
45
71
  if (column.renderValue !== undefined) {
46
72
  const text = column.renderValue(raw, row);
@@ -53,7 +79,7 @@ export function DashboardListCell({ column, row, formatPercent, formatNumber, fo
53
79
  return link === undefined ? number : _jsx(CellTextLink, { link: link, children: number });
54
80
  }
55
81
  if (raw === undefined || raw === null || raw === "")
56
- return EMPTY_VALUE_PLACEHOLDER;
82
+ return empty;
57
83
  const text = String(raw);
58
84
  const shown = I18N_KEY_SHAPE.test(text) ? translate(text) : text;
59
85
  return link === undefined ? shown : _jsx(CellTextLink, { link: link, children: shown });
@@ -94,7 +120,7 @@ export function DashboardListTable({ columns: allColumns, rows, formatPercent, f
94
120
  const hintColumn = columns.find((column) => column.hint !== undefined);
95
121
  const padded = rowToneField !== undefined || leadingBadgeColumns.length > 0;
96
122
  const cellProps = { formatPercent, formatNumber, formatDateTime, translate };
97
- return (_jsx("div", { className: "overflow-x-auto", children: _jsxs("table", { "data-testid": testId, className: "w-full text-sm", children: [showHeader && (_jsx("thead", { children: _jsxs("tr", { className: "h-9 border-b border-border-row text-left text-xs text-muted-foreground", children: [columns.map((column) => (_jsx("th", { scope: "col", className: "px-4 font-medium", children: column.label }, column.field))), rowLink !== undefined && _jsx("th", { scope: "col", className: "w-8" })] }) })), _jsx("tbody", { children: rows.map((row, index) => {
123
+ return (_jsx("div", { className: "overflow-x-auto", children: _jsxs("table", { "data-testid": testId, className: "w-full text-sm", children: [showHeader && (_jsx("thead", { children: _jsxs("tr", { className: "h-9 border-b border-border-row text-left text-xs text-muted-foreground", children: [columns.map((column) => (_jsx("th", { scope: "col", className: cn("px-4 font-medium", column.display === "button" && "text-right"), children: column.label }, column.field))), rowLink !== undefined && _jsx("th", { scope: "col", className: "w-8" })] }) })), _jsx("tbody", { children: rows.map((row, index) => {
98
124
  const rowTarget = rowLink?.linkFor(row);
99
125
  const tone = rowToneOf(row, rowToneField);
100
126
  const dot = rowToneMarker === "dot" && tone !== undefined ? _jsx(ToneDot, { tone: tone }) : null;
@@ -114,7 +140,7 @@ export function DashboardListTable({ columns: allColumns, rows, formatPercent, f
114
140
  "max-sm:grid max-sm:h-auto max-sm:grid-cols-1 max-sm:gap-1 max-sm:py-2", rowToneMarker === "bar" && rowToneClass(tone)), children: [columns.map((column, columnIndex) => {
115
141
  const leading = leadingFor(column, columnIndex);
116
142
  const cell = (_jsx(DashboardListCell, { column: column, row: row, ...cellProps, ...(column.hint !== undefined && { leading }) }));
117
- return (_jsx("td", { className: cn("px-4", !showHeader && "max-sm:block"), children: column.hint === undefined && dot !== null && columnIndex === 0 ? (_jsxs("span", { className: "flex items-center gap-2", children: [dot, cell] })) : (cell) }, column.field));
143
+ return (_jsx("td", { className: cn("px-4", column.display === "button" && "text-right", !showHeader && "max-sm:block"), children: column.hint === undefined && dot !== null && columnIndex === 0 ? (_jsxs("span", { className: "flex items-center gap-2", children: [dot, cell] })) : (cell) }, column.field));
118
144
  }), rowLink !== undefined && (_jsx("td", { className: "w-8 px-2 text-right", children: _jsx(RowLinkIcon, { link: rowTarget, icon: rowLink.icon, label: translate("kumiko.dashboard.list.open-row") }) }))] }, rowKey));
119
145
  const reasonHint = columns.find((column) => column.hint !== undefined && hintReasonOf(column.hint, row) !== undefined)?.hint;
120
146
  return (_jsx(HintReasonRowScope, { hint: reasonHint, row: row, renderBoxRow: (box) => (_jsx("tr", { "data-reason-row": "true", className: "border-b border-border-row last:border-b-0", children: _jsx("td", { colSpan: columns.length + (rowLink !== undefined ? 1 : 0), className: "px-4 pb-3", children: box }) })), children: rowElement }, rowKey));
@@ -1,3 +1,4 @@
1
1
  export type DrawerSide = "left" | "right" | "top" | "bottom";
2
2
  export declare const MAX_VIEWPORT_WIDTH = "85vw";
3
+ export declare function isNarrowFullscreen(side: DrawerSide, narrow: boolean): boolean;
3
4
  export declare function sidePanelClass(side: DrawerSide, narrow: boolean, variant: "floating" | "flush", belowHeader: boolean): string;
@@ -4,6 +4,10 @@
4
4
  // Same cap as WIDTH_CLASS: an explicit `width` must not outgrow the viewport.
5
5
  export const MAX_VIEWPORT_WIDTH = "85vw";
6
6
  const WIDTH_CLASS = "w-[max(600px,37.5vw)] max-w-[85vw] sm:max-w-[max(600px,37.5vw)]";
7
+ // A bottom sheet stays docked on a phone: it holds a short choice and the page stays visible behind it.
8
+ export function isNarrowFullscreen(side, narrow) {
9
+ return narrow && side !== "bottom";
10
+ }
7
11
  // "floating": 32px margin + 32px radius so the panel reads as detached from
8
12
  // the viewport edge, unlike the sheet primitive's flush-edge default.
9
13
  // "flush" docks it back to that flush-edge default instead, borrowing the
@@ -12,8 +16,12 @@ const WIDTH_CLASS = "w-[max(600px,37.5vw)] max-w-[85vw] sm:max-w-[max(600px,37.5
12
16
  // decides, not a `sm:` Tailwind prefix, since the resize width below already
13
17
  // comes from JS and two decision sources is the bug this avoids.
14
18
  export function sidePanelClass(side, narrow, variant, belowHeader) {
15
- if (narrow)
19
+ if (isNarrowFullscreen(side, narrow)) {
16
20
  return "inset-0 h-full w-full max-w-none rounded-none border-0 overflow-hidden";
21
+ }
22
+ if (narrow) {
23
+ return "inset-x-0 bottom-0 h-auto max-h-[90vh] w-full max-w-none rounded-t-[2rem] border-t overflow-hidden";
24
+ }
17
25
  if (variant === "flush") {
18
26
  switch (side) {
19
27
  // h-full would pin height to 100vh despite the shifted top; h-auto lets inset-y-0 size it.
@@ -4,7 +4,7 @@ import { useTranslation } from "../../index.js";
4
4
  import { cn } from "../lib/cn.js";
5
5
  import { useIsNarrowViewport } from "../primitives/use-narrow-viewport.js";
6
6
  import { Sheet, SheetDescription, SheetFooter, SheetHeader, SheetTitle } from "../ui/sheet.js";
7
- import { sidePanelClass } from "./drawer-panel-class.js";
7
+ import { isNarrowFullscreen, sidePanelClass } from "./drawer-panel-class.js";
8
8
  import { renderMaximizeButton, renderResizeHandle } from "./drawer-resize-controls.js";
9
9
  import { buildOverlayStyle, buildSheetStyle } from "./drawer-sizing.js";
10
10
  import { DrawerSheetContent } from "./sheet-parts.js";
@@ -74,5 +74,5 @@ export function Drawer({ open, onOpenChange, side = "right", title, description,
74
74
  // Radix already drops the overlay and the focus trap for a
75
75
  // non-modal Root; only the dismiss-on-outside-interaction is left
76
76
  // to suppress, so a click into the page behind keeps the panel open.
77
- onInteractOutside: modal ? undefined : (event) => event.preventDefault(), showCloseButton: showCloseButton, closeLabel: t("kumiko.dialog.close"), className: cn(sidePanelClass(side, narrow, variant, belowHeader), fillBody && "gap-0", !narrow && panelClassName), style: sheetStyle, children: [canResize && !narrow && renderMaximizeButton(resizeControls), (title !== undefined || description !== undefined) && (_jsxs(SheetHeader, { children: [title !== undefined && _jsx(SheetTitle, { children: title }), description !== undefined && _jsx(SheetDescription, { children: description })] })), _jsx("div", { className: fillBody ? "flex min-h-0 flex-1 flex-col" : "flex-1 overflow-y-auto px-4", children: children }), footer !== undefined && (_jsx(SheetFooter, { className: DRAWER_FOOTER_CLASS, children: footer })), canResize && !narrow && renderResizeHandle(resizeControls)] }) }));
77
+ onInteractOutside: modal ? undefined : (event) => event.preventDefault(), showCloseButton: showCloseButton, closeLabel: t("kumiko.dialog.close"), className: cn(sidePanelClass(side, narrow, variant, belowHeader), fillBody && "gap-0", !isNarrowFullscreen(side, narrow) && panelClassName), style: sheetStyle, children: [canResize && !narrow && renderMaximizeButton(resizeControls), (title !== undefined || description !== undefined) && (_jsxs(SheetHeader, { children: [title !== undefined && _jsx(SheetTitle, { children: title }), description !== undefined && _jsx(SheetDescription, { children: description })] })), _jsx("div", { className: fillBody ? "flex min-h-0 flex-1 flex-col" : "flex-1 overflow-y-auto px-4", children: children }), footer !== undefined && (_jsx(SheetFooter, { className: DRAWER_FOOTER_CLASS, children: footer })), canResize && !narrow && renderResizeHandle(resizeControls)] }) }));
78
78
  }
@@ -1,7 +1,8 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { ChevronDown, ChevronUp, Search } from "lucide-react";
2
+ import { ChevronDown, ChevronUp } from "lucide-react";
3
3
  import { useEffect, useState } from "react";
4
4
  import { usePrimitives, useTranslation } from "../../index.js";
5
+ import { DrawnSearch } from "../drawn-icons.js";
5
6
  const INPUT_CLASS = "h-[26px] rounded border border-input bg-transparent px-1.5 text-center text-sm text-foreground";
6
7
  // Bordered like the page input beside them, so the toolbar reads as controls of the document.
7
8
  const TOOL_BUTTON_CLASS = "size-7";
@@ -31,5 +32,5 @@ function SearchControls({ search, onTermChange, onStepMatch, }) {
31
32
  export function PdfViewerToolbar(props) {
32
33
  const t = useTranslation();
33
34
  const { Button } = usePrimitives();
34
- return (_jsxs("div", { "data-testid": "pdf-toolbar", className: "flex h-10 shrink-0 items-center gap-2 border-b border-border bg-card px-2.5 text-[13px]", children: [_jsx(PageNumberInput, { currentPage: props.currentPage, onGoToPage: props.onGoToPage }), _jsx("span", { className: "text-muted-foreground", children: t("kumiko.widget.pdf-preview.pageCount", { pages: props.pageCount }) }), _jsx("span", { className: "grow" }), props.search.open && props.hideSearch !== true && (_jsx(SearchControls, { search: props.search, onTermChange: props.onTermChange, onStepMatch: props.onStepMatch })), _jsx(Button, { size: "icon", variant: "secondary", className: TOOL_BUTTON_CLASS, ariaLabel: t("kumiko.widget.pdf-preview.zoomOut"), onClick: props.onZoomOut, children: "\u2212" }), _jsxs("span", { className: "min-w-11 whitespace-nowrap text-center text-muted-foreground", "data-testid": "pdf-zoom", children: [Math.round(props.zoom * 100), " %"] }), _jsx(Button, { size: "icon", variant: "secondary", className: TOOL_BUTTON_CLASS, ariaLabel: t("kumiko.widget.pdf-preview.zoomIn"), onClick: props.onZoomIn, children: "+" }), props.hideSearch !== true && (_jsx(Button, { size: "icon", variant: "secondary", className: TOOL_BUTTON_CLASS, pressed: props.search.open, ariaLabel: t("kumiko.widget.pdf-preview.search"), onClick: props.onToggleSearch, children: _jsx(Search, { "aria-hidden": "true", className: "size-3.5" }) }))] }));
35
+ return (_jsxs("div", { "data-testid": "pdf-toolbar", className: "flex h-10 shrink-0 items-center gap-2 border-b border-border bg-card px-2.5 text-[13px]", children: [_jsx(PageNumberInput, { currentPage: props.currentPage, onGoToPage: props.onGoToPage }), _jsx("span", { className: "text-muted-foreground", children: t("kumiko.widget.pdf-preview.pageCount", { pages: props.pageCount }) }), _jsx("span", { className: "grow" }), props.search.open && props.hideSearch !== true && (_jsx(SearchControls, { search: props.search, onTermChange: props.onTermChange, onStepMatch: props.onStepMatch })), _jsx(Button, { size: "icon", variant: "secondary", className: TOOL_BUTTON_CLASS, ariaLabel: t("kumiko.widget.pdf-preview.zoomOut"), onClick: props.onZoomOut, children: "\u2212" }), _jsxs("span", { className: "min-w-11 whitespace-nowrap text-center text-muted-foreground", "data-testid": "pdf-zoom", children: [Math.round(props.zoom * 100), " %"] }), _jsx(Button, { size: "icon", variant: "secondary", className: TOOL_BUTTON_CLASS, ariaLabel: t("kumiko.widget.pdf-preview.zoomIn"), onClick: props.onZoomIn, children: "+" }), props.hideSearch !== true && (_jsx(Button, { size: "icon", variant: "secondary", className: TOOL_BUTTON_CLASS, pressed: props.search.open, ariaLabel: t("kumiko.widget.pdf-preview.search"), onClick: props.onToggleSearch, children: _jsx(DrawnSearch, { "aria-hidden": "true", className: "size-3.5" }) }))] }));
35
36
  }
@@ -3,7 +3,9 @@ import { XIcon } from "lucide-react";
3
3
  import { Dialog as SheetPrimitive } from "radix-ui";
4
4
  import { cn } from "../lib/cn.js";
5
5
  export function DrawerSheetContent({ className, overlayStyle, children, side = "right", showCloseButton = true, closeLabel, ...props }) {
6
- return (_jsxs(SheetPrimitive.Portal, { "data-slot": "sheet-portal", children: [_jsx(SheetPrimitive.Overlay, { "data-slot": "sheet-overlay", style: overlayStyle, className: "fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0" }), _jsxs(SheetPrimitive.Content, { "data-slot": "sheet-content", className: cn("fixed z-50 flex flex-col gap-4 bg-background shadow-lg transition ease-in-out data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:animate-in data-[state=open]:duration-500", side === "right" &&
6
+ return (_jsxs(SheetPrimitive.Portal, { "data-slot": "sheet-portal", children: [_jsx(SheetPrimitive.Overlay, { "data-slot": "sheet-overlay", style: overlayStyle, onClick: (event) => event.stopPropagation(), className: "fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0" }), _jsxs(SheetPrimitive.Content, { "data-slot": "sheet-content",
7
+ // The portal escapes the DOM tree, not the fiber tree: without this a click in the drawer reaches an ancestor's onClick (e.g. the table row it was opened from).
8
+ onClick: (event) => event.stopPropagation(), className: cn("fixed z-50 flex flex-col gap-4 bg-background shadow-lg transition ease-in-out data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:animate-in data-[state=open]:duration-500", side === "right" &&
7
9
  "inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm", side === "left" &&
8
10
  "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm", side === "top" &&
9
11
  "inset-x-0 top-0 h-auto border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top", side === "bottom" &&
@@ -6,5 +6,5 @@ import { Sparkline, StatLinkFrame, TONE_VALUE, } from "./stat.js";
6
6
  * sub line small beside it. Below `sm` plain text "<number> <label>" that joins the strip's single line. */
7
7
  export function StatBoxCell({ label, narrowLabel, value, sub, tone = "default", icon, delta, spark, testId, link, }) {
8
8
  const belowSm = useIsBelowSmViewport();
9
- return (_jsx(StatLinkFrame, { link: link, testId: testId, children: belowSm ? (_jsxs("span", { "data-testid": testId, className: "whitespace-nowrap text-sm", children: [_jsx("span", { className: "tabular-nums text-foreground", children: value }), " ", _jsx("span", { className: "text-foreground", children: narrowLabel ?? label })] })) : (_jsxs("div", { "data-testid": testId, className: "flex min-w-0 items-center gap-3 rounded-md border border-border bg-background px-3 py-2", children: [icon, _jsx("span", { className: cn("text-2xl font-semibold leading-none tabular-nums", TONE_VALUE[tone]), children: value }), _jsxs("div", { className: "flex min-w-0 flex-col", children: [_jsx("span", { className: "truncate text-sm font-semibold text-foreground", children: label }), sub !== undefined && (_jsx("span", { className: "truncate text-xs text-muted-foreground", children: sub }))] }), delta !== undefined && (_jsxs("span", { className: "whitespace-nowrap text-xs font-medium tabular-nums text-muted-foreground", children: [delta.direction === "up" ? "↑" : "↓", delta.value] })), spark !== undefined && (_jsx(Sparkline, { points: spark, className: cn("h-6 w-16 shrink-0", TONE_VALUE[tone]) }))] })) }));
9
+ return (_jsx(StatLinkFrame, { link: link, testId: testId, children: belowSm ? (_jsxs("span", { "data-testid": testId, className: "whitespace-nowrap text-sm", children: [_jsx("span", { className: "tabular-nums text-foreground", children: value }), " ", _jsx("span", { className: "text-foreground", children: narrowLabel ?? label })] })) : (_jsxs("div", { "data-testid": testId, className: "flex min-w-0 items-center gap-3 rounded-lg border border-border bg-background px-3 py-2.5", children: [icon, _jsx("span", { className: cn("text-2xl font-semibold leading-none tabular-nums", TONE_VALUE[tone]), children: value }), _jsxs("div", { className: "flex min-w-0 flex-col", children: [_jsx("span", { className: "truncate text-sm font-semibold text-foreground", children: label }), sub !== undefined && (_jsx("span", { className: "truncate text-xs text-muted-foreground", children: sub }))] }), delta !== undefined && (_jsxs("span", { className: "whitespace-nowrap text-xs font-medium tabular-nums text-muted-foreground", children: [delta.direction === "up" ? "↑" : "↓", delta.value] })), spark !== undefined && (_jsx(Sparkline, { points: spark, className: cn("h-6 w-16 shrink-0", TONE_VALUE[tone]) }))] })) }));
10
10
  }
@@ -24,7 +24,7 @@ export declare function Sparkline({ points, className, }: {
24
24
  }): ReactNode;
25
25
  /** Icon-bearing metric tile with an optional delta chip, trend line,
26
26
  * and sparkline. `icon` is a ready-made node (the app supplies its SVG). */
27
- export declare function StatCard({ icon, label, value, sub, tone, accentColor, delta, trend, spark, testId, link, navigable, children, }: {
27
+ export declare function StatCard({ icon, label, value, sub, tone, accentColor, delta, trend, spark, testId, link, navigable, inset, subBelow, boardPadding, children, }: {
28
28
  readonly icon?: ReactNode;
29
29
  readonly label: string;
30
30
  readonly value: string;
@@ -39,6 +39,12 @@ export declare function StatCard({ icon, label, value, sub, tone, accentColor, d
39
39
  readonly link?: StatLink;
40
40
  /** Draws a small arrow top right: the tile leads somewhere. Implied by `link`. */
41
41
  readonly navigable?: boolean;
42
+ /** Tile inside a panel: page-coloured fill, no shadow, tighter padding (dashboard board look). */
43
+ readonly inset?: boolean;
44
+ /** Puts `sub` on its own line under the value instead of beside it. */
45
+ readonly subBelow?: boolean;
46
+ /** Detail metric tile spacing: 12px/14px padding, 10px/12px and a 17px value below `sm`. */
47
+ readonly boardPadding?: boolean;
42
48
  /** Extra content below the built-in fields (e.g. a usage meter) — kept
43
49
  * inside the same card chrome instead of stacking a second bordered box. */
44
50
  readonly children?: ReactNode;
@@ -9,14 +9,14 @@ const TONE_CHIP = {
9
9
  default: "bg-muted text-foreground",
10
10
  positive: "bg-primary/10 text-primary",
11
11
  ok: "bg-status-ok-surface text-status-ok",
12
- warn: "bg-destructive/10 text-destructive",
12
+ warn: "bg-status-warn-surface text-status-warn",
13
13
  negative: "bg-status-bad-surface text-status-bad",
14
14
  };
15
15
  export const TONE_VALUE = {
16
16
  default: "text-foreground",
17
17
  positive: "text-primary",
18
18
  ok: "text-status-ok",
19
- warn: "text-destructive",
19
+ warn: "text-status-warn",
20
20
  negative: "text-status-bad",
21
21
  };
22
22
  const TONE_STRIPE = {
@@ -59,16 +59,24 @@ function StatIconChip({ icon, tone, accentColor, }) {
59
59
  backgroundColor: `color-mix(in srgb, ${accentColor} 12%, transparent)`,
60
60
  }, children: icon }));
61
61
  }
62
+ function StatDeltaChip({ delta, tone, }) {
63
+ return (_jsxs("span", { className: cn("inline-flex shrink-0 items-center gap-0.5 whitespace-nowrap rounded-full px-1.5 py-0.5 text-xs font-medium tabular-nums", TONE_CHIP[delta.tone ?? tone]), children: [delta.direction === "up" ? "↑" : "↓", delta.value] }));
64
+ }
65
+ function statTileSurface(inset, boardPadding) {
66
+ if (inset)
67
+ return "bg-background px-3 py-2.5 shadow-none";
68
+ return boardPadding ? "px-3.5 py-3 max-sm:px-3 max-sm:py-2.5" : "p-4";
69
+ }
62
70
  /** Icon-bearing metric tile with an optional delta chip, trend line,
63
71
  * and sparkline. `icon` is a ready-made node (the app supplies its SVG). */
64
- export function StatCard({ icon, label, value, sub, tone = "default", accentColor, delta, trend, spark, testId, link, navigable = false, children, }) {
72
+ export function StatCard({ icon, label, value, sub, tone = "default", accentColor, delta, trend, spark, testId, link, navigable = false, inset = false, subBelow = false, boardPadding = false, children, }) {
65
73
  const { Card } = usePrimitives();
66
74
  const leadsSomewhere = navigable || link !== undefined;
67
75
  // StatCard is a reusable small-tile widget (a metrics dashboard grid, not
68
76
  // a whole-section frame) — an extension section mounting several of
69
77
  // these renders a grid of tiles inside its own host Card, not a
70
78
  // duplicate outer frame around the section's full content.
71
- const tile = (_jsxs(Card, { options: { padded: false }, className: cn("relative p-4", TONE_STRIPE[tone]), testId: testId, children: [leadsSomewhere && (_jsx(ArrowUpRight, { className: "absolute right-3 top-3 size-3.5 text-muted-foreground", "aria-hidden": "true", "data-kumiko-layout": "stat-card-arrow" })), _jsxs("div", { className: cn("flex flex-wrap items-start justify-between gap-x-2 gap-y-1", leadsSomewhere && "pr-5"), children: [_jsxs("div", { className: "flex min-w-0 flex-1 basis-[7rem] items-center gap-2 text-muted-foreground", children: [icon !== undefined && _jsx(StatIconChip, { icon: icon, tone: tone, accentColor: accentColor }), _jsx("span", { title: label, className: "min-w-0 line-clamp-2 text-xs font-medium", children: label })] }), delta !== undefined && (_jsxs("span", { className: cn("inline-flex shrink-0 items-center gap-0.5 whitespace-nowrap rounded-full px-1.5 py-0.5 text-xs font-medium tabular-nums", TONE_CHIP[delta.tone ?? tone]), children: [delta.direction === "up" ? "↑" : "↓", delta.value] }))] }), _jsxs("div", { className: "mt-1.5 flex flex-wrap items-baseline gap-x-2", children: [_jsx("span", { className: cn("text-xl font-semibold tabular-nums", TONE_VALUE[tone]), children: value }), sub !== undefined && _jsx("span", { className: "text-xs text-muted-foreground", children: sub })] }), trend !== undefined && (_jsx("div", { className: "mt-0.5 text-xs font-medium text-foreground/80", children: trend })), spark !== undefined && (_jsx(Sparkline, { points: spark, className: cn("mt-2 h-7 w-full", TONE_VALUE[tone]) })), children !== undefined && _jsx("div", { className: "mt-3", children: children })] }));
79
+ const tile = (_jsxs(Card, { options: { padded: false }, className: cn("relative", statTileSurface(inset, boardPadding), TONE_STRIPE[tone]), testId: testId, children: [leadsSomewhere && (_jsx(ArrowUpRight, { className: "absolute right-3 top-3 size-3.5 text-muted-foreground", "aria-hidden": "true", "data-kumiko-layout": "stat-card-arrow" })), _jsxs("div", { className: cn("flex flex-wrap items-start justify-between gap-x-2 gap-y-1", leadsSomewhere && "pr-5"), children: [_jsxs("div", { className: "flex min-w-0 flex-1 basis-[7rem] items-center gap-2 text-muted-foreground", children: [icon !== undefined && _jsx(StatIconChip, { icon: icon, tone: tone, accentColor: accentColor }), _jsx("span", { title: label, className: "min-w-0 line-clamp-2 text-xs font-medium", children: label })] }), delta !== undefined && _jsx(StatDeltaChip, { delta: delta, tone: tone })] }), _jsxs("div", { className: "mt-1.5 flex flex-wrap items-baseline gap-x-2", children: [_jsx("span", { className: cn("text-xl font-semibold tabular-nums", boardPadding && "max-sm:text-[17px]", TONE_VALUE[tone]), children: value }), sub !== undefined && !subBelow && (_jsx("span", { className: "text-xs text-muted-foreground", children: sub }))] }), sub !== undefined && subBelow && (_jsx("div", { "data-kumiko-layout": "stat-card-sub", className: "mt-0.5 text-xs text-muted-foreground", children: sub })), trend !== undefined && (_jsx("div", { className: "mt-0.5 text-xs font-medium text-foreground/80", children: trend })), spark !== undefined && (_jsx(Sparkline, { points: spark, className: cn("mt-2 h-7 w-full", TONE_VALUE[tone]) })), children !== undefined && _jsx("div", { className: "mt-3", children: children })] }));
72
80
  return (_jsx(StatLinkFrame, { link: link, testId: testId, children: tile }));
73
81
  }
74
82
  /** Flat KPI cell for a strip (divider instead of card): label, value with
@@ -14,6 +14,8 @@ export type StepTag = {
14
14
  readonly tone?: "accent" | "muted" | "warn" | "ok" | "bad";
15
15
  /** A note about the step's history (e.g. just changed) reads after what it waits for. */
16
16
  readonly afterWaiting?: boolean;
17
+ /** Sits in the right column of the row, above a trailing link (e.g. a risk chip over "Preview"). */
18
+ readonly side?: true;
17
19
  };
18
20
  export type StepListItem = {
19
21
  readonly id: string;
@@ -52,6 +54,8 @@ export declare function StepActionButton({ action, className, }: {
52
54
  }): ReactNode;
53
55
  export type StepRowSelection = {
54
56
  readonly state: StepSelectionState;
57
+ /** The checkbox replaces the status icon of a selectable row. */
58
+ readonly compact?: true;
55
59
  readonly onToggle: () => void;
56
60
  };
57
61
  export declare function StepRow({ step, phoneCard, selection, }: {
@@ -48,12 +48,12 @@ function StatusIcon({ step }) {
48
48
  function tagTone(tone) {
49
49
  return tone ?? "muted";
50
50
  }
51
- function StepLink({ link }) {
51
+ function StepLink({ link, compact = false, }) {
52
52
  const { Link, Button } = usePrimitives();
53
53
  if (link.href !== undefined) {
54
- return (_jsx(Link, { href: link.href, onPress: link.onClick, className: "shrink-0 text-[13px] font-medium underline underline-offset-2", children: link.label }));
54
+ return (_jsx(Link, { href: link.href, onPress: link.onClick, className: cn("shrink-0 text-[13px] font-medium underline underline-offset-2", compact && "font-normal text-primary no-underline"), children: link.label }));
55
55
  }
56
- return (_jsx(Button, { variant: "link", size: "sm", onClick: link.onClick, className: "shrink-0 text-[13px]", children: link.label }));
56
+ return (_jsx(Button, { variant: "link", size: "sm", onClick: link.onClick, className: cn("shrink-0 text-[13px]", compact && "h-auto p-0 font-normal"), children: link.label }));
57
57
  }
58
58
  function StepBelowLink({ link }) {
59
59
  const { Button } = usePrimitives();
@@ -64,8 +64,9 @@ export function StepActionButton({ action, className, }) {
64
64
  return (_jsx(Button, { size: "sm", variant: action.variant ?? "secondary", disabled: action.disabled, loading: action.pending, onClick: action.onClick, testId: `step-action-${action.id}`, className: cn("max-md:text-[14px]", className), children: action.label }));
65
65
  }
66
66
  // A long reason ("Wartet auf: Whg. 3, Stellplatz 7, …") is cut at the column edge instead of running out of it.
67
- function StepTagBadge({ tone, label, className, }) {
68
- return (_jsx("span", { className: "flex min-w-0 max-w-full", title: label, children: _jsx(StatusBadge, { tone: tone, className: cn("min-w-0 max-w-full", className), children: _jsx("span", { className: "truncate", children: label }) }) }));
67
+ function StepTagBadge({ tone, label, className, chip, }) {
68
+ return (_jsx("span", { className: "flex min-w-0 max-w-full", title: label, children: _jsx(StatusBadge, { tone: tone, dot: chip !== true, className: cn("min-w-0 max-w-full", chip === true &&
69
+ "h-auto rounded px-1.5 py-0.5 text-[11px] max-md:h-auto max-md:text-[11px]", className), children: _jsx("span", { className: "truncate", children: label }) }) }));
69
70
  }
70
71
  // Sources and tags share one line: a source link and the step it waits for read as one fact.
71
72
  // The phone card reads the waiting reason as a plain second line, not as a pill.
@@ -118,22 +119,29 @@ function StepSelectionCell({ step, selection, }) {
118
119
  : state.kind === "blocked"
119
120
  ? t("kumiko.widget.step-list.prerequisiteNotSelectable", { title: state.blockedBy })
120
121
  : undefined;
121
- return (_jsxs("span", { className: "flex h-5 w-4 shrink-0 items-center", children: [_jsx(Checkbox, { "aria-label": t("kumiko.widget.step-list.selectStep", { title: step.title }), checked: state.kind === "selectable" && state.checked, disabled: state.kind !== "selectable", onCheckedChange: selection.onToggle, "data-testid": `step-${step.id}-select`, ...(reason !== undefined && { title: reason, "aria-describedby": reasonId }) }), reason !== undefined && (_jsx("span", { id: reasonId, className: "sr-only", children: reason }))] }));
122
+ return (_jsxs("span", { className: cn("flex h-5 w-4 shrink-0 items-center", selection.compact === true && "mt-px h-[18px] w-[18px]"), children: [_jsx(Checkbox, { className: cn(selection.compact === true &&
123
+ "size-[18px] border-[1.5px] border-border-strong data-[state=checked]:border-primary [&_svg]:size-3"), "aria-label": t("kumiko.widget.step-list.selectStep", { title: step.title }), checked: state.kind === "selectable" && state.checked, disabled: state.kind !== "selectable", onCheckedChange: selection.onToggle, "data-testid": `step-${step.id}-select`, ...(reason !== undefined && { title: reason, "aria-describedby": reasonId }) }), reason !== undefined && (_jsx("span", { id: reasonId, className: "sr-only", children: reason }))] }));
122
124
  }
123
125
  function isAutoSelected(selection) {
124
126
  return selection?.state.kind === "selectable" && selection.state.neededFor !== undefined;
125
127
  }
126
- function stepRowClassName(step, autoSelected) {
127
- return cn("flex gap-2.5 border-b border-border-row px-4 py-3", autoSelected &&
128
+ function stepRowClassName(step, autoSelected, compact) {
129
+ return cn("flex gap-2.5 border-b border-border-row px-4 py-3", compact && "px-3 py-[9px] text-[13px]", autoSelected &&
128
130
  "relative before:absolute before:inset-y-0 before:left-0 before:w-[3px] before:bg-primary/60", step.status === "open" && "bg-card", step.highlighted === true && "bg-status-warn-surface");
129
131
  }
130
- function StepRowText({ step, shownStep, phoneCard, }) {
131
- return (_jsxs("div", { className: "flex min-w-0 grow flex-col gap-1", children: [_jsx("span", { className: cn("font-medium", step.status === "rejected" && "text-muted-foreground line-through"), "data-testid": `step-${step.id}-title`, children: step.title }), step.description !== undefined && (_jsx("span", { className: "text-[13px] text-foreground-secondary", children: step.description })), _jsx(StepSourcesAndTags, { step: shownStep, phoneCard: phoneCard }), step.meta !== undefined && (_jsx("span", { className: "text-[13px] text-muted-foreground", children: step.meta })), step.link?.placement === "below" && _jsx(StepBelowLink, { link: step.link }), _jsx(StepActions, { step: step })] }));
132
+ function StepRowText({ step, shownStep, phoneCard, compact, }) {
133
+ return (_jsxs("div", { className: "flex min-w-0 grow flex-col gap-1", children: [_jsx("span", { className: cn("font-medium", step.status === "rejected" && "text-muted-foreground line-through"), "data-testid": `step-${step.id}-title`, children: step.title }), step.description !== undefined && (_jsx("span", { className: cn("text-[13px] text-foreground-secondary", compact && "text-xs text-muted-foreground"), children: step.description })), _jsx(StepSourcesAndTags, { step: shownStep, phoneCard: phoneCard }), step.meta !== undefined && (_jsx("span", { className: "text-[13px] text-muted-foreground", children: step.meta })), step.link?.placement === "below" && _jsx(StepBelowLink, { link: step.link }), _jsx(StepActions, { step: step })] }));
132
134
  }
133
135
  export function StepRow({ step, phoneCard = false, selection, }) {
134
136
  const t = useTranslation();
135
- const shownStep = selection === undefined
136
- ? step
137
- : { ...step, tags: [...(step.tags ?? []), ...selectionTags(selection.state, t)] };
138
- return (_jsxs("li", { "data-testid": `step-${step.id}`, className: stepRowClassName(step, isAutoSelected(selection)), ...(step.highlighted === true && { "aria-current": "step" }), children: [selection !== undefined && _jsx(StepSelectionCell, { step: step, selection: selection }), _jsx(StatusIcon, { step: step }), _jsx(StepRowText, { step: step, shownStep: shownStep, phoneCard: phoneCard }), step.link !== undefined && step.link.placement !== "below" && _jsx(StepLink, { link: step.link })] }));
137
+ const sideTags = (step.tags ?? []).filter((tag) => tag.side === true);
138
+ const bodyTags = (step.tags ?? []).filter((tag) => tag.side !== true);
139
+ const shownStep = {
140
+ ...step,
141
+ tags: selection === undefined ? bodyTags : [...bodyTags, ...selectionTags(selection.state, t)],
142
+ };
143
+ const compact = selection?.compact === true;
144
+ const trailingLink = step.link !== undefined && step.link.placement !== "below" ? (_jsx(StepLink, { link: step.link, compact: compact })) : null;
145
+ const replacesStatusIcon = compact && selection.state.kind === "selectable";
146
+ return (_jsxs("li", { "data-testid": `step-${step.id}`, className: stepRowClassName(step, isAutoSelected(selection), compact), ...(step.highlighted === true && { "aria-current": "step" }), children: [selection !== undefined && _jsx(StepSelectionCell, { step: step, selection: selection }), !replacesStatusIcon && _jsx(StatusIcon, { step: step }), _jsx(StepRowText, { step: step, shownStep: shownStep, phoneCard: phoneCard, compact: compact }), sideTags.length > 0 ? (_jsxs("div", { className: "flex shrink-0 flex-col items-end gap-1", "data-testid": `step-${step.id}-side`, children: [sideTags.map((tag) => (_jsx(StepTagBadge, { tone: tagTone(tag.tone), label: tag.label, chip: true }, tag.label))), trailingLink] })) : (trailingLink)] }));
139
147
  }
@@ -4,8 +4,12 @@ import { type StepAction, type StepListItem } from "./step-list-row.tsx";
4
4
  export type { StepAction, StepListItem, StepSelectability, StepSource, StepStatus, StepTag, } from "./step-list-row.tsx";
5
5
  export type StepSelectionAction = {
6
6
  readonly id: string;
7
- /** Without a number: the list appends " (n)" with the effective selection size. */
7
+ /** Without a number: the list appends " (n)" with the effective selection size (see `labelForCount`). */
8
8
  readonly label: string;
9
+ /** Replaces the appended " (n)": the label for the effective selection size. The action is disabled at 0. */
10
+ readonly labelForCount?: (count: number) => string;
11
+ /** No counter, never disabled by an empty selection (e.g. "Review one by one"); `onClick` still gets the selection. */
12
+ readonly ignoresSelection?: true;
9
13
  /** Receives the effective selection in list order, prerequisites included. */
10
14
  readonly onClick: (stepIds: readonly string[]) => void;
11
15
  readonly variant?: "primary" | "secondary" | "ghost";
@@ -18,6 +22,8 @@ export type StepListSelection = {
18
22
  readonly onSelectionChange: (selectedIds: readonly string[]) => void;
19
23
  /** Replace `footerActions` while at least one step is selected. */
20
24
  readonly actions: readonly StepSelectionAction[];
25
+ /** Phone-card style: no select-all row, the actions stay visible at 0 selected (disabled unless `ignoresSelection`), a muted header and left-aligned footer. */
26
+ readonly compact?: true;
21
27
  };
22
28
  export type StepListProps = {
23
29
  readonly title: string;
@@ -31,6 +37,8 @@ export type StepListProps = {
31
37
  readonly steps: readonly StepListItem[];
32
38
  /** Footer row: a ghost action for the whole list next to the primary next-step action. */
33
39
  readonly footerActions?: readonly StepAction[];
40
+ /** Quiet line under the footer actions, e.g. "Nothing is saved without you." */
41
+ readonly footerNote?: string;
34
42
  /** Show only the first n steps plus "und k weitere Schritte" (expands on click). */
35
43
  readonly collapsedAfter?: number;
36
44
  /** "always" (default) folds after `collapsedAfter`; "overflow" folds a `fill` list only when its steps do not fit its height, then shows as many as fit but at least `collapsedAfter`. */
@@ -39,8 +47,8 @@ export type StepListProps = {
39
47
  readonly surface?: "ai" | "plain";
40
48
  /** Stretch to the container height: steps scroll in the middle, the footer stays pinned at the bottom. */
41
49
  readonly fill?: boolean;
42
- /** "full" (default) = "x von y erledigt" plus bar, "count" = only the count, "none" = neither, e.g. when `status` already says the list is done. */
43
- readonly progress?: "full" | "count" | "none";
50
+ /** "full" (default) = "x von y erledigt" plus bar, "count" = only the count, "total" = only "n steps" (rejected ones left out), "none" = neither, e.g. when `status` already says the list is done. */
51
+ readonly progress?: "full" | "count" | "total" | "none";
44
52
  readonly emptyContent?: ReactNode;
45
53
  /** Adds a checkbox per selectable step, a select-all row and selection footer actions. */
46
54
  readonly selection?: StepListSelection;
@@ -49,4 +57,4 @@ export type StepListProps = {
49
57
  readonly testId?: string;
50
58
  };
51
59
  /** Ordered plan of steps with status icons, progress header and per-step actions. */
52
- export declare function StepList({ title, subtitle, status, steps, footerActions, collapsedAfter, collapseWhen, surface, fill, progress, emptyContent, selection, phoneCard, testId, }: StepListProps): ReactNode;
60
+ export declare function StepList({ title, subtitle, status, steps, footerActions, footerNote, collapsedAfter, collapseWhen, surface, fill, progress, emptyContent, selection, phoneCard, testId, }: StepListProps): ReactNode;