@dbcdk/react-components 0.0.22 → 0.0.23
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/components/button/Button.module.css +19 -14
- package/dist/components/filter-field/FilterField.js +1 -1
- package/dist/components/filter-field/FilterField.module.css +25 -7
- package/dist/components/filtering/chip-multi-toggle/ChipMultiToggle.d.ts +0 -2
- package/dist/components/forms/input/Input.module.css +3 -5
- package/dist/components/pagination/Pagination.js +12 -2
- package/dist/components/segmented-progress-bar/SegmentedProgressBar.module.css +2 -2
- package/dist/components/sidebar/Sidebar.d.ts +2 -1
- package/dist/components/sidebar/Sidebar.js +2 -2
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.d.ts +2 -1
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.js +2 -2
- package/dist/components/table/Table.d.ts +3 -2
- package/dist/components/table/Table.js +3 -3
- package/dist/components/table/Table.module.css +5 -3
- package/package.json +1 -1
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
user-select: none;
|
|
24
24
|
white-space: nowrap;
|
|
25
25
|
}
|
|
26
|
+
|
|
26
27
|
.buttonLink {
|
|
27
28
|
color: inherit;
|
|
28
29
|
text-decoration: none;
|
|
@@ -35,9 +36,11 @@
|
|
|
35
36
|
border-color var(--transition-fast) var(--ease-standard),
|
|
36
37
|
box-shadow var(--transition-fast) var(--ease-standard);
|
|
37
38
|
}
|
|
39
|
+
|
|
38
40
|
.button:focus-visible {
|
|
39
41
|
outline: none;
|
|
40
|
-
|
|
42
|
+
border-color: var(--color-border-selected);
|
|
43
|
+
box-shadow: inset 0 0 0 1px var(--color-border-selected);
|
|
41
44
|
}
|
|
42
45
|
|
|
43
46
|
.round {
|
|
@@ -47,6 +50,7 @@
|
|
|
47
50
|
.rounded {
|
|
48
51
|
border-radius: var(--border-radius-rounded);
|
|
49
52
|
}
|
|
53
|
+
|
|
50
54
|
.button:disabled,
|
|
51
55
|
.button[aria-disabled='true'] {
|
|
52
56
|
cursor: not-allowed;
|
|
@@ -73,7 +77,8 @@
|
|
|
73
77
|
|
|
74
78
|
.link:focus-visible {
|
|
75
79
|
outline: none;
|
|
76
|
-
|
|
80
|
+
text-decoration: underline;
|
|
81
|
+
text-decoration-color: currentColor;
|
|
77
82
|
}
|
|
78
83
|
|
|
79
84
|
/* Icons */
|
|
@@ -93,8 +98,9 @@
|
|
|
93
98
|
|
|
94
99
|
.button.xs {
|
|
95
100
|
height: var(--component-size-xs);
|
|
96
|
-
min-block-size: var(--component-size-
|
|
97
|
-
padding-inline: var(--spacing-
|
|
101
|
+
min-block-size: var(--component-size-xs);
|
|
102
|
+
padding-inline: var(--spacing-xs);
|
|
103
|
+
font-size: var(--font-size-xs);
|
|
98
104
|
}
|
|
99
105
|
|
|
100
106
|
.button.sm {
|
|
@@ -103,13 +109,6 @@
|
|
|
103
109
|
padding-inline: var(--spacing-xs);
|
|
104
110
|
}
|
|
105
111
|
|
|
106
|
-
.button.xs {
|
|
107
|
-
height: var(--component-size-xs);
|
|
108
|
-
min-block-size: var(--component-size-xs);
|
|
109
|
-
padding-inline: var(--spacing-xs);
|
|
110
|
-
font-size: var(--font-size-xs);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
112
|
.button.sm svg {
|
|
114
113
|
inline-size: var(--icon-size-sm);
|
|
115
114
|
block-size: var(--icon-size-sm);
|
|
@@ -163,9 +162,8 @@
|
|
|
163
162
|
|
|
164
163
|
.default:focus-visible {
|
|
165
164
|
outline: none;
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
var(--focus-ring);
|
|
165
|
+
border-color: var(--color-border-selected);
|
|
166
|
+
box-shadow: inset 0 0 0 1px var(--color-border-selected);
|
|
169
167
|
}
|
|
170
168
|
|
|
171
169
|
.outlined {
|
|
@@ -223,6 +221,13 @@
|
|
|
223
221
|
background-color: var(--opac-bg-light);
|
|
224
222
|
}
|
|
225
223
|
|
|
224
|
+
.button.inline:focus-visible {
|
|
225
|
+
outline: none;
|
|
226
|
+
background-color: var(--opac-bg-light);
|
|
227
|
+
border-color: transparent;
|
|
228
|
+
box-shadow: inset 0 0 0 1px var(--color-border-selected);
|
|
229
|
+
}
|
|
230
|
+
|
|
226
231
|
.active {
|
|
227
232
|
background-color: var(--button-bg-primary);
|
|
228
233
|
color: var(--button-fg-primary);
|
|
@@ -137,7 +137,7 @@ export function FilterField({ field, control, operator, value, onChange, operato
|
|
|
137
137
|
isTypingRef.current = true;
|
|
138
138
|
setLocalValue(next);
|
|
139
139
|
scheduleEmitValue(next);
|
|
140
|
-
}, fullWidth: true, inputSize: size, placeholder: placeholder,
|
|
140
|
+
}, fullWidth: true, inputSize: size, placeholder: placeholder, disabled: disabled, onClear: () => {
|
|
141
141
|
isTypingRef.current = false;
|
|
142
142
|
if (debounceRef.current)
|
|
143
143
|
clearTimeout(debounceRef.current);
|
|
@@ -96,6 +96,15 @@
|
|
|
96
96
|
z-index: 2;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
+
.filterField.outlined.active::before {
|
|
100
|
+
inset-inline-start: -1px;
|
|
101
|
+
top: -1px;
|
|
102
|
+
bottom: -1px;
|
|
103
|
+
width: 4px;
|
|
104
|
+
border-top-left-radius: var(--border-radius-default);
|
|
105
|
+
border-bottom-left-radius: var(--border-radius-default);
|
|
106
|
+
}
|
|
107
|
+
|
|
99
108
|
/* =========================
|
|
100
109
|
FOCUS
|
|
101
110
|
========================= */
|
|
@@ -157,9 +166,10 @@
|
|
|
157
166
|
display: inline-flex;
|
|
158
167
|
align-items: center;
|
|
159
168
|
padding-block: var(--spacing-2xs);
|
|
160
|
-
padding-inline: var(--spacing-
|
|
169
|
+
padding-inline: var(--spacing-xs);
|
|
170
|
+
padding-inline-end: var(--spacing-xxs);
|
|
161
171
|
font-size: var(--font-size-sm);
|
|
162
|
-
color: var(--color-fg-
|
|
172
|
+
color: var(--color-fg-subtle);
|
|
163
173
|
white-space: nowrap;
|
|
164
174
|
user-select: none;
|
|
165
175
|
}
|
|
@@ -175,8 +185,7 @@
|
|
|
175
185
|
gap: var(--spacing-xxs);
|
|
176
186
|
height: 100%;
|
|
177
187
|
padding-block: var(--spacing-2xs);
|
|
178
|
-
padding-inline: var(--spacing-
|
|
179
|
-
|
|
188
|
+
padding-inline: var(--spacing-xxs);
|
|
180
189
|
color: var(--color-fg-default);
|
|
181
190
|
background: transparent;
|
|
182
191
|
border: 0;
|
|
@@ -184,7 +193,7 @@
|
|
|
184
193
|
position: relative;
|
|
185
194
|
z-index: 0;
|
|
186
195
|
font-weight: var(--font-weight-default);
|
|
187
|
-
|
|
196
|
+
font-size: var(--font-size-sm);
|
|
188
197
|
transition:
|
|
189
198
|
background-color var(--transition-fast) var(--ease-standard),
|
|
190
199
|
color var(--transition-fast) var(--ease-standard);
|
|
@@ -206,6 +215,17 @@
|
|
|
206
215
|
z-index: 1;
|
|
207
216
|
}
|
|
208
217
|
|
|
218
|
+
.filterField .operatorTrigger:hover:not(:disabled) {
|
|
219
|
+
color: var(--color-fg-default);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.filterField .operatorTrigger:hover:not(:disabled)::after {
|
|
223
|
+
background: color-mix(
|
|
224
|
+
in srgb,
|
|
225
|
+
var(--color-fg-default) 8%,
|
|
226
|
+
var(--filter-operator-bg, transparent)
|
|
227
|
+
);
|
|
228
|
+
}
|
|
209
229
|
/* =========================
|
|
210
230
|
SEPARATORS
|
|
211
231
|
========================= */
|
|
@@ -272,8 +292,6 @@
|
|
|
272
292
|
min-width: 0;
|
|
273
293
|
}
|
|
274
294
|
|
|
275
|
-
/* subtle highlight when active */
|
|
276
|
-
|
|
277
295
|
.filterField.active .valueWrapper {
|
|
278
296
|
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-border-selected) 18%, transparent);
|
|
279
297
|
}
|
|
@@ -12,8 +12,6 @@ interface ChipMultiToggleProps {
|
|
|
12
12
|
onChange: (nextSelectedValues: string[]) => void;
|
|
13
13
|
onToggle?: (toggledValue: string, isSelected: boolean) => void;
|
|
14
14
|
size?: 'sm' | 'md' | 'lg';
|
|
15
|
-
selectedSeverity: 'neutral' | 'info' | 'success' | 'warning' | 'danger' | 'brand';
|
|
16
|
-
unselectedSeverity?: 'neutral' | 'info' | 'success' | 'warning' | 'danger' | null;
|
|
17
15
|
fullWidth?: boolean;
|
|
18
16
|
disabled?: boolean;
|
|
19
17
|
showAllOption?: boolean;
|
|
@@ -72,9 +72,8 @@
|
|
|
72
72
|
border-bottom-right-radius: 0;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
/* Optional: if ClearButton is absolutely positioned, reserve space */
|
|
76
75
|
.withClear .input {
|
|
77
|
-
padding-inline-end: calc(var(--spacing-md) +
|
|
76
|
+
padding-inline-end: calc(var(--spacing-md) + 16px);
|
|
78
77
|
}
|
|
79
78
|
|
|
80
79
|
/* Global focus reset - variants own visible focus treatment */
|
|
@@ -133,13 +132,12 @@
|
|
|
133
132
|
box-shadow: inset 0 0 0 1px var(--color-border-selected);
|
|
134
133
|
}
|
|
135
134
|
|
|
136
|
-
/* Embedded = chromeless input for grouped controls like FilterField */
|
|
137
135
|
.embedded {
|
|
138
136
|
background-color: transparent;
|
|
139
137
|
border-color: transparent;
|
|
140
138
|
border-radius: 0;
|
|
141
139
|
box-shadow: none;
|
|
142
|
-
padding-inline:
|
|
140
|
+
padding-inline: var(--spacing-xs);
|
|
143
141
|
padding-block: 0;
|
|
144
142
|
}
|
|
145
143
|
|
|
@@ -175,7 +173,7 @@
|
|
|
175
173
|
/* Sizes */
|
|
176
174
|
.xs {
|
|
177
175
|
block-size: var(--component-size-xs);
|
|
178
|
-
font-size: var(--font-size-
|
|
176
|
+
font-size: var(--font-size-xs);
|
|
179
177
|
padding: 0 var(--spacing-xxs);
|
|
180
178
|
}
|
|
181
179
|
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { ArrowLeft, ArrowRight, ChevronDown, ChevronsLeft, ChevronsRight } from 'lucide-react';
|
|
4
|
-
import { useMemo, useCallback } from 'react';
|
|
4
|
+
import { useMemo, useCallback, useRef } from 'react';
|
|
5
5
|
import styles from './Pagination.module.css';
|
|
6
6
|
import { Button } from '../button/Button';
|
|
7
7
|
import { Menu } from '../menu/Menu';
|
|
8
8
|
import { Popover } from '../popover/Popover';
|
|
9
9
|
const DEFAULT_PAGE_SIZE_OPTIONS = [10, 25, 50, 100];
|
|
10
10
|
export function Pagination({ itemsCount = 0, skip = 0, take = DEFAULT_PAGE_SIZE_OPTIONS[1], onPageChange, pageSizeOptions = DEFAULT_PAGE_SIZE_OPTIONS, showFirstLast = true, showGoToPage = true, }) {
|
|
11
|
+
const popoverRef = useRef(null);
|
|
12
|
+
const pageSizeRef = useRef(null);
|
|
11
13
|
const totalPages = useMemo(() => Math.max(1, Math.ceil(itemsCount / Math.max(1, take))), [itemsCount, take]);
|
|
12
14
|
const currentPage = useMemo(() => {
|
|
13
15
|
const p = Math.floor(skip / Math.max(1, take)) + 1;
|
|
@@ -40,5 +42,13 @@ export function Pagination({ itemsCount = 0, skip = 0, take = DEFAULT_PAGE_SIZE_
|
|
|
40
42
|
}, [itemsCount, skip, take]);
|
|
41
43
|
const pages = useMemo(() => Array.from({ length: totalPages }, (_, i) => i + 1), [totalPages]);
|
|
42
44
|
const handlePageSizeChange = useCallback((size) => emit(1, size), [emit]);
|
|
43
|
-
return (_jsxs("div", { className: styles.container, children: [showFirstLast && (_jsx(Button, { size: "sm", icon: _jsx(ChevronsLeft, {}), disabled: !canPrev, onClick: firstPage, "aria-label": "First page" })), _jsx(Button, { size: "sm", icon: _jsx(ArrowLeft, {}), disabled: !canPrev, onClick: prevPage, "aria-label": "Previous page" }), _jsx("div", { className: styles.range, "aria-live": "polite", children: rangeLabel }), _jsx(Button, { size: "sm", icon: _jsx(ArrowRight, {}), disabled: !canNext, onClick: nextPage, "aria-label": "Next page" }), showFirstLast && (_jsx(Button, { size: "sm", icon: _jsx(ChevronsRight, {}), disabled: !canNext, onClick: lastPage, "aria-label": "Last page" })), showGoToPage && (_jsx(Popover, { trigger: open => (_jsxs(Button, { size: "sm", variant: "outlined", onClick: open, children: ["Side ", currentPage, "/", totalPages, " ", _jsx(ChevronDown, { size: 16 })] })), children: _jsx(Menu, { children: pages
|
|
45
|
+
return (_jsxs("div", { className: styles.container, children: [showFirstLast && (_jsx(Button, { size: "sm", icon: _jsx(ChevronsLeft, {}), disabled: !canPrev, onClick: firstPage, "aria-label": "First page" })), _jsx(Button, { size: "sm", icon: _jsx(ArrowLeft, {}), disabled: !canPrev, onClick: prevPage, "aria-label": "Previous page" }), _jsx("div", { className: styles.range, "aria-live": "polite", children: rangeLabel }), _jsx(Button, { size: "sm", icon: _jsx(ArrowRight, {}), disabled: !canNext, onClick: nextPage, "aria-label": "Next page" }), showFirstLast && (_jsx(Button, { size: "sm", icon: _jsx(ChevronsRight, {}), disabled: !canNext, onClick: lastPage, "aria-label": "Last page" })), showGoToPage && (_jsx(Popover, { ref: popoverRef, trigger: open => (_jsxs(Button, { size: "sm", variant: "outlined", onClick: open, children: ["Side ", currentPage, "/", totalPages, " ", _jsx(ChevronDown, { size: 16 })] })), children: _jsx(Menu, { children: pages === null || pages === void 0 ? void 0 : pages.map(page => (_jsx(Menu.Item, { active: page === currentPage, children: _jsx("button", { onClick: () => {
|
|
46
|
+
var _a;
|
|
47
|
+
goToPage(page);
|
|
48
|
+
(_a = popoverRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
49
|
+
}, children: page }) }, page))) }) })), _jsx(Popover, { ref: pageSizeRef, trigger: open => (_jsxs(Button, { size: "sm", variant: "outlined", onClick: open, children: ["Vis ", take, " ", _jsx(ChevronDown, { size: 16 })] })), children: _jsx(Menu, { children: pageSizeOptions === null || pageSizeOptions === void 0 ? void 0 : pageSizeOptions.map(size => (_jsx(Menu.Item, { active: size === take, children: _jsx("button", { onClick: () => {
|
|
50
|
+
var _a;
|
|
51
|
+
handlePageSizeChange(size);
|
|
52
|
+
(_a = pageSizeRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
53
|
+
}, children: size }) }, size))) }) })] }));
|
|
44
54
|
}
|
|
@@ -66,11 +66,11 @@
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
.progressSegment[data-severity='progress'] {
|
|
69
|
-
background: color-mix(in srgb, var(--color-fg-subtle)
|
|
69
|
+
background: color-mix(in srgb, var(--color-fg-subtle) 5%, var(--color-bg-surface));
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
.progressSegment[data-severity='missing'] {
|
|
73
|
-
background: color-mix(in srgb, var(--color-
|
|
73
|
+
background: color-mix(in srgb, var(--color-fg-subtle) 2.5%, var(--color-bg-surface));
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
.progressSegment[data-severity='neutral'] {
|
|
@@ -10,6 +10,7 @@ interface SidebarProps {
|
|
|
10
10
|
productLogo?: React.ReactNode;
|
|
11
11
|
activeLink?: string;
|
|
12
12
|
version?: string | number;
|
|
13
|
+
hideSearch?: boolean;
|
|
13
14
|
}
|
|
14
|
-
export declare function Sidebar({ items, productLogo, activeLink, version }: SidebarProps): JSX.Element;
|
|
15
|
+
export declare function Sidebar({ items, productLogo, activeLink, version, hideSearch, }: SidebarProps): JSX.Element;
|
|
15
16
|
export {};
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { SidebarContainer } from './components/sidebar-container/SidebarContainer';
|
|
4
4
|
import { SidebarProvider } from './providers/SidebarProvider';
|
|
5
|
-
export function Sidebar({ items, productLogo, activeLink, version }) {
|
|
6
|
-
return (_jsx(SidebarProvider, { items: items, children: _jsx(SidebarContainer, { productLogo: productLogo, activeLink: activeLink, version: version }) }));
|
|
5
|
+
export function Sidebar({ items, productLogo, activeLink, version, hideSearch, }) {
|
|
6
|
+
return (_jsx(SidebarProvider, { items: items, children: _jsx(SidebarContainer, { productLogo: productLogo, activeLink: activeLink, version: version, hideSearch: hideSearch }) }));
|
|
7
7
|
}
|
|
@@ -5,6 +5,7 @@ interface SidebarContainerProps {
|
|
|
5
5
|
productLogo?: ReactNode;
|
|
6
6
|
activeLink?: string;
|
|
7
7
|
version?: string | number;
|
|
8
|
+
hideSearch?: boolean;
|
|
8
9
|
}
|
|
9
|
-
export declare function SidebarContainer({ logo, productLogo, activeLink, version, }: SidebarContainerProps): JSX.Element;
|
|
10
|
+
export declare function SidebarContainer({ logo, productLogo, activeLink, version, hideSearch, }: SidebarContainerProps): JSX.Element;
|
|
10
11
|
export {};
|
|
@@ -6,7 +6,7 @@ import { SidebarItems } from '../../../../components/sidebar/components/sidebar-
|
|
|
6
6
|
import SidenavFiltering from '../../../../components/sidebar/components/sidenav-filteirng/SidenavFiltering';
|
|
7
7
|
import { useSidebar } from '../../../../components/sidebar/providers/SidebarProvider';
|
|
8
8
|
import styles from './SidebarContainer.module.css';
|
|
9
|
-
export function SidebarContainer({ logo, productLogo, activeLink, version, }) {
|
|
9
|
+
export function SidebarContainer({ logo, productLogo, activeLink, version, hideSearch, }) {
|
|
10
10
|
const { isSidebarCollapsed, handleSidebarCollapseChange } = useSidebar();
|
|
11
|
-
return (_jsxs("div", { className: `${styles.container} ${isSidebarCollapsed ? styles.collapsed : ''}`, children: [_jsx("div", { className: styles.header, children: _jsxs("div", { className: styles.productHeader, children: [_jsx("div", { className: styles.productLogo, children: productLogo }), _jsx(Button, { size: "md", variant: "inline", shape: "round", "aria-label": "Collapse sidebar", icon: _jsx(ChevronLeft, { className: isSidebarCollapsed ? styles.collapsedIcon : '' }), onClick: () => handleSidebarCollapseChange(!isSidebarCollapsed) })] }) }), _jsxs("div", { className: styles.content, children: [_jsx("div", { className: styles.filter, children: _jsx(SidenavFiltering, {}) }), _jsx("div", { className: `${styles.links} hideScrollBar`, children: _jsx(SidebarItems, { activeLink: activeLink }) })] }), _jsxs("div", { className: styles.footer, children: [_jsx("div", { className: styles.companyLogo, children: logo !== null && logo !== void 0 ? logo : _jsx(Logo, {}) }), version && _jsx("div", { className: `${styles.version} dbc-muted-text dbc-sm-text`, children: version })] })] }));
|
|
11
|
+
return (_jsxs("div", { className: `${styles.container} ${isSidebarCollapsed ? styles.collapsed : ''}`, children: [_jsx("div", { className: styles.header, children: _jsxs("div", { className: styles.productHeader, children: [_jsx("div", { className: styles.productLogo, children: productLogo }), _jsx(Button, { size: "md", variant: "inline", shape: "round", "aria-label": "Collapse sidebar", icon: _jsx(ChevronLeft, { className: isSidebarCollapsed ? styles.collapsedIcon : '' }), onClick: () => handleSidebarCollapseChange(!isSidebarCollapsed) })] }) }), _jsxs("div", { className: styles.content, children: [!hideSearch && (_jsx("div", { className: styles.filter, children: _jsx(SidenavFiltering, {}) })), _jsx("div", { className: `${styles.links} hideScrollBar`, children: _jsx(SidebarItems, { activeLink: activeLink }) })] }), _jsxs("div", { className: styles.footer, children: [_jsx("div", { className: styles.companyLogo, children: logo !== null && logo !== void 0 ? logo : _jsx(Logo, {}) }), version && _jsx("div", { className: `${styles.version} dbc-muted-text dbc-sm-text`, children: version })] })] }));
|
|
12
12
|
}
|
|
@@ -25,7 +25,7 @@ type HeaderExtrasArgs<T> = {
|
|
|
25
25
|
index: number;
|
|
26
26
|
};
|
|
27
27
|
export type TableVariant = 'primary' | 'embedded';
|
|
28
|
-
export type TableProps<T extends Record<string, any>> = Omit<HTMLAttributes<HTMLDivElement>, 'onClick'> & {
|
|
28
|
+
export type TableProps<T extends Record<string, any>> = Omit<HTMLAttributes<HTMLDivElement>, 'onClick' | 'onMouseEnter'> & {
|
|
29
29
|
data: T[];
|
|
30
30
|
dataKey: keyof T;
|
|
31
31
|
columns: ColumnItem<T>[];
|
|
@@ -33,6 +33,7 @@ export type TableProps<T extends Record<string, any>> = Omit<HTMLAttributes<HTML
|
|
|
33
33
|
selectionMode?: 'single' | 'multiple';
|
|
34
34
|
allRowsSelected?: boolean;
|
|
35
35
|
onRowClick?: (row: T) => void;
|
|
36
|
+
onRowMouseEnter?: (row: T) => void;
|
|
36
37
|
onRowSelect?: (rowId: number | string, isSelected: boolean) => void;
|
|
37
38
|
onSelectAllRows?: (isSelected: boolean) => void;
|
|
38
39
|
onSortChange?: (column: ColumnItem<T>, direction: SortDirection) => void;
|
|
@@ -59,5 +60,5 @@ export type TableProps<T extends Record<string, any>> = Omit<HTMLAttributes<HTML
|
|
|
59
60
|
viewMode?: ViewMode;
|
|
60
61
|
emptyConfig?: TableEmptyConfig;
|
|
61
62
|
};
|
|
62
|
-
export declare function Table<T extends Record<string, any>>({ data, columns, selectedRows, onRowSelect, selectionMode, onSortChange, onRowClick, sortById, sortDirection, dataKey, headerExtras, gridTemplateColumns, toolbar, striped, fillViewport, viewportBottomOffset, viewportMin, viewportIncludeMarginTop, take, skip, paginationPlacement, totalItemsCount, onPageChange, loading, variant, size, getRowSeverity, showFirstLast, allRowsSelected, onSelectAllRows, viewMode, emptyConfig, ...rest }: TableProps<T>): JSX.Element;
|
|
63
|
+
export declare function Table<T extends Record<string, any>>({ data, columns, selectedRows, onRowSelect, selectionMode, onSortChange, onRowClick, onRowMouseEnter, sortById, sortDirection, dataKey, headerExtras, gridTemplateColumns, toolbar, striped, fillViewport, viewportBottomOffset, viewportMin, viewportIncludeMarginTop, take, skip, paginationPlacement, totalItemsCount, onPageChange, loading, variant, size, getRowSeverity, showFirstLast, allRowsSelected, onSelectAllRows, viewMode, emptyConfig, ...rest }: TableProps<T>): JSX.Element;
|
|
63
64
|
export {};
|
|
@@ -18,7 +18,7 @@ function buildDefaultGridTemplate(args) {
|
|
|
18
18
|
parts.push('minmax(120px, 1fr)');
|
|
19
19
|
return parts.join(' ');
|
|
20
20
|
}
|
|
21
|
-
export function Table({ data, columns, selectedRows, onRowSelect, selectionMode = 'single', onSortChange, onRowClick, sortById, sortDirection, dataKey, headerExtras, gridTemplateColumns, toolbar, striped, fillViewport = false, viewportBottomOffset, viewportMin, viewportIncludeMarginTop, take, skip, paginationPlacement = 'bottom', totalItemsCount, onPageChange, loading, variant = 'primary', size = 'md', getRowSeverity, showFirstLast = false, allRowsSelected, onSelectAllRows, viewMode, emptyConfig, ...rest }) {
|
|
21
|
+
export function Table({ data, columns, selectedRows, onRowSelect, selectionMode = 'single', onSortChange, onRowClick, onRowMouseEnter, sortById, sortDirection, dataKey, headerExtras, gridTemplateColumns, toolbar, striped, fillViewport = false, viewportBottomOffset, viewportMin, viewportIncludeMarginTop, take, skip, paginationPlacement = 'bottom', totalItemsCount, onPageChange, loading, variant = 'primary', size = 'md', getRowSeverity, showFirstLast = false, allRowsSelected, onSelectAllRows, viewMode, emptyConfig, ...rest }) {
|
|
22
22
|
void viewportBottomOffset;
|
|
23
23
|
void viewportMin;
|
|
24
24
|
void viewportIncludeMarginTop;
|
|
@@ -115,7 +115,7 @@ export function Table({ data, columns, selectedRows, onRowSelect, selectionMode
|
|
|
115
115
|
e.preventDefault();
|
|
116
116
|
onRowClick(row);
|
|
117
117
|
}
|
|
118
|
-
}, onClick: e => {
|
|
118
|
+
}, onMouseEnter: () => onRowMouseEnter === null || onRowMouseEnter === void 0 ? void 0 : onRowMouseEnter(row), onClick: e => {
|
|
119
119
|
const canSelect = Boolean(selectedRows && onRowSelect && dataKey);
|
|
120
120
|
if (isModifierClick(e) && canSelect) {
|
|
121
121
|
e.preventDefault();
|
|
@@ -154,7 +154,7 @@ export function Table({ data, columns, selectedRows, onRowSelect, selectionMode
|
|
|
154
154
|
]
|
|
155
155
|
.filter(Boolean)
|
|
156
156
|
.join(' ');
|
|
157
|
-
const tableShell = (
|
|
157
|
+
const tableShell = (_jsx("div", { ...rest, className: tableClassName, role: "table", "aria-rowcount": data.length, children: _jsxs("div", { className: styles.tableContent, children: [_jsx("div", { className: styles.header, role: "rowgroup", children: headerEl }), _jsx("div", { className: styles.bodyScroll, children: !data.length && !loading ? (_jsx("div", { className: styles.emptyStateSlot, children: _jsx(TableEmptyState, { config: emptyConfig }) })) : (bodyContent) })] }) }));
|
|
158
158
|
const paginationEl = onPageChange && data.length > 0 ? (_jsx("div", { className: `${styles.paginationSlot} ${paginationPlacement === 'top' ? styles.paginationSlotTop : ''}`, children: _jsx(Pagination, { itemsCount: totalItemsCount, take: take, skip: skip, onPageChange: handlePageChange, showFirstLast: showFirstLast }) })) : null;
|
|
159
159
|
if (fillViewport) {
|
|
160
160
|
return (_jsxs("div", { className: styles.fillViewportRoot, style: {
|
|
@@ -74,7 +74,6 @@
|
|
|
74
74
|
flex: 1 1 auto;
|
|
75
75
|
min-block-size: 0;
|
|
76
76
|
min-inline-size: 0;
|
|
77
|
-
max-inline-size: 100%;
|
|
78
77
|
-webkit-overflow-scrolling: touch;
|
|
79
78
|
}
|
|
80
79
|
|
|
@@ -103,11 +102,15 @@
|
|
|
103
102
|
display: none;
|
|
104
103
|
}
|
|
105
104
|
|
|
105
|
+
.tableContent {
|
|
106
|
+
inline-size: fit-content;
|
|
107
|
+
min-inline-size: 100%;
|
|
108
|
+
}
|
|
109
|
+
|
|
106
110
|
.headerCell {
|
|
107
111
|
display: flex;
|
|
108
112
|
align-items: center;
|
|
109
113
|
position: relative;
|
|
110
|
-
min-block-size: 44px;
|
|
111
114
|
padding-block: var(--spacing-xxs);
|
|
112
115
|
padding-inline: var(--spacing-sm);
|
|
113
116
|
font-size: var(--font-size-xs);
|
|
@@ -122,7 +125,6 @@
|
|
|
122
125
|
}
|
|
123
126
|
|
|
124
127
|
.sm .headerCell {
|
|
125
|
-
min-block-size: 40px;
|
|
126
128
|
padding-block: var(--spacing-xxs);
|
|
127
129
|
padding-inline: var(--spacing-sm);
|
|
128
130
|
}
|