@nexub/mcp 5.2.0 → 5.4.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.
|
@@ -11,15 +11,26 @@ Feature-rich data table with sorting and row selection powered by TanStack Table
|
|
|
11
11
|
| Prop | Type | Default | Description |
|
|
12
12
|
| --- | --- | --- | --- |
|
|
13
13
|
| `columns` (required) | `DataTableColumn<TData>[]` | | TanStack Table column definitions (`DataTableColumn` is exported from @nexub/react). Set `meta: { align: 'end' }` for numeric columns; headers, sort buttons and cells follow it. |
|
|
14
|
-
| `caption` | `ReactNode` | | Names the table for assistive tech (and its scroll region). Shown below the table; add `captionHidden` to keep it screen-reader only. |
|
|
15
14
|
| `data` (required) | `TData[]` | | Array of row data objects to render. |
|
|
16
|
-
| `
|
|
17
|
-
| `
|
|
18
|
-
| `
|
|
19
|
-
| `
|
|
20
|
-
| `onRowSelectionChange` | `
|
|
21
|
-
| `
|
|
22
|
-
| `
|
|
15
|
+
| `caption` | `ReactNode` | | Names the table for assistive tech (and its scroll region). Shown below the table; add `captionHidden` to keep it screen-reader only. |
|
|
16
|
+
| `enableSorting` | `boolean` | `false` | Click a header to sort; Shift+click adds more columns, numbered 1, 2… (5.3). |
|
|
17
|
+
| `enableRowSelection` | `boolean` | `false` | Turns on row selection state. |
|
|
18
|
+
| `selectionColumn` | `boolean` | `false` | With `enableRowSelection` (5.3): a checkbox column, select-page in its header, and "Select all N" across pages. On by default from 6.0. |
|
|
19
|
+
| `rowSelection / onRowSelectionChange` | `Record<string, boolean>` | | Controlled selection keyed by row id (5.3). |
|
|
20
|
+
| `getRowId` | `(row: TData, index: number) => string` | | Stable row ids for selection; defaults to the row index (5.3). |
|
|
21
|
+
| `bulkActions` | `(rows: TData[], clear: () => void) => ReactNode` | | A floating bar while rows are selected, with the count, your actions and a clear button (5.3). |
|
|
22
|
+
| `density / defaultDensity / onDensityChange` | `'comfortable' \| 'compact'` | `'comfortable'` | Row height (5.3). |
|
|
23
|
+
| `columnVisibility / onColumnVisibilityChange` | `Record<string, boolean>` | | Which columns show, keyed by column id (5.3). |
|
|
24
|
+
| `viewOptions` | `boolean` | `false` | A "View" menu above the table for density and column visibility (5.3). |
|
|
25
|
+
| `toolbar` | `ReactNode` | | Content at the start of the row above the table, e.g. filters (5.3). |
|
|
26
|
+
| `enableColumnResizing` | `boolean` | `false` | Drag a header edge to resize (5.4). The handle is focusable: Arrow keys resize by 16px, double-click resets. |
|
|
27
|
+
| `columnSizing / onColumnSizingChange` | `Record<string, number>` | | Column widths in px, keyed by column id (5.4). |
|
|
28
|
+
| `enableColumnReordering` | `boolean` | `false` | Drag headers to reorder, or Alt+Arrow on a focused header; the move is announced (5.4). |
|
|
29
|
+
| `columnOrder / onColumnOrderChange` | `string[]` | | Column ids in display order (5.4). |
|
|
30
|
+
| `columnPinning / onColumnPinningChange` | `{ left?: string[]; right?: string[] }` | | Columns that stay in view while the rest scroll sideways (5.4). The selection column pins with them. |
|
|
31
|
+
| `maxHeight` | `number \| string` | | Caps the height: rows scroll and the header sticks (5.4). |
|
|
32
|
+
| `DataTableVirtual` | `import from '@nexub/react/DataTableVirtual'` | | Same props plus `maxHeight` (required), `estimateRowHeight` and `overscan`: renders only the rows in view, for thousands of rows. Needs `@tanstack/react-virtual` installed (5.4). No pagination. |
|
|
33
|
+
| `pagination.pageSize` | `number` | `20` | Rows per page; pagination is on when `pagination` is set. |
|
|
23
34
|
|
|
24
35
|
## Example: Default
|
|
25
36
|
|
|
@@ -72,3 +83,161 @@ export default function Example() {
|
|
|
72
83
|
);
|
|
73
84
|
}
|
|
74
85
|
```
|
|
86
|
+
|
|
87
|
+
## Example: Selection, bulk actions and view menu
|
|
88
|
+
|
|
89
|
+
Select rows with the checkbox column; the bar at the bottom acts on them. The View menu switches density and hides columns.
|
|
90
|
+
|
|
91
|
+
```tsx
|
|
92
|
+
'use client';
|
|
93
|
+
|
|
94
|
+
import * as React from 'react';
|
|
95
|
+
import { Button, DataTable, type DataTableColumn } from '@nexub/react';
|
|
96
|
+
|
|
97
|
+
interface Invoice {
|
|
98
|
+
id: string;
|
|
99
|
+
customer: string;
|
|
100
|
+
status: string;
|
|
101
|
+
amount: number;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const invoices: Invoice[] = [
|
|
105
|
+
{ id: 'INV-2041', customer: 'Acme', status: 'Overdue', amount: 1200 },
|
|
106
|
+
{ id: 'INV-2042', customer: 'Globex', status: 'Paid', amount: 860 },
|
|
107
|
+
{ id: 'INV-2043', customer: 'Initech', status: 'Draft', amount: 430 },
|
|
108
|
+
{ id: 'INV-2044', customer: 'Umbrella', status: 'Overdue', amount: 2150 },
|
|
109
|
+
{ id: 'INV-2045', customer: 'Hooli', status: 'Paid', amount: 990 },
|
|
110
|
+
];
|
|
111
|
+
|
|
112
|
+
const columns: DataTableColumn<Invoice>[] = [
|
|
113
|
+
{ accessorKey: 'id', header: 'Invoice' },
|
|
114
|
+
{ accessorKey: 'customer', header: 'Customer' },
|
|
115
|
+
{ accessorKey: 'status', header: 'Status' },
|
|
116
|
+
{ accessorKey: 'amount', header: 'Amount', meta: { align: 'end' } },
|
|
117
|
+
];
|
|
118
|
+
|
|
119
|
+
export default function Example() {
|
|
120
|
+
const [selection, setSelection] = React.useState<Record<string, boolean>>({ 'INV-2041': true, 'INV-2044': true });
|
|
121
|
+
return (
|
|
122
|
+
<div className="w-full max-w-[640px]">
|
|
123
|
+
<DataTable
|
|
124
|
+
caption="Invoices"
|
|
125
|
+
captionHidden
|
|
126
|
+
columns={columns}
|
|
127
|
+
data={invoices}
|
|
128
|
+
getRowId={(r) => r.id}
|
|
129
|
+
enableSorting
|
|
130
|
+
enableRowSelection
|
|
131
|
+
selectionColumn
|
|
132
|
+
rowSelection={selection}
|
|
133
|
+
onRowSelectionChange={setSelection}
|
|
134
|
+
viewOptions
|
|
135
|
+
bulkActions={(rows, clear) => (
|
|
136
|
+
<>
|
|
137
|
+
<Button size="sm" variant="outline" onClick={clear}>
|
|
138
|
+
Send reminders ({rows.length})
|
|
139
|
+
</Button>
|
|
140
|
+
<Button size="sm" variant="destructive" onClick={clear}>
|
|
141
|
+
Void
|
|
142
|
+
</Button>
|
|
143
|
+
</>
|
|
144
|
+
)}
|
|
145
|
+
/>
|
|
146
|
+
</div>
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Example: Resize, reorder and pin
|
|
152
|
+
|
|
153
|
+
Drag header edges to resize and headers to reorder (or Alt+Arrow). Invoice stays pinned while the rest scroll; the header sticks within `maxHeight`.
|
|
154
|
+
|
|
155
|
+
```tsx
|
|
156
|
+
'use client';
|
|
157
|
+
|
|
158
|
+
import { DataTable, type DataTableColumn } from '@nexub/react';
|
|
159
|
+
|
|
160
|
+
interface Invoice {
|
|
161
|
+
id: string;
|
|
162
|
+
customer: string;
|
|
163
|
+
region: string;
|
|
164
|
+
owner: string;
|
|
165
|
+
status: string;
|
|
166
|
+
amount: number;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const invoices: Invoice[] = Array.from({ length: 30 }, (_, i) => ({
|
|
170
|
+
id: `INV-${2041 + i}`,
|
|
171
|
+
customer: ['Acme', 'Globex', 'Initech', 'Umbrella', 'Hooli'][i % 5]!,
|
|
172
|
+
region: ['EMEA', 'APAC', 'Americas'][i % 3]!,
|
|
173
|
+
owner: ['Ana', 'Ben', 'Chen', 'Dev'][i % 4]!,
|
|
174
|
+
status: ['Paid', 'Overdue', 'Draft'][i % 3]!,
|
|
175
|
+
amount: 400 + ((i * 137) % 2000),
|
|
176
|
+
}));
|
|
177
|
+
|
|
178
|
+
const columns: DataTableColumn<Invoice>[] = [
|
|
179
|
+
{ accessorKey: 'id', header: 'Invoice', size: 120 },
|
|
180
|
+
{ accessorKey: 'customer', header: 'Customer', size: 160 },
|
|
181
|
+
{ accessorKey: 'region', header: 'Region', size: 140 },
|
|
182
|
+
{ accessorKey: 'owner', header: 'Owner', size: 140 },
|
|
183
|
+
{ accessorKey: 'status', header: 'Status', size: 140 },
|
|
184
|
+
{ accessorKey: 'amount', header: 'Amount', size: 120, meta: { align: 'end' } },
|
|
185
|
+
];
|
|
186
|
+
|
|
187
|
+
export default function Example() {
|
|
188
|
+
return (
|
|
189
|
+
<div className="w-full max-w-[640px]">
|
|
190
|
+
<DataTable
|
|
191
|
+
caption="Invoices"
|
|
192
|
+
captionHidden
|
|
193
|
+
columns={columns}
|
|
194
|
+
data={invoices}
|
|
195
|
+
enableColumnResizing
|
|
196
|
+
enableColumnReordering
|
|
197
|
+
columnPinning={{ left: ['id'] }}
|
|
198
|
+
maxHeight={320}
|
|
199
|
+
/>
|
|
200
|
+
</div>
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## Example: 10,000 rows (DataTableVirtual)
|
|
206
|
+
|
|
207
|
+
`import { DataTableVirtual } from '@nexub/react/DataTableVirtual'` and install `@tanstack/react-virtual`. Only the rows in view are rendered.
|
|
208
|
+
|
|
209
|
+
```tsx
|
|
210
|
+
'use client';
|
|
211
|
+
|
|
212
|
+
import type { DataTableColumn } from '@nexub/react';
|
|
213
|
+
import { DataTableVirtual } from '@nexub/react/DataTableVirtual';
|
|
214
|
+
|
|
215
|
+
interface Event {
|
|
216
|
+
id: number;
|
|
217
|
+
name: string;
|
|
218
|
+
user: string;
|
|
219
|
+
at: string;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
const events: Event[] = Array.from({ length: 10_000 }, (_, i) => ({
|
|
223
|
+
id: i + 1,
|
|
224
|
+
name: ['sign_in', 'export', 'invite', 'upgrade'][i % 4]!,
|
|
225
|
+
user: `user${(i * 7919) % 997}@example.com`,
|
|
226
|
+
at: new Date(Date.UTC(2026, 10, 1) + i * 60_000).toISOString().slice(0, 16).replace('T', ' '),
|
|
227
|
+
}));
|
|
228
|
+
|
|
229
|
+
const columns: DataTableColumn<Event>[] = [
|
|
230
|
+
{ accessorKey: 'id', header: '#', meta: { align: 'end' } },
|
|
231
|
+
{ accessorKey: 'name', header: 'Event' },
|
|
232
|
+
{ accessorKey: 'user', header: 'User' },
|
|
233
|
+
{ accessorKey: 'at', header: 'Time (UTC)' },
|
|
234
|
+
];
|
|
235
|
+
|
|
236
|
+
export default function Example() {
|
|
237
|
+
return (
|
|
238
|
+
<div className="w-full max-w-[640px]">
|
|
239
|
+
<DataTableVirtual caption="Audit log" captionHidden columns={columns} data={events} maxHeight={360} enableSorting />
|
|
240
|
+
</div>
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Component index
|
|
2
2
|
|
|
3
|
-
Nexub DS v5.
|
|
3
|
+
Nexub DS v5.4.0. Open `components/<slug>.md` for props, examples and accessibility notes.
|
|
4
4
|
Never use a component marked deprecated.
|
|
5
5
|
|
|
6
6
|
## Components — Actions
|
|
@@ -225,5 +225,5 @@ Never use a component marked deprecated.
|
|
|
225
225
|
|
|
226
226
|
These exist; read their TypeScript props in `node_modules/<package>/dist/index.d.ts`.
|
|
227
227
|
|
|
228
|
-
- `@nexub/react`: AgentKit, AppShell, AspectRatio, Chart, CheckList, Code, CommandPalette, Container, ContextMenu, CountryBadge, DropdownMenu, FileUpload, Flag, FormError, KeyboardShortcut, Logo, Menubar, Motion, NavigationMenu, NexubProvider, PageHeader, Section, Sidebar, ThemeProvider, Toolbar, TopNav, VisuallyHidden
|
|
228
|
+
- `@nexub/react`: AgentKit, AppShell, AspectRatio, Chart, CheckList, Code, CommandPalette, Container, ContextMenu, CountryBadge, DataTableVirtual, DropdownMenu, FileUpload, Flag, FormError, KeyboardShortcut, Logo, Menubar, Motion, NavigationMenu, NexubProvider, PageHeader, Section, Sidebar, ThemeProvider, Toolbar, TopNav, VisuallyHidden
|
|
229
229
|
- `@nexub/patterns`: ActivityPage, AppHeader, AppLauncher, ChatPage, CheckoutPage, DashboardPage, PageFrame, PaywallPage, SettingsLayout, SettingsPage, SignInPage, TransactionDetailPage
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Tokens
|
|
2
2
|
|
|
3
|
-
Nexub DS v5.
|
|
3
|
+
Nexub DS v5.4.0. Every token is a CSS custom property from `@nexub/tokens/css` (loaded by `@nexub/themes/base`).
|
|
4
4
|
The Tailwind preset (`@nexub/tokens/tailwind`) maps them to utilities. Never hardcode a hex, px spacing or shadow that a token covers.
|
|
5
5
|
|
|
6
6
|
## Color roles
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nexub/mcp",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.4.0",
|
|
4
4
|
"description": "MCP server for Nexub Design System: gives Claude, Cursor and any MCP client the components, patterns, tokens and design rules of the installed release.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|