@drivenets/design-system 0.10.0 → 0.11.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 (103) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/index.cjs +117 -122
  3. package/dist/index.d.cts +10 -2
  4. package/dist/index.d.cts.map +1 -1
  5. package/dist/index.d.ts +10 -2
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +119 -125
  8. package/dist/index.js.map +1 -1
  9. package/dist/index.min.css +1 -1
  10. package/package.json +1 -1
  11. package/src/components/ds-alert-banner/ds-alert-banner.module.scss +25 -25
  12. package/src/components/ds-autocomplete/ds-autocomplete.module.scss +29 -29
  13. package/src/components/ds-avatar/_mixins.scss +7 -7
  14. package/src/components/ds-avatar/ds-avatar.module.scss +2 -2
  15. package/src/components/ds-avatar-group/ds-avatar-group.module.scss +6 -6
  16. package/src/components/ds-breadcrumb/ds-breadcrumb.module.scss +14 -14
  17. package/src/components/ds-button/versions/ds-button-legacy/ds-button-legacy.module.scss +17 -17
  18. package/src/components/ds-button/versions/ds-button-new/ds-button-new.module.scss +135 -135
  19. package/src/components/ds-button-v3/ds-button-v3.module.scss +8 -8
  20. package/src/components/ds-card/ds-card.module.scss +12 -12
  21. package/src/components/ds-chip/ds-chip.module.scss +17 -17
  22. package/src/components/ds-chip-group/ds-chip-group.module.scss +12 -12
  23. package/src/components/ds-comment-bubble/components/ds-comment-thread/ds-comment-thread.module.scss +3 -3
  24. package/src/components/ds-comment-bubble/components/ds-thread-item/ds-thread-item.module.scss +18 -18
  25. package/src/components/ds-comment-bubble/ds-comment-bubble.module.scss +43 -43
  26. package/src/components/ds-comment-card/ds-comment-card.module.scss +34 -34
  27. package/src/components/ds-comment-indicator/ds-comment-indicator.module.scss +9 -9
  28. package/src/components/ds-comments-drawer/components/comments-filter-modal/comments-filter-modal.module.scss +10 -10
  29. package/src/components/ds-comments-drawer/ds-comments-drawer.module.scss +11 -11
  30. package/src/components/ds-date-input/ds-date-input.module.scss +42 -42
  31. package/src/components/ds-date-picker/components/calendar-table.module.scss +17 -17
  32. package/src/components/ds-date-picker/components/calendar-view-control/calendar-view-control.module.scss +8 -8
  33. package/src/components/ds-date-picker/components/day-view/day-view.module.scss +1 -1
  34. package/src/components/ds-date-picker/ds-date-picker.module.scss +1 -1
  35. package/src/components/ds-date-range-picker/ds-date-range-picker.module.scss +1 -1
  36. package/src/components/ds-dialog/ds-dialog.module.scss +3 -3
  37. package/src/components/ds-divider/ds-divider.module.scss +1 -1
  38. package/src/components/ds-drawer/ds-drawer.module.scss +12 -12
  39. package/src/components/ds-dropdown-menu/ds-dropdown-menu.module.scss +22 -14
  40. package/src/components/ds-dropdown-menu/ds-dropdown-menu.tsx +2 -0
  41. package/src/components/ds-dropdown-menu/ds-dropdown-menu.types.ts +9 -0
  42. package/src/components/ds-expandable-text-input/ds-expandable-text-input.module.scss +1 -1
  43. package/src/components/ds-file-upload/components/file-upload/file-upload.module.scss +22 -22
  44. package/src/components/ds-file-upload/components/file-upload-item/file-upload-item.module.scss +23 -23
  45. package/src/components/ds-filter-status-icon/ds-filter-status-icon.module.scss +5 -5
  46. package/src/components/ds-form-control/ds-form-control.module.scss +13 -13
  47. package/src/components/ds-icon/ds-icon.module.scss +8 -0
  48. package/src/components/ds-key-value-pair/ds-key-value-pair.module.scss +7 -7
  49. package/src/components/ds-modal/ds-modal.module.scss +9 -9
  50. package/src/components/ds-panel/ds-panel.module.scss +16 -16
  51. package/src/components/ds-popover/ds-popover.module.scss +2 -2
  52. package/src/components/ds-progress-arc/ds-progress-arc.module.scss +7 -7
  53. package/src/components/ds-progress-donut/ds-progress-donut.module.scss +7 -7
  54. package/src/components/ds-progress-linear/ds-progress-linear.module.scss +15 -15
  55. package/src/components/ds-segment-group/ds-segment-group.module.scss +18 -18
  56. package/src/components/ds-select/ds-select.module.scss +8 -8
  57. package/src/components/ds-skeleton/ds-skeleton.module.scss +1 -1
  58. package/src/components/ds-smart-tabs/ds-smart-tabs.module.scss +12 -12
  59. package/src/components/ds-smart-tabs/ds-smart-tabs.tsx +9 -9
  60. package/src/components/ds-spinner/ds-spinner.module.scss +1 -1
  61. package/src/components/ds-status-badge/ds-status-badge.module.scss +21 -25
  62. package/src/components/ds-stepper/ds-stepper.module.scss +55 -55
  63. package/src/components/ds-system-status/ds-system-status.module.scss +22 -22
  64. package/src/components/ds-table/components/ds-table-bulk-actions/ds-table-bulk-actions.module.scss +9 -9
  65. package/src/components/ds-table/components/ds-table-cell/ds-table-cell.module.scss +4 -4
  66. package/src/components/ds-table/components/ds-table-header/ds-table-header.module.scss +5 -10
  67. package/src/components/ds-table/components/ds-table-header/ds-table-header.tsx +6 -9
  68. package/src/components/ds-table/components/ds-table-row/ds-table-row.module.scss +13 -22
  69. package/src/components/ds-table/components/ds-table-row/ds-table-row.tsx +11 -18
  70. package/src/components/ds-table/components/ds-table-row-expandable-cell/ds-table-row-expandable-cell.module.scss +0 -7
  71. package/src/components/ds-table/components/ds-table-row-expandable-cell/ds-table-row-expandable-cell.tsx +19 -28
  72. package/src/components/ds-table/components/ds-table-row-expandable-cell/ds-table-row-expandable-cell.types.ts +0 -4
  73. package/src/components/ds-table/components/ds-table-row-selectable-cell/ds-table-row-selectable-cell.tsx +3 -8
  74. package/src/components/ds-table/components/ds-table-row-virtualized/ds-table-row-virtualized.module.scss +15 -11
  75. package/src/components/ds-table/components/ds-table-row-virtualized/ds-table-row-virtualized.tsx +9 -4
  76. package/src/components/ds-table/ds-table.module.scss +9 -2
  77. package/src/components/ds-table/ds-table.tsx +26 -4
  78. package/src/components/ds-table/filters/components/range-filter/range-filter.module.scss +1 -1
  79. package/src/components/ds-table/styles/_mixins.scss +1 -1
  80. package/src/components/ds-table/styles/_variables.scss +5 -6
  81. package/src/components/ds-table/utils/constants.ts +10 -0
  82. package/src/components/ds-tabs/components/ds-tabs-content/ds-tabs-content.module.scss +1 -1
  83. package/src/components/ds-tabs/components/ds-tabs-list/ds-tabs-indicator.module.scss +1 -1
  84. package/src/components/ds-tabs/components/ds-tabs-list/ds-tabs-list.module.scss +3 -3
  85. package/src/components/ds-tabs/components/ds-tabs-tab/ds-tabs-tab.module.scss +55 -55
  86. package/src/components/ds-tabs/ds-tabs.module.scss +1 -1
  87. package/src/components/ds-tag/ds-tag.module.scss +22 -22
  88. package/src/components/ds-tag-filter/ds-tag-filter.module.scss +10 -10
  89. package/src/components/ds-text-input/ds-text-input.module.scss +1 -1
  90. package/src/components/ds-time-picker/components/time-item/time-item.module.scss +8 -8
  91. package/src/components/ds-time-picker/components/time-scroller/time-scroller.module.scss +3 -3
  92. package/src/components/ds-toast/ds-toast.module.scss +11 -11
  93. package/src/components/ds-toggle/ds-toggle.module.scss +18 -18
  94. package/src/components/ds-tooltip/ds-tooltip.module.scss +5 -5
  95. package/src/components/ds-tree/ds-tree.module.scss +27 -27
  96. package/src/components/ds-vertical-tabs/ds-vertical-tabs.module.scss +13 -13
  97. package/src/styles/_root.scss +0 -18
  98. package/src/styles/_root_new.scss +1 -1
  99. package/src/styles/_scrollbars.scss +5 -5
  100. package/src/styles/_typography.scss +18 -14
  101. package/src/styles/mixins/_list.scss +8 -8
  102. package/src/styles/shared/_dropdown.scss +9 -9
  103. package/src/styles/shared/_input.scss +47 -47
