react-glide-table 1.1.1 → 1.1.3

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
@@ -18,8 +18,8 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
20
  // src/index.ts
21
- var index_exports = {};
22
- __export(index_exports, {
21
+ var src_exports = {};
22
+ __export(src_exports, {
23
23
  CELL_SELECTION_EDGES_CLASS: () => CELL_SELECTION_EDGES_CLASS,
24
24
  DEFAULT_DATA_TABLE_LABELS: () => DEFAULT_DATA_TABLE_LABELS,
25
25
  DEFAULT_TREE_CHILDREN_FIELD: () => DEFAULT_TREE_CHILDREN_FIELD,
@@ -53,7 +53,7 @@ __export(index_exports, {
53
53
  useConvertTreeData: () => useConvertTreeData,
54
54
  useGlideTable: () => useGlideTable
55
55
  });
56
- module.exports = __toCommonJS(index_exports);
56
+ module.exports = __toCommonJS(src_exports);
57
57
 
58
58
  // src/core/labels.ts
59
59
  var DEFAULT_DATA_TABLE_LABELS = {
@@ -1178,6 +1178,7 @@ function useGlideTable(options) {
1178
1178
 
1179
1179
  // src/components/ui/table/components/DataTable/DataTable.tsx
1180
1180
  var import_react_table3 = require("@tanstack/react-table");
1181
+ var import_react7 = require("react");
1181
1182
 
1182
1183
  // src/components/ui/table/components/DataTable/DataTableRow.tsx
1183
1184
  var import_react_table2 = require("@tanstack/react-table");
@@ -1368,7 +1369,7 @@ function DataTableRow({
1368
1369
  virtualIndex,
1369
1370
  measureElement
1370
1371
  }) {
1371
- const { rowSpan, selection, cellSelection, cellEdit, expand } = useDataTableRowContext();
1372
+ const { classNames, rowSpan, selection, cellSelection, cellEdit, expand } = useDataTableRowContext();
1372
1373
  const {
1373
1374
  enableRowSpan,
1374
1375
  primaryRowSpanKey,
@@ -1446,12 +1447,17 @@ function DataTableRow({
1446
1447
  {
1447
1448
  ref: measureElement,
1448
1449
  "data-index": virtualIndex,
1450
+ "data-selected": isRowSelected ? "" : void 0,
1451
+ "data-hovered": isRowHovered || isGroupHovered ? "" : void 0,
1452
+ "data-expandable": enableExpand && canExpand ? "" : void 0,
1453
+ "data-expanded": isExpanded ? "" : void 0,
1449
1454
  className: cn(
1450
1455
  "DataTableRowJSX",
1451
1456
  !enableRowSpan && ROW_HOVER_CLASS,
1452
1457
  enableRowSpan && isRowHovered && !isRowSelected && ROW_HOVERED_BG_CLASS,
1453
1458
  isRowSelected && "is-selected",
1454
1459
  enableExpand && canExpand && "is-expandable",
1460
+ classNames?.row,
1455
1461
  getRowClassName?.(rowData, rowIndex)
1456
1462
  ),
1457
1463
  onMouseEnter: () => onRowHover(rowIndex, rowData),
@@ -1502,10 +1508,19 @@ function DataTableRow({
1502
1508
  isVisuallySelectedAt
1503
1509
  );
1504
1510
  const resolveCellRowIndex = (clientY, element) => getRowIndexInMergedCell(clientY, element, rowIndex, cellRowSpan);
1511
+ const hasSelectionEdges = hasCellSelectionEdges(selectionEdgeStyle);
1505
1512
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1506
1513
  "td",
1507
1514
  {
1508
1515
  rowSpan: rowSpanInfo && rowSpanInfo.rowSpan > 1 ? rowSpanInfo.rowSpan : void 0,
1516
+ "data-merged": isMerged && cellIndex > 0 ? "" : void 0,
1517
+ "data-merged-edge-right": showMergedRightEdge ? "" : void 0,
1518
+ "data-group-selected": enableRowSpan && showCellSelected ? "" : void 0,
1519
+ "data-group-hovered": enableRowSpan && showCellHover && !showCellSelected ? "" : void 0,
1520
+ "data-selection-fill": isCellDragSelected ? "" : void 0,
1521
+ "data-selection-edges": hasSelectionEdges ? "" : void 0,
1522
+ "data-editable": editable ? "" : void 0,
1523
+ "data-editing": isEditing ? "" : void 0,
1509
1524
  onMouseDown: (event) => {
1510
1525
  if (isEditing) {
1511
1526
  event.stopPropagation();
@@ -1549,8 +1564,9 @@ function DataTableRow({
1549
1564
  enableRowSpan && showCellSelected && "is-group-selected",
1550
1565
  enableRowSpan && showCellHover && !showCellSelected && "is-group-hovered",
1551
1566
  isCellDragSelected && CELL_SELECTION_FILL_CLASS,
1552
- hasCellSelectionEdges(selectionEdgeStyle) && CELL_SELECTION_EDGES_CLASS,
1553
- editable && "is-editable"
1567
+ hasSelectionEdges && CELL_SELECTION_EDGES_CLASS,
1568
+ editable && "is-editable",
1569
+ classNames?.cell
1554
1570
  ),
1555
1571
  children: [
1556
1572
  isEditing ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
@@ -1559,7 +1575,11 @@ function DataTableRow({
1559
1575
  ref: editInputRef,
1560
1576
  type: editType === "number" ? "number" : "text",
1561
1577
  defaultValue: draftValue,
1562
- className: cn("cell-edit-input", CELL_ALIGN_CLASS[align]),
1578
+ className: cn(
1579
+ "cell-edit-input",
1580
+ CELL_ALIGN_CLASS[align],
1581
+ classNames?.cellEditInput
1582
+ ),
1563
1583
  onChange: (event) => onDraftValueChange(event.target.value),
1564
1584
  onMouseDown: (event) => event.stopPropagation(),
1565
1585
  onClick: (event) => event.stopPropagation(),
@@ -1577,23 +1597,69 @@ function DataTableRow({
1577
1597
  onCommitEdit(event.currentTarget.value);
1578
1598
  }
1579
1599
  }
1580
- ) : isExpandCell && enableExpand ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "expand-cell", children: [
1581
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "expand-cell-content", children: [
1582
- rowLevel > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "expand-cell-indent", children: "\xB7" }),
1583
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "expand-cell-value", children: (0, import_react_table2.flexRender)(cell.column.columnDef.cell, cell.getContext()) })
1584
- ] }),
1600
+ ) : isExpandCell && enableExpand ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: cn("expand-cell", classNames?.expandCell), children: [
1601
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1602
+ "div",
1603
+ {
1604
+ className: cn(
1605
+ "expand-cell-content",
1606
+ classNames?.expandCellContent
1607
+ ),
1608
+ children: [
1609
+ rowLevel > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1610
+ "span",
1611
+ {
1612
+ className: cn(
1613
+ "expand-cell-indent",
1614
+ classNames?.expandCellIndent
1615
+ ),
1616
+ children: "\xB7"
1617
+ }
1618
+ ),
1619
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1620
+ "div",
1621
+ {
1622
+ className: cn(
1623
+ "expand-cell-value",
1624
+ classNames?.expandCellValue
1625
+ ),
1626
+ children: (0, import_react_table2.flexRender)(cell.column.columnDef.cell, cell.getContext())
1627
+ }
1628
+ )
1629
+ ]
1630
+ }
1631
+ ),
1585
1632
  canExpand && expandKey && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1586
1633
  "button",
1587
1634
  {
1588
1635
  type: "button",
1589
1636
  "aria-label": isExpanded ? collapseRowLabel : expandRowLabel,
1590
- className: "expand-toggle-button",
1637
+ className: cn(
1638
+ "expand-toggle-button",
1639
+ classNames?.expandToggle
1640
+ ),
1591
1641
  onClick: (event) => {
1592
1642
  event.stopPropagation();
1593
1643
  onToggleExpand?.(expandKey);
1594
1644
  },
1595
1645
  onMouseDown: (event) => event.stopPropagation(),
1596
- children: isExpanded ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChevronUp, { className: "expand-toggle-icon" }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChevronDown, { className: "expand-toggle-icon" })
1646
+ children: isExpanded ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1647
+ ChevronUp,
1648
+ {
1649
+ className: cn(
1650
+ "expand-toggle-icon",
1651
+ classNames?.expandToggleIcon
1652
+ )
1653
+ }
1654
+ ) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1655
+ ChevronDown,
1656
+ {
1657
+ className: cn(
1658
+ "expand-toggle-icon",
1659
+ classNames?.expandToggleIcon
1660
+ )
1661
+ }
1662
+ )
1597
1663
  }
1598
1664
  )
1599
1665
  ] }) : (0, import_react_table2.flexRender)(cell.column.columnDef.cell, cell.getContext()),
@@ -1601,7 +1667,7 @@ function DataTableRow({
1601
1667
  "div",
1602
1668
  {
1603
1669
  role: "presentation",
1604
- className: "fill-handle",
1670
+ className: cn("fill-handle", classNames?.fillHandle),
1605
1671
  onMouseDown: (event) => {
1606
1672
  event.stopPropagation();
1607
1673
  event.preventDefault();
@@ -1627,7 +1693,8 @@ function DataTableToolbar({
1627
1693
  selectedCount,
1628
1694
  selectionLabel,
1629
1695
  toolbar,
1630
- className
1696
+ className,
1697
+ classNames
1631
1698
  }) {
1632
1699
  const displayFiltered = filteredCount ?? totalCount;
1633
1700
  const hasCount = displayFiltered !== void 0 || totalCount !== void 0;
@@ -1636,9 +1703,9 @@ function DataTableToolbar({
1636
1703
  const selectionContent = selectionLabel?.(selectedCount) ?? null;
1637
1704
  const hasSelectionContent = selectionContent !== null && selectionContent !== false && selectionContent !== void 0 && typeof selectionContent !== "boolean";
1638
1705
  if (!hasLeftContent && !hasToolbar && !hasSelectionContent) return null;
1639
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: cn("DataTableToolbarJSX", className), children: [
1640
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "toolbar-left", children: [
1641
- hasCount && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "toolbar-count", children: displayFiltered !== void 0 && totalCount !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
1706
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: cn("DataTableToolbarJSX", classNames?.toolbar, className), children: [
1707
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: cn("toolbar-left", classNames?.toolbarLeft), children: [
1708
+ hasCount && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: cn("toolbar-count", classNames?.toolbarCount), children: displayFiltered !== void 0 && totalCount !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
1642
1709
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "toolbar-count-primary", children: displayFiltered }),
1643
1710
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "toolbar-count-placeholder", children: [
1644
1711
  " / ",
@@ -1647,9 +1714,9 @@ function DataTableToolbar({
1647
1714
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "toolbar-count-primary", children: displayFiltered ?? totalCount }) }),
1648
1715
  summary
1649
1716
  ] }),
1650
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "toolbar-right", children: [
1651
- hasSelectionContent && (typeof selectionContent === "string" || typeof selectionContent === "number" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "toolbar-selection", children: selectionContent }) : selectionContent),
1652
- hasToolbar && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "toolbar-actions", children: toolbar })
1717
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: cn("toolbar-right", classNames?.toolbarRight), children: [
1718
+ hasSelectionContent && (typeof selectionContent === "string" || typeof selectionContent === "number" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: cn("toolbar-selection", classNames?.toolbarSelection), children: selectionContent }) : selectionContent),
1719
+ hasToolbar && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: cn("toolbar-actions", classNames?.toolbarActions), children: toolbar })
1653
1720
  ] })
