@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 { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { ChevronDown, ChevronRight, Plus, Search } from "lucide-react";
2
+ import { ChevronDown, ChevronRight, Plus } from "lucide-react";
3
3
  import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState, } from "react";
4
4
  import { rendererWarn } from "../../dev-console.js";
5
5
  import { resolveNavigation } from "../../headless/index.js";
@@ -7,11 +7,13 @@ import { createLiveRefetchScheduler } from "../../hooks/live-refetch-scheduler.j
7
7
  import { lastSegment, toAppSchema, useLiveEvents, useNav, useTranslation } from "../../index.js";
8
8
  import { KumikoLink } from "../app/nav.js";
9
9
  import { useNavEntities, useNavProviders } from "../app/nav-providers-context.js";
10
+ import { DrawnSearch } from "../drawn-icons.js";
10
11
  import { NAV_ICONS } from "../icons.js";
11
12
  import { cn } from "../lib/cn.js";
12
13
  import { SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarInput, SidebarMenu, SidebarMenuAction, SidebarMenuButton, SidebarMenuItem, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, useSidebar, } from "../ui/sidebar.js";
13
14
  import { usePersistedNavCollapse } from "./nav-collapse-state.js";
14
15
  import { resolveParentScreenId } from "./shell-breadcrumb.js";
16
+ import { useShellNavStyle } from "./shell-style.js";
15
17
  import { useDispatchTarget } from "./target-resolver-stub.js";
16
18
  import { parseTargetFromSearchParams } from "./target-url.js";
17
19
  // Widened alias for the two lookup sites below, which index by the plain
@@ -93,6 +95,7 @@ export function NavTree({ schema, user, testId, allowedNavQns, navBadges, }) {
93
95
  revealOnScreenChange(revealScreenId, path);
94
96
  }, [revealScreenId, revealOnScreenChange]);
95
97
  const t = useTranslation();
98
+ const plain = useShellNavStyle() === "plain";
96
99
  const { state: sidebarState } = useSidebar();
97
100
  const [filter, setFilter] = useState("");
98
101
  // The search box is only CSS-hidden (`group-data-[collapsible=icon]:hidden`)
@@ -104,11 +107,10 @@ export function NavTree({ schema, user, testId, allowedNavQns, navBadges, }) {
104
107
  }, [sidebarState]);
105
108
  const q = filter.trim().toLowerCase();
106
109
  const matches = useCallback((raw) => {
107
- const label = raw.includes(".") ? t(raw) : raw;
108
- return label.toLowerCase().includes(q);
110
+ return navLabel(t, raw).toLowerCase().includes(q);
109
111
  }, [t, q]);
110
112
  const navFilter = useMemo(() => ({ q, matches }), [q, matches]);
111
- return (_jsx(ActiveScreenMarkerContext.Provider, { value: activeMarker, children: _jsx(NavFilterContext.Provider, { value: navFilter, children: _jsx(NavBadgesContext.Provider, { value: navBadges ?? EMPTY_BADGES, children: _jsxs("div", { "data-testid": testId, "data-kumiko-layout": "nav-tree", className: "flex w-full flex-col gap-3", children: [_jsxs("div", { className: "relative mb-0 group-data-[collapsible=icon]:hidden", children: [_jsx(Search, { "aria-hidden": "true", className: "pointer-events-none absolute left-2 top-1/2 size-4 -translate-y-1/2 text-sidebar-muted" }), _jsx(SidebarInput, { className: "pl-8", value: filter, onChange: (e) => setFilter(e.target.value), placeholder: t("kumiko.nav.search"), "aria-label": t("kumiko.nav.search") })] }), groupTopLevelRuns(tree).map((run) => run.kind === "section" ? (_jsx(NavSection, { node: run.node, collapsed: collapsed, onToggle: onToggle }, run.node.qualifiedName)) : (_jsx(SidebarMenu, { className: "empty:hidden", children: run.nodes.map((node) => (_jsx(NavMenuNode, { node: node, collapsed: collapsed, onToggle: onToggle }, node.qualifiedName))) }, run.nodes[0].qualifiedName)))] }) }) }) }));
113
+ return (_jsx(ActiveScreenMarkerContext.Provider, { value: activeMarker, children: _jsx(NavFilterContext.Provider, { value: navFilter, children: _jsx(NavBadgesContext.Provider, { value: navBadges ?? EMPTY_BADGES, children: _jsxs("div", { "data-testid": testId, "data-kumiko-layout": "nav-tree", className: "flex w-full flex-col gap-3", children: [_jsxs("div", { className: "relative mb-0 group-data-[collapsible=icon]:hidden", children: [_jsx(DrawnSearch, { "aria-hidden": "true", className: "pointer-events-none absolute left-2 top-1/2 size-4 -translate-y-1/2 text-sidebar-muted" }), _jsx(SidebarInput, { className: cn("pl-8", plain && PLAIN_SEARCH_CLASS), value: filter, onChange: (e) => setFilter(e.target.value), placeholder: t("kumiko.nav.search"), "aria-label": t("kumiko.nav.search") })] }), groupTopLevelRuns(tree, plain).map((run) => run.kind === "section" ? (_jsx(NavSection, { node: run.node, collapsed: collapsed, onToggle: onToggle }, run.node.qualifiedName)) : (_jsx(SidebarMenu, { className: "empty:hidden", children: run.nodes.map((node) => (_jsx(NavMenuNode, { node: node, collapsed: collapsed, onToggle: onToggle }, node.qualifiedName))) }, run.nodes[0].qualifiedName)))] }) }) }) }));
112
114
  }
113
115
  // The runtime badge slot is keyed by the bare nav ID. With no entry it
114
116
  // renders nothing, avoiding layout shift. shrink-0 and ml-auto move it to the
