@exxatdesignux/ui 0.3.0 → 0.4.1

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 (214) hide show
  1. package/CHANGELOG.md +701 -6
  2. package/README.md +138 -0
  3. package/bin/init.mjs +134 -31
  4. package/consumer-extras/cursor-rules/exxat-board-cards.mdc +1 -1
  5. package/consumer-extras/cursor-rules/exxat-centralized-list-dataset.mdc +2 -2
  6. package/consumer-extras/cursor-rules/exxat-collaboration-access.mdc +1 -1
  7. package/consumer-extras/cursor-rules/exxat-data-tables.mdc +2 -0
  8. package/consumer-extras/cursor-rules/exxat-dedicated-search-surfaces.mdc +1 -1
  9. package/consumer-extras/cursor-rules/exxat-ds-agents.mdc +3 -3
  10. package/consumer-extras/cursor-rules/exxat-library-hub-header.mdc +28 -0
  11. package/consumer-extras/cursor-rules/exxat-mono-ids.mdc +1 -1
  12. package/consumer-extras/cursor-rules/exxat-person-identity-display.mdc +1 -1
  13. package/consumer-extras/cursor-rules/exxat-primary-nav-secondary-panel.mdc +6 -6
  14. package/consumer-extras/cursor-rules/exxat-reuse-before-custom.mdc +1 -1
  15. package/consumer-extras/cursor-skills/exxat-board-cards/SKILL.md +2 -2
  16. package/consumer-extras/cursor-skills/exxat-centralized-list-dataset/SKILL.md +1 -1
  17. package/consumer-extras/cursor-skills/exxat-collaboration-access/SKILL.md +3 -3
  18. package/consumer-extras/cursor-skills/exxat-dedicated-search-surfaces/SKILL.md +2 -2
  19. package/consumer-extras/cursor-skills/exxat-ds-skill/SKILL.md +7 -7
  20. package/consumer-extras/cursor-skills/exxat-kpi-flat-band/SKILL.md +1 -1
  21. package/consumer-extras/cursor-skills/exxat-list-page-view-shells/SKILL.md +1 -1
  22. package/consumer-extras/cursor-skills/exxat-mono-ids/SKILL.md +4 -4
  23. package/consumer-extras/cursor-skills/exxat-primary-nav-secondary-panel/SKILL.md +8 -8
  24. package/consumer-extras/cursor-skills/exxat-token-economy/SKILL.md +277 -0
  25. package/consumer-extras/handbook/HANDBOOK.md +2 -0
  26. package/consumer-extras/handbook/glossary.md +2 -1
  27. package/consumer-extras/handbook/reference-implementations.md +31 -4
  28. package/consumer-extras/patterns/collaboration-access-pattern.md +7 -7
  29. package/consumer-extras/patterns/data-views-pattern.md +18 -16
  30. package/consumer-extras/patterns/kpi-flat-band-pattern.md +2 -2
  31. package/dist/components/data-table/index.js +2 -2
  32. package/dist/components/data-table/index.js.map +1 -1
  33. package/dist/components/data-table/pagination.js +3 -3
  34. package/dist/components/data-table/pagination.js.map +1 -1
  35. package/dist/components/data-table/use-table-state.d.ts +1 -1
  36. package/dist/components/data-table/use-table-state.js.map +1 -1
  37. package/dist/components/data-views/data-row-list.js.map +1 -1
  38. package/dist/components/data-views/finder-panel-view.d.ts +1 -1
  39. package/dist/components/data-views/finder-panel-view.js.map +1 -1
  40. package/dist/components/data-views/hub-table.d.ts +9 -3
  41. package/dist/components/data-views/hub-table.js +262 -40
  42. package/dist/components/data-views/hub-table.js.map +1 -1
  43. package/dist/components/data-views/index.js +262 -40
  44. package/dist/components/data-views/index.js.map +1 -1
  45. package/dist/components/data-views/list-page-split-hub-tokens.d.ts +2 -2
  46. package/dist/components/data-views/list-page-split-hub-tokens.js.map +1 -1
  47. package/dist/components/data-views/list-page-tree-column-header.d.ts +1 -1
  48. package/dist/components/data-views/list-page-tree-column-header.js.map +1 -1
  49. package/dist/components/data-views/list-page-tree-panel-shell.js.map +1 -1
  50. package/dist/components/data-views/os-folder-glyph.d.ts +1 -1
  51. package/dist/components/data-views/os-folder-glyph.js.map +1 -1
  52. package/dist/components/ui/avatar.d.ts +1 -1
  53. package/dist/components/ui/key-metrics.js.map +1 -1
  54. package/dist/index.js +136 -39
  55. package/dist/index.js.map +1 -1
  56. package/package.json +3 -2
  57. package/src/components/data-table/index.tsx +2 -2
  58. package/src/components/data-table/pagination.tsx +5 -1
  59. package/src/components/data-table/use-table-state.ts +1 -1
  60. package/src/components/data-views/data-row-list.tsx +1 -1
  61. package/src/components/data-views/finder-panel-view.tsx +2 -2
  62. package/src/components/data-views/hub-table.tsx +149 -41
  63. package/src/components/data-views/list-page-split-hub-tokens.ts +2 -2
  64. package/src/components/data-views/list-page-tree-column-header.tsx +1 -1
  65. package/src/components/data-views/os-folder-glyph.tsx +1 -1
  66. package/src/components/ui/key-metrics.tsx +1 -1
  67. package/template/.claude/skills/exxat-ds-skill/SKILL.md +8 -7
  68. package/template/.cursor/rules/exxat-accessibility.mdc +1 -1
  69. package/template/.cursor/rules/exxat-command-menu.mdc +1 -1
  70. package/template/.cursor/rules/exxat-dashboard-view-charts.mdc +6 -6
  71. package/template/.cursor/rules/exxat-data-tables.mdc +3 -3
  72. package/template/.cursor/rules/exxat-kbd-shortcuts.mdc +5 -5
  73. package/template/.cursor/rules/exxat-mono-ids.mdc +1 -1
  74. package/template/.cursor/rules/exxat-page-vs-drawer.mdc +1 -1
  75. package/template/.cursor/rules/exxat-table-properties-drawer.mdc +1 -1
  76. package/template/AGENTS.md +43 -37
  77. package/template/app/(app)/columns/page.tsx +11 -0
  78. package/template/app/(app)/library/all/page.tsx +11 -0
  79. package/template/app/(app)/library/find/page.tsx +12 -0
  80. package/template/app/(app)/{question-bank → library}/layout.tsx +16 -16
  81. package/template/app/(app)/library/list/page.tsx +12 -0
  82. package/template/app/(app)/{question-bank → library}/new/page.tsx +10 -10
  83. package/template/app/(app)/library/page.tsx +11 -0
  84. package/template/app/(app)/tokens-themes/page.tsx +11 -0
  85. package/template/components/ask-leo-composer.tsx +2 -2
  86. package/template/components/columns-client.tsx +158 -0
  87. package/template/components/columns-showcase.tsx +541 -0
  88. package/template/components/data-views/index.ts +32 -6
  89. package/template/components/data-views/{question-bank-folder-tree-branch.tsx → library-folder-tree-branch.tsx} +19 -19
  90. package/template/components/data-views/table-cells.tsx +673 -0
  91. package/template/components/folder-details-shell.tsx +11 -11
  92. package/template/components/hub-tree-panel-view.tsx +24 -24
  93. package/template/components/{question-bank-board-view.tsx → library-board-view.tsx} +44 -44
  94. package/template/components/{question-bank-client.tsx → library-client.tsx} +82 -82
  95. package/template/components/{question-bank-dashboard-charts.tsx → library-dashboard-charts.tsx} +14 -14
  96. package/template/components/{question-bank-favorite-button.tsx → library-favorite-button.tsx} +7 -7
  97. package/template/components/{question-bank-hub-client.tsx → library-hub-client.tsx} +43 -43
  98. package/template/components/{question-bank-new-folder-sheet.tsx → library-new-folder-sheet.tsx} +14 -14
  99. package/template/components/{question-bank-os-folder-view.tsx → library-os-folder-view.tsx} +31 -31
  100. package/template/components/{question-bank-page-header.tsx → library-page-header.tsx} +6 -6
  101. package/template/components/library-panel-activator.tsx +8 -0
  102. package/template/components/{question-bank-secondary-nav.tsx → library-secondary-nav.tsx} +60 -60
  103. package/template/components/{question-bank-table.tsx → library-table.tsx} +97 -97
  104. package/template/components/list-hub-status-badge.tsx +2 -2
  105. package/template/components/{new-question-composer.tsx → new-library-item-form.tsx} +37 -37
  106. package/template/components/sidebar/app-sidebar.tsx +61 -5
  107. package/template/components/sidebar/secondary-panel.tsx +109 -56
  108. package/template/components/sidebar/sidebar-auto-collapse.tsx +2 -2
  109. package/template/components/sidebar/sidebar-auto-open.tsx +2 -1
  110. package/template/components/table-properties/types.ts +1 -1
  111. package/template/components/templates/discovery-hub-template.tsx +1 -1
  112. package/template/components/templates/new-focus-template.tsx +2 -2
  113. package/template/components/templates/secondary-panel-hub-template.tsx +1 -1
  114. package/template/components/tokens-secondary-nav.tsx +192 -0
  115. package/template/components/tokens-themes-client.tsx +476 -0
  116. package/template/components/tokens-themes-section.tsx +386 -0
  117. package/template/docs/HANDBOOK.md +187 -0
  118. package/template/docs/blueprints/README.md +1 -1
  119. package/template/docs/blueprints/board-card.md +1 -1
  120. package/template/docs/blueprints/data-table.md +2 -2
  121. package/template/docs/blueprints/list-page-template.md +3 -3
  122. package/template/docs/blueprints/page-header.md +4 -4
  123. package/template/docs/collaboration-access-pattern.md +7 -7
  124. package/template/docs/component-selection-guide.md +1 -1
  125. package/template/docs/data-views-pattern.md +18 -16
  126. package/template/docs/glossary.md +58 -0
  127. package/template/docs/kpi-flat-band-pattern.md +3 -3
  128. package/template/docs/kpi-trend-pattern.md +18 -3
  129. package/template/docs/large-dataset-strategy.md +155 -0
  130. package/template/docs/library-hub-header-pattern.md +25 -0
  131. package/template/docs/migrations/_template.md +1 -1
  132. package/template/docs/reference-implementations.md +151 -0
  133. package/template/docs/token-taxonomy.md +1 -1
  134. package/template/docs/voice-and-tone.md +262 -0
  135. package/template/eslint.config.mjs +9 -39
  136. package/template/hooks/use-secondary-panel-hub-nav.ts +10 -10
  137. package/template/lib/ask-leo-route-context.ts +6 -18
  138. package/template/lib/coach-mark-registry.ts +0 -16
  139. package/template/lib/command-menu-config.ts +5 -12
  140. package/template/lib/command-menu-search-data.ts +8 -39
  141. package/template/lib/{question-bank-authoring.ts → library-authoring.ts} +89 -88
  142. package/template/lib/library-dedicated-search.ts +19 -0
  143. package/template/lib/library-hub-search.ts +90 -0
  144. package/template/lib/library-nav.ts +477 -0
  145. package/template/lib/library-recent-searches.ts +22 -0
  146. package/template/lib/{placements-supported-views.ts → library-supported-views.ts} +2 -2
  147. package/template/lib/list-status-badges.ts +16 -104
  148. package/template/lib/mock/dashboard.ts +1 -1
  149. package/template/lib/mock/{question-bank-folders.ts → library-folders.ts} +30 -30
  150. package/template/lib/mock/library-header-collaborators.ts +54 -0
  151. package/template/lib/mock/{question-bank-inspector.ts → library-inspector.ts} +29 -29
  152. package/template/lib/mock/{question-bank-kpi.ts → library-kpi.ts} +20 -20
  153. package/template/lib/mock/library.ts +249 -0
  154. package/template/lib/mock/navigation.tsx +32 -26
  155. package/template/lib/table-state-lifecycle.ts +1 -1
  156. package/template/next.config.mjs +7 -4
  157. package/template/package.json +0 -1
  158. package/tokens/hooks-index.json +2874 -0
  159. package/consumer-extras/cursor-rules/exxat-question-bank-hub-header.mdc +0 -28
  160. package/template/app/(app)/examples/page.tsx +0 -41
  161. package/template/app/(app)/question-bank/find/page.tsx +0 -12
  162. package/template/app/(app)/question-bank/library/page.tsx +0 -11
  163. package/template/app/(app)/question-bank/list/page.tsx +0 -12
  164. package/template/app/(app)/question-bank/page.tsx +0 -11
  165. package/template/components/compliance-board-view.tsx +0 -142
  166. package/template/components/compliance-client.tsx +0 -92
  167. package/template/components/compliance-page-header.tsx +0 -89
  168. package/template/components/compliance-table.tsx +0 -468
  169. package/template/components/data-view-dashboard-charts-compliance.tsx +0 -963
  170. package/template/components/data-view-dashboard-charts-team.tsx +0 -971
  171. package/template/components/data-view-dashboard-charts.tsx +0 -1503
  172. package/template/components/new-placement-back-btn.tsx +0 -28
  173. package/template/components/new-placement-form.tsx +0 -942
  174. package/template/components/placement-board-card.tsx +0 -250
  175. package/template/components/placement-detail.tsx +0 -438
  176. package/template/components/placements-board-view.tsx +0 -397
  177. package/template/components/placements-client.tsx +0 -220
  178. package/template/components/placements-list-view.tsx +0 -124
  179. package/template/components/placements-page-header.tsx +0 -166
  180. package/template/components/placements-table-cells.test.tsx +0 -22
  181. package/template/components/placements-table-cells.tsx +0 -173
  182. package/template/components/placements-table-columns.tsx +0 -210
  183. package/template/components/placements-table.tsx +0 -934
  184. package/template/components/question-bank-panel-activator.tsx +0 -8
  185. package/template/components/rotations-empty-state.tsx +0 -50
  186. package/template/components/rotations-panel-activator.tsx +0 -8
  187. package/template/components/sites-board-view.tsx +0 -67
  188. package/template/components/sites-client.tsx +0 -154
  189. package/template/components/sites-table.tsx +0 -249
  190. package/template/components/team-board-view.tsx +0 -122
  191. package/template/components/team-client.tsx +0 -100
  192. package/template/components/team-page-header.tsx +0 -92
  193. package/template/components/team-table.tsx +0 -553
  194. package/template/docs/question-bank-hub-header-pattern.md +0 -25
  195. package/template/lib/compliance-supported-views.ts +0 -10
  196. package/template/lib/data-view-dashboard-placements-layout.ts +0 -215
  197. package/template/lib/mock/compliance-kpi.ts +0 -61
  198. package/template/lib/mock/compliance.ts +0 -146
  199. package/template/lib/mock/placements-kpi.ts +0 -134
  200. package/template/lib/mock/placements.ts +0 -176
  201. package/template/lib/mock/question-bank-header-collaborators.ts +0 -54
  202. package/template/lib/mock/question-bank.ts +0 -249
  203. package/template/lib/mock/sites-directory.ts +0 -16
  204. package/template/lib/mock/sites-kpi.ts +0 -25
  205. package/template/lib/mock/team-kpi.ts +0 -60
  206. package/template/lib/mock/team.ts +0 -118
  207. package/template/lib/placement-board-card-layout.ts +0 -79
  208. package/template/lib/question-bank-dedicated-search.ts +0 -19
  209. package/template/lib/question-bank-hub-search.ts +0 -90
  210. package/template/lib/question-bank-nav.ts +0 -477
  211. package/template/lib/question-bank-recent-searches.ts +0 -22
  212. package/template/lib/question-bank-supported-views.ts +0 -12
  213. package/template/lib/sites-supported-views.ts +0 -10
  214. package/template/lib/team-supported-views.ts +0 -10