1654
1721
  ] });
1655
1722
  }
@@ -1658,15 +1725,36 @@ function DataTableToolbar({
1658
1725
  var import_jsx_runtime5 = require("react/jsx-runtime");
1659
1726
  function DefaultPending({
1660
1727
  loadingText,
1661
- className
1728
+ className,
1729
+ classNames
1662
1730
  }) {
1663
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: cn("DataTableJSX", "DataTableJSX--pending", className), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "data-table-loading-text", children: loadingText }) });
1731
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1732
+ "div",
1733
+ {
1734
+ className: cn(
1735
+ "DataTableJSX",
1736
+ "DataTableJSX--pending",
1737
+ classNames?.root,
1738
+ classNames?.pending,
1739
+ className
1740
+ ),
1741
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: cn("data-table-loading-text", classNames?.loadingText), children: loadingText })
1742
+ }
1743
+ );
1664
1744
  }
1665
1745
  function DefaultEmpty({
1666
1746
  emptyText,
1667
- columnCount
1747
+ columnCount,
1748
+ classNames
1668
1749
  }) {
1669
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("td", { colSpan: columnCount, className: "data-table-empty-cell", children: emptyText }) });
1750
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1751
+ "td",
1752
+ {
1753
+ colSpan: columnCount,
1754
+ className: cn("data-table-empty-cell", classNames?.emptyCell),
1755
+ children: emptyText
1756
+ }
1757
+ ) });
1670
1758
  }
