@cosmicdrift/kumiko-renderer 0.416.0 → 0.417.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/dist/app/action-form-body.d.ts +1 -4
  2. package/dist/app/action-form-body.js +9 -8
  3. package/dist/app/config-edit-body.js +71 -79
  4. package/dist/app/entity-list-screen.js +1 -1
  5. package/dist/app/header-actions-bar.d.ts +3 -1
  6. package/dist/app/header-actions-bar.js +12 -4
  7. package/dist/app/locked-screen-header.d.ts +2 -0
  8. package/dist/app/locked-screen-header.js +8 -1
  9. package/dist/app/projection-detail-body.js +24 -5
  10. package/dist/app/projection-detail-guidance.d.ts +1 -0
  11. package/dist/app/projection-detail-guidance.js +7 -4
  12. package/dist/app/projection-detail-header-model.js +4 -1
  13. package/dist/app/projection-detail-header-region.js +25 -9
  14. package/dist/app/projection-detail-header.d.ts +2 -0
  15. package/dist/app/projection-detail-header.js +30 -3
  16. package/dist/app/projection-list-shim.js +1 -0
  17. package/dist/app/row-actions.d.ts +4 -0
  18. package/dist/app/row-actions.js +19 -3
  19. package/dist/app/use-projection-detail-actions.d.ts +3 -1
  20. package/dist/app/use-projection-detail-actions.js +9 -1
  21. package/dist/app/use-projection-detail-data.js +17 -1
  22. package/dist/app/use-projection-list-data.js +1 -1
  23. package/dist/card-options.d.ts +2 -0
  24. package/dist/components/choice-chip-class.d.ts +1 -0
  25. package/dist/components/choice-chip-class.js +9 -0
  26. package/dist/components/edit-mounts.d.ts +1 -1
  27. package/dist/components/grid-cell-for-field.js +1 -1
  28. package/dist/components/multi-select-chips.js +2 -1
  29. package/dist/components/narrow-description.d.ts +3 -0
  30. package/dist/components/narrow-description.js +12 -0
  31. package/dist/components/related-list-section.d.ts +5 -3
  32. package/dist/components/related-list-section.js +9 -4
  33. package/dist/components/related-photo-grid.js +17 -3
  34. package/dist/components/render-edit-field-grid.d.ts +12 -3
  35. package/dist/components/render-edit-field-grid.js +60 -18
  36. package/dist/components/render-edit-fields-section.js +45 -11
  37. package/dist/components/render-edit-header-actions.js +1 -1
  38. package/dist/components/render-edit-layout.js +4 -2
  39. package/dist/components/render-edit-section-kinds.js +50 -12
  40. package/dist/components/render-edit-titles.js +1 -1
  41. package/dist/components/render-edit-types.d.ts +11 -0
  42. package/dist/components/render-field-ai-assist.js +3 -2
  43. package/dist/components/render-field-control.js +1 -1
  44. package/dist/components/render-field-value-chips.js +4 -2
  45. package/dist/components/render-list-hint-columns.d.ts +1 -0
  46. package/dist/components/render-list-hint-columns.js +30 -5
  47. package/dist/components/render-list-reference-columns.js +2 -4
  48. package/dist/components/render-list-row-tone.d.ts +2 -0
  49. package/dist/components/render-list-row-tone.js +6 -0
  50. package/dist/components/render-list-table-props.d.ts +13 -2
  51. package/dist/components/render-list-table-props.js +9 -3
  52. package/dist/components/render-list-types.d.ts +4 -0
  53. package/dist/components/render-list.js +12 -4
  54. package/dist/components/use-render-list-columns.js +3 -3
  55. package/dist/components/write-form-registry.d.ts +13 -0
  56. package/dist/components/write-form-registry.js +6 -0
  57. package/dist/components/write-form-section.d.ts +5 -1
  58. package/dist/components/write-form-section.js +55 -16
  59. package/dist/headless/form/form-controller.d.ts +1 -0
  60. package/dist/headless/form/form-controller.js +1 -1
  61. package/dist/headless/format/index.js +5 -4
  62. package/dist/headless/format/relative-time.d.ts +2 -0
  63. package/dist/headless/format/relative-time.js +4 -1
  64. package/dist/headless/view-model/edit.js +87 -37
  65. package/dist/headless/view-model/list.js +6 -0
  66. package/dist/headless/view-model/types.d.ts +49 -4
  67. package/dist/hooks/use-list-table.js +11 -6
  68. package/dist/i18n-defaults.js +7 -2
  69. package/dist/primitives-record-guidance.d.ts +4 -0
  70. package/dist/primitives-share-types.d.ts +82 -0
  71. package/dist/primitives-share-types.js +1 -0
  72. package/dist/primitives.d.ts +34 -83
  73. package/dist/web/app/bold-markup.d.ts +3 -0
  74. package/dist/web/app/bold-markup.js +14 -0
  75. package/dist/web/app/dashboard-body.js +5 -1
  76. package/dist/web/app/dashboard-list-panel.js +7 -4
  77. package/dist/web/app/dashboard-panels.js +31 -3
  78. package/dist/web/app/dashboard-shared.d.ts +3 -1
  79. package/dist/web/app/dashboard-shared.js +3 -3
  80. package/dist/web/app/dashboard-stat-group-panel.d.ts +1 -1
  81. package/dist/web/app/dashboard-stat-group-panel.js +16 -2
  82. package/dist/web/app/dashboard-text-panel.js +11 -6
  83. package/dist/web/app/relative-time.js +10 -1
  84. package/dist/web/components/config-cascade.d.ts +2 -1
  85. package/dist/web/components/config-cascade.js +16 -4
  86. package/dist/web/drawn-icons.js +2 -1
  87. package/dist/web/layout/header-action-pinned.d.ts +4 -2
  88. package/dist/web/layout/header-action-pinned.js +13 -4
  89. package/dist/web/layout/header-overflow-menu.d.ts +2 -0
  90. package/dist/web/layout/header-overflow-menu.js +2 -0
  91. package/dist/web/layout/notification-bell.js +12 -3
  92. package/dist/web/layout/page-header-slot.d.ts +2 -0
  93. package/dist/web/layout/page-header-slot.js +4 -0
  94. package/dist/web/layout/screen-focus.js +4 -1
  95. package/dist/web/layout/shell-header.js +13 -5
  96. package/dist/web/primitives/banner.js +14 -3
  97. package/dist/web/primitives/card.js +5 -3
  98. package/dist/web/primitives/combobox.js +2 -2
  99. package/dist/web/primitives/data-table/actions-column.js +1 -1
  100. package/dist/web/primitives/data-table/card-body.d.ts +1 -1
  101. package/dist/web/primitives/data-table/card-body.js +37 -14
  102. package/dist/web/primitives/data-table/card-frame.d.ts +2 -0
  103. package/dist/web/primitives/data-table/card-frame.js +3 -0
  104. package/dist/web/primitives/data-table/card-row.js +28 -9
  105. package/dist/web/primitives/data-table/card-sort-select.js +1 -1
  106. package/dist/web/primitives/data-table/card-view.js +1 -1
  107. package/dist/web/primitives/data-table/data-cell-props.d.ts +2 -1
  108. package/dist/web/primitives/data-table/data-cell-props.js +1 -0
  109. package/dist/web/primitives/data-table/density.d.ts +3 -1
  110. package/dist/web/primitives/data-table/density.js +11 -4
  111. package/dist/web/primitives/data-table/row-render-parts.d.ts +1 -1
  112. package/dist/web/primitives/data-table/row-render-parts.js +3 -5
  113. package/dist/web/primitives/data-table/sort-options-select.js +2 -2
  114. package/dist/web/primitives/data-table/sortable-header.js +4 -4
  115. package/dist/web/primitives/data-table/table-body.js +2 -1
  116. package/dist/web/primitives/data-table/table-chrome.js +1 -3
  117. package/dist/web/primitives/data-table/table-content.js +7 -11
  118. package/dist/web/primitives/data-table/table-data-cell.js +31 -17
  119. package/dist/web/primitives/data-table/table-header-row.js +1 -1
  120. package/dist/web/primitives/data-table/table-view.js +1 -1
  121. package/dist/web/primitives/data-table/toolbar.js +6 -7
  122. package/dist/web/primitives/data-table/use-data-table-state.d.ts +6 -1
  123. package/dist/web/primitives/data-table/use-data-table-state.js +12 -2
  124. package/dist/web/primitives/data-table-cell.d.ts +13 -2
  125. package/dist/web/primitives/data-table-cell.js +123 -43
  126. package/dist/web/primitives/data-table.js +1 -1
  127. package/dist/web/primitives/default-form.d.ts +1 -1
  128. package/dist/web/primitives/default-form.js +11 -10
  129. package/dist/web/primitives/drawer.js +2 -7
  130. package/dist/web/primitives/facet-filter.d.ts +1 -1
  131. package/dist/web/primitives/facet-filter.js +2 -5
  132. package/dist/web/primitives/facet-search-filter.js +1 -1
  133. package/dist/web/primitives/facet-trigger-label.d.ts +1 -4
  134. package/dist/web/primitives/facet-trigger-label.js +4 -7
  135. package/dist/web/primitives/field.js +15 -8
  136. package/dist/web/primitives/form-footer-parts.js +2 -2
  137. package/dist/web/primitives/inline-suffix.d.ts +2 -0
  138. package/dist/web/primitives/inline-suffix.js +5 -0
  139. package/dist/web/primitives/input-choice-kinds.js +12 -2
  140. package/dist/web/primitives/input-number-kinds.js +2 -2
  141. package/dist/web/primitives/input-text-kinds.js +1 -1
  142. package/dist/web/primitives/layout-elements.d.ts +4 -4
  143. package/dist/web/primitives/layout-elements.js +49 -12
  144. package/dist/web/primitives/layout.d.ts +1 -1
  145. package/dist/web/primitives/layout.js +1 -1
  146. package/dist/web/primitives/money-input.js +8 -7
  147. package/dist/web/primitives/number-input.d.ts +2 -1
  148. package/dist/web/primitives/number-input.js +9 -4
  149. package/dist/web/primitives/page-header.d.ts +1 -1
  150. package/dist/web/primitives/page-header.js +8 -1
  151. package/dist/web/primitives/pager.js +12 -21
  152. package/dist/web/primitives/photo-grid.js +2 -1
  153. package/dist/web/primitives/record-steps.d.ts +1 -1
  154. package/dist/web/primitives/record-steps.js +6 -15
  155. package/dist/web/primitives/row-actions.js +38 -24
  156. package/dist/web/primitives/use-container-narrow.d.ts +12 -0
  157. package/dist/web/primitives/use-container-narrow.js +42 -0
  158. package/dist/web/ui/input.js +1 -1
  159. package/dist/web/ui/textarea.js +1 -1
  160. package/dist/web/widgets/dashboard-list-cards.js +6 -3
  161. package/dist/web/widgets/dashboard-list.d.ts +4 -1
  162. package/dist/web/widgets/dashboard-list.js +10 -5
  163. package/dist/web/widgets/progress-list.js +1 -1
  164. package/dist/web/widgets/stat-box-cell.js +1 -1
  165. package/package.json +5 -5
  166. package/src/changes.json +51 -0
  167. package/src/web/styles.css +3 -2
