@exxatdesignux/ui 0.1.0 → 0.2.6

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.
@@ -0,0 +1,31 @@
1
+ ---
2
+ name: exxat-fontawesome-icons
3
+ description: Font Awesome Pro in Exxat DS — Kit script, fa-light/fa-solid, subset audit (fa:subset-audit), aria-hidden on decorative icons, no parallel icon libraries for product chrome. Use when adding or changing icons, nav glyphs, table toolbar icons, or debugging missing kit glyphs.
4
+ user-invocable: true
5
+ ---
6
+
7
+ # Exxat DS — Font Awesome icons
8
+
9
+ **Cursor rule:** `.cursor/rules/exxat-fontawesome-icons.mdc`
10
+ **Handbook:** `apps/web/AGENTS.md` §1 (item 8), §8 accessibility for icon-only / informational cases.
11
+
12
+ ## Stack
13
+
14
+ - **Kit:** `apps/web/app/layout.tsx` loads the Font Awesome Pro kit (subset via `fontawesome-subset.manifest.json`).
15
+ - **Audit:** `pnpm --filter web fa:subset-audit` — refresh kit icon selection when adding new glyph names.
16
+
17
+ ## MUST
18
+
19
+ 1. **`<i className="fa-light fa-…" aria-hidden="true" />`** when a parent provides the accessible name (`Button` + `aria-label`, `Tip`, adjacent visible text).
20
+ 2. **`fa-light`** for default; **`fa-solid`** for active/selected where the app already does (sidebar rows, tabs).
21
+ 3. **Static** `className` strings where possible so the audit script can find class names.
22
+
23
+ ## MUST NOT
24
+
25
+ - Introduce a **second** icon library for the same surfaces (duplicate Lucide/Heroicons for nav, hubs, toolbars).
26
+ - Put the **only** accessible name on `<i>` without parent labelling — see **exxat-accessibility** Case B/C.
27
+
28
+ ## See also
29
+
30
+ - `.cursor/rules/exxat-accessibility.mdc`
31
+ - `.cursor/skills/exxat-accessibility/SKILL.md`
@@ -0,0 +1,36 @@
1
+ ---
2
+ name: exxat-list-page-view-shells
3
+ description: >-
4
+ Centered, reusable layout for ListPageTemplate view bodies — ListPageViewFrame,
5
+ data-views/ primitives, and rules to avoid page-tied view markup. Use when adding
6
+ folder/panel/custom views, fixing wide-viewport layout, or extracting view UI from a single hub.
7
+ ---
8
+
9
+ # List-page view shells (Exxat DS)
10
+
11
+ ## When to use this skill
12
+
13
+ - Adding or changing **`viewType`** surfaces: **folder**, **panel**, list/board chrome, icon grids, OS-style explorers.
14
+ - User or PR asks for **“centered”**, **“reusable view”**, or **“not tied to one page”** layout.
15
+ - You see **duplicated** `mx-4 lg:mx-6`, `mx-auto max-w-6xl`, or similar wrappers in multiple `*-table.tsx` files.
16
+
17
+ ## Instructions
18
+
19
+ 1. **Gutter + optional max width** — Import **`ListPageViewFrame`** from **`@/components/data-views/list-page-view-frame`** (or **`@/components/data-views`**). Wrap the view body (usually below **`DataTableToolbar`** when the view shares the table toolbar).
20
+ - Pass **`maxWidthClassName={LIST_PAGE_VIEW_FRAME_MAX_ICON_GRID}`** for dense tile grids.
21
+ - Pass **`maxWidthClassName={LIST_PAGE_VIEW_FRAME_MAX_WIDE}`** when the view includes toolbar rows + breadcrumbs + grid.
22
+ 2. **Do not double-gutter** — If **`DataTable`** already provides horizontal inset for the **table** view, do **not** wrap that branch in **`ListPageViewFrame`**. Use the frame on **sibling** view branches (folder, panel, etc.) only.
23
+ 3. **Reuse before inventing** — Prefer **`FolderGridView`**, **`FinderPanelView`**, **`ListPageBoardTemplate`**, **`ListPageViewFrame`**. If a new pattern appears twice, **promote** it to **`components/data-views/`** with domain-agnostic props.
24
+ 4. **Entity-specific → generic** — If logic is “any tree + any row type”, build **`components/data-views/<generic-name>.tsx`** and keep **`question-bank-*`** (or similar) as a thin composition + mock types.
25
+
26
+ ## Checklist
27
+
28
+ - [ ] View body uses **`ListPageViewFrame`** (or a component that uses it internally, e.g. **`FolderGridView`**).
29
+ - [ ] No **extra** horizontal padding around **`DataTable`** vs **`AGENTS.md` §5**.
30
+ - [ ] New grid/shell lives under **`components/data-views/`** when a second hub could reuse it.
31
+
32
+ ## References
33
+
34
+ - **`apps/web/components/data-views/list-page-view-frame.tsx`** — implementation + exported constants.
35
+ - **`apps/web/AGENTS.md` §4.5** — MUST/MUST NOT.
36
+ - **`.cursor/rules/exxat-list-page-view-shells.mdc`**.
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: exxat-primary-nav-secondary-panel
3
+ description: Exxat DS pattern — one primary sidebar row opens a nested SecondaryPanel (Question bank). NavLinkItem.secondaryPanel id, PANELS registry, useAutoPanel on hub, URL scope + same useTableState rows. Use when adding hub scoped nav (All/My/tree) beside content.
4
+ user-invocable: true
5
+ ---
6
+
7
+ # Exxat DS — primary nav → secondary panel
8
+
9
+ **Cursor rule:** `.cursor/rules/exxat-primary-nav-secondary-panel.mdc`
10
+ **Handbook:** `apps/web/AGENTS.md` §4.6
11
+
12
+ ## Wiring checklist
13
+
14
+ 1. **`lib/mock/navigation.tsx`** — set **`secondaryPanel: "<id>"`** on the primary **`NavLinkItem`**; **`url`** = hub route.
15
+ 2. **`components/secondary-panel.tsx`** — add **`PANELS["<id>"]`** → panel shell (title, optional search) + secondary nav component.
16
+ 3. **Hub client** — mount **`*PanelActivator`** with **`useAutoPanel("<id>")`** (same id) for the lifetime of the route (e.g. `QuestionBankPanelActivator`).
17
+ 4. **Data** — keep **one** **`useTableState`** / **`tableState.rows`**; drive scope from **URL** + small helpers (see **`lib/question-bank-nav.ts`**).
18
+
19
+ ## MUST NOT
20
+
21
+ - Set **`secondaryPanel`** without **`PANELS[id]`** + **`useAutoPanel`** — broken empty rail.
22
+ - Use this for full product areas that belong as **primary** or **collapsible child** rows.
23
+
24
+ ## Reference
25
+
26
+ - `components/app-sidebar.tsx` — `openPanel` on same-route primary click.
27
+ - `components/question-bank-secondary-nav.tsx` + `lib/question-bank-nav.ts`.
@@ -0,0 +1,45 @@
1
+ # Global command palette (⌘K)
2
+
3
+ **Code:** `components/command-menu.tsx`, config **`buildCommandMenuConfig()`** in **`lib/command-menu-config.ts`**, wired in **`app/(app)/layout.tsx`** via **`CommandMenuProvider`**. Searchable row data is built in **`lib/command-menu-search-data.ts`** (not inside the shell component).
4
+
5
+ ## Role
6
+
7
+ The command menu is the app’s **global search and AI entry**—one place to jump to routes, library pages, patterns, and AI starters. It is **not** a duplicate of the left sidebar; it **indexes** product surfaces for fast discovery.
8
+
9
+ ## User model
10
+
11
+ | Need | Where it lives |
12
+ |------|----------------|
13
+ | **Find a page, component, or pattern** | Palette — filterable list, **Enter** to navigate. |
14
+ | **Quick AI / natural language** | Prefer **short answers or “research” snippets inside the palette** when the product can return compact, citeable results without leaving the flow. |
15
+ | **Long or complex answers** | **Ask Leo** right sidebar — multi-step reasoning, long-form help, or anything that does not fit a small results surface. |
16
+
17
+ **Design rule:** Treat the palette as **progressive disclosure**—lightweight results first in-menu; **escalate** to Ask Leo when the answer is too large or needs a dedicated conversation surface.
18
+
19
+ ## Keyboard
20
+
21
+ - **⌘K / Ctrl+K** — open / toggle the palette (global listener in `CommandMenu`).
22
+ - **Ask Leo** remains **⌘⌥K / Ctrl+Alt+K** (see `.cursor/rules/exxat-kbd-shortcuts.mdc`) so it does not collide with table search where both exist.
23
+
24
+ ## Configuration
25
+
26
+ - **Static groups** (AI suggestions, Navigation, Components, Patterns) live in **`lib/command-menu-config.ts`**.
27
+ - Optional **`dataGroups`** are passed to **`buildCommandMenuConfig({ dataGroups })`** from the app shell. **Implementation:** **`getCommandMenuSearchDataGroups()`** in **`lib/command-menu-search-data.ts`** maps mock/API rows (e.g. placements with student names) to **`CommandMenuItem`** rows with **`label`**, **`href`**, and **`keywords`** for cmdk filtering. The layout uses **`buildCommandMenuConfig({ dataGroups: getCommandMenuSearchDataGroups() })`**. Keep domain mapping **outside** `command-menu.tsx` so data sources can change without editing the shell.
28
+ - **`searchOnly` on `CommandMenuGroup`:** cmdk shows **every** mounted item when the search box is empty. For large indexes (hundreds of placements), set **`searchOnly: true`** on that group so **`command-menu.tsx`** does not render it until the user has typed a non-empty query. Static groups (AI, Navigation, …) stay visible on open; the data group appears once the user searches.
29
+
30
+ ## Files (quick reference)
31
+
32
+ | Piece | Location |
33
+ |-------|----------|
34
+ | Palette UI | `components/command-menu.tsx` |
35
+ | Static groups + `buildCommandMenuConfig` | `lib/command-menu-config.ts` (`CommandMenuGroup.searchOnly`) |
36
+ | Row → menu items (placements, etc.) | `lib/command-menu-search-data.ts` |
37
+ | Provider + `dataGroups` | `app/(app)/layout.tsx` |
38
+
39
+ ## Sidebar
40
+
41
+ **“Search or ask Leo”** in the sidebar opens the same palette; shortcuts and copy should stay aligned with **`AGENTS.md` §7.1**.
42
+
43
+ ---
44
+
45
+ Keep this document aligned with **`exxat-ds/AGENTS.md` §7.1** when behavior or copy changes.
@@ -0,0 +1,167 @@
1
+ # Data views pattern (table, list, board)
2
+
3
+ > **Canonical rules for agents (MUST/MUST NOT, checklists):** [`AGENTS.md`](../AGENTS.md) in this package (including **§8 Accessibility**). This file is the long-form narrative; keep both aligned when patterns change.
4
+
5
+ This document describes how list pages combine **views**, **toolbar** behavior, **filters**, **properties**, and **persistence** in this codebase.
6
+
7
+ ## Reuse existing components (required)
8
+
9
+ **Prefer composing what already exists** over rebuilding one-off tabs, search, filters, or property panels. The **Placements** flow is the reference implementation; new list/table/board pages should wire the same building blocks with new data and column definitions.
10
+
11
+ | Need | Reuse | Where Placements uses it |
12
+ | --- | --- | --- |
13
+ | **View tabs** (table / list / board, lifecycle filters) | `ListPageTemplate` (`ViewTab`, `renderContent`, optional metrics + export) | `components/data-list-client.tsx` + `components/templates/list-page.tsx` |
14
+ | **Table shell** (search, filter bar, sort, grouping, columns, pagination) | `DataTable`, `DataTableToolbar`, `useTableState` | `components/data-table/`, `components/data-list-table.tsx` |
15
+ | **Properties drawer** (display, columns, filters, sort, view type tiles) | `TablePropertiesDrawer` from `@/components/table-properties` | `DrawerToolbar` / list–board shells in `data-list-table.tsx` |
16
+ | **Board / list** | `PlacementsBoardView`, `PlacementsListView` + same `useTableState` | `DataListTable` |
17
+ | **Page header** (primary CTA + More ⋯ + export) | `PlacementsPageHeader` or `TeamPageHeader` | `components/placements-page-header.tsx`, `components/team-page-header.tsx` |
18
+ | **Team page (primary template)** | `TeamClient` = `ListPageTemplate` + `KeyMetrics` + `TeamPageHeader` + `TeamTable` (same composition as `DataListClient`) | `components/team-client.tsx`, `lib/mock/team-kpi.ts` |
19
+ | **Team roster** | `TeamTable` — `DataTable` + `useTableState` + `TablePropertiesDrawer`; list/board/dashboard read **`tableState.rows`** | `components/team-table.tsx` |
20
+ | **Dashboard view (list tab)** | **`KeyMetrics`** (`variant="flat"` or `"card"`) — same KPI system as the template metrics strip; **do not** add ad-hoc `Card` grids for entity summaries | `TeamTable` dashboard branch, `lib/mock/team-kpi.ts` |
21
+ | **Export** | `ExportDrawer` | `ListPageTemplate` export props; `DataListClient` |
22
+ | **View body layout** (gutter + centered max-width for folder / icon / panel-style content) | **`ListPageViewFrame`** (`components/data-views/list-page-view-frame.tsx`, re-exported from `components/data-views`) | **`FolderGridView`** (uses the frame); **`QuestionBankOsFolderView`** — see **`AGENTS.md` §4.5** |
23
+
24
+ **Rules:** (1) Import and compose these components; pass **props** and **column defs** for your entity. (2) If something is missing, **extend the shared component** under `components/` (e.g. a new optional slot on `DataTableToolbar`) rather than copying markup into a single page. (3) Card-only or lightweight pages may use a smaller **Properties** sheet only when there is **no** table—otherwise use `TablePropertiesDrawer` with `DataTable` (see Team).
25
+
26
+ ### Table pages must use view tabs
27
+
28
+ If the page uses a **`DataTable`** (or equivalent data grid) as the main surface, it **must** sit under **`ListPageTemplate`** so users get the **views toolbar** (tabs, add view, per-tab settings). The default `ViewTab` entries should include at least one tab whose `viewType` is **`table`** when the primary experience is tabular data. **Do not** render a `DataTable` alone under only `PageHeader` + body.
29
+
30
+ - **Reference:** `DataListClient` (Placements) and `TeamClient` (Team).
31
+ - **Rationale:** Consistent navigation, saved views, per-tab view type (table / list / board), and export at the template level.
32
+
33
+ ## View layout frame (centered, reusable)
34
+
35
+ Non-table view branches (e.g. **folder** icon grid, **panel** finder, OS-style folder explorer) **should** use **`ListPageViewFrame`** for the same horizontal gutter and optional **`max-w-*`** centering as other hubs — **not** hand-copied `mx-4 lg:mx-6` + `mx-auto max-w-6xl` in each `*-table.tsx`. New view types belong in **`components/data-views/`** as **generic** components with render props; hub tables only wire **`tableState.rows`** and callbacks.
36
+
37
+ **Handbook:** **`AGENTS.md` §4.5**. **Cursor:** **`.cursor/rules/exxat-list-page-view-shells.mdc`**. **Skill:** **`.cursor/skills/exxat-list-page-view-shells/SKILL.md`**. **Do not** wrap **`DataTable`** in the frame if that stacks padding with the table toolbar (**`AGENTS.md` §5**).
38
+
39
+ ## Architecture
40
+
41
+ - **Page shell** — `ListPageTemplate` owns the views toolbar (tabs), optional metrics, and export drawer. Content for the active tab is rendered via `renderContent`.
42
+ - **Per–lifecycle (or category) data** — `DataListTable` swaps **columns** and **row sets** based on `lifecycleTabId` (e.g. All / Upcoming / Ongoing / Completed). Each lifecycle tab gets its **own** `DataListTable` instance (`key={tab.filterId}`) so `useTableState` resets correctly when columns change.
43
+ - **Shared table state** — `useTableState` holds sort, search, filters, grouping, column order/visibility/pins/widths, row height, gridlines, and pagination flags. **Table**, **list**, **board**, and **dashboard** all read the same state so switching view type keeps behavior aligned.
44
+
45
+ ## Mock data and connected views
46
+
47
+ 1. **Put entity rows in `lib/mock/<entity>.ts`** — Export a typed array (e.g. `TeamMember[]`, `Placement[]`) and reuse it from the page client and from KPI helpers.
48
+ 2. **KPI / summary helpers** — Add `lib/mock/<entity>-kpi.ts` (or next to the mock file) with pure functions **`entityKpiMetrics(rows: T[])`** and **`entityKpiInsight(rows: T[])`** returning `MetricItem[]` and `MetricInsight` from `@/components/key-metrics`. Drive **both** the template **`metrics`** slot and the **dashboard view** from the **same helpers**, passing **`tableState.rows`** in the table component so filters/search apply everywhere.
49
+ 3. **Single table component** — One component (e.g. `TeamTable`) receives **`members`** (full mock) + **`view`**. It calls **`useTableState(members, columns, …)`** once. Branch on `view`:
50
+ - **`table`** → `DataTable` with that state.
51
+ - **`list` / `board`** → `DataTableToolbar` + list/board UI with **`tableState.rows`**.
52
+ - **`dashboard`** → `DataTableToolbar` + **`KeyMetrics`** (and/or other **existing** dashboard building blocks — `ChartsOverview` only when charts are product-appropriate) fed by **`teamKpiMetrics(tableState.rows)`** / **`teamKpiInsight(tableState.rows)`** — **not** bespoke `Card` grids duplicating KPIs.
53
+ 4. **Client wiring** — `renderContent` always renders the table component with **`view={tab.viewType}`** and **`key={tab.id}`** (not `viewType`) so switching views does not remount state. **Do not** show “not wired” placeholders for list/board/dashboard when the table stack supports those views.
54
+ 5. **Full-route dashboards** — The **`/dashboard`** page uses **`DashboardTabs`**, **`KeyMetrics`**, and **`ChartsOverview`** with `lib/mock/dashboard.ts`. List-page **dashboard view** is a **narrower** slice: reuse **`KeyMetrics`** (+ entity KPI helpers) first; add charts only when they match the entity and reuse **`ChartsOverview`** patterns from `components/charts-overview.tsx`.
55
+
56
+ ## Table vs list vs board vs dashboard
57
+
58
+ | Concern | Table | List | Board | Dashboard (view tab) |
59
+ | --- | --- | --- | --- | --- |
60
+ | Primary surface | `DataTable` | `PlacementsListView` / entity list | `PlacementsBoardView` / entity board | **`KeyMetrics`** (+ optional charts via shared dashboard components) |
61
+ | Data source | `useTableState` | **`tableState.rows`** | **`tableState.rows`** | **`tableState.rows`** via KPI helpers |
62
+ | Column headers / labels | `showColumnLabels` | Same source columns, list layout | Phase columns + optional board column menu | N/A (metrics from same columns/filters) |
63
+ | Row click / navigation | From `DataListTable` | From list shell | Card `onOpen` | N/A |
64
+ | Pagination | Optional `PaginationBar` + `CountSyncer` | Same pattern | N/A (board uses phase columns) | N/A |
65
+
66
+ ## Toolbar and properties
67
+
68
+ - **Search** — Global quick search lives in table state (`search` / `showToolbarSearch` from display options). Board phase columns can add local search in the board column header.
69
+ - **Filters** — Built from `ColumnDef.filter` and `filterFields` passed to `TablePropertiesDrawer`. Connectors between filters (`and` / `or`) are part of table state.
70
+ - **Sort / group** — Sort rules and `groupBy` are in table state; board menu proxies the same actions when `boardColumnMenu` is wired.
71
+ - **Properties drawer** — `TablePropertiesDrawer` is **generic**: supply `filterFields`, `fieldDefinitionsForDrawer`, `resolveColumnLabel`, `activeFilters`, sort/column handlers, `displayOptions`, and optional view-type tiles. Domain-specific defaults (e.g. `FILTER_FIELDS` in `types.ts`) are optional; new pages can pass their own definitions.
72
+
73
+ **Import:** `@/components/table-properties` re-exports the drawer and types.
74
+
75
+ ## Board UI reuse
76
+
77
+ **Handbook:** **`AGENTS.md` §4.4** — board card shell, badge row, shared status maps, and MUST/MUST NOT. **Cursor:** **`.cursor/rules/exxat-board-cards.mdc`**, skill **`.cursor/skills/exxat-board-cards/SKILL.md`**.
78
+
79
+ - **Card shell** — `components/data-views/list-page-board-card.tsx` — **`ListPageBoardCard`**, **`ListPageBoardCardHeader`**, **`ListPageBoardCardTitleRow`**, **`ListPageBoardCardAvatar`**, **`ListPageBoardCardBadgeRow`**, **`ListPageBoardCardBody`**, **`ListPageBoardCardSecondary`**. All product board cards on list hubs **should** use this shell (same **`Card` `size="sm"`** pattern as Placements).
80
+ - **Primitives** — `components/data-views/board-card-primitives.tsx` — `BoardCardIconRow`, `BoardCardTwoLineBlock` (optional `line2`), `BoardNewCardPlaceholder`, `lineClampClass`.
81
+ - **Status (Team & Compliance)** — `lib/list-status-badges.ts` — single source for label strings + badge `className` tails for **table, list, and board**. Do **not** pair with `uppercase` on the Badge (labels are sentence case, aligned with Placements `BoardStatusBadge`).
82
+ - **Owner initials** — `lib/initials-from-name.ts` when mock rows have a display name but no `initials` field.
83
+ - **Shared column shell** — `components/data-views/list-page-board-template.tsx` — `ListPageBoardTemplate` + `ListPageBoardColumnDef<T>`: define columns with `filter` predicates, `renderCard`, `getRowKey`. Used by **Team** and **Compliance** boards; new hubs should start here before custom chrome.
84
+ - **Placement card** — `components/data-views/placement-board-card.tsx` — `BoardPlacementCard` composes **`ListPageBoardCard`** parts with `ColumnDef<Placement>` and lifecycle layout helpers from `lib/placement-board-card-layout.ts`. Placements keeps richer column headers (search, menus); still uses the same primitives.
85
+ - New entities should add their own card component that composes **`ListPageBoardCard`** + primitives rather than duplicating column scroll/layout or ad-hoc card chrome.
86
+
87
+ ## Dashboard view (list pages)
88
+
89
+ - **Reuse the dashboard chart bundle** — `components/dashboard-report-charts.tsx` — `DashboardReportCharts`: flat `KeyMetrics` + middle chart section + period comparison `KeyMetrics` card. **`ChartsOverview`** (placement-themed demo gallery) is the default middle section for `/dashboard` and **Placements**. **Team** passes **`chartsSection={<TeamDashboardChartsSection members={tableState.rows} />}`** so charts reflect roster data, not placements. List hubs use `ListPageDashboardCharts` (`metricsSingleRow`). Chart **style** can follow `ChartVariantProvider` when using `ChartsOverview`.
90
+ - **Data tab canvas charts** (`data-view-dashboard-charts*.tsx`) share **`ChartFigure`**, **`ChartCard`**, and **`ChartDataTable`** with `charts-overview.tsx`. **Layout** for Placements / Team / Compliance is stored in one place: **`lib/data-view-dashboard-storage.ts`** (see `AGENTS.md` §4.3). **Keyboard-selected bars/slices** must use **`lib/chart-keyboard-selection.ts`** (`activeBar` / `activeShape`) so behavior matches the gallery — not opacity-only `Cell` dimming.
91
+
92
+ ## Persistence
93
+
94
+ - **Page-level** (`lib/data-list-persistence.ts`, key `exxat-ds:data-list:page:v1`): `displayOptions`, `showMetrics`, `tabs`, `activeTabId`. Loaded in `DataListClient` with `useLayoutEffect`, saved debounced on change. `ListPageTemplate` runs in **controlled** mode when `tabs` / `onTabsChange` / `activeTabId` / `onActiveTabChange` are passed.
95
+ - **Per–lifecycle tab** (key `exxat-ds:data-list:lifecycle:v1:<filterId>`): sort, search, filters, group by, column order/hidden/widths/pins/wrap, column menu search map, row height, gridlines, filter bar visibility, search popover, conditional rules, pagination toggle and page/size. Hydrated in `DataListTable` with `useLayoutEffect`; saved debounced when those fields change.
96
+
97
+ To add a new page: copy the `DataListClient` pattern (controlled `ListPageTemplate` + storage key namespace) or call `schedulePageSave` / `scheduleLifecycleSave` with your own keys.
98
+
99
+ ## Rules of thumb
100
+
101
+ 1. **One `useTableState` per logical table** — Remount with `key` when the column set or entity context changes.
102
+ 2. **Don’t fork filter/sort UX** — Reuse `TablePropertiesDrawer` and `DataTableToolbar` patterns so accessibility and behavior stay consistent.
103
+ 3. **Boards derive from the same columns** — `boardColumns` / `hiddenColKeys` should reflect table `displayCols` so “hide column” and “properties” stay in sync.
104
+ 4. **Persist stable JSON** — Version objects with `v: 1` and keep keys namespaced to allow migrations later.
105
+
106
+ ---
107
+
108
+ ## Required UX for dense lists (10+ items)
109
+
110
+ When a page shows a **list**, **table**, or **card grid** with **more than 10 items**, it must expose:
111
+
112
+ | Capability | Table / list / board | Card-only pages (no `DataTable`) |
113
+ | --- | --- | --- |
114
+ | **Search** | Toolbar search + column quick-search where applicable | At least one search control filtering the visible set |
115
+ | **Filter** | Filter bar + `TablePropertiesDrawer` filters | Filters in toolbar or in Properties, as appropriate to the content |
116
+ | **Sorting** | Column sort / sort rules in drawer | User-visible sort (e.g. name, date, role) |
117
+ | **Properties** | `TablePropertiesDrawer` (columns, display, filters, sort) | A **Properties** entry point (sheet or drawer) for view options — same *role* as table properties, even if the UI is simpler |
118
+
119
+ Below the threshold, these may be omitted unless the page is a primary data hub (see below).
120
+
121
+ ---
122
+
123
+ ## Data pages: primary CTA + More + Export
124
+
125
+ If the page **has exportable data** (rows, members, placements, etc.), follow the **Placements** header pattern:
126
+
127
+ 1. **Primary action** — One default (filled) button for the main task (e.g. **New placement**, **Invite member**). Do **not** use `variant="outline"` for that primary action.
128
+ 2. **More (⋯)** — An outline **icon** button opening a menu that includes **Export** (and other overflow actions). Wire **Export** to `ExportDrawer` (or equivalent).
129
+ 3. **Subtitle** — Prefer a short line with **count + freshness** (e.g. `24 records · Last updated now`), matching `PlacementsPageHeader`.
130
+
131
+ Reference: `components/placements-page-header.tsx`, `components/team-page-header.tsx`, `components/team-client.tsx`.
132
+
133
+ ---
134
+
135
+ ## Page vs drawer (actions and auxiliary views)
136
+
137
+ **When to use a drawer or sheet:** The user needs **the surrounding page** (list, hub, or parent task) to stay **visible for context** *and* they need a **quick view**, **quick actions**, or a **short auxiliary step** — e.g. table properties, export, a brief row summary, or “change one setting and dismiss.”
138
+
139
+ **When to use a new page (route):** The flow is **primary**, **long-form**, **multi-step**, or should have its **own URL** / bookmark / history **without** the parent page behind it — e.g. full create/edit, wizards, or detail that *is* the task.
140
+
141
+ **Rule of thumb:** **Context + quick** → **drawer**; **otherwise** → **new page**.
142
+
143
+ Canonical rules: **`AGENTS.md` §6.4**, root **`.cursor/rules/exxat-page-vs-drawer.mdc`**.
144
+
145
+ ---
146
+
147
+ ## Primary pages with large datasets
148
+
149
+ When a route is a **primary** destination in nav (main hub for an entity) **and** the dataset is **large** or **highly interactive**:
150
+
151
+ - Use the **primary page template**: `ListPageTemplate` (tabs, metrics strip, export drawer at template level) + data client pattern as in **`DataListClient`** / **`DataListTable`** — not a minimal `PageHeader`-only layout.
152
+ - Smaller satellite pages may use **`PageHeader` + section content**; once the dataset grows past the dense-list threshold, add the toolbar rules above and consider promoting to the full template if the page becomes a main hub.
153
+
154
+ ---
155
+
156
+ ## Summary checklist
157
+
158
+ - [ ] **Reuse** — Tabs, search, filters, and property UI come from **`ListPageTemplate`**, **`DataTable` / `useTableState`**, **`TablePropertiesDrawer`**, and related Placements modules—not ad-hoc duplicates.
159
+ - [ ] **Table + tabs** — Any **`DataTable`** is wrapped in **`ListPageTemplate`** (view tabs), not only `PageHeader` + body.
160
+ - [ ] **>10 items** → search, filter, sort, properties (per surface type above).
161
+ - [ ] **Has data to export** → **More** menu with **Export** + shared `ExportDrawer` pattern.
162
+ - [ ] **Primary + large / main hub** → `ListPageTemplate`-style shell where applicable.
163
+ - [ ] **Page vs drawer (§6.4)** — Quick actions with parent **context** → drawer/sheet; primary or long flows → **new route**.
164
+ - [ ] **Primary button** → `Button` default variant (`size="lg"` for parity with Placements), not outline.
165
+ - [ ] **Dashboard view tab** → `KeyMetrics` + shared KPI helpers from **`tableState.rows`**; no duplicate one-off metric cards.
166
+ - [ ] **Data view charts** → `ChartFigure` + `chart-keyboard-selection`; layout persistence via **`data-view-dashboard-storage`** (see `AGENTS.md` §4.3).
167
+ - [ ] **Mock + KPIs** → Entity rows in **`lib/mock/`**; **`entityKpiMetrics` / `entityKpiInsight`** consumed by template metrics and dashboard view.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exxatdesignux/ui",
3
- "version": "0.1.0",
3
+ "version": "0.2.6",
4
4
  "description": "Exxat shared design system (components, hooks, tokens). Monorepo setup: clone repo then pnpm bootstrap at workspace root — see github.com/ExxatDesign/Exxat-DS-Workspace README.",
