@cosmicdrift/kumiko-renderer 0.414.0 → 0.416.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. package/dist/app/action-form-body.d.ts +1 -1
  2. package/dist/app/action-form-body.js +43 -16
  3. package/dist/app/action-form-support.d.ts +4 -1
  4. package/dist/app/action-form-support.js +8 -4
  5. package/dist/app/client-actions.js +6 -4
  6. package/dist/app/config-edit-body.js +13 -4
  7. package/dist/app/entity-list-screen.js +12 -9
  8. package/dist/app/extension-sections.d.ts +2 -0
  9. package/dist/app/list-facets.d.ts +1 -0
  10. package/dist/app/list-facets.js +10 -1
  11. package/dist/app/named-filter-facet.d.ts +0 -1
  12. package/dist/app/named-filter-facet.js +19 -10
  13. package/dist/app/projection-detail-body.js +8 -6
  14. package/dist/app/projection-detail-guidance-data.js +3 -1
  15. package/dist/app/projection-detail-guidance.d.ts +1 -1
  16. package/dist/app/projection-detail-guidance.js +45 -33
  17. package/dist/app/projection-detail-header-model.d.ts +1 -1
  18. package/dist/app/projection-detail-header-model.js +10 -5
  19. package/dist/app/projection-detail-header.js +5 -4
  20. package/dist/app/projection-detail-navigation.d.ts +6 -0
  21. package/dist/app/projection-detail-navigation.js +18 -4
  22. package/dist/app/screen-access.js +1 -2
  23. package/dist/app/screen-shared.d.ts +1 -0
  24. package/dist/app/screen-shared.js +23 -3
  25. package/dist/app/use-entity-list-payload.d.ts +2 -1
  26. package/dist/app/use-entity-list-payload.js +4 -2
  27. package/dist/app/use-projection-detail-actions.d.ts +14 -0
  28. package/dist/app/use-projection-detail-actions.js +40 -16
  29. package/dist/app/use-projection-detail-data.d.ts +2 -0
  30. package/dist/app/use-projection-detail-data.js +37 -10
  31. package/dist/app/use-row-decoration.d.ts +6 -4
  32. package/dist/app/use-row-decoration.js +67 -19
  33. package/dist/app/use-screen-list-rows.js +1 -1
  34. package/dist/card-options.d.ts +25 -0
  35. package/dist/card-options.js +1 -0
  36. package/dist/components/ai-assist-payload.d.ts +2 -0
  37. package/dist/components/ai-assist-payload.js +8 -0
  38. package/dist/components/edit-mounts.d.ts +3 -2
  39. package/dist/components/edit-mounts.js +2 -2
  40. package/dist/components/list-empty-state.d.ts +5 -0
  41. package/dist/components/list-empty-state.js +17 -1
  42. package/dist/components/multi-select-chips.d.ts +10 -0
  43. package/dist/components/multi-select-chips.js +18 -0
  44. package/dist/components/related-list-section.js +44 -32
  45. package/dist/components/related-photo-grid.d.ts +11 -0
  46. package/dist/components/related-photo-grid.js +40 -0
  47. package/dist/components/render-edit-action-button.d.ts +2 -2
  48. package/dist/components/render-edit-field-grid.js +3 -3
  49. package/dist/components/render-edit-header-actions.d.ts +2 -1
  50. package/dist/components/render-edit-header-actions.js +18 -1
  51. package/dist/components/render-edit-layout.js +2 -2
  52. package/dist/components/render-edit-logic.js +1 -0
  53. package/dist/components/render-edit-section-kinds.js +11 -0
  54. package/dist/components/render-edit-types.d.ts +11 -1
  55. package/dist/components/render-field-ai-assist.d.ts +13 -0
  56. package/dist/components/render-field-ai-assist.js +89 -0
  57. package/dist/components/render-field-choice-inputs.js +4 -0
  58. package/dist/components/render-field-control.d.ts +1 -1
  59. package/dist/components/render-field-control.js +18 -8
  60. package/dist/components/render-field-value-chips.d.ts +9 -0
  61. package/dist/components/render-field-value-chips.js +45 -0
  62. package/dist/components/render-field-write-only.js +12 -4
  63. package/dist/components/render-list-hint-columns.d.ts +2 -0
  64. package/dist/components/render-list-hint-columns.js +23 -0
  65. package/dist/components/render-list-toolbar-model.d.ts +2 -2
  66. package/dist/components/use-render-edit-sections.js +5 -1
  67. package/dist/components/use-render-list-columns.js +3 -3
  68. package/dist/context/screen-focus-context.d.ts +1 -1
  69. package/dist/context/screen-focus-context.js +3 -3
  70. package/dist/data-table-facet-types.d.ts +4 -0
  71. package/dist/headless/format/index.d.ts +1 -0
  72. package/dist/headless/format/index.js +20 -0
  73. package/dist/headless/format/phone.d.ts +1 -0
  74. package/dist/headless/format/phone.js +8 -0
  75. package/dist/headless/format/relative-time.d.ts +13 -0
  76. package/dist/headless/format/relative-time.js +60 -0
  77. package/dist/headless/format/safe-locale.d.ts +1 -0
  78. package/dist/headless/format/safe-locale.js +13 -0
  79. package/dist/headless/index.d.ts +3 -3
  80. package/dist/headless/index.js +3 -3
  81. package/dist/headless/pwa-service-worker-meta.d.ts +3 -0
  82. package/dist/headless/pwa-service-worker-meta.js +10 -0
  83. package/dist/headless/view-model/edit.d.ts +3 -2
  84. package/dist/headless/view-model/edit.js +78 -2
  85. package/dist/headless/view-model/field-text.d.ts +9 -0
  86. package/dist/headless/view-model/field-text.js +19 -0
  87. package/dist/headless/view-model/index.d.ts +1 -0
  88. package/dist/headless/view-model/index.js +1 -0
  89. package/dist/headless/view-model/types.d.ts +33 -3
  90. package/dist/i18n-defaults.js +4 -1
  91. package/dist/index.d.ts +1 -1
  92. package/dist/metric-types.d.ts +2 -0
  93. package/dist/primitives-record-guidance.d.ts +30 -1
  94. package/dist/primitives.d.ts +17 -27
  95. package/dist/web/app/dashboard-body.js +3 -2
  96. package/dist/web/app/dashboard-header.js +1 -1
  97. package/dist/web/app/dashboard-list-panel.js +9 -13
  98. package/dist/web/app/dashboard-panel-columns.d.ts +9 -0
  99. package/dist/web/app/dashboard-panel-columns.js +14 -0
  100. package/dist/web/app/dashboard-panels.d.ts +1 -0
  101. package/dist/web/app/dashboard-panels.js +9 -7
  102. package/dist/web/app/dashboard-reference-list-table.js +1 -0
  103. package/dist/web/app/dashboard-shared.js +3 -2
  104. package/dist/web/app/dashboard-stat-group-panel.d.ts +1 -0
  105. package/dist/web/app/dashboard-stat-group-panel.js +22 -8
  106. package/dist/web/app/dashboard-text-panel.d.ts +1 -0
  107. package/dist/web/app/dashboard-text-panel.js +18 -12
  108. package/dist/web/app/relative-time.d.ts +0 -5
  109. package/dist/web/app/relative-time.js +1 -20
  110. package/dist/web/drawn-icons.d.ts +6 -0
  111. package/dist/web/drawn-icons.js +30 -0
  112. package/dist/web/icons.js +6 -5
  113. package/dist/web/index.d.ts +2 -0
  114. package/dist/web/index.js +2 -0
  115. package/dist/web/layout/default-app-shell.js +3 -3
  116. package/dist/web/layout/nav-collapse-state.d.ts +2 -0
  117. package/dist/web/layout/nav-collapse-state.js +10 -0
  118. package/dist/web/layout/nav-tree.js +46 -23
  119. package/dist/web/layout/notification-bell.d.ts +7 -2
  120. package/dist/web/layout/notification-bell.js +16 -5
  121. package/dist/web/layout/shell-focus.d.ts +2 -2
  122. package/dist/web/layout/shell-focus.js +7 -3
  123. package/dist/web/layout/shell-header.d.ts +2 -1
  124. package/dist/web/layout/shell-header.js +56 -27
  125. package/dist/web/layout/shell-style.d.ts +3 -0
  126. package/dist/web/layout/shell-style.js +6 -0
  127. package/dist/web/layout/workspace-shell.d.ts +11 -1
  128. package/dist/web/layout/workspace-shell.js +6 -4
  129. package/dist/web/primitives/banner.d.ts +1 -1
  130. package/dist/web/primitives/banner.js +19 -9
  131. package/dist/web/primitives/card.js +18 -8
  132. package/dist/web/primitives/data-table/actions-column.d.ts +1 -1
  133. package/dist/web/primitives/data-table/actions-column.js +3 -1
  134. package/dist/web/primitives/data-table/card-body.d.ts +1 -1
  135. package/dist/web/primitives/data-table/card-body.js +11 -6
  136. package/dist/web/primitives/data-table/card-row.js +27 -18
  137. package/dist/web/primitives/data-table/data-cell-props.d.ts +2 -0
  138. package/dist/web/primitives/data-table/data-cell-props.js +2 -0
  139. package/dist/web/primitives/data-table/hint-cell.d.ts +1 -3
  140. package/dist/web/primitives/data-table/hint-cell.js +4 -10
  141. package/dist/web/primitives/data-table/row-click-guard.d.ts +2 -0
  142. package/dist/web/primitives/data-table/row-click-guard.js +19 -0
  143. package/dist/web/primitives/data-table/row-render-parts.d.ts +1 -1
  144. package/dist/web/primitives/data-table/row-render-parts.js +3 -2
  145. package/dist/web/primitives/data-table/sort-options-select.js +3 -3
  146. package/dist/web/primitives/data-table/table-body.js +2 -1
  147. package/dist/web/primitives/data-table/table-content.js +10 -6
  148. package/dist/web/primitives/data-table/table-view.js +8 -3
  149. package/dist/web/primitives/data-table/toolbar.d.ts +2 -0
  150. package/dist/web/primitives/data-table/toolbar.js +44 -9
  151. package/dist/web/primitives/data-table/totals-footer.js +4 -3
  152. package/dist/web/primitives/data-table-cell.d.ts +4 -1
  153. package/dist/web/primitives/data-table-cell.js +60 -20
  154. package/dist/web/primitives/default-form.js +6 -3
  155. package/dist/web/primitives/drawer.js +5 -1
  156. package/dist/web/primitives/facet-filter.d.ts +1 -1
  157. package/dist/web/primitives/facet-filter.js +16 -8
  158. package/dist/web/primitives/facet-search-filter.d.ts +2 -1
  159. package/dist/web/primitives/facet-search-filter.js +3 -2
  160. package/dist/web/primitives/facet-trigger-label.d.ts +8 -0
  161. package/dist/web/primitives/facet-trigger-label.js +9 -0
  162. package/dist/web/primitives/file-view-action.js +4 -1
  163. package/dist/web/primitives/form-footer-parts.js +4 -1
  164. package/dist/web/primitives/form.js +6 -8
  165. package/dist/web/primitives/index.js +4 -0
  166. package/dist/web/primitives/layout-elements.d.ts +1 -1
  167. package/dist/web/primitives/layout-elements.js +3 -3
  168. package/dist/web/primitives/locale-number.d.ts +0 -1
  169. package/dist/web/primitives/locale-number.js +1 -13
  170. package/dist/web/primitives/metric.js +17 -5
  171. package/dist/web/primitives/money-input.js +2 -1
  172. package/dist/web/primitives/narrow-pinned-footer.js +7 -3
  173. package/dist/web/primitives/number-input.js +2 -1
  174. package/dist/web/primitives/page-header.js +3 -2
  175. package/dist/web/primitives/pager.d.ts +3 -2
  176. package/dist/web/primitives/pager.js +16 -20
  177. package/dist/web/primitives/photo-grid.d.ts +3 -0
  178. package/dist/web/primitives/photo-grid.js +5 -0
  179. package/dist/web/primitives/record-breadcrumb.js +1 -1
  180. package/dist/web/primitives/record-steps.d.ts +1 -1
  181. package/dist/web/primitives/record-steps.js +11 -6
  182. package/dist/web/primitives/record-summary.d.ts +1 -1
  183. package/dist/web/primitives/record-summary.js +8 -3
  184. package/dist/web/primitives/segmented-select.js +6 -3
  185. package/dist/web/primitives/step-list.d.ts +3 -0
  186. package/dist/web/primitives/step-list.js +11 -0
  187. package/dist/web/primitives/tabs.js +6 -1
  188. package/dist/web/pwa/pwa-support.js +19 -1
  189. package/dist/web/ui/sidebar.d.ts +2 -1
  190. package/dist/web/ui/sidebar.js +4 -3
  191. package/dist/web/widgets/ai-text-field.js +3 -2
  192. package/dist/web/widgets/dashboard-list-cards.js +6 -14
  193. package/dist/web/widgets/dashboard-list.d.ts +10 -0
  194. package/dist/web/widgets/dashboard-list.js +36 -10
  195. package/dist/web/widgets/drawer-panel-class.d.ts +1 -0
  196. package/dist/web/widgets/drawer-panel-class.js +9 -1
  197. package/dist/web/widgets/drawer.js +2 -2
  198. package/dist/web/widgets/pdf-viewer-toolbar.js +3 -2
  199. package/dist/web/widgets/sheet-parts.js +3 -1
  200. package/dist/web/widgets/stat-box-cell.js +1 -1
  201. package/dist/web/widgets/stat.d.ts +7 -1
  202. package/dist/web/widgets/stat.js +12 -4
  203. package/dist/web/widgets/step-list-row.d.ts +4 -0
  204. package/dist/web/widgets/step-list-row.js +22 -14
  205. package/dist/web/widgets/step-list.d.ts +12 -4
  206. package/dist/web/widgets/step-list.js +38 -20
  207. package/package.json +5 -5
  208. package/src/changes.json +126 -0
  209. package/src/web/styles.css +6 -0
