@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,10 +1,10 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { ChevronDown, ChevronLeft, ChevronRight, Loader2 } from "lucide-react";
2
+ import { ChevronLeft, ChevronRight, Loader2 } from "lucide-react";
3
3
  import { useEffect, useRef } from "react";
4
- import { useTranslation } from "../../index.js";
4
+ import { useOptionalLocale, useTranslation } from "../../index.js";
5
5
  import { cn } from "../lib/cn.js";
6
6
  import "../react-css-custom-properties.js";
7
- export const TABLE_FOOTER_BAR_CLASS = cn("flex h-15 shrink-0 items-center gap-4 border-t border-border bg-card pl-4 pr-2", "text-[13px] tabular-nums text-foreground-secondary md:h-11 md:px-6");
7
+ export const TABLE_FOOTER_BAR_CLASS = cn("flex h-15 shrink-0 items-center gap-4 border-t border-border-row bg-card pl-4 pr-2", "text-[12.5px] tabular-nums text-muted-foreground md:h-11 md:px-6");
8
8
  // InfiniteSentinel — empty div at the end of the table that uses
9
9
  // IntersectionObserver to detect when the user scrolls near the list end.
10
10
  // onReachEnd fires exactly once per "becomes visible" transition; the
@@ -60,26 +60,22 @@ export function InfiniteSentinel({ onReachEnd, loadingMore, hasMore, rowsCount,
60
60
  // Status text and aria-labels go through t(...), which requires a
61
61
  // LocaleProvider in the tree — same requirement as InfiniteSentinel above,
62
62
  // already established for DataTable consumers.
63
- export function Pager({ page, limit, total, onPageChange, pageSizeOptions, onPageSizeChange, itemNoun, testId, pinned, }) {
63
+ export function Pager({ page, limit, total, onPageChange, pageSizeOptions, onPageSizeChange, testId, pinned, plain, }) {
64
64
  const t = useTranslation();
65
+ const locale = useOptionalLocale();
65
66
  const totalPages = Math.max(1, Math.ceil(total / limit));
66
67
  const safePage = Math.max(1, Math.min(page, totalPages));
67
68
  const from = (safePage - 1) * limit + 1;
68
69
  const to = Math.min(safePage * limit, total);
69
- return (_jsxs("div", { "data-testid": testId, className: pinned === true
70
- ? TABLE_FOOTER_BAR_CLASS
71
- : "mt-3 flex items-center gap-4 text-[13px] tabular-nums text-foreground-secondary", children: [_jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-1", children: [_jsx("div", { "data-testid": testId !== undefined ? `${testId}-status` : undefined, children: itemNoun !== undefined
72
- ? t("kumiko.pager.status.noun", {
73
- from: from.toLocaleString(),
74
- to: to.toLocaleString(),
75
- total: total.toLocaleString(),
76
- noun: itemNoun(total),
77
- })
78
- : t("kumiko.pager.status", {
79
- from: from.toLocaleString(),
80
- to: to.toLocaleString(),
81
- total: total.toLocaleString(),
82
- }) }), pageSizeOptions !== undefined && onPageSizeChange !== undefined && (_jsxs("div", { className: "relative hidden items-center sm:flex", children: [_jsx("span", { "aria-hidden": "true", children: "\u00B7" }), _jsx("select", { "aria-label": t("kumiko.pager.pageSizeLabel"), "data-testid": testId !== undefined ? `${testId}-page-size` : undefined, value: limit, onChange: (e) => onPageSizeChange(Number(e.target.value)), className: "h-7 cursor-pointer appearance-none rounded-md border-0 bg-transparent pl-1.5 pr-5 text-[13px] text-foreground-secondary hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring", children: pageSizeOptions.map((size) => (_jsx("option", { value: size, children: t("kumiko.pager.pageSize", { size: size.toLocaleString() }) }, size))) }), _jsx(ChevronDown, { className: "pointer-events-none absolute right-0.5 top-1/2 size-3.5 -translate-y-1/2 opacity-50", "aria-hidden": "true" })] }))] }), _jsxs("div", { className: "flex items-center gap-1", children: [_jsx(PagerButton, { ariaLabel: t("kumiko.pager.previousPage"), disabled: safePage <= 1, onClick: () => onPageChange(safePage - 1), testId: testId !== undefined ? `${testId}-prev` : undefined, children: _jsx(ChevronLeft, { className: "size-3.5", "aria-hidden": "true" }) }), _jsx("div", { className: "hidden items-center gap-1 sm:flex", children: pageNumbersAround(safePage, totalPages).map((entry) => typeof entry !== "number" ? (_jsx("span", { "aria-hidden": "true", className: "px-1", children: "\u2026" }, `gap-${entry.gapBefore}`)) : (_jsx(PageNumberButton, { page: entry, current: entry === safePage, label: t("kumiko.pager.goToPage", { page: entry.toLocaleString() }), onClick: () => onPageChange(entry), testId: testId !== undefined ? `${testId}-page-${entry}` : undefined }, entry))) }), _jsx(PagerButton, { ariaLabel: t("kumiko.pager.nextPage"), disabled: safePage >= totalPages, onClick: () => onPageChange(safePage + 1), testId: testId !== undefined ? `${testId}-next` : undefined, children: _jsx(ChevronRight, { className: "size-3.5", "aria-hidden": "true" }) })] })] }));
70
+ return (_jsxs("div", { "data-testid": testId, className: plain === true
71
+ ? "flex items-center justify-between px-4 pb-3 pt-1 text-[12.5px] tabular-nums text-muted-foreground"
72
+ : pinned === true
73
+ ? TABLE_FOOTER_BAR_CLASS
74
+ : "mt-3 flex items-center gap-4 text-[12.5px] tabular-nums text-muted-foreground", children: [_jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-1", children: [_jsx("div", { "data-testid": testId !== undefined ? `${testId}-status` : undefined, children: t("kumiko.pager.status", {
75
+ from: from.toLocaleString(locale),
76
+ to: to.toLocaleString(locale),
77
+ total: total.toLocaleString(locale),
78
+ }) }), pageSizeOptions !== undefined && onPageSizeChange !== undefined && (_jsxs("div", { className: "hidden items-center sm:flex", children: [_jsx("span", { "aria-hidden": "true", children: "\u00B7" }), _jsx("select", { "aria-label": t("kumiko.pager.pageSizeLabel"), "data-testid": testId !== undefined ? `${testId}-page-size` : undefined, value: limit, onChange: (e) => onPageSizeChange(Number(e.target.value)), className: "h-7 cursor-pointer appearance-none rounded-md border-0 bg-transparent px-1.5 text-[12.5px] text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring", children: pageSizeOptions.map((size) => (_jsx("option", { value: size, children: t("kumiko.pager.pageSize", { size: size.toLocaleString(locale) }) }, size))) })] }))] }), _jsxs("div", { className: "flex items-center gap-1", children: [_jsx(PagerButton, { ariaLabel: t("kumiko.pager.previousPage"), disabled: safePage <= 1, onClick: () => onPageChange(safePage - 1), testId: testId !== undefined ? `${testId}-prev` : undefined, children: _jsx(ChevronLeft, { className: "size-3.5", "aria-hidden": "true" }) }), _jsx("div", { className: "hidden items-center gap-1 sm:flex", children: pageNumbersAround(safePage, totalPages).map((entry) => typeof entry !== "number" ? (_jsx("span", { "aria-hidden": "true", className: "px-1", children: "\u2026" }, `gap-${entry.gapBefore}`)) : (_jsx(PageNumberButton, { page: entry, current: entry === safePage, label: t("kumiko.pager.goToPage", { page: entry.toLocaleString() }), onClick: () => onPageChange(entry), testId: testId !== undefined ? `${testId}-page-${entry}` : undefined }, entry))) }), _jsx(PagerButton, { ariaLabel: t("kumiko.pager.nextPage"), disabled: safePage >= totalPages, onClick: () => onPageChange(safePage + 1), testId: testId !== undefined ? `${testId}-next` : undefined, children: _jsx(ChevronRight, { className: "size-3.5", "aria-hidden": "true" }) })] })] }));
83
79
  }
