@dbcdk/react-components 0.0.33 → 0.0.35

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 (33) hide show
  1. package/dist/components/button/Button.module.css +1 -0
  2. package/dist/components/card/components/CardMeta.js +2 -2
  3. package/dist/components/card/components/CardMeta.module.css +3 -3
  4. package/dist/components/datetime-picker/DateTimePicker.d.ts +1 -0
  5. package/dist/components/datetime-picker/DateTimePicker.js +2 -2
  6. package/dist/components/forms/checkbox/Checkbox.module.css +8 -2
  7. package/dist/components/forms/multi-select/MultiSelect.d.ts +4 -1
  8. package/dist/components/forms/multi-select/MultiSelect.js +69 -23
  9. package/dist/components/menu/Menu.module.css +10 -2
  10. package/dist/components/pagination/Pagination.js +7 -5
  11. package/dist/components/table/Table.d.ts +2 -1
  12. package/dist/components/table/Table.js +4 -11
  13. package/dist/components/table/Table.module.css +110 -185
  14. package/dist/components/table/Table.types.d.ts +4 -2
  15. package/dist/components/table/TanstackTable.js +42 -33
  16. package/dist/components/table/components/TableBody.d.ts +2 -3
  17. package/dist/components/table/components/TableBody.js +3 -3
  18. package/dist/components/table/components/TableHeader.d.ts +2 -3
  19. package/dist/components/table/components/TableHeader.js +2 -2
  20. package/dist/components/table/components/TableHeaderCell.js +2 -2
  21. package/dist/components/table/components/TableLoadingBody.d.ts +2 -3
  22. package/dist/components/table/components/TableLoadingBody.js +3 -3
  23. package/dist/components/table/components/TableRow.d.ts +1 -3
  24. package/dist/components/table/components/TableRow.js +5 -6
  25. package/dist/components/table/components/TableSelectionCell.js +3 -2
  26. package/dist/components/table/components/column-resizer/ColumnResizer.module.css +4 -5
  27. package/dist/components/table/table.utils.d.ts +1 -4
  28. package/dist/components/table/table.utils.js +1 -8
  29. package/dist/components/table/tanstackTable.utils.d.ts +10 -6
  30. package/dist/components/table/tanstackTable.utils.js +79 -83
  31. package/dist/src/styles/styles.css +1 -5
  32. package/dist/styles/styles.css +1 -5
  33. package/package.json +2 -1
@@ -53,28 +53,37 @@
53
53
  min-inline-size: 0;
54
54
  inline-size: 100%;
55
55
  max-inline-size: 100%;
56
+ }
57
+
58
+ .tableScroll {
59
+ flex: 1 1 auto;
60
+ min-block-size: 0;
61
+ min-inline-size: 0;
62
+ overflow: auto;
63
+ background: var(--table-row-bg);
64
+ -webkit-overflow-scrolling: touch;
65
+ }
66
+
67
+ .tableElement {
68
+ inline-size: 100%;
69
+ min-inline-size: 100%;
70
+ border-collapse: separate;
71
+ border-spacing: 0;
72
+ table-layout: fixed;
56
73
  font-family: var(--font-family);
57
74
  font-size: var(--font-size-sm);
58
75
  color: var(--table-cell-fg);
59
76
  background: var(--table-row-bg);
60
- overflow: auto;
61
77
  }
62
78
 
63
79
  .header {
64
- position: sticky;
65
- top: 0;
66
- z-index: 10;
67
- background-color: var(--table-header-bg);
68
- border-block-end: 1px solid var(--table-border-header);
69
- margin-bottom: 0;
70
- flex: 0 0 auto;
80
+ position: relative;
81
+ z-index: 2;
71
82
  }
72
83
 
