@cosmicdrift/kumiko-renderer 0.416.0 → 0.418.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 (191) hide show
  1. package/dist/app/action-form-body.d.ts +1 -4
  2. package/dist/app/action-form-body.js +14 -9
  3. package/dist/app/action-form-preview.d.ts +13 -0
  4. package/dist/app/action-form-preview.js +66 -0
  5. package/dist/app/action-form-support.d.ts +6 -1
  6. package/dist/app/action-form-support.js +26 -9
  7. package/dist/app/config-edit-body.js +71 -79
  8. package/dist/app/entity-list-screen.js +1 -1
  9. package/dist/app/header-actions-bar.d.ts +3 -1
  10. package/dist/app/header-actions-bar.js +12 -4
  11. package/dist/app/list-bulk-actions.d.ts +8 -1
  12. package/dist/app/list-bulk-actions.js +28 -4
  13. package/dist/app/locked-screen-header.d.ts +2 -0
  14. package/dist/app/locked-screen-header.js +8 -1
  15. package/dist/app/projection-detail-body.js +24 -5
  16. package/dist/app/projection-detail-guidance.d.ts +1 -0
  17. package/dist/app/projection-detail-guidance.js +7 -4
  18. package/dist/app/projection-detail-header-model.js +4 -1
  19. package/dist/app/projection-detail-header-region.js +25 -9
  20. package/dist/app/projection-detail-header.d.ts +2 -0
  21. package/dist/app/projection-detail-header.js +30 -3
  22. package/dist/app/projection-list-shim.js +1 -0
  23. package/dist/app/row-actions.d.ts +4 -0
  24. package/dist/app/row-actions.js +19 -3
  25. package/dist/app/use-projection-detail-actions.d.ts +3 -1
  26. package/dist/app/use-projection-detail-actions.js +9 -1
  27. package/dist/app/use-projection-detail-data.js +17 -1
  28. package/dist/app/use-projection-list-data.js +1 -1
  29. package/dist/card-options.d.ts +2 -0
  30. package/dist/components/choice-chip-class.d.ts +1 -0
  31. package/dist/components/choice-chip-class.js +9 -0
  32. package/dist/components/edit-mounts.d.ts +1 -1
  33. package/dist/components/embedded-list-paste.js +2 -2
  34. package/dist/components/grid-cell-for-field.js +1 -1
  35. package/dist/components/multi-select-chips.js +7 -2
  36. package/dist/components/multi-select-count.d.ts +5 -0
  37. package/dist/components/multi-select-count.js +10 -0
  38. package/dist/components/narrow-description.d.ts +3 -0
  39. package/dist/components/narrow-description.js +12 -0
  40. package/dist/components/related-list-section.d.ts +5 -3
  41. package/dist/components/related-list-section.js +9 -4
  42. package/dist/components/related-photo-grid.js +17 -3
  43. package/dist/components/render-edit-field-grid.d.ts +12 -3
  44. package/dist/components/render-edit-field-grid.js +60 -18
  45. package/dist/components/render-edit-fields-section.js +45 -11
  46. package/dist/components/render-edit-header-actions.js +1 -1
  47. package/dist/components/render-edit-layout.js +5 -3
  48. package/dist/components/render-edit-section-kinds.js +50 -12
  49. package/dist/components/render-edit-titles.js +1 -1
  50. package/dist/components/render-edit-types.d.ts +13 -0
  51. package/dist/components/render-field-ai-assist.js +26 -7
  52. package/dist/components/render-field-choice-inputs.js +3 -0
  53. package/dist/components/render-field-control.js +1 -1
  54. package/dist/components/render-field-value-chips.js +6 -4
  55. package/dist/components/render-field-values.js +3 -3
  56. package/dist/components/render-list-hint-columns.d.ts +1 -0
  57. package/dist/components/render-list-hint-columns.js +30 -5
  58. package/dist/components/render-list-reference-columns.js +2 -4
  59. package/dist/components/render-list-row-tone.d.ts +2 -0
  60. package/dist/components/render-list-row-tone.js +6 -0
  61. package/dist/components/render-list-table-props.d.ts +13 -2
  62. package/dist/components/render-list-table-props.js +9 -3
  63. package/dist/components/render-list-types.d.ts +4 -0
  64. package/dist/components/render-list.js +12 -4
  65. package/dist/components/use-render-list-columns.js +3 -3
  66. package/dist/components/write-form-registry.d.ts +13 -0
  67. package/dist/components/write-form-registry.js +6 -0
  68. package/dist/components/write-form-section.d.ts +5 -1
  69. package/dist/components/write-form-section.js +55 -16
  70. package/dist/data-table-bulk-types.d.ts +11 -2
  71. package/dist/data-table-bulk-types.js +3 -1
  72. package/dist/headless/form/form-controller.d.ts +2 -0
  73. package/dist/headless/form/form-controller.js +2 -2
  74. package/dist/headless/format/index.d.ts +1 -1
  75. package/dist/headless/format/index.js +6 -5
  76. package/dist/headless/format/money.d.ts +5 -0
  77. package/dist/headless/format/money.js +10 -0
  78. package/dist/headless/format/relative-time.d.ts +2 -0
  79. package/dist/headless/format/relative-time.js +4 -1
  80. package/dist/headless/index.d.ts +1 -1
  81. package/dist/headless/index.js +1 -1
  82. package/dist/headless/view-model/edit.js +87 -37
  83. package/dist/headless/view-model/list.js +6 -0
  84. package/dist/headless/view-model/types.d.ts +50 -5
  85. package/dist/hooks/use-bulk-run.d.ts +2 -2
  86. package/dist/hooks/use-list-table.js +11 -6
  87. package/dist/i18n-defaults.js +8 -2
  88. package/dist/primitives-record-guidance.d.ts +4 -0
  89. package/dist/primitives-share-types.d.ts +82 -0
  90. package/dist/primitives-share-types.js +1 -0
  91. package/dist/primitives.d.ts +34 -83
  92. package/dist/web/app/bold-markup.d.ts +3 -0
  93. package/dist/web/app/bold-markup.js +14 -0
  94. package/dist/web/app/dashboard-body.js +5 -1
  95. package/dist/web/app/dashboard-list-panel.js +7 -4
  96. package/dist/web/app/dashboard-panels.js +31 -3
  97. package/dist/web/app/dashboard-shared.d.ts +3 -1
  98. package/dist/web/app/dashboard-shared.js +3 -3
  99. package/dist/web/app/dashboard-stat-group-panel.d.ts +1 -1
  100. package/dist/web/app/dashboard-stat-group-panel.js +16 -2
  101. package/dist/web/app/dashboard-text-panel.js +11 -6
  102. package/dist/web/app/relative-time.js +10 -1
  103. package/dist/web/components/config-cascade.d.ts +2 -1
  104. package/dist/web/components/config-cascade.js +16 -4
  105. package/dist/web/drawn-icons.js +2 -1
  106. package/dist/web/layout/header-action-pinned.d.ts +4 -2
  107. package/dist/web/layout/header-action-pinned.js +13 -4
  108. package/dist/web/layout/header-overflow-menu.d.ts +2 -0
  109. package/dist/web/layout/header-overflow-menu.js +2 -0
  110. package/dist/web/layout/nav-tree.js +1 -1
  111. package/dist/web/layout/notification-bell.js +13 -4
  112. package/dist/web/layout/page-header-slot.d.ts +2 -0
  113. package/dist/web/layout/page-header-slot.js +4 -0
  114. package/dist/web/layout/screen-focus.js +4 -1
  115. package/dist/web/layout/shell-header.js +15 -7
  116. package/dist/web/primitives/banner.js +14 -3
  117. package/dist/web/primitives/card.js +5 -3
  118. package/dist/web/primitives/combobox.js +2 -2
  119. package/dist/web/primitives/data-table/actions-column.js +1 -1
  120. package/dist/web/primitives/data-table/card-body.d.ts +1 -1
  121. package/dist/web/primitives/data-table/card-body.js +37 -14
  122. package/dist/web/primitives/data-table/card-frame.d.ts +2 -0
  123. package/dist/web/primitives/data-table/card-frame.js +3 -0
  124. package/dist/web/primitives/data-table/card-row.js +28 -9
  125. package/dist/web/primitives/data-table/card-sort-select.js +1 -1
  126. package/dist/web/primitives/data-table/card-view.js +1 -1
  127. package/dist/web/primitives/data-table/data-cell-props.d.ts +2 -1
  128. package/dist/web/primitives/data-table/data-cell-props.js +1 -0
  129. package/dist/web/primitives/data-table/density.d.ts +3 -1
  130. package/dist/web/primitives/data-table/density.js +11 -4
  131. package/dist/web/primitives/data-table/row-render-parts.d.ts +1 -1
  132. package/dist/web/primitives/data-table/row-render-parts.js +3 -5
  133. package/dist/web/primitives/data-table/sort-options-select.js +2 -2
  134. package/dist/web/primitives/data-table/sortable-header.js +4 -4
  135. package/dist/web/primitives/data-table/table-body.js +2 -1
  136. package/dist/web/primitives/data-table/table-chrome.js +1 -3
  137. package/dist/web/primitives/data-table/table-content.js +7 -11
  138. package/dist/web/primitives/data-table/table-data-cell.js +31 -17
  139. package/dist/web/primitives/data-table/table-header-row.js +1 -1
  140. package/dist/web/primitives/data-table/table-view.js +1 -1
  141. package/dist/web/primitives/data-table/toolbar.js +6 -7
  142. package/dist/web/primitives/data-table/use-bulk-selection.d.ts +1 -1
  143. package/dist/web/primitives/data-table/use-bulk-selection.js +5 -0
  144. package/dist/web/primitives/data-table/use-data-table-state.d.ts +6 -1
  145. package/dist/web/primitives/data-table/use-data-table-state.js +12 -2
  146. package/dist/web/primitives/data-table-cell.d.ts +13 -2
  147. package/dist/web/primitives/data-table-cell.js +125 -53
  148. package/dist/web/primitives/data-table.js +1 -1
  149. package/dist/web/primitives/default-form.d.ts +1 -1
  150. package/dist/web/primitives/default-form.js +11 -10
  151. package/dist/web/primitives/drawer.js +2 -7
  152. package/dist/web/primitives/facet-filter.d.ts +1 -1
  153. package/dist/web/primitives/facet-filter.js +2 -5
  154. package/dist/web/primitives/facet-search-filter.js +1 -1
  155. package/dist/web/primitives/facet-trigger-label.d.ts +1 -4
  156. package/dist/web/primitives/facet-trigger-label.js +4 -7
  157. package/dist/web/primitives/field.js +15 -8
  158. package/dist/web/primitives/form-footer-parts.js +2 -2
  159. package/dist/web/primitives/inline-suffix.d.ts +2 -0
  160. package/dist/web/primitives/inline-suffix.js +5 -0
  161. package/dist/web/primitives/input-choice-kinds.js +12 -2
  162. package/dist/web/primitives/input-number-kinds.js +2 -2
  163. package/dist/web/primitives/input-text-kinds.js +1 -1
  164. package/dist/web/primitives/layout-elements.d.ts +4 -4
  165. package/dist/web/primitives/layout-elements.js +49 -12
  166. package/dist/web/primitives/layout.d.ts +1 -1
  167. package/dist/web/primitives/layout.js +1 -1
  168. package/dist/web/primitives/metric.js +4 -5
  169. package/dist/web/primitives/money-input.js +8 -7
  170. package/dist/web/primitives/number-input.d.ts +2 -1
  171. package/dist/web/primitives/number-input.js +9 -4
  172. package/dist/web/primitives/page-header.d.ts +1 -1
  173. package/dist/web/primitives/page-header.js +8 -1
  174. package/dist/web/primitives/pager.js +12 -21
  175. package/dist/web/primitives/photo-grid.js +2 -1
  176. package/dist/web/primitives/record-steps.d.ts +1 -1
  177. package/dist/web/primitives/record-steps.js +6 -15
  178. package/dist/web/primitives/row-actions.js +38 -24
  179. package/dist/web/primitives/use-container-narrow.d.ts +12 -0
  180. package/dist/web/primitives/use-container-narrow.js +42 -0
  181. package/dist/web/pwa/pwa-support.js +13 -7
  182. package/dist/web/ui/input.js +1 -1
  183. package/dist/web/ui/textarea.js +1 -1
  184. package/dist/web/widgets/dashboard-list-cards.js +6 -3
  185. package/dist/web/widgets/dashboard-list.d.ts +4 -1
  186. package/dist/web/widgets/dashboard-list.js +10 -5
  187. package/dist/web/widgets/progress-list.js +1 -1
  188. package/dist/web/widgets/stat-box-cell.js +1 -1
  189. package/package.json +5 -5
  190. package/src/changes.json +51 -0
  191. package/src/web/styles.css +3 -2
