@dbcdk/react-components 0.0.188 → 0.0.190

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/components/accordion/Accordion.cjs +4 -8
  2. package/dist/components/accordion/Accordion.d.ts +1 -1
  3. package/dist/components/accordion/Accordion.js +4 -8
  4. package/dist/components/accordion/Accordion.module.css +55 -6
  5. package/dist/components/accordion/components/AccordionRow.cjs +2 -2
  6. package/dist/components/accordion/components/AccordionRow.d.ts +2 -2
  7. package/dist/components/accordion/components/AccordionRow.js +2 -2
  8. package/dist/components/accordion/components/AccordionRow.module.css +24 -2
  9. package/dist/components/badge/Badge.module.css +11 -11
  10. package/dist/components/breadcrumbs/Breadcrumbs.cjs +10 -7
  11. package/dist/components/breadcrumbs/Breadcrumbs.js +10 -7
  12. package/dist/components/breadcrumbs/Breadcrumbs.module.css +1 -5
  13. package/dist/components/button/Button.module.css +4 -2
  14. package/dist/components/chip/Chip.module.css +15 -1
  15. package/dist/components/circle/Circle.module.css +4 -0
  16. package/dist/components/forms/input/Input.module.css +2 -1
  17. package/dist/components/forms/input-container/InputContainer.cjs +11 -4
  18. package/dist/components/forms/input-container/InputContainer.d.ts +4 -4
  19. package/dist/components/forms/input-container/InputContainer.js +11 -4
  20. package/dist/components/forms/text-area/Textarea.cjs +2 -1
  21. package/dist/components/forms/text-area/Textarea.js +2 -1
  22. package/dist/components/metric-tile/MetricTile.cjs +25 -0
  23. package/dist/components/metric-tile/MetricTile.d.ts +1 -0
  24. package/dist/components/metric-tile/MetricTile.js +25 -0
  25. package/dist/components/metric-tile/MetricTile.module.css +8 -0
  26. package/dist/components/nav-bar/NavBar.d.ts +1 -0
  27. package/dist/components/overlay/tooltip/TooltipProvider.cjs +9 -5
  28. package/dist/components/overlay/tooltip/TooltipProvider.js +9 -5
  29. package/dist/components/page-layout/PageLayout.module.css +8 -1
  30. package/dist/components/sidebar/components/SidebarItem.cjs +2 -0
  31. package/dist/components/sidebar/components/SidebarItem.d.ts +2 -1
  32. package/dist/components/sidebar/components/SidebarItem.js +2 -0
  33. package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.cjs +4 -0
  34. package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.d.ts +2 -1
  35. package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.js +4 -0
  36. package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.cjs +6 -1
  37. package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.d.ts +2 -1
  38. package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.js +6 -1
  39. package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.module.css +14 -0
  40. package/dist/components/sidebar/components/sidebar-items/SidebarItems.cjs +13 -2
  41. package/dist/components/sidebar/components/sidebar-items/SidebarItems.js +13 -2
  42. package/dist/components/table/Table.cjs +1 -0
  43. package/dist/components/table/Table.js +1 -0
  44. package/dist/components/table/Table.module.css +8 -5
  45. package/dist/components/table/Table.types.d.ts +1 -0
  46. package/dist/components/table/components/TableHeader.cjs +2 -0
  47. package/dist/components/table/components/TableHeader.d.ts +2 -1
  48. package/dist/components/table/components/TableHeader.js +2 -0
  49. package/dist/components/table/components/TableHeaderCell.cjs +3 -2
  50. package/dist/components/table/components/TableHeaderCell.d.ts +2 -1
  51. package/dist/components/table/components/TableHeaderCell.js +4 -3
  52. package/dist/components/table/components/TableRow.cjs +1 -0
  53. package/dist/components/table/components/TableRow.js +1 -0
  54. package/dist/components/table/tanstackTable.utils.cjs +3 -2
  55. package/dist/components/table/tanstackTable.utils.js +3 -2
  56. package/dist/components/tabs/Tabs.module.css +34 -6
  57. package/dist/styles/styles.css +39 -3
  58. package/dist/styles.css +39 -3
  59. package/package.json +1 -1
