@chumsinc/sortable-tables 2.2.0 → 3.0.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.
Files changed (66) hide show
  1. package/CHANGELOG.md +69 -52
  2. package/README.md +94 -4
  3. package/dist/DataTable.d.ts +6 -6
  4. package/dist/DataTableCell.d.ts +299 -295
  5. package/dist/DataTableCols.d.ts +5 -5
  6. package/dist/DataTableContext.d.ts +10 -0
  7. package/dist/DataTableProvider.d.ts +12 -0
  8. package/dist/DataTableTH.d.ts +6 -6
  9. package/dist/SortableTable.d.ts +6 -6
  10. package/dist/SortableTableHead.d.ts +6 -6
  11. package/dist/SortableTableHeadWrapper.d.ts +9 -0
  12. package/dist/SortableTableTH.d.ts +6 -6
  13. package/dist/StandaloneDataTable.d.ts +6 -0
  14. package/dist/StandaloneSortHelper.d.ts +5 -0
  15. package/dist/StandaloneSortableTable.d.ts +6 -0
  16. package/dist/Table.d.ts +6 -5
  17. package/dist/index.cjs.js +30 -34
  18. package/dist/index.cjs.js.map +1 -1
  19. package/dist/index.d.ts +20 -16
  20. package/dist/index.es.js +521 -471
  21. package/dist/index.es.js.map +1 -1
  22. package/dist/types.d.ts +104 -103
  23. package/dist/useField.d.ts +6 -0
  24. package/dist/useTableContext.d.ts +2 -0
  25. package/dist/useTableFields.d.ts +9 -0
  26. package/dist/useTableSort.d.ts +9 -0
  27. package/package.json +3 -3
  28. package/src/DataTable.tsx +34 -11
  29. package/src/DataTableCell.tsx +33 -28
  30. package/src/DataTableCols.tsx +11 -18
  31. package/src/DataTableContext.ts +13 -0
  32. package/src/DataTableHead.tsx +6 -7
  33. package/src/DataTableProvider.tsx +62 -0
  34. package/src/DataTableRow.tsx +8 -7
  35. package/src/DataTableTBody.tsx +1 -3
  36. package/src/DataTableTH.tsx +4 -3
  37. package/src/RowsPerPage.tsx +2 -4
  38. package/src/SortableTable.tsx +36 -12
  39. package/src/SortableTableHead.tsx +9 -9
  40. package/src/SortableTableHeadWrapper.tsx +20 -0
  41. package/src/SortableTableTH.tsx +4 -4
  42. package/src/StandaloneDataTable.tsx +16 -0
  43. package/src/StandaloneSortHelper.tsx +15 -0
  44. package/src/StandaloneSortableTable.tsx +21 -0
  45. package/src/Table.tsx +49 -44
  46. package/src/TablePagination.tsx +1 -3
  47. package/src/index.tsx +21 -15
  48. package/src/types.ts +127 -126
  49. package/src/useField.ts +19 -0
  50. package/src/useTableContext.ts +10 -0
  51. package/src/useTableFields.ts +20 -0
  52. package/src/useTableSort.ts +20 -0
  53. package/test/Main.tsx +37 -0
  54. package/test/TableColumnsHandler.tsx +9 -9
  55. package/test/TestTable.tsx +51 -46
  56. package/test/data.ts +232 -232
  57. package/test/index.tsx +11 -11
  58. package/test/tableFields.tsx +11 -3
  59. package/test/utils.ts +19 -0
  60. package/tsconfig.json +1 -0
  61. package/dist/DataTableWithContext.d.ts +0 -2
  62. package/dist/SortableTableWithContext.d.ts +0 -2
  63. package/dist/TableProvider.d.ts +0 -17
  64. package/src/DataTableWithContext.tsx +0 -41
  65. package/src/SortableTableWithContext.tsx +0 -44
  66. package/src/TableProvider.tsx +0 -77
package/CHANGELOG.md CHANGED
@@ -7,15 +7,32 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
9
9
 