@@ -1,11 +1,24 @@
1
1
  import { evalFieldCondition } from "@cosmicdrift/kumiko-framework/ui-types";
2
2
  import { resolveActionIcon } from "@cosmicdrift/kumiko-types/action-icon";
3
3
  import { useMemo } from "react";
4
+ import { useNavigateWithInitialValues } from "./nav.js";
5
+ import { lastSegment } from "./qn.js";
4
6
  import { isWriteHandlerRowAction, refetchAfterWrite, writeRowAction } from "./row-actions.js";
5
7
  import { dispatcherErrorText } from "./write-failed-error.js";
8
+ function isBulkFormDeclaration(bulk) {
9
+ return "screen" in bulk;
10
+ }
6
11
  function asksForConfirm(bulk, rowAction) {
7
12
  return (bulk.confirm !== undefined || rowAction.confirm !== undefined || rowAction.style === "danger");
8
13
  }
14
+ function buildBulkFormAction(bulk, translate, openBulkForm) {
15
+ return {
16
+ id: bulk.id,
17
+ label: translate(bulk.label),
18
+ ...(bulk.icon !== undefined && { icon: bulk.icon }),
19
+ openForm: (rows) => openBulkForm(bulk, rows.map((row) => row.id)),
20
+ };
21
+ }
9
22
  function buildBulkAction(bulk, rowAction, translate, dispatcher) {
10
23
  const label = translate(rowAction.label);
11
24
  const visible = rowAction.visible;
@@ -30,10 +43,13 @@ function buildBulkAction(bulk, rowAction, translate, dispatcher) {
30
43
  },
31
44
  };
32
45
  }
