@dbcdk/react-components 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/logo.js +2 -85
- package/dist/components/__stories__/_data/table.d.ts +15 -0
- package/dist/components/__stories__/_data/table.js +49 -0
- package/dist/components/__stories__/story-components/Colors.d.ts +11 -0
- package/dist/components/__stories__/story-components/Colors.js +96 -0
- package/dist/components/__stories__/story-components/Colors.module.css +27 -0
- package/dist/components/__stories__/story-components/Spacing.d.ts +2 -0
- package/dist/components/__stories__/story-components/Spacing.js +76 -0
- package/dist/components/__stories__/story-components/Spacing.module.css +154 -0
- package/dist/components/app-header/AppHeader.d.ts +4 -3
- package/dist/components/app-header/AppHeader.js +3 -6
- package/dist/components/app-header/AppHeader.module.css +10 -15
- package/dist/components/attribute-chip/AttributeChip.d.ts +9 -0
- package/dist/components/attribute-chip/AttributeChip.js +5 -0
- package/dist/components/attribute-chip/AttributeChip.module.css +65 -0
- package/dist/components/avatar/Avatar.d.ts +5 -3
- package/dist/components/avatar/Avatar.js +37 -37
- package/dist/components/avatar/Avatar.module.css +27 -0
- package/dist/components/breadcrumbs/Breadcrumbs.d.ts +4 -4
- package/dist/components/breadcrumbs/Breadcrumbs.js +4 -14
- package/dist/components/breadcrumbs/Breadcrumbs.module.css +19 -22
- package/dist/components/button/Button.d.ts +6 -2
- package/dist/components/button/Button.js +56 -50
- package/dist/components/button/Button.module.css +119 -56
- package/dist/components/card/Card.d.ts +23 -7
- package/dist/components/card/Card.js +20 -21
- package/dist/components/card/Card.module.css +148 -44
- package/dist/components/card-container/CardContainer.d.ts +6 -3
- package/dist/components/card-container/CardContainer.js +4 -15
- package/dist/components/card-container/CardContainer.module.css +40 -0
- package/dist/components/chip/Chip.d.ts +7 -5
- package/dist/components/chip/Chip.js +14 -37
- package/dist/components/chip/Chip.module.css +50 -27
- package/dist/components/circle/Circle.d.ts +3 -2
- package/dist/components/circle/Circle.js +3 -10
- package/dist/components/circle/Circle.module.css +11 -11
- package/dist/components/clear-button/ClearButton.d.ts +2 -1
- package/dist/components/clear-button/ClearButton.js +6 -17
- package/dist/components/clear-button/ClearButton.module.css +8 -7
- package/dist/components/code-block/CodeBlock.d.ts +7 -0
- package/dist/components/code-block/CodeBlock.js +6 -0
- package/dist/components/code-block/CodeBlock.module.css +60 -0
- package/dist/components/copy-button/CopyButton.d.ts +10 -0
- package/dist/components/copy-button/CopyButton.js +22 -0
- package/dist/components/copy-button/CopyButton.module.css +6 -0
- package/dist/components/datetime-picker/DateTimePicker.d.ts +42 -0
- package/dist/components/datetime-picker/DateTimePicker.js +403 -0
- package/dist/components/datetime-picker/DateTimePicker.module.css +144 -0
- package/dist/components/filter-field/FilterField.d.ts +6 -3
- package/dist/components/filter-field/FilterField.js +130 -158
- package/dist/components/filter-field/FilterField.module.css +35 -25
- package/dist/components/filtering/chip-multi-toggle/ChipMultiToggle.d.ts +36 -0
- package/dist/components/filtering/chip-multi-toggle/ChipMultiToggle.js +53 -0
- package/dist/components/filtering/chip-multi-toggle/ChipMultiToggle.module.css +60 -0
- package/dist/components/forms/checkbox/Checkbox.d.ts +31 -0
- package/dist/components/forms/checkbox/Checkbox.js +27 -0
- package/dist/components/{checkbox → forms/checkbox}/Checkbox.module.css +10 -11
- package/dist/components/forms/checkbox-group/CheckboxGroup.d.ts +47 -0
- package/dist/components/forms/checkbox-group/CheckboxGroup.js +75 -0
- package/dist/components/forms/checkbox-group/CheckboxGroup.module.css +115 -0
- package/dist/components/forms/input/Input.d.ts +22 -0
- package/dist/components/forms/input/Input.js +70 -0
- package/dist/components/forms/input/Input.module.css +160 -0
- package/dist/components/forms/input-container/InputContainer.d.ts +15 -0
- package/dist/components/forms/input-container/InputContainer.js +15 -0
- package/dist/components/forms/input-container/InputContainer.module.css +34 -0
- package/dist/components/forms/multi-select/MultiSelect.d.ts +20 -0
- package/dist/components/forms/multi-select/MultiSelect.js +19 -0
- package/dist/components/forms/select/Select.d.ts +21 -0
- package/dist/components/forms/select/Select.js +94 -0
- package/dist/components/forms/text-area/Textarea.d.ts +17 -0
- package/dist/components/forms/text-area/Textarea.js +33 -0
- package/dist/components/forms/text-area/Textarea.module.css +26 -0
- package/dist/components/headline/Headline.d.ts +9 -1
- package/dist/components/headline/Headline.js +18 -37
- package/dist/components/headline/Headline.module.css +32 -7
- package/dist/components/hyperlink/Hyperlink.d.ts +9 -0
- package/dist/components/hyperlink/Hyperlink.js +11 -0
- package/dist/components/hyperlink/Hyperlink.module.css +23 -0
- package/dist/components/icon/Icon.d.ts +4 -3
- package/dist/components/icon/Icon.js +11 -17
- package/dist/components/icon/Icon.module.css +10 -9
- package/dist/components/menu/Menu.js +25 -67
- package/dist/components/menu/Menu.module.css +10 -32
- package/dist/components/meta-bar/MetaBar.d.ts +11 -0
- package/dist/components/meta-bar/MetaBar.js +9 -0
- package/dist/components/meta-bar/MetaBar.module.css +12 -0
- package/dist/components/nav-bar/NavBar.d.ts +5 -5
- package/dist/components/nav-bar/NavBar.js +15 -45
- package/dist/components/nav-bar/NavBar.module.css +11 -16
- package/dist/components/overlay/modal/Modal.d.ts +23 -0
- package/dist/components/overlay/modal/Modal.js +92 -0
- package/dist/components/overlay/modal/Modal.module.css +66 -0
- package/dist/components/overlay/modal/provider/ModalProvider.d.ts +20 -0
- package/dist/components/overlay/modal/provider/ModalProvider.js +70 -0
- package/dist/components/overlay/side-panel/SidePanel.d.ts +16 -0
- package/dist/components/overlay/side-panel/SidePanel.js +10 -0
- package/dist/components/overlay/side-panel/SidePanel.module.css +56 -0
- package/dist/components/overlay/side-panel/useSidePanel.d.ts +5 -0
- package/dist/components/overlay/side-panel/useSidePanel.js +11 -0
- package/dist/components/overlay/tooltip/Tooltip.d.ts +13 -0
- package/dist/components/overlay/tooltip/Tooltip.js +17 -0
- package/dist/components/overlay/tooltip/Tooltip.module.css +106 -0
- package/dist/components/overlay/tooltip/TooltipProvider.d.ts +20 -0
- package/dist/components/overlay/tooltip/TooltipProvider.js +244 -0
- package/dist/components/overlay/tooltip/useTooltipTrigger.d.ts +24 -0
- package/dist/components/overlay/tooltip/useTooltipTrigger.js +108 -0
- package/dist/components/page/Page.d.ts +7 -6
- package/dist/components/page/Page.js +4 -21
- package/dist/components/page/Page.module.css +2 -2
- package/dist/components/page-layout/PageLayout.d.ts +12 -20
- package/dist/components/page-layout/PageLayout.js +35 -88
- package/dist/components/page-layout/PageLayout.module.css +4 -80
- package/dist/components/page-layout/components/page-layout-hero/PageLayoutHero.d.ts +11 -0
- package/dist/components/page-layout/components/page-layout-hero/PageLayoutHero.js +7 -0
- package/dist/components/page-layout/components/page-layout-hero/PageLayoutHero.module.css +84 -0
- package/dist/components/pagination/Pagination.d.ts +4 -1
- package/dist/components/pagination/Pagination.js +38 -105
- package/dist/components/pagination/Pagination.module.css +11 -3
- package/dist/components/panel/Panel.d.ts +4 -3
- package/dist/components/panel/Panel.js +5 -10
- package/dist/components/panel/Panel.module.css +5 -7
- package/dist/components/popover/Popover.d.ts +3 -1
- package/dist/components/popover/Popover.js +116 -124
- package/dist/components/popover/Popover.module.css +4 -6
- package/dist/components/search-box/SearchBox.d.ts +11 -8
- package/dist/components/search-box/SearchBox.js +112 -149
- package/dist/components/search-box/SearchBox.module.css +0 -1
- package/dist/components/segmented-progress-bar/SegmentedProgressBar.d.ts +1 -1
- package/dist/components/segmented-progress-bar/SegmentedProgressBar.js +47 -88
- package/dist/components/segmented-progress-bar/SegmentedProgressBar.module.css +5 -1
- package/dist/components/sidebar/Sidebar.d.ts +3 -1
- package/dist/components/sidebar/Sidebar.js +5 -29
- package/dist/components/sidebar/components/SidebarItem.js +6 -12
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.d.ts +4 -2
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.js +48 -62
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.module.css +9 -38
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.d.ts +9 -0
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.js +13 -0
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.module.css +155 -0
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.d.ts +3 -1
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.js +4 -18
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.module.css +25 -12
- package/dist/components/sidebar/components/sidebar-items/SidebarItems.d.ts +1 -1
- package/dist/components/sidebar/components/sidebar-items/SidebarItems.js +9 -22
- package/dist/components/sidebar/components/sidenav-filteirng/SidenavFiltering.js +20 -18
- package/dist/components/sidebar/providers/SidebarProvider.d.ts +9 -4
- package/dist/components/sidebar/providers/SidebarProvider.js +188 -73
- package/dist/components/skeleton-loader/SkeletonLoader.js +68 -266
- package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.js +11 -34
- package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.module.css +0 -12
- package/dist/components/split-button/SplitButton.d.ts +7 -5
- package/dist/components/split-button/SplitButton.js +4 -27
- package/dist/components/split-pane/SplitPane.d.ts +34 -0
- package/dist/components/split-pane/SplitPane.js +78 -0
- package/dist/components/split-pane/SplitPane.module.css +106 -0
- package/dist/components/split-pane/provider/SplitPaneContext.d.ts +23 -0
- package/dist/components/split-pane/provider/SplitPaneContext.js +85 -0
- package/dist/components/table/Table.d.ts +28 -10
- package/dist/components/table/Table.js +117 -172
- package/dist/components/table/Table.module.css +78 -47
- package/dist/components/table/components/column-resizer/ColumnResizer.js +4 -15
- package/dist/components/table/components/empty-state/EmptyState.d.ts +41 -0
- package/dist/components/table/components/empty-state/EmptyState.js +27 -0
- package/dist/components/table/components/empty-state/EmptyState.module.css +16 -0
- package/dist/components/table/components/table-settings/TableSettings.d.ts +8 -0
- package/dist/components/table/components/table-settings/TableSettings.js +12 -0
- package/dist/components/table/tanstack.d.ts +14 -0
- package/dist/components/table/tanstack.js +162 -0
- package/dist/components/tabs/Tabs.d.ts +7 -3
- package/dist/components/tabs/Tabs.js +32 -65
- package/dist/components/tabs/Tabs.module.css +9 -9
- package/dist/components/toast/Toast.d.ts +14 -0
- package/dist/components/toast/Toast.js +8 -0
- package/dist/components/toast/Toast.module.css +102 -0
- package/dist/components/toast/provider/ToastProvider.d.ts +23 -0
- package/dist/components/toast/provider/ToastProvider.js +64 -0
- package/dist/components/user-display/UserDisplay.d.ts +2 -1
- package/dist/components/user-display/UserDisplay.js +4 -20
- package/dist/components/user-display/UserDisplay.module.css +2 -2
- package/dist/constants/severity.d.ts +1 -1
- package/dist/constants/severity.js +14 -16
- package/dist/constants/severity.types.d.ts +1 -1
- package/dist/constants/severity.types.js +1 -1
- package/dist/constants/sizes.d.ts +1 -1
- package/dist/constants/sizes.js +6 -7
- package/dist/hooks/usePagination.d.ts +33 -0
- package/dist/hooks/usePagination.js +79 -0
- package/dist/hooks/useSorting.d.ts +49 -0
- package/dist/hooks/useSorting.js +118 -0
- package/dist/hooks/useTableData.d.ts +40 -0
- package/dist/hooks/useTableData.js +45 -0
- package/dist/hooks/useTableSelection.d.ts +25 -0
- package/dist/hooks/useTableSelection.js +128 -0
- package/dist/hooks/useTableSettings.d.ts +7 -0
- package/dist/hooks/useTableSettings.js +24 -0
- package/dist/hooks/useTheme.d.ts +3 -7
- package/dist/hooks/useTheme.js +52 -47
- package/dist/hooks/useTimeDuration.d.ts +22 -0
- package/dist/hooks/useTimeDuration.js +36 -0
- package/dist/hooks/useViewportFill.d.ts +3 -2
- package/dist/hooks/useViewportFill.js +55 -48
- package/dist/index.d.ts +32 -6
- package/dist/index.js +33 -6
- package/dist/src/styles/styles.css +101 -8
- package/dist/styles/css-helper-classes/flex.css +101 -0
- package/dist/styles/css-helper-classes/typography.css +7 -0
- package/dist/styles/styles.css +101 -8
- package/dist/styles/themes/dbc/dark.css +207 -100
- package/dist/styles/themes/dbc/light.css +185 -90
- package/dist/styles/themes/forfatterweb/light.css +1 -1
- package/dist/styles/themes/types.js +1 -1
- package/dist/types/a11y-props.types.d.ts +5 -5
- package/dist/types/a11y-props.types.js +1 -1
- package/dist/types/sizes.types.d.ts +2 -2
- package/dist/types/sizes.types.js +1 -1
- package/dist/utils/arrays/nested-filtering.js +43 -33
- package/dist/utils/date/formatDate.js +25 -16
- package/package.json +33 -18
- package/dist/assets/logo.cjs +0 -87
- package/dist/components/app-header/AppHeader.cjs +0 -14
- package/dist/components/avatar/Avatar.cjs +0 -67
- package/dist/components/breadcrumbs/Breadcrumbs.cjs +0 -23
- package/dist/components/button/Button.cjs +0 -79
- package/dist/components/card/Card.cjs +0 -29
- package/dist/components/card-container/CardContainer.cjs +0 -23
- package/dist/components/checkbox/Checkbox.cjs +0 -43
- package/dist/components/checkbox/Checkbox.d.ts +0 -12
- package/dist/components/checkbox/Checkbox.js +0 -37
- package/dist/components/chip/Chip.cjs +0 -49
- package/dist/components/circle/Circle.cjs +0 -18
- package/dist/components/clear-button/ClearButton.cjs +0 -26
- package/dist/components/data-summary/DataSummary.cjs +0 -49
- package/dist/components/data-summary/DataSummary.d.ts +0 -19
- package/dist/components/data-summary/DataSummary.js +0 -43
- package/dist/components/data-summary/DataSummary.module.css +0 -51
- package/dist/components/filter-field/FilterField.cjs +0 -174
- package/dist/components/headline/Headline.cjs +0 -47
- package/dist/components/icon/Icon.cjs +0 -27
- package/dist/components/input/Input.cjs +0 -48
- package/dist/components/input/Input.d.ts +0 -13
- package/dist/components/input/Input.js +0 -42
- package/dist/components/input/Input.module.css +0 -112
- package/dist/components/menu/Menu.cjs +0 -96
- package/dist/components/multi-select/MultiSelect.cjs +0 -48
- package/dist/components/multi-select/MultiSelect.d.ts +0 -18
- package/dist/components/multi-select/MultiSelect.js +0 -46
- package/dist/components/nav-bar/NavBar.cjs +0 -55
- package/dist/components/page/Page.cjs +0 -30
- package/dist/components/page-layout/PageLayout.cjs +0 -101
- package/dist/components/pagination/Pagination.cjs +0 -117
- package/dist/components/panel/Panel.cjs +0 -18
- package/dist/components/popover/Popover.cjs +0 -132
- package/dist/components/search-box/SearchBox.cjs +0 -162
- package/dist/components/segmented-progress-bar/SegmentedProgressBar.cjs +0 -97
- package/dist/components/select/Select.cjs +0 -52
- package/dist/components/select/Select.d.ts +0 -11
- package/dist/components/select/Select.js +0 -50
- package/dist/components/sidebar/Sidebar.cjs +0 -38
- package/dist/components/sidebar/Sidebar.module.css +0 -66
- package/dist/components/sidebar/components/SidebarItem.cjs +0 -16
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.cjs +0 -74
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.cjs +0 -27
- package/dist/components/sidebar/components/sidebar-items/SidebarItems.cjs +0 -28
- package/dist/components/sidebar/components/sidenav-filteirng/SidenavFiltering.cjs +0 -25
- package/dist/components/sidebar/providers/SidebarProvider.cjs +0 -81
- package/dist/components/skeleton-loader/SkeletonLoader.cjs +0 -270
- package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.cjs +0 -42
- package/dist/components/split-button/SplitButton.cjs +0 -37
- package/dist/components/table/Table.cjs +0 -181
- package/dist/components/table/components/column-resizer/ColumnResizer.cjs +0 -22
- package/dist/components/tabs/Tabs.cjs +0 -74
- package/dist/components/text-area/Textarea.cjs +0 -62
- package/dist/components/text-area/Textarea.d.ts +0 -14
- package/dist/components/text-area/Textarea.js +0 -56
- package/dist/components/text-area/Textarea.module.css +0 -3
- package/dist/components/tooltip/Tooltip.cjs +0 -78
- package/dist/components/tooltip/Tooltip.d.ts +0 -11
- package/dist/components/tooltip/Tooltip.js +0 -72
- package/dist/components/tooltip/Tooltip.module.css +0 -84
- package/dist/components/user-display/UserDisplay.cjs +0 -28
- package/dist/constants/severity.cjs +0 -21
- package/dist/constants/severity.types.cjs +0 -2
- package/dist/constants/sizes.cjs +0 -10
- package/dist/hooks/useTheme.cjs +0 -58
- package/dist/hooks/useViewportFill.cjs +0 -52
- package/dist/index.cjs +0 -264
- package/dist/styles/themes/types.cjs +0 -2
- package/dist/tanstack.cjs +0 -231
- package/dist/tanstack.d.ts +0 -25
- package/dist/tanstack.js +0 -206
- package/dist/types/a11y-props.types.cjs +0 -2
- package/dist/types/assets.d.cjs +0 -2
- package/dist/types/assets.d.js +0 -1
- package/dist/types/css.d.cjs +0 -2
- package/dist/types/css.d.js +0 -1
- package/dist/types/sizes.types.cjs +0 -2
- package/dist/utils/arrays/nested-filtering.cjs +0 -40
- package/dist/utils/date/formatDate.cjs +0 -19
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
.container {
|
|
2
|
+
display: flex;
|
|
3
|
+
inline-size: 100%;
|
|
4
|
+
overflow: hidden;
|
|
5
|
+
min-inline-size: 0;
|
|
6
|
+
min-block-size: 0;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.container[data-direction='horizontal'] {
|
|
10
|
+
flex-direction: row;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.container[data-direction='vertical'] {
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* ===== Primary pane ===== */
|
|
18
|
+
.primary {
|
|
19
|
+
flex: 0 0 var(--split-pane-primary-size, 300px);
|
|
20
|
+
min-inline-size: 0;
|
|
21
|
+
min-block-size: 0;
|
|
22
|
+
overflow: auto;
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
display: flex;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* ===== Secondary pane ===== */
|
|
28
|
+
.secondary {
|
|
29
|
+
flex: 1 1 auto;
|
|
30
|
+
min-inline-size: 0;
|
|
31
|
+
min-block-size: 0;
|
|
32
|
+
overflow: auto;
|
|
33
|
+
display: flex;
|
|
34
|
+
flex-direction: column;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* ===== Gutter (spacing + hit area) ===== */
|
|
38
|
+
.gutter {
|
|
39
|
+
position: relative;
|
|
40
|
+
flex: 0 0 var(--split-pane-gutter, 8px);
|
|
41
|
+
background: transparent;
|
|
42
|
+
z-index: 1;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/* Vertical mode gutter */
|
|
46
|
+
.container[data-direction='vertical'] .gutter {
|
|
47
|
+
inline-size: 100%;
|
|
48
|
+
block-size: var(--split-pane-gutter, 8px);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* ===== Resizer (interaction only) ===== */
|
|
52
|
+
.resizer {
|
|
53
|
+
position: absolute;
|
|
54
|
+
inset: 0;
|
|
55
|
+
cursor: col-resize;
|
|
56
|
+
user-select: none;
|
|
57
|
+
touch-action: none;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.container[data-direction='vertical'] .resizer {
|
|
61
|
+
cursor: row-resize;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/* ===== Divider line ===== */
|
|
65
|
+
.resizer::after {
|
|
66
|
+
content: '';
|
|
67
|
+
position: absolute;
|
|
68
|
+
inset-block: 0;
|
|
69
|
+
inset-inline: 50%;
|
|
70
|
+
inline-size: var(--border-width-hairline);
|
|
71
|
+
background-color: var(--color-border-subtle);
|
|
72
|
+
opacity: 0;
|
|
73
|
+
transform: translateX(-50%);
|
|
74
|
+
transition:
|
|
75
|
+
opacity var(--transition-fast) var(--ease-standard),
|
|
76
|
+
background-color var(--transition-fast) var(--ease-standard);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/* Vertical divider */
|
|
80
|
+
.container[data-direction='vertical'] .resizer::after {
|
|
81
|
+
inset-inline: 0;
|
|
82
|
+
inset-block: 50%;
|
|
83
|
+
inline-size: 100%;
|
|
84
|
+
block-size: var(--border-width-hairline);
|
|
85
|
+
transform: translateY(-50%);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/* ===== Divider visibility modes ===== */
|
|
89
|
+
.container[data-divider='hover'] .resizer:hover::after,
|
|
90
|
+
.container[data-divider='hover'] .resizer:active::after {
|
|
91
|
+
opacity: 1;
|
|
92
|
+
background-color: var(--color-border-strong);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.container[data-divider='always'] .resizer::after {
|
|
96
|
+
opacity: 1;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.container[data-divider='never'] .resizer::after {
|
|
100
|
+
display: none;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.container[data-divider='hover'] .resizer:active::after,
|
|
104
|
+
.container[data-divider='always'] .resizer:active::after {
|
|
105
|
+
background-color: var(--color-brand);
|
|
106
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type SplitDirection = 'horizontal' | 'vertical';
|
|
3
|
+
export interface SplitPaneContextValue {
|
|
4
|
+
direction: SplitDirection;
|
|
5
|
+
primarySize: number;
|
|
6
|
+
setPrimarySize: React.Dispatch<React.SetStateAction<number>>;
|
|
7
|
+
minPrimarySize: number;
|
|
8
|
+
minSecondarySize: number;
|
|
9
|
+
containerRef: React.RefObject<HTMLDivElement>;
|
|
10
|
+
storageKey?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const SplitPaneContext: React.Context<SplitPaneContextValue | null>;
|
|
13
|
+
export declare function useSplitPaneContext(): SplitPaneContextValue;
|
|
14
|
+
type SplitPaneProviderProps = {
|
|
15
|
+
children: React.ReactNode;
|
|
16
|
+
direction: SplitDirection;
|
|
17
|
+
initialPrimarySize: number;
|
|
18
|
+
minPrimarySize: number;
|
|
19
|
+
minSecondarySize: number;
|
|
20
|
+
storageKey?: string;
|
|
21
|
+
};
|
|
22
|
+
export declare function SplitPaneProvider({ children, direction, initialPrimarySize, minPrimarySize, minSecondarySize, storageKey, }: SplitPaneProviderProps): React.ReactNode;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
4
|
+
export const SplitPaneContext = React.createContext(null);
|
|
5
|
+
function clamp(n, min, max) {
|
|
6
|
+
return Math.max(min, Math.min(max, n));
|
|
7
|
+
}
|
|
8
|
+
function readStoredSize(key) {
|
|
9
|
+
try {
|
|
10
|
+
const raw = localStorage.getItem(key);
|
|
11
|
+
if (!raw)
|
|
12
|
+
return null;
|
|
13
|
+
const num = Number(raw);
|
|
14
|
+
return Number.isFinite(num) ? num : null;
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function writeStoredSize(key, value) {
|
|
21
|
+
try {
|
|
22
|
+
localStorage.setItem(key, String(Math.round(value)));
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
// ignore (private mode, disabled storage, etc.)
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export function useSplitPaneContext() {
|
|
29
|
+
const ctx = React.useContext(SplitPaneContext);
|
|
30
|
+
if (!ctx)
|
|
31
|
+
throw new Error('SplitPane components must be used within <SplitPane />');
|
|
32
|
+
return ctx;
|
|
33
|
+
}
|
|
34
|
+
export function SplitPaneProvider({ children, direction, initialPrimarySize, minPrimarySize, minSecondarySize, storageKey, }) {
|
|
35
|
+
const containerRef = useRef(null);
|
|
36
|
+
/**
|
|
37
|
+
* IMPORTANT (Next.js hydration):
|
|
38
|
+
* Always start with initialPrimarySize so server HTML and first client render match.
|
|
39
|
+
* Then, after hydration, read localStorage and update.
|
|
40
|
+
*/
|
|
41
|
+
const [primarySize, setPrimarySize] = useState(initialPrimarySize);
|
|
42
|
+
// Apply persisted size AFTER hydration (prevents SSR/client mismatch warnings)
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
if (!storageKey)
|
|
45
|
+
return;
|
|
46
|
+
const stored = readStoredSize(storageKey);
|
|
47
|
+
if (stored === null)
|
|
48
|
+
return;
|
|
49
|
+
setPrimarySize(stored);
|
|
50
|
+
}, [storageKey]);
|
|
51
|
+
// Clamp after mount / when container is measurable; re-clamp on resize
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
const el = containerRef.current;
|
|
54
|
+
if (!el)
|
|
55
|
+
return;
|
|
56
|
+
const clampToContainer = () => {
|
|
57
|
+
const rect = el.getBoundingClientRect();
|
|
58
|
+
const total = direction === 'horizontal' ? rect.width : rect.height;
|
|
59
|
+
if (!Number.isFinite(total) || total <= 0)
|
|
60
|
+
return;
|
|
61
|
+
const maxPrimary = Math.max(minPrimarySize, total - minSecondarySize);
|
|
62
|
+
setPrimarySize(prev => clamp(prev, minPrimarySize, maxPrimary));
|
|
63
|
+
};
|
|
64
|
+
clampToContainer();
|
|
65
|
+
const ro = new ResizeObserver(() => clampToContainer());
|
|
66
|
+
ro.observe(el);
|
|
67
|
+
return () => ro.disconnect();
|
|
68
|
+
}, [direction, minPrimarySize, minSecondarySize]);
|
|
69
|
+
// Persist on change
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
if (!storageKey)
|
|
72
|
+
return;
|
|
73
|
+
writeStoredSize(storageKey, primarySize);
|
|
74
|
+
}, [storageKey, primarySize]);
|
|
75
|
+
const value = useMemo(() => ({
|
|
76
|
+
direction,
|
|
77
|
+
primarySize,
|
|
78
|
+
setPrimarySize,
|
|
79
|
+
minPrimarySize,
|
|
80
|
+
minSecondarySize,
|
|
81
|
+
containerRef,
|
|
82
|
+
storageKey,
|
|
83
|
+
}), [direction, primarySize, minPrimarySize, minSecondarySize, storageKey]);
|
|
84
|
+
return _jsx(SplitPaneContext.Provider, { value: value, children: children });
|
|
85
|
+
}
|
|
@@ -1,34 +1,47 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { JSX, ReactNode } from 'react';
|
|
3
|
+
import { Severity } from '../../constants/severity.types';
|
|
4
|
+
import { PageChangeEvent } from '../../components/pagination/Pagination';
|
|
5
|
+
import { ViewMode } from '../../hooks/useTableSettings';
|
|
6
|
+
import { TableEmptyConfig } from './components/empty-state/EmptyState';
|
|
2
7
|
type SortDirection = 'asc' | 'desc' | null;
|
|
3
8
|
export interface ColumnItem<T> {
|
|
4
|
-
|
|
9
|
+
id: string;
|
|
10
|
+
header: string | (() => ReactNode);
|
|
5
11
|
accessor?: keyof T;
|
|
6
12
|
sortable?: boolean;
|
|
7
13
|
sortFunction?: (a: T, b: T) => -1 | 0 | 1;
|
|
8
|
-
render?: (item: T) =>
|
|
14
|
+
render?: (item: T) => ReactNode;
|
|
9
15
|
hidden?: boolean;
|
|
10
16
|
align?: 'left' | 'right' | 'center';
|
|
17
|
+
verticalAlign?: 'top' | 'middle' | 'bottom';
|
|
11
18
|
fitContent?: boolean;
|
|
19
|
+
allowWrap?: boolean;
|
|
20
|
+
emptyPlaceholder?: ReactNode;
|
|
21
|
+
width?: number | string;
|
|
12
22
|
}
|
|
13
23
|
type HeaderExtrasArgs<T> = {
|
|
14
24
|
column: ColumnItem<T>;
|
|
15
25
|
index: number;
|
|
16
26
|
};
|
|
17
|
-
export type TableVariant = '
|
|
18
|
-
interface TableProps<T extends Record<string, any>> {
|
|
27
|
+
export type TableVariant = 'primary' | 'embedded';
|
|
28
|
+
export interface TableProps<T extends Record<string, any>> {
|
|
19
29
|
data: T[];
|
|
20
30
|
dataKey: keyof T;
|
|
21
31
|
columns: ColumnItem<T>[];
|
|
22
32
|
selectedRows?: Set<number | string>;
|
|
33
|
+
selectionMode?: 'single' | 'multiple';
|
|
34
|
+
allRowsSelected?: boolean;
|
|
23
35
|
onRowClick?: (row: T) => void;
|
|
24
|
-
onRowSelect?: (
|
|
36
|
+
onRowSelect?: (rowId: number | string, isSelected: boolean) => void;
|
|
37
|
+
onSelectAllRows?: (isSelected: boolean) => void;
|
|
25
38
|
onSortChange?: (column: ColumnItem<T>, direction: SortDirection) => void;
|
|
26
|
-
|
|
39
|
+
sortById?: string;
|
|
27
40
|
sortDirection?: SortDirection;
|
|
28
41
|
loading?: boolean;
|
|
29
|
-
headerExtras?: (args: HeaderExtrasArgs<T>) =>
|
|
42
|
+
headerExtras?: (args: HeaderExtrasArgs<T>) => ReactNode;
|
|
30
43
|
columnStyles?: Partial<Record<string, React.CSSProperties>>;
|
|
31
|
-
headerBelowRow?:
|
|
44
|
+
headerBelowRow?: ReactNode;
|
|
32
45
|
striped?: boolean;
|
|
33
46
|
fillViewport?: boolean;
|
|
34
47
|
viewportBottomOffset?: number;
|
|
@@ -36,10 +49,15 @@ interface TableProps<T extends Record<string, any>> {
|
|
|
36
49
|
viewportIncludeMarginTop?: boolean;
|
|
37
50
|
take?: number;
|
|
38
51
|
skip?: number;
|
|
52
|
+
paginationPlacement?: 'top' | 'bottom';
|
|
39
53
|
totalItemsCount?: number;
|
|
40
54
|
onPageChange?: (e: PageChangeEvent) => void;
|
|
41
55
|
variant?: TableVariant;
|
|
42
56
|
size?: 'sm' | 'md';
|
|
57
|
+
getRowSeverity?: (row: T) => Severity | undefined;
|
|
58
|
+
showFirstLast?: boolean;
|
|
59
|
+
viewMode?: ViewMode;
|
|
60
|
+
emptyConfig?: TableEmptyConfig;
|
|
43
61
|
}
|
|
44
|
-
export declare function Table<T extends Record<string, any>>({ data, columns, selectedRows, onRowSelect, onSortChange, onRowClick,
|
|
62
|
+
export declare function Table<T extends Record<string, any>>({ data, columns, selectedRows, onRowSelect, selectionMode, onSortChange, onRowClick, sortById, sortDirection, dataKey, headerExtras, columnStyles, headerBelowRow, striped, fillViewport, viewportBottomOffset, viewportMin, viewportIncludeMarginTop, take, skip, paginationPlacement, totalItemsCount, onPageChange, loading, variant, size, getRowSeverity, showFirstLast, allRowsSelected, onSelectAllRows, viewMode, emptyConfig, }: TableProps<T>): JSX.Element;
|
|
45
63
|
export {};
|
|
@@ -1,175 +1,120 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { ArrowDown, ArrowUp } from 'lucide-react';
|
|
4
|
+
import { useCallback, useMemo, useRef } from 'react';
|
|
5
|
+
import { SeverityBgColor } from '../../constants/severity';
|
|
6
6
|
import { useViewportFill } from '../../hooks/useViewportFill';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
viewportIncludeMarginTop = false,
|
|
28
|
-
take,
|
|
29
|
-
skip,
|
|
30
|
-
totalItemsCount,
|
|
31
|
-
onPageChange,
|
|
32
|
-
loading,
|
|
33
|
-
variant = "filled",
|
|
34
|
-
size = "md"
|
|
35
|
-
}) {
|
|
36
|
-
const filteredColumns = useMemo(() => columns.filter((c) => !c.hidden), [columns]);
|
|
37
|
-
const handlePageChange = useCallback(
|
|
38
|
-
(e) => {
|
|
39
|
-
onPageChange == null ? void 0 : onPageChange(e);
|
|
40
|
-
},
|
|
41
|
-
[onPageChange]
|
|
42
|
-
);
|
|
43
|
-
const getColStyle = (accessor, alignment) => {
|
|
44
|
-
const baseStyle = accessor ? columnStyles == null ? void 0 : columnStyles[String(accessor)] : void 0;
|
|
45
|
-
return {
|
|
46
|
-
textAlign: alignment != null ? alignment : "left",
|
|
47
|
-
...baseStyle != null ? baseStyle : {}
|
|
7
|
+
import { Checkbox } from '../../components/forms/checkbox/Checkbox';
|
|
8
|
+
import { Pagination } from '../../components/pagination/Pagination';
|
|
9
|
+
import { SkeletonLoaderItem } from '../../components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem';
|
|
10
|
+
import { TableEmptyState } from './components/empty-state/EmptyState';
|
|
11
|
+
import styles from './Table.module.css';
|
|
12
|
+
export function Table({ data, columns, selectedRows, onRowSelect, selectionMode = 'single', onSortChange, onRowClick, sortById, sortDirection, dataKey, headerExtras, columnStyles, headerBelowRow, striped, fillViewport = false, viewportBottomOffset = 0, viewportMin = 120, viewportIncludeMarginTop = false, take, skip, paginationPlacement = 'bottom', totalItemsCount, onPageChange, loading, variant = 'primary', size = 'md', getRowSeverity, showFirstLast = false, allRowsSelected, onSelectAllRows, viewMode, emptyConfig, }) {
|
|
13
|
+
const filteredColumns = useMemo(() => columns.filter(c => !c.hidden), [columns]);
|
|
14
|
+
const handlePageChange = useCallback((e) => {
|
|
15
|
+
onPageChange === null || onPageChange === void 0 ? void 0 : onPageChange(e);
|
|
16
|
+
}, [onPageChange]);
|
|
17
|
+
const getColStyle = (columnId, alignment, verticalAlignment, width) => {
|
|
18
|
+
const baseStyle = columnStyles === null || columnStyles === void 0 ? void 0 : columnStyles[columnId];
|
|
19
|
+
return {
|
|
20
|
+
...(baseStyle !== null && baseStyle !== void 0 ? baseStyle : {}),
|
|
21
|
+
...(alignment === 'right' && { fontVariantNumeric: 'tabular-nums' }),
|
|
22
|
+
verticalAlign: verticalAlignment !== null && verticalAlignment !== void 0 ? verticalAlignment : 'top',
|
|
23
|
+
textAlign: alignment !== null && alignment !== void 0 ? alignment : 'left',
|
|
24
|
+
width: width !== null && width !== void 0 ? width : baseStyle === null || baseStyle === void 0 ? void 0 : baseStyle.width,
|
|
25
|
+
minWidth: width !== null && width !== void 0 ? width : baseStyle === null || baseStyle === void 0 ? void 0 : baseStyle.minWidth,
|
|
26
|
+
};
|
|
48
27
|
};
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
]
|
|
142
|
-
},
|
|
143
|
-
`tableRow-${String(row[dataKey])}-${rowIndex} `
|
|
144
|
-
)) })
|
|
145
|
-
] });
|
|
146
|
-
if (fillViewport) {
|
|
147
|
-
return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "20px" }, children: [
|
|
148
|
-
/* @__PURE__ */ jsx("div", { ref: scrollRef, style: viewportStyle, className: styles.tableScroll, children: tableEl }),
|
|
149
|
-
onPageChange && /* @__PURE__ */ jsx(
|
|
150
|
-
Pagination,
|
|
151
|
-
{
|
|
152
|
-
itemsCount: totalItemsCount,
|
|
153
|
-
take,
|
|
154
|
-
skip,
|
|
155
|
-
onPageChange: handlePageChange
|
|
156
|
-
}
|
|
157
|
-
)
|
|
158
|
-
] });
|
|
159
|
-
}
|
|
160
|
-
return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "20px" }, children: [
|
|
161
|
-
tableEl,
|
|
162
|
-
" ",
|
|
163
|
-
onPageChange && /* @__PURE__ */ jsx(
|
|
164
|
-
Pagination,
|
|
165
|
-
{
|
|
166
|
-
itemsCount: totalItemsCount,
|
|
167
|
-
take,
|
|
168
|
-
skip,
|
|
169
|
-
onPageChange: handlePageChange
|
|
170
|
-
}
|
|
171
|
-
)
|
|
172
|
-
] });
|
|
28
|
+
const scrollRef = useRef(null);
|
|
29
|
+
const { style: viewportStyle } = useViewportFill(scrollRef, {
|
|
30
|
+
bottomOffset: viewportBottomOffset + 60,
|
|
31
|
+
min: viewportMin,
|
|
32
|
+
includeMarginTop: viewportIncludeMarginTop,
|
|
33
|
+
});
|
|
34
|
+
const tableEl = (_jsxs(_Fragment, { children: [_jsxs("table", { className: `${styles.table} ${styles[variant]} ${styles[size]}`, children: [_jsxs("thead", { children: [_jsxs("tr", { children: [selectedRows && onRowSelect && dataKey && (_jsx("th", { className: `${styles.fitContent} ${styles.th}`, children: selectionMode === 'multiple' ? (_jsx(Checkbox, { size: "sm", variant: "primary", checked: allRowsSelected, onChange: checked => onSelectAllRows === null || onSelectAllRows === void 0 ? void 0 : onSelectAllRows(checked) })) : null })), filteredColumns.map((column, index) => {
|
|
35
|
+
const isActiveSort = sortById === column.id;
|
|
36
|
+
const ariaSort = column.sortable && isActiveSort
|
|
37
|
+
? sortDirection === 'asc'
|
|
38
|
+
? 'ascending'
|
|
39
|
+
: 'descending'
|
|
40
|
+
: 'none';
|
|
41
|
+
const toggleSort = () => {
|
|
42
|
+
if (!onSortChange || !column.sortable)
|
|
43
|
+
return;
|
|
44
|
+
const nextDir = !isActiveSort
|
|
45
|
+
? 'asc'
|
|
46
|
+
: sortDirection === 'asc'
|
|
47
|
+
? 'desc'
|
|
48
|
+
: null;
|
|
49
|
+
onSortChange(column, nextDir);
|
|
50
|
+
};
|
|
51
|
+
return (_jsx("th", { style: getColStyle(column.id, column.align, 'middle'), "aria-sort": ariaSort, className: `${styles.th} ${column.sortable ? styles.sortable : ''} `, onClick: e => {
|
|
52
|
+
if (!column.sortable)
|
|
53
|
+
return;
|
|
54
|
+
if (e.target instanceof HTMLElement && e.target.closest('.resizer'))
|
|
55
|
+
return;
|
|
56
|
+
toggleSort();
|
|
57
|
+
}, role: column.sortable ? 'button' : undefined, tabIndex: column.sortable ? 0 : undefined, onKeyDown: e => {
|
|
58
|
+
if (!column.sortable)
|
|
59
|
+
return;
|
|
60
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
61
|
+
e.preventDefault();
|
|
62
|
+
toggleSort();
|
|
63
|
+
}
|
|
64
|
+
}, children: _jsx("div", { className: styles.thInner, children: _jsxs("span", { children: [_jsx("span", { className: styles.thLabel, children: typeof column.header === 'function' ? column.header() : column.header }), column.sortable && (_jsxs("span", { className: styles.sortIndicator, "aria-hidden": "true", children: [isActiveSort && sortDirection === 'asc' && _jsx(ArrowUp, {}), isActiveSort && sortDirection === 'desc' && (_jsx(ArrowDown, { className: styles.descending })), !isActiveSort && (_jsx(ArrowDown, { className: `${styles.descending} ${styles.inActiveSort}` }))] })), headerExtras === null || headerExtras === void 0 ? void 0 : headerExtras({ column, index })] }) }) }, column.id));
|
|
65
|
+
})] }), headerBelowRow ? (_jsx("tr", { className: styles.headerBelowRow, children: _jsx("th", { colSpan: filteredColumns.length, children: headerBelowRow }) })) : null] }), loading && !data.length ? (_jsx("tbody", { className: `${styles.tBody} ${striped ? styles.striped : ''}`, children: Array.from({ length: take !== null && take !== void 0 ? take : 5 }).map((_, rowIndex) => (_jsx("tr", { children: filteredColumns.map((column, colIndex) => (_jsx("td", { style: getColStyle(column.id, column.align, 'middle', column.width), className: `${styles.tableCell} ${column.fitContent ? 'fitContent' : ''}`, children: _jsx(SkeletonLoaderItem, { height: 20, width: "100%" }) }, `${column.id}-${colIndex}`))) }, `loading-row-${rowIndex}`))) })) : (_jsx("tbody", { className: `${styles.tBody} ${striped ? styles.striped : ''}`, children: data === null || data === void 0 ? void 0 : data.map((row, rowIndex) => {
|
|
66
|
+
const rowSeverity = getRowSeverity === null || getRowSeverity === void 0 ? void 0 : getRowSeverity(row);
|
|
67
|
+
return (_jsxs("tr", { tabIndex: onRowClick ? 0 : -1, onClick: e => {
|
|
68
|
+
const rowId = row[dataKey];
|
|
69
|
+
const isModifierClick = e.metaKey || e.ctrlKey;
|
|
70
|
+
const canSelect = Boolean(selectedRows && onRowSelect && dataKey);
|
|
71
|
+
if (isModifierClick && canSelect) {
|
|
72
|
+
e.preventDefault();
|
|
73
|
+
e.stopPropagation();
|
|
74
|
+
const isSelected = selectedRows.has(rowId);
|
|
75
|
+
if (selectionMode === 'single') {
|
|
76
|
+
// In single mode, treat modifier-click as "select this row"
|
|
77
|
+
// (toggle if already selected)
|
|
78
|
+
onRowSelect(rowId, !isSelected);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
// multiple mode: toggle selection
|
|
82
|
+
onRowSelect(rowId, !isSelected);
|
|
83
|
+
}
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick(row);
|
|
87
|
+
}, style: {
|
|
88
|
+
['--row-severity-color']: rowSeverity
|
|
89
|
+
? SeverityBgColor[rowSeverity]
|
|
90
|
+
: undefined,
|
|
91
|
+
}, className: `${onRowClick ? styles.clickableRow : ''} ${(selectedRows === null || selectedRows === void 0 ? void 0 : selectedRows.has(row[dataKey])) ? styles.selectedRow : ''} ${rowSeverity ? styles.severity : ''}`, children: [selectedRows && onRowSelect && dataKey && (_jsx("td", { className: "fitContent", onClick: e => e.stopPropagation(), children: _jsx(Checkbox, { variant: "primary", checked: selectedRows.has(row[dataKey]), size: "sm", onChange: () => onRowSelect === null || onRowSelect === void 0 ? void 0 : onRowSelect(row[dataKey], !selectedRows.has(row[dataKey])) }) })), filteredColumns.map(column => {
|
|
92
|
+
var _a, _b;
|
|
93
|
+
return (_jsx("td", { style: getColStyle(column.id, column.align, column.verticalAlign, column.width), className: `${styles.tableCell} ${column.fitContent ? 'fitContent' : ''} ${column.allowWrap ||
|
|
94
|
+
(selectedRows === null || selectedRows === void 0 ? void 0 : selectedRows.has(row[dataKey])) ||
|
|
95
|
+
viewMode === 'comfortable'
|
|
96
|
+
? styles.allowWrap
|
|
97
|
+
: styles.nowrap} `, children: column.render
|
|
98
|
+
? column.render(row) || ((_a = column.emptyPlaceholder) !== null && _a !== void 0 ? _a : '')
|
|
99
|
+
: column.accessor
|
|
100
|
+
? row[column.accessor] || ((_b = column.emptyPlaceholder) !== null && _b !== void 0 ? _b : '')
|
|
101
|
+
: null }, column.id));
|
|
102
|
+
})] }, `tableRow-${String(row[dataKey])}-${rowIndex}`));
|
|
103
|
+
}) }))] }), !data.length && !loading && _jsx(TableEmptyState, { config: emptyConfig })] }));
|
|
104
|
+
if (fillViewport) {
|
|
105
|
+
return (_jsxs("div", { style: {
|
|
106
|
+
display: 'flex',
|
|
107
|
+
flexDirection: 'column',
|
|
108
|
+
gap: '20px',
|
|
109
|
+
flexFlow: paginationPlacement === 'top' ? 'column-reverse' : 'column',
|
|
110
|
+
position: 'relative',
|
|
111
|
+
}, children: [_jsx("div", { ref: scrollRef, style: viewportStyle, className: styles.tableScroll, children: tableEl }), onPageChange && (_jsx(Pagination, { itemsCount: totalItemsCount, take: take, skip: skip, onPageChange: handlePageChange, showFirstLast: showFirstLast }))] }));
|
|
112
|
+
}
|
|
113
|
+
return (_jsxs("div", { style: {
|
|
114
|
+
display: 'flex',
|
|
115
|
+
flexDirection: 'column',
|
|
116
|
+
gap: '20px',
|
|
117
|
+
flexFlow: paginationPlacement === 'top' ? 'column-reverse' : 'column',
|
|
118
|
+
position: 'relative',
|
|
119
|
+
}, children: [tableEl, onPageChange && (_jsx(Pagination, { itemsCount: totalItemsCount, take: take, skip: skip, onPageChange: handlePageChange }))] }));
|
|
173
120
|
}
|
|
174
|
-
|
|
175
|
-
export { Table };
|