84
80
  // All pages up to 7, else first, last and the neighbours of the current page, gaps in between.
85
81
  function pageNumbersAround(current, totalPages) {
@@ -93,8 +89,8 @@ function pageNumbersAround(current, totalPages) {
93
89
  });
94
90
  }
95
91
  function PageNumberButton({ page, current, label, onClick, testId, }) {
96
- return (_jsx("button", { type: "button", onClick: onClick, "aria-label": label, "aria-current": current ? "page" : undefined, "data-testid": testId, className: cn("inline-flex h-7 min-w-7 items-center justify-center rounded-md px-1.5", "hover:bg-muted focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring", current && "bg-muted font-semibold text-foreground"), children: page.toLocaleString() }));
92
+ return (_jsx("button", { type: "button", onClick: onClick, "aria-label": label, "aria-current": current ? "page" : undefined, "data-testid": testId, className: cn("inline-flex h-6 min-w-6 items-center justify-center rounded px-1.5", "hover:bg-muted focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring", current && "bg-primary text-primary-foreground hover:bg-primary"), children: page.toLocaleString() }));
97
93
  }
98
94
  function PagerButton({ children, onClick, ariaLabel, disabled, testId, }) {
99
- return (_jsx("button", { type: "button", onClick: onClick, disabled: disabled, "aria-label": ariaLabel, "data-testid": testId, className: cn("inline-flex size-11 items-center justify-center rounded-md border border-border sm:size-7", "hover:bg-muted focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring", "disabled:pointer-events-none disabled:text-foreground-disabled"), children: children }));
95
+ return (_jsx("button", { type: "button", onClick: onClick, disabled: disabled, "aria-label": ariaLabel, "data-testid": testId, className: cn("inline-flex size-11 items-center justify-center rounded sm:size-6", "hover:bg-muted focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring", "disabled:pointer-events-none disabled:text-foreground-disabled"), children: children }));
100
96
  }