5
5
  "type": "module",
6
6
  "private": false,
@@ -30,12 +30,14 @@
30
30
  "main": "./src/index.ts",
31
31
  "types": "./src/index.ts",
32
32
  "bin": {
33
+ "exxat-ui": "./bin/cli.mjs",
33
34
  "create-exxat-app": "./bin/init.mjs"
34
35
  },
35
36
  "files": [
36
37
  "src",
37
38
  "bin",
38
- "template"
39
+ "template",
40
+ "consumer-extras"
39
41
  ],
40
42
  "dependencies": {
41
43
  "@hookform/resolvers": "^5.2.2",
@@ -72,6 +74,7 @@
72
74
  },
73
75
  "scripts": {
74
76
  "typecheck": "tsc --noEmit",
75
- "lint": "eslint src/"
77
+ "lint": "eslint src/",
78
+ "vendor:consumer-extras": "node ./scripts/vendor-consumer-extras.mjs"
76
79
  }
77
80
  }
@@ -469,14 +469,19 @@ function SidebarMenuItem({ className, ...props }: React.ComponentProps<"li">) {
469
469
  <li
470
470
  data-slot="sidebar-menu-item"
471
471
  data-sidebar="menu-item"
472
- className={cn("group/menu-item relative", className)}
472
+ className={cn(
473
+ "group/menu-item relative",
474
+ /* Icon rail: center the square menu control in the column (footer + primary). */
475
+ "group-data-[collapsible=icon]:flex group-data-[collapsible=icon]:justify-center",
476
+ className,
477
+ )}
473
478
  {...props}
474
479
  />
475
480
  )