@@ -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);
@@ -4,6 +4,7 @@ export type NavBarItem = NavBarLinkItem | NavBarExpandableItem | NavBarGroupItem
4
4
  type NavBarBase = {
5
5
  label: string;
6
6
  icon?: ReactNode;
7
+ badge?: number | string;
7
8
  iconWidth?: string | number;
8
9
  enabled?: boolean;
9
10
  tags?: string[];
@@ -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
- if (visible) setVisible(false);
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
- if (!visible) setVisible(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, visible]);
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) setVisible(false);
167
- if (!nextOpen) lastActiveIdRef.current = null;
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
- if (visible) setVisible(false);
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
- if (!visible) setVisible(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, visible]);
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) setVisible(false);
161
- if (!nextOpen) lastActiveIdRef.current = null;
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;
@@ -16,6 +16,9 @@
16
16
  --page-layout-banner-height: calc(
17
17
  var(--spacing-2xs) * 2 + var(--font-size-md) * var(--line-height-normal)
18
18
  );
19
+
20
+ /* Structural bottom breathing room for all page content. */
21
+ --page-layout-content-padding-bottom: var(--spacing-2xl);
19
22
  }
20
23
 
21
24
  /* Viewport handling:
@@ -215,7 +218,11 @@
215
218
  align-items: center;
216
219
 
217
220
  background: var(--color-bg-surface);
218
- padding: var(--spacing-md);
221
+ padding-block-start: var(--spacing-md);
222
+ padding-inline: var(--spacing-md);
223
+ padding-block-end: calc(
224
+ var(--page-layout-content-padding-bottom) + env(safe-area-inset-bottom, 0px)
225
+ );
219
226
  overflow: visible;
220
227
  }
221
228
 
@@ -7,6 +7,7 @@ function SidebarItem({
7
7
  component: Component,
8
8
  label,
9
9
  icon,
10
+ badge,
10
11
  href,
11
12
  iconWidth,
12
13
  truncateLabel
@@ -18,6 +19,7 @@ function SidebarItem({
18
19
  SidebarItemContent.SidebarItemContent,
19
20
  {
20
21
  icon,
22
+ badge,
21
23
  iconWidth,
22
24
  label,
23
25
  href,
@@ -3,9 +3,10 @@ interface SidebarItemProps {
3
3
  component?: React.ElementType;
4
4
  label: string;
5
5
  icon: React.ReactNode;
6
+ badge?: number | string;
6
7
  href?: string;
7
8
  iconWidth?: string | number;
8
9
  truncateLabel?: boolean;
9
10
  }
10
- export declare function SidebarItem({ component: Component, label, icon, href, iconWidth, truncateLabel, }: SidebarItemProps): React.ReactNode;
11
+ export declare function SidebarItem({ component: Component, label, icon, badge, href, iconWidth, truncateLabel, }: SidebarItemProps): React.ReactNode;
11
12
  export {};
@@ -5,6 +5,7 @@ function SidebarItem({
5
5
  component: Component,
6
6
  label,
7
7
  icon,
8
+ badge,
8
9
  href,
9
10
  iconWidth,
10
11
  truncateLabel
@@ -16,6 +17,7 @@ function SidebarItem({
16
17
  SidebarItemContent,
17
18
  {
18
19
  icon,
20
+ badge,
19
21
  iconWidth,
20
22
  label,
21
23
  href,
@@ -21,6 +21,7 @@ function ExpandableSidebarItem({
21
21
  items,
22
22
  label,
23
23
  icon,
24
+ badge,
24
25
  component: Component,
25
26
  href,
26
27
  iconWidth,
@@ -85,6 +86,7 @@ function ExpandableSidebarItem({
85
86
  items: (_b = item.children) != null ? _b : [],
86
87
  label: item.label,
87
88
  icon: item.icon,
89
+ badge: item.badge,
88
90
  href: item.href,
89
91
  iconWidth: item.iconWidth,
90
92
  component: item.component
@@ -98,6 +100,7 @@ function ExpandableSidebarItem({
98
100
  component: item.component,
99
101
  label: item.label,
100
102
  icon: item.icon,
103
+ badge: item.badge,
101
104
  href: item.href,
102
105
  iconWidth: item.iconWidth,
103
106
  truncateLabel: item.truncateLabel
@@ -112,6 +115,7 @@ function ExpandableSidebarItem({
112
115
  {
113
116
  headerStyle: expanded,
114
117
  icon,
118
+ badge,
115
119
  iconWidth,
116
120
  label,
117
121
  href,
@@ -5,9 +5,10 @@ type ExpandableSidebarItemProps = {
5
5
  label: string;
6
6
  component: React.ElementType;
7
7
  icon: React.ReactNode;
8
+ badge?: number | string;
8
9
  href: string;
9
10
  iconWidth?: string | number;
10
11
  truncateLabel?: boolean;
11
12
  };
12
- export declare function ExpandableSidebarItem({ items, label, icon, component: Component, href, iconWidth, truncateLabel, }: ExpandableSidebarItemProps): React.ReactNode;
13
+ export declare function ExpandableSidebarItem({ items, label, icon, badge, component: Component, href, iconWidth, truncateLabel, }: ExpandableSidebarItemProps): React.ReactNode;
13
14
  export {};
@@ -15,6 +15,7 @@ function ExpandableSidebarItem({
15
15
  items,
16
16
  label,
17
17
  icon,
18
+ badge,
18
19
  component: Component,
19
20
  href,
20
21
  iconWidth,
@@ -79,6 +80,7 @@ function ExpandableSidebarItem({
79
80
  items: (_b = item.children) != null ? _b : [],
80
81
  label: item.label,
81
82
  icon: item.icon,
83
+ badge: item.badge,
82
84
  href: item.href,
83
85
  iconWidth: item.iconWidth,
84
86
  component: item.component
@@ -92,6 +94,7 @@ function ExpandableSidebarItem({
92
94
  component: item.component,
93
95
  label: item.label,
94
96
  icon: item.icon,
97
+ badge: item.badge,
95
98
  href: item.href,
96
99
  iconWidth: item.iconWidth,
97
100
  truncateLabel: item.truncateLabel
@@ -106,6 +109,7 @@ function ExpandableSidebarItem({
106
109
  {
107
110
  headerStyle: expanded,
108
111
  icon,
112
+ badge,
109
113
  iconWidth,
110
114
  label,
111
115
  href,
@@ -5,6 +5,7 @@ var jsxRuntime = require('react/jsx-runtime');
5
5
  var React = require('react');
6
6
  var getHighlightedSegments = require('../../../../utils/text/get-highlighted-segments');
7
7
  var styles = require('./SidebarItemContent.module.css');
8
+ var Chip = require('../../../chip/Chip');
8
9
  var SidebarProvider = require('../../providers/SidebarProvider');
9
10
 
10
11
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
@@ -15,6 +16,7 @@ var styles__default = /*#__PURE__*/_interopDefault(styles);
15
16
  function SidebarItemContent({
16
17
  icon,
17
18
  label,
19
+ badge,
18
20
  suffixIcon,
19
21
  href,
20
22
  iconWidth,
@@ -45,7 +47,10 @@ function SidebarItemContent({
45
47
  }
46
48
  )
47
49
  ] }),
