@dbcdk/react-components 0.0.213 → 0.0.215

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.
@@ -201,6 +201,13 @@
201
201
  box-shadow: inset 0 0 0 1px var(--color-field-focus);
202
202
  }
203
203
 
204
+ /* The control group clips its rounded corners, so the focus ring follows them instead of being
205
+ cut off. The value is always the group's last part. */
206
+ .valueWrapper {
207
+ border-start-end-radius: calc(var(--border-radius-default) - 1px);
208
+ border-end-end-radius: calc(var(--border-radius-default) - 1px);
209
+ }
210
+
204
211
  .invalid .valueWrapper:focus-within {
205
212
  box-shadow: inset 0 0 0 1px var(--color-status-danger-border);
206
213
  }
@@ -56,11 +56,11 @@ function InputContainer({
56
56
  "div",
57
57
  {
58
58
  "data-modified": modified ? "true" : void 0,
59
- className: `dbc-flex dbc-flex-column dbc-gap-xs ${styles__default.default.inputContainer}`,
59
+ className: "dbc-flex dbc-flex-column dbc-gap-xs",
60
60
  style: { width: fullWidth ? "100%" : void 0 },
61
61
  children: [
62
62
  renderLabelRow,
63
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "dbc-flex dbc-flex-column dbc-gap-xxs", children: [
63
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${styles__default.default.control} dbc-flex dbc-flex-column dbc-gap-xxs`, children: [
64
64
  children,
65
65
  renderMessageRow
66
66
  ] })
@@ -50,11 +50,11 @@ function InputContainer({
50
50
  "div",
51
51
  {
52
52
  "data-modified": modified ? "true" : void 0,
53
- className: `dbc-flex dbc-flex-column dbc-gap-xs ${styles.inputContainer}`,
53
+ className: "dbc-flex dbc-flex-column dbc-gap-xs",
54
54
  style: { width: fullWidth ? "100%" : void 0 },
55
55
  children: [
56
56
  renderLabelRow,
57
- /* @__PURE__ */ jsxs("div", { className: "dbc-flex dbc-flex-column dbc-gap-xxs", children: [
57
+ /* @__PURE__ */ jsxs("div", { className: `${styles.control} dbc-flex dbc-flex-column dbc-gap-xxs`, children: [
58
58
  children,
59
59
  renderMessageRow
60
60
  ] })
@@ -91,3 +91,12 @@
91
91
  align-items: flex-start;
92
92
  flex-shrink: 0;
93
93
  }
94
+
95
+ /* Fills the container the way the control did before it was wrapped, so components that size
96
+ the container, e.g. FilterField, still size the control. */
97
+ .control {
98
+ flex: 1 1 auto;
99
+ width: 100%;
100
+ min-width: 0;
101
+ min-height: 0;
102
+ }
@@ -11,11 +11,13 @@ var SidebarItems = require('../../../../components/sidebar/components/sidebar-it
11
11
  var SidenavFiltering = require('../../../../components/sidebar/components/sidenav-filteirng/SidenavFiltering');
12
12
  var SidebarProvider = require('../../../../components/sidebar/providers/SidebarProvider');
13
13
  var styles = require('./SidebarContainer.module.css');
14
+ var scrollbarStyles = require('../../../../styles/HoverScrollbar.module.css');
14
15
 
15
16
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
16
17
 
17
18
  var SidenavFiltering__default = /*#__PURE__*/_interopDefault(SidenavFiltering);
18
19
  var styles__default = /*#__PURE__*/_interopDefault(styles);
20
+ var scrollbarStyles__default = /*#__PURE__*/_interopDefault(scrollbarStyles);
19
21
 
20
22
  function clamp(n, min, max) {
21
23
  return Math.max(min, Math.min(max, n));
@@ -163,7 +165,7 @@ function SidebarContainer({
163
165
  {
164
166
  ref: containerRef,
165
167
  role: "complementary",
166
- className: `${styles__default.default.container} ${isSidebarCollapsed ? styles__default.default.collapsed : ""} ${isResizing ? styles__default.default.resizing : ""}`,
168
+ className: `${scrollbarStyles__default.default.region} ${scrollbarStyles__default.default.scrollArea} ${styles__default.default.container} ${isSidebarCollapsed ? styles__default.default.collapsed : ""} ${isResizing ? styles__default.default.resizing : ""}`,
167
169
  style: containerStyle,
168
170
  children: [
169
171
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.header, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles__default.default.productHeader, children: [
@@ -184,9 +186,9 @@ function SidebarContainer({
184
186
  }
185
187
  )
186
188
  ] }) }),
187
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles__default.default.content, children: [
189
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${styles__default.default.content} ${scrollbarStyles__default.default.scrollArea}`, children: [
188
190
  !hideSearch && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.filter, children: /* @__PURE__ */ jsxRuntime.jsx(SidenavFiltering__default.default, { placeholder: searchPlaceholder, showSettings }) }),
189
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.links, children: /* @__PURE__ */ jsxRuntime.jsx(SidebarItems.SidebarItems, { activeLink }) })
191
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${styles__default.default.links} ${scrollbarStyles__default.default.scrollArea}`, children: /* @__PURE__ */ jsxRuntime.jsx(SidebarItems.SidebarItems, { activeLink }) })
190
192
  ] }),
191
193
  footer && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.footerSlot, children: footer }),
192
194
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles__default.default.footer, children: [
@@ -9,6 +9,7 @@ import { SidebarItems } from '../../../../components/sidebar/components/sidebar-
9
9
  import SidenavFiltering from '../../../../components/sidebar/components/sidenav-filteirng/SidenavFiltering';
10
10
  import { useSidebar } from '../../../../components/sidebar/providers/SidebarProvider';
11
11
  import styles from './SidebarContainer.module.css';
12
+ import scrollbarStyles from '../../../../styles/HoverScrollbar.module.css';
12
13
 
13
14
  function clamp(n, min, max) {
14
15
  return Math.max(min, Math.min(max, n));
@@ -156,7 +157,7 @@ function SidebarContainer({
156
157
  {
157
158
  ref: containerRef,
158
159
  role: "complementary",
159
- className: `${styles.container} ${isSidebarCollapsed ? styles.collapsed : ""} ${isResizing ? styles.resizing : ""}`,
160
+ className: `${scrollbarStyles.region} ${scrollbarStyles.scrollArea} ${styles.container} ${isSidebarCollapsed ? styles.collapsed : ""} ${isResizing ? styles.resizing : ""}`,
160
161
  style: containerStyle,
161
162
  children: [
162
163
  /* @__PURE__ */ jsx("div", { className: styles.header, children: /* @__PURE__ */ jsxs("div", { className: styles.productHeader, children: [
@@ -177,9 +178,9 @@ function SidebarContainer({
177
178
  }
178
179
  )
179
180
  ] }) }),
180
- /* @__PURE__ */ jsxs("div", { className: styles.content, children: [
181
+ /* @__PURE__ */ jsxs("div", { className: `${styles.content} ${scrollbarStyles.scrollArea}`, children: [
181
182
  !hideSearch && /* @__PURE__ */ jsx("div", { className: styles.filter, children: /* @__PURE__ */ jsx(SidenavFiltering, { placeholder: searchPlaceholder, showSettings }) }),
182
- /* @__PURE__ */ jsx("div", { className: styles.links, children: /* @__PURE__ */ jsx(SidebarItems, { activeLink }) })
183
+ /* @__PURE__ */ jsx("div", { className: `${styles.links} ${scrollbarStyles.scrollArea}`, children: /* @__PURE__ */ jsx(SidebarItems, { activeLink }) })
183
184
  ] }),
184
185
  footer && /* @__PURE__ */ jsx("div", { className: styles.footerSlot, children: footer }),
185
186
  /* @__PURE__ */ jsxs("div", { className: styles.footer, children: [
@@ -15,46 +15,6 @@
15
15
  inline-size var(--transition-fast) var(--ease-standard);
16
16
  }
17
17
 
18
- /* Keep native scrolling visible without competing with navigation content. */
19
- :is(.container, .content, .links) {
20
- scrollbar-width: thin;
21
- scrollbar-color: var(--color-border-subtle) transparent;
22
- }
23
-
24
- :is(.container, .content, .links):is(:hover, :focus-within) {
25
- scrollbar-color: var(--color-border-default) transparent;
26
- }
27
-
28
- /* Non-auto standard properties override WebKit thumb styling in Chromium. */
29
- @supports selector(::-webkit-scrollbar) {
30
- :is(.container, .content, .links),
31
- :is(.container, .content, .links):is(:hover, :focus-within) {
32
- scrollbar-width: auto;
33
- scrollbar-color: auto;
34
- }
35
- }
36
-
37
- :is(.container, .content, .links)::-webkit-scrollbar {
38
- width: calc(var(--spacing-xxs) + 2 * var(--border-width-thin));
39
- height: calc(var(--spacing-xxs) + 2 * var(--border-width-thin));
40
- }
41
-
42
- :is(.container, .content, .links)::-webkit-scrollbar-track {
43
- background: transparent;
44
- }
45
-
46
- :is(.container, .content, .links)::-webkit-scrollbar-thumb {
47
- background-color: var(--color-border-subtle);
48
- background-clip: padding-box;
49
- border: var(--border-width-thin) solid transparent;
50
- border-radius: var(--border-radius-default);
51
- }
52
-
53
- :is(.container, .content, .links)::-webkit-scrollbar-thumb:hover,
54
- :is(.container, .content, .links):focus-within::-webkit-scrollbar-thumb {
55
- background-color: var(--color-border-default);
56
- }
57
-
58
18
  .sidebarIcon {
59
19
  inline-size: var(--icon-size-sm);
60
20
  block-size: var(--icon-size-sm);
@@ -7,6 +7,7 @@ var Pagination = require('../../components/pagination/Pagination');
7
7
  var useViewportFill = require('../../hooks/useViewportFill');
8
8
  var refs_utils = require('../../utils/refs.utils');
9
9
  var columnLayout_utils = require('./columnLayout.utils');
10
+ var scrollbarStyles = require('../../styles/HoverScrollbar.module.css');
10
11
  var EmptyState = require('./components/empty-state/EmptyState');
11
12
  var TableHeaderSettings = require('./components/table-settings/TableHeaderSettings');
12
13
  var TableBody = require('./components/TableBody');
@@ -20,6 +21,7 @@ var tableSettings_utils = require('./tableSettings.utils');
20
21
 
21
22
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
22
23
 
24
+ var scrollbarStyles__default = /*#__PURE__*/_interopDefault(scrollbarStyles);
23
25
  var styles__default = /*#__PURE__*/_interopDefault(styles);
24
26
 
25
27
  const DEFAULT_SKELETON_ROWS = 10;
@@ -111,7 +113,10 @@ function Table({
111
113
  () => tableWidth == null && (columnLayout_utils.usesDistributedWidths(visibleColumns) || showHeader && hasHeaderActions),
112
114
  [tableWidth, visibleColumns, showHeader, hasHeaderActions]
113
115
  );
114
- const availableWidth = useElementWidth.useElementWidth(internalTableRootRef, distributeWidths);
116
+ const availableWidth = useElementWidth.useElementWidth(
117
+ internalTableRootRef,
118
+ distributeWidths || tableWidth != null
119
+ );
115
120
  const distributedLayout = react.useMemo(
116
121
  () => distributeWidths && availableWidth != null ? columnLayout_utils.distributeColumnWidths({
117
122
  tracks: columnLayout_utils.buildColumnTracks(visibleColumns),
@@ -211,18 +216,24 @@ function Table({
211
216
  ) : null;
212
217
  const tableClassName = table_classes.cx(
213
218
  styles__default.default.tableRoot,
219
+ scrollbarStyles__default.default.region,
214
220
  styles__default.default[variant],
215
221
  styles__default.default[size],
216
222
  (measuringLayout || distributeWidths && !distributedLayout) && styles__default.default.measuringLayout,
217
223
  getRowSeverity && styles__default.default.severityTable
218
224
  );
219
225
  const resolvedTableWidth = tableWidth != null ? tableWidth : distributedLayout == null ? void 0 : distributedLayout.totalWidth;
226
+ const fitsWidth = resolvedTableWidth != null && availableWidth != null && resolvedTableWidth <= availableWidth;
220
227
  const tableElementClassName = table_classes.cx(styles__default.default.tableElement, striped && "dbc-table--striped");
221
228
  const tableShell = /* @__PURE__ */ jsxRuntime.jsx("div", { ...rest, className: tableClassName, children: /* @__PURE__ */ jsxRuntime.jsx(
222
229
  "div",
223
230
  {
224
231
  ref: setTableRootRef,
225
- className: styles__default.default.tableScroll,
232
+ className: table_classes.cx(
233
+ styles__default.default.tableScroll,
234
+ scrollbarStyles__default.default.scrollArea,
235
+ fitsWidth && styles__default.default.tableScrollFits
236
+ ),
226
237
  style: fillViewportActive ? viewportFillStyle : !containScrolling ? { overflow: "visible" } : void 0,
227
238
  children: !loading && !data.length ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.emptyStateSlot, children: /* @__PURE__ */ jsxRuntime.jsx(EmptyState.TableEmptyState, { config: emptyConfig }) }) : /* @__PURE__ */ jsxRuntime.jsxs(
228
239
  "table",
@@ -5,6 +5,7 @@ import { Pagination } from '../../components/pagination/Pagination';
5
5
  import { useViewportFill } from '../../hooks/useViewportFill';
6
6
  import { mergeRefs } from '../../utils/refs.utils';
7
7
  import { usesDistributedWidths, distributeColumnWidths, buildColumnTracks } from './columnLayout.utils';
8
+ import scrollbarStyles from '../../styles/HoverScrollbar.module.css';
8
9
  import { TableEmptyState } from './components/empty-state/EmptyState';
9
10
  import { TableHeaderSettings } from './components/table-settings/TableHeaderSettings';
10
11
  import { TableBody } from './components/TableBody';
@@ -105,7 +106,10 @@ function Table({
105
106
  () => tableWidth == null && (usesDistributedWidths(visibleColumns) || showHeader && hasHeaderActions),
106
107
  [tableWidth, visibleColumns, showHeader, hasHeaderActions]
107
108
  );
108
- const availableWidth = useElementWidth(internalTableRootRef, distributeWidths);
109
+ const availableWidth = useElementWidth(
110
+ internalTableRootRef,
111
+ distributeWidths || tableWidth != null
112
+ );
109
113
  const distributedLayout = useMemo(
110
114
  () => distributeWidths && availableWidth != null ? distributeColumnWidths({
111
115
  tracks: buildColumnTracks(visibleColumns),
@@ -205,18 +209,24 @@ function Table({
205
209
  ) : null;
206
210
  const tableClassName = cx(
207
211
  styles.tableRoot,
212
+ scrollbarStyles.region,
208
213
  styles[variant],
209
214
  styles[size],
210
215
  (measuringLayout || distributeWidths && !distributedLayout) && styles.measuringLayout,
211
216
  getRowSeverity && styles.severityTable
212
217
  );
213
218
  const resolvedTableWidth = tableWidth != null ? tableWidth : distributedLayout == null ? void 0 : distributedLayout.totalWidth;
219
+ const fitsWidth = resolvedTableWidth != null && availableWidth != null && resolvedTableWidth <= availableWidth;
214
220
  const tableElementClassName = cx(styles.tableElement, striped && "dbc-table--striped");
215
221
  const tableShell = /* @__PURE__ */ jsx("div", { ...rest, className: tableClassName, children: /* @__PURE__ */ jsx(
216
222
  "div",
217
223
  {
218
224
  ref: setTableRootRef,
219
- className: styles.tableScroll,
225
+ className: cx(
226
+ styles.tableScroll,
227
+ scrollbarStyles.scrollArea,
228
+ fitsWidth && styles.tableScrollFits
229
+ ),
220
230
  style: fillViewportActive ? viewportFillStyle : !containScrolling ? { overflow: "visible" } : void 0,
221
231
  children: !loading && !data.length ? /* @__PURE__ */ jsx("div", { className: styles.emptyStateSlot, children: /* @__PURE__ */ jsx(TableEmptyState, { config: emptyConfig }) }) : /* @__PURE__ */ jsxs(
222
232
  "table",
@@ -110,6 +110,13 @@
110
110
  -webkit-overflow-scrolling: touch;
111
111
  }
112
112
 
113
+ /* The columns fit: a horizontal scrollbar could only come from sub-pixel
114
+ rounding (Safari at page zoom), and showing it would change the measured
115
+ size and trigger another layout pass. */
116
+ .tableScrollFits {
117
+ overflow-x: hidden;
118
+ }
119
+
113
120
  .tableElement {
114
121
  inline-size: 100%;
115
122
  border-collapse: separate;
@@ -0,0 +1,46 @@
1
+ /* Put region on the hover/focus boundary and scrollArea on each native scroller.
2
+ They can share an element. Keep overflow, sizing and gutter policy with callers. */
3
+ .region {
4
+ --hover-scrollbar-thumb: transparent;
5
+ }
6
+
7
+ .region:is(:hover, :focus-within) {
8
+ --hover-scrollbar-thumb: var(--color-border-subtle);
9
+ }
10
+
11
+ .scrollArea {
12
+ /* Use the regular native width where explicit scrollbar sizing is unsupported. */
13
+ scrollbar-width: auto;
14
+ scrollbar-color: var(--hover-scrollbar-thumb, transparent) transparent;
15
+ }
16
+
17
+ /* Non-auto standard values suppress WebKit styling and can leave native
18
+ overlay scrollbars hidden until scrolling starts in Chromium/macOS. */
19
+ @supports selector(::-webkit-scrollbar) {
20
+ .scrollArea {
21
+ scrollbar-width: auto;
22
+ scrollbar-color: auto;
23
+ }
24
+ }
25
+
26
+ .scrollArea::-webkit-scrollbar {
27
+ width: var(--spacing-sm);
28
+ height: var(--spacing-sm);
29
+ }
30
+
31
+ .scrollArea::-webkit-scrollbar-track,
32
+ .scrollArea::-webkit-scrollbar-corner {
33
+ background: transparent;
34
+ }
35
+
36
+ .scrollArea::-webkit-scrollbar-thumb {
37
+ background-color: var(--hover-scrollbar-thumb, transparent);
38
+ background-clip: padding-box;
39
+ /* A 12px track with 3px transparent edges leaves a 6px visible thumb. */
40
+ border: calc(var(--spacing-sm) / 4) solid transparent;
41
+ border-radius: var(--border-radius-md);
42
+ }
43
+
44
+ .scrollArea::-webkit-scrollbar-thumb:hover {
45
+ background-color: var(--color-border-default);
46
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dbcdk/react-components",
3
- "version": "0.0.213",
3
+ "version": "0.0.215",
4
4
  "description": "Reusable React components for DBC projects",
5
5
  "license": "ISC",
6
6
  "author": "",