@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
@@ -0,0 +1,25 @@
1
+ /** Card-Options — Verhalten/Optik, ebenfalls additiv erweiterbar. */
2
+ export type CardOptions = {
3
+ /** Body-Padding (px-6 py-6). false = randlos (Tabelle/eigene Tiles). Default true. */
4
+ readonly padded?: boolean;
5
+ /** Eckenradius. Default "xl" (= Entity-Card). */
6
+ readonly radius?: "lg" | "xl";
7
+ /** Separates the footer with `border-t` and `bg-muted/30`. Defaults to true. */
8
+ readonly footerBordered?: boolean;
9
+ /** Footer horizontal padding. false = none, so footer content aligns with the card edge. Default true. */
10
+ readonly footerInset?: boolean;
11
+ /** Joins the ancestor fillHeight flex chain — a tabs-mode
12
+ * relatedList table sizing to the panel instead of the page — instead of
13
+ * normal document-flow height. Default false. */
14
+ readonly fillHeight?: boolean;
15
+ /** false drops border, background, shadow and radius but keeps padding and
16
+ * header slots — a panel inside a host surface such as a tab panel. Default true. */
17
+ readonly framed?: boolean;
18
+ /** The card is the whole screen body (secretMint reveal and done phase):
19
+ * no frame, the shared screen insets and width of form screens, children
20
+ * stacked with a gap. Without it such a screen sits raw against the
21
+ * shell edge. Default false. */
22
+ readonly screenBody?: boolean;
23
+ /** "inline": title and subtitle on one baseline row at 16px inset, compact padding (the board's side panel). Default "stacked". */
24
+ readonly headerLayout?: "stacked" | "inline";
25
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -8,6 +8,11 @@ export type ListEmptyStateContent = {
8
8
  export type NamedFilterEmptyContent = {
9
9
  readonly title: string;
10
10
  readonly description?: string;
11
+ /** The description needs params from a query; it renders only once the query returned an object. */
12
+ readonly describedByQuery?: {
13
+ readonly query: string;
14
+ readonly describe: (params: Readonly<Record<string, unknown>>) => string;
15
+ };
11
16
  readonly onReset: () => void;
12
17
  };
13
18
  export declare function ListEmptyStateBody({ content, narrowed, namedFilterEmpty, defaultFilterActive, onShowAll, createButton, translate, }: {
@@ -1,13 +1,29 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useState } from "react";
3
3
  import { ErrorReference } from "../app/error-reference.js";
4
+ import { useQuery } from "../hooks/use-query.js";
4
5
  import { usePrimitives } from "../primitives.js";
5
6
  import { RenderEditActionButton } from "./render-edit-action-button.js";
7
+ function isParamsRecord(value) {
8
+ return typeof value === "object" && value !== null && !Array.isArray(value);
9
+ }
10
+ function QueryDescription({ query, describe, }) {
11
+ const { Text } = usePrimitives();
12
+ const result = useQuery(query, {});
13
+ if (!isParamsRecord(result.data))
14
+ return null;
15
+ return _jsx(Text, { variant: "small", children: describe(result.data) });
16
+ }
17
+ function NamedFilterEmptyText({ content, }) {
18
+ const { Text } = usePrimitives();
19
+ const { description, describedByQuery } = content;
20
+ return (_jsxs(_Fragment, { children: [_jsx(Text, { children: content.title }), description !== undefined && _jsx(Text, { variant: "small", children: description }), describedByQuery !== undefined && (_jsx(QueryDescription, { query: describedByQuery.query, describe: describedByQuery.describe }))] }));
21
+ }
6
22
  export function ListEmptyStateBody({ content, narrowed, namedFilterEmpty, defaultFilterActive = false, onShowAll, createButton, translate, }) {
7
23
  const { Text, Button, Dialog, Banner } = usePrimitives();
8
24
  const [actionError, setActionError] = useState(null);
9
25
  if (narrowed && namedFilterEmpty !== undefined) {
10
- return (_jsxs(_Fragment, { children: [_jsx(Text, { children: namedFilterEmpty.title }), namedFilterEmpty.description !== undefined && (_jsx(Text, { variant: "small", children: namedFilterEmpty.description })), _jsx(Button, { variant: "secondary", onClick: namedFilterEmpty.onReset, testId: "render-list-empty-reset-filter", children: translate("kumiko.list.empty.resetFilter") })] }));
26
+ return (_jsxs(_Fragment, { children: [_jsx(NamedFilterEmptyText, { content: namedFilterEmpty }), _jsx(Button, { variant: "secondary", onClick: namedFilterEmpty.onReset, testId: "render-list-empty-reset-filter", children: translate("kumiko.list.empty.resetFilter") })] }));
11
27
  }
12
28
  if (narrowed)
13
29
  return _jsx(Text, { children: translate("kumiko.list.empty.filtered") });
@@ -5,4 +5,5 @@ export declare function hintViewModel(hint: ListColumnHint, rowToneField: string
5
5
  export declare function withDisplayColumns(columns: readonly ListColumnViewModel[], screen: EntityListScreenDefinition): readonly ListColumnViewModel[];
6
6
  export declare function withEmptyPlaceholderColumns(columns: readonly ListColumnViewModel[], screen: EntityListScreenDefinition): readonly ListColumnViewModel[];
7
7
  export declare function withNarrowOnlyColumns(columns: readonly ListColumnViewModel[], screen: EntityListScreenDefinition): readonly ListColumnViewModel[];
8
+ export declare function withNarrowInlineColumns(columns: readonly ListColumnViewModel[], screen: EntityListScreenDefinition): readonly ListColumnViewModel[];
8
9
  export declare function withHintColumns(columns: readonly ListColumnViewModel[], screen: EntityListScreenDefinition, translate: Translate): readonly ListColumnViewModel[];
@@ -12,6 +12,7 @@ export function hintViewModel(hint, rowToneField, translate) {
12
12
  ...(hint.reasonTitleField !== undefined && { reasonTitleField: hint.reasonTitleField }),
13
13
  ...(hint.detailField !== undefined && { detailField: hint.detailField }),
14
14
  ...(hint.narrowDetailField !== undefined && { narrowDetailField: hint.narrowDetailField }),
15
+ ...(hint.narrowField !== undefined && { narrowField: hint.narrowField }),
15
16
  ...(hint.plainSentence === true && { plainSentence: true }),
16
17
  ...(toneField !== undefined && { toneField }),
17
18
  };
@@ -49,6 +50,15 @@ export function withNarrowOnlyColumns(columns, screen) {
49
50
  return columns;
50
51
  return columns.map((col) => narrowOnly.has(col.field) ? { ...col, showOnNarrowOnly: true } : col);
51
52
  }
53
+ export function withNarrowInlineColumns(columns, screen) {
54
+ const inline = new Set(screen.columns.flatMap((spec) => {
55
+ const column = normalizeListColumn(spec);
56
+ return column.narrowInline === true ? [column.field] : [];
57
+ }));
58
+ if (inline.size === 0)
59
+ return columns;
60
+ return columns.map((col) => (inline.has(col.field) ? { ...col, narrowInline: true } : col));
61
+ }
52
62
  // The hint cell owns its rendering: DataTableCell ignores the column's renderer and links once a hint is set.
53
63
  export function withHintColumns(columns, screen, translate) {
54
64
  const hints = new Map();
@@ -1,4 +1,4 @@
1
- import type { EntityListScreenDefinition } from "@cosmicdrift/kumiko-framework/ui-types";
1
+ import type { EntityListScreenDefinition, ListToolbarActionsPlacement } from "@cosmicdrift/kumiko-framework/ui-types";
2
2
  import type { Translate } from "../headless/index.ts";
3
3
  import { type ActionMenuItemSpec } from "../primitives.tsx";
4
4
  import type { ToolbarActionButton } from "./render-list-toolbar-action.tsx";
@@ -8,7 +8,7 @@ type ToolbarModelInput = {
8
8
  readonly pageHeaderSlotAvailable: boolean;
9
9
  readonly pageHeaderCompact: boolean;
10
10
  readonly createInPageHeader: boolean;
11
- readonly toolbarActionsPlacement: "header" | "toolbar" | undefined;
11
+ readonly toolbarActionsPlacement: ListToolbarActionsPlacement | undefined;
12
12
  };
13
13
  export declare function withPlusIconFallback(action: ToolbarActionButton, actions: readonly ToolbarActionButton[]): ToolbarActionButton;
14
14
  export type ToolbarActionSplit = {
@@ -2,7 +2,7 @@ import { normalizeListColumn } from "@cosmicdrift/kumiko-framework/ui-types";
2
2
  import { useMemo } from "react";
3
3
  import { useReferenceLinkResolver, useScreenLinkResolver, } from "../app/reference-link.js";
4
4
  import { computeListViewModel } from "../headless/index.js";
5
- import { withDisplayColumns, withEmptyPlaceholderColumns, withHintColumns, withNarrowOnlyColumns, } from "./render-list-hint-columns.js";
5
+ import { withDisplayColumns, withEmptyPlaceholderColumns, withHintColumns, withNarrowInlineColumns, withNarrowOnlyColumns, } from "./render-list-hint-columns.js";
6
6
  import { enrichReferenceColumns, selectReferenceColumns } from "./render-list-reference-columns.js";
7
7
  import { useReferenceColumnLookups } from "./use-reference-column-lookups.js";
8
8
  /** Cell link to the screen a row names in `screenField`, parametrized by the row's `paramsField` object. */
@@ -52,7 +52,7 @@ export function useRenderListColumns(input) {
52
52
  const { referenceRequests, handleLookupMap, referenceLookups } = useReferenceColumnLookups(rows, referenceColumns);
53
53
  const resolveReferenceLink = useReferenceLinkResolver();
54
54
  const resolveScreenLink = useScreenLinkResolver();
55
- const enrichedColumns = useMemo(() => withNarrowOnlyColumns(withDisplayColumns(withHintColumns(withScreenLinks(enrichReferenceColumns({
55
+ const enrichedColumns = useMemo(() => withNarrowOnlyColumns(withNarrowInlineColumns(withDisplayColumns(withHintColumns(withScreenLinks(enrichReferenceColumns({
56
56
  // Flag first: the reference renderer reads it while it is built.
57
57
  columns: withEmptyPlaceholderColumns(vm.columns, screen),
58
58
  referenceColumns,
@@ -60,7 +60,7 @@ export function useRenderListColumns(input) {
60
60
  resolveReferenceLink,
61
61
  featureName,
62
62
  translate,
63
- }), screen, resolveScreenLink), screen, translate), screen), screen), [
63
+ }), screen, resolveScreenLink), screen, translate), screen), screen), screen), [
64
64
  vm.columns,
65
65
  referenceColumns,
66
66
  referenceLookups,
@@ -10,5 +10,5 @@ export declare function ScreenFocusProvider({ children }: {
10
10
  readonly children: ReactNode;
11
11
  }): ReactNode;
12
12
  export declare function useScreenFocus(): ScreenFocus | null;
13
- /** Reports the focus while the calling screen is mounted; compared by value, cleared on unmount. */
13
+ /** Reports the focus while the calling screen is mounted; compared by value, cleared on unmount unless another screen has reported since. */
14
14
  export declare function useSetScreenFocus(focus: ScreenFocus | null): void;
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { createContext, useContext, useEffect, useRef, useState } from "react";
2
+ import { createContext, useContext, useEffect, useRef, useState, } from "react";
3
3
  const ScreenFocusContext = createContext(null);
4
4
  const noopSetScreenFocus = () => { };
5
5
  const SetScreenFocusContext = createContext(noopSetScreenFocus);
@@ -10,7 +10,7 @@ export function ScreenFocusProvider({ children }) {
10
10
  export function useScreenFocus() {
11
11
  return useContext(ScreenFocusContext);
12
12
  }
13
- /** Reports the focus while the calling screen is mounted; compared by value, cleared on unmount. */
13
+ /** Reports the focus while the calling screen is mounted; compared by value, cleared on unmount unless another screen has reported since. */
14
14
  export function useSetScreenFocus(focus) {
15
15
  const setFocus = useContext(SetScreenFocusContext);
16
16
  const key = focus === null ? null : JSON.stringify(focus);
@@ -23,6 +23,6 @@ export function useSetScreenFocus(focus) {
23
23
  const stableFocus = lastReported.current.focus;
24
24
  useEffect(() => {
25
25
  setFocus(stableFocus);
26
- return () => setFocus(null);
26
+ return () => setFocus((current) => (current === stableFocus ? null : current));
27
27
  }, [setFocus, stableFocus]);
28
28
  }
@@ -18,6 +18,8 @@ export type DataTableFacet = {
18
18
  readonly showCounts?: boolean;
19
19
  /** Chips only: hide chips whose `count` is 0 (unless pressed). */
20
20
  readonly hideEmpty?: boolean;
21
+ /** Below `sm` the facet opens behind the filter icon next to the search field instead of standing as a pill. */
22
+ readonly narrowPlacement?: "behind-filter";
21
23
  /** Present: the options come from a server-side search (reference facets), so the dropdown
22
24
  * shows a search field and reports the typed term instead of filtering `options` itself. */
23
25
  readonly onSearchChange?: (query: string) => void;
@@ -30,6 +32,8 @@ export type DataTableFacetChip = {
30
32
  readonly label: string;
31
33
  /** Selection a click sets; `[]` clears the facet. */
32
34
  readonly values: readonly string[];
35
+ /** Select display: a divider line follows this chip. */
36
+ readonly separatorAfter?: boolean;
33
37
  /** Matching row count, undefined while unknown. */
34
38
  readonly count?: number;
35
39
  };
@@ -9,7 +9,7 @@ export { applyFormatSpec, currencyDecimals, DOCUMENT_FALLBACK_CURRENCY, EMPTY_VA
9
9
  export type { NavDefinition, NavNode, NavRegistrySlice, NavTree, ResolveNavigationOptions, } from "./nav/index.ts";
10
10
  export { resolveNavigation } from "./nav/index.ts";
11
11
  export { pluralKey } from "./plural-key.ts";
12
- export { PWA_SERVICE_WORKER_META_NAME } from "./pwa-service-worker-meta.ts";
12
+ export { PWA_CACHE_NAME_PREFIX, PWA_CACHE_SCOPE_HASH_LENGTH, PWA_SERVICE_WORKER_META_NAME, pwaCacheScopePrefixOf, } from "./pwa-service-worker-meta.ts";
13
13
  export type { Store, WritableStore } from "./store/index.ts";
14
14
  export { createStore, shallowEqual } from "./store/index.ts";
15
15
  export type { CellLink, CellLinkItem, ComputeEditViewModelInput, ComputeListViewModelInput, DerivedCellRoundingTarget, EditExtensionSectionViewModel, EditFieldSpec, EditFieldsSectionViewModel, EditFieldViewModel, EditFormMode, EditRelatedListSectionViewModel, EditSectionSpec, EditSectionViewModel, EditViewModel, EditWriteFormSectionViewModel, EmbeddedDerivedOp, EmbeddedListCellViewModel, EmbeddedListIssueGroups, FieldConditionCtx, FieldRenderer, ListColumnCellDisplay, ListColumnFileDisplay, ListColumnHintViewModel, ListColumnSpec, ListColumnViewModel, ListRowViewModel, ListViewModel, RuntimeCellLink, RuntimeCellLinkItems, RuntimeRenderer, ScreenSlots, Translate, } from "./view-model/index.ts";
@@ -6,6 +6,6 @@ export { createFormController, groupIssuesByPath, I18N_KEY_PARAM, relevantFieldI
6
6
  export { applyFormatSpec, currencyDecimals, DOCUMENT_FALLBACK_CURRENCY, EMPTY_VALUE_PLACEHOLDER, escapeHtml, escapeHtmlAttr, escapeXml, formatDocumentDate, formatDocumentMoney, formatDocumentPercent, formatMoney, html, isSafeHref, RawHtml, raw, resolveSafeMoneyLocale, stripControlChars, toInstant, } from "./format/index.js";
7
7
  export { resolveNavigation } from "./nav/index.js";
8
8
  export { pluralKey } from "./plural-key.js";
9
- export { PWA_SERVICE_WORKER_META_NAME } from "./pwa-service-worker-meta.js";
9
+ export { PWA_CACHE_NAME_PREFIX, PWA_CACHE_SCOPE_HASH_LENGTH, PWA_SERVICE_WORKER_META_NAME, pwaCacheScopePrefixOf, } from "./pwa-service-worker-meta.js";
10
10
  export { createStore, shallowEqual } from "./store/index.js";
11
11
  export { buildOptionLabels, computeDerivedCellValue, computeEditViewModel, computeListViewModel, computeRelatedListSectionViewModel, embeddedCellLabelKey, embeddedCellOptionLabelKey, fieldLabelKey, fieldOptionLabelKey, fieldOptionLabelKeyPrefix, groupEmbeddedListIssues, roundDerivedCellValue, sumEmbeddedListColumn, withDerivedCells, } from "./view-model/index.js";
@@ -1 +1,4 @@
1
1
  export declare const PWA_SERVICE_WORKER_META_NAME = "kumiko-pwa-sw";
2
+ export declare const PWA_CACHE_NAME_PREFIX = "kumiko-pwa-";
3
+ export declare const PWA_CACHE_SCOPE_HASH_LENGTH = 8;
4
+ export declare function pwaCacheScopePrefixOf(scopePath: string): Promise<string>;
@@ -1,3 +1,13 @@
1
1
  // The server writes this meta into the HTML shell only when the app enables `pwa`, and the
2
2
  // web client registers the service worker named in its content only when it finds it.
3
3
  export const PWA_SERVICE_WORKER_META_NAME = "kumiko-pwa-sw";
4
+ // CacheStorage is shared by the whole origin, so each base path gets its own prefix to keep one
5
+ // app's activation from deleting the precache of another app on the same origin.
6
+ export const PWA_CACHE_NAME_PREFIX = "kumiko-pwa-";
7
+ export const PWA_CACHE_SCOPE_HASH_LENGTH = 8;
8
+ // Must match the prefix the server derives from the shell URL, which equals the worker's scope path.
9
+ export async function pwaCacheScopePrefixOf(scopePath) {
10
+ const digest = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(scopePath));
11
+ const hex = Array.from(new Uint8Array(digest), (byte) => byte.toString(16).padStart(2, "0")).join("");
12
+ return `${PWA_CACHE_NAME_PREFIX}${hex.slice(0, PWA_CACHE_SCOPE_HASH_LENGTH)}-`;
13
+ }
@@ -60,6 +60,8 @@ export type ListColumnViewModel = {
60
60
  readonly hideOnNarrow?: boolean;
61
61
  /** Mirrors `ListColumnSpec.showOnNarrowOnly`: the table layout skips the column. */
62
62
  readonly showOnNarrowOnly?: boolean;
63
+ /** Mirrors `ListColumnSpec.narrowInline`: the card draws consecutive such columns on one line. */
64
+ readonly narrowInline?: boolean;
63
65
  /** Only for `type: "number"` — mirrors `NumberFieldDef.grouping` (default
64
66
  * `true`). `false` renders without thousands-separators (e.g. a model
65
67
  * year). */
@@ -87,6 +89,8 @@ export type ListColumnHintViewModel = {
87
89
  readonly detailField?: string;
88
90
  /** `ListColumnHint.narrowDetailField`: replaces `detailField` in the phone card. */
89
91
  readonly narrowDetailField?: string;
92
+ /** `ListColumnHint.narrowField`: replaces the sentence value in the phone card. */
93
+ readonly narrowField?: string;
90
94
  readonly toneField?: string;
91
95
  readonly reasonField?: string;
92
96
  readonly reasonOpenField?: string;
@@ -156,7 +156,6 @@ export const kumikoDefaultTranslations = {
156
156
  "kumiko.pager.status": "{from}–{to} of {total}",
157
157
  "kumiko.pager.goToPage": "Page {page}",
158
158
  "kumiko.form.all-required": "All fields are required.",
159
- "kumiko.pager.status.noun": "{from}–{to} of {total} {noun}",
160
159
  "kumiko.pager.pageSize": "{size} per page",
161
160
  "kumiko.pager.pageSizeLabel": "Entries per page",
162
161
  "kumiko.list.count.noun": "{count} {noun}",
@@ -284,6 +283,8 @@ export const kumikoDefaultTranslations = {
284
283
  "kumiko.widget.message-thread.showImages": "Load images",
285
284
  "kumiko.widget.message-reader.mail": "Mail",
286
285
  "kumiko.widget.step-list.progress": "{done} of {total} done",
286
+ "kumiko.widget.step-list.total.one": "1 step",
287
+ "kumiko.widget.step-list.total.other": "{count} steps",
287
288
  "kumiko.widget.step-list.progressLabel": "Progress",
288
289
  "kumiko.widget.step-list.moreSteps": "and {count} more steps",
289
290
  "kumiko.widget.step-list.waitingFor": "Waiting for: {reason}",
@@ -17,6 +17,8 @@ export type MetricProps = {
17
17
  readonly icon?: NavIconKey;
18
18
  /** Small muted line under the value (see `MetricSpec.subField`). */
19
19
  readonly sub?: string;
20
+ /** Replaces `sub` below `sm` (see `MetricSpec.subFieldNarrow`). */
21
+ readonly narrowSub?: string;
20
22
  };
21
23
  /** Band above the tabs of a record detail: optional subtitle line plus the
22
24
  * metrics as a definition list. `children` are `Metric` tiles. */
@@ -33,6 +33,8 @@ export type RecordStepsProps = {
33
33
  readonly items: readonly {
34
34
  readonly id: string;
35
35
  readonly title: string;
36
+ /** Replaces `title` below the sm breakpoint. */
37
+ readonly narrowTitle?: string;
36
38
  readonly detail?: string;
37
39
  /** Replaces `detail` below the sm breakpoint. */
38
40
  readonly narrowDetail?: string;
@@ -1,6 +1,7 @@
1
1
  import type { ConfigCascade, ConfigScope, ConfigValueSource } from "@cosmicdrift/kumiko-framework/engine";
2
2
  import type { FieldIconKey, FormWidth, IconKey, NavIconKey, RowActionDisplay, SelectOptionTone } from "@cosmicdrift/kumiko-framework/ui-types";
3
3
  import { type ComponentType, type FormEvent, type KeyboardEvent, type ReactNode, type Ref } from "react";
4
+ import type { CardOptions } from "./card-options.ts";
4
5
  import type { DataTableBulk } from "./data-table-bulk-types.ts";
5
6
  import type { DataTableDateRangeFacet, DataTableFacet } from "./data-table-facet-types.ts";
6
7
  import type { DataTableTableBlock } from "./data-table-view-types.ts";
@@ -126,6 +127,10 @@ export type BannerProps = {
126
127
  readonly icon?: NavIconKey;
127
128
  /** Bold heading above `children`, inside the text column. */
128
129
  readonly title?: ReactNode;
130
+ /** Replaces `title` below sm. */
131
+ readonly narrowTitle?: ReactNode;
132
+ /** Replaces `children` below sm and stays visible there even when `inline` drops the text. */
133
+ readonly narrowText?: ReactNode;
129
134
  readonly titleTestId?: string;
130
135
  readonly children?: ReactNode;
131
136
  /** Structured text after `children`; `strong` parts render emphasized.
@@ -722,7 +727,7 @@ export type DataTableProps = {
722
727
  * - `"inline"`: ALWAYS inline buttons, left-aligned, even with >2 (no
723
728
  * kebab). Actions then sit at the same x-position across all rows
724
729
  * (no drifting with label width) and all lists in an app look alike.
725
- * - `"menu"`: every action in the kebab, the row opener included; phone cards draw none. */
730
+ * - `"menu"`: every action in the kebab, the row opener included; phone cards draw none when the row opens, a card without a row target keeps it. */
726
731
  readonly rowActionMode?: DataTableRowActionMode;
727
732
  /** Present: row checkboxes plus a selection bar that runs these actions once per selected row. */
728
733
  readonly bulk?: DataTableBulk;
@@ -1168,29 +1173,7 @@ export type CardSlots = {
1168
1173
  /** Footer content, separated by a top border; aligned to the right by default. */
1169
1174
  readonly footer?: ReactNode;
1170
1175
  };
1171
- /** Card-Options — Verhalten/Optik, ebenfalls additiv erweiterbar. */
1172
- export type CardOptions = {
1173
- /** Body-Padding (px-6 py-6). false = randlos (Tabelle/eigene Tiles). Default true. */
1174
- readonly padded?: boolean;
1175
- /** Eckenradius. Default "xl" (= Entity-Card). */
1176
- readonly radius?: "lg" | "xl";
1177
- /** Separates the footer with `border-t` and `bg-muted/30`. Defaults to true. */
1178
- readonly footerBordered?: boolean;
1179
- /** Footer horizontal padding. false = none, so footer content aligns with the card edge. Default true. */
1180
- readonly footerInset?: boolean;
1181
- /** Joins the ancestor fillHeight flex chain — a tabs-mode
1182
- * relatedList table sizing to the panel instead of the page — instead of
1183
- * normal document-flow height. Default false. */
1184
- readonly fillHeight?: boolean;
1185
- /** false drops border, background, shadow and radius but keeps padding and
1186
- * header slots — a panel inside a host surface such as a tab panel. Default true. */
1187
- readonly framed?: boolean;
1188
- /** The card is the whole screen body (secretMint reveal and done phase):
1189
- * no frame, the shared screen insets and width of form screens, children
1190
- * stacked with a gap. Without it such a screen sits raw against the
1191
- * shell edge. Default false. */
1192
- readonly screenBody?: boolean;
1193
- };
1176
+ export type { CardOptions };
1194
1177
  /** Generic card chrome (border/background/radius/shadow plus
1195
1178
  * header/body/footer) as a primitive, providing one implementation for all
1196
1179
  * card surfaces. It is slot- and option-based so the contract can evolve
@@ -60,7 +60,7 @@ function renderDateStamp(model) {
60
60
  const { screen } = model;
61
61
  if (screen.showUpdatedAt === false || !hasDataPanel(screen.panels))
62
62
  return null;
63
- return (_jsx("span", { "data-testid": `dashboard-${screen.id}-updated-at`, className: "whitespace-nowrap text-sm text-muted-foreground max-sm:hidden", children: model.formatLongDate(model.loadedAtMs) }));
63
+ return (_jsx("span", { "data-testid": `dashboard-${screen.id}-updated-at`, className: "whitespace-nowrap text-[13px] text-muted-foreground max-sm:hidden", children: model.formatLongDate(model.loadedAtMs) }));
64
64
  }
65
65
  function hasDataPanel(panels) {
66
66
  return panels.some((panel) => panel.kind === "text"
@@ -8,6 +8,7 @@ import { hintViewModel } from "../../components/render-list-hint-columns.js";
8
8
  import { screenLinkFor } from "../../components/use-render-list-columns.js";
9
9
  import { extensionSectionName, useAppFeatures, useExtensionSectionComponent, usePrimitives, useUserRoles, } from "../../index.js";
10
10
  import { useIsBelowSmViewport } from "../primitives/use-narrow-viewport.js";
11
+ import { dashboardListCellText } from "../widgets/dashboard-list.js";
11
12
  import { dashboardNavigationLink } from "./dashboard-navigation-link.js";
12
13
  import { DashboardReferenceListTable, } from "./dashboard-reference-list-table.js";
13
14
  import { QueryPanel, useDashboardFormats } from "./dashboard-shared.js";
@@ -64,16 +65,6 @@ function rowLinkResolverOf(rowLink, resolveScreenLink) {
64
65
  const { paramField, screen } = rowLink;
65
66
  return (row) => resolveScreenLink(screen, paramField === undefined ? undefined : row[paramField]);
66
67
  }
67
- // The same number and date formatting the list cells use, so the phone line agrees with the table.
68
- function lineValueText(raw, display, formats) {
69
- if (display === "datetime") {
70
- const atMs = typeof raw === "number" ? raw : typeof raw === "string" ? Date.parse(raw) : Number.NaN;
71
- return Number.isFinite(atMs) ? formats.formatDateTime(atMs) : undefined;
72
- }
73
- if (typeof raw === "number")
74
- return formats.formatNumber(raw);
75
- return typeof raw === "string" && raw !== "" ? raw : undefined;
76
- }
77
68
  function ListLine({ panel, label, data, link, translate, screenId, screenParams, }) {
78
69
  const { Link } = usePrimitives();
79
70
  const nav = useNav();
@@ -84,9 +75,10 @@ function ListLine({ panel, label, data, link, translate, screenId, screenParams,
84
75
  const lineField = panel.narrow?.field ??
85
76
  columns.find((column) => column.display === undefined && typeof firstRow?.[column.field] === "string")?.field;
86
77
  const formats = useDashboardFormats();
87
- const firstText = lineField === undefined
78
+ const lineColumn = columns.find((column) => column.field === lineField);
79
+ const firstText = lineField === undefined || firstRow === undefined
88
80
  ? undefined
89
- : lineValueText(firstRow?.[lineField], columns.find((column) => column.field === lineField)?.display, formats);
81
+ : dashboardListCellText(lineColumn ?? {}, firstRow, lineField, formats, translate);
90
82
  const more = (knownTotal(data) ?? rows.length) - 1;
91
83
  const target = dashboardNavigationLink(nav, link);
92
84
  return (_jsxs(Link, { href: target.href, onPress: target.onPress, testId: `dashboard-panel-${panel.id}`, className: "flex items-center gap-2 rounded-lg border border-border bg-card px-4 py-3 text-sm text-card-foreground", children: [Icon !== undefined && (_jsx("span", { className: "flex shrink-0 items-center", children: _jsx(Icon, { entityName: screenId, entityId: null, screenId: screenId, filterParams: screenParams.filterParams }) })), _jsxs("span", { className: "min-w-0 flex-1 truncate", children: [_jsx("span", { className: "font-semibold", children: label }), firstText !== undefined && ` · ${firstText}`, more > 0 &&
@@ -96,7 +88,7 @@ function NarrowCardsPanel({ panel, label, data, columns, featureName, translate,
96
88
  const { formatPercent, formatNumber, formatDateTime } = useDashboardFormats();
97
89
  const { footerLink } = panel;
98
90
  const totalLabel = totalText(panel, data, true, translate);
99
- return (_jsxs("section", { "data-testid": `dashboard-panel-${panel.id}`, className: "flex flex-col gap-2", children: [_jsxs("header", { className: "flex items-baseline justify-between gap-3", children: [_jsx("h2", { className: "text-sm font-semibold", children: label }), totalLabel !== undefined && (_jsx("span", { className: "text-xs text-muted-foreground", children: totalLabel }))] }), _jsx(DashboardReferenceListTable, { columns: columns, rows: data.rows ?? [], featureName: featureName, formatPercent: formatPercent, formatNumber: formatNumber, formatDateTime: formatDateTime, translate: translate, narrowCards: true, ...(panel.narrow?.titleField !== undefined && { titleField: panel.narrow.titleField }), ...(panel.rowToneField !== undefined && { rowToneField: panel.rowToneField }) }), footerLink !== undefined && (_jsx("footer", { className: "flex flex-wrap items-center gap-x-1 text-xs text-muted-foreground", children: _jsx(ListFooter, { link: footerLink, data: data, narrow: true, translate: translate }) }))] }));
91
+ return (_jsxs("section", { "data-testid": `dashboard-panel-${panel.id}`, className: "flex flex-col gap-2", children: [_jsxs("header", { className: "flex items-baseline justify-between gap-3", children: [_jsx("h2", { className: "text-sm font-semibold", children: label }), totalLabel !== undefined && (_jsx("span", { className: "text-xs text-muted-foreground", children: totalLabel }))] }), _jsx(DashboardReferenceListTable, { columns: columns, rows: data.rows ?? [], featureName: featureName, formatPercent: formatPercent, formatNumber: formatNumber, formatDateTime: formatDateTime, translate: translate, narrowCards: true, ...(panel.narrow?.titleField !== undefined && { titleField: panel.narrow.titleField }), ...(panel.rowToneField !== undefined && { rowToneField: panel.rowToneField }) }), footerLink !== undefined && (_jsx("footer", { className: "flex flex-wrap items-center gap-x-1 text-[12.5px] text-muted-foreground", children: _jsx(ListFooter, { link: footerLink, data: data, narrow: true, translate: translate }) }))] }));
100
92
  }
101
93
  export function ListPanelBody({ panel, label, featureName, screenId, screenParams, translate, }) {
102
94
  const { formatPercent, formatNumber, formatDateTime } = useDashboardFormats();
@@ -115,6 +107,9 @@ export function ListPanelBody({ panel, label, featureName, screenId, screenParam
115
107
  badgeToneField: normalized.badgeToneField,
116
108
  }),
117
109
  ...(normalized.badgeDot !== undefined && { badgeDot: normalized.badgeDot }),
110
+ ...(normalized.emptyPlaceholder !== undefined && {
111
+ emptyPlaceholder: normalized.emptyPlaceholder,
112
+ }),
118
113
  ...(normalized.refEntity !== undefined && {
119
114
  reference: {
120
115
  refEntity: normalized.refEntity,
@@ -10,6 +10,7 @@ type StatPanelBodyProps = {
10
10
  readonly translate: Translate;
11
11
  readonly variant: "card" | "strip" | "strip-compact";
12
12
  };
13
+ export declare function useStatNavigateAllowed(): (panel: StatPanelBodyProps["panel"]) => boolean;
13
14
  export declare function StatPanelBody(props: StatPanelBodyProps): ReactNode;
14
15
  export declare function ChartPanelBody({ panel, label, screenParams, translate, }: {
15
16
  readonly panel: DashboardChartPanel;
@@ -40,15 +40,17 @@ function fallbackText(raw, placeholder) {
40
40
  return String(raw);
41
41
  }
42
42
  // Hidden before any query hook runs: the tile's own count query would be refused for this user.
43
- export function StatPanelBody(props) {
43
+ export function useStatNavigateAllowed() {
44
44
  const appFeatures = useAppFeatures();
45
45
  const userRoles = useUserRoles();
46
- const { navigate } = props.panel;
47
- if (navigate !== undefined &&
48
- !(navigateTargetAllows({ screen: navigate.screen }, appFeatures, userRoles) &&
49
- namedFilterNavigateAllows(navigate, appFeatures, userRoles))) {
46
+ return ({ navigate }) => navigate === undefined ||
47
+ (navigateTargetAllows({ screen: navigate.screen }, appFeatures, userRoles) &&
48
+ namedFilterNavigateAllows(navigate, appFeatures, userRoles));
49
+ }
50
+ export function StatPanelBody(props) {
51
+ const navigateAllowed = useStatNavigateAllowed();
52
+ if (!navigateAllowed(props.panel))
50
53
  return null;
51
- }
52
54
  return _jsx(StatPanelContent, { ...props });
53
55
  }
54
56
  function StatPanelContent({ panel, label, screenId, screenParams, translate, variant, }) {
@@ -112,7 +114,7 @@ function StatVariantCell({ variant, cell, }) {
112
114
  return _jsx(StatBoxCell, { ...boxCell });
113
115
  }
114
116
  const { narrowLabel: _narrow, ...tileCell } = cell;
115
- return variant === "strip" ? _jsx(StatStripCell, { ...tileCell }) : _jsx(StatCard, { ...tileCell });
117
+ return variant === "strip" ? _jsx(StatStripCell, { ...tileCell }) : _jsx(StatCard, { ...tileCell, inset: true });
116
118
  }
117
119
  function statValueText(rawValue, valueFormat, translate, formats) {
118
120
  if (typeof rawValue !== "number") {
@@ -19,6 +19,7 @@ function toReferenceViewColumn(column, featureName) {
19
19
  refEntity: target.entityName,
20
20
  refFeature: target.featureName,
21
21
  refLabelField: column.reference.refLabelField ?? "id",
22
+ ...(column.emptyPlaceholder !== undefined && { emptyPlaceholder: column.emptyPlaceholder }),
22
23
  };
23
24
  }
24
25
  // Dashboard list rows carry raw ids; reference columns resolve them to the target's label
@@ -3,6 +3,7 @@ import { createContext, useCallback, useContext, useEffect, useRef, useState, }
3
3
  import { currencyDecimals } from "../../headless/index.js";
4
4
  import { dispatcherErrorText, useLocale, usePrimitives, useQuery, useTranslation, } from "../../index.js";
5
5
  import { serverNowMs } from "../../server-clock.js";
6
+ import { cn } from "../lib/cn.js";
6
7
  import { resolveSafeLocale } from "../primitives/locale-number.js";
7
8
  import { formatMoney } from "../primitives/money-input.js";
8
9
  import { Skeleton } from "../ui/skeleton.js";
@@ -118,7 +119,7 @@ export function useDashboardFormats() {
118
119
  };
119
120
  }
120
121
  export function PanelShell({ testId, title, subtitle, action, footer, children, }) {
121
- return (_jsxs("section", { "data-testid": testId, className: "flex h-full flex-col rounded-lg border border-border bg-card text-card-foreground", children: [(title !== undefined || action !== undefined) && (_jsxs("header", { className: "flex min-h-11 shrink-0 flex-wrap items-center justify-between gap-x-3 gap-y-2 border-b border-border-row px-4 py-2", 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-3", children: [title !== undefined && _jsx("h2", { className: "text-sm font-semibold break-words", children: title }), subtitle !== undefined && _jsx("p", { className: "text-xs text-muted-foreground", children: subtitle })] }), action !== undefined && _jsx("div", { className: "shrink-0", children: action })] })), _jsx("div", { className: "grow p-4", children: children }), footer !== undefined && (_jsx("footer", { className: "flex shrink-0 flex-wrap items-center gap-x-1 border-t border-border-row px-4 py-2 text-xs 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: [_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
123
  }
123
124
  export function PanelError({ label, error, onRetry, testId, }) {
124
125
  const { Button } = usePrimitives();
@@ -1,6 +1,7 @@
1
1
  import type { DashboardStatGroupPanel } from "@cosmicdrift/kumiko-framework/ui-types";
2
2
  import type { ReactNode } from "react";
3
3
  import type { Translate } from "../../headless/index.ts";
4
+ import "../react-css-custom-properties.ts";
4
5
  import { type ScreenParams } from "./dashboard-shared.tsx";
5
6
  type StatGroupProps = {
6
7
  readonly panel: DashboardStatGroupPanel;
@@ -4,9 +4,10 @@ import { useNav } from "../../app/nav.js";
4
4
  import { navigateTargetAllows } from "../../app/screen-access.js";
5
5
  import { extensionSectionName, useAppFeatures, useExtensionSectionComponent, usePrimitives, useUserRoles, } from "../../index.js";
6
6
  import { cn } from "../lib/cn.js";
7
+ import "../react-css-custom-properties.js";
7
8
  import { STAT_CARD_GRID_CLASSES } from "../widgets/stat.js";
8
9
  import { dashboardNavigationLink } from "./dashboard-navigation-link.js";
9
- import { StatPanelBody } from "./dashboard-panels.js";
10
+ import { StatPanelBody, useStatNavigateAllowed } from "./dashboard-panels.js";
10
11
  import { PanelShell } from "./dashboard-shared.js";
11
12
  // Literal class strings: Tailwind only emits classes it can read in the source.
12
13
  const STAT_CARD_COLUMN_CLASSES = {
@@ -16,11 +17,11 @@ const STAT_CARD_COLUMN_CLASSES = {
16
17
  };
17
18
  // Literal class strings: Tailwind only emits classes it can read in the source.
18
19
  const PHONE_STRIP_TONE_CLASS = {
19
- accent: "max-sm:border-primary/30 max-sm:bg-primary/10",
20
- ok: "max-sm:border-status-ok/30 max-sm:bg-status-ok-surface",
21
- warn: "max-sm:border-status-warn/30 max-sm:bg-status-warn-surface",
22
- bad: "max-sm:border-status-bad/30 max-sm:bg-status-bad-surface",
23
- critical: "max-sm:border-status-critical/30 max-sm:bg-status-critical-surface",
20
+ accent: "max-sm:border-transparent max-sm:bg-primary/10",
21
+ ok: "max-sm:border-transparent max-sm:bg-status-ok-surface",
22
+ warn: "max-sm:border-transparent max-sm:bg-status-warn-surface",
23
+ bad: "max-sm:border-transparent max-sm:bg-status-bad-surface",
24
+ critical: "max-sm:border-transparent max-sm:bg-status-critical-surface",
24
25
  neutral: "",
25
26
  };
26
27
  function StatGroupLink({ link, translate, stretchOnNarrow, }) {
@@ -50,7 +51,13 @@ function PhoneStripIcon({ panel, screenId, screenParams, }) {
50
51
  }
51
52
  function TitledStatStrip(props) {
52
53
  const { panel, label, translate } = props;
53
- return (_jsxs("div", { "data-testid": `dashboard-panel-${panel.id}`, "data-narrow-tone": panel.narrow?.tone, className: cn("relative flex items-center gap-x-4 rounded-lg border border-border bg-card px-4 py-3 max-sm:items-baseline max-sm:gap-x-2 max-sm:overflow-hidden max-sm:py-2", panel.narrow?.tone !== undefined && PHONE_STRIP_TONE_CLASS[panel.narrow.tone]), children: [_jsx(PhoneStripIcon, { panel: panel, screenId: props.screenId, screenParams: props.screenParams }), _jsxs("div", { className: "flex min-w-0 shrink-0 flex-col max-sm:flex-row max-sm:items-baseline", children: [_jsx("h2", { className: "text-sm font-semibold max-sm:after:ml-2 max-sm:after:font-normal max-sm:after:text-muted-foreground max-sm:after:content-['\u00B7']", children: label }), panel.subtitle !== undefined && (_jsx("p", { className: "text-xs text-muted-foreground max-sm:hidden", children: translate(panel.subtitle) }))] }), _jsx("div", { className: "flex min-w-0 items-stretch gap-3 max-sm:block max-sm:grow max-sm:truncate max-sm:text-sm", children: panel.stats.map((stat) => (_jsx("div", { className: `flex min-w-0 max-sm:inline max-sm:[&_a]:inline max-sm:[&:not(:last-child)]:after:mx-1.5 max-sm:[&:not(:last-child)]:after:text-muted-foreground max-sm:[&:not(:last-child)]:after:content-['·'] [&>*]:min-w-0${stat.navigate !== undefined ? " max-sm:relative max-sm:z-10" : ""}`, children: _jsx(StatPanelBody, { panel: stat, label: translate(stat.label), screenId: props.screenId, screenParams: props.screenParams, translate: translate, variant: "strip-compact" }) }, stat.id))) }), panel.link !== undefined && (_jsx(StatGroupLink, { link: panel.link, translate: translate, stretchOnNarrow: true }))] }));
54
+ const navigateAllowed = useStatNavigateAllowed();
55
+ const stats = panel.stats.filter(navigateAllowed);
56
+ return (_jsxs("div", { "data-testid": `dashboard-panel-${panel.id}`, "data-narrow-tone": panel.narrow?.tone, style: { "--stat-count": stats.length }, className: cn(
57
+ // Board grid: title column, one equal column per stat, link column.
58
+ panel.link === undefined
59
+ ? "sm:[grid-template-columns:190px_repeat(var(--stat-count),minmax(0,1fr))]"
60
+ : "sm:[grid-template-columns:190px_repeat(var(--stat-count),minmax(0,1fr))_auto]", "relative flex items-center gap-x-4 rounded-lg border border-border bg-card px-4 py-3 shadow-[var(--card-shadow)] sm:grid sm:gap-x-3 max-sm:items-baseline max-sm:gap-x-2 max-sm:overflow-hidden max-sm:py-2 max-sm:font-medium", panel.narrow?.tone !== undefined && PHONE_STRIP_TONE_CLASS[panel.narrow.tone]), children: [_jsx(PhoneStripIcon, { panel: panel, screenId: props.screenId, screenParams: props.screenParams }), _jsxs("div", { className: "flex min-w-0 shrink-0 flex-col max-sm:flex-row max-sm:items-baseline", children: [_jsx("h2", { className: "text-sm font-semibold max-sm:after:ml-2 max-sm:after:font-normal max-sm:after:text-muted-foreground max-sm:after:content-['\u00B7']", children: label }), panel.subtitle !== undefined && (_jsx("p", { className: "text-xs text-muted-foreground max-sm:hidden", children: translate(panel.subtitle) }))] }), _jsx("div", { className: "flex min-w-0 items-stretch gap-3 sm:contents max-sm:block max-sm:grow max-sm:truncate max-sm:text-sm", children: stats.map((stat) => (_jsx("div", { className: `flex min-w-0 max-sm:inline max-sm:[&_a]:inline max-sm:[&:not(:last-child)]:after:mx-1.5 max-sm:[&:not(:last-child)]:after:text-muted-foreground max-sm:[&:not(:last-child)]:after:content-['·'] [&>*]:min-w-0${stat.navigate !== undefined ? " max-sm:relative max-sm:z-10" : ""}`, children: _jsx(StatPanelBody, { panel: stat, label: translate(stat.label), screenId: props.screenId, screenParams: props.screenParams, translate: translate, variant: "strip-compact" }) }, stat.id))) }), panel.link !== undefined && (_jsx(StatGroupLink, { link: panel.link, translate: translate, stretchOnNarrow: true }))] }));
54
61
  }
55
62
  export function StatGroupPanelBody(props) {
56
63
  const { panel, label, translate } = props;
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { navigateTargetAllows } from "../../app/screen-access.js";
3
3
  import { lastSegment, useAppFeatures, useNav, usePrimitives, useUserRoles } from "../../index.js";
4
+ import { cn } from "../lib/cn.js";
4
5
  import { useIsBelowSmViewport } from "../primitives/use-narrow-viewport.js";
5
6
  import { PanelError, PanelShell, PanelSkeleton, panelPayload, useDashboardFormats, useDashboardQuery, useReportPanelLoaded, } from "./dashboard-shared.js";
6
7
  import { isDashboardI18nText, isRecord, resolveDashboardText } from "./dashboard-text.js";
@@ -63,7 +64,10 @@ const PARAGRAPH_CLASS_NAMES = {
63
64
  strong: "text-sm font-medium text-foreground",
64
65
  lead: "font-heading text-[15.5px] leading-[1.5] sm:text-[17px] sm:leading-relaxed text-foreground",
65
66
  };
66
- function TextBlockView({ block, translate, }) {
67
+ function isLeadParagraph(block) {
68
+ return block?.kind === "paragraph" && block.emphasis === "lead";
69
+ }
70
+ function TextBlockView({ block, translate, followsLead = false, }) {
67
71
  const formats = useDashboardFormats();
68
72
  const resolve = (text) => resolveBlockText(text, translate, formats);
69
73
  switch (block.kind) {
@@ -76,7 +80,7 @@ function TextBlockView({ block, translate, }) {
76
80
  case "code":
77
81
  return (_jsx("pre", { "data-block": "code", className: "overflow-x-auto rounded-md bg-muted p-3 text-xs", children: _jsx("code", { children: block.code }) }));
78
82
  case "hint":
79
- return (_jsx("p", { "data-block": "hint", className: "text-xs text-muted-foreground", children: resolve(block.text) }));
83
+ return (_jsx("p", { "data-block": "hint", className: cn("text-xs text-muted-foreground", followsLead && "-mt-1 text-[11.5px]"), children: resolve(block.text) }));
80
84
  case "link":
81
85
  return _jsx(TextBlockLink, { block: block, resolve: resolve });
82
86
  }
@@ -122,10 +126,10 @@ function TextPanelFrame({ panel, label, children, }) {
122
126
  if (label !== undefined) {
123
127
  return (_jsx(PanelShell, { testId: testId, title: label, children: children }));
124
128
  }
125
- return (_jsx("section", { "data-testid": testId, className: "h-full rounded-lg border border-border bg-card p-4 text-card-foreground", children: children }));
129
+ 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: children }));
126
130
  }
127
131
  function TextBlockList({ blocks, translate, }) {
128
- return (_jsx("div", { className: "flex flex-col gap-3", children: withOccurrenceKeys(blocks, textBlockKey).map(({ entry, key }) => (_jsx(TextBlockView, { block: entry, translate: translate }, key))) }));
132
+ 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))) }));
129
133
  }
130
134
  export function TextPanelBody(props) {
131
135
  const { panel, label, translate } = props;