@dbcdk/react-components 0.0.188 → 0.0.189
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/badge/Badge.module.css +11 -11
- package/dist/components/chip/Chip.module.css +2 -1
- package/dist/components/circle/Circle.module.css +4 -0
- package/dist/components/forms/input-container/InputContainer.cjs +11 -4
- package/dist/components/forms/input-container/InputContainer.d.ts +1 -1
- package/dist/components/forms/input-container/InputContainer.js +11 -4
- package/dist/components/forms/text-area/Textarea.cjs +2 -1
- package/dist/components/forms/text-area/Textarea.js +2 -1
- package/dist/components/metric-tile/MetricTile.cjs +25 -0
- package/dist/components/metric-tile/MetricTile.d.ts +1 -0
- package/dist/components/metric-tile/MetricTile.js +25 -0
- package/dist/components/metric-tile/MetricTile.module.css +8 -0
- package/dist/components/overlay/tooltip/TooltipProvider.cjs +9 -5
- package/dist/components/overlay/tooltip/TooltipProvider.js +9 -5
- package/dist/components/table/Table.cjs +1 -0
- package/dist/components/table/Table.js +1 -0
- package/dist/components/table/Table.module.css +10 -5
- package/dist/components/table/components/TableHeader.cjs +2 -0
- package/dist/components/table/components/TableHeader.d.ts +2 -1
- package/dist/components/table/components/TableHeader.js +2 -0
- package/dist/components/table/components/TableHeaderCell.cjs +2 -1
- package/dist/components/table/components/TableHeaderCell.d.ts +2 -1
- package/dist/components/table/components/TableHeaderCell.js +3 -2
- package/dist/components/tabs/Tabs.module.css +21 -2
- package/package.json +1 -1
|
@@ -4,22 +4,22 @@
|
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
.badge {
|
|
7
|
-
position: absolute;
|
|
8
|
-
top: 0;
|
|
9
|
-
right: 0;
|
|
10
|
-
transform: translate(50%, -50%);
|
|
11
|
-
display: inline-flex;
|
|
12
|
-
align-items: center;
|
|
13
|
-
justify-content: center;
|
|
14
7
|
box-sizing: border-box;
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
block-size: 14px;
|
|
9
|
+
min-inline-size: 14px;
|
|
17
10
|
padding-inline: var(--spacing-2xs);
|
|
18
11
|
border-radius: var(--border-radius-rounded);
|
|
19
|
-
font-size:
|
|
20
|
-
line-height: 1;
|
|
12
|
+
font-size: 12px;
|
|
21
13
|
color: var(--color-fg-inverse);
|
|
22
14
|
pointer-events: none;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
align-items: center;
|
|
17
|
+
line-height: 1;
|
|
18
|
+
display: inline-flex;
|
|
19
|
+
position: absolute;
|
|
20
|
+
top: 0;
|
|
21
|
+
right: 0;
|
|
22
|
+
transform: translate(50%, -30%);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
.badge[data-dot='true'] {
|
|
@@ -93,6 +93,7 @@
|
|
|
93
93
|
.sm {
|
|
94
94
|
height: var(--component-size-xs);
|
|
95
95
|
font-size: var(--font-size-xs);
|
|
96
|
+
padding-inline: var(--spacing-xs);
|
|
96
97
|
}
|
|
97
98
|
|
|
98
99
|
.md {
|
|
@@ -109,7 +110,7 @@
|
|
|
109
110
|
.neutral {
|
|
110
111
|
/* Tinted from the current foreground color instead of a fixed gray, so it
|
|
111
112
|
stays visible whether it's sitting on a white panel or a muted toolbar. */
|
|
112
|
-
--chip-bg: color-mix(in srgb, var(--color-fg-default)
|
|
113
|
+
--chip-bg: color-mix(in srgb, var(--color-fg-default) 8%, transparent);
|
|
113
114
|
--chip-fg: var(--color-fg-default);
|
|
114
115
|
--chip-border: transparent;
|
|
115
116
|
--chip-outlined-border: var(--color-border-subtle);
|
|
@@ -21,6 +21,7 @@ function InputContainer({
|
|
|
21
21
|
orientation = "horizontal",
|
|
22
22
|
size = "md",
|
|
23
23
|
labelWidth = "160px",
|
|
24
|
+
labelAlignment = "center",
|
|
24
25
|
modified = false
|
|
25
26
|
}) {
|
|
26
27
|
const renderLabelRow = (label || labelAction) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${styles__default.default.labelRow} dbc-flex dbc-items-center dbc-gap-md`, children: [
|
|
@@ -59,10 +60,16 @@ function InputContainer({
|
|
|
59
60
|
width: fullWidth ? "100%" : void 0
|
|
60
61
|
},
|
|
61
62
|
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${styles__default.default.horizontal} dbc-flex dbc-flex-column dbc-gap-xs`, "data-size": size, children: [
|
|
62
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
64
|
+
"div",
|
|
65
|
+
{
|
|
66
|
+
className: `${styles__default.default.labelContainer} dbc-flex ${labelAlignment === "top" ? "dbc-items-start" : "dbc-items-center"} dbc-gap-xs`,
|
|
67
|
+
children: [
|
|
68
|
+
renderLabelRow,
|
|
69
|
+
children
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
),
|
|
66
73
|
renderMessageRow
|
|
67
74
|
] })
|
|
68
75
|
}
|
|
@@ -15,4 +15,4 @@ export interface InputContainerProps {
|
|
|
15
15
|
labelAlignment?: 'top' | 'center';
|
|
16
16
|
modified?: boolean;
|
|
17
17
|
}
|
|
18
|
-
export declare function InputContainer({ label, labelAction, htmlFor, error, helpText, helpTextAddition, fullWidth, required, children, orientation, size, labelWidth, modified, }: InputContainerProps): React.ReactElement;
|
|
18
|
+
export declare function InputContainer({ label, labelAction, htmlFor, error, helpText, helpTextAddition, fullWidth, required, children, orientation, size, labelWidth, labelAlignment, modified, }: InputContainerProps): React.ReactElement;
|
|
@@ -15,6 +15,7 @@ function InputContainer({
|
|
|
15
15
|
orientation = "horizontal",
|
|
16
16
|
size = "md",
|
|
17
17
|
labelWidth = "160px",
|
|
18
|
+
labelAlignment = "center",
|
|
18
19
|
modified = false
|
|
19
20
|
}) {
|
|
20
21
|
const renderLabelRow = (label || labelAction) && /* @__PURE__ */ jsxs("div", { className: `${styles.labelRow} dbc-flex dbc-items-center dbc-gap-md`, children: [
|
|
@@ -53,10 +54,16 @@ function InputContainer({
|
|
|
53
54
|
width: fullWidth ? "100%" : void 0
|
|
54
55
|
},
|
|
55
56
|
children: /* @__PURE__ */ jsxs("div", { className: `${styles.horizontal} dbc-flex dbc-flex-column dbc-gap-xs`, "data-size": size, children: [
|
|
56
|
-
/* @__PURE__ */ jsxs(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
/* @__PURE__ */ jsxs(
|
|
58
|
+
"div",
|
|
59
|
+
{
|
|
60
|
+
className: `${styles.labelContainer} dbc-flex ${labelAlignment === "top" ? "dbc-items-start" : "dbc-items-center"} dbc-gap-xs`,
|
|
61
|
+
children: [
|
|
62
|
+
renderLabelRow,
|
|
63
|
+
children
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
),
|
|
60
67
|
renderMessageRow
|
|
61
68
|
] })
|
|
62
69
|
}
|
|
@@ -28,6 +28,7 @@ const Textarea = function Textarea2({
|
|
|
28
28
|
label,
|
|
29
29
|
error,
|
|
30
30
|
helpText,
|
|
31
|
+
helpTextAddition,
|
|
31
32
|
orientation = "horizontal",
|
|
32
33
|
labelWidth = "160px",
|
|
33
34
|
fullWidth = false,
|
|
@@ -97,7 +98,7 @@ const Textarea = function Textarea2({
|
|
|
97
98
|
htmlFor: textareaId,
|
|
98
99
|
error,
|
|
99
100
|
helpText,
|
|
100
|
-
helpTextAddition: showCount ? `${value == null ? void 0 : value.length} tegn i denne boks` : void 0,
|
|
101
|
+
helpTextAddition: helpTextAddition != null ? helpTextAddition : showCount ? `${value == null ? void 0 : value.length} tegn i denne boks` : void 0,
|
|
101
102
|
orientation,
|
|
102
103
|
labelWidth,
|
|
103
104
|
fullWidth,
|
|
@@ -22,6 +22,7 @@ const Textarea = function Textarea2({
|
|
|
22
22
|
label,
|
|
23
23
|
error,
|
|
24
24
|
helpText,
|
|
25
|
+
helpTextAddition,
|
|
25
26
|
orientation = "horizontal",
|
|
26
27
|
labelWidth = "160px",
|
|
27
28
|
fullWidth = false,
|
|
@@ -91,7 +92,7 @@ const Textarea = function Textarea2({
|
|
|
91
92
|
htmlFor: textareaId,
|
|
92
93
|
error,
|
|
93
94
|
helpText,
|
|
94
|
-
helpTextAddition: showCount ? `${value == null ? void 0 : value.length} tegn i denne boks` : void 0,
|
|
95
|
+
helpTextAddition: helpTextAddition != null ? helpTextAddition : showCount ? `${value == null ? void 0 : value.length} tegn i denne boks` : void 0,
|
|
95
96
|
orientation,
|
|
96
97
|
labelWidth,
|
|
97
98
|
fullWidth,
|
|
@@ -51,6 +51,7 @@ const MetricTileBase = ({
|
|
|
51
51
|
label,
|
|
52
52
|
icon,
|
|
53
53
|
value,
|
|
54
|
+
onClick,
|
|
54
55
|
tooltip,
|
|
55
56
|
size = "md",
|
|
56
57
|
variant = "filled",
|
|
@@ -69,14 +70,38 @@ const MetricTileBase = ({
|
|
|
69
70
|
const resolvedValue = (_b = (_a = slots.Value) == null ? void 0 : _a.props.children) != null ? _b : value;
|
|
70
71
|
const resolvedAdornment = (_c = slots.Adornment) == null ? void 0 : _c.props.children;
|
|
71
72
|
const showValueRow = resolvedValue != null || resolvedAdornment != null;
|
|
73
|
+
const isClickable = onClick != null;
|
|
74
|
+
const handleKeyDown = (event) => {
|
|
75
|
+
if (!isClickable) return;
|
|
76
|
+
if (event.key === "Enter") {
|
|
77
|
+
event.preventDefault();
|
|
78
|
+
onClick == null ? void 0 : onClick();
|
|
79
|
+
}
|
|
80
|
+
if (event.key === " ") {
|
|
81
|
+
event.preventDefault();
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
const handleKeyUp = (event) => {
|
|
85
|
+
if (!isClickable) return;
|
|
86
|
+
if (event.key === " ") {
|
|
87
|
+
event.preventDefault();
|
|
88
|
+
onClick == null ? void 0 : onClick();
|
|
89
|
+
}
|
|
90
|
+
};
|
|
72
91
|
return /* @__PURE__ */ jsxRuntime.jsx(client.Tooltip, { content: tooltip, placement: "bottom", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
73
92
|
"span",
|
|
74
93
|
{
|
|
75
94
|
className: styles__default.default.tile,
|
|
95
|
+
role: isClickable ? "button" : void 0,
|
|
96
|
+
tabIndex: isClickable ? 0 : void 0,
|
|
76
97
|
"data-severity": severity,
|
|
77
98
|
"data-size": size,
|
|
78
99
|
"data-variant": variant,
|
|
100
|
+
"data-clickable": isClickable ? "true" : void 0,
|
|
79
101
|
style,
|
|
102
|
+
onClick,
|
|
103
|
+
onKeyDown: handleKeyDown,
|
|
104
|
+
onKeyUp: handleKeyUp,
|
|
80
105
|
children: [
|
|
81
106
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: styles__default.default.labelRow, children: [
|
|
82
107
|
icon != null ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.icon, children: icon }) : null,
|
|
@@ -45,6 +45,7 @@ const MetricTileBase = ({
|
|
|
45
45
|
label,
|
|
46
46
|
icon,
|
|
47
47
|
value,
|
|
48
|
+
onClick,
|
|
48
49
|
tooltip,
|
|
49
50
|
size = "md",
|
|
50
51
|
variant = "filled",
|
|
@@ -63,14 +64,38 @@ const MetricTileBase = ({
|
|
|
63
64
|
const resolvedValue = (_b = (_a = slots.Value) == null ? void 0 : _a.props.children) != null ? _b : value;
|
|
64
65
|
const resolvedAdornment = (_c = slots.Adornment) == null ? void 0 : _c.props.children;
|
|
65
66
|
const showValueRow = resolvedValue != null || resolvedAdornment != null;
|
|
67
|
+
const isClickable = onClick != null;
|
|
68
|
+
const handleKeyDown = (event) => {
|
|
69
|
+
if (!isClickable) return;
|
|
70
|
+
if (event.key === "Enter") {
|
|
71
|
+
event.preventDefault();
|
|
72
|
+
onClick == null ? void 0 : onClick();
|
|
73
|
+
}
|
|
74
|
+
if (event.key === " ") {
|
|
75
|
+
event.preventDefault();
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
const handleKeyUp = (event) => {
|
|
79
|
+
if (!isClickable) return;
|
|
80
|
+
if (event.key === " ") {
|
|
81
|
+
event.preventDefault();
|
|
82
|
+
onClick == null ? void 0 : onClick();
|
|
83
|
+
}
|
|
84
|
+
};
|
|
66
85
|
return /* @__PURE__ */ jsx(Tooltip, { content: tooltip, placement: "bottom", children: /* @__PURE__ */ jsxs(
|
|
67
86
|
"span",
|
|
68
87
|
{
|
|
69
88
|
className: styles.tile,
|
|
89
|
+
role: isClickable ? "button" : void 0,
|
|
90
|
+
tabIndex: isClickable ? 0 : void 0,
|
|
70
91
|
"data-severity": severity,
|
|
71
92
|
"data-size": size,
|
|
72
93
|
"data-variant": variant,
|
|
94
|
+
"data-clickable": isClickable ? "true" : void 0,
|
|
73
95
|
style,
|
|
96
|
+
onClick,
|
|
97
|
+
onKeyDown: handleKeyDown,
|
|
98
|
+
onKeyUp: handleKeyUp,
|
|
74
99
|
children: [
|
|
75
100
|
/* @__PURE__ */ jsxs("span", { className: styles.labelRow, children: [
|
|
76
101
|
icon != null ? /* @__PURE__ */ jsx("span", { className: styles.icon, children: icon }) : null,
|
|
@@ -19,6 +19,14 @@
|
|
|
19
19
|
cursor: default;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
.tile[data-clickable='true'] {
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.tile[data-clickable='true']:focus-visible {
|
|
27
|
+
box-shadow: var(--focus-ring);
|
|
28
|
+
}
|
|
29
|
+
|
|
22
30
|
.tile[data-size='sm'] {
|
|
23
31
|
gap: 1px;
|
|
24
32
|
padding: 6px var(--spacing-sm);
|
|
@@ -119,7 +119,7 @@ function TooltipLayer() {
|
|
|
119
119
|
const triggerRect = trigger.getBoundingClientRect();
|
|
120
120
|
const bubbleRect = bubble.getBoundingClientRect();
|
|
121
121
|
if (bubbleRect.width === 0 || bubbleRect.height === 0) {
|
|
122
|
-
|
|
122
|
+
setVisible((prev) => prev ? false : prev);
|
|
123
123
|
if (rafRef.current) cancelAnimationFrame(rafRef.current);
|
|
124
124
|
rafRef.current = requestAnimationFrame(recompute);
|
|
125
125
|
return;
|
|
@@ -158,13 +158,17 @@ function TooltipLayer() {
|
|
|
158
158
|
lastPlacementRef.current = chosen;
|
|
159
159
|
setPlacement(chosen);
|
|
160
160
|
}
|
|
161
|
-
|
|
162
|
-
}, [active == null ? void 0 : active.open, active == null ? void 0 : active.triggerEl, active == null ? void 0 : active.placement, active == null ? void 0 : active.offset
|
|
161
|
+
setVisible((prev) => prev ? prev : true);
|
|
162
|
+
}, [active == null ? void 0 : active.open, active == null ? void 0 : active.triggerEl, active == null ? void 0 : active.placement, active == null ? void 0 : active.offset]);
|
|
163
163
|
react.useEffect(() => {
|
|
164
164
|
const nextOpen = !!(active == null ? void 0 : active.open);
|
|
165
165
|
setOpen((prev) => prev === nextOpen ? prev : nextOpen);
|
|
166
|
-
if (nextOpen)
|
|
167
|
-
|
|
166
|
+
if (nextOpen) {
|
|
167
|
+
setVisible(false);
|
|
168
|
+
} else {
|
|
169
|
+
setVisible(false);
|
|
170
|
+
lastActiveIdRef.current = null;
|
|
171
|
+
}
|
|
168
172
|
}, [active == null ? void 0 : active.open]);
|
|
169
173
|
react.useLayoutEffect(() => {
|
|
170
174
|
var _a;
|
|
@@ -113,7 +113,7 @@ function TooltipLayer() {
|
|
|
113
113
|
const triggerRect = trigger.getBoundingClientRect();
|
|
114
114
|
const bubbleRect = bubble.getBoundingClientRect();
|
|
115
115
|
if (bubbleRect.width === 0 || bubbleRect.height === 0) {
|
|
116
|
-
|
|
116
|
+
setVisible((prev) => prev ? false : prev);
|
|
117
117
|
if (rafRef.current) cancelAnimationFrame(rafRef.current);
|
|
118
118
|
rafRef.current = requestAnimationFrame(recompute);
|
|
119
119
|
return;
|
|
@@ -152,13 +152,17 @@ function TooltipLayer() {
|
|
|
152
152
|
lastPlacementRef.current = chosen;
|
|
153
153
|
setPlacement(chosen);
|
|
154
154
|
}
|
|
155
|
-
|
|
156
|
-
}, [active == null ? void 0 : active.open, active == null ? void 0 : active.triggerEl, active == null ? void 0 : active.placement, active == null ? void 0 : active.offset
|
|
155
|
+
setVisible((prev) => prev ? prev : true);
|
|
156
|
+
}, [active == null ? void 0 : active.open, active == null ? void 0 : active.triggerEl, active == null ? void 0 : active.placement, active == null ? void 0 : active.offset]);
|
|
157
157
|
useEffect(() => {
|
|
158
158
|
const nextOpen = !!(active == null ? void 0 : active.open);
|
|
159
159
|
setOpen((prev) => prev === nextOpen ? prev : nextOpen);
|
|
160
|
-
if (nextOpen)
|
|
161
|
-
|
|
160
|
+
if (nextOpen) {
|
|
161
|
+
setVisible(false);
|
|
162
|
+
} else {
|
|
163
|
+
setVisible(false);
|
|
164
|
+
lastActiveIdRef.current = null;
|
|
165
|
+
}
|
|
162
166
|
}, [active == null ? void 0 : active.open]);
|
|
163
167
|
useLayoutEffect(() => {
|
|
164
168
|
var _a;
|
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
--table-component-cell-fg: var(--table-cell-fg);
|
|
59
59
|
--table-component-cell-border: var(--table-border-subtle);
|
|
60
60
|
--table-component-divider: var(--table-divider);
|
|
61
|
+
--table-row-actions-reserve-inline: calc(var(--component-size-md) + 4px + var(--spacing-2xs));
|
|
61
62
|
|
|
62
63
|
display: flex;
|
|
63
64
|
flex-direction: column;
|
|
@@ -188,13 +189,13 @@
|
|
|
188
189
|
}
|
|
189
190
|
|
|
190
191
|
.md .headerCell {
|
|
191
|
-
padding-block: var(--spacing-
|
|
192
|
-
padding-inline: var(--spacing-
|
|
192
|
+
padding-block: var(--spacing-xxs);
|
|
193
|
+
padding-inline: var(--spacing-xs);
|
|
193
194
|
}
|
|
194
195
|
|
|
195
196
|
.md .cell {
|
|
196
|
-
padding-block: var(--spacing-
|
|
197
|
-
padding-inline: var(--spacing-
|
|
197
|
+
padding-block: var(--spacing-xxs);
|
|
198
|
+
padding-inline: var(--spacing-xs);
|
|
198
199
|
}
|
|
199
200
|
|
|
200
201
|
.sm .headerCell {
|
|
@@ -371,6 +372,10 @@
|
|
|
371
372
|
justify-content: flex-start;
|
|
372
373
|
}
|
|
373
374
|
|
|
375
|
+
.thMainWithActionsReserve {
|
|
376
|
+
padding-inline-end: var(--table-row-actions-reserve-inline);
|
|
377
|
+
}
|
|
378
|
+
|
|
374
379
|
.thMainRight {
|
|
375
380
|
justify-content: flex-end;
|
|
376
381
|
}
|
|
@@ -620,7 +625,7 @@
|
|
|
620
625
|
}
|
|
621
626
|
|
|
622
627
|
.cellContentWithActions {
|
|
623
|
-
padding-inline-end:
|
|
628
|
+
padding-inline-end: var(--table-row-actions-reserve-inline);
|
|
624
629
|
}
|
|
625
630
|
|
|
626
631
|
.contextMenuTrigger:hover,
|
|
@@ -13,6 +13,7 @@ function TableHeader({
|
|
|
13
13
|
columns,
|
|
14
14
|
hasSelection,
|
|
15
15
|
selectionMode,
|
|
16
|
+
hasRowContextMenu,
|
|
16
17
|
allRowsSelected,
|
|
17
18
|
onSelectAllRows,
|
|
18
19
|
sortById,
|
|
@@ -42,6 +43,7 @@ function TableHeader({
|
|
|
42
43
|
{
|
|
43
44
|
column,
|
|
44
45
|
index,
|
|
46
|
+
reserveInlineEnd: hasRowContextMenu && index === columns.length - 1,
|
|
45
47
|
sortById,
|
|
46
48
|
sortDirection,
|
|
47
49
|
onSortChange,
|
|
@@ -4,6 +4,7 @@ type Props<T> = {
|
|
|
4
4
|
columns: ColumnItem<T>[];
|
|
5
5
|
hasSelection: boolean;
|
|
6
6
|
selectionMode: 'single' | 'multiple';
|
|
7
|
+
hasRowContextMenu: boolean;
|
|
7
8
|
allRowsSelected?: boolean;
|
|
8
9
|
onSelectAllRows?: (isSelected: boolean) => void;
|
|
9
10
|
sortById?: string;
|
|
@@ -12,5 +13,5 @@ type Props<T> = {
|
|
|
12
13
|
headerExtras?: (args: HeaderExtrasArgs<T>) => ReactNode;
|
|
13
14
|
stickyTop?: string;
|
|
14
15
|
};
|
|
15
|
-
export declare function TableHeader<T>({ columns, hasSelection, selectionMode, allRowsSelected, onSelectAllRows, sortById, sortDirection, onSortChange, headerExtras, stickyTop, }: Props<T>): React.ReactNode;
|
|
16
|
+
export declare function TableHeader<T>({ columns, hasSelection, selectionMode, hasRowContextMenu, allRowsSelected, onSelectAllRows, sortById, sortDirection, onSortChange, headerExtras, stickyTop, }: Props<T>): React.ReactNode;
|
|
16
17
|
export {};
|
|
@@ -7,6 +7,7 @@ function TableHeader({
|
|
|
7
7
|
columns,
|
|
8
8
|
hasSelection,
|
|
9
9
|
selectionMode,
|
|
10
|
+
hasRowContextMenu,
|
|
10
11
|
allRowsSelected,
|
|
11
12
|
onSelectAllRows,
|
|
12
13
|
sortById,
|
|
@@ -36,6 +37,7 @@ function TableHeader({
|
|
|
36
37
|
{
|
|
37
38
|
column,
|
|
38
39
|
index,
|
|
40
|
+
reserveInlineEnd: hasRowContextMenu && index === columns.length - 1,
|
|
39
41
|
sortById,
|
|
40
42
|
sortDirection,
|
|
41
43
|
onSortChange,
|
|
@@ -13,6 +13,7 @@ var styles__default = /*#__PURE__*/_interopDefault(styles);
|
|
|
13
13
|
function TableHeaderCell({
|
|
14
14
|
column,
|
|
15
15
|
index,
|
|
16
|
+
reserveInlineEnd = false,
|
|
16
17
|
sortById,
|
|
17
18
|
sortDirection,
|
|
18
19
|
onSortChange,
|
|
@@ -37,7 +38,7 @@ function TableHeaderCell({
|
|
|
37
38
|
"data-divider": column.divider,
|
|
38
39
|
"data-column-index": index,
|
|
39
40
|
children: [
|
|
40
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: alignClasses.inner, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: alignClasses.main, children: column.sortable ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
41
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: alignClasses.inner, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: table_classes.cx(alignClasses.main, reserveInlineEnd && styles__default.default.thMainWithActionsReserve), children: column.sortable ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
41
42
|
"button",
|
|
42
43
|
{
|
|
43
44
|
type: "button",
|
|
@@ -3,10 +3,11 @@ import type { ColumnItem, SortDirection } from '../Table.types';
|
|
|
3
3
|
type Props<T> = {
|
|
4
4
|
column: ColumnItem<T>;
|
|
5
5
|
index: number;
|
|
6
|
+
reserveInlineEnd?: boolean;
|
|
6
7
|
sortById?: string;
|
|
7
8
|
sortDirection?: SortDirection;
|
|
8
9
|
onSortChange?: (column: ColumnItem<T>, direction: SortDirection) => void;
|
|
9
10
|
extraContent?: ReactNode;
|
|
10
11
|
};
|
|
11
|
-
export declare function TableHeaderCell<T>({ column, index, sortById, sortDirection, onSortChange, extraContent, }: Props<T>): ReactNode;
|
|
12
|
+
export declare function TableHeaderCell<T>({ column, index, reserveInlineEnd, sortById, sortDirection, onSortChange, extraContent, }: Props<T>): ReactNode;
|
|
12
13
|
export {};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { ArrowUp, ArrowDown } from 'lucide-react';
|
|
3
|
-
import { getAlignValue, getHeaderAlignClasses } from '../table.classes';
|
|
3
|
+
import { getAlignValue, getHeaderAlignClasses, cx } from '../table.classes';
|
|
4
4
|
import styles from '../Table.module.css';
|
|
5
5
|
import { isActiveSort, getAriaSort, getHeaderLabel, shouldToggleOnKey, getNextSortDirection } from '../table.utils';
|
|
6
6
|
|
|
7
7
|
function TableHeaderCell({
|
|
8
8
|
column,
|
|
9
9
|
index,
|
|
10
|
+
reserveInlineEnd = false,
|
|
10
11
|
sortById,
|
|
11
12
|
sortDirection,
|
|
12
13
|
onSortChange,
|
|
@@ -31,7 +32,7 @@ function TableHeaderCell({
|
|
|
31
32
|
"data-divider": column.divider,
|
|
32
33
|
"data-column-index": index,
|
|
33
34
|
children: [
|
|
34
|
-
/* @__PURE__ */ jsx("div", { className: alignClasses.inner, children: /* @__PURE__ */ jsx("div", { className: alignClasses.main, children: column.sortable ? /* @__PURE__ */ jsxs(
|
|
35
|
+
/* @__PURE__ */ jsx("div", { className: alignClasses.inner, children: /* @__PURE__ */ jsx("div", { className: cx(alignClasses.main, reserveInlineEnd && styles.thMainWithActionsReserve), children: column.sortable ? /* @__PURE__ */ jsxs(
|
|
35
36
|
"button",
|
|
36
37
|
{
|
|
37
38
|
type: "button",
|
|
@@ -220,7 +220,17 @@
|
|
|
220
220
|
}
|
|
221
221
|
|
|
222
222
|
.filled > .tabList {
|
|
223
|
-
|
|
223
|
+
position: relative;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.filled > .tabList::after {
|
|
227
|
+
content: '';
|
|
228
|
+
position: absolute;
|
|
229
|
+
inset-inline: 0;
|
|
230
|
+
inset-block-end: 0;
|
|
231
|
+
block-size: 1px;
|
|
232
|
+
background: var(--color-border-subtle);
|
|
233
|
+
pointer-events: none;
|
|
224
234
|
}
|
|
225
235
|
|
|
226
236
|
/* One continuous backdrop behind the whole button row, so the curved gap
|
|
@@ -249,7 +259,7 @@
|
|
|
249
259
|
|
|
250
260
|
.filled > .tabList > .tabButtons > .tab {
|
|
251
261
|
border: 1px solid transparent;
|
|
252
|
-
border-block-end:
|
|
262
|
+
border-block-end-width: 1px;
|
|
253
263
|
color: var(--color-fg-muted);
|
|
254
264
|
position: relative;
|
|
255
265
|
transition:
|
|
@@ -276,6 +286,15 @@
|
|
|
276
286
|
color: var(--color-fg-default);
|
|
277
287
|
}
|
|
278
288
|
|
|
289
|
+
.filled > .tabList > .tabButtons > .tab.active::after {
|
|
290
|
+
content: '';
|
|
291
|
+
position: absolute;
|
|
292
|
+
inset-inline: -1px;
|
|
293
|
+
inset-block-end: -1px;
|
|
294
|
+
block-size: 1px;
|
|
295
|
+
background: var(--color-bg-surface);
|
|
296
|
+
}
|
|
297
|
+
|
|
279
298
|
.filled > .tabContent {
|
|
280
299
|
background: var(--color-bg-surface);
|
|
281
300
|
border: 1px solid var(--color-border-subtle);
|