@@ -1,5 +1,5 @@
1
1
  import { isPlainObject } from "@cosmicdrift/kumiko-types/type-guards";
2
- import { useEffect, useMemo, useRef } from "react";
2
+ import { useEffect, useMemo, useRef, useState } from "react";
3
3
  import { useQuery } from "../hooks/use-query.js";
4
4
  function rowId(row) {
5
5
  const id = row["id"];
@@ -19,9 +19,7 @@ function decorationFieldsById(answer) {
19
19
  }
20
20
  return byId;
21
21
  }
22
- /** Decoration fields win over same-named row fields; the row id is kept. Entries for ids not in `rows` and malformed entries are ignored. */
23
- export function mergeRowDecoration(rows, answer) {
24
- const byId = decorationFieldsById(answer);
22
+ function applyDecorationFields(rows, byId) {
25
23
  if (byId.size === 0)
26
24
  return rows;
27
25
  return rows.map((row) => {
@@ -30,26 +28,76 @@ export function mergeRowDecoration(rows, answer) {
30
28
  return fields === undefined ? row : { ...row, ...fields, id: row["id"] };
31
29
  });
32
30
  }
31
+ /** Decoration fields win over same-named row fields; the row id is kept. Entries for ids not in `rows` and malformed entries are ignored. */
32
+ export function mergeRowDecoration(rows, answer) {
33
+ return applyDecorationFields(rows, decorationFieldsById(answer));
34
+ }
35
+ function emptyAccumulated(resetKey) {
36
+ return { resetKey, answeredIds: new Set(), fieldsById: new Map(), batchSize: undefined };
37
+ }
38
+ function absorbAnswer(previous, answer, sentIds) {
39
+ // A sent id the answer no longer contains loses its decoration; ids not asked for keep theirs,
40
+ // so rows do not flicker while a refresh runs batch by batch.
41
+ const fieldsById = new Map(previous.fieldsById);
42
+ for (const id of sentIds)
43
+ fieldsById.delete(id);
44
+ for (const [id, fields] of decorationFieldsById(answer))
45
+ fieldsById.set(id, fields);
46
+ return {
47
+ resetKey: previous.resetKey,
48
+ answeredIds: new Set([...previous.answeredIds, ...sentIds]),
49
+ fieldsById,
50
+ batchSize: previous.batchSize ?? sentIds.length,
51
+ };
52
+ }
53
+ function isAppendOf(previousIds, ids) {
54
+ return ids.length > previousIds.length && previousIds.every((id, index) => ids[index] === id);
55
+ }
33
56
  /**
34
- * One decoration call per list answer. `answerToken` changes with every new list answer;
35
- * the decoration query is not live itself. A changed id set refetches through the payload,
36
- * so only a new answer with the same ids calls `refetch`. Loading and error show the plain rows.
57
+ * Sends only ids that have no answer yet, so an infinite list asks once per new page and the
58
+ * answers are kept across calls. `resetKey` drops them (filter or sort changed); a new list
59
+ * answer that is not an append (reload after a write) asks for every id again, in batches of
60
+ * the first send's size.
61
+ * Loading and error show the plain rows.
37
62
  */
38
- export function useRowDecoration(decoration, rows, answerToken) {
63
+ export function useRowDecoration(decoration, rows, answerToken, resetKey) {
39
64
  const ids = rows.flatMap((row) => {
40
65
  const id = rowId(row);
41
66
  return id === undefined ? [] : [id];
42
67
  });
43
- const idsKey = ids.join("\n");
44
- const enabled = decoration !== undefined && ids.length > 0;
45
- const { data, error, refetch } = useQuery(decoration?.query ?? "", { ...decoration?.params, ids }, { enabled });
46
- const lastAnswerRef = useRef(null);
68
+ const [stored, setStored] = useState(() => emptyAccumulated(resetKey));
69
+ const accumulated = stored.resetKey === resetKey ? stored : emptyAccumulated(resetKey);
70
+ const idsToSend = ids
71
+ .filter((id) => !accumulated.answeredIds.has(id))
72
+ .slice(0, accumulated.batchSize);
73
+ const enabled = decoration !== undefined && idsToSend.length > 0;
74
+ const { data, error } = useQuery(decoration?.query ?? "", { ...decoration?.params, ids: idsToSend }, { enabled });
75
+ const sentIdsRef = useRef(idsToSend);
76
+ useEffect(() => {
77
+ sentIdsRef.current = idsToSend;
78
+ });
79
+ const absorbedAnswerRef = useRef(null);
80
+ useEffect(() => {
81
+ if (data === null || data === absorbedAnswerRef.current)
82
+ return;
83
+ absorbedAnswerRef.current = data;
84
+ const sentIds = sentIdsRef.current;
85
+ setStored((current) => absorbAnswer(current.resetKey === resetKey ? current : emptyAccumulated(resetKey), data, sentIds));
86
+ }, [data, resetKey]);
87
+ const previousListRef = useRef(null);
47
88
  useEffect(() => {
48
- const last = lastAnswerRef.current;
49
- lastAnswerRef.current = enabled ? { token: answerToken, idsKey } : null;
50
- if (enabled && last !== null && last.token !== answerToken && last.idsKey === idsKey) {
51
- void refetch();
52
- }
53
- }, [enabled, answerToken, idsKey, refetch]);
54
- return useMemo(() => (!enabled || error !== null || data === null ? rows : mergeRowDecoration(rows, data)), [enabled, error, data, rows]);
89
+ const previous = previousListRef.current;
90
+ previousListRef.current = { token: answerToken, ids };
91
+ if (previous === null || previous.token === answerToken)
92
+ return;
93
+ if (isAppendOf(previous.ids, ids))
94
+ return;
95
+ setStored((current) => ({
96
+ ...(current.resetKey === resetKey ? current : emptyAccumulated(resetKey)),
97
+ answeredIds: new Set(),
98
+ }));
99
+ }, [answerToken, ids, resetKey]);
100
+ const fieldsById = accumulated.fieldsById;
101
+ const decorated = decoration !== undefined;
102
+ return useMemo(() => (!decorated || error !== null ? rows : applyDecorationFields(rows, fieldsById)), [decorated, error, rows, fieldsById]);
55
103
  }
@@ -73,7 +73,7 @@ export function useScreenListRows({ queryType, payload, infinite, aggregates, ro
73
73
  const loadedRows = grouped ? aggregates.rows : infinite ? state.rows : (data?.rows ?? NO_ROWS);
74
74
  // Grouped rows are rebuilt on every render, so only a group refresh counts as a new answer.
75
75
  const answerToken = grouped ? aggregates.groupPages.refreshNonce : loadedRows;
76
- const rows = useRowDecoration(rowDecoration, loadedRows, answerToken);
76
+ const rows = useRowDecoration(rowDecoration, loadedRows, answerToken, resetKey);
77
77
  if (grouped) {
78
78
  return {
79
79
  rows,
@@ -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 {};
@@ -0,0 +1,2 @@
1
+ export declare const AiAssistPayloadProvider: import("react").Provider<Readonly<Record<string, unknown>>>;
2
+ export declare function useAiAssistPayload(): Readonly<Record<string, unknown>>;
@@ -0,0 +1,8 @@
1
+ import { createContext, useContext } from "react";
2
+ // Context payload every aiAssist query of the surrounding form receives; set by the screen that
3
+ // knows what the form is about (actionForm: its load id or drawer row values).
4
+ const AiAssistPayloadContext = createContext({});
5
+ export const AiAssistPayloadProvider = AiAssistPayloadContext.Provider;
6
+ export function useAiAssistPayload() {
7
+ return useContext(AiAssistPayloadContext);
8
+ }
@@ -19,9 +19,9 @@ export declare function ExtensionSectionMount({ section, entityName: hostEntityN
19
19
  readonly stepKey?: string;
20
20
  readonly onReportStepComplete?: (stepKey: string, complete: boolean) => void;
21
21
  }): ReactNode;
22
- export declare function EditSlotMount({ slot, slotName, screenId, entityName, entityId, values, markSaved, hasUnsavedChanges, wizardStep, }: {
22
+ export declare function EditSlotMount({ slot, slotName, screenId, entityName, entityId, values, markSaved, hasUnsavedChanges, wizardStep, activeTabId, }: {
23
23
  readonly slot: PlatformComponent;
24
- readonly slotName: "header" | "titleAction" | "footer";
24
+ readonly slotName: "header" | "titleAction" | "afterForm" | "footer";
25
25
  readonly screenId: string;
26
26
  readonly entityName: string;
27
27
  readonly entityId: string | null;
@@ -32,4 +32,5 @@ export declare function EditSlotMount({ slot, slotName, screenId, entityName, en
32
32
  readonly index: number;
33
33
  readonly isLast: boolean;
34
34
  };
35
+ readonly activeTabId?: string;
35
36
  } & StickyPrimaryActionMarker): ReactNode;
@@ -39,7 +39,7 @@ export function ExtensionSectionMount({ section, entityName: hostEntityName, ent
39
39
  // component for both slots — header passes no hasUnsavedChanges/wizardStep,
40
40
  // footer does. Own component for rules-of-hooks (useExtensionSectionComponent
41
41
  // must not run conditionally inside RenderEdit's render body).
42
- export function EditSlotMount({ slot, slotName, screenId, entityName, entityId, values, markSaved, hasUnsavedChanges, wizardStep, }) {
42
+ export function EditSlotMount({ slot, slotName, screenId, entityName, entityId, values, markSaved, hasUnsavedChanges, wizardStep, activeTabId, }) {
43
43
  const name = extensionSectionName(slot);
44
44
  const Component = useExtensionSectionComponent(name);
45
45
  useEffect(() => {
@@ -49,5 +49,5 @@ export function EditSlotMount({ slot, slotName, screenId, entityName, entityId,
49
49
  }, [name, Component, screenId, slotName]);
50
50
  if (Component === undefined)
51
51
  return null;
52
- return (_jsx(Component, { entityName: entityName, entityId: entityId, values: values, ...(markSaved !== undefined && { markSaved }), ...(hasUnsavedChanges !== undefined && { hasUnsavedChanges }), ...(wizardStep !== undefined && { wizardStep }) }));
52
+ return (_jsx(Component, { entityName: entityName, entityId: entityId, values: values, ...(markSaved !== undefined && { markSaved }), ...(hasUnsavedChanges !== undefined && { hasUnsavedChanges }), ...(wizardStep !== undefined && { wizardStep }), ...(activeTabId !== undefined && { activeTabId }) }));
53
53
  }
@@ -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") });
@@ -0,0 +1,10 @@
1
+ import type { ReactNode } from "react";
2
+ import type { EditFieldViewModel } from "../headless/index.ts";
3
+ import type { MultiSelectCheckboxOption } from "./multi-select-checkboxes.tsx";
4
+ export declare function MultiSelectChips({ field, id, options, value, onChange, }: {
5
+ readonly field: EditFieldViewModel;
6
+ readonly id: string;
7
+ readonly options: readonly MultiSelectCheckboxOption[];
8
+ readonly value: readonly string[];
9
+ readonly onChange: (value: readonly string[]) => void;
10
+ }): ReactNode;
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { usePrimitives } from "../primitives.js";
3
+ // MultiSelectFieldDef's `display: "chips"`: every option is a toggle chip, ticked once chosen.
4
+ export function MultiSelectChips({ field, id, options, value, onChange, }) {
5
+ const { Button, Grid } = usePrimitives();
6
+ const selected = new Set(value);
7
+ // Emits in option order, like the checkbox grid, never in click order.
8
+ const toggle = (optionValue) => {
9
+ const next = new Set(selected);
10
+ if (!next.delete(optionValue))
11
+ next.add(optionValue);
12
+ onChange(options.filter((opt) => next.has(opt.value)).map((opt) => opt.value));
13
+ };
14
+ return (_jsx(Grid, { columns: "auto", tight: true, ariaLabelledBy: `${id}-label`, children: options.map((opt) => {
15
+ const isSelected = selected.has(opt.value);
16
+ return (_jsx(Button, { variant: isSelected ? "primary" : "secondary", size: "sm", pressed: isSelected, disabled: field.readOnly === true || opt.disabled === true, testId: `${id}-chip-${opt.value}`, onClick: () => toggle(opt.value), children: isSelected ? `✓ ${opt.label}` : opt.label }, opt.value));
17
+ }) }));
18
+ }
@@ -23,6 +23,7 @@ import { useOptionalLocale, useTranslation } from "../i18n.js";
23
23
  import { PageHeaderSlotAvailableProvider } from "../page-header-slot.js";
24
24
  import { usePrimitives } from "../primitives.js";
25
25
  import { ListGroupPageBridges } from "./list-group-page-bridges.js";
26
+ import { RelatedPhotoGrid } from "./related-photo-grid.js";
26
27
  import { RenderEditActionButton } from "./render-edit-action-button.js";
27
28
  import { RenderList } from "./render-list.js";
28
29
  // Keyed on the type, not on key presence: most factories omit `sortable`
@@ -79,8 +80,43 @@ function buildRowTone(rule) {
79
80
  return undefined;
80
81
  return (row) => (evalFieldCondition(rule, { ...row.values }) ? rule.tone : undefined);
81
82
  }
83
+ function RelatedListEmptyState({ text, actionButton, onActionError, }) {
84
+ const { Text, Button, Dialog } = usePrimitives();
85
+ return (_jsxs(_Fragment, { children: [_jsx(Text, { children: text.title }), text.description !== undefined && _jsx(Text, { variant: "small", children: text.description }), actionButton !== undefined && (_jsx(RenderEditActionButton, { action: actionButton, Button: Button, Dialog: Dialog, onError: onActionError }))] }));
86
+ }
87
+ function EmbeddedRelatedListCard({ title, actions, testId, children, }) {
88
+ const { Card } = usePrimitives();
89
+ return (_jsx(Card, { options: { framed: false, padded: false },
90
+ // Trim the default header inset: the host row already pads the area.
91
+ className: "[&>div:first-child]:px-0 [&>div:first-child]:pt-1 [&>div:first-child]:pb-2", slots: { title, ...(actions !== undefined && { headerActions: actions }) }, testId: testId, children: children }));
92
+ }
93
+ // A row-body click target comes from EITHER the legacy `rowClick` field OR
94
+ // a `rowActions` entry marked rowClick:true — the boot-validator rejects
95
+ // both being set, so this order is just a fallback, not a precedence rule.
96
+ function buildRelatedListRowClick(section, nav, host, onOpenDrawer) {
97
+ const rowClick = section.rowClick;
98
+ if (rowClick !== undefined) {
99
+ return (row) => {
100
+ const id = String(row.values[rowClick.idColumn ?? "id"] ?? "");
101
+ if (id === "")
102
+ return;
103
+ navigateWithReturnTo(nav, { entity: rowClick.entity, id }, host);
104
+ };
105
+ }
106
+ const rowClickAction = findRowClickAction(section.rowActions);
107
+ if (rowClickAction === undefined)
108
+ return undefined;
109
+ return (row) => {
110
+ if (rowClickAction.kind === "navigate") {
111
+ runProjectionRowNavigate(nav, rowClickAction, row, host);
112
+ }
113
+ else if (onOpenDrawer !== undefined) {
114
+ runDrawerRowAction(rowClickAction, onOpenDrawer, row);
115
+ }
116
+ };
117
+ }
82
118
  export function RelatedListSection({ section, parentId, record, featureName, translate, hideTitle, grow, onOpenDrawer, actions, anchorId, embedded, onAfterWrite, refreshToken, }) {
83
- const { Banner, Section, Card, FillContainer, Text, Button, Dialog } = usePrimitives();
119
+ const { Banner, Section, FillContainer, PhotoGrid } = usePrimitives();
84
120
  const [emptyStateActionError, setEmptyStateActionError] = useState(null);
85
121
  const t = useTranslation();
86
122
  const effectiveTranslate = translate ?? t;
@@ -162,28 +198,7 @@ export function RelatedListSection({ section, parentId, record, featureName, tra
162
198
  const { refetchSelfAndHost, aggregates } = listRows;
163
199
  const onFilterChange = useCallback((field, values) => setFilters((prev) => ({ ...prev, [field]: values })), [setFilters]);
164
200
  const onFilterReset = useCallback(() => setFilters({}), [setFilters]);
165
- const rowClick = section.rowClick;
166
- // A row-body click target comes from EITHER the legacy `rowClick` field OR
167
- // a `rowActions` entry marked rowClick:true — the boot-validator rejects
168
- // both being set, so this order is just a fallback, not a precedence rule.
169
- const rowClickAction = findRowClickAction(section.rowActions);
170
- const onRowClick = rowClick !== undefined
171
- ? (row) => {
172
- const id = String(row.values[rowClick.idColumn ?? "id"] ?? "");
173
- if (id === "")
174
- return;
175
- navigateWithReturnTo(nav, { entity: rowClick.entity, id }, host);
176
- }
177
- : rowClickAction !== undefined
178
- ? (row) => {
179
- if (rowClickAction.kind === "navigate") {
180
- runProjectionRowNavigate(nav, rowClickAction, row, host);
181
- }
182
- else if (onOpenDrawer !== undefined) {
183
- runDrawerRowAction(rowClickAction, onOpenDrawer, row);
184
- }
185
- }
186
- : undefined;
201
+ const onRowClick = buildRelatedListRowClick(section, nav, host, onOpenDrawer);
187
202
  // Same execution path as projectionList's rowActions (kumiko-screen.tsx) —
188
203
  // a relatedList row has the identical "no guaranteed id field" shape a
189
204
  // query-projection row has, so navigate/writeHandler dispatch is shared
@@ -286,12 +301,12 @@ export function RelatedListSection({ section, parentId, record, featureName, tra
286
301
  refetchSelfAndHost,
287
302
  ]);
288
303
  const emptyStateText = pickEmptyStateText(section.emptyState, record);
289
- const emptyStateContent = emptyStateText !== undefined ? (_jsxs(_Fragment, { children: [_jsx(Text, { children: emptyStateText.title }), emptyStateText.description !== undefined && (_jsx(Text, { variant: "small", children: emptyStateText.description })), emptyStateActionButton !== undefined && (_jsx(RenderEditActionButton, { action: emptyStateActionButton, Button: Button, Dialog: Dialog, onError: setEmptyStateActionError }))] })) : undefined;
304
+ const emptyStateContent = emptyStateText !== undefined ? (_jsx(RelatedListEmptyState, { text: emptyStateText, actionButton: emptyStateActionButton, onActionError: setEmptyStateActionError })) : undefined;
290
305
  // Without a cursor-driven pager the client-side sort covers only the fetched
291
306
  // rows; the banner keeps it from claiming "these are the top N".
292
307
  const content = listRows.firstLoad ? (_jsx(Banner, { padded: true, variant: "loading", testId: "related-list-loading", children: t("kumiko.widget.loading") })) : listRows.error ? (_jsx(Banner, { padded: true, variant: "error", testId: "related-list-error", children: dispatcherErrorText(listRows.error, effectiveTranslate) })) : (_jsxs(_Fragment, { children: [listRows.truncated && (_jsx(Banner, { variant: "info", testId: "related-list-truncated", children: effectiveTranslate("kumiko.list.related-list-truncated", {
293
308
  count: listRows.rows.length,
294
- }) })), emptyStateActionError !== null && (_jsxs(Banner, { variant: "error", testId: "related-list-empty-state-action-error", children: [emptyStateActionError.message, _jsx(ErrorReference, { requestId: emptyStateActionError.requestId })] })), _jsx(ListGroupPageBridges, { ...aggregates.groupPages }), _jsx(PageHeaderSlotAvailableProvider, { value: false, children: _jsx(RenderList, { screen: listScreen, entity: entity, rows: listRows.rows, featureName: listFeatureName ?? featureName, translate: effectiveTranslate, ...(section.description !== undefined && { description: section.description }), ...(section.itemNoun !== undefined && { itemNounKey: section.itemNoun }), sort: sort, onSortChange: setSort, ...(section.searchable === true && {
309
+ }) })), emptyStateActionError !== null && (_jsxs(Banner, { variant: "error", testId: "related-list-empty-state-action-error", children: [emptyStateActionError.message, _jsx(ErrorReference, { requestId: emptyStateActionError.requestId })] })), _jsx(ListGroupPageBridges, { ...aggregates.groupPages }), section.photoGrid !== undefined && PhotoGrid !== undefined ? (listRows.rows.length === 0 ? (emptyStateContent) : (_jsx(RelatedPhotoGrid, { rows: listRows.rows, photoGrid: section.photoGrid, rowActions: rowActions, onActionError: setEmptyStateActionError, testId: "related-photo-grid" }))) : (_jsx(PageHeaderSlotAvailableProvider, { value: false, children: _jsx(RenderList, { screen: listScreen, entity: entity, rows: listRows.rows, featureName: listFeatureName ?? featureName, translate: effectiveTranslate, ...(section.description !== undefined && { description: section.description }), ...(section.itemNoun !== undefined && { itemNounKey: section.itemNoun }), sort: sort, onSortChange: setSort, ...(section.searchable === true && {
295
310
  searchable: true,
296
311
  searchValue: search,
297
312
  onSearchChange: setSearch,
@@ -300,7 +315,9 @@ export function RelatedListSection({ section, parentId, record, featureName, tra
300
315
  filterValues: filters,
301
316
  onFilterChange,
302
317
  onFilterReset,
303
- }), ...(onRowClick !== undefined && { onRowClick }), ...(rowActions !== undefined && { rowActions }), ...(section.rowActionMode !== undefined && { rowActionMode: section.rowActionMode }), ...(bulk !== undefined && { bulk }), ...(rowTone !== undefined && { rowTone }), ...(toolbarActionButtons !== undefined && { toolbarActions: toolbarActionButtons }), ...(emptyStateContent !== undefined && { emptyState: emptyStateContent }), ...listTable, ...(aggregates.serverGroups !== undefined && { serverGroups: aggregates.serverGroups }), ...(aggregates.totals !== undefined && { totals: aggregates.totals }), ...(aggregates.notice !== undefined && { notice: aggregates.notice }), screenPadding: false, ...(hideTitle === true && { scrollBody: true, chromeless: true }), ...(embedded === true && { chromeless: true }) }) })] }));
318
+ }), ...(onRowClick !== undefined && { onRowClick }), ...(rowActions !== undefined && { rowActions }), ...(section.rowActionMode !== undefined && { rowActionMode: section.rowActionMode }), ...(bulk !== undefined && { bulk }), ...(rowTone !== undefined && { rowTone }), ...(toolbarActionButtons !== undefined && { toolbarActions: toolbarActionButtons }), ...(emptyStateContent !== undefined && { emptyState: emptyStateContent }), ...listTable, ...(aggregates.serverGroups !== undefined && {
319
+ serverGroups: aggregates.serverGroups,
320
+ }), ...(aggregates.totals !== undefined && { totals: aggregates.totals }), ...(aggregates.notice !== undefined && { notice: aggregates.notice }), screenPadding: false, ...(hideTitle === true && { scrollBody: true, chromeless: true }), ...(embedded === true && { chromeless: true }) }) }))] }));
304
321
  // hideTitle (tabs mode) → the caller (render-edit.tsx) already wraps this
305
322
  // component's own return value in the same Card frame every other tab
306
323
  // kind gets — no card here, or the two would nest. `scrollBody` caps the
@@ -315,12 +332,7 @@ export function RelatedListSection({ section, parentId, record, featureName, tra
315
332
  const countSuffix = listRows.hasData
316
333
  ? ` · ${aggregates.serverGroups?.totalCount ?? listRows.rows.length}`
317
334
  : "";
318
- return (_jsxs(_Fragment, { children: [bridges, _jsx(Card, { options: { framed: false, padded: false },
319
- // Trim the default header inset: the host row already pads the area.
320
- className: "[&>div:first-child]:px-0 [&>div:first-child]:pt-1 [&>div:first-child]:pb-2", slots: {
321
- title: `${section.title}${countSuffix}`,
322
- ...(actions !== undefined && { headerActions: actions }),
323
- }, testId: `related-list-${section.title}-${parentId}`, children: content })] }));
335
+ return (_jsxs(_Fragment, { children: [bridges, _jsx(EmbeddedRelatedListCard, { title: `${section.title}${countSuffix}`, actions: actions, testId: `related-list-${section.title}-${parentId}`, children: content })] }));
324
336
  }
325
337
  if (hideTitle) {
326
338
  return (_jsxs(_Fragment, { children: [bridges, FillContainer !== undefined ? (_jsx(FillContainer, { ...(grow === true && { grow: true }), children: content })) : (content)] }));
@@ -0,0 +1,11 @@
1
+ import type { EditRelatedListSection } from "@cosmicdrift/kumiko-framework/ui-types";
2
+ import type { ReactNode } from "react";
3
+ import type { ErrorNotice } from "../app/error-reference.tsx";
4
+ import { type DataTableRowAction } from "../primitives.tsx";
5
+ export declare function RelatedPhotoGrid({ rows, photoGrid, rowActions, onActionError, testId, }: {
6
+ readonly rows: readonly Readonly<Record<string, unknown>>[];
7
+ readonly photoGrid: NonNullable<EditRelatedListSection["photoGrid"]>;
8
+ readonly rowActions: readonly DataTableRowAction[] | undefined;
9
+ readonly onActionError: (notice: ErrorNotice | null) => void;
10
+ readonly testId?: string;
11
+ }): ReactNode;
@@ -0,0 +1,40 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { fileIdsOf } from "../file-ids-of.js";
3
+ import { usePrimitives } from "../primitives.js";
4
+ import { RenderEditActionButton } from "./render-edit-action-button.js";
5
+ function viewModelOf(row) {
6
+ return { id: String(row["id"] ?? ""), values: row };
7
+ }
8
+ // One tile per row: the row's image and its row actions as buttons. The same
9
+ // DataTableRowAction list the table would get, so confirm and visibility behave alike.
10
+ export function RelatedPhotoGrid({ rows, photoGrid, rowActions, onActionError, testId, }) {
11
+ const { PhotoGrid, Button, Dialog } = usePrimitives();
12
+ if (PhotoGrid === undefined)
13
+ return null;
14
+ const { imageField, captionField } = photoGrid;
15
+ return (_jsx(PhotoGrid, { ...(testId !== undefined && { testId }), tiles: rows.map((row, index) => {
16
+ const vm = viewModelOf(row);
17
+ const caption = captionField === undefined ? undefined : row[captionField];
18
+ const imageId = fileIdsOf(row[imageField])[0];
19
+ return {
20
+ id: vm.id === "" ? String(index) : vm.id,
21
+ ...(imageId !== undefined && { imageId }),
22
+ ...(typeof caption === "string" && caption !== "" && { caption }),
23
+ actions: (rowActions ?? [])
24
+ .filter((action) => action.isVisible?.(vm) !== false)
25
+ .map((action) => (_jsx(RenderEditActionButton, { action: {
26
+ id: action.id,
27
+ label: action.label,
28
+ onPress: () => action.onTrigger(vm),
29
+ ...(action.style !== undefined && { style: action.style }),
30
+ ...(action.display !== undefined && { display: action.display }),
31
+ ...(action.confirm !== undefined && { confirm: action.confirm }),
32
+ ...(action.confirmLabel !== undefined && { confirmLabel: action.confirmLabel }),
33
+ ...(action.confirmRequired !== undefined && {
34
+ confirmRequired: action.confirmRequired,
35
+ }),
36
+ ...(action.icon !== undefined && { icon: action.icon }),
37
+ }, Button: Button, Dialog: Dialog, onError: onActionError }, action.id))),
38
+ };
39
+ }) }));
40
+ }
@@ -1,6 +1,6 @@
1
1
  import type { ReactNode } from "react";
2
2
  import { type ErrorNotice } from "../app/error-reference.tsx";
3
- import type { usePrimitives } from "../primitives.tsx";
3
+ import type { FooterActionMarker, usePrimitives } from "../primitives.tsx";
4
4
  import type { RenderEditAction } from "./render-edit-types.ts";
5
5
  export declare function needsActionConfirm(action: Pick<RenderEditAction, "confirm" | "confirmRequired" | "style">): boolean;
6
6
  export declare function RenderEditActionConfirmDialog({ action, open, onOpenChange, onConfirm, Dialog, }: {
@@ -22,4 +22,4 @@ export declare function RenderEditActionButton({ action, iconOnly, hideIcon, siz
22
22
  readonly Button: ReturnType<typeof usePrimitives>["Button"];
23
23
  readonly Dialog: ReturnType<typeof usePrimitives>["Dialog"];
24
24
  readonly onError: (notice: ErrorNotice | null) => void;
25
- }): ReactNode;
25
+ } & FooterActionMarker): ReactNode;
@@ -1,13 +1,13 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Fragment } from "react";
3
3
  import { GridCellForField } from "./grid-cell-for-field.js";
4
- function appendixCellProps(props, fieldName) {
4
+ function appendixCellProps(props, fieldName, values) {
5
5
  const { labelAppendix, fieldAppendix, fieldAppendixPlacement, fieldDescription } = props;
6
6
  return {
7
7
  ...(labelAppendix !== undefined && { labelAppendix: labelAppendix(fieldName) }),
8
8
  ...(fieldAppendix !== undefined && { fieldAppendix: fieldAppendix(fieldName) }),
9
9
  ...(fieldAppendixPlacement !== undefined && { appendixPlacement: fieldAppendixPlacement }),
10
- ...(fieldDescription !== undefined && { description: fieldDescription(fieldName) }),
10
+ ...(fieldDescription !== undefined && { description: fieldDescription(fieldName, values) }),
11
11
  };
12
12
  }
13
13
  function createFieldCellRenderer(model, section, columns) {
@@ -31,7 +31,7 @@ function createFieldCellRenderer(model, section, columns) {
31
31
  clearErrorsAndValidate(field.field);
32
32
  }, ...(props.actionFormScreenQn !== undefined && {
33
33
  onSuggest: (value) => form.controller.seedField(field.field, value),
34
- }), GridCell: GridCell, featureName: props.featureName, ...appendixCellProps(props, field.field), allIssues: snapshot.errors, valueDisplay: props.valueDisplay, row: snapshot.values, ...(disabled && { fillDisabled: true }), ...(props.hideSectionTitles !== true &&
34
+ }), GridCell: GridCell, featureName: props.featureName, ...appendixCellProps(props, field.field, snapshot.values), allIssues: snapshot.errors, valueDisplay: props.valueDisplay, row: snapshot.values, ...(disabled && { fillDisabled: true }), ...(props.hideSectionTitles !== true &&
35
35
  section.title !== undefined && { sectionTitle: section.title }), ...(showsChangedMarker && field.field in snapshot.changes && { changed: true }) }, field.field));
36
36
  }
37
37
  export function renderFieldGrid(model, section, fields, columns, gridKey) {
@@ -1,6 +1,6 @@
1
1
  import type { ReactNode } from "react";
2
2
  import type { FormValues } from "../headless/index.ts";
3
- import type { ActionMenuItemSpec } from "../primitives.tsx";
3
+ import { type ActionMenuItemSpec } from "../primitives.tsx";
4
4
  import type { RenderEditModel } from "./render-edit-render-model.ts";
5
5
  export type HeaderActionsModel = {
6
6
  readonly headerMenuItems: readonly ActionMenuItemSpec[];
@@ -8,4 +8,5 @@ export type HeaderActionsModel = {
8
8
  readonly formHeaderRegion: ReactNode;
9
9
  readonly titleActionMount: ReactNode;
10
10
  };
11
+ export declare function renderAfterFormSlot<TValues extends FormValues, TCtx>(model: RenderEditModel<TValues, TCtx>): ReactNode;
11
12
  export declare function buildHeaderActions<TValues extends FormValues, TCtx>(model: RenderEditModel<TValues, TCtx>): HeaderActionsModel;
@@ -1,4 +1,5 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { FOOTER_ACTION_ROLE_PROP, } from "../primitives.js";
2
3
  import { EditSlotMount } from "./edit-mounts.js";
3
4
  import { RenderEditActionButton } from "./render-edit-action-button.js";
4
5
  import { resolveExtensionEntityId } from "./render-edit-logic.js";
@@ -75,9 +76,18 @@ function renderCopyLinkButton({ engine: { props, state }, layout, }) {
75
76
  ? null
76
77
  : translate(linkCopied ? "kumiko.actions.copyLinkCopied" : "kumiko.actions.copyLink") })));
77
78
  }
79
+ // The role prop is read by NarrowPinnedFooter from the element, so the DOM span needs a component in between.
80
+ function FooterStartGroup({ children, }) {
81
+ return (_jsx("span", { className: "mr-auto inline-flex gap-2 max-sm:flex max-sm:w-full max-sm:[&>button]:flex-1", "data-footer-align": "start", "data-testid": "render-edit-footer-start", children: children }));
82
+ }
78
83
  function renderCustomActions({ engine: { props, state }, layout, }) {
79
84
  const { Button, Dialog } = state.primitives;
80
- return props.actions?.map((action) => (_jsx(RenderEditActionButton, { action: action, iconOnly: layout.iconOnlyMidActions, Button: Button, Dialog: Dialog, onError: state.setActionError }, action.id)));
85
+ const button = (action) => (_jsx(RenderEditActionButton, { action: action, iconOnly: layout.iconOnlyMidActions, ...(action.pinnedOnPhone === true && { [FOOTER_ACTION_ROLE_PROP]: "inline" }), Button: Button, Dialog: Dialog, onError: state.setActionError }, action.id));
86
+ const startActions = props.actions?.filter((action) => action.align === "start") ?? [];
87
+ const otherActions = props.actions?.filter((action) => action.align !== "start");
88
+ return (_jsxs(_Fragment, { children: [props.footerHint !== undefined && (_jsx("span", { "data-testid": "render-edit-footer-hint", className: "mr-auto min-w-0 text-[13px] text-muted-foreground max-sm:hidden", children: props.footerHint })), startActions.length > 0 && (_jsx(FooterStartGroup, { ...(startActions.some((action) => action.pinnedOnPhone === true) && {
89
+ [FOOTER_ACTION_ROLE_PROP]: "inline",
90
+ }), children: startActions.map(button) })), otherActions?.map(button)] }));
81
91
  }
82
92
  function renderMenuActionButtons({ engine: { props, state }, layout, }) {
83
93
  const { Button, Dialog } = state.primitives;
@@ -98,6 +108,13 @@ function renderEditSlot({ engine: { props, form, sections } }, slot, slotName) {
98
108
  return undefined;
99
109
  return (_jsx(EditSlotMount, { slot: slot, slotName: slotName, screenId: props.screen.id, entityName: sections.vm.entityName, entityId: resolveExtensionEntityId(props.entityId, sections.vm.id), values: form.snapshot.values }));
100
110
  }
111
+ export function renderAfterFormSlot(model) {
112
+ const { props, form, sections } = model.engine;
113
+ const slot = props.screen.slots?.afterForm;
114
+ if (slot === undefined)
115
+ return undefined;
116
+ return (_jsx(EditSlotMount, { slot: slot, slotName: "afterForm", screenId: props.screen.id, entityName: sections.vm.entityName, entityId: resolveExtensionEntityId(props.entityId, sections.vm.id), values: form.snapshot.values, ...(props.activeTabId !== undefined && { activeTabId: props.activeTabId }) }));
117
+ }
101
118
  // A function headerRegion places the slot itself (projectionDetail puts it
102
119
  // into its header card next to the actions); otherwise the slot renders
103
120
  // above the caller's own headerRegion.
@@ -3,7 +3,7 @@ import { ExtensionFormRegistryProvider } from "../app/extension-form-submit.js";
3
3
  import { FormUploadTrackerProvider } from "./form-pending-uploads.js";
4
4
  import { renderActionErrorBanner, renderAllRequiredHint, renderDeleteDialog, renderDraftPicker, renderExtensionErrorBanner, renderFormErrorBanner, renderRootIssueBanners, renderTabStrip, renderWizardProgress, } from "./render-edit-banners.js";
5
5
  import { renderFormActions } from "./render-edit-form-actions.js";
6
- import { buildHeaderActions } from "./render-edit-header-actions.js";
6
+ import { buildHeaderActions, renderAfterFormSlot, } from "./render-edit-header-actions.js";
7
7
  import { renderEditSections } from "./render-edit-section-kinds.js";
8
8
  import { deriveWizardRail } from "./render-edit-wizard-rail.js";
9
9
  import { AllFieldsRequiredProvider } from "./render-field.js";
@@ -72,5 +72,5 @@ export function renderEditLayout(model) {
72
72
  const { props, state, sections, handleSubmit } = model.engine;
73
73
  const header = buildHeaderActions(model);
74
74
  const { Form } = state.primitives;
75
- return (_jsx(ExtensionFormRegistryProvider, { value: state.extensionFormRegistry, children: _jsxs(FormUploadTrackerProvider, { value: state.trackUpload, children: [state.menuActionConfirmDialog, renderPageHeader(model, header), _jsx(Form, { onSubmit: () => void handleSubmit(), ...(state.focusFirstErrorKey > 0 && { focusFirstErrorKey: state.focusFirstErrorKey }), ...buildFormHeadingProps(model), ...buildFormActionProps(model, header), testId: "render-edit-form", stickyActions: state.isWizard || props.fillScreenHeight === true, ...buildFormChromeProps(model, header), children: _jsxs(AllFieldsRequiredProvider, { value: sections.showsAllRequiredHint || props.screen.layout.hideRequiredMarker === true, children: [props.leadContent, sections.showsAllRequiredHint && !state.insideDrawer && renderAllRequiredHint(model), renderDraftPicker(model), renderWizardProgress(model), state.isTabs && state.isStepped && renderTabStrip(model), renderEditSections(model), renderFormErrorBanner(model), renderRootIssueBanners(model), renderExtensionErrorBanner(model), renderActionErrorBanner(model), renderDeleteDialog(model)] }) })] }) }));
75
+ return (_jsx(ExtensionFormRegistryProvider, { value: state.extensionFormRegistry, children: _jsxs(FormUploadTrackerProvider, { value: state.trackUpload, children: [state.menuActionConfirmDialog, renderPageHeader(model, header), _jsx(Form, { onSubmit: () => void handleSubmit(), ...(state.focusFirstErrorKey > 0 && { focusFirstErrorKey: state.focusFirstErrorKey }), ...buildFormHeadingProps(model), ...buildFormActionProps(model, header), testId: "render-edit-form", stickyActions: state.isWizard || props.fillScreenHeight === true, ...buildFormChromeProps(model, header), children: _jsxs(AllFieldsRequiredProvider, { value: sections.showsAllRequiredHint || props.screen.layout.hideRequiredMarker === true, children: [props.leadContent, sections.showsAllRequiredHint && !state.insideDrawer && renderAllRequiredHint(model), renderDraftPicker(model), renderWizardProgress(model), state.isTabs && state.isStepped && renderTabStrip(model), props.formErrorOnTop === true && renderFormErrorBanner(model), renderEditSections(model), renderAfterFormSlot(model), props.formErrorOnTop !== true && renderFormErrorBanner(model), renderRootIssueBanners(model), renderExtensionErrorBanner(model), renderActionErrorBanner(model), renderDeleteDialog(model)] }) })] }) }));
76
76
  }
@@ -93,6 +93,7 @@ export function filterEditSections(sections, fieldsFilter) {
93
93
  for (const section of sections) {
94
94
  if (section.kind === "extension" ||
95
95
  section.kind === "relatedList" ||
96
+ section.kind === "stepList" ||
96
97
  section.kind === "writeForm") {
97
98
  result.push(section);
98
99
  continue;
@@ -47,6 +47,15 @@ function renderRelatedListSection({ model, sectionIndex, sectionActionsEl }, sec
47
47
  // layout); the toolbar buttons live in the list's own toolbar.
48
48
  return hideSectionTitles === true ? (_jsx("div", { className: fillScreenHeight === true ? "flex min-h-0 flex-1 flex-col" : undefined, children: mount }, section.title)) : (mount);
49
49
  }
50
+ function renderStepListSection({ model, sectionIndex }, section) {
51
+ const { Section, StepList } = model.engine.state.primitives;
52
+ if (StepList === undefined || section.items.length === 0)
53
+ return null;
54
+ const items = section.items.map((item, index) => ({ id: String(index), ...item }));
55
+ return (_jsx(Section, { ...(section.title !== undefined && !model.engine.props.hideSectionTitles
56
+ ? { title: section.title }
57
+ : {}), testId: "step-list-section", children: _jsx(StepList, { items: items, testId: "step-list" }) }, section.title ?? `step-list-${sectionIndex}`));
58
+ }
50
59
  function renderWriteFormSection({ model, sectionIndex, sectionActionsEl }, section) {
51
60
  const { props, state, sections } = model.engine;
52
61
  // Own submit button + dispatcher call, entirely independent of
@@ -62,6 +71,8 @@ function renderSectionByKind(rc, section) {
62
71
  return renderRelatedListSection(rc, section);
63
72
  case "writeForm":
64
73
  return renderWriteFormSection(rc, section);
74
+ case "stepList":
75
+ return renderStepListSection(rc, section);
65
76
  case "fields":
66
77
  return renderFieldsSection(rc, section);
67
78
  }