bolt-table 0.1.0 → 0.1.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.
- package/README.md +8 -8
- package/dist/index.d.mts +54 -5
- package/dist/index.d.ts +54 -5
- package/dist/index.js +824 -293
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +825 -310
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# bolt-table
|
|
2
2
|
|
|
3
3
|
A high-performance, fully-featured React table component built on [TanStack Virtual](https://tanstack.com/virtual) and [@dnd-kit](https://dndkit.com). Only the rows visible in the viewport are ever in the DOM — making it fast for datasets of any size.
|
|
4
4
|
|
|
5
|
-
[](https://www.npmjs.com/package/bolt-table)
|
|
6
|
+
[](./LICENSE)
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
@@ -31,7 +31,7 @@ A high-performance, fully-featured React table component built on [TanStack Virt
|
|
|
31
31
|
## Installation
|
|
32
32
|
|
|
33
33
|
```bash
|
|
34
|
-
npm install
|
|
34
|
+
npm install bolt-table
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
### Peer dependencies
|
|
@@ -47,7 +47,7 @@ npm install @tanstack/react-virtual @dnd-kit/core @dnd-kit/sortable lucide-react
|
|
|
47
47
|
## Quick start
|
|
48
48
|
|
|
49
49
|
```tsx
|
|
50
|
-
import { BoltTable, ColumnType } from '
|
|
50
|
+
import { BoltTable, ColumnType } from 'bolt-table';
|
|
51
51
|
|
|
52
52
|
interface User {
|
|
53
53
|
id: string;
|
|
@@ -87,7 +87,7 @@ BoltTable uses browser APIs and must be wrapped in a client boundary. Remove the
|
|
|
87
87
|
|
|
88
88
|
```tsx
|
|
89
89
|
'use client';
|
|
90
|
-
import { BoltTable } from '
|
|
90
|
+
import { BoltTable } from 'bolt-table';
|
|
91
91
|
```
|
|
92
92
|
|
|
93
93
|
---
|
|
@@ -491,11 +491,11 @@ import type {
|
|
|
491
491
|
PaginationType,
|
|
492
492
|
SortDirection,
|
|
493
493
|
DataRecord,
|
|
494
|
-
} from '
|
|
494
|
+
} from 'bolt-table';
|
|
495
495
|
```
|
|
496
496
|
|
|
497
497
|
---
|
|
498
498
|
|
|
499
499
|
## License
|
|
500
500
|
|
|
501
|
-
MIT © [Venkatesh Sirigineedi](https://github.com
|
|
501
|
+
MIT © [Venkatesh Sirigineedi](https://github.com
|
package/dist/index.d.mts
CHANGED
|
@@ -2,6 +2,35 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import React$1, { ReactNode, CSSProperties } from 'react';
|
|
3
3
|
import { Virtualizer } from '@tanstack/react-virtual';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Customizable icon overrides for BoltTable.
|
|
7
|
+
* Pass any of these to the `icons` prop on BoltTable to replace the default SVG icons.
|
|
8
|
+
* Each icon should be a pre-sized React node (e.g. an SVG at 12×12px).
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* <BoltTable
|
|
12
|
+
* icons={{
|
|
13
|
+
* gripVertical: <MyGripIcon size={12} />,
|
|
14
|
+
* sortAsc: <MySortUpIcon size={12} />,
|
|
15
|
+
* }}
|
|
16
|
+
* />
|
|
17
|
+
*/
|
|
18
|
+
interface BoltTableIcons {
|
|
19
|
+
gripVertical?: React$1.ReactNode;
|
|
20
|
+
sortAsc?: React$1.ReactNode;
|
|
21
|
+
sortDesc?: React$1.ReactNode;
|
|
22
|
+
filter?: React$1.ReactNode;
|
|
23
|
+
filterClear?: React$1.ReactNode;
|
|
24
|
+
pin?: React$1.ReactNode;
|
|
25
|
+
pinOff?: React$1.ReactNode;
|
|
26
|
+
eyeOff?: React$1.ReactNode;
|
|
27
|
+
chevronDown?: React$1.ReactNode;
|
|
28
|
+
chevronLeft?: React$1.ReactNode;
|
|
29
|
+
chevronRight?: React$1.ReactNode;
|
|
30
|
+
chevronsLeft?: React$1.ReactNode;
|
|
31
|
+
chevronsRight?: React$1.ReactNode;
|
|
32
|
+
}
|
|
33
|
+
|
|
5
34
|
/**
|
|
6
35
|
* The direction of a column sort.
|
|
7
36
|
*
|
|
@@ -709,13 +738,28 @@ interface BoltTableProps<T extends DataRecord = DataRecord> {
|
|
|
709
738
|
readonly styles?: StylesTypes;
|
|
710
739
|
/**
|
|
711
740
|
* A custom React node to use as the drag grip icon in column headers.
|
|
712
|
-
* When omitted, the default
|
|
741
|
+
* When omitted, the default GripVertical SVG icon is used.
|
|
713
742
|
* Ignored when `hideGripIcon` is `true`.
|
|
714
743
|
*
|
|
744
|
+
* @deprecated Use `icons.gripVertical` instead. This prop is kept for backward compatibility.
|
|
745
|
+
*
|
|
715
746
|
* @example
|
|
716
|
-
* gripIcon={<DragHandleIcon
|
|
747
|
+
* gripIcon={<DragHandleIcon style={{ width: 12, height: 12 }} />}
|
|
717
748
|
*/
|
|
718
749
|
readonly gripIcon?: React$1.ReactNode;
|
|
750
|
+
/**
|
|
751
|
+
* Custom icon overrides for the table's built-in icons.
|
|
752
|
+
* Pass any subset of icons to replace the defaults. Unspecified icons use
|
|
753
|
+
* the built-in SVG icons. Each icon should be a pre-sized React node.
|
|
754
|
+
*
|
|
755
|
+
* @example
|
|
756
|
+
* icons={{
|
|
757
|
+
* gripVertical: <MyGripIcon size={12} />,
|
|
758
|
+
* sortAsc: <MySortUpIcon size={12} />,
|
|
759
|
+
* chevronsLeft: <MyFirstPageIcon size={12} />,
|
|
760
|
+
* }}
|
|
761
|
+
*/
|
|
762
|
+
readonly icons?: BoltTableIcons;
|
|
719
763
|
/**
|
|
720
764
|
* When `true`, the drag grip icon is hidden from all column headers.
|
|
721
765
|
* Columns can still be dragged even without the grip icon.
|
|
@@ -1166,7 +1210,7 @@ interface StylesTypes {
|
|
|
1166
1210
|
* autoHeight={false}
|
|
1167
1211
|
* />
|
|
1168
1212
|
*/
|
|
1169
|
-
declare function BoltTable<T extends DataRecord = DataRecord>({ columns: initialColumns, data, rowHeight, expandedRowHeight, maxExpandedRowHeight, accentColor, className, classNames, styles, gripIcon, hideGripIcon, pagination, onPaginationChange, onColumnResize, onColumnOrderChange, onColumnPin, onColumnHide, rowSelection, expandable, rowKey, onEndReached, onEndReachedThreshold, isLoading, onSortChange, onFilterChange, columnContextMenuItems, autoHeight, layoutLoading, emptyRenderer, }: BoltTableProps<T>): react_jsx_runtime.JSX.Element;
|
|
1213
|
+
declare function BoltTable<T extends DataRecord = DataRecord>({ columns: initialColumns, data, rowHeight, expandedRowHeight, maxExpandedRowHeight, accentColor, className, classNames, styles, gripIcon, hideGripIcon, icons, pagination, onPaginationChange, onColumnResize, onColumnOrderChange, onColumnPin, onColumnHide, rowSelection, expandable, rowKey, onEndReached, onEndReachedThreshold, isLoading, onSortChange, onFilterChange, columnContextMenuItems, autoHeight, layoutLoading, emptyRenderer, }: BoltTableProps<T>): react_jsx_runtime.JSX.Element;
|
|
1170
1214
|
|
|
1171
1215
|
/**
|
|
1172
1216
|
* Props for the DraggableHeader component.
|
|
@@ -1307,6 +1351,11 @@ interface DraggableHeaderProps {
|
|
|
1307
1351
|
* ]}
|
|
1308
1352
|
*/
|
|
1309
1353
|
customContextMenuItems?: ColumnContextMenuItem[];
|
|
1354
|
+
/**
|
|
1355
|
+
* Custom icon overrides from BoltTable's `icons` prop.
|
|
1356
|
+
* Passed through automatically — do not set manually.
|
|
1357
|
+
*/
|
|
1358
|
+
icons?: BoltTableIcons;
|
|
1310
1359
|
}
|
|
1311
1360
|
/**
|
|
1312
1361
|
* DraggableHeader — a single column header cell for BoltTable.
|
|
@@ -1326,7 +1375,7 @@ interface DraggableHeaderProps {
|
|
|
1326
1375
|
*
|
|
1327
1376
|
* @internal This is an internal BoltTable component. Use BoltTable directly.
|
|
1328
1377
|
*/
|
|
1329
|
-
declare const DraggableHeader: React$1.MemoExoticComponent<({ column, visualIndex, accentColor, onResizeStart, styles, classNames, hideGripIcon, gripIcon, stickyOffset, onTogglePin, onToggleHide, isLastColumn, sortDirection, onSort, filterValue, onFilter, onClearFilter, customContextMenuItems, }: DraggableHeaderProps) => react_jsx_runtime.JSX.Element>;
|
|
1378
|
+
declare const DraggableHeader: React$1.MemoExoticComponent<({ column, visualIndex, accentColor, onResizeStart, styles, classNames, hideGripIcon, gripIcon, stickyOffset, onTogglePin, onToggleHide, isLastColumn, sortDirection, onSort, filterValue, onFilter, onClearFilter, customContextMenuItems, icons, }: DraggableHeaderProps) => react_jsx_runtime.JSX.Element>;
|
|
1330
1379
|
|
|
1331
1380
|
/**
|
|
1332
1381
|
* The imperative handle exposed by ResizeOverlay via `ref`.
|
|
@@ -1539,4 +1588,4 @@ interface TableBodyProps {
|
|
|
1539
1588
|
*/
|
|
1540
1589
|
declare const TableBody: React$1.FC<TableBodyProps>;
|
|
1541
1590
|
|
|
1542
|
-
export { BoltTable, type ColumnContextMenuItem, type ColumnType, type DataRecord, DraggableHeader, type ExpandableConfig, type PaginationType, ResizeOverlay, type RowSelectionConfig, type SortDirection, TableBody };
|
|
1591
|
+
export { BoltTable, type BoltTableIcons, type ColumnContextMenuItem, type ColumnType, type DataRecord, DraggableHeader, type ExpandableConfig, type PaginationType, ResizeOverlay, type RowSelectionConfig, type SortDirection, TableBody };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,35 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import React$1, { ReactNode, CSSProperties } from 'react';
|
|
3
3
|
import { Virtualizer } from '@tanstack/react-virtual';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Customizable icon overrides for BoltTable.
|
|
7
|
+
* Pass any of these to the `icons` prop on BoltTable to replace the default SVG icons.
|
|
8
|
+
* Each icon should be a pre-sized React node (e.g. an SVG at 12×12px).
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* <BoltTable
|
|
12
|
+
* icons={{
|
|
13
|
+
* gripVertical: <MyGripIcon size={12} />,
|
|
14
|
+
* sortAsc: <MySortUpIcon size={12} />,
|
|
15
|
+
* }}
|
|
16
|
+
* />
|
|
17
|
+
*/
|
|
18
|
+
interface BoltTableIcons {
|
|
19
|
+
gripVertical?: React$1.ReactNode;
|
|
20
|
+
sortAsc?: React$1.ReactNode;
|
|
21
|
+
sortDesc?: React$1.ReactNode;
|
|
22
|
+
filter?: React$1.ReactNode;
|
|
23
|
+
filterClear?: React$1.ReactNode;
|
|
24
|
+
pin?: React$1.ReactNode;
|
|
25
|
+
pinOff?: React$1.ReactNode;
|
|
26
|
+
eyeOff?: React$1.ReactNode;
|
|
27
|
+
chevronDown?: React$1.ReactNode;
|
|
28
|
+
chevronLeft?: React$1.ReactNode;
|
|
29
|
+
chevronRight?: React$1.ReactNode;
|
|
30
|
+
chevronsLeft?: React$1.ReactNode;
|
|
31
|
+
chevronsRight?: React$1.ReactNode;
|
|
32
|
+
}
|
|
33
|
+
|
|
5
34
|
/**
|
|
6
35
|
* The direction of a column sort.
|
|
7
36
|
*
|
|
@@ -709,13 +738,28 @@ interface BoltTableProps<T extends DataRecord = DataRecord> {
|
|
|
709
738
|
readonly styles?: StylesTypes;
|
|
710
739
|
/**
|
|
711
740
|
* A custom React node to use as the drag grip icon in column headers.
|
|
712
|
-
* When omitted, the default
|
|
741
|
+
* When omitted, the default GripVertical SVG icon is used.
|
|
713
742
|
* Ignored when `hideGripIcon` is `true`.
|
|
714
743
|
*
|
|
744
|
+
* @deprecated Use `icons.gripVertical` instead. This prop is kept for backward compatibility.
|
|
745
|
+
*
|
|
715
746
|
* @example
|
|
716
|
-
* gripIcon={<DragHandleIcon
|
|
747
|
+
* gripIcon={<DragHandleIcon style={{ width: 12, height: 12 }} />}
|
|
717
748
|
*/
|
|
718
749
|
readonly gripIcon?: React$1.ReactNode;
|
|
750
|
+
/**
|
|
751
|
+
* Custom icon overrides for the table's built-in icons.
|
|
752
|
+
* Pass any subset of icons to replace the defaults. Unspecified icons use
|
|
753
|
+
* the built-in SVG icons. Each icon should be a pre-sized React node.
|
|
754
|
+
*
|
|
755
|
+
* @example
|
|
756
|
+
* icons={{
|
|
757
|
+
* gripVertical: <MyGripIcon size={12} />,
|
|
758
|
+
* sortAsc: <MySortUpIcon size={12} />,
|
|
759
|
+
* chevronsLeft: <MyFirstPageIcon size={12} />,
|
|
760
|
+
* }}
|
|
761
|
+
*/
|
|
762
|
+
readonly icons?: BoltTableIcons;
|
|
719
763
|
/**
|
|
720
764
|
* When `true`, the drag grip icon is hidden from all column headers.
|
|
721
765
|
* Columns can still be dragged even without the grip icon.
|
|
@@ -1166,7 +1210,7 @@ interface StylesTypes {
|
|
|
1166
1210
|
* autoHeight={false}
|
|
1167
1211
|
* />
|
|
1168
1212
|
*/
|
|
1169
|
-
declare function BoltTable<T extends DataRecord = DataRecord>({ columns: initialColumns, data, rowHeight, expandedRowHeight, maxExpandedRowHeight, accentColor, className, classNames, styles, gripIcon, hideGripIcon, pagination, onPaginationChange, onColumnResize, onColumnOrderChange, onColumnPin, onColumnHide, rowSelection, expandable, rowKey, onEndReached, onEndReachedThreshold, isLoading, onSortChange, onFilterChange, columnContextMenuItems, autoHeight, layoutLoading, emptyRenderer, }: BoltTableProps<T>): react_jsx_runtime.JSX.Element;
|
|
1213
|
+
declare function BoltTable<T extends DataRecord = DataRecord>({ columns: initialColumns, data, rowHeight, expandedRowHeight, maxExpandedRowHeight, accentColor, className, classNames, styles, gripIcon, hideGripIcon, icons, pagination, onPaginationChange, onColumnResize, onColumnOrderChange, onColumnPin, onColumnHide, rowSelection, expandable, rowKey, onEndReached, onEndReachedThreshold, isLoading, onSortChange, onFilterChange, columnContextMenuItems, autoHeight, layoutLoading, emptyRenderer, }: BoltTableProps<T>): react_jsx_runtime.JSX.Element;
|
|
1170
1214
|
|
|
1171
1215
|
/**
|
|
1172
1216
|
* Props for the DraggableHeader component.
|
|
@@ -1307,6 +1351,11 @@ interface DraggableHeaderProps {
|
|
|
1307
1351
|
* ]}
|
|
1308
1352
|
*/
|
|
1309
1353
|
customContextMenuItems?: ColumnContextMenuItem[];
|
|
1354
|
+
/**
|
|
1355
|
+
* Custom icon overrides from BoltTable's `icons` prop.
|
|
1356
|
+
* Passed through automatically — do not set manually.
|
|
1357
|
+
*/
|
|
1358
|
+
icons?: BoltTableIcons;
|
|
1310
1359
|
}
|
|
1311
1360
|
/**
|
|
1312
1361
|
* DraggableHeader — a single column header cell for BoltTable.
|
|
@@ -1326,7 +1375,7 @@ interface DraggableHeaderProps {
|
|
|
1326
1375
|
*
|
|
1327
1376
|
* @internal This is an internal BoltTable component. Use BoltTable directly.
|
|
1328
1377
|
*/
|
|
1329
|
-
declare const DraggableHeader: React$1.MemoExoticComponent<({ column, visualIndex, accentColor, onResizeStart, styles, classNames, hideGripIcon, gripIcon, stickyOffset, onTogglePin, onToggleHide, isLastColumn, sortDirection, onSort, filterValue, onFilter, onClearFilter, customContextMenuItems, }: DraggableHeaderProps) => react_jsx_runtime.JSX.Element>;
|
|
1378
|
+
declare const DraggableHeader: React$1.MemoExoticComponent<({ column, visualIndex, accentColor, onResizeStart, styles, classNames, hideGripIcon, gripIcon, stickyOffset, onTogglePin, onToggleHide, isLastColumn, sortDirection, onSort, filterValue, onFilter, onClearFilter, customContextMenuItems, icons, }: DraggableHeaderProps) => react_jsx_runtime.JSX.Element>;
|
|
1330
1379
|
|
|
1331
1380
|
/**
|
|
1332
1381
|
* The imperative handle exposed by ResizeOverlay via `ref`.
|
|
@@ -1539,4 +1588,4 @@ interface TableBodyProps {
|
|
|
1539
1588
|
*/
|
|
1540
1589
|
declare const TableBody: React$1.FC<TableBodyProps>;
|
|
1541
1590
|
|
|
1542
|
-
export { BoltTable, type ColumnContextMenuItem, type ColumnType, type DataRecord, DraggableHeader, type ExpandableConfig, type PaginationType, ResizeOverlay, type RowSelectionConfig, type SortDirection, TableBody };
|
|
1591
|
+
export { BoltTable, type BoltTableIcons, type ColumnContextMenuItem, type ColumnType, type DataRecord, DraggableHeader, type ExpandableConfig, type PaginationType, ResizeOverlay, type RowSelectionConfig, type SortDirection, TableBody };
|