@@ -82,6 +82,8 @@ type QueryPanelProps<TData> = {
82
82
  readonly query: string;
83
83
  };
84
84
  readonly label: string;
85
+ /** Title derived from the loaded data; `label` stands in until then. */
86
+ readonly titleFrom?: (data: TData) => string | undefined;
85
87
  /** A function derives the line from the loaded data (e.g. "n of m"); `staticSubtitle` stands in until then. */
86
88
  readonly subtitle?: string | ((data: TData) => string | undefined);
87
89
  readonly staticSubtitle?: string;
@@ -98,7 +100,7 @@ type QueryPanelProps<TData> = {
98
100
  * redraws this panel and nothing else. */
99
101
  readonly children: (data: TData, formats: DashboardFormats) => ReactNode;
100
102
  };
101
- export declare function QueryPanel<TData>({ panel, label, subtitle, staticSubtitle, action, footer, replaceShell, screenParams, translate, skeleton, isEmpty, children, }: QueryPanelProps<TData>): ReactNode;
103
+ export declare function QueryPanel<TData>({ panel, label, titleFrom, subtitle, staticSubtitle, action, footer, replaceShell, screenParams, translate, skeleton, isEmpty, children, }: QueryPanelProps<TData>): ReactNode;
102
104
  export declare function useLoadedAt(screenParams: ScreenParams): {
103
105
  readonly loadedAtMs: number;
104
106
  readonly reportLoaded: (atMs: number) => void;
@@ -119,7 +119,7 @@ export function useDashboardFormats() {
119
119
  };
120
120
  }
121
121
  export function PanelShell({ testId, title, subtitle, action, footer, children, }) {
122
- return (_jsxs("section", { "data-testid": testId, className: "flex h-full flex-col rounded-lg border border-border bg-card text-card-foreground shadow-[var(--card-shadow)]", children: [(title !== undefined || action !== undefined) && (_jsxs("header", { className: "flex shrink-0 flex-wrap items-baseline justify-between gap-x-3 gap-y-2 px-4 pt-3.5", children: [_jsxs("div", { className: "flex min-w-0 flex-col gap-0.5 sm:flex-row sm:flex-wrap sm:items-baseline sm:gap-x-2.5", children: [title !== undefined && _jsx("h2", { className: "text-sm font-semibold break-words", children: title }), subtitle !== undefined && (_jsx("p", { className: "text-[12.5px] text-muted-foreground", children: subtitle }))] }), action !== undefined && _jsx("div", { className: "shrink-0", children: action })] })), _jsx("div", { className: cn("grow px-4 pt-3", footer === undefined && "pb-4"), children: children }), footer !== undefined && (_jsx("footer", { className: "mx-4 mb-4 mt-2.5 flex shrink-0 flex-wrap items-center gap-x-1 border-t border-border-row pt-2.5 text-[12.5px] text-muted-foreground", children: footer }))] }));
122
+ return (_jsxs("section", { "data-testid": testId, className: "flex h-full flex-col rounded-lg border border-border bg-card text-card-foreground shadow-[var(--card-shadow)]", children: [(title !== undefined || action !== undefined) && (_jsxs("header", { className: "flex shrink-0 flex-wrap items-baseline justify-between gap-x-3 gap-y-2 px-4 pt-3.5", children: [_jsx("div", { className: "flex min-w-0 flex-col gap-0.5", children: title !== undefined && _jsx("h2", { className: "text-sm font-semibold break-words", children: title }) }), (subtitle !== undefined || action !== undefined) && (_jsxs("div", { className: "ml-auto flex min-w-0 items-baseline gap-3 max-sm:ml-0 max-sm:w-full max-sm:flex-col max-sm:items-start max-sm:gap-2", children: [subtitle !== undefined && (_jsx("p", { "data-slot": "panel-subtitle", className: "text-[12.5px] tabular-nums text-muted-foreground", children: subtitle })), action] }))] })), _jsx("div", { className: cn("grow px-4 pt-3", footer === undefined && "pb-4"), children: children }), footer !== undefined && (_jsx("footer", { className: "mx-4 mb-4 mt-2.5 flex shrink-0 flex-wrap items-center gap-x-1 border-t border-border-row pt-2.5 text-[12.5px] text-muted-foreground", children: footer }))] }));
123
123
  }