@@ -7,5 +7,5 @@ import { InsideScreenFormColumnContext } from "./metric.js";
7
7
  export function DefaultRecordBreadcrumb({ items, ariaLabel, testId, }) {
8
8
  const insideScreenFormColumn = useContext(InsideScreenFormColumnContext);
9
9
  const keys = uniqueLabelKeys(items.map((item) => item.label));
10
- return (_jsx("nav", { "aria-label": ariaLabel, "data-testid": testId, className: cn("flex shrink-0 flex-wrap items-center gap-2 text-[13px] text-muted-foreground", !insideScreenFormColumn && "px-6 pt-3.5"), children: items.map((item, index) => (_jsxs(Fragment, { children: [index > 0 && _jsx("span", { "aria-hidden": "true", children: "\u203A" }), item.link !== undefined ? (_jsx(DefaultLink, { href: item.link.href, onPress: item.link.onPress, className: "text-foreground-secondary", children: item.label })) : (_jsx("span", { className: "font-medium text-foreground", children: item.label }))] }, keys[index]))) }));
10
+ return (_jsx("nav", { "aria-label": ariaLabel, "data-testid": testId, className: cn("flex shrink-0 flex-wrap items-center gap-2 text-[13px] text-muted-foreground", !insideScreenFormColumn && "px-6 pt-3.5 max-sm:px-4"), children: items.map((item, index) => (_jsxs(Fragment, { children: [index > 0 && _jsx("span", { "aria-hidden": "true", children: "\u203A" }), item.link !== undefined ? (_jsx(DefaultLink, { href: item.link.href, onPress: item.link.onPress, className: "text-foreground-secondary", children: item.label })) : (_jsx("span", { className: "font-medium text-foreground", children: item.label }))] }, keys[index]))) }));
11
11
  }
@@ -12,6 +12,10 @@ const STEP_STRIPE_CLASS = {
12
12
  accent: "bg-primary",
13
13
  neutral: "bg-border-strong",
14
14
  };
