@dbcdk/react-components 0.0.95 → 0.0.97

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 (226) hide show
  1. package/dist/components/alert/Alert.d.ts +13 -0
  2. package/dist/components/forms/input/Input.d.ts +2 -1
  3. package/dist/components/forms/input-container/InputContainer.d.ts +3 -1
  4. package/dist/components/forms/text-area/Textarea.d.ts +1 -1
  5. package/dist/components/stack/Stack.d.ts +11 -3
  6. package/dist/components/table/Table.d.ts +1 -1
  7. package/dist/components/table/Table.types.d.ts +3 -0
  8. package/dist/components/table/components/TableHeader.d.ts +2 -1
  9. package/dist/index.cjs +12750 -0
  10. package/dist/index.css +7149 -0
  11. package/dist/index.d.ts +1 -0
  12. package/dist/index.js +12641 -78
  13. package/dist/tanstack.cjs +2674 -0
  14. package/dist/tanstack.css +1267 -0
  15. package/dist/tanstack.js +2650 -3
  16. package/dist/themes/dbc.css +3 -0
  17. package/dist/themes/forfatterweb.css +2 -0
  18. package/package.json +11 -10
  19. package/dist/assets/logo.js +0 -2
  20. package/dist/components/__stories__/_data/table.d.ts +0 -15
  21. package/dist/components/__stories__/_data/table.js +0 -55
  22. package/dist/components/__stories__/_data/tabs.d.ts +0 -9
  23. package/dist/components/__stories__/_data/tabs.js +0 -31
  24. package/dist/components/__stories__/story-components/Colors.d.ts +0 -11
  25. package/dist/components/__stories__/story-components/Colors.js +0 -96
  26. package/dist/components/__stories__/story-components/Colors.module.css +0 -27
  27. package/dist/components/__stories__/story-components/ComponentSizes.d.ts +0 -2
  28. package/dist/components/__stories__/story-components/ComponentSizes.js +0 -26
  29. package/dist/components/__stories__/story-components/Elevation.d.ts +0 -2
  30. package/dist/components/__stories__/story-components/Elevation.js +0 -49
  31. package/dist/components/__stories__/story-components/Flex.d.ts +0 -2
  32. package/dist/components/__stories__/story-components/Flex.js +0 -177
  33. package/dist/components/__stories__/story-components/Flex.module.css +0 -317
  34. package/dist/components/__stories__/story-components/Spacing.d.ts +0 -6
  35. package/dist/components/__stories__/story-components/Spacing.js +0 -76
  36. package/dist/components/__stories__/story-components/Spacing.module.css +0 -154
  37. package/dist/components/accordion/Accordion.js +0 -70
  38. package/dist/components/accordion/Accordion.module.css +0 -28
  39. package/dist/components/accordion/components/AccordionRow.js +0 -53
  40. package/dist/components/accordion/components/AccordionRow.module.css +0 -90
  41. package/dist/components/app-header/AppHeader.js +0 -5
  42. package/dist/components/app-header/AppHeader.module.css +0 -74
  43. package/dist/components/attribute-chip/AttributeChip.js +0 -5
  44. package/dist/components/attribute-chip/AttributeChip.module.css +0 -65
  45. package/dist/components/avatar/Avatar.js +0 -48
  46. package/dist/components/avatar/Avatar.module.css +0 -91
  47. package/dist/components/breadcrumbs/Breadcrumbs.js +0 -6
  48. package/dist/components/breadcrumbs/Breadcrumbs.module.css +0 -80
  49. package/dist/components/button/Button.js +0 -81
  50. package/dist/components/button/Button.module.css +0 -249
  51. package/dist/components/button-select/ButtonSelect.js +0 -7
  52. package/dist/components/button-select/ButtonSelect.module.css +0 -40
  53. package/dist/components/card/Card.js +0 -71
  54. package/dist/components/card/Card.module.css +0 -160
  55. package/dist/components/card/components/CardMeta.js +0 -26
  56. package/dist/components/card/components/CardMeta.module.css +0 -55
  57. package/dist/components/card-container/CardContainer.js +0 -6
  58. package/dist/components/card-container/CardContainer.module.css +0 -61
  59. package/dist/components/chip/Chip.js +0 -31
  60. package/dist/components/chip/Chip.module.css +0 -236
  61. package/dist/components/circle/Circle.js +0 -5
  62. package/dist/components/circle/Circle.module.css +0 -128
  63. package/dist/components/clear-button/ClearButton.js +0 -13
  64. package/dist/components/clear-button/ClearButton.module.css +0 -26
  65. package/dist/components/code-block/CodeBlock.js +0 -58
  66. package/dist/components/code-block/CodeBlock.module.css +0 -124
  67. package/dist/components/copy-button/CopyButton.js +0 -78
  68. package/dist/components/copy-button/CopyButton.module.css +0 -22
  69. package/dist/components/datetime-picker/DateTimePicker.js +0 -403
  70. package/dist/components/datetime-picker/DateTimePicker.module.css +0 -155
  71. package/dist/components/datetime-picker/dateTimeHelpers.js +0 -248
  72. package/dist/components/divider/Divider.js +0 -12
  73. package/dist/components/filter-field/FilterField.js +0 -191
  74. package/dist/components/filter-field/FilterField.module.css +0 -379
  75. package/dist/components/filtering/chip-multi-toggle/ChipMultiToggle.js +0 -52
  76. package/dist/components/filtering/chip-multi-toggle/ChipMultiToggle.module.css +0 -59
  77. package/dist/components/forms/checkbox/Checkbox.js +0 -26
  78. package/dist/components/forms/checkbox/Checkbox.module.css +0 -99
  79. package/dist/components/forms/checkbox-group/CheckboxGroup.js +0 -75
  80. package/dist/components/forms/checkbox-group/CheckboxGroup.module.css +0 -115
  81. package/dist/components/forms/form-select/FormSelect.js +0 -86
  82. package/dist/components/forms/form-select/FormSelect.module.css +0 -236
  83. package/dist/components/forms/input/Input.js +0 -77
  84. package/dist/components/forms/input/Input.module.css +0 -468
  85. package/dist/components/forms/input-container/InputContainer.js +0 -15
  86. package/dist/components/forms/input-container/InputContainer.module.css +0 -56
  87. package/dist/components/forms/multi-select/MultiSelect.js +0 -122
  88. package/dist/components/forms/radio-buttons/RadioButton.js +0 -26
  89. package/dist/components/forms/radio-buttons/RadioButtonGroup.js +0 -19
  90. package/dist/components/forms/radio-buttons/RadioButtons.module.css +0 -118
  91. package/dist/components/forms/select/Select.js +0 -185
  92. package/dist/components/forms/select/Select.module.css +0 -32
  93. package/dist/components/forms/text-area/Textarea.js +0 -47
  94. package/dist/components/forms/text-area/Textarea.module.css +0 -70
  95. package/dist/components/forms/typeahead/Typeahead.js +0 -668
  96. package/dist/components/forms/typeahead/Typeahead.module.css +0 -38
  97. package/dist/components/grid/Grid.js +0 -23
  98. package/dist/components/grid/Grid.module.css +0 -35
  99. package/dist/components/headline/CollapsibleHeadline.js +0 -29
  100. package/dist/components/headline/Headline.js +0 -26
  101. package/dist/components/headline/Headline.module.css +0 -165
  102. package/dist/components/hyperlink/Hyperlink.js +0 -40
  103. package/dist/components/hyperlink/Hyperlink.module.css +0 -107
  104. package/dist/components/icon/Icon.js +0 -14
  105. package/dist/components/icon/Icon.module.css +0 -36
  106. package/dist/components/interval-select/IntervalSelect.js +0 -99
  107. package/dist/components/json-viewer/HighlightedText.js +0 -6
  108. package/dist/components/json-viewer/JsonNode.js +0 -30
  109. package/dist/components/json-viewer/JsonViewer.js +0 -68
  110. package/dist/components/json-viewer/JsonViewer.module.css +0 -346
  111. package/dist/components/json-viewer/types.js +0 -1
  112. package/dist/components/json-viewer/useClipboardStatus.js +0 -11
  113. package/dist/components/json-viewer/utils.js +0 -125
  114. package/dist/components/menu/Menu.js +0 -165
  115. package/dist/components/menu/Menu.module.css +0 -211
  116. package/dist/components/meta-bar/MetaBar.js +0 -9
  117. package/dist/components/meta-bar/MetaBar.module.css +0 -27
  118. package/dist/components/nav-bar/NavBar.js +0 -29
  119. package/dist/components/nav-bar/NavBar.module.css +0 -200
  120. package/dist/components/overlay/fade-overlay/FadeOverlay.js +0 -8
  121. package/dist/components/overlay/fade-overlay/FadeOverlay.module.css +0 -54
  122. package/dist/components/overlay/modal/Modal.js +0 -115
  123. package/dist/components/overlay/modal/Modal.module.css +0 -109
  124. package/dist/components/overlay/modal/provider/ModalProvider.js +0 -73
  125. package/dist/components/overlay/side-panel/SidePanel.js +0 -83
  126. package/dist/components/overlay/side-panel/SidePanel.module.css +0 -177
  127. package/dist/components/overlay/side-panel/useSidePanel.js +0 -11
  128. package/dist/components/overlay/tooltip/Tooltip.js +0 -17
  129. package/dist/components/overlay/tooltip/Tooltip.module.css +0 -104
  130. package/dist/components/overlay/tooltip/TooltipProvider.js +0 -255
  131. package/dist/components/overlay/tooltip/useTooltipTrigger.js +0 -118
  132. package/dist/components/page/Page.js +0 -11
  133. package/dist/components/page/Page.module.css +0 -76
  134. package/dist/components/page-layout/PageLayout.js +0 -76
  135. package/dist/components/page-layout/PageLayout.module.css +0 -236
  136. package/dist/components/page-layout/components/layout-footer/LayoutFooter.js +0 -27
  137. package/dist/components/page-layout/components/layout-footer/LayoutFooter.module.css +0 -89
  138. package/dist/components/page-layout/components/page-layout-hero/PageLayoutHero.js +0 -14
  139. package/dist/components/page-layout/components/page-layout-hero/PageLayoutHero.module.css +0 -84
  140. package/dist/components/pagination/Pagination.js +0 -56
  141. package/dist/components/pagination/Pagination.module.css +0 -25
  142. package/dist/components/panel/Panel.js +0 -7
  143. package/dist/components/panel/Panel.module.css +0 -29
  144. package/dist/components/popover/Popover.js +0 -257
  145. package/dist/components/popover/Popover.module.css +0 -54
  146. package/dist/components/search-box/SearchBox.js +0 -170
  147. package/dist/components/search-box/SearchBox.module.css +0 -21
  148. package/dist/components/segmented-progress-bar/SegmentedProgressBar.js +0 -48
  149. package/dist/components/segmented-progress-bar/SegmentedProgressBar.module.css +0 -167
  150. package/dist/components/sidebar/Sidebar.js +0 -6
  151. package/dist/components/sidebar/components/SidebarItem.js +0 -8
  152. package/dist/components/sidebar/components/SidebarItem.module.css +0 -0
  153. package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.js +0 -63
  154. package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.module.css +0 -29
  155. package/dist/components/sidebar/components/sidebar-container/SidebarContainer.js +0 -153
  156. package/dist/components/sidebar/components/sidebar-container/SidebarContainer.module.css +0 -260
  157. package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.js +0 -18
  158. package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.module.css +0 -106
  159. package/dist/components/sidebar/components/sidebar-items/SidebarItems.js +0 -26
  160. package/dist/components/sidebar/components/sidebar-items/SidebarItems.module.css +0 -20
  161. package/dist/components/sidebar/components/sidenav-filteirng/SidenavFiltering.js +0 -30
  162. package/dist/components/sidebar/providers/SidebarProvider.js +0 -229
  163. package/dist/components/skeleton-loader/SkeletonLoader.js +0 -73
  164. package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.js +0 -13
  165. package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.module.css +0 -51
  166. package/dist/components/split-button/SplitButton.js +0 -10
  167. package/dist/components/split-button/SplitButton.module.css +0 -32
  168. package/dist/components/split-pane/SplitPane.js +0 -107
  169. package/dist/components/split-pane/SplitPane.module.css +0 -111
  170. package/dist/components/split-pane/provider/SplitPaneContext.js +0 -124
  171. package/dist/components/stack/Stack.js +0 -19
  172. package/dist/components/state-page/StatePage.js +0 -20
  173. package/dist/components/state-page/StatePage.module.css +0 -9
  174. package/dist/components/state-page/empty.js +0 -2
  175. package/dist/components/state-page/error.js +0 -2
  176. package/dist/components/state-page/notFound.js +0 -2
  177. package/dist/components/sticky-footer-layout/StickyFooterLayout.js +0 -64
  178. package/dist/components/table/Table.js +0 -50
  179. package/dist/components/table/Table.module.css +0 -536
  180. package/dist/components/table/Table.types.js +0 -1
  181. package/dist/components/table/TanstackTable.js +0 -111
  182. package/dist/components/table/components/TableBody.js +0 -10
  183. package/dist/components/table/components/TableHeader.js +0 -7
  184. package/dist/components/table/components/TableHeaderCell.js +0 -24
  185. package/dist/components/table/components/TableLoadingBody.js +0 -26
  186. package/dist/components/table/components/TablePagination.js +0 -1
  187. package/dist/components/table/components/TableRow.js +0 -54
  188. package/dist/components/table/components/TableSelectionCell.js +0 -16
  189. package/dist/components/table/components/column-resizer/ColumnResizer.js +0 -5
  190. package/dist/components/table/components/column-resizer/ColumnResizer.module.css +0 -22
  191. package/dist/components/table/components/empty-state/EmptyState.js +0 -23
  192. package/dist/components/table/components/empty-state/EmptyState.module.css +0 -4
  193. package/dist/components/table/components/table-settings/TableSettings.js +0 -63
  194. package/dist/components/table/hooks/useTableRowInteractions.js +0 -30
  195. package/dist/components/table/table.classes.js +0 -23
  196. package/dist/components/table/table.utils.js +0 -47
  197. package/dist/components/table/tanstackTable.utils.js +0 -175
  198. package/dist/components/tabs/Tabs.js +0 -125
  199. package/dist/components/tabs/Tabs.module.css +0 -204
  200. package/dist/components/theme-button/ThemeButton.js +0 -23
  201. package/dist/components/toast/Toast.js +0 -20
  202. package/dist/components/toast/Toast.module.css +0 -161
  203. package/dist/components/toast/provider/ToastProvider.js +0 -70
  204. package/dist/components/user-display/UserDisplay.js +0 -6
  205. package/dist/components/user-display/UserDisplay.module.css +0 -25
  206. package/dist/constants/severity.js +0 -24
  207. package/dist/constants/severity.types.js +0 -1
  208. package/dist/constants/sizes.js +0 -7
  209. package/dist/hooks/useDeviceSize.js +0 -32
  210. package/dist/hooks/useListNavigation.js +0 -234
  211. package/dist/hooks/usePagination.js +0 -140
  212. package/dist/hooks/useSorting.js +0 -118
  213. package/dist/hooks/useTableData.js +0 -45
  214. package/dist/hooks/useTableSelection.js +0 -164
  215. package/dist/hooks/useTableSettings.js +0 -71
  216. package/dist/hooks/useTheme.js +0 -66
  217. package/dist/hooks/useTimeDuration.js +0 -68
  218. package/dist/hooks/useViewportFill.js +0 -77
  219. package/dist/styles/animation.js +0 -5
  220. package/dist/styles/themes/types.js +0 -1
  221. package/dist/types/a11y-props.types.js +0 -1
  222. package/dist/types/sizes.types.js +0 -1
  223. package/dist/utils/arrays/nested-filtering.js +0 -48
  224. package/dist/utils/date/formatDate.js +0 -51
  225. package/dist/utils/localStorage.utils.js +0 -78
  226. package/dist/utils/text/get-highlighted-segments.js +0 -46