124
124
  export function PanelError({ label, error, onRetry, testId, }) {
125
125
  const { Button } = usePrimitives();
@@ -142,7 +142,7 @@ function resolveSubtitle(subtitle, fallback, data) {
142
142
  return subtitle;
143
143
  return data === undefined ? fallback : subtitle(data);
144
144
  }
145
- export function QueryPanel({ panel, label, subtitle, staticSubtitle, action, footer, replaceShell, screenParams, translate, skeleton, isEmpty, children, }) {
145
+ export function QueryPanel({ panel, label, titleFrom, subtitle, staticSubtitle, action, footer, replaceShell, screenParams, translate, skeleton, isEmpty, children, }) {
146
146
  const formats = useDashboardFormats();
147
147
  const { data, error, loading, refetch } = useDashboardQuery(panel.query, panelPayload(panel, screenParams));
148
148
  useReportPanelLoaded(data, loading);
@@ -163,7 +163,7 @@ export function QueryPanel({ panel, label, subtitle, staticSubtitle, action, foo
163
163
  }
164
164
  if (shown !== undefined && replaceShell !== undefined)
165
165
  return replaceShell(shown);
166
- return (_jsx(PanelShell, { testId: `dashboard-panel-${panel.id}`, title: label, subtitle: resolveSubtitle(subtitle, staticSubtitle, shown), action: action, footer: shown !== undefined ? footer?.(shown) : undefined, children: body }));
166
+ return (_jsx(PanelShell, { testId: `dashboard-panel-${panel.id}`, title: (shown !== undefined ? titleFrom?.(shown) : undefined) ?? label, subtitle: resolveSubtitle(subtitle, staticSubtitle, shown), action: action, footer: shown !== undefined ? footer?.(shown) : undefined, children: body }));
167
167
  }
168
168
  // Starts at render time and restarts whenever the merged query params change;
169
169
  // panels additionally report each successful (re)load, so live refetches and
@@ -1,5 +1,5 @@
1
1
  import type { DashboardStatGroupPanel } from "@cosmicdrift/kumiko-framework/ui-types";
2
- import type { ReactNode } from "react";
2
+ import { type ReactNode } from "react";
3
3
  import type { Translate } from "../../headless/index.ts";
4
4
  import "../react-css-custom-properties.ts";
5
5
  import { type ScreenParams } from "./dashboard-shared.tsx";
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { ChevronRight } from "lucide-react";
3
+ import { Fragment } from "react";
3
4
  import { useNav } from "../../app/nav.js";
4
5
  import { navigateTargetAllows } from "../../app/screen-access.js";
5
6
  import { extensionSectionName, useAppFeatures, useExtensionSectionComponent, usePrimitives, useUserRoles, } from "../../index.js";
@@ -43,11 +44,24 @@ function statsForViewport(stats, belowSm) {
43
44
  }
44
45
  function StatCells({ panel, screenId, screenParams, translate, variant, }) {
45
46
  const belowSm = useIsBelowSmViewport();
46
- return statsForViewport(panel.stats, belowSm).map((stat) => (_jsx(StatPanelBody, { panel: stat, label: translate(stat.label), screenId: screenId, screenParams: screenParams, translate: translate, variant: variant }, stat.id)));
47
+ return statsForViewport(panel.stats, belowSm).map((stat) => {
48
+ const body = (_jsx(StatPanelBody, { panel: stat, label: translate(stat.label), screenId: screenId, screenParams: screenParams, translate: translate, variant: variant }, stat.id));
49
+ return variant === "strip" ? (_jsx("div", { "data-stat-card": "true", className: "min-w-0 rounded-lg border border-border bg-card empty:hidden", children: body }, stat.id)) : (_jsx(Fragment, { children: body }, stat.id));
50
+ });
51
+ }
52
+ // Phone: the untitled strip is one text line ("2 Interessenten 2 Vorschläge 1 Antwort"), not tiles.
53
+ function PhoneStatLine(props) {
54
+ const { panel, translate } = props;
55
+ const navigateAllowed = useStatNavigateAllowed();
56
+ const stats = statsForViewport(panel.stats, true).filter(navigateAllowed);
57
+ return (_jsx("div", { "data-testid": `dashboard-panel-${panel.id}`, "data-stat-line": "true", className: "flex flex-wrap justify-between gap-x-3 gap-y-1 rounded-lg border border-border bg-card px-3 py-2 text-sm", children: stats.map((stat) => (_jsx("span", { className: "[&_a]:inline", children: _jsx(StatPanelBody, { panel: stat, label: translate(stat.label), screenId: props.screenId, screenParams: props.screenParams, translate: translate, variant: "strip-compact" }) }, stat.id))) }));
47
58
  }
48
59
  function FlatStatStrip(props) {
49
60
  const { panel, translate } = props;
50
- return (_jsxs("div", { "data-testid": `dashboard-panel-${panel.id}`, className: "rounded-lg border border-border bg-card py-1 lg:flex lg:items-center", children: [_jsx("div", { className: "grid grow grid-cols-2 gap-y-2 lg:auto-cols-fr lg:grid-flow-col lg:divide-x lg:divide-border-row", children: _jsx(StatCells, { ...props, variant: "strip" }) }), panel.link !== undefined && (_jsx("div", { className: "flex px-4 max-lg:pt-1 lg:shrink-0", children: _jsx(StatGroupLink, { link: panel.link, translate: translate, stretchOnNarrow: false }) }))] }));
61
+ const belowSm = useIsBelowSmViewport();
62
+ if (belowSm)
63
+ return _jsx(PhoneStatLine, { ...props });
64
+ return (_jsxs("div", { "data-testid": `dashboard-panel-${panel.id}`, className: "lg:flex lg:items-center lg:gap-3", children: [_jsx("div", { className: "grid grow grid-cols-2 gap-3 lg:auto-cols-fr lg:grid-flow-col", children: _jsx(StatCells, { ...props, variant: "strip" }) }), panel.link !== undefined && (_jsx("div", { className: "flex px-4 max-lg:pt-1 lg:shrink-0", children: _jsx(StatGroupLink, { link: panel.link, translate: translate, stretchOnNarrow: false }) }))] }));
51
65
  }
52
66
  function PhoneStripIcon({ panel, screenId, screenParams, }) {
53
67
  const Icon = useExtensionSectionComponent(panel.icon !== undefined ? extensionSectionName(panel.icon) : undefined);
@@ -3,6 +3,7 @@ import { navigateTargetAllows } from "../../app/screen-access.js";
3
3
  import { extensionSectionName, lastSegment, useAppFeatures, useExtensionSectionComponent, useNav, usePrimitives, useUserRoles, } from "../../index.js";
4
4
  import { cn } from "../lib/cn.js";
5
5
  import { useIsBelowSmViewport } from "../primitives/use-narrow-viewport.js";
6
+ import { renderBoldMarkup } from "./bold-markup.js";
6
7
  import { PanelError, PanelShell, PanelSkeleton, panelPayload, useDashboardFormats, useDashboardQuery, useReportPanelLoaded, } from "./dashboard-shared.js";
7
8
  import { isDashboardI18nText, isRecord, resolveDashboardText } from "./dashboard-text.js";
8
9
  function isDashboardText(value) {
@@ -62,7 +63,7 @@ function resolveBlockText(text, translate, formats) {
62
63
  const PARAGRAPH_CLASS_NAMES = {
63
64
  muted: "text-sm text-muted-foreground",
64
65
  strong: "text-sm font-medium text-foreground",
65
- lead: "font-heading text-[15.5px] leading-[1.5] sm:text-[17px] sm:leading-relaxed text-foreground",
66
+ lead: "font-heading text-sm leading-5 sm:text-[17px] sm:leading-relaxed text-foreground",
66
67
  };
67
68
  function isLeadParagraph(block) {
68
69
  return block?.kind === "paragraph" && block.emphasis === "lead";
@@ -74,7 +75,7 @@ function TextBlockView({ block, translate, followsLead = false, }) {
74
75
  case "heading":
75
76
  return (_jsx("h3", { "data-block": "heading", className: "text-sm font-semibold text-foreground", children: resolve(block.text) }));
76
77
  case "paragraph":
77
- return (_jsx("p", { "data-block": "paragraph", className: PARAGRAPH_CLASS_NAMES[block.emphasis ?? "muted"], children: resolve(block.text) }));
78
+ return (_jsx("p", { "data-block": "paragraph", className: PARAGRAPH_CLASS_NAMES[block.emphasis ?? "muted"], children: renderBoldMarkup(resolve(block.text)) }));
78
79
  case "list":
79
80
  return (_jsx("ul", { "data-block": "list", className: "list-disc space-y-1 pl-5 text-sm text-muted-foreground", children: withOccurrenceKeys(block.items, textKey).map(({ entry, key }) => (_jsx("li", { children: resolve(entry) }, key))) }));
80
81
  case "code":
@@ -121,14 +122,17 @@ function textBlockKey(block) {
121
122
  return `${block.kind}:${textKey(block.text)}`;
122
123
  }
123
124
  }
124
- function TextPanelFrame({ panel, label, screenId, screenParams, children, }) {
125
+ function startsWithLead(blocks) {
126
+ return isLeadParagraph(blocks[0]);
127
+ }
128
+ function TextPanelFrame({ panel, label, screenId, screenParams, accented = false, children, }) {
125
129
  const testId = `dashboard-panel-${panel.id}`;
126
130
  const Icon = useExtensionSectionComponent(panel.icon !== undefined ? extensionSectionName(panel.icon) : undefined);
127
131
  const content = Icon === undefined ? (children) : (_jsxs("div", { className: "flex items-start gap-3", children: [_jsx("span", { "data-testid": `${testId}-icon`, className: "flex shrink-0 items-center pt-0.5", children: _jsx(Icon, { entityName: screenId, entityId: null, screenId: screenId, filterParams: screenParams.filterParams }) }), _jsx("div", { className: "min-w-0 grow", children: children })] }));
128
132
  if (label !== undefined) {
129
133
  return (_jsx(PanelShell, { testId: testId, title: label, children: content }));
130
134
  }
131
- return (_jsx("section", { "data-testid": testId, className: "h-full rounded-lg border border-border bg-card p-4 text-card-foreground max-sm:px-3.5 max-sm:py-3", children: content }));
135
+ return (_jsx("section", { "data-testid": testId, className: cn("h-full rounded-lg border border-border bg-card p-4 text-card-foreground max-sm:px-3 max-sm:py-2.5", accented && "border-l-[3px] border-l-primary"), children: content }));
132
136
  }
133
137
  function TextBlockList({ blocks, translate, }) {
134
138
  return (_jsx("div", { className: "flex flex-col gap-3", children: withOccurrenceKeys(blocks, textBlockKey).map(({ entry, key }, index) => (_jsx(TextBlockView, { block: entry, translate: translate, followsLead: isLeadParagraph(blocks[index - 1]) }, key))) }));
@@ -136,8 +140,9 @@ function TextBlockList({ blocks, translate, }) {
136
140
  export function TextPanelBody(props) {
137
141
  const { panel, label, translate, screenId, screenParams } = props;
138
142
  const narrow = useIsBelowSmViewport();
143
+ const staticBlocks = (narrow ? panel.narrowBlocks : undefined) ?? panel.blocks ?? [];
139
144
  if (panel.query === undefined) {
140
- return (_jsx(TextPanelFrame, { panel: panel, label: label, screenId: screenId, screenParams: screenParams, children: _jsx(TextBlockList, { blocks: (narrow ? panel.narrowBlocks : undefined) ?? panel.blocks ?? [], translate: translate }) }));
145
+ return (_jsx(TextPanelFrame, { panel: panel, label: label, screenId: screenId, screenParams: screenParams, accented: startsWithLead(staticBlocks), children: _jsx(TextBlockList, { blocks: staticBlocks, translate: translate }) }));
141
146
  }
142
147
  return _jsx(QueryTextPanelBody, { ...props, query: panel.query });
143
148
  }
@@ -165,5 +170,5 @@ function QueryTextPanelBody({ panel, query, label, screenId, screenParams, trans
165
170
  else {
166
171
  body = null;
167
172
  }
168
- return (_jsx(TextPanelFrame, { panel: panel, label: label, screenId: screenId, screenParams: screenParams, children: body }));
173
+ return (_jsx(TextPanelFrame, { panel: panel, label: label, screenId: screenId, screenParams: screenParams, accented: startsWithLead(blocks), children: body }));
169
174
  }
@@ -1,7 +1,14 @@
1
1
  import { useEffect, useRef, useState } from "react";
2
2
  import { formatRelativeTime } from "../../headless/format/relative-time.js";
3
+ import { useTranslation } from "../../i18n.js";
3
4
  import { serverNowMs } from "../../server-clock.js";
4
5
  const SECONDS_PER_MINUTE = 60;
6
+ // One look for relative times everywhere: short units, yesterday with clock, absolute after a week.
7
+ const LIST_RELATIVE_OPTIONS = {
8
+ style: "short",
9
+ withTime: true,
10
+ absoluteAfterDays: 7,
11
+ };
5
12
  const SECOND_TICK_MS = 1000;
6
13
  // Above a minute the text changes at most once per minute; half a minute keeps it
7
14
  // at most 30 s late without waking the page every second for a "5 minutes ago".
@@ -14,6 +21,8 @@ export function relativeTickIntervalMs(distanceMs) {
14
21
  /** Returns a formatter for relative times that redraws its component on a timer, but
15
22
  * only while a render actually called it: no relative output on screen, no timer. */
16
23
  export function useRelativeTimeFormatter(locale) {
24
+ const t = useTranslation();
25
+ const justNow = t("kumiko.time.justNow");
17
26
  const [, setTick] = useState(0);
18
27
  const [intervalMs, setIntervalMs] = useState(null);
19
28
  const nearestDistanceMs = useRef(Number.POSITIVE_INFINITY);
@@ -33,6 +42,6 @@ export function useRelativeTimeFormatter(locale) {
33
42
  return (atMs) => {
34
43
  const nowMs = serverNowMs();
35
44
  nearestDistanceMs.current = Math.min(nearestDistanceMs.current, Math.abs(atMs - nowMs));
36
- return formatRelativeTime(atMs, nowMs, locale);
45
+ return formatRelativeTime(atMs, nowMs, locale, { ...LIST_RELATIVE_OPTIONS, justNow });
37
46
  };
38
47
  }
@@ -8,6 +8,7 @@ type ConfigCascadeViewProps = {
8
8
  readonly qualifiedKey?: string;
9
9
  readonly required?: boolean;
10
10
  readonly renderValue?: CascadeValueRenderer;
11
+ readonly compact?: boolean;
11
12
  };
12
- export declare function ConfigCascadeView({ cascade, screenScope, onReset, qualifiedKey, required, renderValue, }: ConfigCascadeViewProps): ReactNode;
13
+ export declare function ConfigCascadeView({ cascade, screenScope, onReset, qualifiedKey, required, renderValue, compact, }: ConfigCascadeViewProps): ReactNode;
13
14
  export {};
@@ -3,6 +3,7 @@ import { useId, useState } from "react";
3
3
  import { usePrimitives, useTranslation } from "../../index.js";
4
4
  import { Icon } from "../icons.js";
5
5
  import { cn } from "../lib/cn.js";
6
+ import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../ui/tooltip.js";
6
7
  const SOURCE_I18N_KEY = {
7
8
  "user-row": "kumiko.config.source.user",
8
9
  "tenant-row": "kumiko.config.source.tenant",
@@ -91,7 +92,7 @@ const OWN_LEVEL_ORIGIN_NO_DEFAULT_KEY = {
91
92
  user: "kumiko.config.cascade.originNoDefault.user",
92
93
  system: "kumiko.config.cascade.originNoDefault.system",
93
94
  };
94
- export function ConfigCascadeView({ cascade, screenScope, onReset, qualifiedKey, required = false, renderValue, }) {
95
+ export function ConfigCascadeView({ cascade, screenScope, onReset, qualifiedKey, required = false, renderValue, compact = false, }) {
95
96
  const t = useTranslation();
96
97
  const { Button } = usePrimitives();
97
98
  const [expanded, setExpanded] = useState(false);
@@ -143,9 +144,20 @@ export function ConfigCascadeView({ cascade, screenScope, onReset, qualifiedKey,
143
144
  : t("kumiko.config.cascade.origin.default"),
144
145
  className: "text-muted-foreground",
145
146
  };
146
- return (_jsxs("div", { className: "flex flex-col gap-1 text-xs", "data-testid": "config-cascade", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-x-1 gap-y-1", children: [_jsx("span", { className: cn("inline-flex items-center gap-1.5", origin.className), children: origin.text }), hasOverride && onReset !== undefined && qualifiedKey !== undefined ? (_jsx(Button, { variant: "ghost", size: "sm", onClick: () => onReset(qualifiedKey, screenScope), testId: "config-cascade-reset", className: "h-auto px-1.5 py-0.5 text-xs text-muted-foreground hover:bg-transparent hover:text-foreground", children: t(screenScope === "system"
147
- ? "kumiko.config.cascade.resetToApp"
148
- : "kumiko.config.cascade.resetTo") })) : null] }), expandable && (cascade.levels.length > 2 || screenScope === "system") ? (_jsxs("button", { type: "button", onClick: () => setExpanded((v) => !v), "aria-expanded": expanded, ...(expanded && { "aria-controls": panelId }), className: "inline-flex cursor-pointer items-center gap-1 self-start rounded-sm text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring", children: [_jsx(Icon, { name: "chevron-right", className: cn("size-3.5 transition-transform motion-reduce:transition-none", expanded && "rotate-90") }), t(expanded ? "kumiko.config.cascade.hideLevels" : "kumiko.config.cascade.showLevels")] })) : null, expanded && expandable && (cascade.levels.length > 2 || screenScope === "system") ? (_jsx("ul", { id: panelId, className: "flex flex-col gap-0.5 border-l border-border pl-3", children: displayLevels.map((display) => (_jsx(CascadeLevelRow, { display: display, ...(renderValue !== undefined && { renderValue }) }, display.level.source))) })) : null] }));
147
+ const resetButton = hasOverride && onReset !== undefined && qualifiedKey !== undefined ? (_jsx(Button, { variant: "ghost", size: "sm", onClick: () => onReset(qualifiedKey, screenScope), testId: "config-cascade-reset", className: "h-auto px-1.5 py-0.5 text-xs text-muted-foreground hover:bg-transparent hover:text-foreground", children: t(screenScope === "system"
148
+ ? "kumiko.config.cascade.resetToApp"
149
+ : "kumiko.config.cascade.resetTo") })) : null;
150
+ const showsLevels = expandable && (cascade.levels.length > 2 || screenScope === "system");
151
+ const levelsPanel = expanded && showsLevels ? (_jsx("ul", { id: panelId, className: "flex flex-col gap-0.5 border-l border-border pl-3", children: displayLevels.map((display) => (_jsx(CascadeLevelRow, { display: display, ...(renderValue !== undefined && { renderValue }) }, display.level.source))) })) : null;
152
+ if (compact) {
153
+ return (_jsxs("div", { className: "flex flex-col gap-1 text-xs", "data-testid": "config-cascade", children: [_jsxs("div", { className: "flex items-center gap-1", children: [_jsx(TooltipProvider, { children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsxs("button", { type: "button", "data-testid": "config-cascade-origin", onClick: showsLevels ? () => setExpanded((v) => !v) : undefined, ...(showsLevels && {
154
+ "aria-expanded": expanded,
155
+ ...(expanded && { "aria-controls": panelId }),
156
+ }), className: cn("inline-flex size-5 items-center justify-center rounded-sm outline-none focus-visible:ring-2 focus-visible:ring-ring", showsLevels ? "cursor-pointer" : "cursor-help", origin.className), children: [_jsx(Icon, { name: "info", className: "size-3.5" }), showsLevels && (_jsx("span", { className: "sr-only", children: t(expanded
157
+ ? "kumiko.config.cascade.hideLevels"
158
+ : "kumiko.config.cascade.showLevels") }))] }) }), _jsx(TooltipContent, { children: origin.text })] }) }), _jsx("span", { className: "sr-only", children: origin.text }), resetButton] }), levelsPanel] }));
159
+ }
160
+ return (_jsxs("div", { className: "flex flex-col gap-1 text-xs", "data-testid": "config-cascade", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-x-1 gap-y-1", children: [_jsx("span", { className: cn("inline-flex items-center gap-1.5", origin.className), children: origin.text }), resetButton] }), showsLevels ? (_jsxs("button", { type: "button", onClick: () => setExpanded((v) => !v), "aria-expanded": expanded, ...(expanded && { "aria-controls": panelId }), className: "inline-flex cursor-pointer items-center gap-1 self-start rounded-sm text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring", children: [_jsx(Icon, { name: "chevron-right", className: cn("size-3.5 transition-transform motion-reduce:transition-none", expanded && "rotate-90") }), t(expanded ? "kumiko.config.cascade.hideLevels" : "kumiko.config.cascade.showLevels")] })) : null, levelsPanel] }));
149
161
  }
150
162
  function CascadeLevelRow({ display, renderValue, }) {
151
163
  const t = useTranslation();
@@ -13,7 +13,8 @@ export const DrawnPencil = createLucideIcon("drawn-pencil", [
13
13
  ["path", { d: "m13 7 4 4", key: "tip" }],
14
14
  ]);
15
15
  export const DrawnFilter = createLucideIcon("drawn-filter", [
16
- ["path", { d: "M4 6h16l-6 7v5l-4 2v-7z", key: "funnel" }],
16
+ ["path", { d: "M21 4h-7M10 4H3M21 12h-9M8 12H3M21 20h-5M12 20H3", key: "lines" }],
17
+ ["path", { d: "M14 2v4M8 10v4M16 18v4", key: "knobs" }],
17
18
  ]);
18
19
  export const DrawnWand = createLucideIcon("drawn-wand", [
19
20
  [
@@ -1,8 +1,10 @@
1
1
  import { type ReactNode } from "react";
2
2
  /** Marks an app header action (e.g. the assistant trigger) that stays in the bar on a phone, next to the
3
- * bell; the rest of `headerActions` folds into the "…" menu. Inside the menu it renders nothing. */
4
- export declare function HeaderActionPinned({ children }: {
3
+ * bell; the rest of `headerActions` folds into the "…" menu. Inside the menu it renders nothing.
4
+ * `hideOnListScreens` drops it on phone entityList/projectionList screens, whose rows carry their own AI action. */
5
+ export declare function HeaderActionPinned({ children, hideOnListScreens, }: {
5
6
  readonly children: ReactNode;
7
+ readonly hideOnListScreens?: boolean;
6
8
  }): ReactNode;
7
9
  export declare function collectPinnedHeaderActions(node: ReactNode): readonly ReactNode[];
8
10
  export declare function isOnlyPinnedHeaderActions(node: ReactNode): boolean;
@@ -1,10 +1,19 @@
1
1
  import { Children, Fragment, isValidElement, useContext } from "react";
2
- import { HeaderOverflowMenuContext } from "./header-overflow-menu.js";
2
+ import { usePageHeaderCompact } from "../../index.js";
3
+ import { HeaderOverflowMenuContext, HeaderScreenTypeContext } from "./header-overflow-menu.js";
4
+ const LIST_SCREEN_TYPES = new Set([
5
+ "entityList",
6
+ "projectionList",
7
+ ]);
3
8
  /** Marks an app header action (e.g. the assistant trigger) that stays in the bar on a phone, next to the
4
- * bell; the rest of `headerActions` folds into the "…" menu. Inside the menu it renders nothing. */
5
- export function HeaderActionPinned({ children }) {
9
+ * bell; the rest of `headerActions` folds into the "…" menu. Inside the menu it renders nothing.
10
+ * `hideOnListScreens` drops it on phone entityList/projectionList screens, whose rows carry their own AI action. */
11
+ export function HeaderActionPinned({ children, hideOnListScreens = false, }) {
6
12
  const inMenu = useContext(HeaderOverflowMenuContext);
7
- return inMenu ? null : children;
13
+ const screenType = useContext(HeaderScreenTypeContext);
14
+ const compact = usePageHeaderCompact();
15
+ const onListScreen = screenType !== undefined && LIST_SCREEN_TYPES.has(screenType);
16
+ return inMenu || (hideOnListScreens && compact && onListScreen) ? null : children;
8
17
  }
9
18
  function isPinnedElement(node) {
10
19
  return isValidElement(node) && node.type === HeaderActionPinned;
@@ -2,3 +2,5 @@
2
2
  * like ThemeToggle can draw a labelled menu row instead of an icon button. */
3
3
  export declare const HeaderOverflowMenuContext: import("react").Context<boolean>;
4
4
  export declare const headerOverflowMenuItemClass: string;
5
+ /** The type of the screen the shell header currently sits above; read by HeaderActionPinned. */
6
+ export declare const HeaderScreenTypeContext: import("react").Context<"actionForm" | "configEdit" | "custom" | "dashboard" | "entityEdit" | "entityList" | "projectionDetail" | "projectionList" | "secretMint" | "secretsEdit" | undefined>;
@@ -6,3 +6,5 @@ export const HeaderOverflowMenuContext = createContext(false);
6
6
  export const headerOverflowMenuItemClass = "relative flex min-h-10 w-full cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-left text-sm " +
7
7
  "outline-none transition-colors hover:bg-accent focus:bg-accent focus:text-accent-foreground " +
8
8
  "disabled:pointer-events-none disabled:opacity-50";
9
+ /** The type of the screen the shell header currently sits above; read by HeaderActionPinned. */
10
+ export const HeaderScreenTypeContext = createContext(undefined);
@@ -13,6 +13,13 @@ const triggerClass = "relative inline-flex size-8 shrink-0 items-center justify-
13
13
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring";
14
14
  const panelClass = "z-50 flex max-h-[28rem] w-[min(22rem,calc(100vw-1.5rem))] flex-col overflow-hidden rounded-md border " +
15
15
  "bg-popover text-popover-foreground shadow-md";
16
+ function NotificationRowItem({ row, createdLabel, onOpen, }) {
17
+ const t = useTranslation();
18
+ return (_jsx("li", { children: _jsxs("button", { type: "button", "data-unread": row.isRead ? undefined : "true", className: "flex w-full items-start gap-2 border-b border-border px-3 py-2 text-left hover:bg-accent focus-visible:bg-accent focus-visible:outline-none", onClick: onOpen, children: [_jsx("span", { "aria-hidden": "true", className: cn("mt-1.5 size-2 shrink-0 rounded-full", row.isRead ? "bg-transparent" : "bg-primary") }), !row.isRead && _jsx("span", { className: "sr-only", children: t("kumiko.notifications.unread") }), _jsxs("span", { className: "min-w-0 flex-1", children: [_jsx("span", { className: cn("block truncate text-sm", !row.isRead && "font-semibold"), children: row.title }), row.body !== null && (_jsx("span", { className: "block truncate text-xs text-muted-foreground", children: row.body })), _jsx("span", { className: "block text-xs text-muted-foreground", children: createdLabel })] })] }) }));
19
+ }
20
+ function unreadBadgeText(unreadCount) {
21
+ return unreadCount > MAX_BADGE_COUNT ? `${MAX_BADGE_COUNT}+` : String(unreadCount);
22
+ }
16
23
  export function NotificationBell({ screens, menuEntry, }) {
17
24
  const t = useTranslation();
18
25
  const nav = useNav();
@@ -20,7 +27,7 @@ export function NotificationBell({ screens, menuEntry, }) {
20
27
  const formatRelative = useRelativeTimeFormatter(locale);
21
28
  const [open, setOpen] = useState(false);
22
29
  const inbox = useInAppInbox(open);
23
- const badge = inbox.unreadCount > MAX_BADGE_COUNT ? `${MAX_BADGE_COUNT}+` : String(inbox.unreadCount);
30
+ const badge = unreadBadgeText(inbox.unreadCount);
24
31
  const label = inbox.unreadCount > 0
25
32
  ? t("kumiko.notifications.labelUnread", { count: badge })
26
33
  : t("kumiko.notifications.label");
@@ -42,8 +49,10 @@ export function NotificationBell({ screens, menuEntry, }) {
42
49
  event.preventDefault();
43
50
  menuEntry.anchorRef.current?.focus();
44
51
  },
45
- }), children: [_jsxs("div", { className: "flex items-center justify-between gap-2 border-b border-border px-3 py-2", children: [_jsx("h2", { className: "text-sm font-semibold", children: t("kumiko.notifications.title") }), inbox.unreadCount > 0 && (_jsx("button", { type: "button", className: "text-xs text-primary hover:underline", onClick: () => void inbox.markAllRead(), children: t("kumiko.notifications.markAllRead") }))] }), _jsxs("div", { className: "min-h-0 flex-1 overflow-y-auto", children: [inbox.failed && (_jsx("p", { role: "alert", className: "px-3 py-4 text-sm text-destructive", children: t("kumiko.notifications.loadFailed") })), !inbox.failed && !inbox.loading && inbox.rows.length === 0 && (_jsx("p", { className: "px-3 py-6 text-center text-sm text-muted-foreground", children: t("kumiko.notifications.empty") })), _jsx("ul", { children: inbox.rows.map((row) => (_jsx("li", { children: _jsxs("button", { type: "button", "data-unread": row.isRead ? undefined : "true", className: "flex w-full items-start gap-2 border-b border-border px-3 py-2 text-left hover:bg-accent focus-visible:bg-accent focus-visible:outline-none", onClick: () => void openRow(row), children: [_jsx("span", { "aria-hidden": "true", className: cn("mt-1.5 size-2 shrink-0 rounded-full", row.isRead ? "bg-transparent" : "bg-primary") }), !row.isRead && (_jsx("span", { className: "sr-only", children: t("kumiko.notifications.unread") })), _jsxs("span", { className: "min-w-0 flex-1", children: [_jsx("span", { className: cn("block truncate text-sm", !row.isRead && "font-semibold"), children: row.title }), row.body !== null && (_jsx("span", { className: "block truncate text-xs text-muted-foreground", children: row.body })), _jsx("span", { className: "block text-xs text-muted-foreground", children: formatRelative(Date.parse(row.createdAt)) })] })] }) }, row.id))) }), inbox.hasMore && (_jsx("button", { type: "button", className: "w-full px-3 py-2 text-sm text-primary hover:bg-accent", onClick: () => void inbox.loadMore(), children: t("kumiko.notifications.loadMore") }))] })] }) }));
46
- return (_jsxs(PopoverPrimitive.Root, { open: open, onOpenChange: setOpen, children: [menuEntry === undefined ? (_jsx(PopoverPrimitive.Trigger, { asChild: true, children: _jsxs("button", { type: "button", "aria-label": label, "data-kumiko-layout": "notification-bell", className: triggerClass, children: [_jsx(Bell, { className: "size-4", "aria-hidden": "true" }), inbox.unreadCount > 0 && (_jsx("span", { "data-kumiko-layout": "notification-bell-badge", className: "absolute right-[3px] top-[3px] rounded-full bg-destructive px-1 py-0.5 text-[9.5px] font-semibold leading-none text-destructive-foreground", children: badge }))] }) })) : (_jsxs(_Fragment, { children: [_jsx(PopoverPrimitive.Anchor, { virtualRef: menuEntry.anchorRef }), _jsxs("button", { type: "button", role: "menuitem", "data-testid": "notification-bell-menu-item", className: headerOverflowMenuItemClass, onClick: () => {
52
+ }), children: [_jsxs("div", { className: "flex items-center justify-between gap-2 border-b border-border px-3 py-2", children: [_jsx("h2", { className: "text-sm font-semibold", children: t("kumiko.notifications.title") }), inbox.unreadCount > 0 && (_jsx("button", { type: "button", className: "text-xs text-primary hover:underline", onClick: () => void inbox.markAllRead(), children: t("kumiko.notifications.markAllRead") }))] }), _jsxs("div", { className: "min-h-0 flex-1 overflow-y-auto", children: [inbox.failed && (_jsx("p", { role: "alert", className: "px-3 py-4 text-sm text-destructive", children: t("kumiko.notifications.loadFailed") })), !inbox.failed && !inbox.loading && inbox.rows.length === 0 && (_jsx("p", { className: "px-3 py-6 text-center text-sm text-muted-foreground", children: t("kumiko.notifications.empty") })), _jsx("ul", { children: inbox.rows.map((row) => (_jsx(NotificationRowItem, { row: row, createdLabel: formatRelative(Date.parse(row.createdAt)), onOpen: () => void openRow(row) }, row.id))) }), inbox.hasMore && (_jsx("button", { type: "button", className: "w-full px-3 py-2 text-sm text-primary hover:bg-accent", onClick: () => void inbox.loadMore(), children: t("kumiko.notifications.loadMore") }))] })] }) }));
53
+ return (_jsxs(PopoverPrimitive.Root, { open: open, onOpenChange: setOpen, children: [menuEntry === undefined ? (
54
+ // Stays mounted while the list is open, else "mark all read" would pull the anchor away.
55
+ inbox.unreadCount > 0 || open ? (_jsx(PopoverPrimitive.Trigger, { asChild: true, children: _jsxs("button", { type: "button", "aria-label": label, "data-kumiko-layout": "notification-bell", className: triggerClass, children: [_jsx(Bell, { className: "size-4", "aria-hidden": "true" }), inbox.unreadCount > 0 && (_jsx("span", { "data-kumiko-layout": "notification-bell-badge", className: "absolute right-[3px] top-[3px] rounded-full bg-destructive px-1 py-0.5 text-[9.5px] font-semibold leading-none text-destructive-foreground", children: badge }))] }) })) : null) : (_jsxs(_Fragment, { children: [_jsx(PopoverPrimitive.Anchor, { virtualRef: menuEntry.anchorRef }), _jsxs("button", { type: "button", role: "menuitem", "data-testid": "notification-bell-menu-item", className: headerOverflowMenuItemClass, onClick: () => {
47
56
  setOpen(true);
48
57
  menuEntry.onSelect();
49
58
  }, children: [_jsx(Bell, { className: "size-4", "aria-hidden": "true" }), _jsx("span", { className: "flex-1", children: t("kumiko.notifications.label") }), inbox.unreadCount > 0 && (_jsx("span", { "data-kumiko-layout": "notification-bell-badge", className: "rounded-full bg-destructive px-1.5 py-0.5 text-[9.5px] font-semibold leading-none text-destructive-foreground", children: badge }))] })] })), panel] }));
@@ -10,6 +10,8 @@ export type PageHeaderSlot = {
10
10
  readonly setTitle: (title: string | undefined) => void;
11
11
  readonly recordTitle: string | undefined;
12
12
  readonly setRecordTitle: (recordTitle: string | undefined) => void;
13
+ readonly narrowRecordTitle: string | undefined;
14
+ readonly setNarrowRecordTitle: (title: string | undefined) => void;
13
15
  readonly bodyTitle: boolean;
14
16
  readonly setBodyTitle: (bodyTitle: boolean) => void;
15
17
  readonly breadcrumbHidden: boolean;
@@ -18,6 +18,7 @@ export function PageHeaderSlotProvider({ children }) {
18
18
  const [actionsElement, setActionsElement] = useState(null);
19
19
  const [title, setTitle] = useState(undefined);
20
20
  const [recordTitle, setRecordTitle] = useState(undefined);
21
+ const [narrowRecordTitle, setNarrowRecordTitle] = useState(undefined);
21
22
  const [bodyTitle, setBodyTitle] = useState(false);
22
23
  const [breadcrumbHidden, setBreadcrumbHidden] = useState(false);
23
24
  const [breadcrumbScreenId, setBreadcrumbScreenId] = useState(undefined);
@@ -32,6 +33,8 @@ export function PageHeaderSlotProvider({ children }) {
32
33
  setTitle,
33
34
  recordTitle,
34
35
  setRecordTitle,
36
+ narrowRecordTitle,
37
+ setNarrowRecordTitle,
35
38
  bodyTitle,
36
39
  setBodyTitle,
37
40
  breadcrumbHidden,
@@ -45,6 +48,7 @@ export function PageHeaderSlotProvider({ children }) {
45
48
  actionsElement,
46
49
  title,
47
50
  recordTitle,
51
+ narrowRecordTitle,
48
52
  bodyTitle,
49
53
  breadcrumbHidden,
50
54
  breadcrumbScreenId,
@@ -25,7 +25,10 @@ function FocusedScreenFrame({ screen, screens, children, }) {
25
25
  const hasActions = topbarActions !== undefined || overflowItems.length > 0;
26
26
  return (_jsxs(_Fragment, { children: [focused && (_jsx(MobileTopBar, { label: parentScreenId !== undefined
27
27
  ? t(screenTitleKey(parentScreenId))
28
- : (slot?.recordTitle ?? slot?.title ?? t(screenTitleKey(shortId))), back: {
28
+ : (slot?.narrowRecordTitle ??
29
+ slot?.recordTitle ??
30
+ slot?.title ??
31
+ t(screenTitleKey(shortId))), back: {
29
32
  label: t("kumiko.actions.back"),
30
33
  onClick: () => parentScreenId !== undefined
31
34
  ? nav.navigate({ screenId: parentScreenId })
@@ -3,13 +3,13 @@ import { IN_APP_NOTIFICATION_FEATURE } from "@cosmicdrift/kumiko-types/in-app-no
3
3
  import { ChevronLeft, MoreHorizontal } from "lucide-react";
4
4
  import { Fragment, useEffect, useId, useMemo, useRef, useState, } from "react";
5
5
  import { resolveNavigation } from "../../headless/index.js";
6
- import { toAppSchema, useNav, usePageHeaderCompact, useTranslation, } from "../../index.js";
6
+ import { lastSegment, toAppSchema, useNav, usePageHeaderCompact, useTranslation, } from "../../index.js";
7
7
  import { Icon, NAV_ICONS } from "../icons.js";
8
8
  import { cn } from "../lib/cn.js";
9
9
  import { Breadcrumb, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, } from "../ui/breadcrumb.js";
10
10
  import { SidebarTrigger } from "../ui/sidebar.js";
11
11
  import { collectPinnedHeaderActions, isOnlyPinnedHeaderActions } from "./header-action-pinned.js";
12
- import { HeaderOverflowMenuContext, headerOverflowMenuItemClass } from "./header-overflow-menu.js";
12
+ import { HeaderOverflowMenuContext, HeaderScreenTypeContext, headerOverflowMenuItemClass, } from "./header-overflow-menu.js";
13
13
  import { buildNavRegistrySliceForApp } from "./nav-tree.js";
14
14
  import { NotificationBell } from "./notification-bell.js";
15
15
  import { usePageHeaderSlot } from "./page-header-slot.js";
@@ -43,6 +43,9 @@ export function ShellHeader({ schema, user, headerActions: appHeaderActions, all
43
43
  const slot = usePageHeaderSlot();
44
44
  const standInScreenId = slot?.breadcrumbScreenId;
45
45
  const screenId = standInScreenId ?? nav.route?.screenId;
46
+ // The qualified id wins: two features can share a short screen id.
47
+ const screenType = (allScreens.find((s) => s.id === screenId) ??
48
+ allScreens.find((s) => lastSegment(s.id) === screenId))?.type;
46
49
  const entityId = standInScreenId !== undefined ? undefined : nav.route?.entityId;
47
50
  const crumbs = useMemo(() => {
48
51
  if (screenId === undefined)
@@ -85,8 +88,13 @@ export function ShellHeader({ schema, user, headerActions: appHeaderActions, all
85
88
  // A screen that draws its own breadcrumb hides the bar's crumbs, but its parent link stays.
86
89
  const titleCrumbs = standInUntitled ? undefined : crumbs;
87
90
  const parentCrumb = titleCrumbs !== undefined && titleCrumbs.length > 1 ? titleCrumbs.at(-2) : undefined;
88
- const parentOnly = bodyTitle && compact && parentCrumb !== undefined;
91
+ // A record's short title replaces the "‹ parent" link on the phone; going back is the gesture or menu.
92
+ const phoneRecordTitle = slot?.narrowRecordTitle ?? recordTitle;
93
+ const phoneShowsRecordTitle = bodyTitle && compact && phoneRecordTitle !== undefined;
94
+ const parentOnly = bodyTitle && compact && parentCrumb !== undefined && !phoneShowsRecordTitle;
89
95
  const bodyTitleCrumbs = () => {
96
+ if (phoneShowsRecordTitle)
97
+ return [{ label: phoneRecordTitle }];
90
98
  if (compact)
91
99
  return parentCrumb === undefined ? [] : [parentCrumb];
92
100
  const ownTitle = recordTitle ?? titleCrumbs?.at(-1)?.label;
@@ -96,7 +104,7 @@ export function ShellHeader({ schema, user, headerActions: appHeaderActions, all
96
104
  ];
97
105
  };
98
106
  const shownCrumbs = bodyTitle ? bodyTitleCrumbs() : visibleCrumbs;
99
- return (_jsxs("header", { "data-kumiko-layout": "shell-header", ...(plainNav && { "data-nav-style": "plain" }), className: cn("flex h-14 shrink-0 items-center gap-3 border-b border-border pl-1.5 pr-3 md:pl-4 md:pr-6", plainNav && "h-[58px] md:gap-2.5 md:px-5", (compact || bellInOverflow) && "relative", focused && "max-md:hidden"), children: [_jsxs("div", { className: "@container flex min-w-0 flex-1 items-center gap-3", children: [_jsx(ShellSidebarTrigger, { focused: focused, plainNav: plainNav }), _jsxs("div", { className: cn("flex min-w-0", compact ? "flex-col justify-center" : "items-center gap-3"), children: [_jsx(ShellBreadcrumb, { crumbs: shownCrumbs, parentOnly: parentOnly, bodyTitle: bodyTitle, titleOverride: titleOverride }), _jsx("div", { ref: setStatusElement, "data-kumiko-layout": "page-header-status", className: cn("flex items-center gap-2 empty:hidden", compact ? "min-w-0 max-w-full overflow-hidden whitespace-nowrap text-xs" : "shrink-0") })] })] }), _jsx(ShellHeaderEnd, { compact: compact, actionsRef: setActionsElement, headerActions: headerActions, overflowItems: slot?.overflowItems ?? [], bellScreens: showsBell ? allScreens : undefined, bellInOverflow: bellInOverflow })] }));
107
+ return (_jsxs("header", { "data-kumiko-layout": "shell-header", ...(plainNav && { "data-nav-style": "plain" }), className: cn("flex h-14 shrink-0 items-center gap-3 border-b border-border pl-1.5 pr-3 md:pl-4 md:pr-6", plainNav && "h-[58px] md:gap-2.5 md:px-5", (compact || bellInOverflow) && "relative", focused && "max-md:hidden"), children: [_jsxs("div", { className: "@container flex min-w-0 flex-1 items-center gap-3", children: [_jsx(ShellSidebarTrigger, { focused: focused, plainNav: plainNav }), _jsxs("div", { className: cn("flex min-w-0", compact ? "flex-col justify-center" : "items-center gap-3"), children: [_jsx(ShellBreadcrumb, { crumbs: shownCrumbs, parentOnly: parentOnly, bodyTitle: bodyTitle, titleOverride: titleOverride }), _jsx("div", { ref: setStatusElement, "data-kumiko-layout": "page-header-status", className: cn("flex items-center gap-2 empty:hidden", compact ? "min-w-0 max-w-full overflow-hidden whitespace-nowrap text-xs" : "shrink-0") })] })] }), _jsx(HeaderScreenTypeContext.Provider, { value: screenType, children: _jsx(ShellHeaderEnd, { compact: compact, actionsRef: setActionsElement, headerActions: headerActions, overflowItems: slot?.overflowItems ?? [], bellScreens: showsBell ? allScreens : undefined, bellInOverflow: bellInOverflow }) })] }));
100
108
  }
101
109
  function foldsIntoOverflow(overflowItems, headerActions) {
102
110
  if (overflowItems.length > 0)
@@ -117,7 +125,7 @@ function VisibleHeaderActions({ compact, headerActions, }) {
117
125
  }
118
126
  function ShellHeaderEnd({ compact, actionsRef, headerActions, overflowItems, bellScreens, bellInOverflow, }) {
119
127
  const hasOverflow = bellInOverflow || (compact && foldsIntoOverflow(overflowItems, headerActions));
120
- return (_jsxs("div", { className: cn("ml-auto flex items-center gap-2", compact ? "min-w-0 max-w-[60%]" : "min-w-0 max-w-[50%] shrink-0 sm:max-w-none"), children: [_jsx("div", { ref: actionsRef, "data-kumiko-layout": "page-header-actions", className: cn(SHELL_HEADER_CONTROLS_CLASSES, "flex min-w-0 items-center gap-2 empty:hidden [&_*]:min-w-0 [&_*]:max-w-full [&_button]:overflow-hidden [&_button]:whitespace-nowrap", compact && "overflow-hidden") }), bellScreens !== undefined && !bellInOverflow && _jsx(NotificationBell, { screens: bellScreens }), _jsx(VisibleHeaderActions, { compact: compact, headerActions: headerActions }), hasOverflow && (_jsx(HeaderOverflow, { items: compact ? overflowItems : [], headerActions: compact ? headerActions : undefined, ...(bellInOverflow && bellScreens !== undefined && { bellScreens }) }))] }));
128
+ return (_jsxs("div", { className: cn("ml-auto flex items-center gap-2", compact ? "min-w-0 max-w-[60%]" : "min-w-0 max-w-[50%] shrink-0 sm:max-w-none"), children: [!compact && _jsx(VisibleHeaderActions, { compact: compact, headerActions: headerActions }), _jsx("div", { ref: actionsRef, "data-kumiko-layout": "page-header-actions", className: cn(SHELL_HEADER_CONTROLS_CLASSES, "flex min-w-0 items-center gap-2 empty:hidden [&_*]:min-w-0 [&_*]:max-w-full [&_button]:overflow-hidden [&_button]:whitespace-nowrap", compact && "overflow-hidden") }), bellScreens !== undefined && !bellInOverflow && _jsx(NotificationBell, { screens: bellScreens }), compact && _jsx(VisibleHeaderActions, { compact: compact, headerActions: headerActions }), hasOverflow && (_jsx(HeaderOverflow, { items: compact ? overflowItems : [], headerActions: compact ? headerActions : undefined, ...(bellInOverflow && bellScreens !== undefined && { bellScreens }) }))] }));
121
129
  }
122
130
  function ShellSidebarTrigger({ focused, plainNav, }) {
123
131
  const t = useTranslation();
@@ -8,6 +8,7 @@ const ICON_COLOR_CLASS = {
8
8
  hint: "text-primary",
9
9
  info: "text-primary",
10
10
  primary: "text-primary",
11
+ assist: "text-primary",
11
12
  ok: "text-status-ok",
12
13
  warning: "text-status-warn",
13
14
  error: "text-destructive",
@@ -23,6 +24,8 @@ function variantClass(variant, compact) {
23
24
  return "border-status-ok/30 bg-status-ok-surface text-foreground";
24
25
  case "primary":
25
26
  return "border-l-4 border-l-primary bg-card text-card-foreground";
27
+ case "assist":
28
+ return "rounded-[9px] border-transparent border-l-[3px] border-l-primary bg-secondary px-3 py-2.5 text-primary font-medium";
26
29
  case "hint":
27
30
  return compact
28
31
  ? "border-border bg-card text-foreground"
@@ -47,11 +50,19 @@ function BannerText({ compact, title: fullTitle, narrowTitle, narrowText, titleT
47
50
  const title = narrow && narrowTitle !== undefined ? narrowTitle : fullTitle;
48
51
  const showsNarrowText = narrow && narrowText !== undefined;
49
52
  const children = showsNarrowText ? narrowText : fullText;
50
- if (compact || inline) {
51
- return (_jsxs("div", { className: cn("min-w-0 grow", wrapsActions && "max-sm:min-w-[10rem] max-sm:basis-0"), children: [title !== undefined && (_jsxs(_Fragment, { children: [_jsx("strong", { "data-testid": titleTestId, className: "font-semibold", children: title }), " "] })), _jsxs("span", { className: cn(inline && !showsNarrowText && "max-sm:hidden"), children: [children, !showsNarrowText && _jsx(BannerParts, { parts: parts })] })] }));
52
- }
53
+ const text = { title, children, showsNarrowText, titleTestId, parts, wrapsActions };
54
+ if (inline && !compact && title !== undefined)
55
+ return _jsx(InlineTitledBannerText, { ...text });
56
+ if (compact || inline)
57
+ return _jsx(CompactBannerText, { inline: inline, ...text });
53
58
  return (_jsxs("div", { className: "min-w-0 flex-1", children: [title !== undefined && (_jsx("div", { "data-testid": titleTestId, className: "font-semibold", children: title })), children, !showsNarrowText && _jsx(BannerParts, { parts: parts }), actionsBelow] }));
54
59
  }
60
+ function InlineTitledBannerText({ title, children, showsNarrowText, titleTestId, parts, wrapsActions, }) {
61
+ return (_jsxs("div", { className: cn("min-w-0 grow", wrapsActions && "max-sm:min-w-[10rem] max-sm:basis-0"), children: [_jsx("div", { "data-testid": titleTestId, className: cn("text-xs text-muted-foreground", !showsNarrowText && "max-sm:text-sm max-sm:font-semibold max-sm:text-foreground"), children: title }), _jsxs("div", { className: cn(!showsNarrowText && "max-sm:hidden"), children: [children, !showsNarrowText && _jsx(BannerParts, { parts: parts })] })] }));
62
+ }
63
+ function CompactBannerText({ inline, title, children, showsNarrowText, titleTestId, parts, wrapsActions, }) {
64
+ return (_jsxs("div", { className: cn("min-w-0 grow", wrapsActions && "max-sm:min-w-[10rem] max-sm:basis-0"), children: [title !== undefined && (_jsxs(_Fragment, { children: [_jsx("strong", { "data-testid": titleTestId, className: "font-semibold", children: title }), " "] })), _jsxs("span", { className: cn(inline && !showsNarrowText && "max-sm:hidden"), children: [children, !showsNarrowText && _jsx(BannerParts, { parts: parts })] })] }));
65
+ }
55
66
  function bannerLayoutClass(variant, compact, actionsBelow, wrapsActions) {
56
67
  return cn("relative flex w-full items-center border", compact ? "gap-2 rounded-md px-2.5 py-2 text-[13px]" : "gap-3 rounded-lg px-3.5 py-2.5 text-sm",
57
68
  // Viewport breakpoint like the form footer bar; actions drop below the text on phones.
@@ -11,12 +11,14 @@ function cardBodyPadding(inline, hasHeader) {
11
11
  ? "px-[var(--card-padding)] pb-[var(--card-padding)]"
12
12
  : "p-[var(--card-padding)]";
13
13
  }
14
- function CardTitleRow({ slots, inline, }) {
14
+ function CardTitleRow({ slots, inline, labelTitle, }) {
15
15
  const { title, subtitle, headerActions } = slots;
16
16
  if (inline) {
17
17
  return (_jsxs("div", { className: "flex flex-wrap items-baseline gap-x-2.5 gap-y-1", children: [title !== undefined && _jsx("h3", { className: "m-0 text-sm font-semibold", children: title }), subtitle !== undefined && (_jsx("div", { className: "text-[12.5px] text-muted-foreground", children: subtitle })), headerActions !== undefined && _jsx("div", { className: "ml-auto", children: headerActions })] }));
18
18
  }
19
- return (_jsxs("div", { className: "flex flex-wrap items-start justify-between gap-3", children: [_jsxs("div", { className: "flex flex-col gap-1", children: [title !== undefined && (_jsx("h3", { className: "text-base font-semibold leading-none tracking-tight", children: title })), subtitle !== undefined && _jsx("div", { className: "text-sm text-muted-foreground", children: subtitle })] }), headerActions] }));
19
+ return (_jsxs("div", { className: "flex flex-wrap items-start justify-between gap-3", children: [_jsxs("div", { className: "flex flex-col gap-1", children: [title !== undefined && (_jsx("h3", { className: labelTitle
20
+ ? "text-[12.5px] font-semibold uppercase leading-none tracking-[0.06em] text-muted-foreground"
21
+ : "text-base font-semibold leading-none tracking-tight", children: title })), subtitle !== undefined && _jsx("div", { className: "text-sm text-muted-foreground", children: subtitle })] }), headerActions] }));
20
22
  }
21
23
  // Generic card chrome (rounded-xl like the entity card), slot- and
22
24
  // options-based so the contract grows additively and consumers never have
@@ -32,7 +34,7 @@ export function DefaultCard({ slots, options, className, testId, dataAttributes,
32
34
  const s = slots ?? {};
33
35
  const inlineHeader = options?.headerLayout === "inline";
34
36
  const hasTitleRow = s.title !== undefined || s.subtitle !== undefined || s.headerActions !== undefined;
35
- const defaultHeader = hasTitleRow || s.headerContent !== undefined ? (_jsxs("div", { className: cn("flex flex-col gap-3", inlineHeader ? "px-4 pt-3.5" : "px-[var(--card-padding)] pt-6 pb-4", fillHeight && "shrink-0"), children: [hasTitleRow && _jsx(CardTitleRow, { slots: s, inline: inlineHeader }), s.headerContent] })) : null;
37
+ const defaultHeader = hasTitleRow || s.headerContent !== undefined ? (_jsxs("div", { className: cn("flex flex-col gap-3", inlineHeader ? "px-4 pt-3.5" : "px-[var(--card-padding)] pt-6 pb-4", fillHeight && "shrink-0"), children: [hasTitleRow && (_jsx(CardTitleRow, { slots: s, inline: inlineHeader, labelTitle: options?.titleStyle === "label" })), s.headerContent] })) : null;
36
38
  const header = s.header ?? defaultHeader;
37
39
  const hasHeader = header !== null && header !== undefined;
38
40
  const card = (_jsxs("div", { ...dataAttributes, "data-slot": "card", "data-testid": testId, className: cn(framed ? cardSurface({ radius }) : "flex flex-col",
@@ -19,8 +19,8 @@ import { useEffect, useState } from "react";
19
19
  import { REFERENCE_SEARCH_DEBOUNCE_MS, useTranslation } from "../../index.js";
20
20
  import { cn } from "../lib/cn.js";
21
21
  import { groupOptions } from "./option-groups.js";
22
- const triggerClass = "flex h-9 w-full min-w-0 items-center justify-between gap-2 " +
23
- "rounded-md border border-input text-left max-md:min-h-11 " +
22
+ const triggerClass = "flex h-[38px] w-full min-w-0 items-center justify-between gap-2 " +
23
+ "rounded-[7px] border-[1.5px] border-input text-left max-md:min-h-11 " +
24
24
  "bg-transparent px-3 py-1 text-sm shadow-sm transition-colors " +
25
25
  "placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 " +
26
26
  "focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50";
@@ -19,7 +19,7 @@ export function ActionsHeaderCell({ label, style, absorbsLeftover, }) {
19
19
  // preceding data column instead of the (already narrow)
20
20
  // page edge. No border-l: a permanent divider looks heavy;
21
21
  // the sticky bg already sets the column apart during scroll.
22
- className: "w-px text-right text-muted-foreground md:sticky md:right-0 md:z-10 md:bg-muted", "aria-label": label, style: absorbsLeftover ? { ...style, width: "auto" } : style }));
22
+ className: "w-px text-right text-muted-foreground md:sticky md:right-0 md:z-10 md:bg-background", "aria-label": label, style: absorbsLeftover ? { ...style, width: "auto" } : style }));
23
23
  }
24
24
  export function ActionsBodyCell({ testId, fillsHeight, measureContent, children, }) {
25
25
  return (_jsx(TableCell, { "data-testid": testId,
@@ -1,5 +1,5 @@
1
1
  import { type cardColumnRoles } from "@cosmicdrift/kumiko-framework/ui-types";
2
- import type { ReactNode } from "react";
2
+ import { type ReactNode } from "react";
3
3
  import type { ListColumnViewModel, ListRowViewModel } from "../../../headless/index.ts";
4
4
  import type { DataTableModel } from "./use-data-table-state.ts";
5
5
  export type CardRoles = ReturnType<typeof cardColumnRoles<ListColumnViewModel>>;