15
+ function StepTitle({ item }) {
16
+ const narrow = useIsBelowSmViewport();
17
+ return narrow ? (item.narrowTitle ?? item.title) : item.title;
18
+ }
15
19
  function StepDetail({ item }) {
16
20
  const narrow = useIsBelowSmViewport();
17
21
  const detail = narrow ? (item.narrowDetail ?? item.detail) : item.detail;
@@ -22,13 +26,14 @@ function StepDetail({ item }) {
22
26
  function StepRow({ item, reasonLabel }) {
23
27
  const [reasonOpen, setReasonOpen] = useState(item.reasonOpen === true);
24
28
  const reasonBoxId = useId();
25
- return (_jsxs("li", { "data-testid": `record-step-${item.id}`, "data-tone": item.tone, className: "relative grid grid-cols-[minmax(0,1fr)_auto] gap-x-3 gap-y-1 py-3 pl-5 pr-4 max-sm:py-1.5 max-sm:pl-3.5 max-sm:pr-0", children: [_jsx("span", { "aria-hidden": "true", className: cn("absolute inset-y-2 left-0 w-1 rounded-full max-sm:inset-y-0 max-sm:w-[3px]", STEP_STRIPE_CLASS[item.tone ?? "neutral"]) }), _jsxs("div", { className: "col-start-1 row-start-1 flex min-w-0 items-start gap-2", children: [_jsx("span", { className: "font-medium text-foreground max-sm:text-sm", children: item.title }), item.reason !== undefined && (_jsx("span", { className: "flex max-sm:hidden", children: _jsx(ReasonInfoButton, { label: reasonLabel, open: reasonOpen, controls: reasonBoxId, onToggle: () => setReasonOpen((open) => !open) }) }))] }), _jsxs("div", { className: "col-start-2 row-start-1 flex shrink-0 items-center gap-3 max-sm:row-span-2 max-sm:self-center max-sm:[&_button]:h-8 max-sm:[&_button]:text-[13px]", children: [item.moreActions !== undefined && _jsx("div", { className: "max-sm:hidden", children: item.moreActions }), item.actions] }), _jsx("div", { className: "col-start-1 row-start-2 min-w-0 sm:col-span-2", children: _jsx(StepDetail, { item: item }) }), item.reason !== undefined && reasonOpen && (_jsx("div", { className: "col-span-2 row-start-3 max-sm:hidden", children: _jsx(ReasonBox, { id: reasonBoxId, testId: `record-step-${item.id}-reason`, ...(item.reasonTitle !== undefined && { title: item.reasonTitle }), children: item.reason }) }))] }));
29
+ const narrow = useIsBelowSmViewport();
30
+ return (_jsxs("li", { "data-testid": `record-step-${item.id}`, "data-tone": item.tone, className: "relative grid grid-cols-[minmax(0,1fr)_auto] gap-x-3 gap-y-1 py-3 pl-5 pr-4 max-sm:py-[9px] max-sm:pl-3.5 max-sm:pr-0", children: [_jsx("span", { "aria-hidden": "true", className: cn("absolute inset-y-2.5 left-0 w-1 rounded-[2px] max-sm:inset-y-[9px]", STEP_STRIPE_CLASS[item.tone ?? "neutral"]) }), _jsxs("div", { className: "col-start-1 row-start-1 flex min-w-0 items-start gap-2", children: [_jsx("span", { className: "font-medium text-foreground max-sm:text-[13.5px]", "data-slot": "step-what", children: _jsx(StepTitle, { item: item }) }), item.reason !== undefined && (_jsx("span", { className: "flex max-sm:hidden", children: _jsx(ReasonInfoButton, { label: reasonLabel, open: reasonOpen, controls: reasonBoxId, onToggle: () => setReasonOpen((open) => !open) }) }))] }), _jsxs("div", { className: "col-start-2 row-start-1 flex shrink-0 items-center gap-3 max-sm:row-span-2 max-sm:self-center max-sm:[&_button]:h-8 max-sm:[&_button]:text-[13px]", children: [item.moreActions !== undefined && !narrow && (_jsx("div", { className: "text-[12.5px] text-muted-foreground [&_a]:text-[12.5px] [&_a]:text-muted-foreground [&_button]:text-[12.5px] [&_button]:text-muted-foreground", children: item.moreActions })), item.actions] }), _jsx("div", { className: "col-start-1 row-start-2 min-w-0 sm:col-span-2", children: _jsx(StepDetail, { item: item }) }), item.moreActions !== undefined && narrow && (_jsx("div", { "data-testid": `record-step-${item.id}-more-actions`, className: "col-span-2 row-start-3 flex flex-wrap items-center gap-3 text-xs text-muted-foreground [&_a]:text-xs [&_a]:text-muted-foreground [&_button]:text-xs [&_button]:text-muted-foreground", children: item.moreActions })), item.reason !== undefined && reasonOpen && (_jsx("div", { className: "col-span-2 row-start-3 max-sm:hidden", children: _jsx(ReasonBox, { id: reasonBoxId, testId: `record-step-${item.id}-reason`, ...(item.reasonTitle !== undefined && { title: item.reasonTitle }), children: item.reason }) }))] }));
26
31
  }
27
32
  function StepsHeader({ title, subtitle, count, testId, }) {
28
- return (_jsxs("header", { className: "flex flex-wrap items-baseline gap-x-3 gap-y-1 px-4 py-3 sm:border-b max-sm:px-0 max-sm:pt-1", children: [_jsx("h3", { className: "m-0 text-sm font-semibold text-foreground", children: title }), subtitle !== undefined && (_jsx("span", { className: "text-[13px] text-muted-foreground max-sm:hidden", children: subtitle })), count !== undefined && (_jsx("span", { "data-testid": `${testId ?? "record-steps"}-count`, className: "ml-auto text-xs text-muted-foreground sm:hidden", children: count }))] }));
33
+ return (_jsxs("header", { className: "flex flex-wrap items-baseline gap-x-3 gap-y-1 px-4 py-3 max-sm:px-0 max-sm:pt-1", children: [_jsx("h3", { className: "m-0 text-sm font-semibold text-foreground", children: title }), subtitle !== undefined && (_jsx("span", { className: "text-[13px] text-muted-foreground max-sm:hidden", children: subtitle })), count !== undefined && (_jsx("span", { "data-testid": `${testId ?? "record-steps"}-count`, className: "ml-auto text-xs text-muted-foreground sm:hidden", children: count }))] }));
29
34
  }
30
35
  function StepsMoreToggle({ testId, expanded, label, onToggle, }) {
31
- return (_jsxs("button", { type: "button", "data-testid": `${testId ?? "record-steps"}-toggle`, "aria-expanded": expanded, className: "relative w-full border-t px-4 py-3 text-left text-sm font-medium text-primary hover:underline max-sm:mt-2.5 max-sm:border-t-0 max-sm:py-1 max-sm:pl-3.5 max-sm:pr-0 max-sm:text-xs max-sm:font-normal max-sm:text-muted-foreground max-sm:no-underline", onClick: onToggle, children: [_jsx("span", { "aria-hidden": "true", className: "absolute inset-y-0 left-0 w-[3px] rounded-full bg-border sm:hidden" }), label] }));
36
+ return (_jsxs("button", { type: "button", "data-testid": `${testId ?? "record-steps"}-toggle`, "aria-expanded": expanded, className: "relative w-full border-t px-4 py-3 text-left text-sm font-medium text-primary hover:underline max-sm:border-border-row max-sm:py-[9px] max-sm:pl-3.5 max-sm:pr-0 max-sm:text-xs max-sm:font-normal", onClick: onToggle, children: [_jsx("span", { "aria-hidden": "true", className: "absolute inset-y-[9px] left-0 w-1 rounded-[2px] bg-border-strong sm:hidden" }), label] }));
32
37
  }
33
38
  export function DefaultRecordSteps({ title, subtitle, emptyLabel, reasonLabel, narrowLimit, moreLabel, lessLabel, items, count, testId, }) {
34
39
  const insideScreenFormColumn = useContext(InsideScreenFormColumnContext);
@@ -41,5 +46,5 @@ export function DefaultRecordSteps({ title, subtitle, emptyLabel, reasonLabel, n
41
46
  : expanded
42
47
  ? lessLabel
43
48
  : moreLabel(items.length - visible.length);
44
- return (_jsx("section", { "data-testid": testId, className: cn("shrink-0", !insideScreenFormColumn && "px-6 py-2"), children: _jsxs("div", { className: "sm:rounded-md sm:border sm:bg-card", children: [_jsx(StepsHeader, { title: title, subtitle: subtitle, count: count, testId: testId }), items.length === 0 ? (_jsx("p", { className: "m-0 px-4 py-3 text-sm text-muted-foreground", children: emptyLabel })) : (_jsx("ul", { className: "m-0 flex list-none flex-col p-0 max-sm:gap-2.5 sm:divide-y", children: visible.map((item) => (_jsx(StepRow, { item: item, reasonLabel: reasonLabel }, item.id))) })), limited && toggleLabel !== undefined && (_jsx(StepsMoreToggle, { testId: testId, expanded: expanded, label: toggleLabel, onToggle: () => setExpanded((open) => !open) }))] }) }));
49
+ return (_jsx("section", { "data-testid": testId, className: cn("shrink-0", !insideScreenFormColumn && "px-6 py-2 max-sm:px-4"), children: _jsxs("div", { className: "sm:rounded-md sm:border sm:bg-card", children: [_jsx(StepsHeader, { title: title, subtitle: subtitle, count: count, testId: testId }), items.length === 0 ? (_jsx("p", { className: "m-0 px-4 py-3 text-sm text-muted-foreground", children: emptyLabel })) : (_jsx("ul", { className: "m-0 flex list-none flex-col divide-y divide-border-row p-0", children: visible.map((item) => (_jsx(StepRow, { item: item, reasonLabel: reasonLabel }, item.id))) })), limited && toggleLabel !== undefined && (_jsx(StepsMoreToggle, { testId: testId, expanded: expanded, label: toggleLabel, onToggle: () => setExpanded((open) => !open) }))] }) }));
45
50
  }
@@ -14,5 +14,5 @@ const SUMMARY_BORDER_CLASS = {
14
14
  export function DefaultRecordSummary({ text, narrowText, tone, testId, }) {
15
15
  const insideScreenFormColumn = useContext(InsideScreenFormColumnContext);
16
16
  const narrow = useIsBelowSmViewport();
17
- return (_jsx("div", { className: cn("shrink-0", !insideScreenFormColumn && "px-6 py-2"), children: _jsx("p", { "data-testid": testId, "data-tone": tone, className: cn("m-0 rounded-md border border-l-[3px] bg-card px-4 py-3 font-heading text-[15.5px] leading-[1.5] sm:text-[17px] sm:leading-relaxed text-foreground", tone === undefined ? "border-l-primary" : SUMMARY_BORDER_CLASS[tone]), children: narrow && narrowText !== undefined ? narrowText : text }) }));
17
+ return (_jsx("div", { className: cn("shrink-0", !insideScreenFormColumn && "px-6 py-2 max-sm:px-4"), children: _jsx("p", { "data-testid": testId, "data-tone": tone, className: cn("m-0 rounded-lg border border-l-[3px] bg-card px-3.5 py-2.5 sm:px-[18px] sm:py-3.5 font-heading text-[15px] leading-[1.5] sm:text-[17px] sm:leading-relaxed text-foreground", tone === undefined ? "border-l-primary" : SUMMARY_BORDER_CLASS[tone]), children: narrow && narrowText !== undefined ? narrowText : text }) }));
18
18
  }
@@ -47,7 +47,7 @@ export function SegmentedControl({ id, name, value, onChange, options, disabled,
47
47
  const badgeTone = declaredTone !== undefined ? statusToneForOptionTone(declaredTone) : undefined;
48
48
  return (_jsx("button", { ref: (node) => {
49
49
  buttonRefs.current[index] = node;
50
- }, type: "button", role: "radio", "aria-checked": checked, tabIndex: index === tabStopIndex ? 0 : -1, disabled: disabled === true || opt.disabled === true, "data-testid": `segmented-${id}-${opt.value}`, onClick: () => onChange(opt.value), onKeyDown: (e) => handleKeyDown(e, index), className: cn(
50
+ }, type: "button", role: "radio", "aria-checked": checked, tabIndex: index === tabStopIndex ? 0 : -1, disabled: disabled === true || opt.disabled === true, "data-testid": `segmented-${id}-${opt.value}`, onClick: () => onChange(opt.value), onKeyDown: (e) => handleKeyDown(e, index), title: opt.label, className: cn(
51
51
  // Per-segment top/left border instead of the container's
52
52
  // `divide-x`: divide-x only draws verticals between siblings
53
53
  // in source order, which misplaces borders the moment a
@@ -63,8 +63,11 @@ export function SegmentedControl({ id, name, value, onChange, options, disabled,
63
63
  // and the next row's top border cut a notch into the row above.
64
64
  // Harmless on a single-row layout: there's no leftover space to
65
65
  // grow into, so `w-fit` on the container still holds.
66
- "-ml-px -mt-px grow basis-0 whitespace-nowrap border-l border-t px-3 py-1.5 text-center text-sm transition-colors", "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring", "disabled:pointer-events-none disabled:opacity-50", hasError === true ? "border-destructive/50" : "border-border", size === "touch" && "min-h-11", checked
66
+ //
67
+ // The ellipsis sits on the inner span: overflow on the segment itself
68
+ // would drop its automatic min-width to 0 and segments would stop wrapping.
69
+ "-ml-px -mt-px max-w-full grow basis-0 whitespace-nowrap border-l border-t px-3 py-1.5 text-center text-sm transition-colors", "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring", "disabled:pointer-events-none disabled:opacity-50", hasError === true ? "border-destructive/50" : "border-border", size === "touch" && "min-h-11", checked
67
70
  ? cn("font-semibold", badgeTone !== undefined ? TONE_PILL[badgeTone] : "bg-primary/10 text-primary")
68
- : "bg-transparent font-medium text-foreground hover:bg-accent"), children: opt.label }, opt.value));
71
+ : "bg-transparent font-medium text-foreground hover:bg-accent"), children: _jsx("span", { className: "block truncate", children: opt.label }) }, opt.value));
69
72
  })] }));
