@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.
- package/dist/css/utilities.css +1 -1
- package/dist/css/utilities.css.map +1 -1
- package/dist/hyphen-components.cjs.development.js +11 -2
- package/dist/hyphen-components.cjs.development.js.map +1 -1
- package/dist/hyphen-components.cjs.production.min.js +2 -2
- package/dist/hyphen-components.cjs.production.min.js.map +1 -1
- package/dist/hyphen-components.esm.js +11 -2
- package/dist/hyphen-components.esm.js.map +1 -1
- package/dist/index.d.ts +10 -10
- package/package.json +2 -2
- package/src/components/Table/Table.mdx +20 -0
- package/src/components/Table/Table.tsx +7 -7
- package/src/components/Table/TableBody/TableBody.test.tsx +89 -1
- package/src/components/Table/TableBody/TableBody.tsx +23 -8
- package/src/components/Table/TableHead/TableHead.tsx +6 -6
- package/src/components/Table/TableHead/TableHeaderCell/TableHeaderCell.tsx +6 -6
- package/src/components/Table/common/TableRow/TableRow.test.tsx +1 -1
- package/src/components/Table/common/TableRow/TableRow.tsx +11 -9
- package/src/lib/getColumnKeys.ts +5 -3
- package/src/types/index.ts +4 -4
|
@@ -5309,7 +5309,8 @@ var TableRow = ({
|
|
|
5309
5309
|
const getCellClassName = (column) => {
|
|
5310
5310
|
if (column.cellClassName) {
|
|
5311
5311
|
if (typeof column.cellClassName === "function") {
|
|
5312
|
-
|
|
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,
|