33
- /** Resolves each bulk action against its writeHandler row action; one that resolves to nothing is dropped. */
46
+ /** Resolves each bulk action against its writeHandler row action; one that resolves to nothing is dropped. Form actions need `openBulkForm`. */
34
47
  export function buildListBulkActions(options) {
35
- const { bulkActions, rowActions, translate, dispatcher } = options;
48
+ const { bulkActions, rowActions, translate, dispatcher, openBulkForm } = options;
36
49
  return bulkActions.flatMap((bulk) => {
50
+ if (isBulkFormDeclaration(bulk)) {
51
+ return openBulkForm === undefined ? [] : [buildBulkFormAction(bulk, translate, openBulkForm)];
52
+ }
37
53
  const rowAction = rowActions?.find((action) => action.id === bulk.rowAction);
38
54
  if (rowAction === undefined || !isWriteHandlerRowAction(rowAction))
39
55
  return [];
@@ -43,12 +59,20 @@ export function buildListBulkActions(options) {
43
59
  /** DataTable `bulk` prop of a list screen; undefined without bulk actions or dispatcher. */
44
60
  export function useListBulk(options) {
45
61
  const { bulkActions, rowActions, translate, dispatcher, reload } = options;
62
+ const navigateWithInitialValues = useNavigateWithInitialValues();
46
63
  return useMemo(() => {
47
64
  if (bulkActions === undefined || dispatcher === undefined)
48
65
  return undefined;
49
- const actions = buildListBulkActions({ bulkActions, rowActions, translate, dispatcher });
66
+ const openBulkForm = (action, ids) => navigateWithInitialValues({ screenId: lastSegment(action.screen) }, { [action.idsField]: ids });
67
+ const actions = buildListBulkActions({
68
+ bulkActions,
69
+ rowActions,
70
+ translate,
71
+ dispatcher,
72
+ openBulkForm,
73
+ });
50
74
  if (actions.length === 0)
51
75
  return undefined;
52
76
  return { actions, reload: () => refetchAfterWrite(reload) };
53
- }, [bulkActions, rowActions, translate, dispatcher, reload]);
77
+ }, [bulkActions, rowActions, translate, dispatcher, reload, navigateWithInitialValues]);
54
78
  }
@@ -7,3 +7,5 @@ export declare function LockedHeaderScope({ standInScreenId, children, }: {
7
7
  readonly standInScreenId?: string;
8
8
  readonly children?: ReactNode;
9
9
  }): ReactNode;
10
+ /** True while the screen renders as the stand-in of a locked screen (`visibleWhen` + `fallback`). */
11
+ export declare function useIsStandInScreen(): boolean;
@@ -15,6 +15,9 @@ function LockedScreenHeader({ standInScreenId }) {
15
15
  // every mounted PageHeader overwrites and clears on unmount, so only the outermost scope mounts
16
16
  // a header; nested scopes report the screen that finally renders up to it.
17
17
  const ReportStandInContext = createContext(undefined);
18
+ // Separate from ReportStandInContext: the stand-in's own KumikoScreen wraps its body in a
19
+ // StandInChainBoundary, which clears the report context, so that one cannot tell a body it is a stand-in.
20
+ const StandInScreenContext = createContext(false);
18
21
  /** Screen bodies (and anything embedded in them) are not part of a fallback chain. */
19
22
  export function StandInChainBoundary({ children }) {
20
23
  return (_jsx(ReportStandInContext.Provider, { value: undefined, children: children }));
@@ -29,5 +32,9 @@ export function LockedHeaderScope({ standInScreenId, children, }) {
29
32
  reportToOuter({ screenId: effectiveScreenId });
30
33
  return () => reportToOuter(undefined);
31
34
  }, [reportToOuter, effectiveScreenId]);
32
- return (_jsxs(_Fragment, { children: [reportToOuter === undefined && (_jsx(LockedScreenHeader, { ...(effectiveScreenId !== undefined && { standInScreenId: effectiveScreenId }) })), _jsx(ReportStandInContext.Provider, { value: setInner, children: children })] }));
35
+ return (_jsxs(_Fragment, { children: [reportToOuter === undefined && (_jsx(LockedScreenHeader, { ...(effectiveScreenId !== undefined && { standInScreenId: effectiveScreenId }) })), _jsx(StandInScreenContext.Provider, { value: standInScreenId !== undefined, children: _jsx(ReportStandInContext.Provider, { value: setInner, children: children }) })] }));
36
+ }
37
+ /** True while the screen renders as the stand-in of a locked screen (`visibleWhen` + `fallback`). */
38
+ export function useIsStandInScreen() {
39
+ return useContext(StandInScreenContext);
33
40
  }
@@ -1,6 +1,8 @@
1
- import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { evalFieldCondition } from "@cosmicdrift/kumiko-framework/ui-types";
2
3
  import { useState } from "react";
3
4
  import { RenderEdit } from "../components/render-edit.js";
5
+ import { WriteFormRegistryProvider } from "../components/write-form-registry.js";
4
6
  import { useOptionalDispatcher } from "../context/dispatcher-context.js";
5
7
  import { useUserRoles } from "../context/user-roles-context.js";
6
8
  import { useLocale, useTranslation } from "../i18n.js";
@@ -52,6 +54,8 @@ export function ProjectionDetailBody({ schema, screen, translate, entityId, }) {
52
54
  // headerActions moved out of RenderEdit's footer — this component owns
53
55
  // the failure-surfacing state RenderEdit used to own for them.
54
56
  const [actionError, setActionError] = useState(null);
57
+ // writeForm sections register here so an action with `submitWith` can send their values.
58
+ const [writeForms] = useState(() => new Map());
55
59
  const appFeatures = useAppFeatures();
56
60
  const userRoles = useUserRoles();
57
61
  const dispatcher = useOptionalDispatcher();
@@ -79,6 +83,7 @@ export function ProjectionDetailBody({ schema, screen, translate, entityId, }) {
79
83
  detailQuery,
80
84
  reloadDetail,
81
85
  activeTabId: activeSection?.id,
86
+ writeForms,
82
87
  });
83
88
  const { hasMetrics, headerActionsList, hasHeaderActions, hasHeaderCard, renderedDetailScreen } = useProjectionDetailLayout({ screen, headerActions, hasTabs, detailScreen });
84
89
  const recordId = detailQuery.data?.["id"];
@@ -103,8 +108,13 @@ export function ProjectionDetailBody({ schema, screen, translate, entityId, }) {
103
108
  if (!record) {
104
109
  return renderRecordNotFound({ schema, screen, nav, returnTarget, effectiveTranslate });
105
110
  }
111
+ const visibleMetrics = screen.metrics?.filter((metric) => metric.visibleWhen === undefined || evalFieldCondition(metric.visibleWhen, { ...record }));
106
112
  const regionModel = {
107
- screen: { ...screen, layout: { ...screen.layout, sections: visibleSections } },
113
+ screen: {
114
+ ...screen,
115
+ ...(visibleMetrics !== undefined && { metrics: visibleMetrics }),
116
+ layout: { ...screen.layout, sections: visibleSections },
117
+ },
108
118
  record,
109
119
  primitives,
110
120
  effectiveTranslate,
@@ -119,7 +129,7 @@ export function ProjectionDetailBody({ schema, screen, translate, entityId, }) {
119
129
  pageHeaderSlotAvailable,
120
130
  pageHeaderCompactContext,
121
131
  hasHeaderActions,
122
- hasMetrics,
132
+ hasMetrics: hasMetrics && (visibleMetrics?.length ?? 0) > 0,
123
133
  hasHeaderCard,
124
134
  hasTabs,
125
135
  tabCounts,
@@ -129,9 +139,18 @@ export function ProjectionDetailBody({ schema, screen, translate, entityId, }) {
129
139
  };
130
140
  const regionPieces = deriveDetailRegionPieces(regionModel);
131
141
  const renderHeaderContent = (headerSlot) => renderDetailHeaderContent(regionModel, regionPieces, headerSlot);
132
- return (_jsxs(_Fragment, { children: [refetchErrorBanner, _jsx(RenderEdit, { refreshToken: reloadNonce, screen: renderedDetailScreen, entity: entity, featureName: schema.featureName, initial: record, entityId: effectiveEntityId, customSubmit: async () => ({ isSuccess: true, validationBlocked: false, data: undefined }), onReload: reloadDetail, onRelatedListDrawerAction: openDrawer, ...(translate !== undefined && { translate }), ...(hasTabs && activeSection !== undefined && { activeTabId: activeSection.id }), ...(screen.footerHint !== undefined && {
142
+ return (_jsxs(WriteFormRegistryProvider, { value: writeForms, children: [refetchErrorBanner, _jsx(RenderEdit, { refreshToken: reloadNonce, screen: renderedDetailScreen, entity: entity, featureName: schema.featureName, initial: record, entityId: effectiveEntityId, customSubmit: async () => ({ isSuccess: true, validationBlocked: false, data: undefined }), onReload: reloadDetail, onRelatedListDrawerAction: openDrawer, ...(translate !== undefined && { translate }), ...(hasTabs && activeSection !== undefined && { activeTabId: activeSection.id }), ...(screen.footerHint !== undefined && {
133
143
  footerHint: effectiveTranslate(screen.footerHint),
134
- }), ...(hasTabs && activeSections.length === 1 && { hideSectionTitles: true }), ...(screenFillsHeight(screen) && { fillScreenHeight: true }), ...((hasHeaderCard ||
144
+ }), ...(hasTabs &&
145
+ activeSections.length === 1 &&
146
+ screen.layout.narrowTabs !== false && { hideSectionTitles: true }), recordSections: {
147
+ labelTitles: true,
148
+ ...(hasTabs &&
149
+ activeSections.length > 1 &&
150
+ activeSections[0]?.tabLabel === undefined && { omitFirstTitle: true }),
151
+ ...(screen.pageNavigation === false && { pageNavigation: false }),
152
+ ...(screen.photosBeside === true && { photosBeside: true }),
153
+ }, ...(screenFillsHeight(screen) && { fillScreenHeight: true }), ...((hasHeaderCard ||
135
154
  hasTabs ||
136
155
  hasRecordGuidance(screen) ||
137
156
  screen.slots?.header !== undefined ||
@@ -9,5 +9,6 @@ export type DetailGuidanceModel = DetailHeaderModel & {
9
9
  };
10
10
  export declare function wrapLayout(primitives: DetailGuidanceModel["primitives"], className: string, node: ReactNode): ReactNode;
11
11
  export declare function renderDetailBreadcrumb(model: DetailGuidanceModel): ReactNode;
12
+ export declare function renderDetailSummary(model: DetailGuidanceModel): ReactNode;
12
13
  /** Summary, banner, progress and steps in reading order; blocks whose record field holds nothing drop out. */
13
14
  export declare function renderDetailGuidance(model: DetailGuidanceModel): ReactNode;
@@ -77,7 +77,7 @@ export function renderDetailBreadcrumb(model) {
77
77
  }
78
78
  return (_jsx(Text, { testId: testId, children: items.map((item, index) => (_jsxs(Fragment, { children: [index > 0 && (_jsx(Text, { variant: "muted", decorative: true, children: " / " })), item.link !== undefined ? (_jsx(Link, { href: item.link.href, ...(item.link.onPress !== undefined && { onPress: item.link.onPress }), children: item.label })) : (_jsx(Text, { children: item.label }))] }, keys[index]))) }));
79
79
  }
80
- function renderSummary(model) {
80
+ export function renderDetailSummary(model) {
81
81
  const spec = model.screen.summary;
82
82
  if (spec === undefined)
83
83
  return undefined;
@@ -104,7 +104,7 @@ function renderBanner(model) {
104
104
  return undefined;
105
105
  const { Banner } = model.primitives;
106
106
  const actions = renderItemActions(model, spec.actions, notice);
107
- return wrapLayout(model.primitives, GUIDANCE_INSET, _jsx(Banner, { variant: BANNER_VARIANT[notice.tone ?? "neutral"], icon: BANNER_ICON[notice.tone ?? "neutral"], title: notice.title, ...(notice.narrowTitle !== undefined && { narrowTitle: notice.narrowTitle }), ...(notice.narrowText !== undefined && { narrowText: notice.narrowText }), inline: true, ...(actions !== undefined && { actions }), testId: "kumiko-screen-projection-detail-banner", children: notice.text }));
107
+ return wrapLayout(model.primitives, GUIDANCE_INSET, _jsx(Banner, { variant: BANNER_VARIANT[notice.tone ?? "neutral"], ...(spec.iconless !== true && { icon: BANNER_ICON[notice.tone ?? "neutral"] }), title: notice.title, ...(notice.narrowTitle !== undefined && { narrowTitle: notice.narrowTitle }), ...(notice.narrowText !== undefined && { narrowText: notice.narrowText }), inline: true, ...(actions !== undefined && { actions }), testId: "kumiko-screen-projection-detail-banner", children: notice.text }));
108
108
  }
109
109
  function buildStepItem(model, spec, step) {
110
110
  const [mainAction, ...otherActions] = resolveItemActions(model, spec.actions, step);
@@ -204,6 +204,9 @@ export function renderDetailGuidance(model) {
204
204
  const beside = progress?.placement === "beside-steps" && steps !== undefined;
205
205
  const progressNode = renderProgress(model, beside);
206
206
  const progressInset = progress?.hideOnNarrow === true ? `${PROGRESS_INSET} max-sm:hidden` : PROGRESS_INSET;
207
- return (_jsxs(_Fragment, { children: [renderSummary(model), renderBanner(model), beside ? (wrapLayout(model.primitives, "grid grid-cols-1 items-stretch gap-4 lg:grid-cols-12", _jsxs(_Fragment, { children: [wrapLayout(model.primitives, progressNode !== undefined ? "min-w-0 lg:col-span-8" : "min-w-0 lg:col-span-12", renderSteps(model)), progressNode !== undefined &&
208
- wrapLayout(model.primitives, `${progressInset} lg:col-span-4 lg:flex lg:flex-col lg:pl-0 lg:[&>*]:flex-1`, progressNode)] }))) : (_jsxs(_Fragment, { children: [progressNode !== undefined && wrapLayout(model.primitives, progressInset, progressNode), renderSteps(model)] }))] }));
207
+ const lower = (_jsx(_Fragment, { children: beside ? (wrapLayout(model.primitives, "grid grid-cols-1 items-stretch gap-4 lg:grid-cols-12", _jsxs(_Fragment, { children: [wrapLayout(model.primitives, progressNode !== undefined ? "min-w-0 lg:col-span-8" : "min-w-0 lg:col-span-12", renderSteps(model)), progressNode !== undefined &&
208
+ wrapLayout(model.primitives, `${progressInset} lg:col-span-4 lg:flex lg:flex-col lg:pl-0 lg:[&>*]:flex-1`, progressNode)] }))) : (_jsxs(_Fragment, { children: [progressNode !== undefined && wrapLayout(model.primitives, progressInset, progressNode), renderSteps(model)] })) }));
209
+ return (_jsxs(_Fragment, { children: [renderBanner(model), model.screen.metricsPlacement?.narrow === "before-steps"
210
+ ? wrapLayout(model.primitives, "max-md:order-2", lower)
211
+ : lower] }));
209
212
  }
@@ -65,7 +65,10 @@ export function buildDetailTabItems(sections, record, translate, queryCounts = {
65
65
  const count = typeof countValue === "number" && Number.isFinite(countValue) ? countValue : undefined;
66
66
  return {
67
67
  id: section.id ?? "",
68
- label: translate(section.title ?? section.id ?? ""),
68
+ label: translate(sections.find((s) => s.id === section.id && s.tabLabel !== undefined)?.tabLabel ??
69
+ section.title ??
70
+ section.id ??
71
+ ""),
69
72
  ...(count !== undefined && { count }),
70
73
  };
71
74
  });
@@ -1,8 +1,8 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { resolveRecordTitle } from "../components/render-edit-helpers.js";
3
3
  import { requestLeave } from "../leave-guard.js";
4
- import { renderDetailBreadcrumb, renderDetailGuidance, wrapLayout, } from "./projection-detail-guidance.js";
5
- import { buildMetricItems, renderActionErrorBanner, renderBandSubtitle, renderHeaderActionsContent, renderHeaderSubtitleSlot, renderHeaderTitleSlot, renderMetricsBlock, renderRecordTitleBlock, renderStatusBadge, } from "./projection-detail-header.js";
4
+ import { renderDetailBreadcrumb, renderDetailGuidance, renderDetailSummary, wrapLayout, } from "./projection-detail-guidance.js";
5
+ import { buildMetricItems, renderActionErrorBanner, renderBandSubtitle, renderHeaderActionsContent, renderHeaderSubtitleSlot, renderHeaderTitleSlot, renderMetricsBlock, renderMobileSummary, renderRecordTitleBlock, renderStatusBadge, } from "./projection-detail-header.js";
6
6
  import { buildDetailTabItems } from "./projection-detail-header-model.js";
7
7
  export function deriveDetailRegionPieces(model) {
8
8
  const { screen, record, primitives, actionError, hasHeaderActions } = model;
@@ -46,12 +46,26 @@ const NARROW_METRICS_ORDER = "max-md:order-1";
46
46
  const LEAD_BAND_SHARED_PADDING = "[&>*]:pb-0";
47
47
  const TILES_BAND_SHARED_PADDING = "[&>*]:pt-3";
48
48
  const NARROW_TABS_ORDER = "max-md:order-2";
49
+ const NARROW_TABS_ORDER_AFTER_STEPS = "max-md:order-3";
49
50
  function usesNarrowMetricsOrder(model) {
50
- return model.screen.metricsPlacement?.narrow === "after-guidance";
51
+ return model.screen.metricsPlacement?.narrow !== undefined;
52
+ }
53
+ function narrowTabsOrder(model) {
54
+ return model.screen.metricsPlacement?.narrow === "before-steps"
55
+ ? NARROW_TABS_ORDER_AFTER_STEPS
56
+ : NARROW_TABS_ORDER;
51
57
  }
52
58
  function wrapNarrowOrder(model, orderClass, node) {
53
59
  return usesNarrowMetricsOrder(model) ? wrapLayout(model.primitives, orderClass, node) : node;
54
60
  }
61
+ // `narrowTabs: false` drops the strip on the phone; the sections then stand one under the other.
62
+ function wrapTabStrip(model, strip) {
63
+ const classes = [
64
+ usesNarrowMetricsOrder(model) ? narrowTabsOrder(model) : undefined,
65
+ model.screen.layout.narrowTabs === false ? "max-sm:hidden" : undefined,
66
+ ].filter((c) => c !== undefined);
67
+ return classes.length === 0 ? strip : wrapLayout(model.primitives, classes.join(" "), strip);
68
+ }
55
69
  // Only the metric tiles move below the guidance on narrow screens; the lead and the
56
70
  // subtitle/status line stay under the title, so they get their own tile-less band.
57
71
  function renderBandWithNarrowMetrics(model, metricItems, subtitle, lead) {
@@ -79,16 +93,18 @@ function renderPageHeaderBranch(model, pieces, headerSlot, PageHeader) {
79
93
  // The title block owns chip and subtitle, so neither the shell header nor the band repeats them.
80
94
  const hasTitleBlock = titleText !== undefined;
81
95
  const bandSubtitle = hasTitleBlock ? undefined : pieces.bandSubtitle;
82
- return (_jsxs(_Fragment, { children: [_jsx(PageHeader, { ...(hasTitleBlock && { bodyTitle: true }), ...(hasTitleBlock &&
83
- !pageHeaderCompact && { recordTitle: shortTitleOf(header, record) ?? titleText }), ...(header === undefined && recordTitle !== undefined && { title: recordTitle }), ...(!pageHeaderCompact &&
96
+ return (_jsxs(_Fragment, { children: [_jsx(PageHeader, { ...(hasTitleBlock && { bodyTitle: true }), ...(hasTitleBlock && { recordTitle: shortTitleOf(header, record) ?? titleText }), ...(header?.narrowTitle !== undefined && {
97
+ narrowRecordTitle: model.effectiveTranslate(header.narrowTitle),
98
+ }), ...(header === undefined && recordTitle !== undefined && { title: recordTitle }), ...(!hasTitleBlock &&
99
+ !pageHeaderCompact &&
84
100
  statusBadge !== undefined && {
85
101
  status: statusBadge,
86
102
  }), ...(hasHeaderActions && {
87
103
  actions: renderHeaderActionsContent(model, { compact: pageHeaderCompact, PageHeader }),
88
104
  }) }), titleText !== undefined &&
89
- renderRecordTitleBlock(model, titleText, statusBadge, pieces.headerSubtitleSlot, !pageHeaderCompact), MetricBand === undefined && bandSubtitle, MetricBand === undefined && headerSlot, (hasMetrics || bandSubtitle !== undefined || headerSlot !== undefined) &&
105
+ renderRecordTitleBlock(model, titleText, statusBadge, pieces.headerSubtitleSlot, false), hasTitleBlock && renderMobileSummary(model), hasTitleBlock && renderDetailSummary(model), MetricBand === undefined && bandSubtitle, MetricBand === undefined && headerSlot, (hasMetrics || bandSubtitle !== undefined || headerSlot !== undefined) &&
90
106
  (MetricBand !== undefined || hasMetrics) &&
91
- renderBandWithNarrowMetrics(model, metricItems, bandSubtitle, MetricBand !== undefined ? headerSlot : undefined), pieces.actionErrorBanner] }));
107
+ renderBandWithNarrowMetrics(model, metricItems, bandSubtitle, MetricBand !== undefined ? headerSlot : undefined), !hasTitleBlock && renderMobileSummary(model), !hasTitleBlock && renderDetailSummary(model), pieces.actionErrorBanner] }));
92
108
  }
93
109
  function renderHeaderCardBranch(model, pieces, headerSlot) {
94
110
  const { primitives, hasHeaderActions, hasMetrics, hasHeaderCard } = model;
@@ -103,7 +119,7 @@ function renderHeaderCardBranch(model, pieces, headerSlot) {
103
119
  ...(headerSubtitleSlot !== undefined && { subtitle: headerSubtitleSlot }),
104
120
  ...(headerSlot !== undefined && { headerContent: headerSlot }),
105
121
  ...(hasHeaderActions && { headerActions: headerActionsContent }),
106
- }, children: [hasMetrics && !metricsOutsideCard && renderMetricsBlock(model, pieces.metricItems), pieces.actionErrorBanner] })), metricsOutsideCard &&
122
+ }, children: [hasMetrics && !metricsOutsideCard && renderMetricsBlock(model, pieces.metricItems), pieces.actionErrorBanner] })), renderMobileSummary(model), renderDetailSummary(model), metricsOutsideCard &&
107
123
  wrapNarrowOrder(model, NARROW_METRICS_ORDER, renderMetricsBlock(model, pieces.metricItems))] }));
108
124
  }
109
125
  function renderDetailTabs(model, activeSection, Tabs) {
@@ -119,5 +135,5 @@ export function renderDetailHeaderContent(model, pieces, headerSlot) {
119
135
  : renderHeaderCardBranch(model, pieces, headerSlot), renderDetailGuidance(model), hasTabs &&
120
136
  activeSection !== undefined &&
121
137
  Tabs !== undefined &&
122
- wrapNarrowOrder(model, NARROW_TABS_ORDER, renderDetailTabs(model, activeSection, Tabs))] }));
138
+ wrapTabStrip(model, renderDetailTabs(model, activeSection, Tabs))] }));
123
139
  }
@@ -30,6 +30,8 @@ export declare function renderRecordTitleBlock(model: DetailHeaderModel, titleTe
30
30
  export declare function renderHeaderSubtitleSlot(model: DetailHeaderModel): ReactNode;
31
31
  export declare function buildMetricItems(model: DetailHeaderModel): ReactNode[] | undefined;
32
32
  export declare function renderMetricsBlock(model: DetailHeaderModel, metricItems: ReactNode[] | undefined, subtitle?: ReactNode, lead?: ReactNode): ReactNode;
33
+ /** The phone-only line right under the title; nothing when the screen has no `mobileSummary` or the field is empty. */
34
+ export declare function renderMobileSummary(model: DetailHeaderModel): ReactNode;
33
35
  export declare function renderStatusBadge(model: DetailHeaderModel): ReactNode;
34
36
  export declare function renderBandSubtitle(model: DetailHeaderModel, statusBadge: ReactNode, headerSubtitleSlot: ReactNode, pageHeaderCompact: boolean): ReactNode;
35
37
  export declare function renderActionErrorBanner(model: DetailHeaderModel, actionError: ErrorNotice): ReactNode;
@@ -1,5 +1,5 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Fragment } from "react";
2
+ import { Children, Fragment } from "react";
3
3
  import { isSelectOptionTone } from "../status-tone.js";
4
4
  import { ErrorReference } from "./error-reference.js";
5
5
  import { HeaderActionsBar } from "./header-actions-bar.js";
@@ -9,11 +9,14 @@ import { navigateTargetAllows } from "./screen-access.js";
9
9
  export function renderHeaderActionsContent(model, pageHeaderOptions) {
10
10
  const { screen, primitives, headerActionsList, setActionError } = model;
11
11
  const { Grid, Button, Dialog, ActionOverflowMenu } = primitives;
12
+ const menuActionIds = (screen.actions ?? [])
13
+ .filter((action) => action.placement === "menu")
14
+ .map((action) => action.id);
12
15
  return (_jsx(Grid, { columns: "auto", testId: "kumiko-screen-projection-detail-actions", children: _jsx(HeaderActionsBar, { actions: headerActionsList, Button: Button, Dialog: Dialog, ActionOverflowMenu: ActionOverflowMenu, onError: setActionError, ...(pageHeaderOptions !== undefined && {
13
16
  collapseAfterPrimary: true,
14
17
  compact: pageHeaderOptions.compact,
15
18
  PageHeader: pageHeaderOptions.PageHeader,
16
- }), ...(screen.primaryAction !== undefined && { preferredPrimaryId: screen.primaryAction }), ...(screen.inlineActions !== undefined && { inlineActionIds: screen.inlineActions }) }) }));
19
+ }), ...(screen.primaryAction !== undefined && { preferredPrimaryId: screen.primaryAction }), ...(screen.inlineActions !== undefined && { inlineActionIds: screen.inlineActions }), ...(menuActionIds.length > 0 && { menuActionIds }) }) }));
17
20
  }
18
21
  // Plain Text, not Heading — the Card title slot already renders as its own
19
22
  // heading element (h3); nesting another heading (h1) inside it is invalid HTML.
@@ -28,7 +31,9 @@ export function renderHeaderTitleSlot(model) {
28
31
  // beside it only where the shell bar does not carry it (phone); on desktop the bar shows it.
29
32
  export function renderRecordTitleBlock(model, titleText, statusBadge, subtitle, chipInBar) {
30
33
  const { Grid, Heading, FillContainer } = model.primitives;
31
- const block = (_jsxs(_Fragment, { children: [_jsxs(Grid, { columns: "auto", testId: "kumiko-screen-projection-detail-title-block", children: [_jsx(Heading, { variant: "page", testId: "kumiko-screen-projection-detail-title", children: titleText }), !chipInBar && statusBadge] }), subtitle] }));
34
+ // With a mobileSummary the phone shows only the H1 and that line: chip and subtitle give way.
35
+ const hiddenOnPhone = (node) => FillContainer !== undefined && mobileSummaryLineOf(model) !== undefined && node != null ? (_jsx(FillContainer, { className: "max-sm:hidden", children: node })) : (node);
36
+ const block = (_jsxs(_Fragment, { children: [_jsxs(Grid, { columns: "auto", testId: "kumiko-screen-projection-detail-title-block", children: [_jsx(Heading, { variant: "page", testId: "kumiko-screen-projection-detail-title", children: titleText }), !chipInBar && hiddenOnPhone(statusBadge)] }), hiddenOnPhone(subtitle)] }));
32
37
  return FillContainer !== undefined ? (_jsx(FillContainer, { className: "flex flex-col gap-1 px-6 pt-2 max-sm:px-4", children: block })) : (block);
33
38
  }
34
39
  function renderSubtitleParts(model, subtitleParts) {
@@ -129,6 +134,28 @@ export function buildMetricItems(model) {
129
134
  }
130
135
  // Metrics are a dl band when the primitive exists; the old Grid stays as the fallback.
131
136
  export function renderMetricsBlock(model, metricItems, subtitle, lead) {
137
+ const { FillContainer } = model.primitives;
138
+ if (mobileSummaryLineOf(model) === undefined || FillContainer === undefined) {
139
+ return renderPlainMetricsBlock(model, metricItems, subtitle, lead);
140
+ }
141
+ // Tiles give way to the summary line (rendered under the title) below sm; display:none keeps one copy for assistive tech.
142
+ const hiddenOnPhone = Children.map(metricItems, (item) => (_jsx(FillContainer, { className: "max-sm:hidden", children: item }))) ?? undefined;
143
+ const band = renderPlainMetricsBlock(model, hiddenOnPhone, subtitle, lead);
144
+ return subtitle === undefined && lead === undefined ? (_jsx(FillContainer, { className: "max-sm:hidden", children: band })) : (band);
145
+ }
146
+ function mobileSummaryLineOf(model) {
147
+ const raw = model.screen.mobileSummary === undefined ? undefined : model.record[model.screen.mobileSummary];
148
+ return typeof raw === "string" && raw !== "" ? raw : undefined;
149
+ }
150
+ /** The phone-only line right under the title; nothing when the screen has no `mobileSummary` or the field is empty. */
151
+ export function renderMobileSummary(model) {
152
+ const { FillContainer, Text } = model.primitives;
153
+ const line = mobileSummaryLineOf(model);
154
+ if (line === undefined || FillContainer === undefined)
155
+ return undefined;
156
+ return (_jsx(FillContainer, { className: "px-6 pt-1 text-left sm:hidden max-sm:px-4", children: _jsx(Text, { variant: "muted", testId: "kumiko-screen-projection-detail-mobile-summary", children: line }) }));
157
+ }
158
+ function renderPlainMetricsBlock(model, metricItems, subtitle, lead) {
132
159
  const { screen, primitives } = model;
133
160
  const { MetricBand, Grid } = primitives;
134
161
  return MetricBand !== undefined ? (_jsx(MetricBand, { testId: "kumiko-screen-projection-detail-metrics", subtitle: subtitle, ...(lead !== undefined && { lead }), ...(screen.metricsStyle === "tiles" && { tiles: true }), children: metricItems })) : (_jsx(Grid, { columns: screen.metrics?.length ?? 1, testId: "kumiko-screen-projection-detail-metrics", children: metricItems }));
@@ -50,6 +50,7 @@ export function synthesizeProjectionEntity(columns, sortable) {
50
50
  function rowPresentation(screen) {
51
51
  return {
52
52
  ...(screen.rowToneField !== undefined && { rowToneField: screen.rowToneField }),
53
+ ...(screen.mutedRowField !== undefined && { mutedRowField: screen.mutedRowField }),
53
54
  ...(screen.rowRenderer !== undefined && { rowRenderer: screen.rowRenderer }),
54
55
  };
55
56
  }
@@ -1,6 +1,7 @@
1
1
  import type { EntityEditScreenDefinition, FeatureSchema, RelatedListToolbarAction, RowAction, RowActionClientAction, RowActionDrawer, RowActionNavigate, RowActionWriteHandler, RowFieldExtractor, ToolbarAction } from "@cosmicdrift/kumiko-framework/ui-types";
2
2
  import type { RenderEditAction } from "../components/render-edit-types.ts";
3
3
  import type { ToolbarActionButton } from "../components/render-list.tsx";
4
+ import type { WriteFormRegistry } from "../components/write-form-registry.ts";
4
5
  import type { Dispatcher, ListRowViewModel, Translate } from "../headless/index.ts";
5
6
  import type { DataTableRowAction } from "../primitives.tsx";
6
7
  import { type ClientActionRuntime } from "./client-actions.tsx";
@@ -110,5 +111,8 @@ export declare function buildRecordActions(options: {
110
111
  * form holds unsaved input so it is not lost silently. */
111
112
  readonly discardChanges?: DiscardChanges;
112
113
  readonly clientActions?: ClientActionRuntime;
114
+ readonly writeForms?: WriteFormRegistry;
115
+ /** Ids of the actions that a writeForm section submits (`submitWith`). */
116
+ readonly submitWithIds?: ReadonlySet<string>;
113
117
  }): readonly RenderEditAction[] | undefined;
114
118
  export {};
@@ -465,7 +465,7 @@ export function deletesShownRecord(action, payload, shownRecordId) {
465
465
  payload["id"] === shownRecordId);
466
466
  }
467
467
  function buildWriteHandlerRecordAction(action, options) {
468
- const { record, translate, actionIcon, dispatcher, onWriteSuccess, defaultWritePayloadId, onRecordLeft, discardChanges, } = options;
468
+ const { record, translate, actionIcon, dispatcher, onWriteSuccess, defaultWritePayloadId, onRecordLeft, discardChanges, writeForms, submitWithIds, } = options;
469
469
  const shownRecordId = defaultWritePayloadId ?? record["id"];
470
470
  const confirm = withDiscardHint(action.confirm !== undefined ? translate(action.confirm) : undefined, discardChanges);
471
471
  // The discard label wins: the action then also throws away the unsaved input.
@@ -480,13 +480,27 @@ function buildWriteHandlerRecordAction(action, options) {
480
480
  ...(confirm !== undefined && { confirm }),
481
481
  ...(confirmLabel !== undefined && { confirmLabel }),
482
482
  onPress: async () => {
483
- const payload = action.payload !== undefined
483
+ const ownPayload = action.payload !== undefined
484
484
  ? evalRowExtractor(action.payload, record)
485
485
  : { id: shownRecordId };
486
+ // A form submitted by this action (writeForm `submitWith`) validates first; no write on error.
487
+ const form = writeForms?.get(action.id);
488
+ // A form is not mounted (other tab, hidden by visibleWhen): writing only the own payload would
489
+ // silently skip its fields.
490
+ if (form === undefined && submitWithIds?.has(action.id) === true) {
491
+ rendererError(`kumiko-screen: action "${action.id}" submits a writeForm that is not mounted`);
492
+ throw new Error(translate("kumiko.writeForm.unavailable"));
493
+ }
494
+ // A form hidden by CSS (phone/desktop only) shows no inline errors, so the failure is named here.
495
+ if (form !== undefined && !form.validate()) {
496
+ throw new Error(translate("kumiko.writeForm.invalid", { fields: form.invalidFieldLabels().join(", ") }));
497
+ }
498
+ const payload = form === undefined ? ownPayload : { ...ownPayload, ...form.getValues() };
486
499
  const result = await dispatcher.write(action.handler, payload);
487
500
  if (!result.isSuccess) {
488
501
  throw new WriteFailedError(result.error, dispatcherErrorText(result.error, translate));
489
502
  }
503
+ form?.rebase();
490
504
  const deletedShownRecord = deletesShownRecord(action, payload, shownRecordId);
491
505
  if (onRecordLeft !== undefined && (action.redirect !== undefined || deletedShownRecord)) {
492
506
  onRecordLeft(action, result.data, deletedShownRecord);
@@ -504,7 +518,7 @@ function buildWriteHandlerRecordAction(action, options) {
504
518
  // resolved against the record currently being viewed/edited, independent of
505
519
  // any table row.
506
520
  export function buildRecordActions(options) {
507
- const { actions, record, translate, nav, host, dispatcher, openDrawer, onWriteSuccess, onRecordLeft, defaultScreenTargetEntityId, sameEntityScreenId, defaultWritePayloadId, discardChanges, clientActions, } = options;
521
+ const { actions, record, translate, nav, host, dispatcher, openDrawer, onWriteSuccess, onRecordLeft, defaultScreenTargetEntityId, sameEntityScreenId, defaultWritePayloadId, discardChanges, clientActions, writeForms, submitWithIds, } = options;
508
522
  const out = [];
509
523
  for (const action of actions) {
510
524
  if (action.visible !== undefined && !evalFieldCondition(action.visible, record))
@@ -558,6 +572,8 @@ export function buildRecordActions(options) {
558
572
  defaultWritePayloadId,
559
573
  onRecordLeft,
560
574
  discardChanges,
575
+ writeForms,
576
+ submitWithIds,
561
577
  }));
562
578
  }
563
579
  return out.length > 0 ? out : undefined;
@@ -1,5 +1,6 @@
1
- import type { RowAction } from "@cosmicdrift/kumiko-framework/ui-types";
1
+ import { type RowAction } from "@cosmicdrift/kumiko-framework/ui-types";
2
2
  import type { RenderEditAction } from "../components/render-edit.tsx";
3
+ import type { WriteFormRegistry } from "../components/write-form-registry.ts";
3
4
  import type { useOptionalDispatcher } from "../context/dispatcher-context.tsx";
4
5
  import type { useUserRoles } from "../context/user-roles-context.tsx";
5
6
  import type { Translate } from "../headless/index.ts";
@@ -27,6 +28,7 @@ type DetailActionsInput = {
27
28
  readonly detailQuery: ReturnType<typeof useProjectionDetailData>["detailQuery"];
28
29
  readonly reloadDetail: ReturnType<typeof useProjectionDetailData>["reloadDetail"];
29
30
  readonly activeTabId: string | undefined;
31
+ readonly writeForms: WriteFormRegistry;
30
32
  };
31
33
  export declare function useProjectionDetailActions(input: DetailActionsInput): {
32
34
  buildSectionActions: (actions: readonly RowAction[]) => readonly RenderEditAction[] | undefined;
@@ -1,3 +1,4 @@
1
+ import { isWriteFormEditSection, } from "@cosmicdrift/kumiko-framework/ui-types";
1
2
  import { resolveActionIcon } from "@cosmicdrift/kumiko-types/action-icon";
2
3
  import { useCallback, useMemo } from "react";
3
4
  import { lastSegment } from "./qn.js";
@@ -10,7 +11,7 @@ function isShownOnTab(action, activeTabId) {
10
11
  (activeTabId !== undefined && action.showOnTabs.includes(activeTabId)));
11
12
  }
12
13
  export function useProjectionDetailActions(input) {
13
- const { schema, screen, effectiveTranslate, effectiveEntityId, nav, host, dispatcher, clientActions, appFeatures, userRoles, returnTarget, openDrawer, detailQuery, reloadDetail, activeTabId, } = input;
14
+ const { schema, screen, effectiveTranslate, effectiveEntityId, nav, host, dispatcher, clientActions, appFeatures, userRoles, returnTarget, openDrawer, detailQuery, reloadDetail, activeTabId, writeForms, } = input;
14
15
  const handleRecordLeft = useCallback((action, resultData, deletedShownRecord) => {
15
16
  const record = detailQuery.data ?? {};
16
17
  // Never return onto the just-deleted record.
@@ -153,6 +154,9 @@ export function useProjectionDetailActions(input) {
153
154
  sameEntityScreenId,
154
155
  ]);
155
156
  const footerIds = screen.footerActions;
157
+ const submitWithIds = useMemo(() => new Set(screen.layout.sections.flatMap((section) => isWriteFormEditSection(section) && section.submitWith !== undefined
158
+ ? [section.submitWith]
159
+ : [])), [screen.layout.sections]);
156
160
  const recordActions = useMemo(() => {
157
161
  const declaredHasEdit = screen.actions?.some((a) => a.id === "edit") === true;
158
162
  const resolved = buildRecordActions({
@@ -167,6 +171,8 @@ export function useProjectionDetailActions(input) {
167
171
  onRecordLeft: handleRecordLeft,
168
172
  sameEntityScreenId,
169
173
  clientActions,
174
+ writeForms,
175
+ submitWithIds,
170
176
  });
171
177
  // skip: a declared or unavailable edit action leaves the resolved list untouched
172
178
  if (defaultEditAction === undefined || declaredHasEdit)
@@ -186,6 +192,8 @@ export function useProjectionDetailActions(input) {
186
192
  openDrawer,
187
193
  handleRecordLeft,
188
194
  sameEntityScreenId,
195
+ writeForms,
196
+ submitWithIds,
189
197
  ]);
190
198
  // footerActions render in RenderEdit's pinned footer, so the header bar must not repeat them.
191
199
  const headerActions = useMemo(() => footerIds === undefined
@@ -37,11 +37,27 @@ export function useProjectionDetailData(input) {
37
37
  }, [isTabsMode, Tabs, screen.id]);
38
38
  const entity = useMemo(() => synthesizeProjectionDetailEntity(screen.layout), [screen.layout]);
39
39
  const detailScreen = useMemo(() => {
40
+ if (activeSections.length > 0 && screen.layout.narrowTabs === false) {
41
+ // Below `sm` there is no tab strip: every visible section renders, the ones of the
42
+ // other tabs only on the phone. A `hideOnNarrow` section of another tab has no place at
43
+ // all (hideOnNarrow would win over showOnNarrowOnly and show it on desktop).
44
+ const sections = visibleSections.flatMap((section) => {
45
+ if (activeSections.includes(section))
46
+ return [section];
47
+ if ("hideOnNarrow" in section && section.hideOnNarrow === true)
48
+ return [];
49
+ return [{ ...section, showOnNarrowOnly: true }];
50
+ });
51
+ return synthesizeProjectionDetailScreen({
52
+ ...screen,
53
+ layout: { ...screen.layout, sections },
54
+ });
55
+ }
40
56
  const source = activeSections.length > 0
41
57
  ? { ...screen, layout: { ...screen.layout, sections: activeSections } }
42
58
  : screen;
43
59
  return synthesizeProjectionDetailScreen(source);
44
- }, [screen, activeSections]);
60
+ }, [screen, activeSections, visibleSections]);
45
61
  // A writeForm section's handler creates a new record (see EditWriteFormSection's
46
62
  // doc) — both the outer record (header/metrics/other sections) and a sibling
47
63
  // relatedList section's own independently-fetched rows must reflect it. A
@@ -39,8 +39,8 @@ export function useProjectionListData(input) {
39
39
  const filterFacets = useMemo(() => {
40
40
  const namedFacet = buildNamedFilterFacet(screen.namedFilters, effectiveTranslate, userRoles, screen.namedFilterFacet, facetCounts);
41
41
  return [
42
- ...(namedFacet !== undefined ? [namedFacet] : []),
43
42
  ...buildFilterFacets(resolvedFacetSpecs),
43
+ ...(namedFacet !== undefined ? [namedFacet] : []),
44
44
  ];
45
45
  }, [
46
46
  resolvedFacetSpecs,
@@ -22,4 +22,6 @@ export type CardOptions = {
22
22
  readonly screenBody?: boolean;
23
23
  /** "inline": title and subtitle on one baseline row at 16px inset, compact padding (the board's side panel). Default "stacked". */
24
24
  readonly headerLayout?: "stacked" | "inline";
25
+ /** "label": the title is a small uppercase muted label. Default "heading". */
26
+ readonly titleStyle?: "heading" | "label";
25
27
  };
@@ -0,0 +1 @@
1
+ export declare function choiceChipClass(selected: boolean): string;
@@ -0,0 +1,9 @@
1
+ // Shared look of toggle chips in forms (multiSelect chips, value chips, AI-assist chips): 26px
2
+ // pill with a 1px border; a chosen chip gets a primary border and a light primary fill. Passed as
3
+ // Button `className`; the phone keeps the same height instead of the 44px touch minimum.
4
+ const CHOICE_CHIP_BASE = "h-[26px] rounded-full border px-3 text-[13px] font-medium max-md:min-h-[26px]";
5
+ export function choiceChipClass(selected) {
6
+ return selected
7
+ ? `${CHOICE_CHIP_BASE} border-primary bg-primary/10 text-primary ring-0`
8
+ : `${CHOICE_CHIP_BASE} border-border bg-background text-foreground`;
9
+ }
@@ -21,7 +21,7 @@ export declare function ExtensionSectionMount({ section, entityName: hostEntityN
21
21
  }): ReactNode;
22
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" | "afterForm" | "footer";
24
+ readonly slotName: "header" | "titleAction" | "afterForm" | "afterSection" | "footer";
25
25
  readonly screenId: string;
26
26
  readonly entityName: string;
27
27
  readonly entityId: string | null;
@@ -1,4 +1,4 @@
1
- import { currencyDecimals } from "../headless/index.js";
1
+ import { moneyAmountToMinor } from "../headless/index.js";
2
2
  // Locale-aware decimal parse for pasted text: strips space/NBSP thousands
3
3
  // separators outright, then treats whichever of "," or "." appears LAST in
4
4
  // the string as the decimal separator and strips the other one — handles
@@ -36,7 +36,7 @@ function coerceMoney(text, currency) {
36
36
  if (text.trim() === "")
37
37
  return undefined;
38
38
  const n = parseLocaleAwareDecimal(text);
39
- return n === undefined ? undefined : Math.round(n * 10 ** currencyDecimals(currency));
39
+ return n === undefined ? undefined : moneyAmountToMinor(n, currency);
40
40
  }
41
41
  function coerceSelect(column, text) {
42
42
  return (column.options ?? []).find((opt) => opt === text || column.optionLabels?.[opt] === text);
@@ -38,5 +38,5 @@ export function GridCellForField({ field, columns, issues, onChange, onSuggest,
38
38
  field.embeddedListCells !== undefined &&
39
39
  field.label === sectionTitle;
40
40
  const effectiveSpan = field.span !== undefined ? Math.min(field.span, columns) : 1;
41
- return (_jsx(GridCell, { span: effectiveSpan, ...(flow === true && { width: fieldCellWidth(field) }), children: _jsx(RenderField, { field: field, ...(issues !== undefined && { issues }), onChange: onChange, ...(onSuggest !== undefined && { onSuggest }), featureName: featureName, ...(labelAppendix !== undefined && { labelAppendix }), ...(fieldAppendix !== undefined && { fieldAppendix }), ...(appendixPlacement !== undefined && { appendixPlacement }), ...(description !== undefined && { description }), ...(status !== undefined && { status }), allIssues: allIssues, valueDisplay: valueDisplay, row: row, ...(changed === true && { changed }), ...(layout !== undefined && { layout }), ...(accent === true && { accent }), ...(fillDisabled === true && { fillDisabled }), ...(hideLabel && { hideLabel }) }) }));
41
+ return (_jsx(GridCell, { span: effectiveSpan, ...(flow === true && { width: fieldCellWidth(field) }), ...(field.hideOnNarrow === true && { hideOnNarrow: true }), children: _jsx(RenderField, { field: field, ...(issues !== undefined && { issues }), onChange: onChange, ...(onSuggest !== undefined && { onSuggest }), featureName: featureName, ...(labelAppendix !== undefined && { labelAppendix }), ...(fieldAppendix !== undefined && { fieldAppendix }), ...(appendixPlacement !== undefined && { appendixPlacement }), ...(description !== undefined && { description }), ...(status !== undefined && { status }), allIssues: allIssues, valueDisplay: valueDisplay, row: row, ...(changed === true && { changed }), ...(layout !== undefined && { layout }), ...(accent === true && { accent }), ...(fillDisabled === true && { fillDisabled }), ...(hideLabel && { hideLabel }) }) }));
42
42
  }