@mistersee/global-table 0.1.8 → 0.1.9

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.
package/README.md CHANGED
@@ -15,15 +15,39 @@ A lightweight, Tailwind-first React data table for product UIs that need sticky
15
15
  - **Sticky columns** — pin any fields left or right while scrolling horizontally
16
16
  - **Hybrid pagination** — controlled or uncontrolled (`limit` / `skip`)
17
17
  - **Column visibility** — toggle which fields are shown
18
- - **Column settings tabs** — switch between Visibility and Pinning with smooth transitions; pin fields using inline radio controls
18
+ - **Column settings tabs** — Visibility, Pinning and Features tabs with smooth transitions; pin fields using inline radio controls
19
+ - **Sorting** — click a header title to sort (client-side, or controlled for server-side)
20
+ - **Row selection** — checkboxes inside the `#` index column, with a select-all (current page) checkbox in the header
21
+ - **Features tab** — users can switch row checkboxes, drag & drop columns and header sorting on/off from the Columns popover
19
22
  - **Column reorder** — optional drag-and-drop header reordering
20
23
  - **Custom actions** — inject any React nodes into the actions column
24
+ - **Row actions menu** — a centered three-line button opens a dropdown of actions with leading icons, separators, labels, shortcuts, danger and disabled states, and keyboard navigation
21
25
  - **Row index** — optional leading `#` column (pagination-aware)
26
+ - **Soft cell borders** — light dividers between every cell and row (`bordered`, on by default)
22
27
  - **Field styling** — map Tailwind classes to fields from outside (e.g. price → green)
23
28
  - **Design slots** — style structure via `classNames` without rewriting markup
24
29
  - **Sensible defaults** — column min-width `120px`, max-width `310px`
25
30
  - **Tailwind CSS only** — no CSS-in-JS runtime for styles
26
31
 