@@ -0,0 +1,477 @@
1
+ /**
2
+ * Library secondary nav + URL scope — demo “My” matches mock author rows.
3
+ */
4
+
5
+ import type { LibraryItem } from "@/lib/mock/library"
6
+ import type { LibraryFolder } from "@/lib/mock/library-folders"
7
+ import { collectFolderDescendantIds } from "@/lib/mock/library-folders"
8
+
9
+ /** Demo curator — “My items” filters `author` / `createdBy` to this value. */
10
+ export const LIBRARY_NAV_MY_AUTHOR = "Owner A"
11
+
12
+ export type LibraryNavScope = "all" | "my" | "folder"
13
+
14
+ export interface LibraryNavState {
15
+ scope: LibraryNavScope
16
+ /** Set when `scope === "folder"` */
17
+ folderId: string | null
18
+ }
19
+
20
+ export const LIBRARY_ENTRY_PATH = "/library"
21
+
22
+ /** Breadcrumb segment for the discovery hub — links from library / search shells back to `/library`. */
23
+ export const LIBRARY_HUB_BREADCRUMB = {
24
+ label: "Library",
25
+ href: LIBRARY_ENTRY_PATH,
26
+ } as const
27
+
28
+ /** List hub with secondary nav, views, and table state. */
29
+ export const LIBRARY_ALL_PATH = "/library/all"
30
+
31
+ /**
32
+ * Same hub as the library (table + panel + tree) but intended for search landings (`?q=`).
33
+ * Keeps secondary panel + nav behavior aligned with {@link LIBRARY_ALL_PATH}.
34
+ */
35
+ export const LIBRARY_LIST_PATH = "/library/list"
36
+
37
+ /**
38
+ * Results from the discovery hub composer — same table stack as {@link LIBRARY_LIST_PATH} but a
39
+ * distinct URL so library “Search” and hub-driven search are not conflated.
40
+ */
41
+ export const LIBRARY_HUB_FIND_PATH = "/library/find"
42
+
43
+ /** @deprecated Use `LIBRARY_ALL_PATH` for scoped library routes. */
44
+ export const LIBRARY_HUB_PATH = LIBRARY_ALL_PATH
45
+
46
+ export const LIBRARY_LIBRARY_HUB_PATHS: readonly string[] = [
47
+ LIBRARY_ALL_PATH,
48
+ LIBRARY_LIST_PATH,
49
+ LIBRARY_HUB_FIND_PATH,
50
+ ]
51
+
52
+ /** Library list search (`/list`) or hub discovery search (`/find`) — both use the dedicated search shell. */
53
+ export function isLibraryDedicatedSearchPathname(pathname: string): boolean {
54
+ return pathname === LIBRARY_LIST_PATH || pathname === LIBRARY_HUB_FIND_PATH
55
+ }
56
+
57
+ /**
58
+ * Whether a secondary-nav row (All / My / folder / Search) matches the current URL + parsed nav.
59
+ * Used by `LibrarySecondaryNav` and the folder tree branch.
60
+ */
61
+ export function isLibraryNavActive(
62
+ pathname: string,
63
+ nav: LibraryNavState,
64
+ scope: LibraryNavScope,
65
+ folderId?: string | null,
66
+ ): boolean {
67
+ const p = pathname.length > 1 && pathname.endsWith("/") ? pathname.slice(0, -1) : pathname
68
+ if (!LIBRARY_LIBRARY_HUB_PATHS.includes(p)) return false
69
+ if (scope === "all") {
70
+ if (isLibraryDedicatedSearchPathname(pathname)) return false
71
+ return nav.scope === "all"
72
+ }
73
+ if (scope === "my") {
74
+ if (isLibraryDedicatedSearchPathname(pathname)) return false
75
+ return nav.scope === "my"
76
+ }
77
+ if (scope === "folder" && folderId) {
78
+ return nav.scope === "folder" && nav.folderId === folderId
79
+ }
80
+ return false
81
+ }
82
+
83
+ /** Default secondary-nav selection — All questions (no `scope` query). */
84
+ export const LIBRARY_DEFAULT_NAV: LibraryNavState = {
85
+ scope: "all",
86
+ folderId: null,
87
+ }
88
+
89
+ export function isLibraryDefaultNav(nav: LibraryNavState): boolean {
90
+ return nav.scope === "all" && nav.folderId === null
91
+ }
92
+
93
+ export function parseLibraryNav(searchParams: URLSearchParams): LibraryNavState {
94
+ const raw = (searchParams.get("scope") ?? "all").toLowerCase()
95
+ if (raw === "my") return { scope: "my", folderId: null }
96
+ if (raw === "folder") {
97
+ const rawId = searchParams.get("folderId") ?? searchParams.get("folder")
98
+ const folderId = typeof rawId === "string" ? rawId.trim() || null : null
99
+ return { scope: "folder", folderId }
100
+ }
101
+ if (raw === "all") return { ...LIBRARY_DEFAULT_NAV }
102
+ return { ...LIBRARY_DEFAULT_NAV }
103
+ }
104
+
105
+ /** Rewrite invalid or incomplete scope URLs back to the default All questions hub. Preserves list search params when present. */
106
+ export function libraryCanonicalNavHref(searchParams: URLSearchParams): string | null {
107
+ const raw = searchParams.get("scope")
108
+ if (!raw) return null
109
+ const lowered = raw.toLowerCase()
110
+ const q = searchParams.get("q")?.trim() || null
111
+ const fav = searchParams.get("fav") === "1"
112
+ const deckClinical = searchParams.get("deck") === "clinical"
113
+ const preserved = {
114
+ q,
115
+ ...(fav ? { fav: true as const } : {}),
116
+ ...(deckClinical ? { deck: "clinical" as const } : {}),
117
+ }
118
+ if (lowered === "my") return null
119
+ if (lowered === "folder") {
120
+ const folderId = searchParams.get("folderId") ?? searchParams.get("folder")
121
+ return folderId ? null : libraryNavHref({ scope: "all", ...preserved })
122
+ }
123
+ if (lowered === "all") return null
124
+ return libraryNavHref({ scope: "all", ...preserved })
125
+ }
126
+
127
+ /** Breadcrumb + title for `SiteHeader` / `PageHeader` (matches secondary nav scopes). */
128
+ export interface LibraryHubHeaderModel {
129
+ title: string
130
+ breadcrumbs?: { label: string; href?: string }[]
131
+ }
132
+
133
+ /** Back link for `/library/new` — icon + parent label in `SiteHeader` (`back` prop). */
134
+ export function newQuestionBackNav(
135
+ folders: LibraryFolder[],
136
+ folderId?: string,
137
+ ): { label: string; href: string } {
138
+ if (folderId) {
139
+ const folder = folders.find(f => f.id === folderId)
140
+ if (folder) {
141
+ return {
142
+ label: folder.name,
143
+ href: libraryNavHref({ scope: "folder", folderId: folder.id }),
144
+ }
145
+ }
146
+ }
147
+ return {
148
+ label: LIBRARY_HUB_BREADCRUMB.label,
149
+ href: libraryNavHref({ scope: "all" }),
150
+ }
151
+ }
152
+
153
+ /** Ancestor-only breadcrumbs for `/library/new` (current page is the PageHeader title). */
154
+ export function newQuestionBreadcrumbs(
155
+ folders: LibraryFolder[],
156
+ folderId?: string,
157
+ ): { label: string; href: string }[] {
158
+ if (folderId) {
159
+ const folder = folders.find(f => f.id === folderId)
160
+ if (folder) {
161
+ return [
162
+ {
163
+ label: folder.name,
164
+ href: libraryNavHref({ scope: "folder", folderId: folder.id }),
165
+ },
166
+ ]
167
+ }
168
+ }
169
+ return [
170
+ {
171
+ label: LIBRARY_HUB_BREADCRUMB.label,
172
+ href: LIBRARY_HUB_BREADCRUMB.href,
173
+ },
174
+ ]
175
+ }
176
+
177
+ export function libraryHubHeaderModel(
178
+ folders: LibraryFolder[],
179
+ nav: LibraryNavState,
180
+ ): LibraryHubHeaderModel {
181
+ if (nav.scope === "my") {
182
+ return {
183
+ breadcrumbs: [{ label: LIBRARY_HUB_BREADCRUMB.label, href: LIBRARY_HUB_BREADCRUMB.href }],
184
+ title: "My items",
185
+ }
186
+ }
187
+ if (nav.scope === "folder" && nav.folderId) {
188
+ const name = folders.find(f => f.id === nav.folderId)?.name ?? "Folder"
189
+ return {
190
+ breadcrumbs: [{ label: LIBRARY_HUB_BREADCRUMB.label, href: LIBRARY_HUB_BREADCRUMB.href }],
191
+ title: name,
192
+ }
193
+ }
194
+ return {
195
+ breadcrumbs: [{ label: LIBRARY_HUB_BREADCRUMB.label, href: LIBRARY_HUB_BREADCRUMB.href }],
196
+ title: "All items",
197
+ }
198
+ }
199
+
200
+ export function filterLibraryItemsByNav(
201
+ items: LibraryItem[],
202
+ folders: LibraryFolder[],
203
+ nav: LibraryNavState,
204
+ ): LibraryItem[] {
205
+ if (nav.scope === "all") return items
206
+ if (nav.scope === "my") {
207
+ return items.filter(
208
+ i => i.author === LIBRARY_NAV_MY_AUTHOR || i.createdBy === LIBRARY_NAV_MY_AUTHOR,
209
+ )
210
+ }
211
+ if (nav.scope === "folder" && nav.folderId) {
212
+ const allowedFolderIds = collectFolderDescendantIds(folders, nav.folderId)
213
+ return items.filter(i => allowedFolderIds.has(i.folderId))
214
+ }
215
+ return items
216
+ }
217
+
218
+ /** Mock folder id for the Favorites bucket (see `DEFAULT_LIBRARY_FOLDERS`). */
219
+ export const LIBRARY_FAVORITES_FOLDER_ID = "fld-favorites"
220
+
221
+ /** Root folder id for the mock “Folder 1” tree (`fld-skills-lab` is a child). */
222
+ export const LIBRARY_CLINICAL_ROOT_FOLDER_ID = "fld-clinical"
223
+
224
+ /**
225
+ * Client-side “AI / hub” free-text filter — same scan as `useTableState` toolbar search
226
+ * (`Object.values` → string → lowercase `includes`).
227
+ */
228
+ export function filterLibraryItemsByFreeText(items: LibraryItem[], q: string): LibraryItem[] {
229
+ const t = q.trim()
230
+ if (!t) return items
231
+ const needle = t.toLowerCase()
232
+ return items.filter(row =>
233
+ Object.values(row).some(v => String(v ?? "").toLowerCase().includes(needle)),
234
+ )
235
+ }
236
+
237
+ export function isLibraryItemFavorite(item: LibraryItem): boolean {
238
+ return item.folderId === LIBRARY_FAVORITES_FOLDER_ID || item.isStarred === true
239
+ }
240
+
241
+ /** When a mock row lives in the Favorites folder, toggling off moves it here (no “original folder” yet). */
242
+ const LIBRARY_UNFAVORITE_FALLBACK_FOLDER_ID = "fld-science"
243
+
244
+ /** Demo toggle for `isStarred` / Favorites folder membership (offline mock only). */
245
+ export function toggleLibraryItemFavorite(item: LibraryItem): LibraryItem {
246
+ if (isLibraryItemFavorite(item)) {
247
+ if (item.folderId === LIBRARY_FAVORITES_FOLDER_ID) {
248
+ return {
249
+ ...item,
250
+ folderId: LIBRARY_UNFAVORITE_FALLBACK_FOLDER_ID,
251
+ isStarred: false,
252
+ }
253
+ }
254
+ return { ...item, isStarred: false }
255
+ }
256
+ return { ...item, isStarred: true }
257
+ }
258
+
259
+ export function filterLibraryItemsByFavoritesOnly(items: LibraryItem[]): LibraryItem[] {
260
+ return items.filter(isLibraryItemFavorite)
261
+ }
262
+
263
+ /**
264
+ * Mock “Featured deck” (`deck=clinical`): items under the Folder 1 tree **or**
265
+ * demo categories Category 1 / Category 3 (so list landings can show a coherent slice).
266
+ */
267
+ export function filterLibraryItemsByClinicalDeckMock(
268
+ items: LibraryItem[],
269
+ folders: LibraryFolder[],
270
+ ): LibraryItem[] {
271
+ const inClinicalTree = collectFolderDescendantIds(folders, LIBRARY_CLINICAL_ROOT_FOLDER_ID)
272
+ const topicMatch = new Set(["Category 1", "Category 3"])
273
+ return items.filter(
274
+ i => inClinicalTree.has(i.folderId) || topicMatch.has(i.topic),
275
+ )
276
+ }
277
+
278
+ export type LibraryLandingFilterState = {
279
+ hubFreeText: string
280
+ favOnly: boolean
281
+ clinicalDeck: boolean
282
+ }
283
+
284
+ /**
285
+ * Nav scope + optional dedicated search routes (`/library/list`, `/library/find`) landing filters (`q`, `fav`, `deck`).
286
+ * When `hubFreeText` is non-empty but matches no rows, hub text is ignored so the scoped list still shows.
287
+ */
288
+ export function applyLibraryHubDisplayFilters(
289
+ items: LibraryItem[],
290
+ folders: LibraryFolder[],
291
+ nav: LibraryNavState,
292
+ landing: LibraryLandingFilterState | null,
293
+ ): LibraryItem[] {
294
+ let rows = filterLibraryItemsByNav(items, folders, nav)
295
+ if (!landing) return rows
296
+ let afterText = filterLibraryItemsByFreeText(rows, landing.hubFreeText)
297
+ if (landing.hubFreeText.trim() && afterText.length === 0) {
298
+ afterText = rows
299
+ }
300
+ rows = afterText
301
+ if (landing.favOnly) rows = filterLibraryItemsByFavoritesOnly(rows)
302
+ if (landing.clinicalDeck) rows = filterLibraryItemsByClinicalDeckMock(rows, folders)
303
+ return rows
304
+ }
305
+
306
+ /** True when hub `q` is non-empty but matches no rows under the current nav (before fav/deck). */
307
+ export function libraryHubTextMatchesNothing(
308
+ items: LibraryItem[],
309
+ folders: LibraryFolder[],
310
+ nav: LibraryNavState,
311
+ landing: LibraryLandingFilterState | null,
312
+ ): boolean {
313
+ if (!landing?.hubFreeText.trim()) return false
314
+ const navRows = filterLibraryItemsByNav(items, folders, nav)
315
+ return filterLibraryItemsByFreeText(navRows, landing.hubFreeText).length === 0
316
+ }
317
+
318
+ export function patchLibraryUrlSearchParams(
319
+ sp: URLSearchParams,
320
+ patch: {
321
+ q?: string | null
322
+ fav?: boolean | null
323
+ deckClinical?: boolean | null
324
+ },
325
+ ): URLSearchParams {
326
+ const next = new URLSearchParams(sp.toString())
327
+ if (patch.q !== undefined) {
328
+ const t = patch.q?.trim() ?? ""
329
+ if (t) next.set("q", t)
330
+ else next.delete("q")
331
+ }
332
+ if (patch.fav !== undefined) {
333
+ if (patch.fav) next.set("fav", "1")
334
+ else next.delete("fav")
335
+ }
336
+ if (patch.deckClinical !== undefined) {
337
+ if (patch.deckClinical) next.set("deck", "clinical")
338
+ else next.delete("deck")
339
+ }
340
+ return next
341
+ }
342
+
343
+ /** Build {@link LIBRARY_LIST_PATH} query consistently (nav + hub search + mock toggles). */
344
+ export function libraryListSearchHref(
345
+ nav: LibraryNavState,
346
+ opts: { q?: string | null; fav?: boolean; deckClinical?: boolean },
347
+ ): string {
348
+ return libraryNavHref({
349
+ scope: nav.scope,
350
+ folderId: nav.folderId,
351
+ searchLanding: true,
352
+ q: opts.q,
353
+ fav: opts.fav,
354
+ deck: opts.deckClinical ? "clinical" : undefined,
355
+ })
356
+ }
357
+
358
+ /** Favorites bucket — same folder scope on library, list, or hub-find; preserves `q` / mock toggles on dedicated search routes. */
359
+ export function libraryFavoritesFolderHref(pathname: string, currentSearch: URLSearchParams): string {
360
+ const onList = pathname === LIBRARY_LIST_PATH
361
+ const onHubFind = pathname === LIBRARY_HUB_FIND_PATH
362
+ const q = currentSearch.get("q")
363
+ const fav = currentSearch.get("fav") === "1"
364
+ const deckClinical = currentSearch.get("deck") === "clinical"
365
+ return libraryNavHref({
366
+ scope: "folder",
367
+ folderId: LIBRARY_FAVORITES_FOLDER_ID,
368
+ ...(onList ? { searchLanding: true } : onHubFind ? { hubFind: true } : {}),
369
+ q,
370
+ ...(fav ? { fav: true as const } : {}),
371
+ ...(deckClinical ? { deck: "clinical" as const } : {}),
372
+ })
373
+ }
374
+
375
+ /** “Search” secondary nav — {@link LIBRARY_LIST_PATH} without `?q=` (always the search landing). Preserves `fav` / `deck` when set. */
376
+ export function librarySearchLandingNavHref(
377
+ nav: LibraryNavState,
378
+ currentSearch: URLSearchParams,
379
+ ): string {
380
+ const listNav: LibraryNavState =
381
+ nav.scope === "folder" ? LIBRARY_DEFAULT_NAV : nav
382
+ return libraryListSearchHref(listNav, {
383
+ fav: currentSearch.get("fav") === "1" ? true : undefined,
384
+ deckClinical: currentSearch.get("deck") === "clinical" ? true : undefined,
385
+ })
386
+ }
387
+
388
+ /** True when the dedicated search shell should show the “Search” nav row as current (not browsing a folder there). */
389
+ export function isLibrarySearchNavActive(pathname: string, nav: LibraryNavState): boolean {
390
+ if (pathname !== LIBRARY_LIST_PATH && pathname !== LIBRARY_HUB_FIND_PATH) return false
391
+ if (nav.scope === "folder" && nav.folderId) return false
392
+ return true
393
+ }
394
+
395
+ /**
396
+ * Hub scope link that preserves list-only params (`q`, `fav`, `deck`) when the user is already
397
+ * on {@link LIBRARY_LIST_PATH}; folder / “My” targets use the library path per product rule.
398
+ */
399
+ export function libraryHubScopeHref(
400
+ pathname: string,
401
+ currentSearch: URLSearchParams,
402
+ patch: { scope: LibraryNavScope; folderId?: string | null },
403
+ ): string {
404
+ const onList = pathname === LIBRARY_LIST_PATH
405
+ const onHubFind = pathname === LIBRARY_HUB_FIND_PATH
406
+ const q = currentSearch.get("q")
407
+ const fav = currentSearch.get("fav") === "1"
408
+ const deckClinical = currentSearch.get("deck") === "clinical"
409
+ const landingBits = {
410
+ q,
411
+ ...(fav ? { fav: true as const } : {}),
412
+ ...(deckClinical ? { deck: "clinical" as const } : {}),
413
+ }
414
+ if (patch.scope === "my" || (patch.scope === "folder" && patch.folderId)) {
415
+ return libraryNavHref({
416
+ scope: patch.scope,
417
+ folderId: patch.folderId,
418
+ searchLanding: false,
419
+ })
420
+ }
421
+ if (patch.scope === "all") {
422
+ return libraryNavHref({
423
+ scope: "all",
424
+ ...(onList ? { searchLanding: true } : onHubFind ? { hubFind: true } : {}),
425
+ ...landingBits,
426
+ })
427
+ }
428
+ return libraryNavHref({ scope: "all", searchLanding: false })
429
+ }
430
+
431
+ /** Build `/library` href with optional query + hash (hash without leading `#`). */
432
+ export function libraryNavHref(opts: {
433
+ scope: LibraryNavScope
434
+ folderId?: string | null
435
+ hash?: string
436
+ /**
437
+ * Hub / panel search string (`?q=`). On {@link LIBRARY_LIST_PATH} and {@link LIBRARY_HUB_FIND_PATH}
438
+ * this filters rows via {@link applyLibraryHubDisplayFilters} — **not** the DataTable toolbar
439
+ * (toolbar stays independent on those routes).
440
+ */
441
+ q?: string | null
442
+ /** Mock list filter: `fav=1` — favorites folder or `isStarred` rows. */
443
+ fav?: boolean
444
+ /** Mock list filter: `deck=clinical` — see {@link filterLibraryItemsByClinicalDeckMock}. */
445
+ deck?: "clinical" | null
446
+ /**
447
+ * When true, links use {@link LIBRARY_LIST_PATH} (library “Search” in secondary nav).
448
+ * Scoped folder / mine links should use `searchLanding: false` (library path).
449
+ */
450
+ searchLanding?: boolean
451
+ /**
452
+ * When true, links use {@link LIBRARY_HUB_FIND_PATH} (discovery hub composer submit).
453
+ * Do not combine with `searchLanding` — hub find wins if both are set.
454
+ */
455
+ hubFind?: boolean
456
+ }): string {
457
+ const base =
458
+ opts.hubFind === true
459
+ ? LIBRARY_HUB_FIND_PATH
460
+ : opts.searchLanding === true
461
+ ? LIBRARY_LIST_PATH
462
+ : LIBRARY_ALL_PATH
463
+ const sp = new URLSearchParams()
464
+ if (opts.scope === "my") sp.set("scope", "my")
465
+ if (opts.scope === "folder" && opts.folderId) {
466
+ sp.set("scope", "folder")
467
+ sp.set("folderId", opts.folderId)
468
+ }
469
+ const trimmedQ = opts.q?.trim()
470
+ if (trimmedQ) sp.set("q", trimmedQ)
471
+ if (opts.fav) sp.set("fav", "1")
472
+ if (opts.deck === "clinical") sp.set("deck", "clinical")
473
+ const qs = sp.toString()
474
+ const h = opts.hash?.replace(/^#/, "")
475
+ const hashPart = h ? `#${h}` : ""
476
+ return qs ? `${base}?${qs}${hashPart}` : `${base}${hashPart}`
477
+ }
@@ -0,0 +1,22 @@
1
+ import { createDedicatedSearchRecentsController } from "@/lib/dedicated-search-recents"
2
+
3
+ const controller = createDedicatedSearchRecentsController("library", {
4
+ storageKey: "exxat-ds.library.recent-searches.v1",
5
+ eventName: "exxat-library-recent-searches",
6
+ })
7
+
8
+ export const LIBRARY_RECENT_SEARCHES_EVENT = controller.eventName
9
+
10
+ export const libraryDedicatedSearchRecents = controller
11
+
12
+ export function readLibraryRecentSearches(): string[] {
13
+ return controller.read()
14
+ }
15
+
16
+ export function recordLibraryRecentSearch(query: string): void {
17
+ controller.record(query)
18
+ }
19
+
20
+ export function clearLibraryRecentSearches(): void {
21
+ controller.clear()
22
+ }
@@ -1,7 +1,7 @@
1
1
  import type { DataListViewType } from "@/lib/data-list-view"
2
2
 
3
- /** Views implemented in `PlacementsTable` — keep in sync with the renderers passed to `HubTable`. */
4
- export const PLACEMENTS_SUPPORTED_VIEWS = [
3
+ /** Views implemented in `LibraryTable` — keep in sync with `ListPageConnectedViewBody` renderers. */
4
+ export const LIBRARY_SUPPORTED_VIEWS = [
5
5
  "table",
6
6
  "list",
7
7
  "board",
@@ -1,25 +1,24 @@
1
1
  /**
2
- * Shared status chip labels, tint classes, and FA icon names for product list hubs
3
- * (Placements, Team, Compliance — table, list, board), plus related chips
4
- * (dashboard **task priority**, placement **readiness** on the detail drawer).
2
+ * Shared status chip tints + dashboard task-priority chips.
5
3
  *
6
- * Labels use **sentence / title case** (e.g. "Due soon", "Under Review"). Do **not** add **`uppercase`**.
4
+ * **Rendering primitive:** `ListHubStatusBadge` (`components/list-hub-status-badge.tsx`)
5
+ * for any status chip on a list hub. Map your domain statuses onto
6
+ * `LIST_HUB_STATUS_TINT_*` below before introducing new colors.
7
7
  *
8
- * **Rendering:** Use **`ListHubStatusBadge`** from `@/components/list-hub-status-badge`, or
9
- * **`StatusBadge`** from **`components/placements-table-cells.tsx`** for placement rows (wrapper
10
- * around **`ListHubStatusBadge`** + **`PLACEMENT_STATUS_*`** below). Task priority → **`TaskPriorityBadge`**.
8
+ * **Reference consumers:** `columns-showcase.tsx` (catalog),
9
+ * `library-board-view.tsx` (board card status row), `task-priority-badge.tsx`
10
+ * (dashboard task chips).
11
11
  *
12
- * **Semantic tints:** Map domain statuses onto **`LIST_HUB_STATUS_TINT_*`** before inventing new colors.
13
- * **Icon-on-tinted-disc** (insights / activity): **`TintedIconDisc`** + **`--icon-disc-*`** in **`app/globals.css`**.
12
+ * **Icon-on-tinted-disc** (insights / activity rows): `TintedIconDisc` + `--icon-disc-*`
13
+ * in `app/globals.css`.
14
+ *
15
+ * Labels stay **sentence / title case** (e.g. "Due soon", "Under review"). Do **not**
16
+ * add `uppercase`.
14
17
  */
15
18
 
16
- import type { ComplianceStatus } from "@/lib/mock/compliance"
17
- import type { Status as PlacementStatus } from "@/lib/mock/placements"
18
- import type { TeamMember } from "@/lib/mock/team"
19
-
20
- // ─── Semantic variants (reuse for new entities) ─────────────────────────────
19
+ // ─── Semantic variants (reuse for every entity) ─────────────────────────────
21
20
  //
22
- // **Light washes** (same visual weight as before) + **darker ink** via `--chip-*` for WCAG 1.4.3.
21
+ // Light washes (same visual weight as before) + darker ink via `--chip-*` for WCAG 1.4.3.
23
22
  // Backgrounds stay subtle; contrast is carried by label + icon color, not heavier fills.
24
23
 
25
24
  export const LIST_HUB_STATUS_TINT_SUCCESS =
@@ -34,25 +33,11 @@ export const LIST_HUB_STATUS_TINT_NEUTRAL =
34
33
  export const LIST_HUB_STATUS_TINT_DANGER =
35
34
  "bg-destructive/15 text-[var(--chip-destructive)] border-destructive/20 dark:bg-destructive/15 dark:text-red-200"
36
35
 
37
- /** In-progress / review (distinct from warning where both appear e.g. Placements “Under review). */
36
+ /** In-progress / review distinct from warning when both appear together (e.g. "Under review"). */
38
37
  export const LIST_HUB_STATUS_TINT_INFO =
39
38
  "bg-sky-500/15 text-[var(--chip-1)] border-sky-500/20 dark:bg-sky-500/15 dark:text-sky-100"
40
39
 
41
- // ─── Placement detail readiness row (string labels from mock) ─────────────
42
-
43
- const PLACEMENT_READINESS_BADGE_CLASS: Record<string, string> = {
44
- Ready: LIST_HUB_STATUS_TINT_SUCCESS,
45
- "At risk": LIST_HUB_STATUS_TINT_DANGER,
46
- Blocked: LIST_HUB_STATUS_TINT_DANGER,
47
- "In review": LIST_HUB_STATUS_TINT_INFO,
48
- }
49
-
50
- /** Badge `className` tail for placement readiness labels; unknown → neutral. */
51
- export function placementReadinessBadgeClass(readiness: string): string {
52
- return PLACEMENT_READINESS_BADGE_CLASS[readiness] ?? LIST_HUB_STATUS_TINT_NEUTRAL
53
- }
54
-
55
- // ─── Dashboard task priority (shared chip system) ──────────────────────────
40
+ // ─── Dashboard task priority ────────────────────────────────────────────────
56
41
 
57
42
  export type TaskPriorityLevel = "high" | "medium" | "low"
58
43
 
@@ -73,76 +58,3 @@ export function normalizeTaskPriority(priority: string): TaskPriorityLevel | nul
73
58
  if (k === "high" || k === "medium" || k === "low") return k
74
59
  return null
75
60
  }
76
-
77
- // ─── Placements (lifecycle status) ───────────────────────────────────────
78
-
79
- export const PLACEMENT_STATUS_LABEL: Record<PlacementStatus, string> = {
80
- confirmed: "Confirmed",
81
- pending: "Pending",
82
- "under-review": "Under Review",
83
- rejected: "Rejected",
84
- completed: "Completed",
85
- }
86
-
87
- export const PLACEMENT_STATUS_BADGE_CLASS: Record<PlacementStatus, string> = {
88
- confirmed: LIST_HUB_STATUS_TINT_SUCCESS,
89
- pending: LIST_HUB_STATUS_TINT_WARNING,
90
- "under-review": LIST_HUB_STATUS_TINT_INFO,
91
- rejected: LIST_HUB_STATUS_TINT_DANGER,
92
- completed: LIST_HUB_STATUS_TINT_NEUTRAL,
93
- }
94
-
95
- export const PLACEMENT_STATUS_ICON: Record<PlacementStatus, string> = {
96
- confirmed: "fa-circle-check",
97
- pending: "fa-hourglass-half",
98
- "under-review": "fa-eye",
99
- rejected: "fa-circle-xmark",
100
- completed: "fa-clipboard-check",
101
- }
102
-
103
- // ─── Team ─────────────────────────────────────────────────────────────────
104
-
105
- export type TeamMemberStatus = TeamMember["status"]
106
-
107
- export const TEAM_MEMBER_STATUS_LABEL: Record<TeamMemberStatus, string> = {
108
- active: "Active",
109
- away: "Away",
110
- invited: "Invited",
111
- }
112
-
113
- export const TEAM_MEMBER_STATUS_BADGE_CLASS: Record<TeamMemberStatus, string> = {
114
- active: LIST_HUB_STATUS_TINT_SUCCESS,
115
- away: LIST_HUB_STATUS_TINT_WARNING,
116
- invited: LIST_HUB_STATUS_TINT_NEUTRAL,
117
- }
118
-
119
- /** Font Awesome icon per status — shape + label, not colour alone (WCAG 1.4.1). */
120
- export const TEAM_MEMBER_STATUS_ICON: Record<TeamMemberStatus, string> = {
121
- active: "fa-circle-check",
122
- away: "fa-moon",
123
- invited: "fa-envelope",
124
- }
125
-
126
- // ─── Compliance ───────────────────────────────────────────────────────────
127
-
128
- export const COMPLIANCE_STATUS_LABEL: Record<ComplianceStatus, string> = {
129
- compliant: "Compliant",
130
- due_soon: "Due soon",
131
- overdue: "Overdue",
132
- pending: "Pending",
133
- }
134
-
135
- export const COMPLIANCE_STATUS_BADGE_CLASS: Record<ComplianceStatus, string> = {
136
- compliant: LIST_HUB_STATUS_TINT_SUCCESS,
137
- due_soon: LIST_HUB_STATUS_TINT_WARNING,
138
- overdue: LIST_HUB_STATUS_TINT_DANGER,
139
- pending: LIST_HUB_STATUS_TINT_NEUTRAL,
140
- }
141
-
142
- export const COMPLIANCE_STATUS_ICON: Record<ComplianceStatus, string> = {
143
- compliant: "fa-shield-check",
144
- due_soon: "fa-clock",
145
- overdue: "fa-triangle-exclamation",
146
- pending: "fa-hourglass-half",
147
- }
148
-
@@ -16,7 +16,7 @@ export const DASHBOARD_METRICS: MetricItem[] = [
16
16
  export const DASHBOARD_INSIGHT: MetricInsight = {
17
17
  title: "Throughput note",
18
18
  description: "Demo insight card — wire real KPIs from your product domain.",
19
- href: "/examples",
19
+ href: "/dashboard",
20
20
  severity: "warning",
21
21
  actionLabel: "Ask Leo",
22
22
  }