@dbcdk/react-components 0.0.137 → 0.0.139

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.
@@ -152,8 +152,7 @@ const Input = react.forwardRef(function Input2({
152
152
  }
153
153
  ) : null,
154
154
  endAdornment
155
- ] }),
156
- hasVisibleClear && !hasEndAdornment && onClear ? /* @__PURE__ */ jsxRuntime.jsx(ClearButton.ClearButton, { onClick: onClear, ariaLabel: clearAriaLabel, absolute: true }) : null
155
+ ] })
157
156
  ]
158
157
  }
159
158
  ),
@@ -146,8 +146,7 @@ const Input = forwardRef(function Input2({
146
146
  }
147
147
  ) : null,
148
148
  endAdornment
149
- ] }),
150
- hasVisibleClear && !hasEndAdornment && onClear ? /* @__PURE__ */ jsx(ClearButton, { onClick: onClear, ariaLabel: clearAriaLabel, absolute: true }) : null
149
+ ] })
151
150
  ]
152
151
  }
153
152
  ),
@@ -186,6 +186,7 @@
186
186
  background: var(--table-component-row-bg);
187
187
  overflow: hidden;
188
188
  line-height: 20px;
189
+ height: 40px;
189
190
  }
190
191
 
191
192
  .md .headerCell {
@@ -208,6 +209,19 @@
208
209
  padding-inline: var(--spacing-sm);
209
210
  font-size: var(--font-size-xs);
210
211
  line-height: 20px;
212
+ height: 32px;
213
+ }
214
+
215
+ .sm .contextMenuOverlay {
216
+ inset-block: 0;
217
+ min-block-size: 0;
218
+ block-size: min(100%, 32px);
219
+ }
220
+
221
+ .sm .contextMenuTrigger {
222
+ min-block-size: 0;
223
+ block-size: 100%;
224
+ border-radius: 0;
211
225
  }
212
226
 
213
227
  .cell[data-vertical-align='top'] {
@@ -539,6 +553,15 @@
539
553
  text-overflow: clip;
540
554
  }
541
555
 
556
+ .row:focus-within > .cell:not(.selectionCell) .cellContent,
557
+ .row:focus-within > .cell:not(.selectionCell) .cellValueEllipsis {
558
+ white-space: normal;
559
+ overflow-wrap: break-word;
560
+ word-break: normal;
561
+ overflow: visible;
562
+ text-overflow: clip;
563
+ }
564
+
542
565
  .contextMenuTrigger {
543
566
  color: var(--color-fg-subtle);
544
567
  min-inline-size: 36px;
@@ -548,6 +571,7 @@
548
571
 
549
572
  .contextMenuAnchorCell {
550
573
  overflow: visible;
574
+ z-index: 1;
551
575
  }
552
576
 
553
577
  .contextMenuAnchorCell .cellValueEllipsis,
@@ -557,14 +581,13 @@
557
581
 
558
582
  .contextMenuOverlay {
559
583
  position: absolute;
560
- inset-block-start: 50%;
584
+ inset-block-start: 0;
561
585
  inset-inline-end: 0;
562
- transform: translateY(-50%);
563
586
  display: inline-flex;
564
587
  align-items: center;
565
588
  justify-content: center;
566
589
  min-inline-size: 40px;
567
- min-block-size: 40px;
590
+ block-size: min(100%, 40px);
568
591
  z-index: 3;
569
592
  }
570
593
 
@@ -162,7 +162,14 @@ function TableRow({
162
162
  children: cellValue
163
163
  }
164
164
  ),
165
- hasContextMenu && isLastColumn ? /* @__PURE__ */ jsxRuntime.jsx(RowContextMenu, { rowId, items: contextMenuItems }) : null
165
+ hasContextMenu && isLastColumn ? /* @__PURE__ */ jsxRuntime.jsx(
166
+ RowContextMenu,
167
+ {
168
+ rowId,
169
+ items: contextMenuItems,
170
+ onRowClick: onRowClick ? () => onRowClick(row) : void 0
171
+ }
172
+ ) : null
166
173
  ]
