@mirror-physics/fractal-ui 0.2.0-next.60 → 0.2.0-next.61

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/index.cjs CHANGED
@@ -1458,6 +1458,7 @@ function SortableTable({
1458
1458
  pagination,
1459
1459
  highlightRow,
1460
1460
  onRowClick,
1461
+ onRowDoubleClick,
1461
1462
  rowAction
1462
1463
  }) {
1463
1464
  const [internalKey, setInternalKey] = (0, import_react4.useState)(defaultSortKey ?? null);
@@ -1568,6 +1569,7 @@ function SortableTable({
1568
1569
  }) }) }),
1569
1570
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("tbody", { children: visibleRows.map((row, rowIndex) => {
1570
1571
  const highlighted = highlightRow?.(row, rowIndex) ?? false;
1572
+ const interactive = Boolean(onRowClick || onRowDoubleClick);
1571
1573
  const action = rowAction ? {
1572
1574
  label: rowAction.label(row, rowIndex),
1573
1575
  icon: rowAction.icon(row, rowIndex)
@@ -1578,18 +1580,20 @@ function SortableTable({
1578
1580
  className: cn(
1579
1581
  "fractal-sortable-table-row",
1580
1582
  highlighted && "fractal-sortable-table-row--highlighted",
1581
- onRowClick && "fractal-sortable-table-row--interactive"
1583
+ interactive && "fractal-sortable-table-row--interactive"
1582
1584
  ),
1583
1585
  onClick: onRowClick ? () => onRowClick(row, rowIndex) : void 0,
1584
- onKeyDown: onRowClick ? (event) => {
1586
+ onDoubleClick: onRowDoubleClick ? () => onRowDoubleClick(row, rowIndex) : void 0,
1587
+ onKeyDown: interactive ? (event) => {
1585
1588
  if (event.key === "Enter" || event.key === " ") {
1586
1589
  event.preventDefault();
1587
- onRowClick(row, rowIndex);
1590
+ const activateRow = onRowClick ?? onRowDoubleClick;
1591
+ activateRow?.(row, rowIndex);
1588
1592
  }
1589
1593
  } : void 0,
1590
1594
  "aria-label": action?.label,
1591
- role: onRowClick ? "button" : void 0,
1592
- tabIndex: onRowClick ? 0 : void 0,
1595
+ role: interactive ? "button" : void 0,
1596
+ tabIndex: interactive ? 0 : void 0,
1593
1597
  children: columns.map((col, columnIndex) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
1594
1598
  "td",
1595
1599
  {