1671
1759
  function DataTable({
1672
1760
  isPending = false,
@@ -1675,6 +1763,7 @@ function DataTable({
1675
1763
  filteredCount,
1676
1764
  totalCount,
1677
1765
  className,
1766
+ classNames,
1678
1767
  slots,
1679
1768
  ...glideOptions
1680
1769
  }) {
@@ -1702,8 +1791,19 @@ function DataTable({
1702
1791
  const RowSlot = slots?.Row ?? DataTableRow;
1703
1792
  const PendingSlot = slots?.Pending ?? DefaultPending;
1704
1793
  const EmptySlot = slots?.Empty ?? DefaultEmpty;
1794
+ const contextValue = (0, import_react7.useMemo)(
1795
+ () => ({ ...rowContextValue, classNames }),
1796
+ [rowContextValue, classNames]
1797
+ );
1705
1798
  if (isPending) {
1706
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(PendingSlot, { loadingText, className });
1799
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1800
+ PendingSlot,
1801
+ {
1802
+ loadingText,
1803
+ className,
1804
+ classNames
1805
+ }
1806
+ );
1707
1807
  }
1708
1808
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1709
1809
  "div",
@@ -1711,6 +1811,7 @@ function DataTable({
1711
1811
  className: cn(
1712
1812
  "DataTableJSX",
1713
1813
  !enableCellSelection && "DataTableJSX--no-cell-selection",
1814
+ classNames?.root,
1714
1815
  className
1715
1816
  ),
1716
1817
  children: [
@@ -1722,71 +1823,120 @@ function DataTable({
1722
1823
  summary,
1723
1824
  selectedCount,
1724
1825
  selectionLabel,
1725
- toolbar
1826
+ toolbar,
1827
+ classNames
1726
1828
  }
1727
1829
  ),
1728
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { ref: scrollRef, className: "data-table-scroll", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1830
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { ref: scrollRef, className: cn("data-table-scroll", classNames?.scroll), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1729
1831
  "table",
1730
1832
  {
1731
- className: "data-table",
1833
+ className: cn("data-table", classNames?.table),
1732
1834
  onDragStart: enableCellSelection ? (event) => event.preventDefault() : void 0,
1733
1835
  children: [
1734
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("thead", { className: "data-table-head", children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("tr", { className: "data-table-head-row", children: headerGroup.headers.map((header) => {
1735
- const align = header.column.columnDef.meta?.align ?? "center";
1736
- const headerClassName = header.column.columnDef.meta?.headerClassName;
1737
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1738
- "th",
1739
- {
1740
- style: { width: header.getSize() !== 150 ? header.getSize() : void 0 },
1741
- className: cn(
1742
- "data-table-head-cell",
1743
- CELL_ALIGN_CLASS[align],
1744
- headerClassName
1836
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("thead", { className: cn("data-table-head", classNames?.head), children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1837
+ "tr",
1838
+ {
1839
+ className: cn("data-table-head-row", classNames?.headRow),
1840
+ children: headerGroup.headers.map((header) => {
1841
+ const align = header.column.columnDef.meta?.align ?? "center";
1842
+ const headerClassName = header.column.columnDef.meta?.headerClassName;
1843
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1844
+ "th",
1845
+ {
1846
+ style: { width: header.getSize() !== 150 ? header.getSize() : void 0 },
1847
+ className: cn(
1848
+ "data-table-head-cell",
1849
+ CELL_ALIGN_CLASS[align],
1850
+ classNames?.headCell,
1851
+ headerClassName
1852
+ ),
1853
+ children: header.isPlaceholder ? null : (0, import_react_table3.flexRender)(header.column.columnDef.header, header.getContext())
1854
+ },
1855
+ header.id
1856
+ );
1857
+ })
1858
+ },
1859
+ headerGroup.id
1860
+ )) }),
1861
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(DataTableContextProvider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1862
+ "tbody",
1863
+ {
1864
+ onMouseLeave: clearHover,
1865
+ className: cn("data-table-body", classNames?.body),
1866
+ children: rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1867
+ EmptySlot,
1868
+ {
1869
+ emptyText,
1870
+ columnCount,
1871
+ classNames
1872
+ }
1873
+ ) : shouldVirtualize ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
1874
+ paddingTop > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1875
+ "tr",
1876
+ {
1877
+ "aria-hidden": true,
1878
+ className: cn(
1879
+ "data-table-virtual-spacer",
1880
+ classNames?.virtualSpacer
1881
+ ),
1882
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1883
+ "td",
1884
+ {
1885
+ colSpan: columnCount,
1886
+ style: { height: paddingTop },
1887
+ className: cn(
1888
+ "data-table-virtual-spacer-cell",
1889
+ classNames?.virtualSpacerCell
1890
+ )
1891
+ }
1892
+ )
1893
+ }
1745
1894
  ),
1746
- children: header.isPlaceholder ? null : (0, import_react_table3.flexRender)(header.column.columnDef.header, header.getContext())
1747
- },
1748
- header.id
1749
- );
1750
- }) }, headerGroup.id)) }),
1751
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(DataTableContextProvider, { value: rowContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("tbody", { onMouseLeave: clearHover, className: "data-table-body", children: rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(EmptySlot, { emptyText, columnCount }) : shouldVirtualize ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
1752
- paddingTop > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("tr", { "aria-hidden": true, className: "data-table-virtual-spacer", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1753
- "td",
1754
- {
1755
- colSpan: columnCount,
1756
- style: { height: paddingTop },
1757
- className: "data-table-virtual-spacer-cell"
1758
- }
1759
- ) }),
1760
- virtualRows.map((virtualRow) => {
1761
- const row = rows[virtualRow.index];
1762
- if (!row) return null;
1763
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1895
+ virtualRows.map((virtualRow) => {
1896
+ const row = rows[virtualRow.index];
1897
+ if (!row) return null;
1898
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1899
+ RowSlot,
1900
+ {
1901
+ row,
1902
+ virtualIndex: virtualRow.index,
1903
+ measureElement: rowVirtualizer.measureElement,
1904
+ onToggleSelect: () => handleToggleSelect(row)
1905
+ },
1906
+ row.id
1907
+ );
1908
+ }),
1909
+ paddingBottom > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1910
+ "tr",
1911
+ {
1912
+ "aria-hidden": true,
1913
+ className: cn(
1914
+ "data-table-virtual-spacer",
1915
+ classNames?.virtualSpacer
1916
+ ),
1917
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1918
+ "td",
1919
+ {
1920
+ colSpan: columnCount,
1921
+ style: { height: paddingBottom },
1922
+ className: cn(
1923
+ "data-table-virtual-spacer-cell",
1924
+ classNames?.virtualSpacerCell
1925
+ )
1926
+ }
1927
+ )
1928
+ }
1929
+ )
1930
+ ] }) : rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1764
1931
  RowSlot,
1765
1932
  {
1766
1933
  row,
1767
- virtualIndex: virtualRow.index,
1768
- measureElement: rowVirtualizer.measureElement,
1769
1934
  onToggleSelect: () => handleToggleSelect(row)
1770
1935
  },
1771
1936
  row.id
1772
- );
1773
- }),
1774
- paddingBottom > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("tr", { "aria-hidden": true, className: "data-table-virtual-spacer", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1775
- "td",
1776
- {
1777
- colSpan: columnCount,
1778
- style: { height: paddingBottom },
1779
- className: "data-table-virtual-spacer-cell"
1780
- }
1781
- ) })
1782
- ] }) : rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1783
- RowSlot,
1784
- {
1785
- row,
1786
- onToggleSelect: () => handleToggleSelect(row)
1787
- },
1788
- row.id
1789
- )) }) })
1937
+ ))
1938
+ }
1939
+ ) })
1790
1940
  ]