@@ -132,21 +134,30 @@ function NavBadge({ node }) {
132
134
  // A pure section is a group header without its own screen that only groups
133
135
  // its children. At the top level it becomes a SidebarGroup with a toggleable
134
136
  // GroupLabel; a node with a screen remains a clickable menu entry even when it
135
- // also has children.
136
- function isPureSection(node) {
137
+ // also has children. In the plain nav a group's createAction stays a section
138
+ // and renders as a "+" on the group label.
139
+ function isPureSection(node, plain) {
137
140
  return (node.screen === undefined &&
138
141
  node.target === undefined &&
139
142
  node.provider !== true &&
140
- node.createAction === undefined &&
143
+ (plain || node.createAction === undefined) &&
141
144
  node.children.length > 0);
142
145
  }
146
+ const PLAIN_ITEM_CLASS = "px-2.5 py-1.5 text-[13.5px] leading-[1.3] font-normal hover:bg-sidebar-foreground/10 data-[active=true]:bg-sidebar-foreground/10 data-[active=true]:font-medium data-[active=true]:text-sidebar-foreground";
147
+ const PLAIN_GROUP_LABEL_CLASS = "justify-between rounded-none px-2.5 pt-[11px] pb-[3px] text-[10.5px] font-normal uppercase tracking-[0.07em] text-sidebar-muted";
148
+ const PLAIN_SEARCH_CLASS = "h-auto rounded-md border-0 py-[7px] text-[12.5px]";
149
+ const PLUS_BUTTON_CLASS = "flex size-5 items-center justify-center rounded-md text-sidebar-muted";
150
+ const PLAIN_PLUS_REVEAL_CLASS = "opacity-0 group-hover/menu-item:opacity-100 group-hover/menu-sub-item:opacity-100 group-focus-within/menu-item:opacity-100 group-focus-within/menu-sub-item:opacity-100 focus-visible:opacity-100 [@media(pointer:coarse)]:opacity-100";
151
+ function usePlainItemClass() {
152
+ return useShellNavStyle() === "plain" ? PLAIN_ITEM_CLASS : undefined;
153
+ }
143
154
  // Consecutive non-section entries share one <ul>, so the root gap only
144
155
  // separates blocks and not every pair of top-level leaves.
145
- function groupTopLevelRuns(nodes) {
156
+ function groupTopLevelRuns(nodes, plain) {
146
157
  const runs = [];
147
158
  let entries;
148
159
  for (const node of nodes) {
149
- if (isPureSection(node)) {
160
+ if (isPureSection(node, plain)) {
150
161
  entries = undefined;
151
162
  runs.push({ kind: "section", node });
152
163
  }
@@ -163,13 +174,16 @@ function groupTopLevelRuns(nodes) {
163
174
  // If the label contains a dot, pass it through t(): the bundle translates
164
175
  // the key; otherwise the key remains visible as a reminder of a missing
165
176
  // translation. Literal string labels are left unchanged.
177
+ function navLabel(t, raw) {
178
+ return raw.includes(".") ? t(raw) : raw;
179
+ }
166
180
  function useLabel(node) {
167
- const t = useTranslation();
168
- return node.label.includes(".") ? t(node.label) : node.label;
181
+ return navLabel(useTranslation(), node.label);
169
182
  }
170
183
  // Without an icon only the collapsed rail shows the initial letter; expanded,
171
184
  // the label stands alone.
172
185
  function NavLeadingIcon({ node, active, expanded = false, label, }) {
186
+ const plain = useShellNavStyle() === "plain";
173
187
  const iconKey = expanded && node.icon === "folder" ? "folder-open" : node.icon;
174
188
  const isKnownIcon = iconKey !== undefined && Object.hasOwn(NAV_ICONS, iconKey);
175
189
  const NavIcon = iconKey !== undefined && isKnownIcon ? NAV_ICON_LOOKUP[iconKey] : undefined;
@@ -179,8 +193,9 @@ function NavLeadingIcon({ node, active, expanded = false, label, }) {
179
193
  `registered in NAV_ICONS — falling back to the dot indicator. Check the icon key spelling.`);
180
194
  }
181
195
  }, [iconKey, isKnownIcon, node.qualifiedName]);
182
- if (NavIcon !== undefined)
183
- return _jsx(NavIcon, { "aria-hidden": "true", className: "shrink-0" });
196
+ if (NavIcon !== undefined) {
197
+ return (_jsx(NavIcon, { "aria-hidden": "true", className: cn("shrink-0", plain && "hidden group-data-[collapsible=icon]:block") }));
198
+ }
184
199
  const initial = label?.trim().charAt(0).toUpperCase();
185
200
  if (initial === undefined || initial === "")
186
201
  return null;
@@ -386,14 +401,15 @@ function TreeActionControl({ action, ariaLabel, className, dispatch, workspaceId
386
401
  function NodeActions({ node, expandable, workspaceId, }) {
387
402
  const dispatch = useDispatchTarget();
388
403
  const t = useTranslation();
404
+ const plain = useShellNavStyle() === "plain";
389
405
  const create = node.createAction;
390
406
  const actions = node.actions ?? [];
391
407
  if (create === undefined && actions.length === 0)
392
408
  return null;
393
- const label = (s) => (s.includes(".") ? t(s) : s);
394
- const btn = "flex size-5 items-center justify-center rounded-md text-sidebar-muted hover:bg-sidebar-accent hover:text-sidebar-accent-foreground";
409
+ const label = (s) => navLabel(t, s);
410
+ const btn = `${PLUS_BUTTON_CLASS} hover:bg-sidebar-accent hover:text-sidebar-accent-foreground`;
395
411
  const hover = "opacity-0 group-hover/menu-item:opacity-100 group-hover/menu-sub-item:opacity-100 group-focus-within/menu-item:opacity-100";
396
- return (_jsxs("div", { className: cn("absolute top-1 flex items-center gap-0.5", expandable ? "right-7" : "right-1"), children: [create !== undefined && (_jsx(TreeActionControl, { action: create, ariaLabel: label(create.label), className: btn, dispatch: dispatch, workspaceId: workspaceId, children: _jsx(Plus, { className: "size-3.5" }) })), actions.map((a) => (_jsx(TreeActionControl, { action: a, ariaLabel: label(a.label), className: cn(btn, hover), dispatch: dispatch, workspaceId: workspaceId, children: _jsx(ActionGlyph, { icon: a.icon }) }, a.label)))] }));
412
+ return (_jsxs("div", { className: cn("absolute top-1 flex items-center gap-0.5", expandable ? "right-7" : "right-1"), children: [create !== undefined && (_jsx(TreeActionControl, { action: create, ariaLabel: label(create.label), className: cn(btn, plain && PLAIN_PLUS_REVEAL_CLASS), dispatch: dispatch, workspaceId: workspaceId, children: _jsx(Plus, { className: "size-3.5" }) })), actions.map((a) => (_jsx(TreeActionControl, { action: a, ariaLabel: label(a.label), className: cn(btn, hover), dispatch: dispatch, workspaceId: workspaceId, children: _jsx(ActionGlyph, { icon: a.icon }) }, a.label)))] }));
397
413
  }
398
414
  // Status lines within a provider sub-list (lazy loading or error).
399
415
  function ProviderStatus({ loading, error, }) {
@@ -410,6 +426,11 @@ function ProviderStatus({ loading, error, }) {
410
426
  // on items with children, not on the section itself.
411
427
  function NavSection({ node, collapsed, onToggle }) {
412
428
  const displayLabel = useLabel(node);
429
+ const t = useTranslation();
430
+ const nav = useNav();
431
+ const dispatch = useDispatchTarget();
432
+ const plain = useShellNavStyle() === "plain";
433
+ const create = node.createAction;
413
434
  const { q, matches } = useContext(NavFilterContext);
414
435
  // Provider children are statically empty until loaded, so they keep the
415
436
  // section visible; their matches cannot be checked statically, and the node
@@ -419,7 +440,7 @@ function NavSection({ node, collapsed, onToggle }) {
419
440
  !node.children.some((c) => c.provider === true || subtreeMatches(c, matches))) {
420
441
  return null;
421
442
  }
422
- return (_jsxs(SidebarGroup, { children: [_jsx(SidebarGroupLabel, { children: displayLabel }), _jsx(SidebarGroupContent, { children: _jsx(SidebarMenu, { children: node.children.map((child) => (_jsx(NavMenuNode, { node: child, collapsed: collapsed, onToggle: onToggle }, child.qualifiedName))) }) })] }));
443
+ return (_jsxs(SidebarGroup, { children: [_jsxs(SidebarGroupLabel, { className: plain ? PLAIN_GROUP_LABEL_CLASS : undefined, children: [displayLabel, plain && create !== undefined && (_jsx(TreeActionControl, { action: create, ariaLabel: navLabel(t, create.label), className: `${PLUS_BUTTON_CLASS} hover:bg-sidebar-foreground/10 hover:text-sidebar-foreground`, dispatch: dispatch, workspaceId: nav.route?.workspaceId, children: _jsx(Plus, { className: "size-3.5" }) }))] }), _jsx(SidebarGroupContent, { children: _jsx(SidebarMenu, { children: node.children.map((child) => (_jsx(NavMenuNode, { node: child, collapsed: collapsed, onToggle: onToggle }, child.qualifiedName))) }) })] }));
423
444
  }
424
445
  // A menu entry (top-level item or section child) supports three click modes:
425
446
  // `screen` is a route link (KumikoLink), `target` dispatches to EditorPanel
@@ -432,19 +453,20 @@ function NavMenuNode({ node, collapsed, onToggle }) {
432
453
  const t = useTranslation();
433
454
  const dispatch = useDispatchTarget();
434
455
  const s = useNavNodeState(node, collapsed);
456
+ const itemClass = usePlainItemClass();
435
457
  if (s.hidden)
436
458
  return null;
437
459
  const sub = s.isExpanded ? (_jsxs(SidebarMenuSub, { children: [_jsx(ProviderStatus, { loading: s.providerLoading, error: s.providerError }), s.childNodes.map((child) => (_jsx(NavSubNode, { node: child, collapsed: collapsed, onToggle: onToggle }, child.qualifiedName)))] })) : null;
438
460
  const chevron = s.expandable ? (_jsx(SidebarMenuAction, { "aria-label": t(s.isExpanded ? "kumiko.nav.collapse" : "kumiko.nav.expand"), "aria-expanded": s.isExpanded, onClick: () => onToggle(node.qualifiedName), children: s.isExpanded ? _jsx(ChevronDown, {}) : _jsx(ChevronRight, {}) })) : null;
439
461
  if (node.screen !== undefined) {
440
462
  const screenId = lastSegment(node.screen);
441
- return (_jsxs(SidebarMenuItem, { children: [_jsx(SidebarMenuButton, { asChild: true, isActive: s.active, tooltip: s.displayLabel, children: _jsxs(KumikoLink, { to: { ...(s.workspaceId !== undefined && { workspaceId: s.workspaceId }), screenId }, ...(s.ariaCurrent && { "aria-current": "page" }), children: [_jsx(NavLeadingIcon, { node: node, active: s.active, label: s.displayLabel }), _jsx("span", { className: "min-w-0 truncate group-data-[collapsible=icon]:hidden", title: s.displayLabel, children: s.displayLabel }), _jsx(NavBadge, { node: node })] }) }), _jsx(NodeActions, { node: node, expandable: s.expandable, workspaceId: s.workspaceId }), chevron, sub] }));
463
+ return (_jsxs(SidebarMenuItem, { children: [_jsx(SidebarMenuButton, { asChild: true, isActive: s.active, tooltip: s.displayLabel, className: itemClass, children: _jsxs(KumikoLink, { to: { ...(s.workspaceId !== undefined && { workspaceId: s.workspaceId }), screenId }, ...(s.ariaCurrent && { "aria-current": "page" }), children: [_jsx(NavLeadingIcon, { node: node, active: s.active, label: s.displayLabel }), _jsx("span", { className: "min-w-0 truncate group-data-[collapsible=icon]:hidden", title: s.displayLabel, children: s.displayLabel }), _jsx(NavBadge, { node: node })] }) }), _jsx(NodeActions, { node: node, expandable: s.expandable, workspaceId: s.workspaceId }), chevron, sub] }));
442
464
  }
443
465
  if (node.target !== undefined) {
444
466
  const target = node.target;
445
- return (_jsxs(SidebarMenuItem, { children: [_jsxs(SidebarMenuButton, { isActive: s.active, tooltip: s.displayLabel, onClick: () => dispatch(target), children: [_jsx(NavLeadingIcon, { node: node, active: s.active, label: s.displayLabel }), _jsx("span", { className: "min-w-0 truncate group-data-[collapsible=icon]:hidden", title: s.displayLabel, children: s.displayLabel }), _jsx(NavBadge, { node: node })] }), _jsx(NodeActions, { node: node, expandable: s.expandable, workspaceId: s.workspaceId }), chevron, sub] }));
467
+ return (_jsxs(SidebarMenuItem, { children: [_jsxs(SidebarMenuButton, { isActive: s.active, className: itemClass, tooltip: s.displayLabel, onClick: () => dispatch(target), children: [_jsx(NavLeadingIcon, { node: node, active: s.active, label: s.displayLabel }), _jsx("span", { className: "min-w-0 truncate group-data-[collapsible=icon]:hidden", title: s.displayLabel, children: s.displayLabel }), _jsx(NavBadge, { node: node })] }), _jsx(NodeActions, { node: node, expandable: s.expandable, workspaceId: s.workspaceId }), chevron, sub] }));
446
468
  }
447
- return (_jsxs(SidebarMenuItem, { children: [_jsxs(SidebarMenuButton, { onClick: () => {
469
+ return (_jsxs(SidebarMenuItem, { children: [_jsxs(SidebarMenuButton, { className: itemClass, onClick: () => {
448
470
  if (s.expandable)
449
471
  onToggle(node.qualifiedName);
450
472
  }, ...(s.expandable && { "aria-expanded": s.isExpanded }), children: [_jsx(NavLeadingIcon, { node: node, active: false, expanded: s.isExpanded, label: s.displayLabel }), _jsx("span", { className: "truncate group-data-[collapsible=icon]:hidden", title: s.displayLabel, children: s.displayLabel }), s.expandable &&
@@ -460,6 +482,7 @@ function NavSubNode({ node, collapsed, onToggle }) {
460
482
  const t = useTranslation();
461
483
  const dispatch = useDispatchTarget();
462
484
  const s = useNavNodeState(node, collapsed);
485
+ const itemClass = usePlainItemClass();
463
486
  if (s.hidden)
464
487
  return null;
465
488
  // Children go in their own SidebarMenuSub (<ul>): a sub-item is an <li>, so
@@ -473,13 +496,13 @@ function NavSubNode({ node, collapsed, onToggle }) {
473
496
  }, className: "absolute top-1 right-1 flex size-5 items-center justify-center rounded-md text-sidebar-muted hover:bg-sidebar-accent hover:text-sidebar-accent-foreground", children: s.isExpanded ? _jsx(ChevronDown, { className: "size-3.5" }) : _jsx(ChevronRight, { className: "size-3.5" }) })) : null;
474
497
  if (node.screen !== undefined) {
475
498
  const screenId = lastSegment(node.screen);
476
- return (_jsxs(SidebarMenuSubItem, { children: [_jsx(SidebarMenuSubButton, { asChild: true, isActive: s.active, children: _jsxs(KumikoLink, { to: { ...(s.workspaceId !== undefined && { workspaceId: s.workspaceId }), screenId }, ...(s.ariaCurrent && { "aria-current": "page" }), children: [_jsx(NavLeadingIcon, { node: node, active: s.active, label: s.displayLabel }), _jsx("span", { className: "min-w-0 truncate group-data-[collapsible=icon]:hidden", title: s.displayLabel, children: s.displayLabel }), _jsx(NavBadge, { node: node })] }) }), _jsx(NodeActions, { node: node, expandable: s.expandable, workspaceId: s.workspaceId }), chevron, deeper] }));
499
+ return (_jsxs(SidebarMenuSubItem, { children: [_jsx(SidebarMenuSubButton, { asChild: true, isActive: s.active, className: itemClass, children: _jsxs(KumikoLink, { to: { ...(s.workspaceId !== undefined && { workspaceId: s.workspaceId }), screenId }, ...(s.ariaCurrent && { "aria-current": "page" }), children: [_jsx(NavLeadingIcon, { node: node, active: s.active, label: s.displayLabel }), _jsx("span", { className: "min-w-0 truncate group-data-[collapsible=icon]:hidden", title: s.displayLabel, children: s.displayLabel }), _jsx(NavBadge, { node: node })] }) }), _jsx(NodeActions, { node: node, expandable: s.expandable, workspaceId: s.workspaceId }), chevron, deeper] }));
477
500
  }
478
501
  if (node.target !== undefined) {
479
502
  const target = node.target;
480
- return (_jsxs(SidebarMenuSubItem, { children: [_jsx(SidebarMenuSubButton, { asChild: true, isActive: s.active, children: _jsxs("button", { type: "button", onClick: () => dispatch(target), children: [_jsx(NavLeadingIcon, { node: node, active: s.active, label: s.displayLabel }), _jsx("span", { className: "min-w-0 truncate group-data-[collapsible=icon]:hidden", title: s.displayLabel, children: s.displayLabel }), _jsx(NavBadge, { node: node })] }) }), _jsx(NodeActions, { node: node, expandable: s.expandable, workspaceId: s.workspaceId }), chevron, deeper] }));
503
+ return (_jsxs(SidebarMenuSubItem, { children: [_jsx(SidebarMenuSubButton, { asChild: true, isActive: s.active, className: itemClass, children: _jsxs("button", { type: "button", onClick: () => dispatch(target), children: [_jsx(NavLeadingIcon, { node: node, active: s.active, label: s.displayLabel }), _jsx("span", { className: "min-w-0 truncate group-data-[collapsible=icon]:hidden", title: s.displayLabel, children: s.displayLabel }), _jsx(NavBadge, { node: node })] }) }), _jsx(NodeActions, { node: node, expandable: s.expandable, workspaceId: s.workspaceId }), chevron, deeper] }));
481
504
  }
482
- return (_jsxs(SidebarMenuSubItem, { children: [_jsx(SidebarMenuSubButton, { asChild: true, children: _jsxs("button", { type: "button", onClick: () => {
505
+ return (_jsxs(SidebarMenuSubItem, { children: [_jsx(SidebarMenuSubButton, { asChild: true, className: itemClass, children: _jsxs("button", { type: "button", onClick: () => {
483
506
  if (s.expandable)
484
507
  onToggle(node.qualifiedName);
485
508
  }, children: [_jsx(NavLeadingIcon, { node: node, active: false, expanded: s.isExpanded, label: s.displayLabel }), _jsx("span", { className: "truncate group-data-[collapsible=icon]:hidden", title: s.displayLabel, children: s.displayLabel })] }) }), _jsx(NodeActions, { node: node, expandable: s.expandable, workspaceId: s.workspaceId }), chevron, deeper] }));
@@ -1,5 +1,10 @@
1
1
  import type { ScreenDefinition } from "@cosmicdrift/kumiko-framework/ui-types";
2
- import { type ReactNode } from "react";
3
- export declare function NotificationBell({ screens, }: {
2
+ import { type ReactNode, type RefObject } from "react";
3
+ export declare function NotificationBell({ screens, menuEntry, }: {
4
4
  readonly screens: readonly ScreenDefinition[];
5
+ /** Inside the header overflow menu: a menu row instead of the bell button; the list opens at `anchorRef` and survives the menu closing via `onSelect`. */
6
+ readonly menuEntry?: {
7
+ readonly anchorRef: RefObject<HTMLElement | null>;
8
+ readonly onSelect: () => void;
9
+ };
5
10
  }): ReactNode;
@@ -1,18 +1,19 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Bell } from "lucide-react";
3
3
  import { Popover as PopoverPrimitive } from "radix-ui";
4
4
  import { useState } from "react";
5
5
  import { lastSegment, useLocale, useNav, useTranslation } from "../../index.js";
6
6
  import { useRelativeTimeFormatter } from "../app/relative-time.js";
7
7
  import { cn } from "../lib/cn.js";
8
+ import { headerOverflowMenuItemClass } from "./header-overflow-menu.js";
8
9
  import { useInAppInbox } from "./use-in-app-inbox.js";
9
10
  const MAX_BADGE_COUNT = 99;
10
- const triggerClass = "relative inline-flex size-8 shrink-0 items-center justify-center rounded-md border border-input " +
11
- "bg-background text-foreground shadow-xs transition-colors hover:bg-accent " +
11
+ const triggerClass = "relative inline-flex size-8 shrink-0 items-center justify-center rounded-md " +
12
+ "text-foreground-secondary transition-colors hover:bg-accent " +
12
13
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring";
13
14
  const panelClass = "z-50 flex max-h-[28rem] w-[min(22rem,calc(100vw-1.5rem))] flex-col overflow-hidden rounded-md border " +
14
15
  "bg-popover text-popover-foreground shadow-md";
15
- export function NotificationBell({ screens, }) {
16
+ export function NotificationBell({ screens, menuEntry, }) {
16
17
  const t = useTranslation();
17
18
  const nav = useNav();
18
19
  const locale = useLocale().locale();
@@ -35,5 +36,15 @@ export function NotificationBell({ screens, }) {
35
36
  setOpen(false);
36
37
  nav.navigate(target.entityId === undefined ? { screenId } : { screenId, entityId: target.entityId });
37
38
  };
38
- return (_jsxs(PopoverPrimitive.Root, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverPrimitive.Trigger, { asChild: true, children: _jsxs("button", { type: "button", "aria-label": label, "data-kumiko-layout": "notification-bell", className: triggerClass, children: [_jsx(Bell, { className: "size-4", "aria-hidden": "true" }), inbox.unreadCount > 0 && (_jsx("span", { "data-kumiko-layout": "notification-bell-badge", className: "absolute -right-1.5 -top-1.5 flex min-w-4 items-center justify-center rounded-full bg-destructive px-1 text-[10px] font-semibold leading-4 text-destructive-foreground", children: badge }))] }) }), _jsx(PopoverPrimitive.Portal, { children: _jsxs(PopoverPrimitive.Content, { align: "end", sideOffset: 6, className: panelClass, children: [_jsxs("div", { className: "flex items-center justify-between gap-2 border-b border-border px-3 py-2", children: [_jsx("h2", { className: "text-sm font-semibold", children: t("kumiko.notifications.title") }), inbox.unreadCount > 0 && (_jsx("button", { type: "button", className: "text-xs text-primary hover:underline", onClick: () => void inbox.markAllRead(), children: t("kumiko.notifications.markAllRead") }))] }), _jsxs("div", { className: "min-h-0 flex-1 overflow-y-auto", children: [inbox.failed && (_jsx("p", { role: "alert", className: "px-3 py-4 text-sm text-destructive", children: t("kumiko.notifications.loadFailed") })), !inbox.failed && !inbox.loading && inbox.rows.length === 0 && (_jsx("p", { className: "px-3 py-6 text-center text-sm text-muted-foreground", children: t("kumiko.notifications.empty") })), _jsx("ul", { children: inbox.rows.map((row) => (_jsx("li", { children: _jsxs("button", { type: "button", "data-unread": row.isRead ? undefined : "true", className: "flex w-full items-start gap-2 border-b border-border px-3 py-2 text-left hover:bg-accent focus-visible:bg-accent focus-visible:outline-none", onClick: () => void openRow(row), children: [_jsx("span", { "aria-hidden": "true", className: cn("mt-1.5 size-2 shrink-0 rounded-full", row.isRead ? "bg-transparent" : "bg-primary") }), !row.isRead && (_jsx("span", { className: "sr-only", children: t("kumiko.notifications.unread") })), _jsxs("span", { className: "min-w-0 flex-1", children: [_jsx("span", { className: cn("block truncate text-sm", !row.isRead && "font-semibold"), children: row.title }), row.body !== null && (_jsx("span", { className: "block truncate text-xs text-muted-foreground", children: row.body })), _jsx("span", { className: "block text-xs text-muted-foreground", children: formatRelative(Date.parse(row.createdAt)) })] })] }) }, row.id))) }), inbox.hasMore && (_jsx("button", { type: "button", className: "w-full px-3 py-2 text-sm text-primary hover:bg-accent", onClick: () => void inbox.loadMore(), children: t("kumiko.notifications.loadMore") }))] })] }) })] }));
39
+ const panel = (_jsx(PopoverPrimitive.Portal, { children: _jsxs(PopoverPrimitive.Content, { align: "end", sideOffset: 6, className: panelClass, ...(menuEntry !== undefined && {
40
+ // Without a Trigger Radix has nothing to refocus; the keyboard user returns to the menu button.
41
+ onCloseAutoFocus: (event) => {
42
+ event.preventDefault();
43
+ menuEntry.anchorRef.current?.focus();
44
+ },
45
+ }), children: [_jsxs("div", { className: "flex items-center justify-between gap-2 border-b border-border px-3 py-2", children: [_jsx("h2", { className: "text-sm font-semibold", children: t("kumiko.notifications.title") }), inbox.unreadCount > 0 && (_jsx("button", { type: "button", className: "text-xs text-primary hover:underline", onClick: () => void inbox.markAllRead(), children: t("kumiko.notifications.markAllRead") }))] }), _jsxs("div", { className: "min-h-0 flex-1 overflow-y-auto", children: [inbox.failed && (_jsx("p", { role: "alert", className: "px-3 py-4 text-sm text-destructive", children: t("kumiko.notifications.loadFailed") })), !inbox.failed && !inbox.loading && inbox.rows.length === 0 && (_jsx("p", { className: "px-3 py-6 text-center text-sm text-muted-foreground", children: t("kumiko.notifications.empty") })), _jsx("ul", { children: inbox.rows.map((row) => (_jsx("li", { children: _jsxs("button", { type: "button", "data-unread": row.isRead ? undefined : "true", className: "flex w-full items-start gap-2 border-b border-border px-3 py-2 text-left hover:bg-accent focus-visible:bg-accent focus-visible:outline-none", onClick: () => void openRow(row), children: [_jsx("span", { "aria-hidden": "true", className: cn("mt-1.5 size-2 shrink-0 rounded-full", row.isRead ? "bg-transparent" : "bg-primary") }), !row.isRead && (_jsx("span", { className: "sr-only", children: t("kumiko.notifications.unread") })), _jsxs("span", { className: "min-w-0 flex-1", children: [_jsx("span", { className: cn("block truncate text-sm", !row.isRead && "font-semibold"), children: row.title }), row.body !== null && (_jsx("span", { className: "block truncate text-xs text-muted-foreground", children: row.body })), _jsx("span", { className: "block text-xs text-muted-foreground", children: formatRelative(Date.parse(row.createdAt)) })] })] }) }, row.id))) }), inbox.hasMore && (_jsx("button", { type: "button", className: "w-full px-3 py-2 text-sm text-primary hover:bg-accent", onClick: () => void inbox.loadMore(), children: t("kumiko.notifications.loadMore") }))] })] }) }));
46
+ return (_jsxs(PopoverPrimitive.Root, { open: open, onOpenChange: setOpen, children: [menuEntry === undefined ? (_jsx(PopoverPrimitive.Trigger, { asChild: true, children: _jsxs("button", { type: "button", "aria-label": label, "data-kumiko-layout": "notification-bell", className: triggerClass, children: [_jsx(Bell, { className: "size-4", "aria-hidden": "true" }), inbox.unreadCount > 0 && (_jsx("span", { "data-kumiko-layout": "notification-bell-badge", className: "absolute right-[3px] top-[3px] rounded-full bg-destructive px-1 py-0.5 text-[9.5px] font-semibold leading-none text-destructive-foreground", children: badge }))] }) })) : (_jsxs(_Fragment, { children: [_jsx(PopoverPrimitive.Anchor, { virtualRef: menuEntry.anchorRef }), _jsxs("button", { type: "button", role: "menuitem", "data-testid": "notification-bell-menu-item", className: headerOverflowMenuItemClass, onClick: () => {
47
+ setOpen(true);
48
+ menuEntry.onSelect();
49
+ }, children: [_jsx(Bell, { className: "size-4", "aria-hidden": "true" }), _jsx("span", { className: "flex-1", children: t("kumiko.notifications.label") }), inbox.unreadCount > 0 && (_jsx("span", { "data-kumiko-layout": "notification-bell-badge", className: "rounded-full bg-destructive px-1.5 py-0.5 text-[9.5px] font-semibold leading-none text-destructive-foreground", children: badge }))] })] })), panel] }));
39
50
  }
@@ -2,15 +2,15 @@ import { type ReactNode } from "react";
2
2
  type ShellFocusContextValue = {
3
3
  readonly focused: boolean;
4
4
  readonly register: () => () => void;
5
- readonly topbarActions?: ReactNode;
6
5
  };
7
6
  export declare const ShellFocusProvider: import("react").Provider<ShellFocusContextValue | null>;
7
+ export declare const ShellTopbarActionsProvider: import("react").Provider<ReactNode>;
8
8
  export type ShellFocusHost = {
9
9
  readonly focused: boolean;
10
10
  readonly value: ShellFocusContextValue;
11
11
  };
12
12
  /** Shell side: holds the focus counter. */
13
- export declare function useShellFocusHost(topbarActions?: ReactNode): ShellFocusHost;
13
+ export declare function useShellFocusHost(): ShellFocusHost;
14
14
  /** True while any mounted screen holds focus mode (always false outside DefaultAppShell). */
15
15
  export declare function useShellFocused(): boolean;
16
16
  /** The shell's topbarActions, for focused screens whose MobileTopBar replaces the shell header. */
@@ -7,15 +7,19 @@
7
7
  import { createContext, useCallback, useContext, useLayoutEffect, useMemo, useState, } from "react";
8
8
  const ShellFocusContext = createContext(null);
9
9
  export const ShellFocusProvider = ShellFocusContext.Provider;
10
+ // Own context: the shell builds this element anew on every render, which would otherwise
11
+ // re-render every ShellFocusContext consumer along with it.
12
+ const ShellTopbarActionsContext = createContext(undefined);
13
+ export const ShellTopbarActionsProvider = ShellTopbarActionsContext.Provider;
10
14
  /** Shell side: holds the focus counter. */
11
- export function useShellFocusHost(topbarActions) {
15
+ export function useShellFocusHost() {
12
16
  const [holders, setHolders] = useState(0);
13
17
  const register = useCallback(() => {
14
18
  setHolders((count) => count + 1);
15
19
  return () => setHolders((count) => count - 1);
16
20
  }, []);
17
21
  const focused = holders > 0;
18
- const value = useMemo(() => ({ focused, register, topbarActions }), [focused, register, topbarActions]);
22
+ const value = useMemo(() => ({ focused, register }), [focused, register]);
19
23
  return { focused, value };
20
24
  }
21
25
  /** True while any mounted screen holds focus mode (always false outside DefaultAppShell). */
@@ -24,7 +28,7 @@ export function useShellFocused() {
24
28
  }
25
29
  /** The shell's topbarActions, for focused screens whose MobileTopBar replaces the shell header. */
26
30
  export function useShellTopbarActions() {
27
- return useContext(ShellFocusContext)?.topbarActions;
31
+ return useContext(ShellTopbarActionsContext);
28
32
  }
29
33
  /** Screen side: call while the screen is mounted to get the focused shell. No-op without a DefaultAppShell. */
30
34
  export function useShellFocusMode() {
@@ -4,10 +4,11 @@ type ShellHeaderUser = {
4
4
  readonly id: string;
5
5
  readonly roles: readonly string[];
6
6
  };
7
- export declare function ShellHeader({ schema, user, headerActions: appHeaderActions, allowedNavQns, }: {
7
+ export declare function ShellHeader({ schema, user, headerActions: appHeaderActions, allowedNavQns, notificationBellPlacement, }: {
8
8
  readonly schema: AppSchema | FeatureSchema;
9
9
  readonly user?: ShellHeaderUser;
10
10
  readonly headerActions?: ReactNode;
11
11
  readonly allowedNavQns?: ReadonlySet<string>;
12
+ readonly notificationBellPlacement?: "header" | "overflow";
12
13
  }): ReactNode;
13
14
  export {};
@@ -1,12 +1,4 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- // ShellHeader — inset header bar for sidebar-based shells: SidebarTrigger
3
- // (rail/mobile-sheet toggle), breadcrumb of the active screen, optional
4
- // right-aligned headerActions. Shared by DefaultAppShell and WorkspaceShell so
5
- // both carry the same header (h-14, also with a collapsed icon rail).
6
- //
7
- // The `data-kumiko-layout="shell-header"` marker drives `--shell-header-height`
8
- // in styles.css (:has() selector) — the single source for the header height
9
- // that Drawer's `belowHeader` prop also reads.
10
2
  import { IN_APP_NOTIFICATION_FEATURE } from "@cosmicdrift/kumiko-types/in-app-notification-types";
11
3
  import { ChevronLeft, MoreHorizontal } from "lucide-react";
12
4
  import { Fragment, useEffect, useId, useMemo, useRef, useState, } from "react";
@@ -23,14 +15,17 @@ import { NotificationBell } from "./notification-bell.js";
23
15
  import { usePageHeaderSlot } from "./page-header-slot.js";
24
16
  import { activeNavLabel, resolveDetailBreadcrumb, screenTitleKey, } from "./shell-breadcrumb.js";
25
17
  import { useShellFocused } from "./shell-focus.js";
18
+ import { useShellNavStyle } from "./shell-style.js";
26
19
  import { SHELL_HEADER_CONTROLS_CLASSES } from "./uniform-bar-controls.js";
27
- export function ShellHeader({ schema, user, headerActions: appHeaderActions, allowedNavQns, }) {
20
+ export function ShellHeader({ schema, user, headerActions: appHeaderActions, allowedNavQns, notificationBellPlacement = "header", }) {
28
21
  const nav = useNav();
29
22
  const t = useTranslation();
30
23
  const focused = useShellFocused();
24
+ const plainNav = useShellNavStyle() === "plain";
31
25
  // The app's headerActions (the assistant button) stay in focus mode: they are not navigation,
32
- // and a focused screen must not cut the user off from them. The sidebar trigger and the
33
- // notification bell are rendered by this header itself, not passed in, and stay hidden.
26
+ // and a focused screen must not cut the user off from them. The notification bell is rendered
27
+ // by this header itself, not passed in, and stays hidden; so does the sidebar trigger, except
28
+ // with the plain nav style, whose panel symbol stays visible in focus mode.
34
29
  const headerActions = appHeaderActions;
35
30
  const appSchema = toAppSchema(schema);
36
31
  const tree = useMemo(() => {
@@ -72,12 +67,8 @@ export function ShellHeader({ schema, user, headerActions: appHeaderActions, all
72
67
  const titleOverride = slot?.title;
73
68
  const recordTitle = slot?.recordTitle;
74
69
  const compact = usePageHeaderCompact();
75
- const overflowItems = slot?.overflowItems ?? [];
76
- // On a phone the app's headerActions fold into the menu, except the ones wrapped in HeaderActionPinned.
77
- const pinnedActions = compact ? collectPinnedHeaderActions(headerActions) : [];
78
- const hasOverflow = compact &&
79
- (overflowItems.length > 0 ||
80
- (headerActions !== undefined && !isOnlyPinnedHeaderActions(headerActions)));
70
+ const showsBell = !focused && user !== undefined && hasInAppChannel;
71
+ const bellInOverflow = showsBell && notificationBellPlacement === "overflow";
81
72
  // A stand-in without a translated title must not surface the raw i18n key.
82
73
  const standInUntitled = standInScreenId !== undefined && crumbs?.at(-1)?.label === screenTitleKey(standInScreenId);
83
74
  const bodyTitle = slot?.bodyTitle === true;
@@ -105,20 +96,43 @@ export function ShellHeader({ schema, user, headerActions: appHeaderActions, all
105
96
  ];
106
97
  };
107
98
  const shownCrumbs = bodyTitle ? bodyTitleCrumbs() : visibleCrumbs;
108
- return (_jsxs("header", { "data-kumiko-layout": "shell-header", className: cn("flex h-14 shrink-0 items-center gap-3 border-b border-border pl-1.5 pr-3 md:pl-4 md:pr-6", compact && "relative", focused && "max-md:hidden"), children: [_jsxs("div", { className: "@container flex min-w-0 flex-1 items-center gap-3", children: [!focused && _jsx(SidebarTrigger, { label: t("kumiko.sidebar.toggle") }), _jsxs("div", { className: cn("flex min-w-0", compact ? "flex-col justify-center" : "items-center gap-3"), children: [shownCrumbs !== undefined && shownCrumbs.length > 0 && (_jsx(Breadcrumb, { className: "min-w-0", "aria-label": t("kumiko.breadcrumb.label"), children: _jsx(BreadcrumbList, { className: "flex-nowrap gap-1.5 sm:gap-1.5", children: shownCrumbs.map((crumb, index) => {
109
- const screenId = crumb.screenId;
110
- const isLast = index === shownCrumbs.length - 1;
111
- return (_jsxs(Fragment, { children: [index > 0 && (_jsx(BreadcrumbSeparator, { className: "hidden text-muted-foreground @xs:inline-flex [&>svg]:size-3.5" })), _jsx(BreadcrumbItem, { className: cn(isLast ? "min-w-0" : "hidden shrink-0 @xs:inline-flex"), children: screenId !== undefined && (!isLast || parentOnly) ? (_jsxs(BreadcrumbLink, { href: "#", className: "whitespace-nowrap text-foreground-secondary", onClick: (e) => {
112
- e.preventDefault();
113
- nav.navigate({ screenId });
114
- }, children: [parentOnly && (_jsx(ChevronLeft, { className: "me-0.5 inline size-4 align-text-bottom", "aria-hidden": "true" })), crumb.label] })) : isLast && bodyTitle ? (_jsx("span", { className: "truncate text-lg font-semibold text-foreground", children: crumb.label })) : isLast ? (_jsx("h1", { "aria-current": "page", title: titleOverride ?? crumb.label, className: "truncate text-lg font-semibold text-foreground", children: titleOverride ?? crumb.label })) : (_jsx(BreadcrumbPage, { className: "whitespace-nowrap text-foreground-secondary", children: crumb.label })) })] }, screenId ?? crumb.label));
115
- }) }) })), _jsx("div", { ref: setStatusElement, "data-kumiko-layout": "page-header-status", className: cn("flex items-center gap-2 empty:hidden", compact ? "min-w-0 max-w-full overflow-hidden whitespace-nowrap text-xs" : "shrink-0") })] })] }), _jsxs("div", { className: cn("ml-auto flex items-center gap-2", compact ? "min-w-0 max-w-[60%]" : "min-w-0 max-w-[50%] shrink-0 sm:max-w-none"), children: [_jsx("div", { ref: setActionsElement, "data-kumiko-layout": "page-header-actions", className: cn(SHELL_HEADER_CONTROLS_CLASSES, "flex min-w-0 items-center gap-2 empty:hidden [&_*]:min-w-0 [&_*]:max-w-full [&_button]:overflow-hidden [&_button]:whitespace-nowrap", compact && "overflow-hidden") }), !focused && user !== undefined && hasInAppChannel && (_jsx(NotificationBell, { screens: allScreens })), !compact && headerActions !== undefined && (_jsx("div", { "data-kumiko-layout": "header-actions", className: "flex items-center gap-2", children: headerActions })), pinnedActions.length > 0 && (_jsx("div", { "data-kumiko-layout": "header-actions-pinned", className: "flex items-center gap-2", children: pinnedActions })), hasOverflow && _jsx(HeaderOverflow, { items: overflowItems, headerActions: headerActions })] })] }));
99
+ return (_jsxs("header", { "data-kumiko-layout": "shell-header", ...(plainNav && { "data-nav-style": "plain" }), className: cn("flex h-14 shrink-0 items-center gap-3 border-b border-border pl-1.5 pr-3 md:pl-4 md:pr-6", plainNav && "h-[58px] md:gap-2.5 md:px-5", (compact || bellInOverflow) && "relative", focused && "max-md:hidden"), children: [_jsxs("div", { className: "@container flex min-w-0 flex-1 items-center gap-3", children: [_jsx(ShellSidebarTrigger, { focused: focused, plainNav: plainNav }), _jsxs("div", { className: cn("flex min-w-0", compact ? "flex-col justify-center" : "items-center gap-3"), children: [_jsx(ShellBreadcrumb, { crumbs: shownCrumbs, parentOnly: parentOnly, bodyTitle: bodyTitle, titleOverride: titleOverride }), _jsx("div", { ref: setStatusElement, "data-kumiko-layout": "page-header-status", className: cn("flex items-center gap-2 empty:hidden", compact ? "min-w-0 max-w-full overflow-hidden whitespace-nowrap text-xs" : "shrink-0") })] })] }), _jsx(ShellHeaderEnd, { compact: compact, actionsRef: setActionsElement, headerActions: headerActions, overflowItems: slot?.overflowItems ?? [], bellScreens: showsBell ? allScreens : undefined, bellInOverflow: bellInOverflow })] }));
100
+ }
101
+ function foldsIntoOverflow(overflowItems, headerActions) {
102
+ if (overflowItems.length > 0)
103
+ return true;
104
+ return headerActions !== undefined && !isOnlyPinnedHeaderActions(headerActions);
105
+ }
106
+ // On a phone the app's headerActions fold into the menu, except the ones wrapped in HeaderActionPinned.
107
+ function VisibleHeaderActions({ compact, headerActions, }) {
108
+ if (!compact) {
109
+ if (headerActions === undefined)
110
+ return null;
111
+ return (_jsx("div", { "data-kumiko-layout": "header-actions", className: "flex items-center gap-2", children: headerActions }));
112
+ }
113
+ const pinnedActions = collectPinnedHeaderActions(headerActions);
114
+ if (pinnedActions.length === 0)
115
+ return null;
116
+ return (_jsx("div", { "data-kumiko-layout": "header-actions-pinned", className: "flex items-center gap-2", children: pinnedActions }));
117
+ }
118
+ function ShellHeaderEnd({ compact, actionsRef, headerActions, overflowItems, bellScreens, bellInOverflow, }) {
119
+ const hasOverflow = bellInOverflow || (compact && foldsIntoOverflow(overflowItems, headerActions));
120
+ return (_jsxs("div", { className: cn("ml-auto flex items-center gap-2", compact ? "min-w-0 max-w-[60%]" : "min-w-0 max-w-[50%] shrink-0 sm:max-w-none"), children: [_jsx("div", { ref: actionsRef, "data-kumiko-layout": "page-header-actions", className: cn(SHELL_HEADER_CONTROLS_CLASSES, "flex min-w-0 items-center gap-2 empty:hidden [&_*]:min-w-0 [&_*]:max-w-full [&_button]:overflow-hidden [&_button]:whitespace-nowrap", compact && "overflow-hidden") }), bellScreens !== undefined && !bellInOverflow && _jsx(NotificationBell, { screens: bellScreens }), _jsx(VisibleHeaderActions, { compact: compact, headerActions: headerActions }), hasOverflow && (_jsx(HeaderOverflow, { items: compact ? overflowItems : [], headerActions: compact ? headerActions : undefined, ...(bellInOverflow && bellScreens !== undefined && { bellScreens }) }))] }));
121
+ }
122
+ function ShellSidebarTrigger({ focused, plainNav, }) {
123
+ const t = useTranslation();
124
+ if (focused && !plainNav)
125
+ return null;
126
+ return (_jsx(SidebarTrigger, { label: t("kumiko.sidebar.toggle"), ...(plainNav && { icon: "panel-all-widths" }) }));
116
127
  }
117
128
  // A hand-rolled menu instead of Radix DropdownMenu: app headerActions are opaque
118
129
  // nodes with their own popovers, and the panel stays mounted while closed so their
119
130
  // effects (shortcut listeners) keep running.
120
131
  const MENU_ITEM_SELECTOR = '[role="menuitem"]:not(:disabled)';
121
- function HeaderOverflow({ items, headerActions, }) {
132
+ function OverflowBellEntry({ screens, anchorRef, onSelect, separated, }) {
133
+ return (_jsxs(_Fragment, { children: [_jsx(NotificationBell, { screens: screens, menuEntry: { anchorRef, onSelect } }), separated && _jsx("hr", { className: "-mx-1 my-1 border-t border-border" })] }));
134
+ }
135
+ function HeaderOverflow({ items, headerActions, bellScreens, }) {
122
136
  const t = useTranslation();
123
137
  const [open, setOpen] = useState(false);
124
138
  const panelId = useId();
@@ -182,7 +196,7 @@ function HeaderOverflow({ items, headerActions, }) {
182
196
  event.preventDefault();
183
197
  menuItems[next]?.focus();
184
198
  };
185
- return (_jsxs(_Fragment, { children: [_jsx("button", { ref: triggerRef, type: "button", "aria-label": t("kumiko.page-header.actions"), "aria-haspopup": "menu", "aria-expanded": open, "aria-controls": panelId, "data-testid": "shell-header-overflow-trigger", onClick: () => setOpen((wasOpen) => !wasOpen), className: "inline-flex size-10 shrink-0 items-center justify-center rounded-md border border-input bg-background text-foreground shadow-xs hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring", children: _jsx(MoreHorizontal, { className: "size-4", "aria-hidden": "true" }) }), _jsxs("div", { ref: panelRef, id: panelId, role: "menu", "aria-label": t("kumiko.page-header.actions"), hidden: !open, onKeyDown: onPanelKeyDown, "data-testid": "shell-header-overflow", className: "absolute right-2 top-full z-30 mt-1 w-max min-w-[8rem] max-w-[calc(100vw-1rem)] rounded-md border bg-popover p-1 text-popover-foreground shadow-md", children: [items.length > 0 && (_jsx("div", { className: "flex flex-col", children: items.map((item) => (_jsxs("button", { type: "button", role: "menuitem", disabled: item.disabled === true, "data-testid": item.testId ?? `shell-header-overflow-item-${item.id}`, onClick: () => {
199
+ return (_jsxs(_Fragment, { children: [_jsx("button", { ref: triggerRef, type: "button", "aria-label": t("kumiko.page-header.actions"), "aria-haspopup": "menu", "aria-expanded": open, "aria-controls": panelId, "data-testid": "shell-header-overflow-trigger", onClick: () => setOpen((wasOpen) => !wasOpen), className: "inline-flex size-10 shrink-0 items-center justify-center rounded-md border border-input bg-background text-foreground shadow-xs hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring", children: _jsx(MoreHorizontal, { className: "size-4", "aria-hidden": "true" }) }), _jsxs("div", { ref: panelRef, id: panelId, role: "menu", "aria-label": t("kumiko.page-header.actions"), hidden: !open, onKeyDown: onPanelKeyDown, "data-testid": "shell-header-overflow", className: "absolute right-2 top-full z-30 mt-1 w-max min-w-[8rem] max-w-[calc(100vw-1rem)] rounded-md border bg-popover p-1 text-popover-foreground shadow-md", children: [bellScreens !== undefined && (_jsx(OverflowBellEntry, { screens: bellScreens, anchorRef: triggerRef, onSelect: () => setOpen(false), separated: items.length > 0 || headerActions !== undefined })), items.length > 0 && (_jsx("div", { className: "flex flex-col", children: items.map((item) => (_jsxs("button", { type: "button", role: "menuitem", disabled: item.disabled === true, "data-testid": item.testId ?? `shell-header-overflow-item-${item.id}`, onClick: () => {
186
200
  setOpen(false);
187
201
  item.onSelect();
188
202
  }, className: cn(headerOverflowMenuItemClass, item.variant === "danger" && "text-destructive"), children: [item.icon !== undefined && Object.hasOwn(NAV_ICONS, item.icon) && (_jsx(Icon, { name: item.icon, className: "size-4 shrink-0" })), item.label] }, item.id))) })), items.length > 0 && headerActions !== undefined && (_jsx("hr", { className: "-mx-1 my-1 border-t border-border" })), headerActions !== undefined && (_jsx("div", { "data-kumiko-layout": "header-actions",
@@ -190,3 +204,18 @@ function HeaderOverflow({ items, headerActions, }) {
190
204
  // being restyled through a child selector that reaches into their markup.
191
205
  className: "flex flex-col items-stretch gap-1", onClick: () => setOpen(false), children: _jsx(HeaderOverflowMenuContext.Provider, { value: true, children: headerActions }) }))] })] }));
192
206
  }
207
+ // The bar's breadcrumb: only the page title truncates, parents stay whole and leave when the space is too narrow.
208
+ function ShellBreadcrumb({ crumbs, parentOnly, bodyTitle, titleOverride, }) {
209
+ const nav = useNav();
210
+ const t = useTranslation();
211
+ if (crumbs === undefined || crumbs.length === 0)
212
+ return null;
213
+ return (_jsx(Breadcrumb, { className: "min-w-0", "aria-label": t("kumiko.breadcrumb.label"), children: _jsx(BreadcrumbList, { className: "flex-nowrap gap-1.5 sm:gap-1.5", children: crumbs.map((crumb, index) => {
214
+ const screenId = crumb.screenId;
215
+ const isLast = index === crumbs.length - 1;
216
+ return (_jsxs(Fragment, { children: [index > 0 && (_jsx(BreadcrumbSeparator, { className: "hidden text-muted-foreground @xs:inline-flex [&>svg]:size-3.5" })), _jsx(BreadcrumbItem, { className: cn(isLast ? "min-w-0" : "hidden shrink-0 @xs:inline-flex"), children: screenId !== undefined && (!isLast || parentOnly) ? (_jsxs(BreadcrumbLink, { href: "#", className: cn("whitespace-nowrap text-foreground-secondary", parentOnly && "text-[17px] font-semibold text-foreground"), onClick: (e) => {
217
+ e.preventDefault();
218
+ nav.navigate({ screenId });
219
+ }, children: [parentOnly && (_jsx(ChevronLeft, { className: "me-0.5 inline size-4 align-text-bottom", "aria-hidden": "true" })), crumb.label] })) : isLast && bodyTitle ? (_jsx("span", { className: "truncate text-lg font-semibold text-foreground", children: crumb.label })) : isLast ? (_jsx("h1", { "aria-current": "page", title: titleOverride ?? crumb.label, className: "truncate text-lg font-semibold text-foreground", children: titleOverride ?? crumb.label })) : (_jsx(BreadcrumbPage, { className: "whitespace-nowrap text-foreground-secondary", children: crumb.label })) })] }, screenId ?? crumb.label));
220
+ }) }) }));
221
+ }
@@ -0,0 +1,3 @@
1
+ export type ShellNavStyle = "default" | "plain";
2
+ export declare const ShellNavStyleProvider: import("react").Provider<ShellNavStyle>;
3
+ export declare function useShellNavStyle(): ShellNavStyle;
@@ -0,0 +1,6 @@
1
+ import { createContext, useContext } from "react";
2
+ const ShellNavStyleContext = createContext("default");
3
+ export const ShellNavStyleProvider = ShellNavStyleContext.Provider;
4
+ export function useShellNavStyle() {
5
+ return useContext(ShellNavStyleContext);
6
+ }
@@ -1,5 +1,6 @@
1
1
  import { type ReactNode } from "react";
2
2
  import type { AppSchema, FeatureSchema, WorkspaceSchema } from "../../index.ts";
3
+ import { type ShellNavStyle } from "./shell-style.tsx";
3
4
  export type WorkspaceShellUser = {
4
5
  readonly id: string;
5
6
  readonly roles: readonly string[];
@@ -34,10 +35,19 @@ export type WorkspaceShellProps = {
34
35
  * scrolls INSIDE instead of the whole page. Default true — set
35
36
  * `fill={false}` to opt back into page scroll. */
36
37
  readonly fill?: boolean;
38
+ /** Surface behind the screen content. `"card"` (default) keeps the inset on `bg-card`;
39
+ * `"background"` lets the page background show through so cards stand out from it. */
40
+ readonly contentSurface?: "card" | "background";
41
+ /** `"plain"` renders the sidebar without leading icons while expanded (the focus rail and the
42
+ * collapsed rail keep them), with uppercase group labels, quiet active entries, a panel-symbol
43
+ * sidebar trigger and a 58px title bar. `"default"` keeps the icon navigation. */
44
+ readonly navStyle?: ShellNavStyle;
45
+ /** `"header"` (default) draws the notification bell in the title bar; `"overflow"` moves it into the "…" menu, which then shows on every width. */
46
+ readonly notificationBellPlacement?: "header" | "overflow";
37
47
  /** Screen content. */
38
48
  readonly children: ReactNode;
39
49
  };
40
- export declare function WorkspaceShell({ brand, schema, topbarActions, user, initialWorkspaceId, sidebarFooter, focusRailNavQns, navBadges, fill, children, }: WorkspaceShellProps): ReactNode;
50
+ export declare function WorkspaceShell({ brand, schema, topbarActions, user, initialWorkspaceId, sidebarFooter, focusRailNavQns, navBadges, fill, contentSurface, navStyle, notificationBellPlacement, children, }: WorkspaceShellProps): ReactNode;
41
51
  export declare function filterByAccess(workspaces: readonly WorkspaceSchema[], userRoles: readonly string[] | undefined): readonly WorkspaceSchema[];
42
52
  /** Returns the short screen-id of the first nav-member that points at
43
53
  * a screen. Walks the workspace's nav-list in order and skips section
@@ -33,19 +33,21 @@ import { isUiAccessGranted } from "@cosmicdrift/kumiko-framework/ui-types";
33
33
  import { useCallback, useLayoutEffect, useMemo } from "react";
34
34
  import { qualifyNavId, ScreenFocusProvider, toAppSchema, UserRolesProvider, useNav, useTranslation, } from "../../index.js";
35
35
  import { useResolvers } from "../app/resolvers-context.js";
36
+ import { cn } from "../lib/cn.js";
36
37
  import { Sidebar, SidebarContent, SidebarFooter, SidebarHeader, SidebarInset, SidebarProvider, SidebarRail, } from "../ui/sidebar.js";
37
38
  import { EditorPanel } from "./editor-panel.js";
38
39
  import { fillClasses } from "./fill-classes.js";
39
40
  import { FocusAwareSidebarBody, sidebarProviderProps } from "./focus-aware-sidebar.js";
40
41
  import { lastSegment, NavTree } from "./nav-tree.js";
41
42
  import { PageHeaderSlotProvider } from "./page-header-slot.js";
42
- import { ShellFocusProvider, useShellFocusHost } from "./shell-focus.js";
43
+ import { ShellFocusProvider, ShellTopbarActionsProvider, useShellFocusHost, } from "./shell-focus.js";
43
44
  import { ShellHeader } from "./shell-header.js";
45
+ import { ShellNavStyleProvider } from "./shell-style.js";
44
46
  import { usePersistedSidebarOpen } from "./sidebar-open-state.js";
45
47
  import { SidebarPanelProvider, useSidebarPanelHost } from "./sidebar-panel.js";
46
48
  import { parseTargetFromSearchParams } from "./target-url.js";
47
49
  import { WorkspaceSwitcher } from "./workspace-switcher.js";
48
- export function WorkspaceShell({ brand, schema, topbarActions, user, initialWorkspaceId, sidebarFooter, focusRailNavQns, navBadges, fill = true, children, }) {
50
+ export function WorkspaceShell({ brand, schema, topbarActions, user, initialWorkspaceId, sidebarFooter, focusRailNavQns, navBadges, fill = true, contentSurface = "card", navStyle = "default", notificationBellPlacement = "header", children, }) {
49
51
  const app = useMemo(() => toAppSchema(schema), [schema]);
50
52
  const visible = useMemo(() => filterByAccess(app.workspaces ?? [], user?.roles), [app.workspaces, user?.roles]);
51
53
  const nav = useNav();
@@ -153,9 +155,9 @@ export function WorkspaceShell({ brand, schema, topbarActions, user, initialWork
153
155
  // The second column appears only when a screen fills it (sidebar-09 pattern);
154
156
  // otherwise every other screen would have an empty strip beside the navigation.
155
157
  const panel = useSidebarPanelHost();
156
- const focus = useShellFocusHost(topbarActions);
158
+ const focus = useShellFocusHost();
157
159
  const sidebarOpen = usePersistedSidebarOpen();
158
- return (_jsx(ScreenFocusProvider, { children: _jsx(SidebarProvider, { ...fillCls.provider, ...sidebarProviderProps(focus, sidebarOpen), children: _jsx(ShellFocusProvider, { value: focus.value, children: _jsxs(SidebarPanelProvider, { value: panel.value, children: [_jsxs(Sidebar, { collapsible: "icon", mobileTitle: t("kumiko.sidebar.title"), mobileDescription: t("kumiko.sidebar.description"), children: [_jsxs(FocusAwareSidebarBody, { focused: focus.focused, brand: brand, schema: app, user: user, allowedNavQns: allowedNavQns, railNavQns: focusRailNavQns, footer: sidebarFooter, children: [_jsxs(SidebarHeader, { "data-kumiko-layout": "sidebar-header", children: [brand, switcher] }), _jsx(SidebarContent, { "data-kumiko-layout": "sidebar-nav", children: sidebarContent }), sidebarFooter !== undefined && (_jsx(SidebarFooter, { "data-kumiko-layout": "sidebar-footer", className: "border-t border-sidebar-border", children: sidebarFooter }))] }), _jsx(SidebarRail, { "aria-label": t("kumiko.sidebar.toggle"), title: t("kumiko.sidebar.toggle") })] }), _jsx("div", { ref: panel.ref, "data-kumiko-layout": "sidebar-panel", className: panel.occupied ? "flex h-svh shrink-0 flex-col" : "hidden" }), _jsx(SidebarInset, { className: fillCls.inset, children: _jsxs(PageHeaderSlotProvider, { children: [_jsx(ShellHeader, { schema: app, ...(user !== undefined && { user }), ...(allowedNavQns !== undefined && { allowedNavQns }), ...(topbarActions !== undefined && { headerActions: topbarActions }) }), _jsx("main", { className: fillCls.main, children: activeTarget !== undefined ? (_jsx(EditorPanel, { resolvers: resolvers })) : (_jsx(UserRolesProvider, { roles: user?.roles, children: children })) })] }) })] }) }) }) }));
160
+ return (_jsx(ShellNavStyleProvider, { value: navStyle, children: _jsx(ScreenFocusProvider, { children: _jsx(SidebarProvider, { ...fillCls.provider, ...sidebarProviderProps(focus, sidebarOpen), children: _jsx(ShellFocusProvider, { value: focus.value, children: _jsx(ShellTopbarActionsProvider, { value: topbarActions, children: _jsxs(SidebarPanelProvider, { value: panel.value, children: [_jsxs(Sidebar, { collapsible: "icon", mobileTitle: t("kumiko.sidebar.title"), mobileDescription: t("kumiko.sidebar.description"), children: [_jsxs(FocusAwareSidebarBody, { focused: focus.focused, brand: brand, schema: app, user: user, allowedNavQns: allowedNavQns, railNavQns: focusRailNavQns, footer: sidebarFooter, children: [_jsxs(SidebarHeader, { "data-kumiko-layout": "sidebar-header", children: [brand, switcher] }), _jsx(SidebarContent, { "data-kumiko-layout": "sidebar-nav", children: sidebarContent }), sidebarFooter !== undefined && (_jsx(SidebarFooter, { "data-kumiko-layout": "sidebar-footer", className: "border-t border-sidebar-border", children: sidebarFooter }))] }), _jsx(SidebarRail, { "aria-label": t("kumiko.sidebar.toggle"), title: t("kumiko.sidebar.toggle") })] }), _jsx("div", { ref: panel.ref, "data-kumiko-layout": "sidebar-panel", className: panel.occupied ? "flex h-svh shrink-0 flex-col" : "hidden" }), _jsx(SidebarInset, { className: cn(fillCls.inset, contentSurface === "background" && "bg-background"), children: _jsxs(PageHeaderSlotProvider, { children: [_jsx(ShellHeader, { schema: app, ...(user !== undefined && { user }), ...(allowedNavQns !== undefined && { allowedNavQns }), ...(topbarActions !== undefined && { headerActions: topbarActions }), notificationBellPlacement: notificationBellPlacement }), _jsx("main", { className: fillCls.main, children: activeTarget !== undefined ? (_jsx(EditorPanel, { resolvers: resolvers })) : (_jsx(UserRolesProvider, { roles: user?.roles, children: children })) })] }) })] }) }) }) }) }) }));
159
161
  }
160
162
  // --- helpers (exported for tests) ---
161
163
  export function filterByAccess(workspaces, userRoles) {
@@ -1,4 +1,4 @@
1
1
  import type { ReactNode } from "react";
2
2
  import type { BannerProps } from "../../index.ts";
3
3
  import "../react-css-custom-properties.ts";
4
- export declare function DefaultBanner({ variant, density, icon, title, titleTestId, children, parts, actions, actionsPlacement, padded, inline, testId, id, }: BannerProps): ReactNode;
4
+ export declare function DefaultBanner({ variant, density, icon, title, narrowTitle, narrowText, titleTestId, children, parts, actions, actionsPlacement, padded, inline, testId, id, }: BannerProps): ReactNode;