167
174
  }
168
175
  )
@@ -176,7 +183,8 @@ function TableRow({
176
183
  }
177
184
  function RowContextMenu({
178
185
  rowId,
179
- items
186
+ items,
187
+ onRowClick
180
188
  }) {
181
189
  const toggleRef = react.useRef(null);
182
190
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -189,6 +197,11 @@ function RowContextMenu({
189
197
  e.stopPropagation();
190
198
  (_a = toggleRef.current) == null ? void 0 : _a.call(toggleRef, e);
191
199
  },
200
+ onContextMenu: (e) => {
201
+ e.preventDefault();
202
+ e.stopPropagation();
203
+ onRowClick == null ? void 0 : onRowClick();
204
+ },
192
205
  children: /* @__PURE__ */ jsxRuntime.jsx(
193
206
  Popover.Popover,
194
207
  {
@@ -156,7 +156,14 @@ function TableRow({
156
156
  children: cellValue
157
157
  }
158
158
  ),
159
- hasContextMenu && isLastColumn ? /* @__PURE__ */ jsx(RowContextMenu, { rowId, items: contextMenuItems }) : null
159
+ hasContextMenu && isLastColumn ? /* @__PURE__ */ jsx(
160
+ RowContextMenu,
161
+ {
162
+ rowId,
163
+ items: contextMenuItems,
164
+ onRowClick: onRowClick ? () => onRowClick(row) : void 0
165
+ }
166
+ ) : null
160
167
  ]
161
168
  }
162
169
  )
@@ -170,7 +177,8 @@ function TableRow({
170
177
  }
171
178
  function RowContextMenu({
172
179
  rowId,
173
- items
180
+ items,
181
+ onRowClick
174
182
  }) {
175
183
  const toggleRef = useRef(null);
176
184
  return /* @__PURE__ */ jsx(
@@ -183,6 +191,11 @@ function RowContextMenu({
183
191
  e.stopPropagation();
184
192
  (_a = toggleRef.current) == null ? void 0 : _a.call(toggleRef, e);
185
193
  },
194
+ onContextMenu: (e) => {
195
+ e.preventDefault();
196
+ e.stopPropagation();
197
+ onRowClick == null ? void 0 : onRowClick();
198
+ },
186
199
  children: /* @__PURE__ */ jsx(
187
200
  Popover,
188
201
  {
@@ -14,6 +14,7 @@ function useTableRowInteractions({
14
14
  const handleRowClick = react.useCallback(
15
15
  (e) => {
16
16
  var _a, _b;
17
+ if (e.button !== 0) return;
17
18
  const target = e.target;
18
19
  if (((_a = target == null ? void 0 : target.closest) == null ? void 0 : _a.call(target, '[data-selection-control="true"]')) || ((_b = target == null ? void 0 : target.closest) == null ? void 0 : _b.call(target, '[data-row-context-menu="true"]'))) {
19
20
  return;
@@ -12,6 +12,7 @@ function useTableRowInteractions({
12
12
  const handleRowClick = useCallback(
13
13
  (e) => {
14
14
  var _a, _b;
15
+ if (e.button !== 0) return;
15
16
  const target = e.target;
16
17
  if (((_a = target == null ? void 0 : target.closest) == null ? void 0 : _a.call(target, '[data-selection-control="true"]')) || ((_b = target == null ? void 0 : target.closest) == null ? void 0 : _b.call(target, '[data-row-context-menu="true"]'))) {
17
18
  return;
package/dist/index.d.ts CHANGED
@@ -23,3 +23,4 @@ export * from './components/forms/input-container/InputContainer';
23
23
  export * from './components/divider/Divider';
24
24
  export * from './components/grid/Grid';
25
25
  export * from './components/metric-tile/MetricTile';
26
+ export type { TableContextMenuItem } from './components/table/Table.types';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dbcdk/react-components",
3
- "version": "0.0.137",
3
+ "version": "0.0.139",
4
4
  "description": "Reusable React components for DBC projects",
5
5
  "license": "ISC",
6
6
  "author": "",