48
- suffixIcon && !isSidebarCollapsed && /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.suffixIcon, children: suffixIcon })
50
+ !isSidebarCollapsed && (badge != null || suffixIcon) ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: styles__default.default.trailing, children: [
51
+ badge != null ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.badge, children: /* @__PURE__ */ jsxRuntime.jsx(Chip.Chip, { size: "sm", children: typeof badge === "number" ? badge.toLocaleString("da-DK") : badge }) }) : null,
52
+ suffixIcon ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.suffixIcon, children: suffixIcon }) : null
53
+ ] }) : null
49
54
  ]
50
55
  }
51
56
  );
@@ -3,6 +3,7 @@ import type { JSX } from 'react';
3
3
  export interface SidebarItemContentProps {
4
4
  icon?: React.ReactNode;
5
5
  label: React.ReactNode;
6
+ badge?: number | string;
6
7
  suffixIcon?: React.ReactNode;
7
8
  href?: string;
8
9
  iconWidth?: string | number;
@@ -10,4 +11,4 @@ export interface SidebarItemContentProps {
10
11
  headerStyle?: boolean;
11
12
  truncateLabel?: boolean;
12
13
  }
13
- export declare function SidebarItemContent({ icon, label, suffixIcon, href, iconWidth, disableActiveStyles, headerStyle, truncateLabel, }: SidebarItemContentProps): JSX.Element;
14
+ export declare function SidebarItemContent({ icon, label, badge, suffixIcon, href, iconWidth, disableActiveStyles, headerStyle, truncateLabel, }: SidebarItemContentProps): JSX.Element;
@@ -3,11 +3,13 @@ import { jsx, jsxs } from 'react/jsx-runtime';
3
3
  import React from 'react';
4
4
  import { getHighlightedSegments } from '../../../../utils/text/get-highlighted-segments';
5
5
  import styles from './SidebarItemContent.module.css';
6
+ import { Chip } from '../../../chip/Chip';
6
7
  import { useSidebar } from '../../providers/SidebarProvider';
7
8
 
8
9
  function SidebarItemContent({
9
10
  icon,
10
11
  label,
12
+ badge,
11
13
  suffixIcon,
12
14
  href,
13
15
  iconWidth,
@@ -38,7 +40,10 @@ function SidebarItemContent({
38
40
  }
39
41
  )
40
42
  ] }),