70
73
  }
@@ -10,7 +10,12 @@ const TAB_TRIGGER_CLASS = "h-full shrink-0 flex-none whitespace-nowrap rounded-n
10
10
  // tab's hover and underline span its label plus 10px; "filter" insets the strip so its first label
11
11
  // lines up with a list pane's search field, "plain" sits flush with the content it switches.
12
12
  const STRIP_SPACING = {
13
- pill: { scroller: "px-1.5 @lg:px-6", list: "h-11 gap-2 @lg:gap-6", trigger: "" },
13
+ pill: {
14
+ scroller: "px-1.5 @lg:px-6 max-sm:px-0",
15
+ list: "h-11 gap-2 @lg:gap-6 max-sm:gap-0.5",
16
+ // Phone viewport, not pane width: four counted tabs must still fit a 400px pane on a desktop.
17
+ trigger: "max-sm:px-2.5 max-sm:text-[13px]",
18
+ },
14
19
  plain: { scroller: "px-0", list: "h-10 gap-1", trigger: "px-2.5 font-normal" },
15
20
  filter: { scroller: "px-1.5", list: "h-10 gap-0", trigger: "px-2.5 font-normal" },
16
21
  };
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useEffect, useState } from "react";
3
- import { PWA_SERVICE_WORKER_META_NAME } from "../../headless/pwa-service-worker-meta.js";
3
+ import { PWA_SERVICE_WORKER_META_NAME, pwaCacheScopePrefixOf, } from "../../headless/pwa-service-worker-meta.js";
4
4
  import { useTranslation } from "../../index.js";
