@hyphen/hyphen-components 9.0.0-beta.0 → 9.0.0-beta.1

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.
@@ -5309,7 +5309,8 @@ var TableRow = ({
5309
5309
  const getCellClassName = (column) => {
5310
5310
  if (column.cellClassName) {
5311
5311
  if (typeof column.cellClassName === "function") {
5312
- return column.cellClassName(column, row, rowIndex);
5312
+ const cellValue = column.dataKey && row ? row[column.dataKey] : void 0;
5313
+ return column.cellClassName(cellValue, row, rowIndex);
5313
5314
  }
5314
5315
  return column.cellClassName;
5315
5316
  }
@@ -5356,6 +5357,7 @@ var TableRow = ({
5356
5357
  var TableBody = ({
5357
5358
  columns,
5358
5359
  rows,
5360
+ rowKey,
5359
5361
  align = "left",
5360
5362
  className = "",
5361
5363
  emptyCellPlaceholder = "",
@@ -5373,6 +5375,13 @@ var TableBody = ({
5373
5375
  },
5374
5376
  className
5375
5377
  );
5378
+ const getRowKey = (row, rowIndex) => {
5379
+ const keyValue = row?.[rowKey];
5380
+ if (typeof keyValue === "string" || typeof keyValue === "number" || typeof keyValue === "bigint") {
5381
+ return `row-key-${String(keyValue)}`;
5382
+ }
5383
+ return `row-index-${rowIndex}`;
5384
+ };
5376
5385
  return /* @__PURE__ */ import_react66.default.createElement("tbody", { className: tableBodyClasses }, rows.map((row, rowIndex) => /* @__PURE__ */ import_react66.default.createElement(
5377
5386
  TableRow,
5378
5387
  {
@@ -5380,7 +5389,7 @@ var TableBody = ({
5380
5389
  row,
5381
5390
  rowIndex,
5382
5391
  align,
5383
- key: rowIndex,
5392
+ key: getRowKey(row, rowIndex),
5384
5393
  emptyCellPlaceholder,
5385
5394
  truncateOverflow,
5386
5395
  isBorderless,