41
- suffixIcon && !isSidebarCollapsed && /* @__PURE__ */ jsx("span", { className: styles.suffixIcon, children: suffixIcon })
43
+ !isSidebarCollapsed && (badge != null || suffixIcon) ? /* @__PURE__ */ jsxs("span", { className: styles.trailing, children: [
44
+ badge != null ? /* @__PURE__ */ jsx("span", { className: styles.badge, children: /* @__PURE__ */ jsx(Chip, { size: "sm", children: typeof badge === "number" ? badge.toLocaleString("da-DK") : badge }) }) : null,
45
+ suffixIcon ? /* @__PURE__ */ jsx("span", { className: styles.suffixIcon, children: suffixIcon }) : null
46
+ ] }) : null
42
47
  ]
43
48
  }
44
49
  );
@@ -87,6 +87,20 @@
87
87
  color: inherit;
88
88
  }
89
89
 
90
+ .trailing {
91
+ display: inline-flex;
92
+ align-items: center;
93
+ gap: var(--spacing-xs);
94
+ flex: 0 0 auto;
95
+ margin-inline-start: auto;
96
+ min-inline-size: 0;
97
+ }
98
+
99
+ .badge {
100
+ display: inline-flex;
101
+ align-items: center;
102
+ }
103
+
90
104
  .collapsed svg {
91
105
  inline-size: var(--icon-size-md);
92
106
  block-size: var(--icon-size-md);
@@ -26,13 +26,23 @@ function SidebarItems({ activeLink }) {
26
26
  ] }, key);
27
27
  }