476
481
  }
477
482
 
478
483
  const sidebarMenuButtonVariants = cva(
479
- "peer/menu-button group/menu-button flex w-full cursor-pointer select-none items-center gap-2 overflow-hidden rounded-md p-2 text-start text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pe-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground data-active:bg-background data-active:font-medium data-active:text-foreground data-active:shadow-sm data-active:ring-1 data-active:ring-sidebar-border data-active:hover:bg-background data-active:hover:text-foreground data-active:hc:border data-active:hc:border-foreground data-active:forced-colors:border data-active:forced-colors:border-[Highlight] [&_svg:not([data-product-logo]):not([data-product-logo-mark])]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate",
484
+ "peer/menu-button group/menu-button flex w-full group-data-[collapsible=icon]:w-8 cursor-pointer select-none items-center gap-2 overflow-hidden rounded-md p-2 text-start text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pe-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground data-active:bg-background data-active:font-medium data-active:text-foreground data-active:shadow-sm data-active:ring-1 data-active:ring-sidebar-border data-active:hover:bg-background data-active:hover:text-foreground data-active:hc:border data-active:hc:border-foreground data-active:forced-colors:border data-active:forced-colors:border-[Highlight] [&_svg:not([data-product-logo]):not([data-product-logo-mark])]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:gap-0 group-data-[collapsible=icon]:[&>*:not(:first-child)]:hidden",
480
485
  {
481
486
  variants: {
482
487
  variant: {
@@ -1,22 +1,60 @@
1
+ "use client"
2
+
1
3
  /**
2
4
  * PageHeader — Full-width content area header
3
5
  *
4
6
  * Sits at the top of a page's main content, BELOW the breadcrumb/topbar.
5
7
  * Uses Ivy Presto (Adobe Fonts) for the title via font-heading CSS variable.
6
8
  *
9
+ * **Variant `collaboration`** — optional access line + stacked collaborator faces
10
+ * and an invite control ahead of the primary `actions` slot (Question bank pattern).
11
+ *
7
12
  * WCAG 2.1 AA:
8
13
  * ✓ <h1> landmark — one per page (WCAG 1.3.1)
9
14
  * ✓ Sufficient colour contrast ≥ 4.5:1 on title + subtitle (SC 1.4.3)
15
+ * ✓ Face stack: `role="group"` + aggregate `aria-label`; each face has a `Tooltip` name
10
16
  */
11
17
 
12
18
  import * as React from "react"
13
19
  import { cn } from "@/lib/utils"
20
+ import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
21
+ import { Button } from "@/components/ui/button"
22
+ import { Tip } from "@/components/ui/tip"
23
+ import {
24
+ Tooltip,
25
+ TooltipContent,
26
+ TooltipTrigger,
27
+ } from "@/components/ui/tooltip"
28
+
29
+ export type PageHeaderVariant = "default" | "collaboration"
30
+
31
+ export interface PageHeaderCollaborator {
32
+ id: string
33
+ name: string
34
+ imageUrl?: string | null
35
+ initials?: string
36
+ }
14
37
 
15
38
  export interface PageHeaderProps {
16
39
  /** Primary page title — rendered as <h1> in Ivy Presto serif */
17
40
  title: string
18
- /** Short descriptor or date shown below the title */
41
+ /** Short descriptor or date shown below the title (and below `accessInfo` when set) */
19
42
  subtitle?: string
43
+ /** Layout preset — `collaboration` enables access line + face stack + invite ahead of `actions`. */
44
+ variant?: PageHeaderVariant
45
+ /**
46
+ * Role / access copy or badges — rendered between the title and subtitle when
47
+ * `variant="collaboration"` (e.g. lock icon + “Editors can modify”).
48
+ */
49
+ accessInfo?: React.ReactNode
50
+ /** People with access — shown as an overlapping face stack when `variant="collaboration"`. */
51
+ collaborators?: PageHeaderCollaborator[]
52
+ /** Max faces before a `+N` chip — default 4 */
53
+ collaboratorDisplayLimit?: number
54
+ /** Outline control beside the stack — e.g. open share / invite dialog */
55
+ onAddCollaborator?: () => void
56
+ /** Accessible name for the invite control — default “Invite people” */
57
+ addCollaboratorLabel?: string
20
58
  /** Optional slot for right-aligned actions (buttons, selectors, etc.) */
21
59
  actions?: React.ReactNode
22
60
  /** Extra className for the outer wrapper */
@@ -25,32 +63,136 @@ export interface PageHeaderProps {
25
63
  showTitleBlock?: boolean
26
64
  }
27
65
 
28
- export function PageHeader({ title, subtitle, actions, className, showTitleBlock = true }: PageHeaderProps) {
66
+ function PageHeaderCollaborationFaces({
67
+ people,
68
+ limit,
69
+ addLabel,
70
+ onAdd,
71
+ }: {
72
+ people: PageHeaderCollaborator[]
73
+ limit: number
74
+ addLabel: string
75
+ onAdd?: () => void
76
+ }) {
77
+ const visible = people.slice(0, limit)
78
+ const overflow = Math.max(0, people.length - visible.length)
79
+ const names = people.map(p => p.name).join(", ")
80
+
81
+ return (
82
+ <div
83
+ role="group"
84
+ aria-label={names ? `People with access: ${names}` : "People with access"}
85
+ className="flex shrink-0 items-center gap-2 sm:gap-2.5"
86
+ >
87
+ {visible.length > 0 && (
88
+ <div className="flex -space-x-2 ps-0.5">
89
+ {visible.map((c, index) => (
90
+ <Tooltip key={c.id}>
91
+ <TooltipTrigger asChild>
92
+ <Avatar
93
+ size="sm"
94
+ shape="circle"
95
+ className="relative ring-2 ring-background"
96
+ style={{ zIndex: 10 + index }}
97
+ >
98
+ {c.imageUrl ? (
99
+ <AvatarImage src={c.imageUrl} alt="" referrerPolicy="no-referrer" />
100
+ ) : null}
101
+ <AvatarFallback className="text-xs font-semibold">
102
+ {(c.initials ?? c.name.slice(0, 2)).toUpperCase()}
103
+ </AvatarFallback>
104
+ </Avatar>
105
+ </TooltipTrigger>
106
+ <TooltipContent side="bottom">{c.name}</TooltipContent>
107
+ </Tooltip>
108
+ ))}
109
+ {overflow > 0 && (
110
+ <div
111
+ className="relative z-30 flex size-6 shrink-0 items-center justify-center rounded-full bg-muted text-xs font-medium tabular-nums text-muted-foreground ring-2 ring-background sm:size-7"
112
+ aria-label={`${overflow} more people with access`}
113
+ >
114
+ +{overflow}
115
+ </div>
116
+ )}
117
+ </div>
118
+ )}
119
+ {onAdd ? (
120
+ <Tip side="bottom" label={addLabel}>
121
+ <Button
122
+ type="button"
123
+ variant="outline"
124
+ size="icon"
125
+ className="size-8 min-h-8 min-w-8 shrink-0 rounded-full border-dashed"
126
+ aria-label={addLabel}
127
+ onClick={onAdd}
128
+ >
129
+ <i className="fa-light fa-user-plus text-sm" aria-hidden="true" />
130
+ </Button>
131
+ </Tip>
132
+ ) : null}
133
+ </div>
134
+ )
135
+ }
136
+
137
+ export function PageHeader({
138
+ title,
139
+ subtitle,
140
+ variant = "default",
141
+ accessInfo,
142
+ collaborators,
143
+ collaboratorDisplayLimit = 4,
144
+ onAddCollaborator,
145
+ addCollaboratorLabel = "Invite people",
146
+ actions,
147
+ className,
148
+ showTitleBlock = true,
149
+ }: PageHeaderProps) {
150
+ const isCollaboration = variant === "collaboration"
151
+ const showAccess = Boolean(isCollaboration && accessInfo)
152
+ const showFaceRail =
153
+ isCollaboration &&
154
+ ((collaborators && collaborators.length > 0) || Boolean(onAddCollaborator))
155
+ const showActionsColumn = Boolean(actions) || showFaceRail
156
+
29
157
  return (
30
158
  <div
31
159
  className={cn(
32
160
  "flex flex-col gap-1 px-4 pt-2 pb-4 lg:px-6",
33
161
  "sm:flex-row sm:items-end sm:gap-4",
34
162
  showTitleBlock ? "sm:justify-between" : "sm:justify-end",
35
- className
163
+ className,
36
164
  )}
37
165
  >
38
166
  {/* Title block — hidden visually when showTitleBlock is false; keep h1 for a11y */}
39
- <div className={cn("flex flex-col gap-0.5", !showTitleBlock && "sr-only")}>
167
+ <div className={cn("flex min-w-0 flex-col gap-0.5", !showTitleBlock && "sr-only")}>
40
168
  <h1
41
169
  className="text-2xl font-semibold tracking-tight leading-tight text-foreground"
42
170
  style={{ fontFamily: "var(--font-heading)" }}
43
171
  >
44
172
  {title}
45
173
  </h1>
174
+ {showAccess && (
175
+ <div className="flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-xs leading-snug text-muted-foreground">
176
+ {accessInfo}
177
+ </div>
178
+ )}
46
179
  {subtitle && (
47
180
  <p className="text-sm text-muted-foreground leading-none">{subtitle}</p>
48
181
  )}
49
182
  </div>
50
183
 
51
- {/* Right-side actions — e.g. date picker, CTA buttons */}
52
- {actions && (
53
- <div className="flex items-center gap-2 shrink-0">{actions}</div>
184
+ {showActionsColumn && (
185
+ <div className="flex flex-wrap items-center gap-2 sm:gap-3 shrink-0 sm:ms-auto sm:justify-end">
186
+ {showFaceRail ? (
187
+ <PageHeaderCollaborationFaces
188
+ people={collaborators ?? []}
189
+ limit={collaboratorDisplayLimit}
190
+ addLabel={addCollaboratorLabel}
191
+ onAdd={onAddCollaborator}
192
+ />
193
+ ) : null}
194
+ {actions}
195
+ </div>
54
196
  )}
55
197
  </div>
56
198
  )
@@ -43,6 +43,7 @@ export function QuestionBankClient() {
43
43
  tablePropertiesRef={tableRef}
44
44
  header={(
45
45
  <QuestionBankPageHeader
46
+ variant="collaboration"
46
47
  questionCount={count}
47
48
  onNewQuestion={() => {}}
48
49
  onExport={() => setExportOpen(true)}