@trackunit/react-table 2.13.4 → 2.14.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/index.cjs.js CHANGED
@@ -1543,17 +1543,18 @@ const Table = ({ rowHeight = 50, loading = false, hideFooter = false, style, ref
1543
1543
  return null;
1544
1544
  }
1545
1545
  else {
1546
+ const isRowInteractive = (!!props.onRowClick || row.getCanSelect()) &&
1547
+ (props.isRowClickable ? props.isRowClickable(row.original) : true);
1546
1548
  return (jsxRuntime.jsx(reactTableBaseComponents.Tr, { className: tailwindMerge.twMerge(
1547
1549
  // `absolute left-0 top-0 w-full` anchors the row so the
1548
1550
  // virtualizer can position it via a transform (directDomUpdates).
1549
- "row-focus group absolute left-0 top-0 w-full", reactComponents.cvaInteractableItem({
1550
- cursor: (!!props.onRowClick || row.getCanSelect()) &&
1551
- (props.isRowClickable ? props.isRowClickable(row.original) : true)
1552
- ? "pointer"
1553
- : "default",
1554
- selection: row.getIsSelected() ? "selected" : "auto",
1555
- focus: "unfocused",
1556
- })), "data-index": virtualRow.index, "data-testid": `table-body-row-${virtualRow.index}`, layout: "flex", onClick: () => {
1551
+ "row-focus group absolute left-0 top-0 w-full", isRowInteractive || row.getIsSelected()
1552
+ ? reactComponents.cvaInteractableItem({
1553
+ cursor: isRowInteractive ? "pointer" : "default",
1554
+ selection: row.getIsSelected() ? "selected" : "auto",
1555
+ focus: "unfocused",
1556
+ })
1557
+ : "cursor-default"), "data-index": virtualRow.index, "data-testid": `table-body-row-${virtualRow.index}`, layout: "flex", onClick: () => {
1557
1558
  if (props.onRowClick) {
1558
1559
  props.onRowClick(row);
1559
1560
  }
@@ -1586,6 +1587,7 @@ const Table = ({ rowHeight = 50, loading = false, hideFooter = false, style, ref
1586
1587
  isColumnDragging: draggingColumnId === cell.column.id,
1587
1588
  isColumnDropped: droppedColumnId === cell.column.id,
1588
1589
  selected: row.getIsSelected(),
1590
+ hoverable: isRowInteractive,
1589
1591
  }), "data-pinned": pinned, "data-selection-cell": props.selectionColId && cell.column.id === props.selectionColId ? "true" : undefined, key: cell.id, onClick: event => {
1590
1592
  // prevent onRowClick action when clicking on a "selectable" cell with checkbox
1591
1593
  if (props.selectionColId && cell.column.id === props.selectionColId) {
@@ -1656,7 +1658,8 @@ const cvaTh = cssClassVarianceUtilities.cva({
1656
1658
  lastUnpinnedWithoutBorder: false,
1657
1659
  },
1658
1660
  });
1659
- const sharedPinnedStyles = "sticky z-[1] group-has-[:checked]:bg-primary-50 group-hover:has-[:checked]:bg-primary-50 group-focus-within:has-[:checked]:bg-primary-50 bg-white group-hover:bg-neutral-100";
1661
+ const sharedPinnedStyles = "sticky z-[1] group-has-[:checked]:bg-primary-50 group-hover:has-[:checked]:bg-primary-50 group-focus-within:has-[:checked]:bg-primary-50 bg-white";
1662
+ const pinnedHoverClassName = "group-hover:bg-neutral-100";
1660
1663
  const cvaTd = cssClassVarianceUtilities.cva({
1661
1664
  base: ["relative"],
1662
1665
  variants: {
@@ -1681,13 +1684,22 @@ const cvaTd = cssClassVarianceUtilities.cva({
1681
1684
  true: "bg-primary-50 group-hover:bg-primary-100 group-focus-within:bg-primary-50",
1682
1685
  false: "",
1683
1686
  },
1687
+ hoverable: {
1688
+ true: "",
1689
+ false: "",
1690
+ },
1684
1691
  },
1692
+ compoundVariants: [
1693
+ { pinned: "left", hoverable: true, className: pinnedHoverClassName },
1694
+ { pinned: "right", hoverable: true, className: pinnedHoverClassName },
1695
+ ],
1685
1696
  defaultVariants: {
1686
1697
  pinned: false,
1687
1698
  isColumnDragging: false,
1688
1699
  isColumnDropped: false,
1689
1700
  lastUnpinnedWithoutBorder: false,
1690
1701
  selected: false,
1702
+ hoverable: true,
1691
1703
  },
1692
1704
  });
1693
1705
 
package/index.esm.js CHANGED
@@ -1542,17 +1542,18 @@ const Table = ({ rowHeight = 50, loading = false, hideFooter = false, style, ref
1542
1542
  return null;
1543
1543
  }
1544
1544
  else {
1545
+ const isRowInteractive = (!!props.onRowClick || row.getCanSelect()) &&
1546
+ (props.isRowClickable ? props.isRowClickable(row.original) : true);
1545
1547
  return (jsx(Tr, { className: twMerge(
1546
1548
  // `absolute left-0 top-0 w-full` anchors the row so the
1547
1549
  // virtualizer can position it via a transform (directDomUpdates).
1548
- "row-focus group absolute left-0 top-0 w-full", cvaInteractableItem({
1549
- cursor: (!!props.onRowClick || row.getCanSelect()) &&
1550
- (props.isRowClickable ? props.isRowClickable(row.original) : true)
1551
- ? "pointer"
1552
- : "default",
1553
- selection: row.getIsSelected() ? "selected" : "auto",
1554
- focus: "unfocused",
1555
- })), "data-index": virtualRow.index, "data-testid": `table-body-row-${virtualRow.index}`, layout: "flex", onClick: () => {
1550
+ "row-focus group absolute left-0 top-0 w-full", isRowInteractive || row.getIsSelected()
1551
+ ? cvaInteractableItem({
1552
+ cursor: isRowInteractive ? "pointer" : "default",
1553
+ selection: row.getIsSelected() ? "selected" : "auto",
1554
+ focus: "unfocused",
1555
+ })
1556
+ : "cursor-default"), "data-index": virtualRow.index, "data-testid": `table-body-row-${virtualRow.index}`, layout: "flex", onClick: () => {
1556
1557
  if (props.onRowClick) {
1557
1558
  props.onRowClick(row);
1558
1559
  }
@@ -1585,6 +1586,7 @@ const Table = ({ rowHeight = 50, loading = false, hideFooter = false, style, ref
1585
1586
  isColumnDragging: draggingColumnId === cell.column.id,
1586
1587
  isColumnDropped: droppedColumnId === cell.column.id,
1587
1588
  selected: row.getIsSelected(),
1589
+ hoverable: isRowInteractive,
1588
1590
  }), "data-pinned": pinned, "data-selection-cell": props.selectionColId && cell.column.id === props.selectionColId ? "true" : undefined, key: cell.id, onClick: event => {
1589
1591
  // prevent onRowClick action when clicking on a "selectable" cell with checkbox
1590
1592
  if (props.selectionColId && cell.column.id === props.selectionColId) {
@@ -1655,7 +1657,8 @@ const cvaTh = cva({
1655
1657
  lastUnpinnedWithoutBorder: false,
1656
1658
  },
1657
1659
  });
1658
- const sharedPinnedStyles = "sticky z-[1] group-has-[:checked]:bg-primary-50 group-hover:has-[:checked]:bg-primary-50 group-focus-within:has-[:checked]:bg-primary-50 bg-white group-hover:bg-neutral-100";
1660
+ const sharedPinnedStyles = "sticky z-[1] group-has-[:checked]:bg-primary-50 group-hover:has-[:checked]:bg-primary-50 group-focus-within:has-[:checked]:bg-primary-50 bg-white";
1661
+ const pinnedHoverClassName = "group-hover:bg-neutral-100";
1659
1662
  const cvaTd = cva({
1660
1663
  base: ["relative"],
1661
1664
  variants: {
@@ -1680,13 +1683,22 @@ const cvaTd = cva({
1680
1683
  true: "bg-primary-50 group-hover:bg-primary-100 group-focus-within:bg-primary-50",
1681
1684
  false: "",
1682
1685
  },
1686
+ hoverable: {
1687
+ true: "",
1688
+ false: "",
1689
+ },
1683
1690
  },
1691
+ compoundVariants: [
1692
+ { pinned: "left", hoverable: true, className: pinnedHoverClassName },
1693
+ { pinned: "right", hoverable: true, className: pinnedHoverClassName },
1694
+ ],
1684
1695
  defaultVariants: {
1685
1696
  pinned: false,
1686
1697
  isColumnDragging: false,
1687
1698
  isColumnDropped: false,
1688
1699
  lastUnpinnedWithoutBorder: false,
1689
1700
  selected: false,
1701
+ hoverable: true,
1690
1702
  },
1691
1703
  });
1692
1704
 
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entry.js","sourceRoot":"","sources":["../../../../../libs/react/table/migrations/entry.ts"],"names":[],"mappings":"","sourcesContent":["export {};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-table",
3
- "version": "2.13.4",
3
+ "version": "2.14.1",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -11,15 +11,15 @@
11
11
  "react-dnd": "16.0.1",
12
12
  "react-dnd-html5-backend": "16.0.1",
13
13
  "tailwind-merge": "^3.7.0",
14
- "@trackunit/react-components": "3.10.3",
15
- "@trackunit/react-core-hooks": "1.27.2",
16
- "@trackunit/shared-utils": "1.21.1",
17
- "@trackunit/css-class-variance-utilities": "2.5.1",
18
- "@trackunit/ui-icons": "1.19.1",
19
- "@trackunit/react-table-base-components": "2.14.4",
20
- "@trackunit/react-form-components": "2.12.4",
21
- "@trackunit/i18n-library-translation": "2.10.2",
22
- "@trackunit/iris-app-runtime-core-api": "1.23.2",
14
+ "@trackunit/react-components": "3.11.1",
15
+ "@trackunit/react-core-hooks": "1.28.1",
16
+ "@trackunit/shared-utils": "1.22.0",
17
+ "@trackunit/css-class-variance-utilities": "2.6.0",
18
+ "@trackunit/ui-icons": "1.20.0",
19
+ "@trackunit/react-table-base-components": "2.15.1",
20
+ "@trackunit/react-form-components": "2.13.1",
21
+ "@trackunit/i18n-library-translation": "2.11.1",
22
+ "@trackunit/iris-app-runtime-core-api": "1.24.0",
23
23
  "zod": "^3.25.76"
24
24
  },
25
25
  "peerDependencies": {