@dbcdk/react-components 0.0.135 → 0.0.137
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/forms/file-upload/FileUpload.cjs +13 -3
- package/dist/components/forms/file-upload/FileUpload.d.ts +4 -1
- package/dist/components/forms/file-upload/FileUpload.js +14 -4
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.cjs +12 -10
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.js +12 -10
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.module.css +18 -14
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.module.css +12 -0
- package/dist/components/table/Table.cjs +3 -4
- package/dist/components/table/Table.d.ts +1 -1
- package/dist/components/table/Table.js +4 -5
- package/dist/components/table/Table.module.css +52 -21
- package/dist/components/table/Table.types.d.ts +9 -1
- package/dist/components/table/components/TableBody.cjs +2 -0
- package/dist/components/table/components/TableBody.d.ts +2 -1
- package/dist/components/table/components/TableBody.js +2 -0
- package/dist/components/table/components/TableHeader.cjs +1 -10
- package/dist/components/table/components/TableHeader.d.ts +1 -2
- package/dist/components/table/components/TableHeader.js +1 -10
- package/dist/components/table/components/TableRow.cjs +89 -68
- package/dist/components/table/components/TableRow.d.ts +2 -1
- package/dist/components/table/components/TableRow.js +89 -68
- package/dist/components/table/table.utils.cjs +0 -2
- package/dist/components/table/table.utils.d.ts +0 -1
- package/dist/components/table/table.utils.js +1 -2
- package/dist/components/table/tanstackTable.utils.cjs +2 -2
- package/dist/components/table/tanstackTable.utils.js +3 -3
- package/dist/hooks/useSorting.cjs +1 -0
- package/dist/hooks/useSorting.d.ts +6 -5
- package/dist/hooks/useSorting.js +1 -1
- package/dist/hooks/useTableData.cjs +29 -7
- package/dist/hooks/useTableData.d.ts +3 -1
- package/dist/hooks/useTableData.js +31 -9
- package/package.json +1 -1
|
@@ -11,7 +11,7 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
11
11
|
|
|
12
12
|
var styles__default = /*#__PURE__*/_interopDefault(styles);
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
const FileUpload = react.forwardRef(function FileUpload2({
|
|
15
15
|
label,
|
|
16
16
|
labelAction,
|
|
17
17
|
error,
|
|
@@ -33,11 +33,20 @@ function FileUpload({
|
|
|
33
33
|
disabled,
|
|
34
34
|
className,
|
|
35
35
|
...inputProps
|
|
36
|
-
}) {
|
|
36
|
+
}, ref) {
|
|
37
37
|
const reactId = react.useId();
|
|
38
38
|
const inputId = id != null ? id : `file-upload-${reactId}`;
|
|
39
39
|
const inputRef = react.useRef(null);
|
|
40
40
|
const [dragging, setDragging] = react.useState(false);
|
|
41
|
+
react.useImperativeHandle(
|
|
42
|
+
ref,
|
|
43
|
+
() => ({
|
|
44
|
+
clear() {
|
|
45
|
+
if (inputRef.current) inputRef.current.value = "";
|
|
46
|
+
}
|
|
47
|
+
}),
|
|
48
|
+
[]
|
|
49
|
+
);
|
|
41
50
|
function handleDragOver(e) {
|
|
42
51
|
e.preventDefault();
|
|
43
52
|
if (!disabled) setDragging(true);
|
|
@@ -112,6 +121,7 @@ function FileUpload({
|
|
|
112
121
|
)
|
|
113
122
|
}
|
|
114
123
|
);
|
|
115
|
-
}
|
|
124
|
+
});
|
|
125
|
+
FileUpload.displayName = "FileUpload";
|
|
116
126
|
|
|
117
127
|
exports.FileUpload = FileUpload;
|
|
@@ -12,4 +12,7 @@ export interface FileUploadProps extends Omit<InputHTMLAttributes<HTMLInputEleme
|
|
|
12
12
|
width?: string | number;
|
|
13
13
|
maxWidth?: string | number;
|
|
14
14
|
}
|
|
15
|
-
export
|
|
15
|
+
export type FileUploadHandle = {
|
|
16
|
+
clear(): void;
|
|
17
|
+
};
|
|
18
|
+
export declare const FileUpload: import("react").ForwardRefExoticComponent<FileUploadProps & import("react").RefAttributes<FileUploadHandle>>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import { UploadCloud } from 'lucide-react';
|
|
4
|
-
import { useId, useRef, useState } from 'react';
|
|
4
|
+
import { forwardRef, useId, useRef, useState, useImperativeHandle } from 'react';
|
|
5
5
|
import styles from './FileUpload.module.css';
|
|
6
6
|
import { InputContainer } from '../input-container/InputContainer';
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
const FileUpload = forwardRef(function FileUpload2({
|
|
9
9
|
label,
|
|
10
10
|
labelAction,
|
|
11
11
|
error,
|
|
@@ -27,11 +27,20 @@ function FileUpload({
|
|
|
27
27
|
disabled,
|
|
28
28
|
className,
|
|
29
29
|
...inputProps
|
|
30
|
-
}) {
|
|
30
|
+
}, ref) {
|
|
31
31
|
const reactId = useId();
|
|
32
32
|
const inputId = id != null ? id : `file-upload-${reactId}`;
|
|
33
33
|
const inputRef = useRef(null);
|
|
34
34
|
const [dragging, setDragging] = useState(false);
|
|
35
|
+
useImperativeHandle(
|
|
36
|
+
ref,
|
|
37
|
+
() => ({
|
|
38
|
+
clear() {
|
|
39
|
+
if (inputRef.current) inputRef.current.value = "";
|
|
40
|
+
}
|
|
41
|
+
}),
|
|
42
|
+
[]
|
|
43
|
+
);
|
|
35
44
|
function handleDragOver(e) {
|
|
36
45
|
e.preventDefault();
|
|
37
46
|
if (!disabled) setDragging(true);
|
|
@@ -106,6 +115,7 @@ function FileUpload({
|
|
|
106
115
|
)
|
|
107
116
|
}
|
|
108
117
|
);
|
|
109
|
-
}
|
|
118
|
+
});
|
|
119
|
+
FileUpload.displayName = "FileUpload";
|
|
110
120
|
|
|
111
121
|
export { FileUpload };
|
package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.cjs
CHANGED
|
@@ -106,7 +106,7 @@ function ExpandableSidebarItem({
|
|
|
106
106
|
);
|
|
107
107
|
};
|
|
108
108
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${styles__default.default.container}`, children: [
|
|
109
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles__default.default.itemRow
|
|
109
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${styles__default.default.itemRow} ${expanded ? styles__default.default.itemRowExpanded : ""}`, children: [
|
|
110
110
|
/* @__PURE__ */ jsxRuntime.jsx(Component, { onClick: () => toggleAccordion(void 0, true), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
111
111
|
SidebarItemContent.SidebarItemContent,
|
|
112
112
|
{
|
|
@@ -116,23 +116,25 @@ function ExpandableSidebarItem({
|
|
|
116
116
|
label,
|
|
117
117
|
href,
|
|
118
118
|
disableActiveStyles: expanded,
|
|
119
|
+
suffixIcon: !isSidebarCollapsed ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
120
|
+
lucideReact.ChevronDown,
|
|
121
|
+
{
|
|
122
|
+
className: `${styles__default.default.chevron} ${expanded ? styles__default.default.chevronExpanded : ""}`
|
|
123
|
+
}
|
|
124
|
+
) : void 0,
|
|
119
125
|
truncateLabel
|
|
120
126
|
}
|
|
121
127
|
) }),
|
|
122
128
|
!isSidebarCollapsed && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.toggleButton, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
123
129
|
Button.Button,
|
|
124
130
|
{
|
|
125
|
-
variant: "
|
|
131
|
+
variant: "inline",
|
|
132
|
+
shape: "round",
|
|
133
|
+
className: styles__default.default.toggleButtonControl,
|
|
126
134
|
"aria-label": expanded ? `Collapse ${label}` : `Expand ${label}`,
|
|
127
135
|
"aria-expanded": expanded,
|
|
128
136
|
"aria-controls": `${href}-children`,
|
|
129
|
-
onClick: toggleAccordion
|
|
130
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
131
|
-
lucideReact.ChevronDown,
|
|
132
|
-
{
|
|
133
|
-
className: `${styles__default.default.chevron} ${expanded ? styles__default.default.chevronExpanded : ""}`
|
|
134
|
-
}
|
|
135
|
-
)
|
|
137
|
+
onClick: toggleAccordion
|
|
136
138
|
}
|
|
137
139
|
) })
|
|
138
140
|
] }),
|
|
@@ -141,7 +143,7 @@ function ExpandableSidebarItem({
|
|
|
141
143
|
{
|
|
142
144
|
id: `${href}-children`,
|
|
143
145
|
onAnimationEnd: handleAnimationEnd,
|
|
144
|
-
className: `${styles__default.default.childrenContainer} ${closing ? "animate--collapse" :
|
|
146
|
+
className: `${styles__default.default.childrenContainer} ${closing ? "animate--collapse" : ""}`,
|
|
145
147
|
children: items.map((item, idx) => renderNavItem(item, `${href}-${idx}`))
|
|
146
148
|
}
|
|
147
149
|
)
|
|
@@ -100,7 +100,7 @@ function ExpandableSidebarItem({
|
|
|
100
100
|
);
|
|
101
101
|
};
|
|
102
102
|
return /* @__PURE__ */ jsxs("div", { className: `${styles.container}`, children: [
|
|
103
|
-
/* @__PURE__ */ jsxs("div", { className: styles.itemRow
|
|
103
|
+
/* @__PURE__ */ jsxs("div", { className: `${styles.itemRow} ${expanded ? styles.itemRowExpanded : ""}`, children: [
|
|
104
104
|
/* @__PURE__ */ jsx(Component, { onClick: () => toggleAccordion(void 0, true), children: /* @__PURE__ */ jsx(
|
|
105
105
|
SidebarItemContent,
|
|
106
106
|
{
|
|
@@ -110,23 +110,25 @@ function ExpandableSidebarItem({
|
|
|
110
110
|
label,
|
|
111
111
|
href,
|
|
112
112
|
disableActiveStyles: expanded,
|
|
113
|
+
suffixIcon: !isSidebarCollapsed ? /* @__PURE__ */ jsx(
|
|
114
|
+
ChevronDown,
|
|
115
|
+
{
|
|
116
|
+
className: `${styles.chevron} ${expanded ? styles.chevronExpanded : ""}`
|
|
117
|
+
}
|
|
118
|
+
) : void 0,
|
|
113
119
|
truncateLabel
|
|
114
120
|
}
|
|
115
121
|
) }),
|
|
116
122
|
!isSidebarCollapsed && /* @__PURE__ */ jsx("div", { className: styles.toggleButton, children: /* @__PURE__ */ jsx(
|
|
117
123
|
Button,
|
|
118
124
|
{
|
|
119
|
-
variant: "
|
|
125
|
+
variant: "inline",
|
|
126
|
+
shape: "round",
|
|
127
|
+
className: styles.toggleButtonControl,
|
|
120
128
|
"aria-label": expanded ? `Collapse ${label}` : `Expand ${label}`,
|
|
121
129
|
"aria-expanded": expanded,
|
|
122
130
|
"aria-controls": `${href}-children`,
|
|
123
|
-
onClick: toggleAccordion
|
|
124
|
-
children: /* @__PURE__ */ jsx(
|
|
125
|
-
ChevronDown,
|
|
126
|
-
{
|
|
127
|
-
className: `${styles.chevron} ${expanded ? styles.chevronExpanded : ""}`
|
|
128
|
-
}
|
|
129
|
-
)
|
|
131
|
+
onClick: toggleAccordion
|
|
130
132
|
}
|
|
131
133
|
) })
|
|
132
134
|
] }),
|
|
@@ -135,7 +137,7 @@ function ExpandableSidebarItem({
|
|
|
135
137
|
{
|
|
136
138
|
id: `${href}-children`,
|
|
137
139
|
onAnimationEnd: handleAnimationEnd,
|
|
138
|
-
className: `${styles.childrenContainer} ${closing ? "animate--collapse" :
|
|
140
|
+
className: `${styles.childrenContainer} ${closing ? "animate--collapse" : ""}`,
|
|
139
141
|
children: items.map((item, idx) => renderNavItem(item, `${href}-${idx}`))
|
|
140
142
|
}
|
|
141
143
|
)
|
package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.module.css
CHANGED
|
@@ -6,28 +6,32 @@
|
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
.itemRow {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
column-gap: var(--spacing-xs);
|
|
9
|
+
position: relative;
|
|
10
|
+
display: block;
|
|
11
|
+
border-radius: var(--border-radius-md);
|
|
13
12
|
}
|
|
14
13
|
|
|
15
14
|
.toggleButton {
|
|
16
|
-
|
|
15
|
+
position: absolute;
|
|
16
|
+
inset-inline-end: var(--spacing-xs);
|
|
17
|
+
inset-block-start: 50%;
|
|
18
|
+
transform: translateY(-50%);
|
|
19
|
+
display: inline-flex;
|
|
17
20
|
align-items: center;
|
|
18
21
|
justify-content: center;
|
|
19
|
-
flex: 0 0 auto;
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
.container button {
|
|
23
|
-
|
|
24
|
-
min-
|
|
25
|
-
|
|
26
|
-
max-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
min-block-size: 28px !important;
|
|
26
|
+
min-inline-size: 28px !important;
|
|
27
|
+
max-block-size: 28px !important;
|
|
28
|
+
max-inline-size: 28px !important;
|
|
29
|
+
border-color: transparent !important;
|
|
30
|
+
background-color: transparent !important;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.toggleButtonControl {
|
|
34
|
+
opacity: 0;
|
|
31
35
|
}
|
|
32
36
|
|
|
33
37
|
.childrenContainer {
|
package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.module.css
CHANGED
|
@@ -53,6 +53,18 @@
|
|
|
53
53
|
color: var(--color-fg-default);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
.container:not(.active):hover .icon,
|
|
57
|
+
.container:not(.active):hover .suffixIcon,
|
|
58
|
+
.container:focus-visible .icon,
|
|
59
|
+
.container:focus-visible .suffixIcon {
|
|
60
|
+
color: var(--color-fg-default);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.active .icon,
|
|
64
|
+
.active .suffixIcon {
|
|
65
|
+
color: var(--color-fg-default);
|
|
66
|
+
}
|
|
67
|
+
|
|
56
68
|
.icon,
|
|
57
69
|
.suffixIcon {
|
|
58
70
|
inline-size: var(--sidebar-item-icon-width, auto);
|
|
@@ -52,6 +52,7 @@ function Table({
|
|
|
52
52
|
showHeader = true,
|
|
53
53
|
getRowSeverity,
|
|
54
54
|
getContextMenuItems,
|
|
55
|
+
showContextMenuOnHover = true,
|
|
55
56
|
onRowClick,
|
|
56
57
|
onRowMouseEnter,
|
|
57
58
|
onRowSelect,
|
|
@@ -65,7 +66,6 @@ function Table({
|
|
|
65
66
|
const internalTableRootRef = react.useRef(null);
|
|
66
67
|
const tableRootRefWrapper = react.useRef(tableRootRef);
|
|
67
68
|
const hasSelection = Boolean(selectedRows && onRowSelect);
|
|
68
|
-
const hasContextMenu = Boolean(getContextMenuItems);
|
|
69
69
|
const hasPagination = Boolean(onPageChange && (loading || data.length > 0));
|
|
70
70
|
const paginationOffset = hasPagination ? 72 : 0;
|
|
71
71
|
const { style: viewportFillStyle, maxHeight } = useViewportFill.useViewportFill(internalTableRootRef, {
|
|
@@ -102,6 +102,7 @@ function Table({
|
|
|
102
102
|
viewMode,
|
|
103
103
|
getRowSeverity,
|
|
104
104
|
getContextMenuItems,
|
|
105
|
+
showContextMenuOnHover,
|
|
105
106
|
onRowClick,
|
|
106
107
|
onRowMouseEnter,
|
|
107
108
|
onRowSelect
|
|
@@ -158,15 +159,13 @@ function Table({
|
|
|
158
159
|
style: column.width != null ? { width: column.width } : void 0
|
|
159
160
|
},
|
|
160
161
|
column.id
|
|
161
|
-
))
|
|
162
|
-
hasContextMenu ? /* @__PURE__ */ jsxRuntime.jsx("col", { style: { width: table_utils.CONTEXT_MENU_COLUMN_PX } }) : null
|
|
162
|
+
))
|
|
163
163
|
] }),
|
|
164
164
|
showHeader && /* @__PURE__ */ jsxRuntime.jsx(
|
|
165
165
|
TableHeader.TableHeader,
|
|
166
166
|
{
|
|
167
167
|
columns: visibleColumns,
|
|
168
168
|
hasSelection,
|
|
169
|
-
hasContextMenu,
|
|
170
169
|
selectionMode,
|
|
171
170
|
allRowsSelected,
|
|
172
171
|
onSelectAllRows,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { JSX } from 'react';
|
|
2
2
|
import type { TableProps } from './Table.types';
|
|
3
|
-
export declare function Table<T extends Record<string, any>>({ data, dataKey, columns, selectedRows, selectionMode, allRowsSelected, sortById, sortDirection, loading, emptyConfig, variant, size, viewMode, striped, fillViewport, fillViewportBottomOffset, containScrolling, stickyHeader, tableWidth, tableRootRef, measuringLayout, toolbar, headerExtras, take, skip, totalItemsCount, paginationPlacement, showFirstLast, showGoToPage, showPageSize, pageSizeOptions, showHeader, getRowSeverity, getContextMenuItems, onRowClick, onRowMouseEnter, onRowSelect, onSelectAllRows, onSortChange, onPageChange, ...rest }: TableProps<T>): JSX.Element;
|
|
3
|
+
export declare function Table<T extends Record<string, any>>({ data, dataKey, columns, selectedRows, selectionMode, allRowsSelected, sortById, sortDirection, loading, emptyConfig, variant, size, viewMode, striped, fillViewport, fillViewportBottomOffset, containScrolling, stickyHeader, tableWidth, tableRootRef, measuringLayout, toolbar, headerExtras, take, skip, totalItemsCount, paginationPlacement, showFirstLast, showGoToPage, showPageSize, pageSizeOptions, showHeader, getRowSeverity, getContextMenuItems, showContextMenuOnHover, onRowClick, onRowMouseEnter, onRowSelect, onSelectAllRows, onSortChange, onPageChange, ...rest }: TableProps<T>): JSX.Element;
|
|
4
4
|
export type { ColumnItem } from './Table.types';
|
|
@@ -9,7 +9,7 @@ import { TableBody } from './components/TableBody';
|
|
|
9
9
|
import { TableHeader } from './components/TableHeader';
|
|
10
10
|
import { cx } from './table.classes';
|
|
11
11
|
import styles from './Table.module.css';
|
|
12
|
-
import { getVisibleColumns, SELECTION_COLUMN_PX
|
|
12
|
+
import { getVisibleColumns, SELECTION_COLUMN_PX } from './table.utils';
|
|
13
13
|
|
|
14
14
|
function Table({
|
|
15
15
|
data,
|
|
@@ -46,6 +46,7 @@ function Table({
|
|
|
46
46
|
showHeader = true,
|
|
47
47
|
getRowSeverity,
|
|
48
48
|
getContextMenuItems,
|
|
49
|
+
showContextMenuOnHover = true,
|
|
49
50
|
onRowClick,
|
|
50
51
|
onRowMouseEnter,
|
|
51
52
|
onRowSelect,
|
|
@@ -59,7 +60,6 @@ function Table({
|
|
|
59
60
|
const internalTableRootRef = useRef(null);
|
|
60
61
|
const tableRootRefWrapper = useRef(tableRootRef);
|
|
61
62
|
const hasSelection = Boolean(selectedRows && onRowSelect);
|
|
62
|
-
const hasContextMenu = Boolean(getContextMenuItems);
|
|
63
63
|
const hasPagination = Boolean(onPageChange && (loading || data.length > 0));
|
|
64
64
|
const paginationOffset = hasPagination ? 72 : 0;
|
|
65
65
|
const { style: viewportFillStyle, maxHeight } = useViewportFill(internalTableRootRef, {
|
|
@@ -96,6 +96,7 @@ function Table({
|
|
|
96
96
|
viewMode,
|
|
97
97
|
getRowSeverity,
|
|
98
98
|
getContextMenuItems,
|
|
99
|
+
showContextMenuOnHover,
|
|
99
100
|
onRowClick,
|
|
100
101
|
onRowMouseEnter,
|
|
101
102
|
onRowSelect
|
|
@@ -152,15 +153,13 @@ function Table({
|
|
|
152
153
|
style: column.width != null ? { width: column.width } : void 0
|
|
153
154
|
},
|
|
154
155
|
column.id
|
|
155
|
-
))
|
|
156
|
-
hasContextMenu ? /* @__PURE__ */ jsx("col", { style: { width: CONTEXT_MENU_COLUMN_PX } }) : null
|
|
156
|
+
))
|
|
157
157
|
] }),
|
|
158
158
|
showHeader && /* @__PURE__ */ jsx(
|
|
159
159
|
TableHeader,
|
|
160
160
|
{
|
|
161
161
|
columns: visibleColumns,
|
|
162
162
|
hasSelection,
|
|
163
|
-
hasContextMenu,
|
|
164
163
|
selectionMode,
|
|
165
164
|
allRowsSelected,
|
|
166
165
|
onSelectAllRows,
|
|
@@ -241,14 +241,6 @@
|
|
|
241
241
|
line-height: 0;
|
|
242
242
|
}
|
|
243
243
|
|
|
244
|
-
.headerCell.contextMenuCell,
|
|
245
|
-
.cell.contextMenuCell {
|
|
246
|
-
inline-size: 1%;
|
|
247
|
-
white-space: nowrap;
|
|
248
|
-
padding-inline: var(--spacing-2xs);
|
|
249
|
-
overflow: visible;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
244
|
.headerCell.selectionCell {
|
|
253
245
|
padding-block: var(--spacing-xxs);
|
|
254
246
|
vertical-align: middle;
|
|
@@ -259,19 +251,10 @@
|
|
|
259
251
|
padding-block: var(--spacing-xxs);
|
|
260
252
|
}
|
|
261
253
|
|
|
262
|
-
.headerCell.contextMenuHeaderCell {
|
|
263
|
-
padding-block: var(--spacing-xxs);
|
|
264
|
-
}
|
|
265
|
-
|
|
266
254
|
.headerCell:hover [data-resizer='true']::after {
|
|
267
255
|
opacity: 1;
|
|
268
256
|
}
|
|
269
257
|
|
|
270
|
-
.cell.contextMenuCell {
|
|
271
|
-
vertical-align: top;
|
|
272
|
-
padding-block: var(--spacing-2xs);
|
|
273
|
-
}
|
|
274
|
-
|
|
275
258
|
.selectionHitArea {
|
|
276
259
|
display: inline-flex;
|
|
277
260
|
align-items: flex-start;
|
|
@@ -496,10 +479,6 @@
|
|
|
496
479
|
text-align: right;
|
|
497
480
|
}
|
|
498
481
|
|
|
499
|
-
.contextMenuCellContent {
|
|
500
|
-
justify-content: flex-end;
|
|
501
|
-
}
|
|
502
|
-
|
|
503
482
|
/* vertical alignment inside content wrapper */
|
|
504
483
|
.cellContent[data-vertical-align='top'] {
|
|
505
484
|
align-items: flex-start;
|
|
@@ -562,6 +541,58 @@
|
|
|
562
541
|
|
|
563
542
|
.contextMenuTrigger {
|
|
564
543
|
color: var(--color-fg-subtle);
|
|
544
|
+
min-inline-size: 36px;
|
|
545
|
+
min-block-size: 36px;
|
|
546
|
+
border-radius: var(--border-radius-rounded);
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
.contextMenuAnchorCell {
|
|
550
|
+
overflow: visible;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
.contextMenuAnchorCell .cellValueEllipsis,
|
|
554
|
+
.contextMenuAnchorCell .cellValueNoEllipsis {
|
|
555
|
+
padding-inline-end: calc(36px + var(--spacing-sm));
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
.contextMenuOverlay {
|
|
559
|
+
position: absolute;
|
|
560
|
+
inset-block-start: 50%;
|
|
561
|
+
inset-inline-end: 0;
|
|
562
|
+
transform: translateY(-50%);
|
|
563
|
+
display: inline-flex;
|
|
564
|
+
align-items: center;
|
|
565
|
+
justify-content: center;
|
|
566
|
+
min-inline-size: 40px;
|
|
567
|
+
min-block-size: 40px;
|
|
568
|
+
z-index: 3;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
.contextMenuOverlay:hover .contextMenuTrigger,
|
|
572
|
+
.contextMenuOverlay:focus-within .contextMenuTrigger {
|
|
573
|
+
background-color: var(--opac-bg-light);
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
.contextMenuItemLabel {
|
|
577
|
+
display: inline-flex;
|
|
578
|
+
align-items: flex-start;
|
|
579
|
+
gap: var(--spacing-xs);
|
|
580
|
+
min-width: 0;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
.contextMenuItemText {
|
|
584
|
+
min-width: 0;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
.contextMenuHoverOnly .contextMenuTrigger {
|
|
588
|
+
opacity: 0;
|
|
589
|
+
pointer-events: none;
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
.contextMenuHoverOnly:hover .contextMenuTrigger,
|
|
593
|
+
.contextMenuHoverOnly:focus-within .contextMenuTrigger {
|
|
594
|
+
opacity: 1;
|
|
595
|
+
pointer-events: auto;
|
|
565
596
|
}
|
|
566
597
|
|
|
567
598
|
.severityTable {
|
|
@@ -24,14 +24,21 @@ export type HeaderExtrasArgs<T> = {
|
|
|
24
24
|
column: ColumnItem<T>;
|
|
25
25
|
index: number;
|
|
26
26
|
};
|
|
27
|
-
export type
|
|
27
|
+
export type TableContextMenuActionItem = {
|
|
28
|
+
type?: 'item';
|
|
28
29
|
label: ReactNode;
|
|
30
|
+
icon?: ReactNode;
|
|
29
31
|
onClick: () => void;
|
|
30
32
|
active?: boolean;
|
|
31
33
|
selected?: boolean;
|
|
32
34
|
disabled?: boolean;
|
|
33
35
|
variant?: 'default' | 'danger';
|
|
34
36
|
};
|
|
37
|
+
export type TableContextMenuHeaderItem = {
|
|
38
|
+
type: 'header';
|
|
39
|
+
label: ReactNode;
|
|
40
|
+
};
|
|
41
|
+
export type TableContextMenuItem = TableContextMenuActionItem | TableContextMenuHeaderItem;
|
|
35
42
|
export type StickyHeader = false | 'app-header' | number;
|
|
36
43
|
export type TableVariant = 'primary' | 'embedded';
|
|
37
44
|
export type SortDirection = 'asc' | 'desc' | null;
|
|
@@ -74,6 +81,7 @@ export type TableProps<T extends Record<string, any>> = Omit<HTMLAttributes<HTML
|
|
|
74
81
|
rowId: string | number;
|
|
75
82
|
open: () => void;
|
|
76
83
|
}) => TableContextMenuItem[];
|
|
84
|
+
showContextMenuOnHover?: boolean;
|
|
77
85
|
onRowClick?: (row: T) => void;
|
|
78
86
|
onRowMouseEnter?: (row: T) => void;
|
|
79
87
|
onRowSelect?: (rowId: number | string, isSelected: boolean) => void;
|
|
@@ -21,6 +21,7 @@ function TableBody({
|
|
|
21
21
|
viewMode,
|
|
22
22
|
getRowSeverity,
|
|
23
23
|
getContextMenuItems,
|
|
24
|
+
showContextMenuOnHover,
|
|
24
25
|
onRowClick,
|
|
25
26
|
onRowMouseEnter,
|
|
26
27
|
onRowSelect
|
|
@@ -40,6 +41,7 @@ function TableBody({
|
|
|
40
41
|
viewMode,
|
|
41
42
|
getRowSeverity,
|
|
42
43
|
getContextMenuItems,
|
|
44
|
+
showContextMenuOnHover,
|
|
43
45
|
onRowClick,
|
|
44
46
|
onRowMouseEnter,
|
|
45
47
|
onRowSelect
|
|
@@ -17,9 +17,10 @@ type Props<T extends Record<string, any>> = {
|
|
|
17
17
|
rowId: string | number;
|
|
18
18
|
open: () => void;
|
|
19
19
|
}) => TableContextMenuItem[];
|
|
20
|
+
showContextMenuOnHover: boolean;
|
|
20
21
|
onRowClick?: (row: T) => void;
|
|
21
22
|
onRowMouseEnter?: (row: T) => void;
|
|
22
23
|
onRowSelect?: (rowId: number | string, isSelected: boolean) => void;
|
|
23
24
|
};
|
|
24
|
-
export declare function TableBody<T extends Record<string, any>>({ data, dataKey, columns, striped, selectedRows, hasSelection, selectionMode, selectionInputName, viewMode, getRowSeverity, getContextMenuItems, onRowClick, onRowMouseEnter, onRowSelect, }: Props<T>): ReactNode;
|
|
25
|
+
export declare function TableBody<T extends Record<string, any>>({ data, dataKey, columns, striped, selectedRows, hasSelection, selectionMode, selectionInputName, viewMode, getRowSeverity, getContextMenuItems, showContextMenuOnHover, onRowClick, onRowMouseEnter, onRowSelect, }: Props<T>): ReactNode;
|
|
25
26
|
export {};
|
|
@@ -15,6 +15,7 @@ function TableBody({
|
|
|
15
15
|
viewMode,
|
|
16
16
|
getRowSeverity,
|
|
17
17
|
getContextMenuItems,
|
|
18
|
+
showContextMenuOnHover,
|
|
18
19
|
onRowClick,
|
|
19
20
|
onRowMouseEnter,
|
|
20
21
|
onRowSelect
|
|
@@ -34,6 +35,7 @@ function TableBody({
|
|
|
34
35
|
viewMode,
|
|
35
36
|
getRowSeverity,
|
|
36
37
|
getContextMenuItems,
|
|
38
|
+
showContextMenuOnHover,
|
|
37
39
|
onRowClick,
|
|
38
40
|
onRowMouseEnter,
|
|
39
41
|
onRowSelect
|
|
@@ -12,7 +12,6 @@ var styles__default = /*#__PURE__*/_interopDefault(styles);
|
|
|
12
12
|
function TableHeader({
|
|
13
13
|
columns,
|
|
14
14
|
hasSelection,
|
|
15
|
-
hasContextMenu,
|
|
16
15
|
selectionMode,
|
|
17
16
|
allRowsSelected,
|
|
18
17
|
onSelectAllRows,
|
|
@@ -48,15 +47,7 @@ function TableHeader({
|
|
|
48
47
|
extraContent: headerExtras == null ? void 0 : headerExtras({ column, index })
|
|
49
48
|
},
|
|
50
49
|
column.id
|
|
51
|
-
))
|
|
52
|
-
hasContextMenu ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
53
|
-
"th",
|
|
54
|
-
{
|
|
55
|
-
className: [styles__default.default.headerCell, styles__default.default.contextMenuCell, styles__default.default.contextMenuHeaderCell].filter(Boolean).join(" "),
|
|
56
|
-
scope: "col",
|
|
57
|
-
"aria-label": "R\xE6kkehandlinger"
|
|
58
|
-
}
|
|
59
|
-
) : null
|
|
50
|
+
))
|
|
60
51
|
] })
|
|
61
52
|
}
|
|
62
53
|
);
|
|
@@ -3,7 +3,6 @@ import type { ColumnItem, HeaderExtrasArgs, SortDirection } from '../Table.types
|
|
|
3
3
|
type Props<T> = {
|
|
4
4
|
columns: ColumnItem<T>[];
|
|
5
5
|
hasSelection: boolean;
|
|
6
|
-
hasContextMenu: boolean;
|
|
7
6
|
selectionMode: 'single' | 'multiple';
|
|
8
7
|
allRowsSelected?: boolean;
|
|
9
8
|
onSelectAllRows?: (isSelected: boolean) => void;
|
|
@@ -13,5 +12,5 @@ type Props<T> = {
|
|
|
13
12
|
headerExtras?: (args: HeaderExtrasArgs<T>) => ReactNode;
|
|
14
13
|
stickyTop?: string;
|
|
15
14
|
};
|
|
16
|
-
export declare function TableHeader<T>({ columns, hasSelection,
|
|
15
|
+
export declare function TableHeader<T>({ columns, hasSelection, selectionMode, allRowsSelected, onSelectAllRows, sortById, sortDirection, onSortChange, headerExtras, stickyTop, }: Props<T>): React.ReactNode;
|
|
17
16
|
export {};
|
|
@@ -6,7 +6,6 @@ import styles from '../Table.module.css';
|
|
|
6
6
|
function TableHeader({
|
|
7
7
|
columns,
|
|
8
8
|
hasSelection,
|
|
9
|
-
hasContextMenu,
|
|
10
9
|
selectionMode,
|
|
11
10
|
allRowsSelected,
|
|
12
11
|
onSelectAllRows,
|
|
@@ -42,15 +41,7 @@ function TableHeader({
|
|
|
42
41
|
extraContent: headerExtras == null ? void 0 : headerExtras({ column, index })
|
|
43
42
|
},
|
|
44
43
|
column.id
|
|
45
|
-
))
|
|
46
|
-
hasContextMenu ? /* @__PURE__ */ jsx(
|
|
47
|
-
"th",
|
|
48
|
-
{
|
|
49
|
-
className: [styles.headerCell, styles.contextMenuCell, styles.contextMenuHeaderCell].filter(Boolean).join(" "),
|
|
50
|
-
scope: "col",
|
|
51
|
-
"aria-label": "R\xE6kkehandlinger"
|
|
52
|
-
}
|
|
53
|
-
) : null
|
|
44
|
+
))
|
|
54
45
|
] })
|
|
55
46
|
}
|
|
56
47
|
);
|