28
28
  if (item.type === "expandable") {
29
- const { component: Component2, label: label2, icon: icon2, children, href: href2, iconWidth: iconWidth2, truncateLabel: truncateLabel2 } = item;
29
+ const {
30
+ component: Component2,
31
+ label: label2,
32
+ icon: icon2,
33
+ badge: badge2,
34
+ children,
35
+ href: href2,
36
+ iconWidth: iconWidth2,
37
+ truncateLabel: truncateLabel2
38
+ } = item;
30
39
  return /* @__PURE__ */ jsxRuntime.jsx(
31
40
  ExpandableSidebarItem.ExpandableSidebarItem,
32
41
  {
33
42
  items: children,
34
43
  label: label2,
35
44
  icon: icon2,
45
+ badge: badge2,
36
46
  href: href2,
37
47
  iconWidth: iconWidth2,
38
48
  truncateLabel: truncateLabel2,
@@ -41,13 +51,14 @@ function SidebarItems({ activeLink }) {
41
51
  key
42
52
  );
43
53
  }
44
- const { component: Component, label, icon, href, iconWidth, truncateLabel } = item;
54
+ const { component: Component, label, icon, badge, href, iconWidth, truncateLabel } = item;
45
55
  return /* @__PURE__ */ jsxRuntime.jsx(
46
56
  SidebarItem.SidebarItem,
47
57
  {
48
58
  component: Component,
49
59
  label,
50
60
  icon,
61
+ badge,
51
62
  href,
52
63
  iconWidth,
53
64
  truncateLabel
@@ -20,13 +20,23 @@ function SidebarItems({ activeLink }) {
20
20
  ] }, key);
21
21
  }
22
22
  if (item.type === "expandable") {
23
- const { component: Component2, label: label2, icon: icon2, children, href: href2, iconWidth: iconWidth2, truncateLabel: truncateLabel2 } = item;
23
+ const {
24
+ component: Component2,
25
+ label: label2,
26
+ icon: icon2,
27
+ badge: badge2,
28
+ children,
29
+ href: href2,
30
+ iconWidth: iconWidth2,
31
+ truncateLabel: truncateLabel2
32
+ } = item;
24
33
  return /* @__PURE__ */ jsx(
25
34
  ExpandableSidebarItem,
26
35
  {
27
36
  items: children,
28
37
  label: label2,
29
38
  icon: icon2,
39
+ badge: badge2,
30
40
  href: href2,
31
41
  iconWidth: iconWidth2,
32
42
  truncateLabel: truncateLabel2,
@@ -35,13 +45,14 @@ function SidebarItems({ activeLink }) {
35
45
  key
36
46
  );
37
47
  }
38
- const { component: Component, label, icon, href, iconWidth, truncateLabel } = item;
48
+ const { component: Component, label, icon, badge, href, iconWidth, truncateLabel } = item;
39
49
  return /* @__PURE__ */ jsx(
40
50
  SidebarItem,
41
51
  {
42
52
  component: Component,
43
53
  label,
44
54
  icon,
55
+ badge,
45
56
  href,
46
57
  iconWidth,
47
58
  truncateLabel
@@ -197,6 +197,7 @@ function Table({
197
197
  columns: visibleColumns,
198
198
  hasSelection,
199
199
  selectionMode,
200
+ hasRowContextMenu: Boolean(getContextMenuItems),
200
201
  allRowsSelected,
201
202
  onSelectAllRows,
202
203
  sortById,
@@ -191,6 +191,7 @@ function Table({
191
191
  columns: visibleColumns,
192
192
  hasSelection,
193
193
  selectionMode,
194
+ hasRowContextMenu: Boolean(getContextMenuItems),
194
195
  allRowsSelected,
195
196
  onSelectAllRows,
196
197
  sortById,
@@ -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;
@@ -184,17 +185,16 @@
184
185
  background: var(--table-component-row-bg);
185
186
  overflow: hidden;
186
187
  line-height: 20px;
187
- height: 40px;
188
188
  }
189
189
 
190
190
  .md .headerCell {
191
191
  padding-block: var(--spacing-xs);
192
- padding-inline: var(--spacing-sm);
192
+ padding-inline: var(--spacing-xs);
193
193
  }
194
194
 
195
195
  .md .cell {
196
196
  padding-block: var(--spacing-xs);
197
- padding-inline: var(--spacing-sm);
197
+ padding-inline: var(--spacing-xs);
198
198
  }
199
199
 
200
200
  .sm .headerCell {
@@ -207,7 +207,6 @@
207
207
  padding-inline: var(--spacing-sm);
208
208
  font-size: var(--font-size-xs);
209
209
  line-height: 20px;
210
- height: 32px;
211
210
  }
212
211
 
213
212
  .sm .contextMenuTrigger {
@@ -371,6 +370,10 @@
371
370
  justify-content: flex-start;
372
371
  }
373
372
 
373
+ .thMainWithActionsReserve {
374
+ padding-inline-end: var(--table-row-actions-reserve-inline);
375
+ }
376
+
374
377
  .thMainRight {
375
378
  justify-content: flex-end;
376
379
  }
@@ -620,7 +623,7 @@
620
623
  }
621
624
 
622
625
  .cellContentWithActions {
623
- padding-inline-end: calc(var(--component-size-md) + 4px + var(--spacing-sm));
626
+ padding-inline-end: var(--table-row-actions-reserve-inline);
624
627
  }
625
628
 
626
629
  .contextMenuTrigger:hover,
@@ -12,6 +12,7 @@ export interface ColumnItem<T> {
12
12
  render?: (item: T) => ReactNode;
13
13
  hidden?: boolean;
14
14
  align?: 'left' | 'right' | 'center';
15
+ muted?: boolean;
15
16
  verticalAlign?: 'top' | 'middle' | 'bottom';
16
17
  divider?: 'right' | 'left';
17
18
  allowWrap?: boolean;
@@ -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,
@@ -30,14 +31,14 @@ function TableHeaderCell({
30
31
  return /* @__PURE__ */ jsxRuntime.jsxs(
31
32
  "th",
32
33
  {
33
- className: styles__default.default.headerCell,
34
+ className: table_classes.cx(styles__default.default.headerCell, column.muted && "dbc-muted-text"),
34
35
  scope: "col",
35
36
  "aria-sort": ariaSort,
36
37
  "data-align": align,
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,
@@ -24,14 +25,14 @@ function TableHeaderCell({
24
25
  return /* @__PURE__ */ jsxs(
25
26
  "th",
26
27
  {
27
- className: styles.headerCell,
28
+ className: cx(styles.headerCell, column.muted && "dbc-muted-text"),
28
29
  scope: "col",
29
30
  "aria-sort": ariaSort,
30
31
  "data-align": align,
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",