@@ -1,50 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useCallback, useId, useMemo, useRef } from 'react';
4
- import { Pagination } from '../../components/pagination/Pagination';
5
- import { useViewportFill } from '../../hooks/useViewportFill';
6
- import { TableEmptyState } from './components/empty-state/EmptyState';
7
- import { TableBody } from './components/TableBody';
8
- import { TableHeader } from './components/TableHeader';
9
- import { TableLoadingBody } from './components/TableLoadingBody';
10
- import { cx } from './table.classes';
11
- import styles from './Table.module.css';
12
- import { getVisibleColumns, SELECTION_COLUMN_PX } from './table.utils';
13
- export function Table({ data, dataKey, columns, selectedRows, selectionMode = 'single', allRowsSelected, sortById, sortDirection, loading, emptyConfig, variant = 'primary', size = 'md', viewMode, striped, fillViewport = false, fillViewportBottomOffset = 16, tableWidth, tableRootRef, measuringLayout = false, toolbar, headerExtras, take, skip, totalItemsCount, paginationPlacement = 'bottom', showFirstLast = false, pageSizeOptions, getRowSeverity, onRowClick, onRowMouseEnter, onRowSelect, onSelectAllRows, onSortChange, onPageChange, ...rest }) {
14
- const visibleColumns = useMemo(() => getVisibleColumns(columns), [columns]);
15
- const selectionInputName = useId();
16
- const internalTableRootRef = useRef(null);
17
- const tableRootRefWrapper = useRef(tableRootRef);
18
- const hasSelection = Boolean(selectedRows && onRowSelect);
19
- const hasPagination = Boolean(onPageChange && (loading || data.length > 0));
20
- const paginationOffset = hasPagination ? 72 : 0;
21
- const { style: viewportFillStyle } = useViewportFill(internalTableRootRef, {
22
- bottomOffset: fillViewportBottomOffset + paginationOffset,
23
- min: 120,
24
- });
25
- const setTableRootRef = useCallback((node) => {
26
- internalTableRootRef.current = node;
27
- if (typeof tableRootRefWrapper.current === 'function') {
28
- tableRootRefWrapper.current(node);
29
- }
30
- else if (tableRootRefWrapper.current) {
31
- tableRootRefWrapper.current.current = node;
32
- }
33
- }, []);
34
- const handlePageChange = useCallback((e) => {
35
- onPageChange === null || onPageChange === void 0 ? void 0 : onPageChange(e);
36
- }, [onPageChange]);
37
- const bodyContent = loading && !data.length ? (_jsx(TableLoadingBody, { rows: take !== null && take !== void 0 ? take : 5, columns: visibleColumns, hasSelection: hasSelection })) : (_jsx(TableBody, { data: data, dataKey: dataKey, columns: visibleColumns, striped: striped, selectedRows: selectedRows, hasSelection: hasSelection, selectionMode: selectionMode, selectionInputName: selectionInputName, viewMode: viewMode, getRowSeverity: getRowSeverity, onRowClick: onRowClick, onRowMouseEnter: onRowMouseEnter, onRowSelect: onRowSelect }));
38
- const paginationEl = hasPagination ? (_jsx("div", { className: cx(styles.paginationSlot, paginationPlacement === 'top' && styles.paginationSlotTop), children: _jsx(Pagination, { itemsCount: totalItemsCount, take: take, skip: skip, onPageChange: handlePageChange, showFirstLast: showFirstLast, pageSizeOptions: pageSizeOptions }) })) : null;
39
- const tableClassName = cx(styles.tableRoot, styles[variant], styles[size], measuringLayout && styles.measuringLayout, getRowSeverity && styles.severityTable);
40
- const tableShell = (_jsx("div", { ...rest, className: tableClassName, children: _jsx("div", { ref: setTableRootRef, className: styles.tableScroll, style: fillViewport ? viewportFillStyle : undefined, children: !data.length && !loading ? (_jsx("div", { className: styles.emptyStateSlot, children: _jsx(TableEmptyState, { config: emptyConfig }) })) : (_jsxs("table", { className: styles.tableElement, "aria-rowcount": data.length, style: tableWidth != null ? { width: tableWidth } : undefined, children: [_jsxs("colgroup", { children: [hasSelection ? _jsx("col", { style: { width: SELECTION_COLUMN_PX } }) : null, visibleColumns.map(column => (_jsx("col", { style: column.width != null ? { width: column.width } : undefined }, column.id)))] }), _jsx(TableHeader, { columns: visibleColumns, hasSelection: hasSelection, selectionMode: selectionMode, allRowsSelected: allRowsSelected, onSelectAllRows: onSelectAllRows, sortById: sortById, sortDirection: sortDirection, onSortChange: onSortChange, headerExtras: headerExtras }), bodyContent] })) }) }));
41
- if (fillViewport) {
42
- return (_jsxs("div", { className: styles.fillViewportRoot, style: {
43
- flexDirection: paginationPlacement === 'top' ? 'column-reverse' : 'column',
44
- }, children: [toolbar ? _jsx("div", { className: styles.toolbarSlot, children: toolbar }) : null, _jsx("div", { className: styles.tableViewport, children: tableShell }), paginationEl] }));
45
- }
46
- return (_jsxs("div", { className: "dbc-flex dbc-flex-column dbc-gap-md", style: {
47
- flexFlow: paginationPlacement === 'top' ? 'column-reverse' : 'column',
48
- position: 'relative',
49
- }, children: [toolbar ? _jsx("div", { className: styles.toolbarSlot, children: toolbar }) : null, tableShell, paginationEl] }));
50
- }
@@ -1,536 +0,0 @@
1
- .fillViewportRoot {
2
- display: flex;
3
- position: relative;
4
- block-size: 100%;
5
- min-block-size: 0;
6
- min-inline-size: 0;
7
- overflow: hidden;
8
- }
9
-
10
- .inlineRoot {
11
- display: flex;
12
- flex-direction: column;
13
- min-block-size: 0;
14
- min-inline-size: 0;
15
- inline-size: 100%;
16
- max-inline-size: 100%;
17
- position: relative;
18
- }
19
-
20
- .toolbarSlot {
21
- margin-bottom: 12px;
22
- flex: 0 0 auto;
23
- }
24
-
25
- .tableViewport {
26
- flex: 1 1 auto;
27
- min-block-size: 0;
28
- min-inline-size: 0;
29
- display: flex;
30
- flex-direction: column;
31
- overflow: hidden;
32
- }
33
-
34
- .paginationSlot {
35
- flex: 0 0 auto;
36
- overflow: visible;
37
- margin-top: auto;
38
- }
39
-
40
- .paginationSlot:not(.paginationSlotTop) {
41
- padding-top: var(--spacing-sm);
42
- }
43
-
44
- .paginationSlot.paginationSlotTop {
45
- padding-bottom: var(--spacing-sm);
46
- }
47
-
48
- .tableRoot {
49
- display: flex;
50
- flex-direction: column;
51
- flex: 1 1 auto;
52
- min-block-size: 0;
53
- min-inline-size: 0;
54
- inline-size: 100%;
55
- max-inline-size: 100%;
56
- }
57
-
58
- .measuringLayout {
59
- visibility: hidden;
60
- }
61
-
62
- .tableScroll {
63
- flex: 1 1 auto;
64
- min-block-size: 0;
65
- min-inline-size: 0;
66
- overflow: auto;
67
- background: var(--table-row-bg);
68
- -webkit-overflow-scrolling: touch;
69
- }
70
-
71
- .tableElement {
72
- inline-size: 100%;
73
- min-inline-size: 100%;
74
- border-collapse: separate;
75
- border-spacing: 0;
76
- table-layout: fixed;
77
- font-family: var(--font-family);
78
- font-size: var(--font-size-sm);
79
- color: var(--table-cell-fg);
80
- background: var(--table-row-bg);
81
- }
82
-
83
- .header {
84
- position: relative;
85
- z-index: 10;
86
- }
87
-
88
- .headerRow,
89
- .row {
90
- position: relative;
91
- }
92
-
93
- .emptyStateSlot {
94
- display: grid;
95
- place-items: center;
96
- min-block-size: 100%;
97
- padding: var(--spacing-lg);
98
- }
99
-
100
- .body {
101
- min-block-size: 0;
102
- }
103
-
104
- .body .row:first-child .cell {
105
- border-block-start: var(--spacing-xs) solid var(--table-row-bg);
106
- }
107
-
108
- .headerCell,
109
- .cell {
110
- position: relative;
111
- box-sizing: border-box;
112
- min-width: 0;
113
- vertical-align: top;
114
- text-align: start;
115
- }
116
-
117
- .headerCell {
118
- position: sticky;
119
- top: 0;
120
- z-index: 6;
121
- vertical-align: middle;
122
- background-color: var(--table-header-bg);
123
- border-block-end: 1px solid var(--table-border-header);
124
- padding-block: var(--spacing-xxs);
125
- padding-inline: var(--spacing-sm);
126
- font-size: var(--font-size-xs);
127
- font-weight: var(--font-weight-medium);
128
- letter-spacing: var(--letter-spacing-wide);
129
- text-transform: uppercase;
130
- color: var(--table-header-fg);
131
- white-space: nowrap;
132
- }
133
-
134
- .cell {
135
- padding-block: 6px;
136
- padding-inline: var(--spacing-sm);
137
- border-block-end: 1px solid var(--table-border-subtle);
138
- background: var(--table-row-bg);
139
- overflow: hidden;
140
- line-height: 20px;
141
- }
142
-
143
- .md .headerCell {
144
- padding-block: var(--spacing-xs);
145
- padding-inline: var(--spacing-sm);
146
- }
147
-
148
- .md .cell {
149
- padding-block: var(--spacing-xs);
150
- padding-inline: var(--spacing-sm);
151
- }
152
-
153
- .sm .headerCell {
154
- padding-block: var(--spacing-xxs);
155
- padding-inline: var(--spacing-sm);
156
- }
157
-
158
- .sm .cell {
159
- padding-block: var(--spacing-xxs);
160
- padding-inline: var(--spacing-sm);
161
- font-size: var(--font-size-xs);
162
- line-height: 20px;
163
- }
164
-
165
- .cell[data-vertical-align='top'] {
166
- vertical-align: top;
167
- }
168
-
169
- .cell[data-vertical-align='middle'] {
170
- vertical-align: middle;
171
- }
172
-
173
- .cell[data-vertical-align='bottom'] {
174
- vertical-align: bottom;
175
- }
176
-
177
- .headerCell[data-align='right'],
178
- .cell[data-align='right'] {
179
- text-align: end;
180
- font-variant-numeric: tabular-nums;
181
- }
182
-
183
- .headerCell[data-align='center'],
184
- .cell[data-align='center'] {
185
- text-align: center;
186
- }
187
-
188
- .headerCell.selectionCell,
189
- .cell.selectionCell {
190
- padding-inline: calc(var(--spacing-xxs) + 6px) var(--spacing-sm);
191
- cursor: pointer;
192
- overflow: visible;
193
- line-height: 0;
194
- }
195
-
196
- .headerCell.selectionCell {
197
- padding-block: var(--spacing-xxs);
198
- vertical-align: middle;
199
- }
200
-
201
- .cell.selectionCell {
202
- vertical-align: top;
203
- padding-block: var(--spacing-xxs);
204
- }
205
-
206
- .selectionHitArea {
207
- display: inline-flex;
208
- align-items: flex-start;
209
- justify-content: flex-start;
210
- min-block-size: 0;
211
- padding: 0;
212
- line-height: 0;
213
- }
214
-
215
- .selectionControlWrap {
216
- display: inline-flex;
217
- align-items: flex-start;
218
- line-height: 0;
219
- }
220
-
221
- .selectionControlWrap span {
222
- gap: 0;
223
- }
224
-
225
- .selectionControlWrap input[type='radio'] + span {
226
- width: 18px;
227
- height: 18px;
228
- border-width: 1px;
229
- border-color: color-mix(in srgb, var(--color-fg-default) 28%, transparent);
230
- }
231
-
232
- .selectionControlWrap input[type='radio'] + span > span {
233
- width: 8px;
234
- height: 8px;
235
- }
236
-
237
- .clickableRow {
238
- cursor: pointer;
239
- }
240
-
241
- .row:hover > .cell {
242
- background-color: var(--table-row-bg-hover);
243
- }
244
-
245
- .selectedRow > .cell {
246
- background-color: var(--table-row-bg-selected);
247
- }
248
-
249
- .selectedRow:hover > .cell {
250
- background-color: var(--table-row-bg-selected-hover);
251
- }
252
-
253
- .striped > .row:nth-child(even):not(.selectedRow):not(:hover) > .cell {
254
- background-color: var(--table-row-bg-alt);
255
- }
256
-
257
- .row:focus-within > .cell {
258
- box-shadow:
259
- inset 0 2px 0 var(--color-brand),
260
- inset 0 -2px 0 var(--color-brand);
261
- }
262
-
263
- .row:focus-within > .cell:first-child {
264
- box-shadow:
265
- inset 2px 0 0 var(--color-brand),
266
- inset 0 2px 0 var(--color-brand),
267
- inset 0 -2px 0 var(--color-brand);
268
- }
269
-
270
- .row:focus-within > .cell:last-child {
271
- box-shadow:
272
- inset -2px 0 0 var(--color-brand),
273
- inset 0 2px 0 var(--color-brand),
274
- inset 0 -2px 0 var(--color-brand);
275
- }
276
-
277
- .nowrap {
278
- white-space: nowrap;
279
- }
280
-
281
- .allowWrap {
282
- white-space: normal;
283
- overflow-wrap: break-word;
284
- word-break: normal;
285
- }
286
-
287
- .thInner {
288
- display: flex;
289
- align-items: center;
290
- inline-size: 100%;
291
- min-width: 0;
292
- }
293
-
294
- .thInnerRight {
295
- justify-content: flex-end;
296
- }
297
-
298
- .thInnerCenter {
299
- justify-content: center;
300
- }
301
-
302
- .thMain {
303
- flex: 1 1 auto;
304
- min-width: 0;
305
- display: flex;
306
- align-items: center;
307
- justify-content: flex-start;
308
- }
309
-
310
- .thMainRight {
311
- justify-content: flex-end;
312
- }
313
-
314
- .thMainCenter {
315
- justify-content: center;
316
- }
317
-
318
- .thButton {
319
- all: unset;
320
- display: inline-flex;
321
- align-items: center;
322
- gap: 4px;
323
- min-width: 0;
324
- max-inline-size: 100%;
325
- cursor: pointer;
326
- user-select: none;
327
- border-radius: var(--border-radius-default);
328
- padding-block: 2px;
329
- padding-inline: 2px;
330
- justify-content: flex-start;
331
- }
332
-
333
- .thButtonRight {
334
- justify-content: flex-end;
335
- }
336
-
337
- .thButtonCenter {
338
- justify-content: center;
339
- }
340
-
341
- .thLabel {
342
- overflow: hidden;
343
- text-overflow: ellipsis;
344
- white-space: nowrap;
345
- flex: 0 1 auto;
346
- min-width: 0;
347
- }
348
-
349
- .thLabelRight {
350
- text-align: right;
351
- width: 100%;
352
- }
353
-
354
- .thLabelCenter {
355
- text-align: center;
356
- width: 100%;
357
- }
358
-
359
- .thOverlayExtras {
360
- position: absolute;
361
- inset-block: 0;
362
- inset-inline-end: 0;
363
- display: flex;
364
- align-items: center;
365
- justify-content: center;
366
- min-width: 0;
367
- pointer-events: none;
368
- z-index: 7;
369
- }
370
-
371
- .thOverlayExtras > * {
372
- pointer-events: auto;
373
- }
374
-
375
- .sortIndicator {
376
- display: inline-flex;
377
- flex: 0 0 auto;
378
- align-items: center;
379
- color: var(--color-fg-subtle);
380
- opacity: 0.9;
381
- }
382
-
383
- .sortIndicator svg {
384
- inline-size: var(--icon-size-sm);
385
- block-size: var(--icon-size-sm);
386
- }
387
-
388
- .descending {
389
- transform: rotate(180deg);
390
- }
391
-
392
- .inActiveSort {
393
- opacity: 0.45;
394
- }
395
-
396
- .cellContent {
397
- display: flex;
398
- inline-size: 100%;
399
- min-width: 0;
400
- max-inline-size: 100%;
401
- }
402
-
403
- /* horizontal alignment inside content wrapper */
404
- .cellContent[data-align='left'] {
405
- justify-content: flex-start;
406
- text-align: left;
407
- }
408
-
409
- .cellContent[data-align='center'] {
410
- justify-content: center;
411
- text-align: center;
412
- }
413
-
414
- .cellContent[data-align='right'] {
415
- justify-content: flex-end;
416
- text-align: right;
417
- }
418
-
419
- /* vertical alignment inside content wrapper */
420
- .cellContent[data-vertical-align='top'] {
421
- align-items: flex-start;
422
- }
423
-
424
- .cellContent[data-vertical-align='middle'] {
425
- align-items: center;
426
- }
427
-
428
- .cellContent[data-vertical-align='bottom'] {
429
- align-items: flex-end;
430
- }
431
-
432
- .cellContent > * {
433
- min-width: 0;
434
- max-inline-size: 100%;
435
- }
436
-
437
- /* keep truncation + text alignment working */
438
- .cellValueEllipsis {
439
- display: block;
440
- inline-size: 100%;
441
- min-width: 0;
442
- max-inline-size: 100%;
443
- white-space: nowrap;
444
- overflow: hidden;
445
- text-overflow: ellipsis;
446
- }
447
-
448
- .cellContent[data-align='left'] .cellValueEllipsis {
449
- text-align: left;
450
- }
451
-
452
- .cellContent[data-align='center'] .cellValueEllipsis {
453
- text-align: center;
454
- }
455
-
456
- .cellContent[data-align='right'] .cellValueEllipsis {
457
- text-align: right;
458
- }
459
-
460
- .allowWrap .cellContent,
461
- .allowWrap .cellValueEllipsis {
462
- white-space: normal;
463
- overflow-wrap: break-word;
464
- word-break: normal;
465
- overflow: visible;
466
- text-overflow: clip;
467
- }
468
-
469
- .severityTable {
470
- --row-rail-width: 2px;
471
- --row-rail-inset-block: 1px;
472
- --row-rail-radius: 0;
473
- }
474
-
475
- .severityTable .row.severity > .cell:first-child {
476
- position: relative;
477
- }
478
-
479
- .severityTable .row.severity > .cell:first-child::before {
480
- content: '';
481
- position: absolute;
482
- inset-inline-start: 0;
483
- inset-block-start: var(--row-rail-inset-block);
484
- inset-block-end: var(--row-rail-inset-block);
485
- inline-size: var(--row-rail-width);
486
- background-color: var(--row-severity-color);
487
- border-radius: var(--row-rail-radius);
488
- z-index: 2;
489
- pointer-events: none;
490
- opacity: 0.95;
491
- }
492
-
493
- .severityTable .row.severity:hover > .cell:first-child::before,
494
- .severityTable .row.severity:focus-within > .cell:first-child::before {
495
- opacity: 1;
496
- z-index: 8;
497
- }
498
-
499
- .severityTable .row.severityFailed > .cell:first-child::before {
500
- box-shadow: 1px 0 0 color-mix(in srgb, var(--row-severity-color) 20%, transparent);
501
- }
502
-
503
- .sm .severityTable {
504
- --row-rail-width: 4px;
505
- --row-rail-inset-block: 1px;
506
- }
507
-
508
- .dividerLeft,
509
- .dividerRight {
510
- position: relative;
511
- }
512
-
513
- .headerCell.dividerLeft,
514
- .headerCell.dividerRight {
515
- position: sticky;
516
- }
517
-
518
- .dividerLeft::before {
519
- content: '';
520
- position: absolute;
521
- left: 0;
522
- top: 8px;
523
- bottom: 8px;
524
- width: 1px;
525
- background: var(--table-divider);
526
- }
527
-
528
- .dividerRight::after {
529
- content: '';
530
- position: absolute;
531
- right: 0;
532
- top: 8px;
533
- bottom: 8px;
534
- width: 1px;
535
- background: var(--table-divider);
536
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,111 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { useReactTable, getCoreRowModel, getSortedRowModel, } from '@tanstack/react-table';
4
- import * as React from 'react';
5
- import ColumnResizer from './components/column-resizer/ColumnResizer';
6
- import { Table } from './Table';
7
- import { DEFAULT_COLUMN_PX } from './table.utils';
8
- import { buildDistributedColumnWidths, buildColumnVisibilityFromVisibleIds, mapDefsToColumnItems, sortingEqual, getSortPropsFromSorting, } from './tanstackTable.utils';
9
- export function TanstackTable(props) {
10
- const { data, dataKey, columns, sorting: controlledSorting, onSortingChange, optimisticSortingUi = true, visibleColumnIds, manualSorting, selectedRows, onRowSelect, ...tableProps } = props;
11
- const isControlledSorting = controlledSorting != null;
12
- const [uiSorting, setUiSorting] = React.useState(controlledSorting !== null && controlledSorting !== void 0 ? controlledSorting : []);
13
- React.useEffect(() => {
14
- if (!isControlledSorting)
15
- return;
16
- if (sortingEqual(uiSorting, controlledSorting))
17
- return;
18
- setUiSorting(controlledSorting);
19
- }, [isControlledSorting, controlledSorting, uiSorting]);
20
- const columnVisibility = React.useMemo(() => buildColumnVisibilityFromVisibleIds(columns, visibleColumnIds), [columns, visibleColumnIds]);
21
- const [columnSizing, setColumnSizing] = React.useState({});
22
- const containerRef = React.useRef(null);
23
- const [availableWidth, setAvailableWidth] = React.useState(undefined);
24
- const table = useReactTable({
25
- data,
26
- columns: columns,
27
- state: {
28
- sorting: uiSorting,
29
- columnSizing,
30
- columnVisibility,
31
- },
32
- onSortingChange: updater => {
33
- const next = typeof updater === 'function' ? updater(uiSorting) : updater;
34
- if (optimisticSortingUi)
35
- setUiSorting(next);
36
- onSortingChange === null || onSortingChange === void 0 ? void 0 : onSortingChange(next);
37
- },
38
- onColumnSizingChange: setColumnSizing,
39
- getCoreRowModel: getCoreRowModel(),
40
- getSortedRowModel: getSortedRowModel(),
41
- manualSorting: manualSorting !== null && manualSorting !== void 0 ? manualSorting : false,
42
- enableColumnResizing: true,
43
- columnResizeMode: 'onChange',
44
- defaultColumn: {
45
- enableResizing: true,
46
- minSize: 80,
47
- size: DEFAULT_COLUMN_PX,
48
- },
49
- });
50
- React.useLayoutEffect(() => {
51
- const el = containerRef.current;
52
- if (!el)
53
- return;
54
- const updateWidth = () => {
55
- const next = el.clientWidth;
56
- setAvailableWidth(next > 0 ? next : undefined);
57
- };
58
- updateWidth();
59
- if (typeof ResizeObserver === 'undefined') {
60
- window.addEventListener('resize', updateWidth);
61
- return () => window.removeEventListener('resize', updateWidth);
62
- }
63
- const observer = new ResizeObserver(() => updateWidth());
64
- observer.observe(el);
65
- return () => observer.disconnect();
66
- }, []);
67
- const distributedLayout = React.useMemo(() => {
68
- if (availableWidth == null)
69
- return null;
70
- return buildDistributedColumnWidths({
71
- table,
72
- hasSelection: Boolean(selectedRows && onRowSelect && dataKey),
73
- defaultMinPx: 80,
74
- columnSizing,
75
- availableWidth,
76
- });
77
- }, [table, selectedRows, onRowSelect, dataKey, columnSizing, availableWidth]);
78
- const initialLayoutReady = availableWidth != null;
79
- const resolvedLayout = React.useMemo(() => {
80
- const next = {};
81
- table.getVisibleLeafColumns().forEach((column) => {
82
- next[column.id] = {
83
- width: distributedLayout === null || distributedLayout === void 0 ? void 0 : distributedLayout.widths[column.id],
84
- };
85
- });
86
- return next;
87
- }, [table, distributedLayout]);
88
- const columnItems = React.useMemo(() => mapDefsToColumnItems(columns, columnVisibility, resolvedLayout), [columns, columnVisibility, resolvedLayout]);
89
- const visibleData = table.getRowModel().rows.map(r => r.original);
90
- const { sortById, sortDirection } = getSortPropsFromSorting(uiSorting);
91
- const handleSortChange = React.useCallback((column, direction) => {
92
- const next = direction == null ? [] : [{ id: column.id, desc: direction === 'desc' }];
93
- if (optimisticSortingUi)
94
- setUiSorting(next);
95
- onSortingChange === null || onSortingChange === void 0 ? void 0 : onSortingChange(next);
96
- }, [optimisticSortingUi, onSortingChange]);
97
- const headerExtras = React.useCallback(({ index }) => {
98
- var _a, _b, _c, _d;
99
- const headerGroups = table.getHeaderGroups();
100
- const leafHeaders = headerGroups.length > 0 ? headerGroups[headerGroups.length - 1].headers : [];
101
- const header = leafHeaders[index];
102
- if (!header)
103
- return null;
104
- const canResize = (_c = (_b = (_a = header.column).getCanResize) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : false;
105
- const handler = (_d = header.getResizeHandler) === null || _d === void 0 ? void 0 : _d.call(header);
106
- if (!canResize || !handler)
107
- return null;
108
- return _jsx(ColumnResizer, { id: header.column.id, handler: handler });
109
- }, [table]);
110
- return (_jsx(Table, { ...tableProps, tableRootRef: containerRef, onSortChange: handleSortChange, dataKey: dataKey, data: visibleData, columns: columnItems, tableWidth: distributedLayout === null || distributedLayout === void 0 ? void 0 : distributedLayout.totalWidth, measuringLayout: !initialLayoutReady, sortById: sortById, sortDirection: sortDirection, headerExtras: headerExtras, selectedRows: selectedRows, onRowSelect: onRowSelect }));
111
- }
@@ -1,10 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { cx } from '../table.classes';
3
- import styles from '../Table.module.css';
4
- import { TableRow } from './TableRow';
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
- const rowId = row[dataKey];
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
- }) }));
10
- }