@@ -6,12 +6,12 @@ import { DsIcon } from '../../../ds-icon';
6
6
  import { TableCell, TableRow } from '../core-table';
7
7
  import { DsTableCell } from '../ds-table-cell';
8
8
  import { DsTableRowSelectableCell } from '../ds-table-row-selectable-cell';
9
- import { DsTableRowExpandableCell } from '../ds-table-row-expandable-cell';
10
9
  import type { DsTableRowProps } from './ds-table-row.types';
11
10
  import styles from './ds-table-row.module.scss';
12
11
  import { useDsTableContext } from '../../context/ds-table-context';
13
12
  import { mergeRefs } from '../../../../utils/merge-refs';
14
13
  import { getColumnSizeStyle } from '../../utils/column-size';
14
+ import { EXPANDER_COLUMN_ID } from '../../utils/constants';
15
15
 
16
16
  interface DsRowDragHandleProps {
17
17
  isDragging: boolean;
@@ -40,7 +40,6 @@ const DsRowDragHandle = ({ isDragging, attributes, listeners }: DsRowDragHandleP
40
40
 
41
41
  const DsTableRow = <TData,>({ ref, row, isSelected }: DsTableRowProps<TData>) => {
42
42
  const {
43
- expandable,
44
43
  selectable,
45
44
  reorderable,
46
45
  onRowClick,
@@ -53,7 +52,6 @@ const DsTableRow = <TData,>({ ref, row, isSelected }: DsTableRowProps<TData>) =>
53
52
  activeRowId,
54
53
  } = useDsTableContext<TData, unknown>();
55
54
  const isExpanded = row.getIsExpanded();
56
- const isExpandable = typeof expandable === 'function' ? expandable(row.original) : expandable;
57
55
  const isActive = activeRowId === row.id;
58
56
 
59
57
  const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({
@@ -67,7 +65,7 @@ const DsTableRow = <TData,>({ ref, row, isSelected }: DsTableRowProps<TData>) =>
67
65
  transition,
68
66
  ...(isDragging
69
67
  ? {
70
- background: 'var(--action-active-light)',
68
+ background: 'var(--color-dap-purple-200)',
71
69
  boxShadow: '0 0 12px 0 rgba(0, 102, 250, 0.60)',
72
70
  zIndex: 1,
73
71
  }
@@ -99,13 +97,6 @@ const DsTableRow = <TData,>({ ref, row, isSelected }: DsTableRowProps<TData>) =>
99
97
  {selectable && (
100
98
  <DsTableRowSelectableCell row={row} isSelected={isSelected} className={styles.selectableCell} />
101
99
  )}
102
- {expandable && (
103
- <DsTableRowExpandableCell
104
- row={row}
105
- className={styles.expandableCell}
106
- buttonClassName={styles.expandToggleButton}
107
- />
108
- )}
109
100
  {reorderable && (
110
101
  <DsRowDragHandle isDragging={isDragging} attributes={attributes} listeners={listeners} />
111
102
  )}
@@ -114,7 +105,14 @@ const DsTableRow = <TData,>({ ref, row, isSelected }: DsTableRowProps<TData>) =>
114
105
  const cellStyle = getColumnSizeStyle(cell.column.getSize());
115
106
 
116
107
  return (
117
- <TableCell key={cell.id} className={styles.tableCell} style={cellStyle}>
108
+ <TableCell
109
+ key={cell.id}
110
+ className={classnames(
111
+ styles.tableCell,
112
+ cell.column.id === EXPANDER_COLUMN_ID && styles.expandableCell,
113
+ )}
114
+ style={cellStyle}
115
+ >
118
116
  {isLastColumn ? (
119
117
  <DsTableCell
120
118
  row={row}
@@ -133,12 +131,7 @@ const DsTableRow = <TData,>({ ref, row, isSelected }: DsTableRowProps<TData>) =>
133
131
  {isExpanded && renderExpandedRow && (
134
132
  <TableRow className={styles.expandedRow}>
135
133
  <TableCell
136
- colSpan={
137
- row.getVisibleCells().length +
138
- (selectable ? 1 : 0) +
139
- (isExpandable ? 1 : 0) +
140
- (reorderable ? 1 : 0)
141
- }
134
+ colSpan={row.getVisibleCells().length + (selectable ? 1 : 0) + (reorderable ? 1 : 0)}
142
135
  className={styles.tableCell}
143
136
  >
144
137
  {renderExpandedRow(row.original)}
@@ -1,10 +1,3 @@
1
- @use '../../styles/variables' as vars;
2
-
3
- .cell {
4
- width: vars.$expand-column-width;
5
- padding: 0;
6
- }
7
-
8
1
  .button {
9
2
  margin: auto;
10
3
  }
@@ -1,45 +1,36 @@
1
1
  import type React from 'react';
2
2
  import classnames from 'classnames';
3
- import { TableCell } from '../core-table';
4
3
  import { DsButton } from '../../../ds-button';
5
4
  import { DsIcon } from '../../../ds-icon';
6
5
  import stylesShared from '../../styles/shared/ds-table-shared.module.scss';
7
- import { useDsTableContext } from '../../context/ds-table-context';
8
6
  import type { DsTableRowExpandableCellProps } from './ds-table-row-expandable-cell.types';
9
7
  import styles from './ds-table-row-expandable-cell.module.scss';
10
8
 
11
9
  export const DsTableRowExpandableCell = <TData,>({
12
10
  row,
13
- className,
14
11
  buttonClassName,
15
12
  }: DsTableRowExpandableCellProps<TData>) => {
16
- const { expandable } = useDsTableContext<TData, unknown>();
17
13
  const isExpanded = row.getIsExpanded();
18
- const isExpandable = typeof expandable === 'function' ? expandable(row.original) : expandable;
19
14
 
20
15
  return (
21
- <TableCell className={classnames(styles.cell, className)}>
22
- {isExpandable && (
23
- <DsButton
24
- design="v1.2"
25
- buttonType="tertiary"
26
- size="small"
27
- className={classnames(styles.button, buttonClassName)}
28
- onClick={(e: React.MouseEvent) => {
29
- e.stopPropagation();
30
- row.toggleExpanded();
31
- }}
32
- onDoubleClick={(e: React.MouseEvent) => {
33
- e.stopPropagation();
34
- }}
35
- >
36
- <DsIcon
37
- icon="chevron_right"
38
- size="small"
39
- className={classnames(stylesShared.pageButtonIcon, isExpanded && 'rotate-90')}
40
- />
41
- </DsButton>
42
- )}
43
- </TableCell>
16
+ <DsButton
17
+ design="v1.2"
18
+ buttonType="tertiary"
19
+ size="small"
20
+ className={classnames(styles.button, buttonClassName)}
21
+ onClick={(e: React.MouseEvent) => {
22
+ e.stopPropagation();
23
+ row.toggleExpanded();
24
+ }}
25
+ onDoubleClick={(e: React.MouseEvent) => {
26
+ e.stopPropagation();
27
+ }}
28
+ >
29
+ <DsIcon
30
+ icon="chevron_right"
31
+ size="small"
32
+ className={classnames(stylesShared.pageButtonIcon, isExpanded && 'rotate-90')}
33
+ />
34
+ </DsButton>
44
35
  );
45
36
  };
@@ -6,10 +6,6 @@ export interface DsTableRowExpandableCellProps<TData> {
6
6
  * expanded state when the button is clicked.
7
7
  */
8
8
  row: Row<TData>;
9
- /**
10
- * Additional CSS class name applied to the cell element.
11
- */
12
- className?: string;
13
9
  /**
14
10
  * Additional CSS class name applied to the expand/collapse button.
15
11
  */
@@ -17,14 +17,9 @@ export const DsTableRowSelectableCell = <TData,>({
17
17
  className={stylesShared.checkboxContainer}
18
18
  checked={isSelected}
19
19
  disabled={!row.getCanSelect()}
20
- onClick={(e) => {
21
- e.stopPropagation();
22
- const toggleHandler = row.getToggleSelectedHandler();
23
- toggleHandler(e);
24
- }}
25
- onDoubleClick={(e: React.MouseEvent) => {
26
- e.stopPropagation();
27
- }}
20
+ onCheckedChange={(checked) => row.toggleSelected(!!checked)}
21
+ onClick={(e) => e.stopPropagation()}
22
+ onDoubleClick={(e: React.MouseEvent) => e.stopPropagation()}
28
23
  />
29
24
  </TableCell>
30
25
  );
@@ -8,20 +8,20 @@
8
8
  width: 100%;
9
9
 
10
10
  &:hover {
11
- background-color: var(--color-background-secondary);
11
+ background-color: var(--background-secondary);
12
12
  }
13
13
 
14
14
  &[data-state='selected'] {
15
- background-color: var(--color-background-selected-weak);
15
+ background-color: var(--background-secondary-hover);
16
16
  }
17
17
 
18
18
  &[data-state='active'] {
19
- background-color: var(--color-background-selected-weak);
19
+ background-color: var(--background-secondary-hover);
20
20
  }
21
21
 
22
22
  &:not(:last-child):not(.expandedRowContent) {
23
23
  > td {
24
- border-bottom: vars.$border-width solid var(--color-border-secondary);
24
+ border-bottom: vars.$border-width solid var(--border-secondary);
25
25
  }
26
26
  }
27
27
 
@@ -53,27 +53,31 @@
53
53
  }
54
54
 
55
55
  .cell,
56
- .selectableCell,
57
- .expandableCell {
56
+ .selectableCell {
58
57
  display: flex;
59
58
  align-items: center;
60
59
  @include typography.body-sm-reg;
61
- color: var(--color-font-main);
60
+ color: var(--font-main);
62
61
  }
63
62
 
64
63
  .cell {
65
- padding: 0 var(--spacing-standard);
64
+ padding: 0 var(--standard);
65
+ }
66
+
67
+ .expandableCell {
68
+ padding: 0;
69
+ justify-content: center;
66
70
  }
67
71
 
68
72
  .expandedRowContent {
69
- background-color: var(--color-background-secondary);
73
+ background-color: var(--background-secondary);
70
74
 
71
75
  & > td {
72
76
  display: flex;
73
77
  flex-direction: column;
74
78
  flex: 1;
75
- padding: var(--spacing-standard);
76
- background-color: var(--color-background-secondary);
79
+ padding: var(--standard);
80
+ background-color: var(--background-secondary);
77
81
  }
78
82
 
79
83
  @include table-mixins.expanded-row-border('bottom');
@@ -4,9 +4,9 @@ import { useDsTableContext } from '../../context/ds-table-context';
4
4
  import { getColumnSizeStyle } from '../../utils/column-size';
5
5
  import { TableCell, TableRow } from '../core-table';
6
6
  import { DsTableRowSelectableCell } from '../ds-table-row-selectable-cell';
7
- import { DsTableRowExpandableCell } from '../ds-table-row-expandable-cell';
8
7
  import type { DsTableRowVirtualizedProps } from './ds-table-row-virtualized.types';
9
8
  import { DsTableCell } from '../ds-table-cell';
9
+ import { EXPANDER_COLUMN_ID } from '../../utils/constants';
10
10
 
11
11
  export const DsTableRowVirtualized = <TData,>({
12
12
  row,
@@ -19,7 +19,6 @@ export const DsTableRowVirtualized = <TData,>({
19
19
  }: DsTableRowVirtualizedProps<TData>) => {
20
20
  const {
21
21
  selectable,
22
- expandable,
23
22
  bordered,
24
23
  rowSize,
25
24
  activeRowId,
@@ -71,13 +70,19 @@ export const DsTableRowVirtualized = <TData,>({
71
70
  {selectable && (
72
71
  <DsTableRowSelectableCell row={row} isSelected={isSelected} className={styles.selectableCell} />
73
72
  )}
74
- {expandable && <DsTableRowExpandableCell row={row} className={styles.expandableCell} />}
75
73
  {row.getVisibleCells().map((cell, idx) => {
76
74
  const isLastColumn = idx === row.getVisibleCells().length - 1;
77
75
  const cellStyle = getColumnSizeStyle(cell.column.getSize(), true);
78
76
 
79
77
  return (
80
- <TableCell key={cell.id} style={cellStyle} className={styles.cell}>
78
+ <TableCell
79
+ key={cell.id}
80
+ style={cellStyle}
81
+ className={classnames(
82
+ styles.cell,
83
+ cell.column.id === EXPANDER_COLUMN_ID && styles.expandableCell,
84
+ )}
85
+ >
81
86
  {isLastColumn ? (
82
87
  <DsTableCell
83
88
  row={row}
@@ -2,14 +2,21 @@
2
2
  @use '../../styles/utilities' as utils;
3
3
  @use './styles/variables' as vars;
4
4
 
5
+ :root {
6
+ --ds-table-row-small: 36px;
7
+ --ds-table-row-medium: 48px;
8
+ --ds-table-row-large: 64px;
9
+ --ds-table-header-height: 45px;
10
+ }
11
+
5
12
  $bulk-actions-height: 60px;
6
13
 
7
14
  .container {
8
15
  border-radius: vars.$border-radius;
9
16
  border-width: vars.$border-width;
10
17
  border-style: solid;
11
- border-color: var(--neutral-6);
12
- background: var(--color-background);
18
+ border-color: var(--color-dap-gray-400);
19
+ background: var(--background);
13
20
  }
14
21
 
15
22
  .dataTableContainer {
@@ -1,9 +1,11 @@
1
1
  import * as React from 'react';
2
- import { useImperativeHandle } from 'react';
2
+ import { useImperativeHandle, useMemo } from 'react';
3
3
  import {
4
+ type ColumnDef,
4
5
  type RowSelectionState,
5
6
  type ColumnFiltersState,
6
7
  getCoreRowModel,
8
+ getExpandedRowModel,
7
9
  getFilteredRowModel,
8
10
  getSortedRowModel,
9
11
  type SortingState,
@@ -17,10 +19,11 @@ import { DsTableHeader } from './components/ds-table-header';
17
19
  import styles from './ds-table.module.scss';
18
20
  import type { DsDataTableProps, DsTableRowSize } from './ds-table.types';
19
21
  import { DsTableRow } from './components/ds-table-row';
22
+ import { DsTableRowExpandableCell } from './components/ds-table-row-expandable-cell';
20
23
  import { useDragAndDrop } from './hooks/use-drag-and-drop';
21
24
  import { type DsTableContextType, DsTableContext } from './context/ds-table-context';
22
25
  import { DsTableBodyVirtualized } from './components/ds-table-body-virtualized';
23
- import { EMPTY_TABLE_STATE_TEXT } from './utils/constants';
26
+ import { EMPTY_TABLE_STATE_TEXT, EXPANDER_COLUMN_ID, EXPANDER_COLUMN_WIDTH } from './utils/constants';
24
27
 
25
28
  // Row size to pixel height mapping (matches CSS variables)
26
29
  const ROW_SIZE_HEIGHT_MAP: Record<DsTableRowSize, number> = {
@@ -34,7 +37,7 @@ const ROW_SIZE_HEIGHT_MAP: Record<DsTableRowSize, number> = {
34
37
  */
35
38
  const DsTable = <TData extends { id: string }, TValue>({
36
39
  ref,
37
- columns,
40
+ columns: columnsProp,
38
41
  data: tableData,
39
42
  virtualized = false,
40
43
  virtualizedOptions,
@@ -122,6 +125,23 @@ const DsTable = <TData extends { id: string }, TValue>({
122
125
  onSelectionChange?.(newRowSelection);
123
126
  };
124
127
 
128
+ const columns = useMemo<ColumnDef<TData, TValue>[]>(() => {
129
+ if (!expandable) {
130
+ return columnsProp;
131
+ }
132
+
133
+ const expanderColumn: ColumnDef<TData, TValue> = {
134
+ id: EXPANDER_COLUMN_ID,
135
+ size: EXPANDER_COLUMN_WIDTH,
136
+ enableSorting: false,
137
+ enableResizing: false,
138
+ header: () => null,
139
+ cell: ({ row }) => (row.getCanExpand() ? <DsTableRowExpandableCell row={row} /> : null),
140
+ };
141
+
142
+ return [expanderColumn, ...columnsProp];
143
+ }, [columnsProp, expandable]);
144
+
125
145
  const table = useReactTable({
126
146
  data: reorderable ? data : tableData,
127
147
  columns,
@@ -133,6 +153,8 @@ const DsTable = <TData extends { id: string }, TValue>({
133
153
  onColumnVisibilityChange: handleColumnVisibilityChange, // TODO: looks like this is not used, since visibility is handled from the outside
134
154
  onRowSelectionChange: handleRowSelectionChange,
135
155
  getRowId: (row) => row.id,
156
+ getExpandedRowModel: getExpandedRowModel(),
157
+ getRowCanExpand: typeof expandable === 'function' ? (row) => expandable(row.original) : () => expandable,
136
158
  state: {
137
159
  sorting,
138
160
  columnFilters,
@@ -191,7 +213,7 @@ const DsTable = <TData extends { id: string }, TValue>({
191
213
  const renderEmptyState = () => (
192
214
  <TableRow>
193
215
  <TableCell
194
- colSpan={columns.length + (expandable ? 1 : 0) + (selectable ? 1 : 0)}
216
+ colSpan={columns.length + (selectable ? 1 : 0) + (reorderable ? 1 : 0)}
195
217
  className={styles.emptyState}
196
218
  >
197
219
  {emptyState || EMPTY_TABLE_STATE_TEXT}
@@ -3,7 +3,7 @@
3
3
  flex-direction: column;
4
4
  gap: 10px;
5
5
  padding-bottom: 16px;
6
- border-bottom: 1px solid var(--color-border);
6
+ border-bottom: 1px solid var(--border);
7
7
  }
8
8
 
9
9
  .header {
@@ -1,5 +1,5 @@
1
1
  @mixin expanded-row-border($side) {
2
- $border: 1px solid var(--color-border-action-primary);
2
+ $border: 1px solid var(--border-action-primary);
3
3
 
4
4
  &:not(.expandedRow + &) > td {
5
5
  border-#{$side}: $border;
@@ -1,7 +1,6 @@
1
1
  $border-radius: 4px;
2
2
  $border-width: 1px;
3
3
  $virtualized-height: 600px;
4
- $expand-column-width: 36px;
5
4
  $select-column-width: 36px;
6
5
  $reorder-column-width: 60px;
7
6
  $container-margin-vertical: 1rem;
@@ -10,8 +9,8 @@ $filter-input-max-width: 24rem;
10
9
  $header-sort-gap: 0.5rem;
11
10
  $empty-state-height: 6rem;
12
11
 
13
- $hover-bg-color: var(--color-background-secondary);
14
- $hover-border-color: var(--color-border);
15
- $expanded-row-bg-color: var(--color-background-secondary);
16
- $expand-toggle-hover-bg-color: var(--color-background-action-hover-weak);
17
- $expand-toggle-icon-color: var(--color-icon-information-main);
12
+ $hover-bg-color: var(--background-secondary);
13
+ $hover-border-color: var(--border);
14
+ $expanded-row-bg-color: var(--background-secondary);
15
+ $expand-toggle-hover-bg-color: var(--background-action-hover-weak);
16
+ $expand-toggle-icon-color: var(--icon-information-main);
@@ -2,3 +2,13 @@
2
2
  * Default text for empty table state
3
3
  */
4
4
  export const EMPTY_TABLE_STATE_TEXT = 'No results.';
5
+
6
+ /**
7
+ * Column id used for the synthetic expander column injected when `expandable` is set.
8
+ */
9
+ export const EXPANDER_COLUMN_ID = 'expander';
10
+
11
+ /**
12
+ * Width (in px) of the expander column.
13
+ */
14
+ export const EXPANDER_COLUMN_WIDTH = 36;
@@ -2,7 +2,7 @@ $animation-duration: 0.2s;
2
2
  $animation-translate: -4px;
3
3
 
4
4
  .tabContent {
5
- padding: var(--spacing-standard) 0;
5
+ padding: var(--standard) 0;
6
6
  animation: fadeIn $animation-duration ease-in;
7
7
 
8
8
  &[data-state='closed'] {
@@ -5,7 +5,7 @@ $transition-duration: 0.2s;
5
5
 
6
6
  .indicator {
7
7
  position: absolute;
8
- background: var(--color-background-selected);
8
+ background: var(--background-primary);
9
9
  transition:
10
10
  left $transition-duration ease-in-out,
11
11
  top $transition-duration ease-in-out,
@@ -8,7 +8,7 @@ $border-width: 1px;
8
8
  flex-direction: row;
9
9
  align-items: center;
10
10
  border-bottom: $border-width solid var(--color-border-main);
11
- gap: var(--spacing-xs);
11
+ gap: var(--xs);
12
12
  }
13
13
 
14
14
  [data-orientation='vertical'] & {
@@ -18,10 +18,10 @@ $border-width: 1px;
18
18
  }
19
19
 
20
20
  [data-orientation='vertical'][data-size='medium'] & {
21
- gap: var(--spacing-xs);
21
+ gap: var(--xs);
22
22
  }
23
23
 
24
24
  [data-orientation='vertical'][data-size='small'] & {
25
- gap: var(--spacing-3xs);
25
+ gap: var(--3xs);
26
26
  }
27
27
  }