10
- #### [v2.2.0](https://github.com/ChumsInc/sortable-tables/compare/v2.1.3...v2.2.0)
10
+ #### [v3.0.0](https://github.com/ChumsInc/sortable-tables/compare/v2.2.0...v3.0.0)
11
+
12
+ > 2025-12-30
13
+
14
+
15
+
16
+
17
+ ### Commits
18
+
19
+ - [`372fb75`](https://github.com/ChumsInc/sortable-tables/commit/372fb75f6401cdafe51a8c94bb725a9b5bb55054) Add DataTableProvider to allow for better modifying of columns.
20
+ - [`54f85e5`](https://github.com/ChumsInc/sortable-tables/commit/54f85e50d2390e7dfd2b9b3f4aad1a215abc51a5) Add DataTableProvider to allow for better modifying of columns.
21
+ - [`ca0dee4`](https://github.com/ChumsInc/sortable-tables/commit/ca0dee45c5f0e76c9239642e5946b171b0559fa0) chore: add type definitions for SortableTableHeadWrapper, declare component with displayName
22
+ - [`d5cb405`](https://github.com/ChumsInc/sortable-tables/commit/d5cb40577c6e9edbe84a0770af756b6e28d8ae5d) chore: replace "collapse" with "visible" for field visibility control, filter hidden fields in table rendering
23
+ - [`f8e67fb`](https://github.com/ChumsInc/sortable-tables/commit/f8e67fbc6f38cb8e457cb0f864abd3933b9f895b) chore: move field visibility filter to DataTableCell, simplify SortableTableHead rendering logic
24
+ - [`0d376b5`](https://github.com/ChumsInc/sortable-tables/commit/0d376b5567005ace9a64e14b6e593d5a7f617b20) chore: add StandaloneSortHelper to help handle sortChanges in StandaloneSortableTable component
25
+ - [`0780ecf`](https://github.com/ChumsInc/sortable-tables/commit/0780ecf033a3291e65d080915e14cb3c9812a1b6) chore: add testing for standalone tables
26
+
27
+ #### [v2.2.0](https://github.com/ChumsInc/sortable-tables/compare/v2.1.3...v2.2.0) - 2025-12-16
11
28
 
12
29
  > 2025-12-16
13
30
 
14
31
 
15
32
 
16
33
 
17
- ### Commits
18
-
34
+ ### Commits
35
+
19
36
  - [`78c1ccc`](https://github.com/ChumsInc/sortable-tables/commit/78c1ccc7fe0ccb1a98077ecdbbe75f21a8b08da5) chore: add new context-based table components and integrate TableProvider with useTableFields hook
20
37
 
21
38
  #### [v2.1.3](https://github.com/ChumsInc/sortable-tables/compare/v2.1.2...v2.1.3) - 2025-12-15
@@ -25,8 +42,8 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
25
42
 
26
43
 
27
44
 
28
- ### Commits
29
-
45
+ ### Commits
46
+
30
47
  - [`f4bdc3e`](https://github.com/ChumsInc/sortable-tables/commit/f4bdc3e6007cad72623eafe7d823cbb15c5edf68) chore: replace classnames with clsx, add DataTableCols declaration, add DataTableCols with option for visibility:collapse
31
48
 
32
49
  #### [v2.1.2](https://github.com/ChumsInc/sortable-tables/compare/v2.1.1...v2.1.2) - 2025-12-02
@@ -36,8 +53,8 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
36
53
 
37
54
 
38
55
 
39
- ### Commits
40
-
56
+ ### Commits
57
+
41
58
  - [`210a01e`](https://github.com/ChumsInc/sortable-tables/commit/210a01e9cf4e62a63d569bd6ced41a26f17b5ae5) chore: update dependencies in package-lock.json
42
59
 
43
60
  #### [v2.1.1](https://github.com/ChumsInc/sortable-tables/compare/v2.1.0...v2.1.1) - 2025-11-04
@@ -47,8 +64,8 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
47
64
 
48
65
 
49
66
 
50
- ### Commits
51
-
67
+ ### Commits
68
+
52
69
  - [`be79047`](https://github.com/ChumsInc/sortable-tables/commit/be79047541456eee2006706438b55aa61aed4fc1) chore: update types and dependencies
53
70
 
54
71
  #### [v2.1.0](https://github.com/ChumsInc/sortable-tables/compare/v2.0.14...v2.1.0) - 2025-11-03
@@ -58,8 +75,8 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
58
75
 
59
76
 
60
77
 
61
- ### Commits
62
-
78
+ ### Commits
79
+
63
80
  - [`7b2a057`](https://github.com/ChumsInc/sortable-tables/commit/7b2a057454d2b46affe2cccfce060c7812065a23) migrate to vite library build
64
81
  - [`ae562e9`](https://github.com/ChumsInc/sortable-tables/commit/ae562e9c631b94c367f87ff5df70e849ee0405a2) migrate to vite library build
65
82
 
@@ -70,8 +87,8 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
70
87
 
71
88
 
72
89
 
73
- ### Commits
74
-
90
+ ### Commits
91
+
75
92
  - [`48f4b1f`](https://github.com/ChumsInc/sortable-tables/commit/48f4b1f0df1e94a4eede5e1333a25262b28f4cdd) chore: npm updates, apply className attribute to rendered table.
76
93
 
77
94
  #### [v2.0.13](https://github.com/ChumsInc/sortable-tables/compare/v2.0.12...v2.0.13) - 2025-07-08
@@ -81,8 +98,8 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
81
98
 
82
99
 
83
100
 
84
- ### Commits
85
-
101
+ ### Commits
102
+
86
103
  - [`4f9d4cc`](https://github.com/ChumsInc/sortable-tables/commit/4f9d4cc0cb6da9c27fa26c93bfd6ee302a70ff3c) fix: still trying to make it work for MouseEvent typing ... perhaps I should learn to write tests?
87
104
 
88
105
  #### [v2.0.12](https://github.com/ChumsInc/sortable-tables/compare/v2.0.11...v2.0.12) - 2025-07-08
@@ -92,8 +109,8 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
92
109
 
93
110
 
94
111
 
95
- ### Commits
96
-
112
+ ### Commits
113
+
97
114
  - [`23062bc`](https://github.com/ChumsInc/sortable-tables/commit/23062bc7b9bb8764c1a83f96f3c1e75db292fbf4) fix: types.d.ts did not seem to get updated on last build
98
115
 
99
116
  #### [v2.0.11](https://github.com/ChumsInc/sortable-tables/compare/v2.0.10...v2.0.11) - 2025-07-08
@@ -103,8 +120,8 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
103
120
 
104
121
 
105
122
 
106
- ### Commits
107
-
123
+ ### Commits
124
+
108
125
  - [`83848ad`](https://github.com/ChumsInc/sortable-tables/commit/83848ad28bad0dcd659f3a4bcf2a9ee1ab44d860) fix: add stricter typing for onSelectRow MouseEvent<HTMLTableRowElement>
109
126
 
110
127
  #### [v2.0.10](https://github.com/ChumsInc/sortable-tables/compare/v2.0.9...v2.0.10) - 2025-07-07
@@ -114,8 +131,8 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
114
131
 
115
132
 
116
133
 
117
- ### Commits
118
-
134
+ ### Commits
135
+
119
136
  - [`8f314f4`](https://github.com/ChumsInc/sortable-tables/commit/8f314f4f89a0f47382de3a678b8ec124ac44ebdf) fix: allow key modifiers to be passed on onSelectRow
120
137
  - [`7267ff2`](https://github.com/ChumsInc/sortable-tables/commit/7267ff20a6a233043919c53e46113f5300dea9af) fix: allow key modifiers to be passed on onSelectRow
121
138
 
@@ -126,8 +143,8 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
126
143
 
127
144
 
128
145
 
129
- ### Commits
130
-
146
+ ### Commits
147
+
131
148
  - [`08001a6`](https://github.com/ChumsInc/sortable-tables/commit/08001a6604fea9ae723147f36a54261d798153c8) fix: add correct fields type for SortableTableProps, npm updates
132
149
 
133
150
  #### [v2.0.8](https://github.com/ChumsInc/sortable-tables/compare/v2.0.7...v2.0.8) - 2025-03-13
@@ -137,8 +154,8 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
137
154
 
138
155
 
139
156
 
140
- ### Commits
141
-
157
+ ### Commits
158
+
142
159
  - [`ad120cd`](https://github.com/ChumsInc/sortable-tables/commit/ad120cd7f521d194613370aa91befd24582aef5d) fix: allow React.ReactNode for rowsPerPage label
143
160
 
144
161
  #### [v2.0.7](https://github.com/ChumsInc/sortable-tables/compare/v2.0.6...v2.0.7) - 2025-02-27
@@ -148,8 +165,8 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
148
165
 
149
166
 
150
167
 
151
- ### Commits
152
-
168
+ ### Commits
169
+
153
170
  - [`2350125`](https://github.com/ChumsInc/sortable-tables/commit/2350125f5fca9545c2ca1136191af5f765313e4f) fix: always show datacell contents if the render attribute is not undefined.
154
171
  - [`3ffa14a`](https://github.com/ChumsInc/sortable-tables/commit/3ffa14a3f1648173a9d8c896abe886c26928506e) chore: npm updates
155
172
  - [`364895d`](https://github.com/ChumsInc/sortable-tables/commit/364895dd31a6aa4a8b8d4911b965323637a7e85f) chore: update README.md
@@ -164,11 +181,11 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
164
181
 
165
182
 
166
183
 
167
- ### Commits
168
-
169
- - [`4d7716d`](https://github.com/ChumsInc/sortable-tables/commit/4d7716d5d23eac513b3761c03b722aeba250019b) fix: Accessibility fixes
170
- - aria labels for pagination buttons
171
- - allow set table cell as TD or TH
184
+ ### Commits
185
+
186
+ - [`4d7716d`](https://github.com/ChumsInc/sortable-tables/commit/4d7716d5d23eac513b3761c03b722aeba250019b) fix: Accessibility fixes
187
+ - aria labels for pagination buttons
188
+ - allow set table cell as TD or TH
172
189
  - set scope on sortable table header cell
173
190
 
174
191
  #### [v2.0.5](https://github.com/ChumsInc/sortable-tables/compare/v2.0.4...v2.0.5) - 2025-02-07
@@ -178,8 +195,8 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
178
195
 
179
196
 
180
197
 
181
- ### Commits
182
-
198
+ ### Commits
199
+
183
200
  - [`cd6ae46`](https://github.com/ChumsInc/sortable-tables/commit/cd6ae4690642081d649933f3a6828f180db50cc3) fix: RowsPerPage select element was missing id attribute
184
201
 
185
202
  #### [v2.0.4](https://github.com/ChumsInc/sortable-tables/compare/v2.0.3...v2.0.4) - 2025-02-06
@@ -189,11 +206,11 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
189
206
 
190
207
 
191
208
 
192
- ### Commits
193
-
194
- - [`82a8737`](https://github.com/ChumsInc/sortable-tables/commit/82a87377d0a63ae4ea4826a7842640c3efc19d6c) feat:
195
- - add responsive option
196
- - add sort indicator alignment
209
+ ### Commits
210
+
211
+ - [`82a8737`](https://github.com/ChumsInc/sortable-tables/commit/82a87377d0a63ae4ea4826a7842640c3efc19d6c) feat:
212
+ - add responsive option
213
+ - add sort indicator alignment
197
214
  - add testing (visual, not automated)
198
215
  - [`4f31f68`](https://github.com/ChumsInc/sortable-tables/commit/4f31f68f59875bfde20e7a3bf828b0e41c91bba0) feat: Show sort icon on hover.
199
216
  - [`116487f`](https://github.com/ChumsInc/sortable-tables/commit/116487f5edd46c47eedc721c6feb2b71e92c189c) feat: Show sort icon on hover over the TH
@@ -205,8 +222,8 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
205
222
 
206
223
 
207
224
 
208
- ### Commits
209
-
225
+ ### Commits
226
+
210
227
  - [`b3e03b4`](https://github.com/ChumsInc/sortable-tables/commit/b3e03b4887b87c7cf744be4fda396cb2f41d7e1d) feat: Show sort icon on hover.
211
228
 
212
229
  #### [v2.0.2](https://github.com/ChumsInc/sortable-tables/compare/v2.0.1...v2.0.2) - 2025-02-05
@@ -216,8 +233,8 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
216
233
 
217
234
 
218
235
 
219
- ### Commits
220
-
236
+ ### Commits
237
+
221
238
  - [`6127c13`](https://github.com/ChumsInc/sortable-tables/commit/6127c13ef9c987b28e64c6883ea3c2e12026c9ff) fix: ensure thProps.className gets applied to SortableTH
222
239
 
223
240
  #### v2.0.1 - 2025-02-05
@@ -227,19 +244,19 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
227
244
 
228
245
 
229
246
 
230
- ### Commits
231
-
247
+ ### Commits
248
+
232
249
  - [`319cf62`](https://github.com/ChumsInc/sortable-tables/commit/319cf620ace584d7a1a5962879d007da898c0905) Initial commit
233
250
  - [`76ff58a`](https://github.com/ChumsInc/sortable-tables/commit/76ff58a7005dfea279dbdbb04303b3fca65bcc22) initial commit, time for testing.
234
- - [`d8639dc`](https://github.com/ChumsInc/sortable-tables/commit/d8639dc51c0373a1123b5e5b751caa89f2873b6a) fix: add dist directory
235
- - updates to package.json
251
+ - [`d8639dc`](https://github.com/ChumsInc/sortable-tables/commit/d8639dc51c0373a1123b5e5b751caa89f2873b6a) fix: add dist directory
252
+ - updates to package.json
236
253
  - updates to tsconfig.json
237
- - [`e314afe`](https://github.com/ChumsInc/sortable-tables/commit/e314afefd0bb93f493867daca924bcba4992e78e) features:
238
- - include TablePagination element
239
- - RowsPerPage select
254
+ - [`e314afe`](https://github.com/ChumsInc/sortable-tables/commit/e314afefd0bb93f493867daca924bcba4992e78e) features:
255
+ - include TablePagination element
256
+ - RowsPerPage select
240
257
  - add displayName to each component
241
- - [`472dac4`](https://github.com/ChumsInc/sortable-tables/commit/472dac4f942d729db8cabccfd15d50acf0ec9d90) fixes
242
- - add label option for RowsPerPage
258
+ - [`472dac4`](https://github.com/ChumsInc/sortable-tables/commit/472dac4f942d729db8cabccfd15d50acf0ec9d90) fixes
259
+ - add label option for RowsPerPage
243
260
  - update TablePagination layout
244
261
  - [`29d01eb`](https://github.com/ChumsInc/sortable-tables/commit/29d01eb21114a805c75e64838497c8f309676879) fix: add xs table size
245
262
  - [`ef2b963`](https://github.com/ChumsInc/sortable-tables/commit/ef2b963564efd036d052acde54e471d4319aa46e) chore: Update README to specific to that package.
package/README.md CHANGED
@@ -8,10 +8,10 @@ This components uses [Bootstrap 5.3](https://getbootstrap.com/docs/5.3/content/t
8
8
  additional table size 'xs' for less padding.
9
9
 
10
10
  ## Usage
11
- Typical Usage:
11
+ ### Configure Columns
12
12
  ```tsx
13
- import {SortableTable, SortableTableField, SortProps} from "@chumsinc/sortable-tables";
14
- import {ProductLine} from 'chums-type'
13
+ import {StandaloneSortableTable, SortableTableField, SortProps} from "@chumsinc/sortable-tables";
14
+ import {ProductLine} from 'chums-types'
15
15
 
16
16
  const fields: SortableTableField<ProductLine>[] = [
17
17
  {field: 'ProductLine', title: 'Prod Line', sortable: true, as: 'th'},
@@ -38,6 +38,94 @@ const fields: SortableTableField<ProductLine>[] = [
38
38
  align: 'end'
39
39
  },
40
40
  ];
41
+ ```
42
+ ### Usage in a DataTableProvider
43
+ ```tsx
44
+ export default function Main() {
45
+ const dispatch = useAppDispatch();
46
+ const initialSort: SortProps<ProductLine> = {field: 'ProductLine', ascending: true};
47
+
48
+ return (
49
+ <DataTableProvider initialFields={tableFields} initialSort={initialSort}>
50
+ <TestTable />
51
+ </DataTableProvider>
52
+ )
53
+ }
54
+
55
+ function TestTable() {
56
+ const dispatch = useAppDispatch();
57
+ const data = useAppSelector(selectSortedProductLines);
58
+ const sort = useAppSelector(selectProductLinesSort);
59
+ const [page, setPage] = useState(0);
60
+ const [rowsPerPage, setRowsPerPage] = useState(5);
61
+ const [, setCurrentSort] = useTableSort<ProductLine>();
62
+
63
+ useEffect(() => {
64
+ setCurrentSort(sort);
65
+ setPage(0)
66
+ }, [sort, setCurrentSort])
67
+
68
+ const rowsPerPageChangeHandler = (rpp: number) => {
69
+ setPage(0);
70
+ setRowsPerPage(rpp);
71
+ }
72
+
73
+ const sortChangeHandler = (sort: SortProps<ProductLine>) => {
74
+ dispatch(setProductLinesSort(sort));
75
+ }
76
+
77
+
78
+ return (
79
+ <div>
80
+ <TableColumnsHandler/>
81
+ <SortableTable onChangeSort={sortChangeHandler} size="lg" responsive
82
+ data={data.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)}
83
+ keyField="ProductLine" rowClassName={rowClassName}/>
84
+ <TablePagination page={page} onChangePage={setPage} size="sm"
85
+ rowsPerPage={rowsPerPage}
86
+ rowsPerPageProps={{
87
+ onChange: rowsPerPageChangeHandler,
88
+ label: <span className="bi-images" aria-label="Images Per Page"></span>,
89
+ pageValues: [5, 10, 15, 25, 50, 100]
90
+ }}
91
+ showFirst={data.length > rowsPerPage}
92
+ showLast={data.length > rowsPerPage}
93
+ count={data.length}/>
94
+ </div>
95
+
96
+ )
97
+ }
98
+
99
+ function TableColumnsHandler() {
100
+ const [getField, updateField] = useTableContext<ProductLine>();
101
+ const [collapse, setCollapse] = React.useState<boolean>(getField('ProductLineDesc')?.collapse ?? false);
102
+ const id = useId();
103
+
104
+ const toggleFieldCollapse = useCallback((key: string, next: boolean) => {
105
+ console.debug('toggleFieldVisibility', key, next);
106
+ updateField(key, (prev) => ({...prev, collapse: next}))
107
+ setCollapse(next);
108
+ }, [updateField]);
109
+
110
+ const handleVisibleChange = (ev: React.ChangeEvent<HTMLInputElement>) => {
111
+ toggleFieldCollapse('ProductLineDesc', ev.target.checked);
112
+ }
113
+
114
+ return (
115
+ <div style={{display: 'flex', alignItems: 'center', justifyContent: 'flex-start', gap: '1rem'}}>
116
+ <input type="checkbox" checked={collapse} id={id} onChange={handleVisibleChange}/>
117
+ <label htmlFor={id}>Hide Description</label>
118
+ </div>
119
+ )
120
+ }
121
+
122
+
123
+ ```
124
+ ### Usage as a Standalone Table:
125
+ ```tsx
126
+ import {StandaloneSortableTable, SortableTableField, SortProps} from "@chumsinc/sortable-tables";
127
+ import {ProductLine} from 'chums-type'
128
+ import {fields} from './fields'
41
129
 
42
130
  export default function ProductLinesList() {
43
131
  const [sort, setSort] = useState<SortProps<ProductLine>>({field: 'ProductLine', ascending: true});
@@ -58,7 +146,7 @@ export default function ProductLinesList() {
58
146
 
59
147
  return (
60
148
  <div>
61
- <SortableTable currentSort={sort} onChangeSort={setSort} fields={fields} size="lg" responsive
149
+ <StandaloneSortableTable currentSort={sort} onChangeSort={setSort} fields={fields} size="lg" responsive
62
150
  data={list.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)}
63
151
  keyField="ProductLine" rowClassName={rowClassName}/>
64
152
  <TablePagination page={page} onChangePage={setPage} size="sm"
@@ -75,8 +163,10 @@ export default function ProductLinesList() {
75
163
  }
76
164
  ```
77
165
 
166
+ ##
78
167
  ## Breaking Changes
79
168
  Breaking changes from `chums-components`
80
169
  - TablePagination
81
170
  - The rows per page options were moved to a new attribute `rowsPerPageProps`
82
171
  - RowsPerPage now renders as a bootstrap InputGroup element
172
+ - For old standalone tables without the ContextProvider use version 2.1.3
@@ -1,6 +1,6 @@
1
- import { DataTableProps } from './types';
2
- declare function DataTable<T = unknown>({ fields, ...rest }: DataTableProps<T>): import("react/jsx-runtime").JSX.Element;
3
- declare namespace DataTable {
4
- var displayName: string;
5
- }
6
- export default DataTable;
1
+ import { DataTableProps } from './types';
2
+ declare function DataTable<T = unknown>({ className, size, responsive, sticky, data, keyField, rowClassName, renderRow, onSelectRow, selected, tableHeadProps, children, tfoot, ...rest }: Omit<DataTableProps<T>, 'fields'>): import("react/jsx-runtime").JSX.Element;
3
+ declare namespace DataTable {
4
+ var displayName: string;
5
+ }
6
+ export default DataTable;