32
+ ### What's new in 0.1.9
33
+
34
+ - **Row actions dropdown** (`rowActions`) — a centered ☰ button per row that opens a menu with icons
35
+ - **Row selection** (`enableRowSelection`, `onSelectionChange`) — checkboxes in the `#` column; selected ids **and** row objects are returned to your code
36
+ - **Features tab** — users can switch row checkboxes, drag & drop columns and sorting on/off
37
+ - **Soft cell borders** (`bordered`, default `true`); right-pinned columns use a border instead of a shadow
38
+ - Drag & drop column reorder now also works without `onColumnOrderChange` (order kept inside the table)
39
+
40
+ ---
41
+
42
+ ## Contents
43
+
44
+ - [Install](#install)
45
+ - [Quick start](#quick-start)
46
+ - [Column definition](#column-definition)
47
+ - [Props](#misterseeglobaltable-props): [Sticky](#sticky-columns) · [Pagination](#pagination-hybrid) · [Column settings](#column-settings-visibility-pinning--features) · [Sorting](#sorting) · [Reorder](#column-reorder-drag--drop) · [Actions](#actions-column) · [Row selection](#row-selection) · [Features tab](#features-tab) · [Borders](#borders) · [Index](#row-index) · [Field classes](#field-colors--classes) · [classNames](#design-slots-classnames)
48
+ - [Recipes](#recipes)
49
+ - [Exports](#exports)
50
+
27
51
  ---
28
52
 
29
53
  ## Install
@@ -106,11 +130,12 @@ export function CustomersTable({ rows }: { rows: Customer[] }) {
106
130
  orders: 'text-blue-500',
107
131
  spent: 'text-green-500 font-medium',
108
132
  }}
109
- renderActions={(row) => (
110
- <button type="button" onClick={() => console.log(row.id)}>
111
- View
112
- </button>
113
- )}
133
+ enableRowSelection
134
+ onSelectionChange={(ids, selectedRows) => console.log(ids, selectedRows)}
135
+ rowActions={[
136
+ { key: 'view', label: 'View', onSelect: (row) => console.log('view', row.id) },
137
+ { key: 'delete', label: 'Delete', variant: 'danger', onSelect: (row) => console.log('delete', row.id) },
138
+ ]}
114
139
  classNames={{
115
140
  root: 'rounded-xl bg-white p-3 shadow-sm',
116
141
  th: 'bg-zinc-100 font-medium text-zinc-700',
@@ -129,10 +154,10 @@ The screenshot above shows a typical configuration:
129
154
  | Area | Behavior |
130
155
  | --- | --- |
131
156
  | Header | Drag handles when reordering is enabled |
132
- | `#` | Optional index column |
157
+ | `#` | Optional index column; row checkboxes when selection is on |
133
158
  | `Orders` / `Spent` | Colored via `fieldClassNames` |
134
- | `Actions` | Sticky right + custom `renderActions` |
135
- | Footer | Column toggle, page size select, pagination |
159
+ | `Actions` | Sticky right + ☰ `rowActions` menu and/or custom `renderActions` |
160
+ | Footer | Columns button (Visibility / Pinning / Features), page size select, pagination |
136
161
 
137
162
  ---
138
163
 
@@ -147,6 +172,8 @@ type ColumnDef<T> = {
147
172
  defaultVisible?: boolean
148
173
  cell?: (row: T, rowIndex: number) => React.ReactNode
149
174
  className?: string
175
+ sortable?: boolean // default true for data columns; false for index / actions
176
+ sortFn?: (a: T, b: T) => number // custom client-side comparison (ascending)
150
177
  }
151
178
  ```
152
179
 
@@ -167,7 +194,7 @@ Use `width: 'auto'` for content-sized columns such as action button groups.
167
194
  | --- | --- | --- | --- |
168
195
  | `columns` | `ColumnDef<T>[]` | — | Column definitions |
169
196
  | `data` | `T[]` | — | Row data for the current view (or full list in uncontrolled pagination) |
170
- | `getRowId` | `(row, index) => string` | row index | Stable row key |
197
+ | `getRowId` | `(row, index) => string` | row index | Stable row key. **Recommended**: also used as the id for row selection |
171
198
  | `defaultVisibleColumns` | `string[]` | all visible | Initial visible column keys |
172
199
  | `loading` | `boolean` | `false` | Shows skeleton rows |
173
200
 
@@ -188,10 +215,11 @@ Use `width: 'auto'` for content-sized columns such as action button groups.
188
215
 
189
216
  `stickyLeft` / `stickyRight` override `column.sticky` as the base configuration.
190
217
 
191
- The **Columns** dropdown has two tabs:
218
+ The **Columns** dropdown has three tabs:
192
219
 
193
220
  - **Visibility**: show or hide columns.
194
221
  - **Pinning**: the right-hand tab shows horizontal **None / Left / Right** radio controls on the right of each field, including the index column when enabled. Choose one option per field; changes apply immediately without a Save button. Multiple fields can be pinned on either side.
222
+ - **Features**: switch row checkboxes, drag & drop and sorting on/off (see [Features tab](#features-tab)).
195
223
 
196
224
  | Pinning option | Behavior |
197
225
  | --- | --- |
@@ -217,9 +245,9 @@ Dropdown choices override the base configuration for the selected field until th
217
245
 
218
246
  **Controlled (API / server):** pass the current page `data`, plus `limit`, `skip`, `total`, and `onPaginationChange`.
219
247
 
220
- ### Column settings (Visibility & Pinning)
248
+ ### Column settings (Visibility, Pinning & Features)
221
249
 
222
- Both tabs are available by default through the **Columns** button; no additional props are required. `columnsLabel` changes the button label, while the tab titles remain **Visibility** and **Pinning**. Setting `showColumnToggle={false}` hides both tabs but keeps programmatic sticky configuration active.
250
+ All tabs are available by default through the **Columns** button; no additional props are required. `columnsLabel` changes the button label, while the tab titles remain **Visibility**, **Pinning** and **Features**. Setting `showColumnToggle={false}` hides the button (and all tabs) but keeps programmatic sticky configuration active. Use `showFeatureToggles={false}` to hide only the Features tab.
223
251
 
224
252
  | Prop | Type | Default | Description |
225
253
  | --- | --- | --- | --- |
@@ -231,6 +259,32 @@ Both tabs are available by default through the **Columns** button; no additional
231
259
  <MisterSeeGlobalTable showColumnToggle={false} {...props} />
232
260
  ```
233
261
 
262
+ ### Sorting
263
+
264
+ | Prop | Type | Default | Description |
265
+ | --- | --- | --- | --- |
266
+ | `enableSorting` | `boolean` | `true` if `onSortChange` or `sortState` is set | Allow clicking header titles to sort |
267
+ | `defaultSort` | `{ key, direction } \| null` | `null` | Initial sort (uncontrolled) |
268
+ | `sortState` | `{ key, direction } \| null` | — | Controlled sort |
269
+ | `onSortChange` | `(sort \| null) => void` | — | Called on every header click |
270
+
271
+ Clicking a header cycles **ascending → descending → off**. In uncontrolled pagination the table sorts `data` itself (numbers, booleans, dates and strings with natural order, e.g. `item2` before `item10`); when the sort is also uncontrolled it jumps back to page 1. Use `column.sortFn` for custom ordering and `column.sortable: false` to lock a column.
272
+
273
+ With controlled (server) pagination the table does **not** reorder `data`; read the sort from `onSortChange` and fetch sorted rows:
274
+
275
+ ```tsx
276
+ const [sort, setSort] = useState<SortState | null>(null)
277
+
278
+ <MisterSeeGlobalTable
279
+ sortState={sort}
280
+ onSortChange={(next) => {
281
+ setSort(next)
282
+ refetch({ sortBy: next?.key, order: next?.direction })
283
+ }}
284
+ {...serverPagingProps}
285
+ />
286
+ ```
287
+
234
288
  ### Column reorder (drag & drop)
235
289
 
236
290
  | Prop | Type | Default | Description |
@@ -239,6 +293,8 @@ Both tabs are available by default through the **Columns** button; no additional
239
293
  | `onColumnOrderChange` | `(next) => void` | — | Called after a successful drop |
240
294
  | `enableColumnReorder` | `boolean` | `true` if `onColumnOrderChange` is set | Force enable/disable |
241
295
 
296
+ Without `columnOrder`, the table keeps the new order itself (until unmount), so reordering also works when it is switched on from the Features tab. Pass `columnOrder` + `onColumnOrderChange` to save the order (e.g. to `localStorage` or a user profile).
297
+
242
298
  ```tsx
243
299
  const [columnOrder, setColumnOrder] = useState(columns.map((c) => c.key))
244
300
 
@@ -261,6 +317,8 @@ To disable reordering entirely:
261
317
  | Prop | Type | Default | Description |
262
318
  | --- | --- | --- | --- |
263
319
  | `renderActions` | `(row, rowIndex) => ReactNode` | — | Custom action UI per row |
320
+ | `rowActions` | `RowActionEntry[] \| (row, rowIndex) => RowActionEntry[]` | — | Dropdown menu opened from a three-line button |
321
+ | `rowActionsLabel` | `string` | `"Open row actions"` | Accessible label of the menu button |
264
322
  | `actionsKey` | `string` | `"actions"` | Target column key |
265
323
  | `actionsHeader` | `ReactNode` | `"Actions"` | Header if column is auto-created |
266
324
 
@@ -277,6 +335,169 @@ To disable reordering entirely:
277
335
  />
278
336
  ```
279
337
 
338
+ #### Row actions dropdown
339
+
340
+ Pass `rowActions` to get a three-line (☰) button, centered in the actions column. Clicking it opens a dropdown rendered in a portal, so the table's scroll container never clips it, and it opens upward when there is no room below.
341
+
342
+ ```tsx
343
+ import type { RowActionEntry } from '@mistersee/global-table'
344
+
345
+ const rowActions = (row: Customer): RowActionEntry<Customer>[] => [
346
+ { type: 'label', key: 'manage', label: 'Manage' },
347
+ { key: 'view', label: 'View details', icon: <EyeIcon />, onSelect: (r) => open(r.id) },
348
+ { key: 'edit', label: 'Edit', icon: <PencilIcon />, shortcut: '⌘E', onSelect: edit },
349
+ { key: 'orders', label: 'View orders', icon: <BagIcon />, disabled: (r) => r.orders === 0, onSelect: showOrders },
350
+ { type: 'separator', key: 'sep' },
351
+ { key: 'delete', label: 'Delete', icon: <TrashIcon />, variant: 'danger', onSelect: remove },
352
+ ]
353
+
354
+ <MisterSeeGlobalTable rowActions={rowActions} stickyRight={['actions']} {...props} />
355
+ ```
356
+
357
+ | Item field | Type | Description |
358
+ | --- | --- | --- |
359
+ | `key` | `string` | Unique key |
360
+ | `label` | `ReactNode` | Item text |
361
+ | `icon` | `ReactNode` | Leading icon (sized to 16px) |
362
+ | `shortcut` | `ReactNode` | Trailing hint, e.g. `⌘E` |
363
+ | `variant` | `'default' \| 'danger'` | `danger` renders red |
364
+ | `disabled` / `hidden` | `boolean \| (row, rowIndex) => boolean` | Per-row state |
365
+ | `onSelect` | `(row, rowIndex) => void` | Called on click / Enter |
366
+
367
+ Use `{ type: 'separator', key }` for a divider and `{ type: 'label', key, label }` for a section heading. Hidden items are removed and leftover separators are cleaned up automatically. If every item is hidden for a row, no button is shown for that row.
368
+
369
+ - **Icons**: pass any React node (inline SVG, `lucide-react`, Heroicons…). The library does not bundle an icon set.
370
+ - **Keyboard**: `Enter` / `↓` on the ☰ button opens the menu; `↓`/`↑`, `Home`/`End` move; `Enter` selects; `Esc` closes and returns focus to the button.
371
+ - **Per-row items**: pass a function `(row, rowIndex) => entries` to change labels or items per row (e.g. *Activate* vs *Deactivate*).
372
+ - **With `renderActions`**: your nodes render first, then the ☰ button.
373
+ - **Styling**: `classNames.actionsTrigger` and `classNames.actionsMenu`.
374
+
375
+ The menu is also exported as `RowActionsMenu` to use in your own cells:
376
+
377
+ ```tsx
378
+ import { RowActionsMenu } from '@mistersee/global-table'
379
+
380
+ {
381
+ key: 'more',
382
+ header: '',
383
+ width: 'auto',
384
+ cell: (row, rowIndex) => (
385
+ <RowActionsMenu row={row} rowIndex={rowIndex} actions={rowActions(row)} align="end" />
386
+ ),
387
+ }
388
+ ```
389
+
390
+ ### Row selection
391
+
392
+ Checkboxes are rendered inside the leading index (`#`) column. The header checkbox selects or clears every row on the current page, and shows a dash when only some rows are selected. Selection works without `showIndex`: the column then holds only the checkboxes.
393
+
394
+ | Prop | Type | Default | Description |
395
+ | --- | --- | --- | --- |
396
+ | `enableRowSelection` | `boolean` | `false` | Show row checkboxes |
397
+ | `selectedRowIds` | `string[]` | — | Controlled selection (ids from `getRowId`) |
398
+ | `defaultSelectedRowIds` | `string[]` | — | Uncontrolled initial selection |
399
+ | `onSelectionChange` | `(ids, rows) => void` | — | Selected ids and matching rows |
400
+
401
+ #### Getting the selected values
402
+
403
+ Every time a checkbox changes, `onSelectionChange(ids, rows)` returns the selection to your code:
404
+
405
+ - `ids` — `string[]` of selected row ids (from `getRowId`)
406
+ - `rows` — `T[]` the full row objects for those ids
407
+
408
+ ```tsx
409
+ const [selectedRows, setSelectedRows] = useState<Customer[]>([])
410
+
411
+ <MisterSeeGlobalTable
412
+ columns={columns}
413
+ data={customers}
414
+ getRowId={(row) => row.id}
415
+ showIndex
416
+ enableRowSelection
417
+ onSelectionChange={(ids, rows) => {
418
+ console.log(ids) // ['cus_a1f2', 'cus_b3e8']
419
+ setSelectedRows(rows) // use for delete, export, API calls…
420
+ }}
421
+ />
422
+
423
+ <button
424
+ disabled={selectedRows.length === 0}
425
+ onClick={() => api.deleteMany(selectedRows.map((r) => r.id))}
426
+ >
427
+ Delete {selectedRows.length} selected
428
+ </button>
429
+ ```
430
+
431
+ #### Controlled selection
432
+
433
+ Own the selection when you need to change it from outside the table (clear after an action, pre-select rows, sync with the URL):
434
+
435
+ ```tsx
436
+ const [ids, setIds] = useState<string[]>([])
437
+
438
+ <MisterSeeGlobalTable
439
+ selectedRowIds={ids}
440
+ onSelectionChange={(nextIds) => setIds(nextIds)}
441
+ {...props}
442
+ />
443
+
444
+ <button onClick={() => setIds([])}>Clear selection</button>
445
+ ```
446
+
447
+ #### Good to know
448
+
449
+ - **Always pass `getRowId`.** Without it the id is the row position, so sorting or new data can move the selection to other rows.
450
+ - **Selection is kept across pages.** Rows picked on page 1 stay selected while you browse page 2.
451
+ - **Server pagination:** `data` only holds the current page, so `rows` contains the selected rows from that page only, while `ids` contains every selected id. Use `ids` as the source of truth.
452
+ - **Header checkbox** selects/clears the current page only.
453
+ - Turning **Row checkboxes** off in the Features tab hides the checkboxes but keeps the selection.
454
+ - With `showIndex`, the index column grows by 28px to fit the checkbox (`indexWidth + 28`); without it, the column is 48px.
455
+ - Selected rows get a light `bg-zinc-50` background (including pinned cells).
456
+
457
+ ### Features tab
458
+
459
+ The Columns popover has a third tab, **Features**, with switches for **Row checkboxes**, **Drag & drop columns** and **Sort by header**. Each switch starts from the matching prop (`enableRowSelection`, `enableColumnReorder`, `enableSorting`) and the user can change it at runtime. Drag & drop works even without `onColumnOrderChange`: the order is then kept inside the table.
460
+
461
+ | Prop | Type | Default | Description |
462
+ | --- | --- | --- | --- |
463
+ | `showFeatureToggles` | `boolean` | `true` | Show the Features tab |
464
+ | `onFeaturesChange` | `(features: { rowSelection, columnReorder, sorting }) => void` | — | Called when a switch changes |
465
+
466
+ | Switch | Starts from | Effect when off |
467
+ | --- | --- | --- |
468
+ | Row checkboxes | `enableRowSelection` | Checkboxes hidden (selection kept) |
469
+ | Drag & drop columns | `enableColumnReorder` / `onColumnOrderChange` | Headers can't be dragged |
470
+ | Sort by header | `enableSorting` / `onSortChange` / `sortState` | Header clicks don't sort; data shown unsorted |
471
+
472
+ Switch choices last until the table unmounts. To remember them, save `onFeaturesChange` output and pass it back through the props next time:
473
+
474
+ ```tsx
475
+ const [features, setFeatures] = useState(() =>
476
+ JSON.parse(localStorage.getItem('table-features') ?? 'null') ?? {
477
+ rowSelection: false,
478
+ columnReorder: true,
479
+ sorting: true,
480
+ },
481
+ )
482
+
483
+ <MisterSeeGlobalTable
484
+ enableRowSelection={features.rowSelection}
485
+ enableColumnReorder={features.columnReorder}
486
+ enableSorting={features.sorting}
487
+ onFeaturesChange={(next) => {
488
+ setFeatures(next)
489
+ localStorage.setItem('table-features', JSON.stringify(next))
490
+ }}
491
+ {...props}
492
+ />
493
+ ```
494
+
495
+ ### Borders
496
+
497
+ | Prop | Type | Default | Description |
498
+ | --- | --- | --- | --- |
499
+ | `bordered` | `boolean` | `true` | Soft vertical dividers between cells; right-pinned columns get a plain border instead of a shadow. `false` keeps row lines only (and the shadow) |
500
+
280
501
  ### Row index
281
502
 
282
503
  | Prop | Type | Default | Description |
@@ -322,6 +543,8 @@ To disable reordering entirely:
322
543
  | `skeleton` | Loading rows |
323
544
  | `columnToggle` | Columns button |
324
545
  | `pagination` | Footer controls |
546
+ | `actionsTrigger` | Row actions ☰ button |
547
+ | `actionsMenu` | Row actions dropdown panel |
325
548
 
326
549
  ```tsx
327
550
  <MisterSeeGlobalTable
@@ -338,13 +561,81 @@ Sticky headers/cells respect `classNames.th` / `classNames.td` (including custom
338
561
 
339
562
  ---
340
563
 
564
+ ## Recipes
565
+
566
+ ### Bulk actions toolbar
567
+
568
+ ```tsx
569
+ function CustomersPage({ customers }: { customers: Customer[] }) {
570
+ const [ids, setIds] = useState<string[]>([])
571
+ const [rows, setRows] = useState<Customer[]>([])
572
+
573
+ return (
574
+ <>
575
+ {ids.length > 0 && (
576
+ <div className="flex items-center gap-2">
577
+ <span>{ids.length} selected</span>
578
+ <button onClick={() => exportCsv(rows)}>Export</button>
579
+ <button onClick={async () => { await api.archive(ids); setIds([]) }}>Archive</button>
580
+ </div>
581
+ )}
582
+
583
+ <MisterSeeGlobalTable
584
+ columns={columns}
585
+ data={customers}
586
+ getRowId={(row) => row.id}
587
+ showIndex
588
+ enableRowSelection
589
+ selectedRowIds={ids}
590
+ onSelectionChange={(nextIds, nextRows) => {
591
+ setIds(nextIds)
592
+ setRows(nextRows)
593
+ }}
594
+ rowActions={(row) => [
595
+ { key: 'edit', label: 'Edit', icon: <PencilIcon />, onSelect: () => openEditor(row.id) },
596
+ { type: 'separator', key: 'sep' },
597
+ { key: 'delete', label: 'Delete', icon: <TrashIcon />, variant: 'danger', onSelect: () => remove(row.id) },
598
+ ]}
599
+ stickyRight={['actions']}
600
+ />
601
+ </>
602
+ )
603
+ }
604
+ ```
605
+
606
+ ### Server-side table
607
+
608
+ ```tsx
609
+ const [paging, setPaging] = useState({ limit: 20, skip: 0 })
610
+ const [sort, setSort] = useState<SortState | null>(null)
611
+ const { data, total, isLoading } = useCustomers({ ...paging, sort })
612
+
613
+ <MisterSeeGlobalTable
614
+ columns={columns}
615
+ data={data}
616
+ total={total}
617
+ loading={isLoading}
618
+ getRowId={(row) => row.id}
619
+ limit={paging.limit}
620
+ skip={paging.skip}
621
+ onPaginationChange={setPaging}
622
+ sortState={sort}
623
+ onSortChange={(next) => {
624
+ setSort(next)
625
+ setPaging((p) => ({ ...p, skip: 0 }))
626
+ }}
627
+ />
628
+ ```
629
+
630
+ ---
631
+
341
632
  ## Loading state
342
633
 
343
634
  ```tsx
344
635
  <MisterSeeGlobalTable columns={columns} data={rows} loading />
345
636
  ```
346
637
 
347
- When `loading` is `true`, skeleton rows are rendered to match the current page size and visible column count.
638
+ When `loading` is `true`, skeleton rows are rendered to match the current page size and visible column count. The select-all checkbox is disabled while loading.
348
639
 
349
640
  ---
350
641
 
@@ -356,13 +647,25 @@ import {
356
647
  INDEX_COLUMN_KEY,
357
648
  DEFAULT_COL_MIN_WIDTH, // 120
358
649
  DEFAULT_COL_MAX_WIDTH, // 310
650
+ RowActionsMenu, // the ☰ dropdown, usable in your own cells
651
+ MenuIcon, // the three-line icon
359
652
  } from '@mistersee/global-table'
360
653
 
361
654
  import type {
362
655
  ColumnDef,
656
+ ColumnTogglePosition,
363
657
  MisterSeeGlobalTableProps,
364
658
  MisterSeeGlobalTableClassNames,
365
- StickySide,
659
+ RowActionEntry, // item | separator | label
660
+ RowActionItem,
661
+ RowActionLabel,
662
+ RowActionSeparator,
663
+ RowActionsMenuProps,
664
+ SortDirection, // 'asc' | 'desc'
665
+ SortState, // { key, direction }
666
+ StickySide, // 'left' | 'right'
667
+ TableFeature, // 'rowSelection' | 'columnReorder' | 'sorting'
668
+ TableFeatureState, // Record<TableFeature, boolean>
366
669
  } from '@mistersee/global-table'
367
670
  ```
368
671
 
@@ -382,7 +685,7 @@ bun run build:demo # demo production build
382
685
  ## Design principles
383
686
 
384
687
  - **Composable, not opinionated** — bring your own buttons, badges, and Tailwind tokens
385
- - **Opt-in complexity** — drag-and-drop, index, and column toggle can be turned off
688
+ - **Opt-in complexity** — drag-and-drop, sorting, selection, index, and column toggle can be turned off (by you via props, or by users via the Features tab)
386
689
  - **Predictable layout** — default column bounds keep dense tables readable
387
690
  - **Peer-first styling** — consumers own Tailwind; the library stays thin
388
691
 
@@ -0,0 +1,17 @@
1
+ /** Purely visual checkbox square (checked / indeterminate / empty). */
2
+ export declare function CheckboxBox({ checked, indeterminate, disabled, className, }: {
3
+ checked: boolean;
4
+ indeterminate?: boolean;
5
+ disabled?: boolean;
6
+ className?: string;
7
+ }): import("react").JSX.Element;
8
+ /** Accessible checkbox: native input (visually hidden) + styled box. */
9
+ export declare function Checkbox({ checked, indeterminate, disabled, onChange, label, className, }: {
10
+ checked: boolean;
11
+ indeterminate?: boolean;
12
+ disabled?: boolean;
13
+ onChange: (checked: boolean) => void;
14
+ /** Accessible name (not rendered). */
15
+ label: string;
16
+ className?: string;
17
+ }): import("react").JSX.Element;
@@ -1,9 +1,15 @@
1
- import type { StickySide } from './types';
1
+ import type { StickySide, TableFeature } from './types';
2
2
  export interface ColumnToggleItem {
3
3
  key: string;
4
4
  label: React.ReactNode;
5
5
  }
6
- export declare function ColumnToggle({ columns, visibleKeys, stickyColumns, onStickyChange, onChange, className, label, }: {
6
+ export interface FeatureToggleItem {
7
+ key: TableFeature;
8
+ label: React.ReactNode;
9
+ description?: React.ReactNode;
10
+ enabled: boolean;
11
+ }
12
+ export declare function ColumnToggle({ columns, visibleKeys, stickyColumns, onStickyChange, onChange, features, onFeatureChange, className, label, }: {
7
13
  columns: ColumnToggleItem[];
8
14
  stickyColumns: (ColumnToggleItem & {
9
15
  sticky?: StickySide;
@@ -11,6 +17,9 @@ export declare function ColumnToggle({ columns, visibleKeys, stickyColumns, onSt
11
17
  onStickyChange: (key: string, side: StickySide | null) => void;
12
18
  visibleKeys: Set<string>;
13
19
  onChange: (next: Set<string>) => void;
20
+ /** Table feature switches shown in the third tab (hidden when empty). */
21
+ features?: FeatureToggleItem[];
22
+ onFeatureChange?: (key: TableFeature, enabled: boolean) => void;
14
23
  className?: string;
15
24
  label?: React.ReactNode;
16
25
  }): import("react").JSX.Element;
@@ -0,0 +1,16 @@
1
+ import { type ReactNode } from 'react';
2
+ import type { RowActionEntry } from './types';
3
+ export interface RowActionsMenuProps<T> {
4
+ row: T;
5
+ rowIndex: number;
6
+ actions: RowActionEntry<T>[];
7
+ /** Accessible label for the trigger button. Default: `"Open row actions"` */
8
+ label?: string;
9
+ /** Custom trigger content. Default: three-line menu icon. */
10
+ triggerIcon?: ReactNode;
11
+ /** Menu alignment relative to the trigger. Default: `"end"` */
12
+ align?: 'start' | 'end';
13
+ triggerClassName?: string;
14
+ menuClassName?: string;
15
+ }
16
+ export declare function RowActionsMenu<T>({ row, rowIndex, actions, label, triggerIcon, align, triggerClassName, menuClassName, }: RowActionsMenuProps<T>): import("react").JSX.Element | null;
@@ -2,4 +2,4 @@ import type { MisterSeeGlobalTableProps } from './types';
2
2
  export declare const INDEX_COLUMN_KEY = "__see_table_index__";
3
3
  export declare const DEFAULT_COL_MIN_WIDTH = 120;
4
4
  export declare const DEFAULT_COL_MAX_WIDTH = 310;
5
- export declare function MisterSeeGlobalTable<T extends Record<string, unknown>>({ columns, data, getRowId, defaultVisibleColumns, limit: limitProp, skip: skipProp, total: totalProp, onPaginationChange, limitOptions, loading, stickyLeft, stickyRight, renderActions, actionsKey, actionsHeader, columnOrder, onColumnOrderChange, enableColumnReorder, enableSorting, sortState: sortStateProp, defaultSort, onSortChange, showColumnToggle, columnTogglePosition, columnsLabel, showIndex, indexHeader, indexWidth, renderIndex, fieldClassNames, classNames, }: MisterSeeGlobalTableProps<T>): import("react").JSX.Element;
5
+ export declare function MisterSeeGlobalTable<T extends Record<string, unknown>>({ columns, data, getRowId, defaultVisibleColumns, limit: limitProp, skip: skipProp, total: totalProp, onPaginationChange, limitOptions, loading, stickyLeft, stickyRight, renderActions: renderActionsProp, rowActions, rowActionsLabel, actionsKey, actionsHeader, columnOrder, onColumnOrderChange, enableColumnReorder, enableSorting, sortState: sortStateProp, defaultSort, onSortChange, showColumnToggle, columnTogglePosition, columnsLabel, bordered, enableRowSelection, selectedRowIds, defaultSelectedRowIds, onSelectionChange, showFeatureToggles, onFeaturesChange, showIndex, indexHeader, indexWidth, renderIndex, fieldClassNames, classNames, }: MisterSeeGlobalTableProps<T>): import("react").JSX.Element;
@@ -1,5 +1,6 @@
1
- export declare function SkeletonRows({ rowCount, columnCount, className, }: {
1
+ export declare function SkeletonRows({ rowCount, columnCount, className, bordered, }: {
2
2
  rowCount: number;
3
3
  columnCount: number;
4
4
  className?: string;
5
+ bordered?: boolean;
5
6
  }): import("react").JSX.Element;