5
5
  import { cn } from "../lib/cn.js";
6
6
  export const PWA_INSTALL_HINT_DISMISSED_KEY = "kumiko:pwa-install-hint-dismissed";
@@ -56,6 +56,22 @@ function registerServiceWorker(serviceWorkerUrl) {
56
56
  .register(serviceWorkerUrl, { scope, updateViaCache: "none" })
57
57
  .catch(() => undefined);
58
58
  }
59
+ // Only the registration for this document's scope is touched. A worker counts as the
60
+ // framework's own when it is served as /sw.js and left a cache with this scope's kumiko-pwa-
61
+ // prefix; app-owned workers and other apps on the origin have no such marker.
62
+ async function retireStaleServiceWorker() {
63
+ if (!("serviceWorker" in navigator) || typeof caches === "undefined")
64
+ return;
65
+ const registration = await navigator.serviceWorker.getRegistration();
66
+ if (!registration?.active?.scriptURL.endsWith("/sw.js"))
67
+ return;
68
+ const cachePrefix = await pwaCacheScopePrefixOf(new URL(registration.scope).pathname);
69
+ const pwaCacheNames = (await caches.keys()).filter((name) => name.startsWith(cachePrefix));
70
+ if (pwaCacheNames.length === 0)
71
+ return;
72
+ await registration.unregister();
73
+ await Promise.all(pwaCacheNames.map((name) => caches.delete(name)));
74
+ }
59
75
  function useInstallHint(enabled) {
60
76
  const [hint, setHint] = useState({ kind: "none" });
61
77
  useEffect(() => {
@@ -97,6 +113,8 @@ export function PwaSupport() {
97
113
  useEffect(() => {
98
114
  if (serviceWorkerUrl !== undefined)
99
115
  registerServiceWorker(serviceWorkerUrl);
116
+ else
117
+ retireStaleServiceWorker().catch(() => undefined);
100
118
  }, [serviceWorkerUrl]);
101
119
  if (hint.kind === "none")
102
120
  return null;
@@ -26,8 +26,9 @@ declare function Sidebar({ side, variant, collapsible, mobileTitle, mobileDescri
26
26
  mobileTitle?: string;
27
27
  mobileDescription?: string;
28
28
  }): React.JSX.Element;
29
- declare function SidebarTrigger({ className, onClick, label, ...props }: React.ComponentProps<typeof Button> & {
29
+ declare function SidebarTrigger({ className, onClick, label, icon, ...props }: React.ComponentProps<typeof Button> & {
30
30
  label?: string;
31
+ icon?: "panel" | "panel-all-widths";
31
32
  }): React.JSX.Element;
32
33
  declare function SidebarRail({ className, ...props }: React.ComponentProps<"button">): React.JSX.Element;
33
34
  declare function SidebarInset({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
@@ -1,9 +1,10 @@
1
1
  // @ts-nocheck — vendored shadcn, regenerate via scripts/sync-shadcn.ts
2
2
  "use client";
3
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
4
  import * as React from "react";
5
5
  import { cva } from "class-variance-authority";
6
6
  import { MenuIcon, PanelLeftIcon } from "lucide-react";
7
+ import { DrawnPanel } from "../drawn-icons.js";
7
8
  import { Slot } from "radix-ui";
8
9
  import { useIsMobile } from "./use-mobile.js";
9
10
  import { cn } from "../lib/cn.js";
@@ -100,12 +101,12 @@ function Sidebar({ side = "left", variant = "sidebar", collapsible = "offcanvas"
100
101
  ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]"
101
102
  : "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l", className), ...props, children: _jsx("div", { "data-sidebar": "sidebar", "data-slot": "sidebar-inner", className: "flex h-full w-full flex-col bg-sidebar px-2 py-3 group-data-[collapsible=icon]:px-2 group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow-sm", children: children }) })] }));
102
103
  }
103
- function SidebarTrigger({ className, onClick, label = "Toggle Sidebar", ...props }) {
104
+ function SidebarTrigger({ className, onClick, label = "Toggle Sidebar", icon = "panel", ...props }) {
104
105
  const { toggleSidebar } = useSidebar();
105
106
  return (_jsxs(Button, { "data-sidebar": "trigger", "data-slot": "sidebar-trigger", variant: "ghost", size: "icon", className: cn("size-8 max-md:size-11", className), onClick: (event) => {
106
107
  onClick?.(event);
107
108
  toggleSidebar();
108
- }, ...props, children: [_jsx(PanelLeftIcon, { className: "max-md:hidden" }), _jsx(MenuIcon, { className: "md:hidden" }), _jsx("span", { className: "sr-only", children: label })] }));
109
+ }, ...props, children: [icon === "panel-all-widths" ? (_jsx(DrawnPanel, {})) : (_jsxs(_Fragment, { children: [_jsx(PanelLeftIcon, { className: "max-md:hidden" }), _jsx(MenuIcon, { className: "md:hidden" })] })), _jsx("span", { className: "sr-only", children: label })] }));
109
110
  }