1791
1941
  }
1792
1942
  ) })
@@ -1796,7 +1946,7 @@ function DataTable({
1796
1946
  }
1797
1947
 
1798
1948
  // src/components/ui/table/components/Table/Table.tsx
1799
- var import_react9 = require("react");
1949
+ var import_react10 = require("react");
1800
1950
 
1801
1951
  // src/components/ui/table/components/Table/buildColumnDef.tsx
1802
1952
  var import_jsx_runtime6 = require("react/jsx-runtime");
@@ -1866,10 +2016,10 @@ function buildColumnDef(props, sort, onSort) {
1866
2016
  }
1867
2017
 
1868
2018
  // src/components/ui/table/components/Table/parseTableChildren.ts
1869
- var import_react8 = require("react");
2019
+ var import_react9 = require("react");
1870
2020
 
1871
2021
  // src/components/ui/table/components/Table/tableChildTypes.ts
1872
- var import_react7 = require("react");
2022
+ var import_react8 = require("react");
1873
2023
  var TABLE_HEADER_DISPLAY_NAME = "Table.Header";
1874
2024
  var TABLE_BODY_DISPLAY_NAME = "Table.Body";
1875
2025
  var TABLE_COLUMN_DISPLAY_NAME = "Table.Column";
@@ -1881,16 +2031,16 @@ function getComponentDisplayName(type) {
1881
2031
  return void 0;
1882
2032
  }
1883
2033
  function isTableHeaderElement(child) {
1884
- return (0, import_react7.isValidElement)(child) && getComponentDisplayName(child.type) === TABLE_HEADER_DISPLAY_NAME;
2034
+ return (0, import_react8.isValidElement)(child) && getComponentDisplayName(child.type) === TABLE_HEADER_DISPLAY_NAME;
1885
2035
  }
1886
2036
  function isTableBodyElement(child) {
1887
- return (0, import_react7.isValidElement)(child) && getComponentDisplayName(child.type) === TABLE_BODY_DISPLAY_NAME;
2037
+ return (0, import_react8.isValidElement)(child) && getComponentDisplayName(child.type) === TABLE_BODY_DISPLAY_NAME;
1888
2038
  }
1889
2039
  function isTableColumnElement(child) {
1890
- return (0, import_react7.isValidElement)(child) && getComponentDisplayName(child.type) === TABLE_COLUMN_DISPLAY_NAME;
2040
+ return (0, import_react8.isValidElement)(child) && getComponentDisplayName(child.type) === TABLE_COLUMN_DISPLAY_NAME;
1891
2041
  }
1892
2042
  function isTablePaginationElement(child) {
1893
- return (0, import_react7.isValidElement)(child) && getComponentDisplayName(child.type) === TABLE_PAGINATION_DISPLAY_NAME;
2043
+ return (0, import_react8.isValidElement)(child) && getComponentDisplayName(child.type) === TABLE_PAGINATION_DISPLAY_NAME;
1894
2044
  }
1895
2045
 
1896
2046
  // src/components/ui/table/components/Table/parseTableChildren.ts
@@ -1900,7 +2050,7 @@ function parseTableChildren(children) {
1900
2050
  body: null,
1901
2051
  pagination: null
1902
2052
  };
1903
- for (const child of import_react8.Children.toArray(children)) {
2053
+ for (const child of import_react9.Children.toArray(children)) {
1904
2054
  if (isTableHeaderElement(child)) {
1905
2055
  slots.header = child;
1906
2056
  continue;
@@ -1918,7 +2068,7 @@ function parseTableChildren(children) {
1918
2068
  function extractColumnElements(header) {
1919
2069
  if (!header) return [];
1920
2070
  const { children } = header.props;
1921
- return import_react8.Children.toArray(children).filter(isTableColumnElement);
2071
+ return import_react9.Children.toArray(children).filter(isTableColumnElement);
1922
2072
  }
1923
2073
 
1924
2074
  // src/components/ui/table/components/Table/TableBody.tsx
@@ -2025,12 +2175,12 @@ function TableRoot({
2025
2175
  filteredCount,
2026
2176
  ...dataTableProps
2027
2177
  }) {
2028
- const { header, pagination: paginationElement } = (0, import_react9.useMemo)(
2178
+ const { header, pagination: paginationElement } = (0, import_react10.useMemo)(
2029
2179
  () => parseTableChildren(children),
2030
2180
  [children]
2031
2181
  );
2032
- const [sort, setSort] = (0, import_react9.useState)(null);
2033
- const handleSort = (0, import_react9.useCallback)((field) => {
2182
+ const [sort, setSort] = (0, import_react10.useState)(null);
2183
+ const handleSort = (0, import_react10.useCallback)((field) => {
2034
2184
  setSort((previous) => {
2035
2185
  if (previous?.field !== field) {
2036
2186
  return { field, direction: "asc" };
@@ -2041,7 +2191,7 @@ function TableRoot({
2041
2191
  return null;
2042
2192
  });
2043
2193
  }, []);
2044
- const columns = (0, import_react9.useMemo)(() => {
2194
+ const columns = (0, import_react10.useMemo)(() => {
2045
2195
  return extractColumnElements(header).map(
2046
2196
  (columnElement) => buildColumnDef(columnElement.props, sort, handleSort)
2047
2197
  );
@@ -2050,7 +2200,7 @@ function TableRoot({
2050
2200
  const pageSize = paginationProps?.pageSize ?? 10;
2051
2201
  const page = paginationProps?.page ?? 1;
2052
2202
  const resolvedTotalCount = paginationProps?.totalCount ?? totalCount ?? data.length;
2053
- const tableData = (0, import_react9.useMemo)(() => {
2203
+ const tableData = (0, import_react10.useMemo)(() => {
2054
2204
  const sortedData = sortTableData(data, sort);
2055
2205
  if (!paginationProps) return sortedData;
2056
2206
  return paginateTableData(sortedData, page, pageSize);