@dbcdk/react-components 0.0.214 → 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
+ }
@@ -113,7 +113,10 @@ function Table({
113
113
  () => tableWidth == null && (columnLayout_utils.usesDistributedWidths(visibleColumns) || showHeader && hasHeaderActions),
114
114
  [tableWidth, visibleColumns, showHeader, hasHeaderActions]
115
115
  );
116
- const availableWidth = useElementWidth.useElementWidth(internalTableRootRef, distributeWidths);
116
+ const availableWidth = useElementWidth.useElementWidth(
117
+ internalTableRootRef,
118
+ distributeWidths || tableWidth != null
119
+ );
117
120
  const distributedLayout = react.useMemo(
118
121
  () => distributeWidths && availableWidth != null ? columnLayout_utils.distributeColumnWidths({
119
122
  tracks: columnLayout_utils.buildColumnTracks(visibleColumns),
@@ -220,12 +223,17 @@ function Table({
220
223
  getRowSeverity && styles__default.default.severityTable
221
224
  );
222
225
  const resolvedTableWidth = tableWidth != null ? tableWidth : distributedLayout == null ? void 0 : distributedLayout.totalWidth;
226
+ const fitsWidth = resolvedTableWidth != null && availableWidth != null && resolvedTableWidth <= availableWidth;
223
227
  const tableElementClassName = table_classes.cx(styles__default.default.tableElement, striped && "dbc-table--striped");
224
228
  const tableShell = /* @__PURE__ */ jsxRuntime.jsx("div", { ...rest, className: tableClassName, children: /* @__PURE__ */ jsxRuntime.jsx(
225
229
  "div",
226
230
  {
227
231
  ref: setTableRootRef,
228
- className: table_classes.cx(styles__default.default.tableScroll, scrollbarStyles__default.default.scrollArea),
232
+ className: table_classes.cx(
233
+ styles__default.default.tableScroll,
234
+ scrollbarStyles__default.default.scrollArea,
235
+ fitsWidth && styles__default.default.tableScrollFits
236
+ ),
229
237
  style: fillViewportActive ? viewportFillStyle : !containScrolling ? { overflow: "visible" } : void 0,
230
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(
231
239
  "table",
@@ -106,7 +106,10 @@ function Table({
106
106
  () => tableWidth == null && (usesDistributedWidths(visibleColumns) || showHeader && hasHeaderActions),
107
107
  [tableWidth, visibleColumns, showHeader, hasHeaderActions]
108
108
  );
109
- const availableWidth = useElementWidth(internalTableRootRef, distributeWidths);
109
+ const availableWidth = useElementWidth(
110
+ internalTableRootRef,
111
+ distributeWidths || tableWidth != null
112
+ );
110
113
  const distributedLayout = useMemo(
111
114
  () => distributeWidths && availableWidth != null ? distributeColumnWidths({
112
115
  tracks: buildColumnTracks(visibleColumns),
@@ -213,12 +216,17 @@ function Table({
213
216
  getRowSeverity && styles.severityTable
214
217
  );
215
218
  const resolvedTableWidth = tableWidth != null ? tableWidth : distributedLayout == null ? void 0 : distributedLayout.totalWidth;
219
+ const fitsWidth = resolvedTableWidth != null && availableWidth != null && resolvedTableWidth <= availableWidth;
216
220
  const tableElementClassName = cx(styles.tableElement, striped && "dbc-table--striped");
217
221
  const tableShell = /* @__PURE__ */ jsx("div", { ...rest, className: tableClassName, children: /* @__PURE__ */ jsx(
218
222
  "div",
219
223
  {
220
224
  ref: setTableRootRef,
221
- className: cx(styles.tableScroll, scrollbarStyles.scrollArea),
225
+ className: cx(
226
+ styles.tableScroll,
227
+ scrollbarStyles.scrollArea,
228
+ fitsWidth && styles.tableScrollFits
229
+ ),
222
230
  style: fillViewportActive ? viewportFillStyle : !containScrolling ? { overflow: "visible" } : void 0,
223
231
  children: !loading && !data.length ? /* @__PURE__ */ jsx("div", { className: styles.emptyStateSlot, children: /* @__PURE__ */ jsx(TableEmptyState, { config: emptyConfig }) }) : /* @__PURE__ */ jsxs(
224
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dbcdk/react-components",
3
- "version": "0.0.214",
3
+ "version": "0.0.215",
4
4
  "description": "Reusable React components for DBC projects",
5
5
  "license": "ISC",
6
6
  "author": "",