110
111
  function SidebarRail({ className, ...props }) {
111
112
  const { toggleSidebar } = useSidebar();
@@ -21,9 +21,10 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
21
21
  // with a transparent background so the suggestion shows through past the
22
22
  // typed text. Both elements MUST share identical typography/box classes
23
23
  // or the suggestion won't align with the caret.
24
- import { Check, Languages, Wand2 } from "lucide-react";
24
+ import { Check, Languages } from "lucide-react";
25
25
  import { useLayoutEffect, useRef, useState } from "react";
26
26
  import { useAiTextAction, useCompletion, usePrimitives, useTranslation } from "../../index.js";
27
+ import { DrawnWand } from "../drawn-icons.js";
27
28
  import { cn } from "../lib/cn.js";
28
29
  import { AiTextEndActionButton, endActionPaddingClass, } from "./ai-text-end-action.js";
29
30
  import { ModeSwitch } from "./mode-switch.js";
@@ -118,7 +119,7 @@ function AiTextCore({ multiline, label, id, name, value, onChange, required, dis
118
119
  }, id: id, name: name, type: "text", value: value, required: required, disabled: disabled === true || unavailable, placeholder: placeholder, onChange: (e) => handleChange(e.target.value), onKeyDown: handleKeyDown, onBlur: clearCompletion, onScroll: (e) => {
119
120
  if (overlayRef.current)
120
121
  overlayRef.current.scrollLeft = e.currentTarget.scrollLeft;
121
- }, className: cn(sharedTextClass, singleLineWrapClass, "relative bg-transparent", endActionPaddingClass(endAction)), "data-testid": testId !== undefined ? `${testId}-input` : undefined })), endAction !== undefined && (_jsx(AiTextEndActionButton, { action: endAction, multiline: multiline, disabled: disabled === true || unavailable, testId: testId }))] }), showGhost && _jsx(Text, { variant: "muted", children: t("kumiko.aiText.acceptHint") }), capExceeded && _jsx(Text, { variant: "muted", children: t("kumiko.aiText.capExceeded") }), showToolbar && (_jsxs("div", { className: "mt-1 flex gap-1", children: [actions.includes("correct") && (_jsx(Button, { variant: "secondary", size: "sm", disabled: value.length === 0, ariaLabel: t("kumiko.aiText.correct"), onClick: () => openDialog("correct"), children: _jsx(Check, { className: "size-3.5", "aria-hidden": "true" }) })), actions.includes("translate") && (_jsx(Button, { variant: "secondary", size: "sm", disabled: value.length === 0, ariaLabel: t("kumiko.aiText.translate"), onClick: () => openDialog("translate"), children: _jsx(Languages, { className: "size-3.5", "aria-hidden": "true" }) })), actions.includes("rewrite") && (_jsx(Button, { variant: "secondary", size: "sm", disabled: value.length === 0, ariaLabel: t("kumiko.aiText.rewrite"), onClick: () => openDialog("rewrite"), children: _jsx(Wand2, { className: "size-3.5", "aria-hidden": "true" }) }))] }))] }), _jsxs(Dialog, { open: dialogMode !== null, onOpenChange: (open) => {
122
+ }, className: cn(sharedTextClass, singleLineWrapClass, "relative bg-transparent", endActionPaddingClass(endAction)), "data-testid": testId !== undefined ? `${testId}-input` : undefined })), endAction !== undefined && (_jsx(AiTextEndActionButton, { action: endAction, multiline: multiline, disabled: disabled === true || unavailable, testId: testId }))] }), showGhost && _jsx(Text, { variant: "muted", children: t("kumiko.aiText.acceptHint") }), capExceeded && _jsx(Text, { variant: "muted", children: t("kumiko.aiText.capExceeded") }), showToolbar && (_jsxs("div", { className: "mt-1 flex gap-1", children: [actions.includes("correct") && (_jsx(Button, { variant: "secondary", size: "sm", disabled: value.length === 0, ariaLabel: t("kumiko.aiText.correct"), onClick: () => openDialog("correct"), children: _jsx(Check, { className: "size-3.5", "aria-hidden": "true" }) })), actions.includes("translate") && (_jsx(Button, { variant: "secondary", size: "sm", disabled: value.length === 0, ariaLabel: t("kumiko.aiText.translate"), onClick: () => openDialog("translate"), children: _jsx(Languages, { className: "size-3.5", "aria-hidden": "true" }) })), actions.includes("rewrite") && (_jsx(Button, { variant: "secondary", size: "sm", disabled: value.length === 0, ariaLabel: t("kumiko.aiText.rewrite"), onClick: () => openDialog("rewrite"), children: _jsx(DrawnWand, { className: "size-3.5", "aria-hidden": "true" }) }))] }))] }), _jsxs(Dialog, { open: dialogMode !== null, onOpenChange: (open) => {
122
123
  if (!open)
123
124
  closeDialog();
124
125
  }, title: dialogMode !== null ? t(`kumiko.aiText.${dialogMode}`) : "", onConfirm: applyResult, testId: testId !== undefined ? `${testId}-dialog` : undefined, children: [dialogMode === "translate" && needsConfig && (_jsxs("div", { className: "mb-3 flex flex-col gap-2", children: [_jsx(ModeSwitch, { value: targetLanguage, options: translateLanguages.map((l) => ({ value: l, label: l.toUpperCase() })), onChange: setTargetLanguage }), _jsx(Button, { variant: "primary", size: "sm", onClick: runConfiguredAction, children: t(`kumiko.aiText.${dialogMode}`) })] })), dialogMode === "rewrite" && needsConfig && (_jsxs("div", { className: "mb-3 flex flex-col gap-2", children: [_jsx(ModeSwitch, { value: rewriteStyle, options: REWRITE_STYLES.map((s) => ({
@@ -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
  }
@@ -8,6 +8,8 @@ export type DashboardListColumn = {
8
8
  readonly display?: "bar" | "badge" | "datetime" | "button";
9
9
  readonly badgeToneField?: string;
10
10
  readonly badgeDot?: false;
11
+ /** `false` leaves an empty cell blank instead of drawing the placeholder. */
12
+ readonly emptyPlaceholder?: false;
11
13
  /** Resolves the raw cell value to display text, e.g. a reference id to its label. */
12
14
  readonly renderValue?: (value: unknown, row: Readonly<Record<string, unknown>>) => string;
13
15
  /** Links the rendered text to its target, e.g. a reference cell to the record's detail. */
@@ -19,6 +21,12 @@ export type DashboardListColumn = {
19
21
  };
20
22
  export type DashboardListRow = Readonly<Record<string, unknown>>;
21
23
  type Row = DashboardListRow;
24
+ /** Plain-text form of a cell value, for places that cannot render the cell itself (phone line). */
25
+ export declare function dashboardListCellText(column: Pick<DashboardListColumn, "display" | "renderValue">, row: Row, field: string, formats: {
26
+ readonly formatPercent: (fraction: number) => string;
27
+ readonly formatNumber: (value: number) => string;
28
+ readonly formatDateTime: (atMs: number) => string;
29
+ }, translate: (key: string) => string): string | undefined;
22
30
  export declare function DashboardListCell({ column, row, formatPercent, formatNumber, formatDateTime, translate, leading, }: {
23
31
  /** Only a `hint` column takes it: it stands on the sentence's line, in front of it. */
24
32
  readonly leading?: ReactNode;
@@ -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,21 +49,21 @@ 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
69
  return link === undefined ? (label) : (_jsx(CellTextLink, { link: link, className: LINK_BUTTON_CLASS, children: label }));
@@ -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-[85vh] 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;