73
- .bodyScroll {
74
- flex: 1 1 auto;
75
- min-block-size: 0;
76
- min-inline-size: 0;
77
- -webkit-overflow-scrolling: touch;
84
+ .headerRow,
85
+ .row {
86
+ position: relative;
78
87
  }
79
88
 
80
89
  .emptyStateSlot {
@@ -84,33 +93,26 @@
84
93
  padding: var(--spacing-lg);
85
94
  }
86
95
 
87
- .headerRow,
88
- .row {
89
- position: relative;
90
- display: grid;
91
- grid-template-columns: var(--grid-template);
92
- align-items: stretch;
93
- inline-size: 100%;
94
- min-inline-size: 0;
95
- }
96
-
97
96
  .body {
98
97
  min-block-size: 0;
99
98
  }
100
99
 
101
- .body::before {
102
- display: none;
103
- }
104
-
105
- .tableContent {
106
- inline-size: fit-content;
107
- min-inline-size: 100%;
100
+ .headerCell,
101
+ .cell {
102
+ position: relative;
103
+ box-sizing: border-box;
104
+ min-width: 0;
105
+ vertical-align: top;
106
+ text-align: start;
108
107
  }
109
108
 
110
109
  .headerCell {
111
- display: flex;
112
- align-items: center;
113
- position: relative;
110
+ position: sticky;
111
+ top: 0;
112
+ z-index: 6;
113
+ vertical-align: middle;
114
+ background-color: var(--table-header-bg);
115
+ border-block-end: 1px solid var(--table-border-header);
114
116
  padding-block: var(--spacing-xxs);
115
117
  padding-inline: var(--spacing-sm);
116
118
  font-size: var(--font-size-xs);
@@ -119,60 +121,27 @@
119
121
  text-transform: uppercase;
120
122
  color: var(--table-header-fg);
121
123
  white-space: nowrap;
122
- overflow: hidden;
123
- text-overflow: ellipsis;
124
- min-width: 0;
125
- }
126
-
127
- .sm .headerCell {
128
- padding-block: var(--spacing-xxs);
129
- padding-inline: var(--spacing-sm);
130
- }
131
-
132
- .row {
133
- background: var(--table-row-bg);
134
- transition:
135
- background-color 140ms ease,
136
- box-shadow 140ms ease;
137
- }
138
-
139
- .row::after {
140
- content: '';
141
- position: absolute;
142
- inset: 0;
143
- pointer-events: none;
144
- z-index: 4;
145
- opacity: 0;
146
- box-shadow: inset 0 0 0 2px var(--color-brand);
147
- transition: opacity 140ms ease;
148
- }
149
-
150
- .row:focus-within {
151
- outline: none;
152
- }
153
-
154
- .row:focus-within::after {
155
- opacity: 1;
156
124
  }
157
125
 
158
126
  .cell {
159
- position: relative;
160
- min-block-size: var(--component-size-md);
161
127
  padding-block: 6px;
162
128
  padding-inline: var(--spacing-sm);
163
129
  border-block-end: 1px solid var(--table-border-subtle);
164
- text-align: start;
165
- vertical-align: top;
166
- min-width: 0;
130
+ background: var(--table-row-bg);
167
131
  overflow: hidden;
132
+ line-height: 20px;
133
+ }
134
+
135
+ .sm .headerCell {
136
+ padding-block: var(--spacing-xxs);
137
+ padding-inline: var(--spacing-sm);
168
138
  }
169
139
 
170
140
  .sm .cell {
171
- min-block-size: var(--component-size-sm);
172
- padding-block: 6px;
141
+ padding-block: var(--spacing-xxs);
173
142
  padding-inline: var(--spacing-sm);
174
143
  font-size: var(--font-size-xs);
175
- line-height: var(--line-height-normal);
144
+ line-height: 20px;
176
145
  }
177
146
 
178
147
  .headerCell[data-align='right'],
@@ -188,43 +157,35 @@
188
157
 
189
158
  .headerCell.selectionCell,
190
159
  .cell.selectionCell {
191
- overflow: visible !important;
192
- display: flex;
193
- align-items: flex-start;
194
- justify-content: flex-start;
195
- min-width: 0;
196
- padding-inline: var(--spacing-sm);
197
- padding-block: 6px;
160
+ padding-inline: calc(var(--spacing-xxs) + 2px) var(--spacing-sm);
198
161
  cursor: pointer;
162
+ overflow: visible;
163
+ line-height: 0;
199
164
  }
200
165
 
201
- .headerCell.selectionCell:hover button,
202
- .cell.selectionCell:hover button {
203
- border-color: var(--color-fg-default);
166
+ .headerCell.selectionCell {
167
+ padding-block: var(--spacing-xxs);
168
+ vertical-align: middle;
204
169
  }
205
170
 
206
- .headerCell.selectionCell:focus-within > button,
207
- .cell.selectionCell:focus-within > button {
208
- border-color: var(--color-fg-default);
171
+ .cell.selectionCell {
172
+ vertical-align: top;
173
+ padding-block: var(--spacing-xxs);
209
174
  }
210
175
 
211
176
  .selectionHitArea {
212
177
  display: inline-flex;
213
178
  align-items: flex-start;
214
179
  justify-content: flex-start;
215
- inline-size: fit-content;
216
- block-size: auto;
217
180
  min-block-size: 0;
218
181
  padding: 0;
219
- }
220
-
221
- .sm .selectionHitArea {
222
- min-block-size: 0;
182
+ line-height: 0;
223
183
  }
224
184
 
225
185
  .selectionControlWrap {
226
186
  display: inline-flex;
227
187
  align-items: flex-start;
188
+ line-height: 0;
228
189
  }
229
190
 
230
191
  .selectionControlWrap span {
@@ -247,22 +208,42 @@
247
208
  cursor: pointer;
248
209
  }
249
210
 
250
- .clickableRow:hover {
211
+ .clickableRow:hover > .cell {
251
212
  background-color: var(--table-row-bg-hover);
252
213
  }
253
214
 
254
- .selectedRow {
215
+ .selectedRow > .cell {
255
216
  background-color: var(--table-row-bg-selected);
256
217
  }
257
218
 
258
- .selectedRow:hover {
219
+ .selectedRow:hover > .cell {
259
220
  background-color: var(--table-row-bg-selected-hover);
260
221
  }
261
222
 
262
- .striped .row:nth-child(even):not(.selectedRow):not(:hover) {
223
+ .striped > .row:nth-child(even):not(.selectedRow):not(:hover) > .cell {
263
224
  background-color: var(--table-row-bg-alt);
264
225
  }
265
226
 
227
+ .row:focus-within > .cell {
228
+ box-shadow:
229
+ inset 0 2px 0 var(--color-brand),
230
+ inset 0 -2px 0 var(--color-brand);
231
+ }
232
+
233
+ .row:focus-within > .cell:first-child {
234
+ box-shadow:
235
+ inset 2px 0 0 var(--color-brand),
236
+ inset 0 2px 0 var(--color-brand),
237
+ inset 0 -2px 0 var(--color-brand);
238
+ }
239
+
240
+ .row:focus-within > .cell:last-child {
241
+ box-shadow:
242
+ inset -2px 0 0 var(--color-brand),
243
+ inset 0 2px 0 var(--color-brand),
244
+ inset 0 -2px 0 var(--color-brand);
245
+ }
246
+
266
247
  .nowrap {
267
248
  white-space: nowrap;
268
249
  }
@@ -354,7 +335,7 @@
354
335
  justify-content: center;
355
336
  min-width: 0;
356
337
  pointer-events: none;
357
- z-index: 5;
338
+ z-index: 7;
358
339
  }
359
340
 
360
341
  .thOverlayExtras > * {
@@ -374,6 +355,14 @@
374
355
  block-size: var(--icon-size-sm);
375
356
  }
376
357
 
358
+ .descending {
359
+ transform: rotate(180deg);
360
+ }
361
+
362
+ .inActiveSort {
363
+ opacity: 0.45;
364
+ }
365
+
377
366
  .cellContent {
378
367
  display: block;
379
368
  inline-size: 100%;
@@ -392,44 +381,30 @@
392
381
  min-width: 0;
393
382
  max-inline-size: 100%;
394
383
  white-space: nowrap;
395
- /* overflow: hidden; */
396
- /* text-overflow: ellipsis; */
384
+ overflow: hidden;
385
+ text-overflow: ellipsis;
397
386
  }
398
387
 
399
- .allowWrap .cellContent {
388
+ .allowWrap .cellContent,
389
+ .allowWrap .cellValueEllipsis {
400
390
  white-space: normal;
401
391
  overflow-wrap: break-word;
402
392
  word-break: normal;
393
+ overflow: visible;
394
+ text-overflow: clip;
403
395
  }
404
396
 
405
397
  .severityTable {
406
- --row-rail-width: 4px;
407
- --row-rail-gap: 10px;
408
- --row-rail-offset: calc(var(--row-rail-width) + var(--row-rail-gap));
398
+ --row-rail-width: 2px;
409
399
  --row-rail-inset-block: 1px;
410
- --row-rail-radius: 0 2px 2px 0;
411
- --selection-rail-compensation: calc(var(--row-rail-offset) / 2);
412
- }
413
-
414
- .severityTable .headerCell.selectionCell,
415
- .severityTable .row .selectionCell {
416
- padding-inline-start: 0 !important;
417
- }
418
-
419
- .severityTable .headerCell.selectionCell .selectionHitArea,
420
- .severityTable .row .selectionCell .selectionHitArea {
421
- inline-size: calc(100% - var(--selection-rail-compensation));
422
- margin-inline-start: var(--selection-rail-compensation);
400
+ --row-rail-radius: 0;
423
401
  }
424
402
 
425
- .severityTable .row.severity {
426
- --row-severity-color: transparent;
427
- --row-severity-bg: transparent;
428
- --row-severity-bg-hover: transparent;
429
- background-color: var(--row-severity-bg);
403
+ .severityTable .row.severity > .cell:first-child {
404
+ position: relative;
430
405
  }
431
406
 
432
- .severityTable .row.severity::before {
407
+ .severityTable .row.severity > .cell:first-child::before {
433
408
  content: '';
434
409
  position: absolute;
435
410
  inset-inline-start: 0;
@@ -441,62 +416,33 @@
441
416
  z-index: 2;
442
417
  pointer-events: none;
443
418
  opacity: 0.95;
444
- transition:
445
- inline-size 140ms ease,
446
- opacity 140ms ease,
447
- filter 140ms ease;
448
- }
449
-
450
- .severityTable .row.severity > * {
451
- position: relative;
452
- z-index: 3;
453
- }
454
-
455
- .severityTable .row.severity.clickableRow:hover::before,
456
- .severityTable .row.severity:hover::before {
457
- opacity: 1;
458
- filter: saturate(1.08);
459
- }
460
-
461
- .severityTable .row.severity.clickableRow:hover,
462
- .severityTable .row.severity:hover {
463
- background-color: var(--row-severity-bg-hover);
464
- }
465
-
466
- .severityTable .row.severity.selectedRow {
467
- background-color: var(--table-row-bg-selected);
468
- }
469
-
470
- .severityTable .row.severity.selectedRow:hover {
471
- background-color: var(--table-row-bg-selected-hover);
472
419
  }
473
420
 
474
- .severityTable .row.severity:focus-within::before {
475
- inline-size: 6px;
421
+ .severityTable .row.severity:hover > .cell:first-child::before,
422
+ .severityTable .row.severity:focus-within > .cell:first-child::before {
476
423
  opacity: 1;
424
+ z-index: 8;
477
425
  }
478
426
 
479
- .striped .severityTable .row.severity:nth-child(even):not(.selectedRow):not(:hover) {
480
- background-image:
481
- linear-gradient(var(--row-severity-bg), var(--row-severity-bg)),
482
- linear-gradient(var(--table-row-bg-alt), var(--table-row-bg-alt));
483
- background-blend-mode: normal;
484
- }
485
-
486
- .severityTable .row.severityFailed::before {
427
+ .severityTable .row.severityFailed > .cell:first-child::before {
487
428
  box-shadow: 1px 0 0 color-mix(in srgb, var(--row-severity-color) 20%, transparent);
488
429
  }
489
430
 
490
431
  .sm .severityTable {
491
432
  --row-rail-width: 4px;
492
- --row-rail-gap: 8px;
493
433
  --row-rail-inset-block: 1px;
494
434
  }
495
435
 
496
- .dividerLeft {
436
+ .dividerLeft,
437
+ .dividerRight {
497
438
  position: relative;
498
439
  }
499
440
 
441
+ .headerCell.dividerLeft,
442
+ .headerCell.dividerRight {
443
+ position: sticky;
444
+ }
445
+
500
446
  .dividerLeft::before {
501
447
  content: '';
502
448
  position: absolute;
@@ -507,10 +453,6 @@
507
453
  background: var(--table-divider);
508
454
  }
509
455
 
510
- .dividerRight {
511
- position: relative;
512
- }
513
-
514
456
  .dividerRight::after {
515
457
  content: '';
516
458
  position: absolute;
@@ -520,20 +462,3 @@
520
462
  width: 1px;
521
463
  background: var(--table-divider);
522
464
  }
523
-
524
- .newRow {
525
- animation: tableRowFadeIn 1000ms ease-out;
526
- }
527
-
528
- .newRow {
529
- animation: tableRowFadeIn 600ms ease-out;
530
- }
531
-
532
- @keyframes tableRowFadeIn {
533
- from {
534
- opacity: 0;
535
- }
536
- to {
537
- opacity: 1;
538
- }
539
- }
@@ -1,4 +1,4 @@
1
- import type { HTMLAttributes, ReactNode } from 'react';
1
+ import type { HTMLAttributes, ReactNode, Ref } from 'react';
2
2
  import type { PageChangeEvent } from '../../components/pagination/Pagination';
3
3
  import type { Severity } from '../../constants/severity.types';
4
4
  import type { ViewMode } from '../../hooks/useTableSettings';
@@ -6,6 +6,7 @@ export interface ColumnItem<T> {
6
6
  id: string;
7
7
  header: string | (() => ReactNode);
8
8
  accessor?: keyof T;
9
+ width?: number | string;
9
10
  sortable?: boolean;
10
11
  sortFunction?: (a: T, b: T) => -1 | 0 | 1;
11
12
  render?: (item: T) => ReactNode;
@@ -40,7 +41,8 @@ export type TableProps<T extends Record<string, any>> = Omit<HTMLAttributes<HTML
40
41
  viewMode?: ViewMode;
41
42
  striped?: boolean;
42
43
  fillViewport?: boolean;
43
- gridTemplateColumns?: string;
44
+ tableWidth?: number;
45
+ tableRootRef?: Ref<HTMLDivElement>;
44
46
  toolbar?: ReactNode;
45
47
  headerExtras?: (args: HeaderExtrasArgs<T>) => ReactNode;
46
48
  take?: number;
@@ -4,7 +4,8 @@ import { useReactTable, getCoreRowModel, getSortedRowModel, getFilteredRowModel,
4
4
  import * as React from 'react';
5
5
  import ColumnResizer from './components/column-resizer/ColumnResizer';
6
6
  import { Table } from './Table';
7
- import { buildColumnVisibilityFromVisibleIds, mapDefsToColumnItems, sortingEqual, getSortPropsFromSorting, columnItemsToIdSet, buildDistributedGridTemplateColumns, } from './tanstackTable.utils';
7
+ import { DEFAULT_COLUMN_PX } from './table.utils';
8
+ import { buildDistributedColumnWidths, buildColumnVisibilityFromVisibleIds, mapDefsToColumnItems, sortingEqual, getSortPropsFromSorting, } from './tanstackTable.utils';
8
9
  export function TanstackTable(props) {
9
10
  const { data, dataKey, columns, sorting: controlledSorting, onSortingChange, optimisticSortingUi = true, visibleColumnIds, manualSorting, selectedRows, onRowSelect, ...tableProps } = props;
10
11
  const isControlledSorting = controlledSorting != null;
@@ -47,34 +48,10 @@ export function TanstackTable(props) {
47
48
  defaultColumn: {
48
49
  enableResizing: true,
49
50
  minSize: 80,
50
- size: 180,
51
+ size: DEFAULT_COLUMN_PX,
51
52
  },
52
53
  });
53
- const columnItems = React.useMemo(() => mapDefsToColumnItems(columns, columnVisibility), [columns, columnVisibility]);
54
- const allowedIds = React.useMemo(() => columnItemsToIdSet(columnItems), [columnItems]);
55
- const visibleData = table.getRowModel().rows.map(r => r.original);
56
- const { sortById, sortDirection } = getSortPropsFromSorting(uiSorting);
57
- const handleSortChange = React.useCallback((column, direction) => {
58
- const next = direction == null ? [] : [{ id: column.id, desc: direction === 'desc' }];
59
- if (optimisticSortingUi)
60
- setUiSorting(next);
61
- onSortingChange === null || onSortingChange === void 0 ? void 0 : onSortingChange(next);
62
- }, [optimisticSortingUi, onSortingChange]);
63
- const headerExtras = React.useCallback(({ index }) => {
64
- var _a, _b, _c, _d;
65
- const headerGroups = table.getHeaderGroups();
66
- const leafHeaders = headerGroups.length > 0 ? headerGroups[headerGroups.length - 1].headers : [];
67
- const header = leafHeaders[index];
68
- if (!header)
69
- return null;
70
- const canResize = (_c = (_b = (_a = header.column).getCanResize) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : false;
71
- const handler = (_d = header.getResizeHandler) === null || _d === void 0 ? void 0 : _d.call(header);
72
- if (!canResize || !handler)
73
- return null;
74
- return _jsx(ColumnResizer, { id: header.column.id, handler: handler });
75
- }, [table]);
76
- const hasSelection = Boolean(selectedRows && onRowSelect && dataKey);
77
- React.useEffect(() => {
54
+ React.useLayoutEffect(() => {
78
55
  const el = containerRef.current;
79
56
  if (!el)
80
57
  return;
@@ -91,15 +68,47 @@ export function TanstackTable(props) {
91
68
  observer.observe(el);
92
69
  return () => observer.disconnect();
93
70
  }, []);
94
- const gridTemplateColumns = React.useMemo(() => {
95
- return buildDistributedGridTemplateColumns({
71
+ const distributedLayout = React.useMemo(() => {
72
+ if (availableWidth == null)
73
+ return null;
74
+ return buildDistributedColumnWidths({
96
75
  table,
97
- allowedIds,
98
- hasSelection,
76
+ hasSelection: Boolean(selectedRows && onRowSelect && dataKey),
99
77
  defaultMinPx: 80,
100
78
  columnSizing,
101
79
  availableWidth,
102
80
  });
103
- }, [table, allowedIds, hasSelection, columnSizing, availableWidth]);
104
- return (_jsx("div", { ref: containerRef, style: { width: '100%', minWidth: 0, overflow: 'auto' }, children: _jsx(Table, { ...tableProps, onSortChange: handleSortChange, dataKey: dataKey, data: visibleData, columns: columnItems, sortById: sortById, sortDirection: sortDirection, gridTemplateColumns: gridTemplateColumns, headerExtras: headerExtras, selectedRows: selectedRows, onRowSelect: onRowSelect }) }));
81
+ }, [table, selectedRows, onRowSelect, dataKey, columnSizing, availableWidth]);
82
+ const resolvedLayout = React.useMemo(() => {
83
+ const next = {};
84
+ table.getVisibleLeafColumns().forEach((column) => {
85
+ next[column.id] = {
86
+ width: distributedLayout === null || distributedLayout === void 0 ? void 0 : distributedLayout.widths[column.id],
87
+ };
88
+ });
89
+ return next;
90
+ }, [table, distributedLayout]);
91
+ const columnItems = React.useMemo(() => mapDefsToColumnItems(columns, columnVisibility, resolvedLayout), [columns, columnVisibility, resolvedLayout]);
92
+ const visibleData = table.getRowModel().rows.map(r => r.original);
93
+ const { sortById, sortDirection } = getSortPropsFromSorting(uiSorting);
94
+ const handleSortChange = React.useCallback((column, direction) => {
95
+ const next = direction == null ? [] : [{ id: column.id, desc: direction === 'desc' }];
96
+ if (optimisticSortingUi)
97
+ setUiSorting(next);
98
+ onSortingChange === null || onSortingChange === void 0 ? void 0 : onSortingChange(next);
99
+ }, [optimisticSortingUi, onSortingChange]);
100
+ const headerExtras = React.useCallback(({ index }) => {
101
+ var _a, _b, _c, _d;
102
+ const headerGroups = table.getHeaderGroups();
103
+ const leafHeaders = headerGroups.length > 0 ? headerGroups[headerGroups.length - 1].headers : [];
104
+ const header = leafHeaders[index];
105
+ if (!header)
106
+ return null;
107
+ const canResize = (_c = (_b = (_a = header.column).getCanResize) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : false;
108
+ const handler = (_d = header.getResizeHandler) === null || _d === void 0 ? void 0 : _d.call(header);
109
+ if (!canResize || !handler)
110
+ return null;
111
+ return _jsx(ColumnResizer, { id: header.column.id, handler: handler });
112
+ }, [table]);
113
+ return (_jsx(Table, { ...tableProps, tableRootRef: containerRef, onSortChange: handleSortChange, dataKey: dataKey, data: visibleData, columns: columnItems, tableWidth: distributedLayout === null || distributedLayout === void 0 ? void 0 : distributedLayout.totalWidth, sortById: sortById, sortDirection: sortDirection, headerExtras: headerExtras, selectedRows: selectedRows, onRowSelect: onRowSelect }));
105
114
  }
@@ -1,11 +1,10 @@
1
- import type { CSSProperties, ReactNode } from 'react';
1
+ import type { ReactNode } from 'react';
2
2
  import type { ViewMode } from '../../../hooks/useTableSettings';
3
3
  import type { ColumnItem } from '../Table.types';
4
4
  type Props<T extends Record<string, any>> = {
5
5
  data: T[];
6
6
  dataKey: keyof T;
7
7
  columns: ColumnItem<T>[];
8
- gridStyle: CSSProperties;
9
8
  striped?: boolean;
10
9
  selectedRows?: Set<number | string>;
11
10
  hasSelection: boolean;
@@ -17,5 +16,5 @@ type Props<T extends Record<string, any>> = {
17
16
  onRowMouseEnter?: (row: T) => void;
18
17
  onRowSelect?: (rowId: number | string, isSelected: boolean) => void;
19
18
  };
20
- export declare function TableBody<T extends Record<string, any>>({ data, dataKey, columns, gridStyle, striped, selectedRows, hasSelection, selectionMode, selectionInputName, viewMode, getRowSeverity, onRowClick, onRowMouseEnter, onRowSelect, }: Props<T>): ReactNode;
19
+ export declare function TableBody<T extends Record<string, any>>({ data, dataKey, columns, striped, selectedRows, hasSelection, selectionMode, selectionInputName, viewMode, getRowSeverity, onRowClick, onRowMouseEnter, onRowSelect, }: Props<T>): ReactNode;
21
20
  export {};
@@ -2,9 +2,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { cx } from '../table.classes';
3
3
  import styles from '../Table.module.css';
4
4
  import { TableRow } from './TableRow';
5
- export function TableBody({ data, dataKey, columns, gridStyle, striped, selectedRows, hasSelection, selectionMode, selectionInputName, viewMode, getRowSeverity, onRowClick, onRowMouseEnter, onRowSelect, }) {
6
- return (_jsx("div", { className: cx(styles.body, striped && styles.striped), role: "rowgroup", children: data.map(row => {
5
+ export function TableBody({ data, dataKey, columns, striped, selectedRows, hasSelection, selectionMode, selectionInputName, viewMode, getRowSeverity, onRowClick, onRowMouseEnter, onRowSelect, }) {
6
+ return (_jsx("tbody", { className: cx(styles.body, striped && styles.striped), children: data.map(row => {
7
7
  const rowId = row[dataKey];
8
- return (_jsx(TableRow, { row: row, rowId: rowId, columns: columns, gridStyle: gridStyle, selectedRows: selectedRows, hasSelection: hasSelection, selectionMode: selectionMode, selectionInputName: selectionInputName, viewMode: viewMode, getRowSeverity: getRowSeverity, onRowClick: onRowClick, onRowMouseEnter: onRowMouseEnter, onRowSelect: onRowSelect }, `gridRow-${rowId}`));
8
+ return (_jsx(TableRow, { row: row, rowId: rowId, columns: columns, selectedRows: selectedRows, hasSelection: hasSelection, selectionMode: selectionMode, selectionInputName: selectionInputName, viewMode: viewMode, getRowSeverity: getRowSeverity, onRowClick: onRowClick, onRowMouseEnter: onRowMouseEnter, onRowSelect: onRowSelect }, `gridRow-${rowId}`));
9
9
  }) }));
10
10
  }
@@ -1,8 +1,7 @@
1
- import React, { type CSSProperties, type ReactNode } from 'react';
1
+ import React, { type ReactNode } from 'react';
2
2
  import type { ColumnItem, HeaderExtrasArgs, SortDirection } from '../Table.types';
3
3
  type Props<T> = {
4
4
  columns: ColumnItem<T>[];
5
- gridStyle: CSSProperties;
6
5
  hasSelection: boolean;
7
6
  selectionMode: 'single' | 'multiple';
8
7
  allRowsSelected?: boolean;
@@ -12,5 +11,5 @@ type Props<T> = {
12
11
  onSortChange?: (column: ColumnItem<T>, direction: SortDirection) => void;
13
12
  headerExtras?: (args: HeaderExtrasArgs<T>) => ReactNode;
14
13
  };
15
- export declare function TableHeader<T>({ columns, gridStyle, hasSelection, selectionMode, allRowsSelected, onSelectAllRows, sortById, sortDirection, onSortChange, headerExtras, }: Props<T>): React.ReactNode;
14
+ export declare function TableHeader<T>({ columns, hasSelection, selectionMode, allRowsSelected, onSelectAllRows, sortById, sortDirection, onSortChange, headerExtras, }: Props<T>): React.ReactNode;
16
15
  export {};
@@ -2,6 +2,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { TableHeaderCell } from './TableHeaderCell';
3
3
  import { TableSelectionCell } from './TableSelectionCell';
4
4
  import styles from '../Table.module.css';
5
- export function TableHeader({ columns, gridStyle, hasSelection, selectionMode, allRowsSelected, onSelectAllRows, sortById, sortDirection, onSortChange, headerExtras, }) {
6
- return (_jsxs("div", { className: styles.headerRow, style: gridStyle, role: "row", children: [hasSelection ? (_jsx(TableSelectionCell, { isHeader: true, multiple: selectionMode === 'multiple', checked: allRowsSelected, onToggle: checked => onSelectAllRows === null || onSelectAllRows === void 0 ? void 0 : onSelectAllRows(checked) })) : null, columns.map((column, index) => (_jsx(TableHeaderCell, { column: column, index: index, sortById: sortById, sortDirection: sortDirection, onSortChange: onSortChange, extraContent: headerExtras === null || headerExtras === void 0 ? void 0 : headerExtras({ column, index }) }, column.id)))] }));
5
+ export function TableHeader({ columns, hasSelection, selectionMode, allRowsSelected, onSelectAllRows, sortById, sortDirection, onSortChange, headerExtras, }) {
6
+ return (_jsx("thead", { className: styles.header, children: _jsxs("tr", { className: styles.headerRow, children: [hasSelection ? (_jsx(TableSelectionCell, { isHeader: true, multiple: selectionMode === 'multiple', checked: allRowsSelected, onToggle: checked => onSelectAllRows === null || onSelectAllRows === void 0 ? void 0 : onSelectAllRows(checked) })) : null, columns.map((column, index) => (_jsx(TableHeaderCell, { column: column, index: index, sortById: sortById, sortDirection: sortDirection, onSortChange: onSortChange, extraContent: headerExtras === null || headerExtras === void 0 ? void 0 : headerExtras({ column, index }) }, column.id)))] }) }));
7
7
  }
@@ -15,10 +15,10 @@ export function TableHeaderCell({ column, index, sortById, sortDirection, onSort
15
15
  const nextDirection = getNextSortDirection(column.sortable, active, sortDirection !== null && sortDirection !== void 0 ? sortDirection : null);
16
16
  onSortChange(column, nextDirection);
17
17
  };
18
- return (_jsxs("div", { className: cx(styles.headerCell, dividerClass), role: "columnheader", "aria-sort": ariaSort, "data-align": align, "data-divider": column.divider, "data-column-index": index, children: [_jsx("div", { className: alignClasses.inner, children: _jsx("div", { className: alignClasses.main, children: column.sortable ? (_jsxs("button", { type: "button", className: alignClasses.button, onClick: handleToggleSort, onKeyDown: e => {
18
+ return (_jsxs("th", { className: cx(styles.headerCell, dividerClass), scope: "col", "aria-sort": ariaSort, "data-align": align, "data-divider": column.divider, "data-column-index": index, children: [_jsx("div", { className: alignClasses.inner, children: _jsx("div", { className: alignClasses.main, children: column.sortable ? (_jsxs("button", { type: "button", className: alignClasses.button, onClick: handleToggleSort, onKeyDown: e => {
19
19
  if (!shouldToggleOnKey(e.key))
20
20
  return;
21
21
  e.preventDefault();
22
22
  handleToggleSort();
23
- }, children: [_jsx("span", { className: alignClasses.label, children: getHeaderLabel(column.header) }), _jsxs("span", { className: styles.sortIndicator, "aria-hidden": "true", children: [active && sortDirection === 'asc' && _jsx(ArrowUp, {}), active && sortDirection === 'desc' && _jsx(ArrowDown, { className: styles.descending }), !active && _jsx(ArrowDown, { className: `${styles.descending} ${styles.inActiveSort}` })] })] })) : (_jsx("span", { className: alignClasses.label, children: getHeaderLabel(column.header) })) }) }), extraContent != null ? _jsx("div", { className: styles.thOverlayExtras, children: extraContent }) : null] }, column.id));
23
+ }, children: [_jsx("span", { className: alignClasses.label, children: getHeaderLabel(column.header) }), _jsxs("span", { className: styles.sortIndicator, "aria-hidden": "true", children: [active && sortDirection === 'asc' && _jsx(ArrowUp, {}), active && sortDirection === 'desc' && _jsx(ArrowDown, {}), !active && _jsx(ArrowDown, { className: styles.inActiveSort })] })] })) : (_jsx("span", { className: alignClasses.label, children: getHeaderLabel(column.header) })) }) }), extraContent != null ? _jsx("div", { className: styles.thOverlayExtras, children: extraContent }) : null] }, column.id));
24
24
  }
@@ -1,10 +1,9 @@
1
- import type { CSSProperties, ReactNode } from 'react';
1
+ import type { ReactNode } from 'react';
2
2
  import type { ColumnItem } from '../Table.types';
3
3
  type Props<T> = {
4
4
  rows: number;
5
5
  columns: ColumnItem<T>[];
6
6
  hasSelection: boolean;
7
- gridStyle: CSSProperties;
8
7
  };
9
- export declare function TableLoadingBody<T>({ rows, columns, hasSelection, gridStyle, }: Props<T>): ReactNode;
8
+ export declare function TableLoadingBody<T>({ rows, columns, hasSelection }: Props<T>): ReactNode;
10
9
  export {};