@nexub/mcp 5.2.0 → 5.3.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,19 @@ 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
|
+
| `pagination.pageSize` | `number` | `20` | Rows per page; pagination is on when `pagination` is set. |
|
|
23
27
|
|
|
24
28
|
## Example: Default
|
|
25
29
|
|
|
@@ -72,3 +76,67 @@ export default function Example() {
|
|
|
72
76
|
);
|
|
73
77
|
}
|
|
74
78
|
```
|
|
79
|
+
|
|
80
|
+
## Example: Selection, bulk actions and view menu
|
|
81
|
+
|
|
82
|
+
Select rows with the checkbox column; the bar at the bottom acts on them. The View menu switches density and hides columns.
|
|
83
|
+
|
|
84
|
+
```tsx
|
|
85
|
+
'use client';
|
|
86
|
+
|
|
87
|
+
import * as React from 'react';
|
|
88
|
+
import { Button, DataTable, type DataTableColumn } from '@nexub/react';
|
|
89
|
+
|
|
90
|
+
interface Invoice {
|
|
91
|
+
id: string;
|
|
92
|
+
customer: string;
|
|
93
|
+
status: string;
|
|
94
|
+
amount: number;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const invoices: Invoice[] = [
|
|
98
|
+
{ id: 'INV-2041', customer: 'Acme', status: 'Overdue', amount: 1200 },
|
|
99
|
+
{ id: 'INV-2042', customer: 'Globex', status: 'Paid', amount: 860 },
|
|
100
|
+
{ id: 'INV-2043', customer: 'Initech', status: 'Draft', amount: 430 },
|
|
101
|
+
{ id: 'INV-2044', customer: 'Umbrella', status: 'Overdue', amount: 2150 },
|
|
102
|
+
{ id: 'INV-2045', customer: 'Hooli', status: 'Paid', amount: 990 },
|
|
103
|
+
];
|
|
104
|
+
|
|
105
|
+
const columns: DataTableColumn<Invoice>[] = [
|
|
106
|
+
{ accessorKey: 'id', header: 'Invoice' },
|
|
107
|
+
{ accessorKey: 'customer', header: 'Customer' },
|
|
108
|
+
{ accessorKey: 'status', header: 'Status' },
|
|
109
|
+
{ accessorKey: 'amount', header: 'Amount', meta: { align: 'end' } },
|
|
110
|
+
];
|
|
111
|
+
|
|
112
|
+
export default function Example() {
|
|
113
|
+
const [selection, setSelection] = React.useState<Record<string, boolean>>({ 'INV-2041': true, 'INV-2044': true });
|
|
114
|
+
return (
|
|
115
|
+
<div className="w-full max-w-[640px]">
|
|
116
|
+
<DataTable
|
|
117
|
+
caption="Invoices"
|
|
118
|
+
captionHidden
|
|
119
|
+
columns={columns}
|
|
120
|
+
data={invoices}
|
|
121
|
+
getRowId={(r) => r.id}
|
|
122
|
+
enableSorting
|
|
123
|
+
enableRowSelection
|
|
124
|
+
selectionColumn
|
|
125
|
+
rowSelection={selection}
|
|
126
|
+
onRowSelectionChange={setSelection}
|
|
127
|
+
viewOptions
|
|
128
|
+
bulkActions={(rows, clear) => (
|
|
129
|
+
<>
|
|
130
|
+
<Button size="sm" variant="outline" onClick={clear}>
|
|
131
|
+
Send reminders ({rows.length})
|
|
132
|
+
</Button>
|
|
133
|
+
<Button size="sm" variant="destructive" onClick={clear}>
|
|
134
|
+
Void
|
|
135
|
+
</Button>
|
|
136
|
+
</>
|
|
137
|
+
)}
|
|
138
|
+
/>
|
|
139
|
+
</div>
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Component index
|
|
2
2
|
|
|
3
|
-
Nexub DS v5.
|
|
3
|
+
Nexub DS v5.3.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
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Tokens
|
|
2
2
|
|
|
3
|
-
Nexub DS v5.
|
|
3
|
+
Nexub DS v5.3.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.3.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",
|