@forgedevstack/grid-table 1.0.2 → 1.0.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.js CHANGED
@@ -55,6 +55,7 @@ __export(index_exports, {
55
55
  useTableContext: () => useTableContext
56
56
  });
57
57
  module.exports = __toCommonJS(index_exports);
58
+ var import_styles = require("@forgedevstack/bear/styles.css");
58
59
 
59
60
  // src/components/GridTable/GridTable.tsx
60
61
  var import_react15 = require("react");
@@ -226,6 +227,10 @@ function reducer(state, action) {
226
227
  return { ...state, selectedIds: action.payload };
227
228
  case "SET_EXPANDED_IDS":
228
229
  return { ...state, expandedIds: action.payload };
230
+ case "SET_EXPANDED_CELL_IDS":
231
+ return { ...state, expandedCellIds: action.payload };
232
+ case "SET_AUTO_SIZED_COLUMN_IDS":
233
+ return { ...state, autoSizedColumnIds: action.payload };
229
234
  case "SET_COLUMN_STATES":
230
235
  return { ...state, columnStates: action.payload };
231
236
  case "SET_DRAGGING_COLUMN":
@@ -263,9 +268,24 @@ function TableProvider({
263
268
  sortConfig: _sortConfig,
264
269
  enableMultiSort = false,
265
270
  getRowId,
266
- onStateChange
271
+ onStateChange,
272
+ showOverflowTooltip = true,
273
+ enableCellAutoSizeOnDoubleClick = false,
274
+ subCellExpandTrigger = "both",
275
+ expandRowOnDoubleClick = false,
276
+ globalFilterColumns = void 0
267
277
  }) {
268
278
  var _a, _b;
279
+ const tableOptions = (0, import_react.useMemo)(
280
+ () => ({
281
+ showOverflowTooltip,
282
+ enableCellAutoSizeOnDoubleClick,
283
+ subCellExpandTrigger,
284
+ expandRowOnDoubleClick,
285
+ globalFilterColumns
286
+ }),
287
+ [showOverflowTooltip, enableCellAutoSizeOnDoubleClick, subCellExpandTrigger, expandRowOnDoubleClick, globalFilterColumns]
288
+ );
269
289
  const initialColumnStates = columns.map((col, index) => ({
270
290
  id: col.id,
271
291
  visible: !col.hidden,
@@ -294,6 +314,8 @@ function TableProvider({
294
314
  totalItems: data.length,
295
315
  selectedIds: /* @__PURE__ */ new Set(),
296
316
  expandedIds: /* @__PURE__ */ new Set(),
317
+ expandedCellIds: /* @__PURE__ */ new Set(),
318
+ autoSizedColumnIds: /* @__PURE__ */ new Set(),
297
319
  loading,
298
320
  error,
299
321
  theme: mergedTheme,
@@ -420,6 +442,25 @@ function TableProvider({
420
442
  actions.expandRow(id);
421
443
  }
422
444
  },
445
+ toggleCellExpansion: (rowId, columnId) => {
446
+ const key = `${String(rowId)}-${columnId}`;
447
+ const next = new Set(state.expandedCellIds);
448
+ if (next.has(key)) {
449
+ next.delete(key);
450
+ } else {
451
+ next.add(key);
452
+ }
453
+ dispatch({ type: "SET_EXPANDED_CELL_IDS", payload: next });
454
+ },
455
+ toggleColumnAutoSize: (columnId) => {
456
+ const next = new Set(state.autoSizedColumnIds);
457
+ if (next.has(columnId)) {
458
+ next.delete(columnId);
459
+ } else {
460
+ next.add(columnId);
461
+ }
462
+ dispatch({ type: "SET_AUTO_SIZED_COLUMN_IDS", payload: next });
463
+ },
423
464
  reorderColumn: (sourceId, targetId) => {
424
465
  const newStates = [...state.columnStates];
425
466
  const sourceIndex = newStates.findIndex((c) => c.id === sourceId);
@@ -458,6 +499,8 @@ function TableProvider({
458
499
  page: ONE,
459
500
  selectedIds: /* @__PURE__ */ new Set(),
460
501
  expandedIds: /* @__PURE__ */ new Set(),
502
+ expandedCellIds: /* @__PURE__ */ new Set(),
503
+ autoSizedColumnIds: /* @__PURE__ */ new Set(),
461
504
  columnStates: initialColumnStates
462
505
  }
463
506
  })
@@ -468,11 +511,15 @@ function TableProvider({
468
511
  let filteredData = [...state.data];
469
512
  if (state.globalFilter) {
470
513
  const searchLower = state.globalFilter.toLowerCase();
471
- filteredData = filteredData.filter(
472
- (row) => Object.values(row).some(
473
- (val) => String(val).toLowerCase().includes(searchLower)
474
- )
475
- );
514
+ const columnIds = tableOptions.globalFilterColumns;
515
+ filteredData = filteredData.filter((row) => {
516
+ const colsToSearch = columnIds && columnIds.length > 0 ? state.columns.filter((c) => columnIds.includes(c.id)) : state.columns;
517
+ return colsToSearch.some((col) => {
518
+ const accessor = col.accessor;
519
+ const value = typeof accessor === "function" ? accessor(row) : row[accessor];
520
+ return String(value != null ? value : "").toLowerCase().includes(searchLower);
521
+ });
522
+ });
476
523
  }
477
524
  state.filters.forEach((filter) => {
478
525
  const column = columns.find((c) => c.id === filter.columnId);
@@ -558,10 +605,11 @@ function TableProvider({
558
605
  isTablet,
559
606
  isDesktop
560
607
  };
561
- }, [state, columns]);
608
+ }, [state, columns, tableOptions]);
562
609
  const contextValue = {
563
610
  state,
564
611
  actions,
612
+ tableOptions,
565
613
  computed
566
614
  };
567
615
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableContext.Provider, { value: contextValue, children });
@@ -1050,6 +1098,7 @@ function useTable() {
1050
1098
 
1051
1099
  // src/components/GridHeader/GridHeader.tsx
1052
1100
  var import_react9 = require("react");
1101
+ var import_bear = require("@forgedevstack/bear");
1053
1102
 
1054
1103
  // src/components/FilterPopup/FilterPopup.tsx
1055
1104
  var import_react8 = require("react");
@@ -1265,6 +1314,7 @@ function HeaderCell({
1265
1314
  hasFilter = false,
1266
1315
  isDragging = false,
1267
1316
  isDragOver = false,
1317
+ isColumnAutoSized = false,
1268
1318
  onSort,
1269
1319
  onFilterOpen,
1270
1320
  onResizeStart,
@@ -1309,23 +1359,33 @@ function HeaderCell({
1309
1359
  }
1310
1360
  return classes.join(" ");
1311
1361
  }, [column.align, isSortable, isDragging, isDragOver]);
1362
+ const cellStyle = (0, import_react9.useMemo)(() => {
1363
+ const base = {
1364
+ flexShrink: 0,
1365
+ ...column.sticky && {
1366
+ position: "sticky",
1367
+ [column.sticky]: 0,
1368
+ zIndex: 2,
1369
+ backgroundColor: "var(--gt-bg-secondary, #2b2b2b)"
1370
+ },
1371
+ ...column.headerStyle
1372
+ };
1373
+ if (isColumnAutoSized) {
1374
+ base.width = "auto";
1375
+ base.minWidth = "max-content";
1376
+ base.maxWidth = "none";
1377
+ } else {
1378
+ base.width = typeof columnState.width === "number" ? `${columnState.width}px` : columnState.width;
1379
+ base.minWidth = column.minWidth || MIN_COLUMN_WIDTH;
1380
+ base.maxWidth = column.maxWidth || MAX_COLUMN_WIDTH;
1381
+ }
1382
+ return base;
1383
+ }, [column, columnState.width, isColumnAutoSized]);
1312
1384
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1313
1385
  "div",
1314
1386
  {
1315
1387
  className: `${cellClasses} ${column.headerClassName || ""} ${column.sticky ? `sticky-${column.sticky}` : ""}`,
1316
- style: {
1317
- width: columnState.width,
1318
- minWidth: column.minWidth || MIN_COLUMN_WIDTH,
1319
- maxWidth: column.maxWidth || MAX_COLUMN_WIDTH,
1320
- flexShrink: 0,
1321
- ...column.sticky && {
1322
- position: "sticky",
1323
- [column.sticky]: 0,
1324
- zIndex: 2,
1325
- backgroundColor: "var(--bg-secondary, #2b2b2b)"
1326
- },
1327
- ...column.headerStyle
1328
- },
1388
+ style: cellStyle,
1329
1389
  role: "columnheader",
1330
1390
  "aria-sort": sortDirection === "asc" ? "ascending" : sortDirection === "desc" ? "descending" : "none",
1331
1391
  onClick: handleClick,
@@ -1368,6 +1428,7 @@ function GridHeader({
1368
1428
  enableDragDrop = true,
1369
1429
  enableResize = true,
1370
1430
  enableSelection = false,
1431
+ enableExpansion = false,
1371
1432
  allSelected = false,
1372
1433
  someSelected = false,
1373
1434
  onSelectAll,
@@ -1440,18 +1501,16 @@ function GridHeader({
1440
1501
  }, [sticky]);
1441
1502
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: `${headerClasses} ${className}`, style, role: "row", children: [
1442
1503
  enableSelection && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "grid-header-select", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1443
- "input",
1504
+ import_bear.Checkbox,
1444
1505
  {
1445
- type: "checkbox",
1446
1506
  checked: allSelected,
1447
- ref: (el) => {
1448
- if (el) el.indeterminate = someSelected && !allSelected;
1449
- },
1450
- onChange: onSelectAll,
1451
- className: "grid-header-checkbox",
1507
+ indeterminate: someSelected && !allSelected,
1508
+ onChange: () => onSelectAll == null ? void 0 : onSelectAll(),
1509
+ size: "sm",
1452
1510
  "aria-label": "Select all rows"
1453
1511
  }
1454
1512
  ) }),
1513
+ enableExpansion && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "grid-header-expand-spacer", "aria-hidden": true }),
1455
1514
  visibleColumns.map((col, index) => {
1456
1515
  const colState = columnStates.find((cs) => cs.id === col.id) || {
1457
1516
  id: col.id,
@@ -1481,6 +1540,7 @@ function GridHeader({
1481
1540
  hasFilter,
1482
1541
  isDragging: dragDrop.draggingColumnId === col.id,
1483
1542
  isDragOver: dragDrop.dragOverColumnId === col.id,
1543
+ isColumnAutoSized: state.autoSizedColumnIds.has(col.id),
1484
1544
  onSort: () => actions.toggleSorting(col.id),
1485
1545
  onFilterOpen: () => handleFilterClick(col.id),
1486
1546
  onResizeStart: handleResizeStart(col.id, colState.width),
@@ -1512,10 +1572,58 @@ var import_react12 = require("react");
1512
1572
 
1513
1573
  // src/components/GridRow/GridRow.tsx
1514
1574
  var import_react11 = require("react");
1575
+ var import_bear3 = require("@forgedevstack/bear");
1515
1576
 
1516
1577
  // src/components/GridCell/GridCell.tsx
1517
1578
  var import_react10 = require("react");
1579
+ var import_bear2 = require("@forgedevstack/bear");
1580
+
1581
+ // src/utils/highlight.utils.tsx
1518
1582
  var import_jsx_runtime4 = require("react/jsx-runtime");
1583
+ function highlightMatch(text, term) {
1584
+ if (!term.trim()) return text;
1585
+ const parts = text.split(new RegExp(`(${escapeRegex(term)})`, "gi"));
1586
+ return parts.map(
1587
+ (part, i) => part.toLowerCase() === term.toLowerCase() ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("mark", { className: "grid-cell-highlight", children: part }, i) : part
1588
+ );
1589
+ }
1590
+ function escapeRegex(s) {
1591
+ return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1592
+ }
1593
+
1594
+ // src/utils/generateSampleData.ts
1595
+ function generateSampleData(columns, rowCount) {
1596
+ const ids = columns.map((c) => c.id);
1597
+ return Array.from({ length: rowCount }, (_, i) => {
1598
+ const row = {};
1599
+ ids.forEach((key) => {
1600
+ if (key === "id" || key === "idNumber") {
1601
+ row[key] = i + 1;
1602
+ } else if (key === "email") {
1603
+ row[key] = `user${i + 1}@example.com`;
1604
+ } else if (key === "name" || key === "firstName" || key === "title") {
1605
+ row[key] = `Sample ${i + 1}`;
1606
+ } else if (key === "status" || key === "role") {
1607
+ row[key] = ["active", "inactive", "pending"][i % 3];
1608
+ } else if (key === "date" || key === "joinDate" || key === "createdAt") {
1609
+ row[key] = new Date(2020 + i % 4, i % 12, i % 28 + 1).toISOString().slice(0, 10);
1610
+ } else if (key === "salary" || key === "amount" || key === "count") {
1611
+ row[key] = 1e3 * (i + 1) + i % 100;
1612
+ } else if (key === "department") {
1613
+ row[key] = ["Engineering", "Design", "Marketing", "Sales", "HR"][i % 5];
1614
+ } else {
1615
+ row[key] = `Value ${i + 1}`;
1616
+ }
1617
+ });
1618
+ if (!("id" in row) && ids.length > 0) {
1619
+ row.id = i + 1;
1620
+ }
1621
+ return row;
1622
+ });
1623
+ }
1624
+
1625
+ // src/components/GridCell/GridCell.tsx
1626
+ var import_jsx_runtime5 = require("react/jsx-runtime");
1519
1627
  var ALIGN_CLASSES2 = {
1520
1628
  left: "text-left justify-start",
1521
1629
  center: "text-center justify-center",
@@ -1525,6 +1633,7 @@ function GridCell({
1525
1633
  column,
1526
1634
  row,
1527
1635
  rowIndex,
1636
+ rowId,
1528
1637
  value,
1529
1638
  width,
1530
1639
  align = "left",
@@ -1536,20 +1645,18 @@ function GridCell({
1536
1645
  stickyOffset = 0,
1537
1646
  onClick
1538
1647
  }) {
1539
- const handleClick = (0, import_react10.useCallback)(
1540
- (e) => {
1541
- if (onClick) {
1542
- e.stopPropagation();
1543
- onClick({
1544
- row,
1545
- rowIndex,
1546
- columnId: column.id,
1547
- value
1548
- });
1549
- }
1550
- },
1551
- [onClick, row, rowIndex, column.id, value]
1552
- );
1648
+ var _a, _b, _c;
1649
+ const valueRef = (0, import_react10.useRef)(null);
1650
+ const [overflowTitle, setOverflowTitle] = (0, import_react10.useState)(void 0);
1651
+ const { state, actions, tableOptions } = useTableContext();
1652
+ const showOverflowTooltip = ((_a = column.showOverflowTooltip) != null ? _a : tableOptions.showOverflowTooltip) !== false;
1653
+ const hasSubCell = Boolean(column.renderSubCell);
1654
+ const trigger = (_c = (_b = column.subCellExpandTrigger) != null ? _b : tableOptions.subCellExpandTrigger) != null ? _c : "both";
1655
+ const showArrow = hasSubCell && (trigger === "arrow" || trigger === "both");
1656
+ const enableCellAutoSize = tableOptions.enableCellAutoSizeOnDoubleClick === true;
1657
+ const cellKey = `${String(rowId)}-${column.id}`;
1658
+ const isSubCellExpanded = state.expandedCellIds.has(cellKey);
1659
+ const isAutoSized = state.autoSizedColumnIds.has(column.id);
1553
1660
  const formattedValue = (0, import_react10.useMemo)(() => {
1554
1661
  if (column.render) {
1555
1662
  return column.render(value, row, rowIndex);
@@ -1565,9 +1672,53 @@ function GridCell({
1565
1672
  }
1566
1673
  return String(value);
1567
1674
  }, [column, row, rowIndex, value]);
1675
+ (0, import_react10.useEffect)(() => {
1676
+ var _a2;
1677
+ if (!showOverflowTooltip || !valueRef.current) return;
1678
+ const el = valueRef.current;
1679
+ const truncated = el.scrollWidth > el.clientWidth;
1680
+ const raw = (_a2 = el.textContent) != null ? _a2 : "";
1681
+ setOverflowTitle(truncated && raw ? raw : void 0);
1682
+ }, [showOverflowTooltip, formattedValue]);
1683
+ const handleClick = (0, import_react10.useCallback)(
1684
+ (e) => {
1685
+ if (onClick) {
1686
+ e.stopPropagation();
1687
+ onClick({
1688
+ row,
1689
+ rowIndex,
1690
+ columnId: column.id,
1691
+ value
1692
+ });
1693
+ }
1694
+ },
1695
+ [onClick, row, rowIndex, column.id, value]
1696
+ );
1697
+ const handleDoubleClick = (0, import_react10.useCallback)(
1698
+ (e) => {
1699
+ e.stopPropagation();
1700
+ if (hasSubCell && (trigger === "doubleClick" || trigger === "both")) {
1701
+ actions.toggleCellExpansion(rowId, column.id);
1702
+ } else if (enableCellAutoSize) {
1703
+ actions.toggleColumnAutoSize(column.id);
1704
+ }
1705
+ },
1706
+ [hasSubCell, trigger, enableCellAutoSize, actions, rowId, column.id]
1707
+ );
1708
+ const handleExpandClick = (0, import_react10.useCallback)(
1709
+ (e) => {
1710
+ e.stopPropagation();
1711
+ actions.toggleCellExpansion(rowId, column.id);
1712
+ },
1713
+ [actions, rowId, column.id]
1714
+ );
1568
1715
  const cellStyle = (0, import_react10.useMemo)(() => {
1569
1716
  const baseStyle = { ...style };
1570
- if (width !== void 0) {
1717
+ if (isAutoSized) {
1718
+ baseStyle.width = "auto";
1719
+ baseStyle.minWidth = "max-content";
1720
+ baseStyle.maxWidth = "none";
1721
+ } else if (width !== void 0) {
1571
1722
  baseStyle.width = typeof width === "number" ? `${width}px` : width;
1572
1723
  baseStyle.minWidth = baseStyle.width;
1573
1724
  baseStyle.maxWidth = baseStyle.width;
@@ -1575,7 +1726,7 @@ function GridCell({
1575
1726
  if (sticky) {
1576
1727
  baseStyle.position = "sticky";
1577
1728
  baseStyle.zIndex = 1;
1578
- baseStyle.backgroundColor = "var(--bg-primary, #1e1e1e)";
1729
+ baseStyle.backgroundColor = "var(--gt-bg-primary, #1e1e1e)";
1579
1730
  if (sticky === "left") {
1580
1731
  baseStyle.left = stickyOffset;
1581
1732
  } else if (sticky === "right") {
@@ -1583,10 +1734,12 @@ function GridCell({
1583
1734
  }
1584
1735
  }
1585
1736
  return baseStyle;
1586
- }, [style, width, sticky, stickyOffset]);
1737
+ }, [style, width, sticky, stickyOffset, isAutoSized]);
1587
1738
  const alignClass = ALIGN_CLASSES2[align];
1588
1739
  const stickyClass = sticky ? `sticky-${sticky}` : "";
1589
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1740
+ const shouldHighlight = state.globalFilter && typeof formattedValue === "string" && (!tableOptions.globalFilterColumns || tableOptions.globalFilterColumns.length === 0 || tableOptions.globalFilterColumns.includes(column.id));
1741
+ const cellContent = shouldHighlight ? highlightMatch(String(formattedValue), state.globalFilter) : formattedValue;
1742
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1590
1743
  "div",
1591
1744
  {
1592
1745
  className: `
@@ -1594,25 +1747,55 @@ function GridCell({
1594
1747
  ${alignClass}
1595
1748
  ${stickyClass}
1596
1749
  ${onClick ? "cursor-pointer" : ""}
1750
+ ${hasSubCell ? "grid-cell--has-sub" : ""}
1751
+ ${isAutoSized ? "grid-cell--auto-sized" : ""}
1597
1752
  ${column.cellClassName || ""}
1598
1753
  ${className}
1599
1754
  `.trim(),
1600
1755
  style: { ...cellStyle, ...column.cellStyle },
1601
1756
  role: "cell",
1602
1757
  onClick: onClick ? handleClick : void 0,
1758
+ onDoubleClick: handleDoubleClick,
1603
1759
  children: [
1604
- showLabel && labelText && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "grid-cell-label", children: [
1605
- labelText,
1606
- ":"
1760
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "grid-cell-inner", children: [
1761
+ showLabel && labelText && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_bear2.Typography, { component: "span", variant: "body2", color: "secondary", className: "grid-cell-label", children: [
1762
+ labelText,
1763
+ ":"
1764
+ ] }),
1765
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "grid-cell-value-wrapper", style: { minWidth: 0, overflow: "hidden" }, children: overflowTitle ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_bear2.Tooltip, { content: overflowTitle, placement: "top", delay: 200, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1766
+ "span",
1767
+ {
1768
+ ref: valueRef,
1769
+ className: `grid-cell-value ${isAutoSized ? "" : "grid-cell-value--truncate"}`,
1770
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_bear2.Typography, { component: "span", variant: "body2", className: "grid-cell-value-text", children: cellContent })
1771
+ }
1772
+ ) }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1773
+ "span",
1774
+ {
1775
+ ref: valueRef,
1776
+ className: `grid-cell-value ${isAutoSized ? "" : "grid-cell-value--truncate"}`,
1777
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_bear2.Typography, { component: "span", variant: "body2", children: cellContent })
1778
+ }
1779
+ ) }),
1780
+ showArrow && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1781
+ "button",
1782
+ {
1783
+ type: "button",
1784
+ className: `grid-cell-expand-trigger ${isSubCellExpanded ? "grid-cell-expand-trigger--expanded" : ""}`,
1785
+ onClick: handleExpandClick,
1786
+ "aria-label": isSubCellExpanded ? "Collapse" : "Expand",
1787
+ "aria-expanded": isSubCellExpanded
1788
+ }
1789
+ )
1607
1790
  ] }),
1608
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "grid-cell-value truncate", children: formattedValue })
1791
+ hasSubCell && isSubCellExpanded && column.renderSubCell && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "grid-cell-subcell", children: column.renderSubCell(row) })
1609
1792
  ]
1610
1793
  }
1611
1794
  );
1612
1795
  }
1613
1796
 
1614
1797
  // src/components/GridRow/GridRow.tsx
1615
- var import_jsx_runtime5 = require("react/jsx-runtime");
1798
+ var import_jsx_runtime6 = require("react/jsx-runtime");
1616
1799
  function GridRow({
1617
1800
  row,
1618
1801
  rowIndex,
@@ -1652,10 +1835,13 @@ function GridRow({
1652
1835
  },
1653
1836
  [onContextMenu, row, rowIndex, isDisabled]
1654
1837
  );
1655
- const handleSelectChange = (0, import_react11.useCallback)(() => {
1656
- if (isDisabled) return;
1657
- onSelect == null ? void 0 : onSelect(!isSelected);
1658
- }, [onSelect, isSelected, isDisabled]);
1838
+ const handleSelectChange = (0, import_react11.useCallback)(
1839
+ (selected) => {
1840
+ if (isDisabled) return;
1841
+ onSelect == null ? void 0 : onSelect(selected);
1842
+ },
1843
+ [onSelect, isDisabled]
1844
+ );
1659
1845
  const handleExpandToggle = (0, import_react11.useCallback)(() => {
1660
1846
  if (isDisabled) return;
1661
1847
  onExpand == null ? void 0 : onExpand(!isExpanded);
@@ -1709,8 +1895,8 @@ function GridRow({
1709
1895
  }
1710
1896
  return classes.join(" ");
1711
1897
  }, [isHovered, isSelected, isDisabled, onClick, isMobile]);
1712
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
1713
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1898
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
1899
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
1714
1900
  "div",
1715
1901
  {
1716
1902
  className: `${rowClasses} ${className}`,
@@ -1724,18 +1910,17 @@ function GridRow({
1724
1910
  onMouseEnter: () => setIsHovered(true),
1725
1911
  onMouseLeave: () => setIsHovered(false),
1726
1912
  children: [
1727
- enableSelection && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "grid-row-select", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1728
- "input",
1913
+ enableSelection && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "grid-row-select", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1914
+ import_bear3.Checkbox,
1729
1915
  {
1730
- type: "checkbox",
1731
- checked: isSelected,
1732
- onChange: handleSelectChange,
1916
+ checked: isSelected != null ? isSelected : false,
1917
+ onChange: (e) => handleSelectChange(e.target.checked),
1733
1918
  disabled: isDisabled,
1734
- className: "grid-row-checkbox",
1919
+ size: "sm",
1735
1920
  "aria-label": "Select row"
1736
1921
  }
1737
1922
  ) }),
1738
- enableExpansion && renderExpansion && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "grid-row-expand", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1923
+ enableExpansion && renderExpansion && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "grid-row-expand", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1739
1924
  "button",
1740
1925
  {
1741
1926
  onClick: handleExpandToggle,
@@ -1743,7 +1928,7 @@ function GridRow({
1743
1928
  className: "grid-row-expand-button",
1744
1929
  "aria-label": isExpanded ? "Collapse row" : "Expand row",
1745
1930
  "aria-expanded": isExpanded,
1746
- children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1931
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1747
1932
  "span",
1748
1933
  {
1749
1934
  className: `transform transition-transform duration-200 ${isExpanded ? "rotate-90" : ""}`,
@@ -1775,12 +1960,13 @@ function GridRow({
1775
1960
  }
1776
1961
  }
1777
1962
  }
1778
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1963
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1779
1964
  GridCell,
1780
1965
  {
1781
1966
  column: col,
1782
1967
  row,
1783
1968
  rowIndex,
1969
+ rowId: getRowId(row),
1784
1970
  value: getCellValue(col),
1785
1971
  width,
1786
1972
  align: col.align,
@@ -1797,12 +1983,12 @@ function GridRow({
1797
1983
  ]
1798
1984
  }
1799
1985
  ),
1800
- isExpanded && renderExpansion && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "grid-row-expansion", children: renderExpansion(row) })
1986
+ isExpanded && renderExpansion && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "grid-row-expansion", children: renderExpansion(row, getRowId(row)) })
1801
1987
  ] });
1802
1988
  }
1803
1989
 
1804
1990
  // src/components/GridBody/GridBody.tsx
1805
- var import_jsx_runtime6 = require("react/jsx-runtime");
1991
+ var import_jsx_runtime7 = require("react/jsx-runtime");
1806
1992
  function GridBody({
1807
1993
  data,
1808
1994
  columns,
@@ -1843,7 +2029,7 @@ function GridBody({
1843
2029
  if (data.length === 0) {
1844
2030
  return null;
1845
2031
  }
1846
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: `grid-body ${className}`, style, role: "rowgroup", children: data.map((row, index) => {
2032
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: `grid-body ${className}`, style, role: "rowgroup", children: data.map((row, index) => {
1847
2033
  var _a, _b;
1848
2034
  const rowId = getRowId(row);
1849
2035
  const isSelected = selectedIds.has(rowId);
@@ -1851,7 +2037,7 @@ function GridBody({
1851
2037
  const isDisabled = (_a = isRowDisabled == null ? void 0 : isRowDisabled(row)) != null ? _a : false;
1852
2038
  const rowClassName = (_b = getRowClassName == null ? void 0 : getRowClassName(row, index)) != null ? _b : "";
1853
2039
  const rowStyle = getRowStyle == null ? void 0 : getRowStyle(row, index);
1854
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
2040
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1855
2041
  GridRow,
1856
2042
  {
1857
2043
  row,
@@ -1880,178 +2066,8 @@ function GridBody({
1880
2066
  }) });
1881
2067
  }
1882
2068
 
1883
- // src/components/Pagination/Pagination.tsx
1884
- var import_react13 = require("react");
1885
- var import_jsx_runtime7 = require("react/jsx-runtime");
1886
- function Pagination({
1887
- page,
1888
- pageSize,
1889
- totalItems,
1890
- totalPages,
1891
- pageSizeOptions = [10, 20, 50, 100],
1892
- showFirstLast = true,
1893
- showPageNumbers = true,
1894
- maxPageButtons = FIVE,
1895
- className = "",
1896
- style,
1897
- onPageChange,
1898
- onPageSizeChange
1899
- }) {
1900
- const { state } = useTableContext();
1901
- const { translations } = state;
1902
- const canGoPrevious = page > ONE;
1903
- const canGoNext = page < totalPages;
1904
- const startItem = (page - ONE) * pageSize + ONE;
1905
- const endItem = Math.min(page * pageSize, totalItems);
1906
- const handleFirstPage = (0, import_react13.useCallback)(() => {
1907
- onPageChange(ONE);
1908
- }, [onPageChange]);
1909
- const handlePreviousPage = (0, import_react13.useCallback)(() => {
1910
- if (canGoPrevious) {
1911
- onPageChange(page - ONE);
1912
- }
1913
- }, [canGoPrevious, page, onPageChange]);
1914
- const handleNextPage = (0, import_react13.useCallback)(() => {
1915
- if (canGoNext) {
1916
- onPageChange(page + ONE);
1917
- }
1918
- }, [canGoNext, page, onPageChange]);
1919
- const handleLastPage = (0, import_react13.useCallback)(() => {
1920
- onPageChange(totalPages);
1921
- }, [onPageChange, totalPages]);
1922
- const handlePageSizeChange = (0, import_react13.useCallback)(
1923
- (event) => {
1924
- onPageSizeChange(Number(event.target.value));
1925
- },
1926
- [onPageSizeChange]
1927
- );
1928
- const pageNumbers = (0, import_react13.useMemo)(() => {
1929
- if (!showPageNumbers || totalPages <= ONE) return [];
1930
- const pages = [];
1931
- const halfMax = Math.floor(maxPageButtons / 2);
1932
- let start = Math.max(ONE, page - halfMax);
1933
- let end = Math.min(totalPages, page + halfMax);
1934
- if (page <= halfMax) {
1935
- end = Math.min(totalPages, maxPageButtons);
1936
- }
1937
- if (page > totalPages - halfMax) {
1938
- start = Math.max(ONE, totalPages - maxPageButtons + ONE);
1939
- }
1940
- if (start > ONE) {
1941
- pages.push(ONE);
1942
- if (start > 2) {
1943
- pages.push("ellipsis");
1944
- }
1945
- }
1946
- for (let i = start; i <= end; i++) {
1947
- if (!pages.includes(i)) {
1948
- pages.push(i);
1949
- }
1950
- }
1951
- if (end < totalPages) {
1952
- if (end < totalPages - ONE) {
1953
- pages.push("ellipsis");
1954
- }
1955
- pages.push(totalPages);
1956
- }
1957
- return pages;
1958
- }, [page, totalPages, showPageNumbers, maxPageButtons]);
1959
- if (totalItems === 0) {
1960
- return null;
1961
- }
1962
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1963
- "div",
1964
- {
1965
- className: `grid-pagination ${className}`,
1966
- style,
1967
- role: "navigation",
1968
- "aria-label": "Pagination",
1969
- children: [
1970
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "grid-pagination-info", children: [
1971
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "grid-pagination-range", children: [
1972
- startItem,
1973
- "-",
1974
- endItem,
1975
- " ",
1976
- translations.of,
1977
- " ",
1978
- totalItems
1979
- ] }),
1980
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "grid-pagination-size", children: [
1981
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { htmlFor: "page-size", children: [
1982
- translations.rowsPerPage,
1983
- ":"
1984
- ] }),
1985
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1986
- "select",
1987
- {
1988
- id: "page-size",
1989
- value: pageSize,
1990
- onChange: handlePageSizeChange,
1991
- className: "px-2 py-1 text-sm rounded",
1992
- children: pageSizeOptions.map((size) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: size, children: size }, size))
1993
- }
1994
- )
1995
- ] })
1996
- ] }),
1997
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "grid-pagination-controls", children: [
1998
- showFirstLast && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1999
- "button",
2000
- {
2001
- onClick: handleFirstPage,
2002
- disabled: !canGoPrevious,
2003
- className: "p-2 rounded text-theme-secondary",
2004
- "aria-label": translations.first,
2005
- children: "<<"
2006
- }
2007
- ),
2008
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2009
- "button",
2010
- {
2011
- onClick: handlePreviousPage,
2012
- disabled: !canGoPrevious,
2013
- className: "p-2 rounded text-theme-secondary",
2014
- "aria-label": translations.previous,
2015
- children: "<"
2016
- }
2017
- ),
2018
- showPageNumbers && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "grid-pagination-pages", children: pageNumbers.map(
2019
- (pageNum, index) => pageNum === "ellipsis" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "px-2 text-theme-muted", children: "..." }, `ellipsis-${index}`) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2020
- "button",
2021
- {
2022
- onClick: () => onPageChange(pageNum),
2023
- className: `min-w-[32px] h-8 px-2 rounded text-sm ${pageNum === page ? "active" : ""}`,
2024
- "aria-current": pageNum === page ? "page" : void 0,
2025
- children: pageNum
2026
- },
2027
- pageNum
2028
- )
2029
- ) }),
2030
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2031
- "button",
2032
- {
2033
- onClick: handleNextPage,
2034
- disabled: !canGoNext,
2035
- className: "p-2 rounded text-theme-secondary",
2036
- "aria-label": translations.next,
2037
- children: ">"
2038
- }
2039
- ),
2040
- showFirstLast && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2041
- "button",
2042
- {
2043
- onClick: handleLastPage,
2044
- disabled: !canGoNext,
2045
- className: "p-2 rounded text-theme-secondary",
2046
- "aria-label": translations.last,
2047
- children: ">>"
2048
- }
2049
- )
2050
- ] })
2051
- ]
2052
- }
2053
- );
2054
- }
2069
+ // src/components/GridTable/GridTable.tsx
2070
+ var import_bear5 = require("@forgedevstack/bear");
2055
2071
 
2056
2072
  // src/components/Skeleton/Skeleton.tsx
2057
2073
  var import_jsx_runtime8 = require("react/jsx-runtime");
@@ -2128,8 +2144,203 @@ function Skeleton({
2128
2144
  ] });
2129
2145
  }
2130
2146
 
2131
- // src/components/EmptyState/EmptyState.tsx
2147
+ // src/components/TableStudioPanel/TableStudioPanel.tsx
2148
+ var import_react13 = require("react");
2149
+ var import_bear4 = require("@forgedevstack/bear");
2132
2150
  var import_jsx_runtime9 = require("react/jsx-runtime");
2151
+ var DEFAULT_ROW_COUNT = 10;
2152
+ function TableStudioPanel({
2153
+ data,
2154
+ columns,
2155
+ propsSnapshot,
2156
+ onDataChange,
2157
+ open = true,
2158
+ onOpenChange
2159
+ }) {
2160
+ const [activeTab, setActiveTab] = (0, import_react13.useState)("data");
2161
+ const [generateCount, setGenerateCount] = (0, import_react13.useState)(DEFAULT_ROW_COUNT);
2162
+ const handleGenerate = (0, import_react13.useCallback)(() => {
2163
+ if (!onDataChange) return;
2164
+ const count = Math.min(100, Math.max(1, generateCount));
2165
+ const generated = generateSampleData(columns, count);
2166
+ onDataChange(generated);
2167
+ setActiveTab("data");
2168
+ }, [columns, generateCount, onDataChange]);
2169
+ const panelContent = /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
2170
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2171
+ "div",
2172
+ {
2173
+ style: {
2174
+ display: "flex",
2175
+ borderBottom: "1px solid var(--gt-border-color, rgba(0,0,0,0.08))",
2176
+ padding: "0.25rem 0",
2177
+ gap: 2
2178
+ },
2179
+ children: ["data", "props", "generate"].map((tab) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2180
+ "button",
2181
+ {
2182
+ type: "button",
2183
+ onClick: () => setActiveTab(tab),
2184
+ style: {
2185
+ flex: 1,
2186
+ padding: "0.5rem 0.5rem",
2187
+ border: "none",
2188
+ borderRadius: 4,
2189
+ background: activeTab === tab ? "var(--gt-bg-tertiary)" : "transparent",
2190
+ color: "var(--gt-text-primary)",
2191
+ cursor: "pointer",
2192
+ fontWeight: activeTab === tab ? 600 : 400,
2193
+ fontSize: 12,
2194
+ textTransform: "capitalize"
2195
+ },
2196
+ children: tab
2197
+ },
2198
+ tab
2199
+ ))
2200
+ }
2201
+ ),
2202
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: { flex: 1, overflow: "auto", padding: "0.75rem" }, children: [
2203
+ activeTab === "data" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
2204
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_bear4.Typography, { variant: "subtitle2", component: "h3", style: { marginBottom: "0.5rem" }, children: [
2205
+ "Data (",
2206
+ data.length,
2207
+ " rows)"
2208
+ ] }),
2209
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2210
+ "pre",
2211
+ {
2212
+ style: {
2213
+ margin: 0,
2214
+ fontSize: 11,
2215
+ fontFamily: "monospace",
2216
+ whiteSpace: "pre-wrap",
2217
+ wordBreak: "break-word",
2218
+ color: "var(--gt-text-primary)"
2219
+ },
2220
+ children: JSON.stringify(data, null, 2)
2221
+ }
2222
+ )
2223
+ ] }),
2224
+ activeTab === "props" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
2225
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_bear4.Typography, { variant: "subtitle2", component: "h3", style: { marginBottom: "0.5rem" }, children: "Props" }),
2226
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("dl", { style: { margin: 0, fontSize: 13, color: "var(--gt-text-primary)" }, children: Object.entries(propsSnapshot).map(([key, value]) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: { marginBottom: "0.5rem" }, children: [
2227
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("dt", { style: { fontWeight: 600, marginBottom: 2 }, children: key }),
2228
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("dd", { style: { margin: 0, color: "var(--gt-text-secondary)" }, children: typeof value === "object" && value !== null ? JSON.stringify(value) : String(value) })
2229
+ ] }, key)) })
2230
+ ] }),
2231
+ activeTab === "generate" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
2232
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_bear4.Typography, { variant: "subtitle2", component: "h3", style: { marginBottom: "0.5rem" }, children: "Generate sample data" }),
2233
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { style: { fontSize: 12, color: "var(--gt-text-secondary)", marginBottom: "0.75rem" }, children: "Create rows from column definitions. Uses placeholders for common fields (name, email, id, etc.)." }),
2234
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "0.5rem" }, children: [
2235
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { style: { fontSize: 12, fontWeight: 500 }, children: [
2236
+ "Rows",
2237
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2238
+ "input",
2239
+ {
2240
+ type: "number",
2241
+ min: 1,
2242
+ max: 100,
2243
+ value: generateCount,
2244
+ onChange: (e) => setGenerateCount(Number(e.target.value) || 1),
2245
+ style: {
2246
+ display: "block",
2247
+ marginTop: 4,
2248
+ width: "100%",
2249
+ padding: "6px 8px",
2250
+ borderRadius: 4,
2251
+ border: "1px solid var(--gt-border-color)",
2252
+ background: "var(--gt-bg-primary)",
2253
+ color: "var(--gt-text-primary)"
2254
+ }
2255
+ }
2256
+ )
2257
+ ] }),
2258
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2259
+ "button",
2260
+ {
2261
+ type: "button",
2262
+ onClick: handleGenerate,
2263
+ disabled: !onDataChange,
2264
+ style: {
2265
+ padding: "8px 12px",
2266
+ borderRadius: 6,
2267
+ border: "none",
2268
+ background: onDataChange ? "var(--gt-accent-primary)" : "var(--gt-bg-tertiary)",
2269
+ color: onDataChange ? "#fff" : "var(--gt-text-muted)",
2270
+ cursor: onDataChange ? "pointer" : "not-allowed",
2271
+ fontWeight: 500,
2272
+ fontSize: 13
2273
+ },
2274
+ children: "Generate data"
2275
+ }
2276
+ ),
2277
+ !onDataChange && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { style: { fontSize: 11, color: "var(--gt-text-muted)" }, children: "Table must use studio with controllable data to generate." })
2278
+ ] })
2279
+ ] })
2280
+ ] })
2281
+ ] });
2282
+ const width = 320;
2283
+ const isCollapsed = !open;
2284
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
2285
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2286
+ "button",
2287
+ {
2288
+ type: "button",
2289
+ onClick: () => onOpenChange == null ? void 0 : onOpenChange(!open),
2290
+ className: "grid-table-studio-toggle",
2291
+ style: {
2292
+ position: "fixed",
2293
+ right: open ? width : 0,
2294
+ top: "50%",
2295
+ transform: "translateY(-50%)",
2296
+ zIndex: 10001,
2297
+ width: 24,
2298
+ height: 48,
2299
+ border: "1px solid var(--gt-border-color, rgba(0,0,0,0.08))",
2300
+ borderRight: "none",
2301
+ borderRadius: "8px 0 0 8px",
2302
+ background: "var(--gt-bg-secondary, #f5f5f5)",
2303
+ color: "var(--gt-text-primary)",
2304
+ cursor: "pointer",
2305
+ display: "flex",
2306
+ alignItems: "center",
2307
+ justifyContent: "center",
2308
+ fontSize: 14,
2309
+ boxShadow: " -2px 0 8px rgba(0,0,0,0.08)"
2310
+ },
2311
+ "aria-label": open ? "Close studio panel" : "Open studio panel",
2312
+ children: open ? "\u203A" : "\u2039"
2313
+ }
2314
+ ),
2315
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2316
+ "aside",
2317
+ {
2318
+ className: "grid-table-studio-panel",
2319
+ style: {
2320
+ position: "fixed",
2321
+ top: 0,
2322
+ right: 0,
2323
+ bottom: 0,
2324
+ width: isCollapsed ? 0 : width,
2325
+ minWidth: isCollapsed ? 0 : 280,
2326
+ borderLeft: "1px solid var(--gt-border-color, rgba(0,0,0,0.08))",
2327
+ backgroundColor: "var(--gt-bg-secondary, #f5f5f5)",
2328
+ display: "flex",
2329
+ flexDirection: "column",
2330
+ overflow: "hidden",
2331
+ zIndex: 1e4,
2332
+ boxShadow: isCollapsed ? "none" : "-4px 0 12px rgba(0,0,0,0.08)",
2333
+ transition: "width 0.2s ease, box-shadow 0.2s ease"
2334
+ },
2335
+ "aria-label": "Table studio panel",
2336
+ children: !isCollapsed && panelContent
2337
+ }
2338
+ )
2339
+ ] });
2340
+ }
2341
+
2342
+ // src/components/EmptyState/EmptyState.tsx
2343
+ var import_jsx_runtime10 = require("react/jsx-runtime");
2133
2344
  function EmptyState({
2134
2345
  title,
2135
2346
  description,
@@ -2142,22 +2353,22 @@ function EmptyState({
2142
2353
  const { translations } = state;
2143
2354
  const displayTitle = title != null ? title : translations.empty;
2144
2355
  const displayDescription = description != null ? description : translations.noResults;
2145
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
2356
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
2146
2357
  "div",
2147
2358
  {
2148
2359
  className: `grid-empty-state ${className}`,
2149
2360
  style,
2150
2361
  role: "status",
2151
2362
  children: [
2152
- icon && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "grid-empty-icon", children: icon }),
2153
- !icon && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "grid-empty-icon", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2363
+ icon && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "grid-empty-icon", children: icon }),
2364
+ !icon && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "grid-empty-icon", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2154
2365
  "svg",
2155
2366
  {
2156
2367
  className: "icon-lg",
2157
2368
  fill: "none",
2158
2369
  viewBox: "0 0 24 24",
2159
2370
  stroke: "currentColor",
2160
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2371
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2161
2372
  "path",
2162
2373
  {
2163
2374
  strokeLinecap: "round",
@@ -2168,9 +2379,9 @@ function EmptyState({
2168
2379
  )
2169
2380
  }
2170
2381
  ) }),
2171
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h3", { className: "grid-empty-title", children: displayTitle }),
2172
- displayDescription && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "grid-empty-description", children: displayDescription }),
2173
- action && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "grid-empty-action", children: action })
2382
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h3", { className: "grid-empty-title", children: displayTitle }),
2383
+ displayDescription && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "grid-empty-description", children: displayDescription }),
2384
+ action && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "grid-empty-action", children: action })
2174
2385
  ]
2175
2386
  }
2176
2387
  );
@@ -2178,11 +2389,11 @@ function EmptyState({
2178
2389
 
2179
2390
  // src/components/MobileDrawer/MobileDrawer.tsx
2180
2391
  var import_react14 = require("react");
2181
- var import_jsx_runtime10 = require("react/jsx-runtime");
2392
+ var import_jsx_runtime11 = require("react/jsx-runtime");
2182
2393
  function DrawerHeader({ title, onClose }) {
2183
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "drawer-header", children: [
2184
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h3", { children: title }),
2185
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2394
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "drawer-header", children: [
2395
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h3", { children: title }),
2396
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2186
2397
  "button",
2187
2398
  {
2188
2399
  onClick: onClose,
@@ -2199,15 +2410,15 @@ function FilterContent() {
2199
2410
  const handleClearAll = (0, import_react14.useCallback)(() => {
2200
2411
  actions.clearFilters();
2201
2412
  }, [actions]);
2202
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "drawer-filter-content", children: [
2203
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
2204
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "text-sm text-theme-muted", children: [
2413
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "drawer-filter-content", children: [
2414
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { children: [
2415
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "text-sm text-theme-muted", children: [
2205
2416
  filters.length,
2206
2417
  " ",
2207
2418
  translations.filter,
2208
2419
  "(s) active"
2209
2420
  ] }),
2210
- filters.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2421
+ filters.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2211
2422
  "button",
2212
2423
  {
2213
2424
  onClick: handleClearAll,
@@ -2216,13 +2427,13 @@ function FilterContent() {
2216
2427
  }
2217
2428
  )
2218
2429
  ] }),
2219
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "space-y-3", children: columns.filter((col) => col.filterable !== false).map((col) => {
2430
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "space-y-3", children: columns.filter((col) => col.filterable !== false).map((col) => {
2220
2431
  var _a;
2221
2432
  const existingFilter = filters.find((f) => f.columnId === col.id);
2222
2433
  const headerText = typeof col.header === "string" ? col.header : col.id;
2223
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "filter-item", children: [
2224
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "block text-sm font-medium text-theme-secondary mb-1", children: headerText }),
2225
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2434
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "filter-item", children: [
2435
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("label", { className: "block text-sm font-medium text-theme-secondary mb-1", children: headerText }),
2436
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2226
2437
  "input",
2227
2438
  {
2228
2439
  type: "text",
@@ -2248,15 +2459,15 @@ function SortContent() {
2248
2459
  const handleClearAll = (0, import_react14.useCallback)(() => {
2249
2460
  actions.clearSorting();
2250
2461
  }, [actions]);
2251
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "drawer-sort-content", children: [
2252
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
2253
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "text-sm text-theme-muted", children: [
2462
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "drawer-sort-content", children: [
2463
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { children: [
2464
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "text-sm text-theme-muted", children: [
2254
2465
  sorting.length,
2255
2466
  " ",
2256
2467
  translations.sort,
2257
2468
  "(s) active"
2258
2469
  ] }),
2259
- sorting.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2470
+ sorting.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2260
2471
  "button",
2261
2472
  {
2262
2473
  onClick: handleClearAll,
@@ -2265,17 +2476,17 @@ function SortContent() {
2265
2476
  }
2266
2477
  )
2267
2478
  ] }),
2268
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "space-y-2", children: columns.filter((col) => col.sortable !== false).map((col) => {
2479
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "space-y-2", children: columns.filter((col) => col.sortable !== false).map((col) => {
2269
2480
  const sortItem = sorting.find((s) => s.columnId === col.id);
2270
2481
  const headerText = typeof col.header === "string" ? col.header : col.id;
2271
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
2482
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2272
2483
  "button",
2273
2484
  {
2274
2485
  onClick: () => actions.toggleSorting(col.id),
2275
2486
  className: `w-full px-3 py-2 rounded ${sortItem ? "active" : ""}`,
2276
2487
  children: [
2277
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-sm text-theme-primary", children: headerText }),
2278
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-xs text-theme-muted", children: (sortItem == null ? void 0 : sortItem.direction) === "asc" ? translations.sortAsc : (sortItem == null ? void 0 : sortItem.direction) === "desc" ? translations.sortDesc : "-" })
2488
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-sm text-theme-primary", children: headerText }),
2489
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-xs text-theme-muted", children: (sortItem == null ? void 0 : sortItem.direction) === "asc" ? translations.sortAsc : (sortItem == null ? void 0 : sortItem.direction) === "desc" ? translations.sortDesc : "-" })
2279
2490
  ]
2280
2491
  },
2281
2492
  col.id
@@ -2286,10 +2497,10 @@ function SortContent() {
2286
2497
  function ColumnsContent() {
2287
2498
  const { state, actions } = useTableContext();
2288
2499
  const { translations, columns, columnStates } = state;
2289
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "drawer-columns-content", children: [
2290
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
2291
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-sm text-theme-muted", children: translations.showColumns }),
2292
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2500
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "drawer-columns-content", children: [
2501
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { children: [
2502
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-sm text-theme-muted", children: translations.showColumns }),
2503
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2293
2504
  "button",
2294
2505
  {
2295
2506
  onClick: actions.resetColumns,
@@ -2298,16 +2509,16 @@ function ColumnsContent() {
2298
2509
  }
2299
2510
  )
2300
2511
  ] }),
2301
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "space-y-2", children: columns.map((col) => {
2512
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "space-y-2", children: columns.map((col) => {
2302
2513
  const colState = columnStates.find((cs) => cs.id === col.id);
2303
2514
  const isVisible = (colState == null ? void 0 : colState.visible) !== false;
2304
2515
  const headerText = typeof col.header === "string" ? col.header : col.id;
2305
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
2516
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2306
2517
  "label",
2307
2518
  {
2308
2519
  className: "px-3 py-2 rounded cursor-pointer",
2309
2520
  children: [
2310
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2521
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2311
2522
  "input",
2312
2523
  {
2313
2524
  type: "checkbox",
@@ -2316,7 +2527,7 @@ function ColumnsContent() {
2316
2527
  className: "w-4 h-4 rounded"
2317
2528
  }
2318
2529
  ),
2319
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-sm text-theme-primary", children: headerText })
2530
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-sm text-theme-primary", children: headerText })
2320
2531
  ]
2321
2532
  },
2322
2533
  col.id
@@ -2358,8 +2569,8 @@ function MobileDrawer({
2358
2569
  if (!isOpen || !content) {
2359
2570
  return null;
2360
2571
  }
2361
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: `mobile-drawer-container ${className}`, style, children: [
2362
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2572
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: `mobile-drawer-container ${className}`, style, children: [
2573
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2363
2574
  "div",
2364
2575
  {
2365
2576
  className: "mobile-drawer-overlay",
@@ -2371,7 +2582,7 @@ function MobileDrawer({
2371
2582
  "aria-hidden": "true"
2372
2583
  }
2373
2584
  ),
2374
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
2585
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2375
2586
  "div",
2376
2587
  {
2377
2588
  className: "mobile-drawer",
@@ -2382,11 +2593,11 @@ function MobileDrawer({
2382
2593
  "aria-modal": "true",
2383
2594
  "aria-labelledby": "drawer-title",
2384
2595
  children: [
2385
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DrawerHeader, { title: DRAWER_TITLES[content], onClose }),
2386
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "drawer-content", children: [
2387
- content === "filter" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FilterContent, {}),
2388
- content === "sort" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SortContent, {}),
2389
- content === "columns" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ColumnsContent, {})
2596
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(DrawerHeader, { title: DRAWER_TITLES[content], onClose }),
2597
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "drawer-content", children: [
2598
+ content === "filter" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(FilterContent, {}),
2599
+ content === "sort" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SortContent, {}),
2600
+ content === "columns" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ColumnsContent, {})
2390
2601
  ] })
2391
2602
  ]
2392
2603
  }
@@ -2395,7 +2606,7 @@ function MobileDrawer({
2395
2606
  }
2396
2607
 
2397
2608
  // src/components/GridTable/GridTable.tsx
2398
- var import_jsx_runtime11 = require("react/jsx-runtime");
2609
+ var import_jsx_runtime12 = require("react/jsx-runtime");
2399
2610
  function GridTableContent({
2400
2611
  data,
2401
2612
  columns,
@@ -2433,10 +2644,18 @@ function GridTableContent({
2433
2644
  renderHeader,
2434
2645
  renderFooter,
2435
2646
  className = "",
2436
- style
2647
+ style,
2648
+ showOverflowTooltip,
2649
+ enableCellAutoSizeOnDoubleClick,
2650
+ subCellExpandTrigger,
2651
+ expandRowOnDoubleClick,
2652
+ themeMode,
2653
+ paginationConfig
2437
2654
  }) {
2655
+ var _a, _b;
2438
2656
  const { state, actions, computed } = useTableContext();
2439
2657
  const { shouldShowMobileView, breakpointValue } = useBreakpoint();
2658
+ const themeClass = themeMode === "dark" ? "dark" : themeMode === "light" ? "light" : void 0;
2440
2659
  const getRowIdFn = (0, import_react15.useCallback)(
2441
2660
  (row) => {
2442
2661
  if (getRowId) return getRowId(row);
@@ -2465,6 +2684,22 @@ function GridTableContent({
2465
2684
  },
2466
2685
  [actions]
2467
2686
  );
2687
+ const handleRowDoubleClick = (0, import_react15.useCallback)(
2688
+ (row, index) => {
2689
+ if (expandRowOnDoubleClick) {
2690
+ actions.toggleRowExpansion(getRowIdFn(row));
2691
+ }
2692
+ onRowDoubleClick == null ? void 0 : onRowDoubleClick(row, index);
2693
+ },
2694
+ [expandRowOnDoubleClick, actions, getRowIdFn, onRowDoubleClick]
2695
+ );
2696
+ const handleSelectAll = (0, import_react15.useCallback)(() => {
2697
+ if (computed.allSelected) {
2698
+ actions.deselectAll();
2699
+ } else {
2700
+ actions.selectAll();
2701
+ }
2702
+ }, [computed.allSelected, actions]);
2468
2703
  const handleFilterOpen = (0, import_react15.useCallback)(
2469
2704
  (columnId) => {
2470
2705
  if (shouldShowMobileView) {
@@ -2494,14 +2729,14 @@ function GridTableContent({
2494
2729
  if (error) {
2495
2730
  const errorMessage = typeof error === "string" ? error : error.message;
2496
2731
  if (errorContent) {
2497
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: `grid-table-error ${classNames.root || ""} ${className}`, style: containerStyle, children: typeof errorContent === "function" ? errorContent(error) : errorContent });
2732
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: `grid-table-error ${classNames.root || ""} ${className}`, style: containerStyle, children: typeof errorContent === "function" ? errorContent(error) : errorContent });
2498
2733
  }
2499
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: `grid-table-error ${classNames.root || ""} ${className}`, style: containerStyle, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2734
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: `grid-table-error ${classNames.root || ""} ${className}`, style: containerStyle, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2500
2735
  EmptyState,
2501
2736
  {
2502
2737
  title: state.translations.errorLoading,
2503
2738
  description: errorMessage,
2504
- action: onRetry && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2739
+ action: onRetry && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2505
2740
  "button",
2506
2741
  {
2507
2742
  onClick: onRetry,
@@ -2514,9 +2749,9 @@ function GridTableContent({
2514
2749
  }
2515
2750
  if (loading) {
2516
2751
  if (loadingContent) {
2517
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: `grid-table-loading ${classNames.root || ""} ${className}`, style: containerStyle, children: loadingContent });
2752
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: `grid-table-loading ${classNames.root || ""} ${className}`, style: containerStyle, children: loadingContent });
2518
2753
  }
2519
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: `grid-table-loading ${classNames.root || ""} ${className}`, style: containerStyle, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2754
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: `grid-table-loading ${classNames.root || ""} ${className}`, style: containerStyle, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2520
2755
  Skeleton,
2521
2756
  {
2522
2757
  rows: 5,
@@ -2530,17 +2765,17 @@ function GridTableContent({
2530
2765
  ) });
2531
2766
  }
2532
2767
  const isEmpty = computed.paginatedData.length === 0;
2533
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2768
+ const tableContent = /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2534
2769
  "div",
2535
2770
  {
2536
2771
  className: `grid-table rounded-lg border overflow-hidden ${classNames.root || ""} ${className}`,
2537
2772
  style: containerStyle,
2538
2773
  role: "table",
2539
2774
  children: [
2540
- renderHeader && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "grid-table-custom-header", children: renderHeader() }),
2541
- showGlobalFilter && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "grid-table-toolbar", children: [
2542
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "toolbar-search-wrapper", children: [
2543
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2775
+ renderHeader && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "grid-table-custom-header", children: renderHeader() }),
2776
+ showGlobalFilter && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "grid-table-toolbar", children: [
2777
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "toolbar-search-wrapper", children: [
2778
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2544
2779
  "svg",
2545
2780
  {
2546
2781
  className: "search-icon",
@@ -2548,10 +2783,10 @@ function GridTableContent({
2548
2783
  viewBox: "0 0 24 24",
2549
2784
  stroke: "currentColor",
2550
2785
  strokeWidth: 2,
2551
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" })
2786
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" })
2552
2787
  }
2553
2788
  ),
2554
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2789
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2555
2790
  "input",
2556
2791
  {
2557
2792
  type: "text",
@@ -2561,24 +2796,24 @@ function GridTableContent({
2561
2796
  className: "w-full pl-10 pr-3 py-2 text-sm rounded"
2562
2797
  }
2563
2798
  ),
2564
- state.globalFilter && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2799
+ state.globalFilter && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2565
2800
  "button",
2566
2801
  {
2567
2802
  onClick: () => actions.setGlobalFilter(""),
2568
2803
  className: "clear-button",
2569
2804
  "aria-label": "Clear search",
2570
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("svg", { className: "icon-md", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" }) })
2805
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("svg", { className: "icon-md", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" }) })
2571
2806
  }
2572
2807
  )
2573
2808
  ] }),
2574
- state.filters.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2809
+ state.filters.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2575
2810
  "button",
2576
2811
  {
2577
2812
  onClick: () => actions.clearFilters(),
2578
2813
  className: "filter-badge",
2579
2814
  children: [
2580
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("svg", { className: "icon-md", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" }) }),
2581
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { children: [
2815
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("svg", { className: "icon-md", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" }) }),
2816
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { children: [
2582
2817
  state.filters.length,
2583
2818
  " filter",
2584
2819
  state.filters.length > 1 ? "s" : ""
@@ -2586,38 +2821,38 @@ function GridTableContent({
2586
2821
  ]
2587
2822
  }
2588
2823
  ),
2589
- shouldShowMobileView && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "toolbar-actions", children: [
2590
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2824
+ shouldShowMobileView && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "toolbar-actions", children: [
2825
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2591
2826
  "button",
2592
2827
  {
2593
2828
  onClick: () => actions.openMobileDrawer("filter"),
2594
2829
  className: "toolbar-action-button",
2595
2830
  "aria-label": state.translations.filter,
2596
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("svg", { className: "icon-md", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z" }) })
2831
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("svg", { className: "icon-md", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z" }) })
2597
2832
  }
2598
2833
  ),
2599
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2834
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2600
2835
  "button",
2601
2836
  {
2602
2837
  onClick: () => actions.openMobileDrawer("sort"),
2603
2838
  className: "toolbar-action-button",
2604
2839
  "aria-label": state.translations.sort,
2605
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("svg", { className: "icon-md", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4" }) })
2840
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("svg", { className: "icon-md", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4" }) })
2606
2841
  }
2607
2842
  ),
2608
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2843
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2609
2844
  "button",
2610
2845
  {
2611
2846
  onClick: () => actions.openMobileDrawer("columns"),
2612
2847
  className: "toolbar-action-button",
2613
2848
  "aria-label": state.translations.columns,
2614
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("svg", { className: "icon-md", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 17V7m0 10a2 2 0 01-2 2H5a2 2 0 01-2-2V7a2 2 0 012-2h2a2 2 0 012 2m0 10a2 2 0 002 2h2a2 2 0 002-2M9 7a2 2 0 012-2h2a2 2 0 012 2m0 10V7m0 10a2 2 0 002 2h2a2 2 0 002-2V7a2 2 0 00-2-2h-2a2 2 0 00-2 2" }) })
2849
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("svg", { className: "icon-md", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 17V7m0 10a2 2 0 01-2 2H5a2 2 0 01-2-2V7a2 2 0 012-2h2a2 2 0 012 2m0 10a2 2 0 002 2h2a2 2 0 002-2M9 7a2 2 0 012-2h2a2 2 0 012 2m0 10V7m0 10a2 2 0 002 2h2a2 2 0 002-2V7a2 2 0 00-2-2h-2a2 2 0 00-2 2" }) })
2615
2850
  }
2616
2851
  )
2617
2852
  ] })
2618
2853
  ] }),
2619
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "grid-table-container overflow-auto", children: [
2620
- !shouldShowMobileView && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2854
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "grid-table-container overflow-auto", children: [
2855
+ !shouldShowMobileView && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2621
2856
  GridHeader,
2622
2857
  {
2623
2858
  columns,
@@ -2630,24 +2865,25 @@ function GridTableContent({
2630
2865
  enableDragDrop,
2631
2866
  enableResize: enableColumnResize,
2632
2867
  enableSelection: enableRowSelection,
2868
+ enableExpansion: enableRowExpansion,
2633
2869
  allSelected: computed.allSelected,
2634
2870
  someSelected: computed.someSelected,
2635
- onSelectAll: actions.selectAll,
2871
+ onSelectAll: handleSelectAll,
2636
2872
  onFilterOpen: handleFilterOpen,
2637
2873
  getSortDirection: (colId) => {
2638
- var _a;
2874
+ var _a2;
2639
2875
  const sort = state.sorting.find((s) => s.columnId === colId);
2640
- return (_a = sort == null ? void 0 : sort.direction) != null ? _a : null;
2876
+ return (_a2 = sort == null ? void 0 : sort.direction) != null ? _a2 : null;
2641
2877
  }
2642
2878
  }
2643
2879
  ),
2644
- isEmpty ? emptyContent || /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2880
+ isEmpty ? emptyContent || /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2645
2881
  EmptyState,
2646
2882
  {
2647
2883
  className: classNames.empty,
2648
2884
  style: styles.empty
2649
2885
  }
2650
- ) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2886
+ ) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2651
2887
  GridBody,
2652
2888
  {
2653
2889
  data: computed.paginatedData,
@@ -2662,7 +2898,7 @@ function GridTableContent({
2662
2898
  selectedIds: state.selectedIds,
2663
2899
  expandedIds: state.expandedIds,
2664
2900
  onRowClick,
2665
- onRowDoubleClick,
2901
+ onRowDoubleClick: handleRowDoubleClick,
2666
2902
  onCellClick,
2667
2903
  onRowSelect: handleRowSelect,
2668
2904
  onRowExpand: handleRowExpand,
@@ -2674,27 +2910,50 @@ function GridTableContent({
2674
2910
  }
2675
2911
  )
2676
2912
  ] }),
2677
- showPagination && !isEmpty && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2678
- Pagination,
2679
- {
2680
- page: state.page,
2681
- pageSize: state.pageSize,
2682
- totalItems: computed.sortedData.length,
2683
- totalPages: computed.totalPages,
2684
- className: classNames.pagination,
2685
- style: styles.pagination,
2686
- onPageChange: (page) => {
2687
- actions.setPage(page);
2688
- onPageChange == null ? void 0 : onPageChange(page, state.pageSize);
2689
- },
2690
- onPageSizeChange: (pageSize) => {
2691
- actions.setPageSize(pageSize);
2692
- onPageChange == null ? void 0 : onPageChange(1, pageSize);
2913
+ showPagination && !isEmpty && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: `grid-pagination ${(_a = classNames.pagination) != null ? _a : ""}`, style: styles.pagination, role: "navigation", "aria-label": "Pagination", children: [
2914
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "grid-pagination-info", children: [
2915
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_bear5.Typography, { component: "span", variant: "body2", color: "secondary", children: [
2916
+ (state.page - 1) * state.pageSize + 1,
2917
+ "-",
2918
+ Math.min(state.page * state.pageSize, computed.sortedData.length),
2919
+ " ",
2920
+ state.translations.of,
2921
+ " ",
2922
+ computed.sortedData.length
2923
+ ] }),
2924
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_bear5.Typography, { component: "span", variant: "caption", color: "secondary", className: "bear-sr-only", children: state.translations.rowsPerPage }),
2925
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2926
+ import_bear5.Select,
2927
+ {
2928
+ value: String(state.pageSize),
2929
+ onChange: (value) => {
2930
+ const pageSize = Number(value);
2931
+ actions.setPageSize(pageSize);
2932
+ onPageChange == null ? void 0 : onPageChange(1, pageSize);
2933
+ },
2934
+ options: ((_b = paginationConfig == null ? void 0 : paginationConfig.pageSizeOptions) != null ? _b : [10, 20, 50, 100]).map((size) => ({ value: String(size), label: String(size) })),
2935
+ size: "sm"
2936
+ }
2937
+ )
2938
+ ] }),
2939
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "grid-pagination-controls", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2940
+ import_bear5.Pagination,
2941
+ {
2942
+ count: Math.max(1, computed.totalPages),
2943
+ page: state.page,
2944
+ onChange: (page) => {
2945
+ actions.setPage(page);
2946
+ onPageChange == null ? void 0 : onPageChange(page, state.pageSize);
2947
+ },
2948
+ showFirstLast: true,
2949
+ showPrevNext: true,
2950
+ size: "sm",
2951
+ variant: "outlined"
2693
2952
  }
2694
- }
2695
- ),
2696
- renderFooter && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "grid-table-custom-footer", children: renderFooter() }),
2697
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2953
+ ) })
2954
+ ] }),
2955
+ renderFooter && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "grid-table-custom-footer", children: renderFooter() }),
2956
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2698
2957
  MobileDrawer,
2699
2958
  {
2700
2959
  isOpen: state.showMobileDrawer,
@@ -2707,6 +2966,10 @@ function GridTableContent({
2707
2966
  ]
2708
2967
  }
2709
2968
  );
2969
+ if (themeClass) {
2970
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: themeClass, children: tableContent });
2971
+ }
2972
+ return tableContent;
2710
2973
  }
2711
2974
  function GridTable({
2712
2975
  data,
@@ -2721,12 +2984,26 @@ function GridTable({
2721
2984
  sortConfig,
2722
2985
  enableMultiSelect = false,
2723
2986
  getRowId,
2987
+ showOverflowTooltip,
2988
+ enableCellAutoSizeOnDoubleClick,
2989
+ subCellExpandTrigger,
2990
+ expandRowOnDoubleClick,
2991
+ themeMode,
2992
+ themeOverride,
2993
+ studio = false,
2724
2994
  ...props
2725
2995
  }) {
2726
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2996
+ var _a, _b;
2997
+ const [studioData, setStudioData] = (0, import_react15.useState)(data);
2998
+ const [studioOpen, setStudioOpen] = (0, import_react15.useState)(true);
2999
+ (0, import_react15.useEffect)(() => {
3000
+ if (studio) setStudioData(data);
3001
+ }, [data, studio]);
3002
+ const effectiveData = studio ? studioData : data;
3003
+ const tableContent = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2727
3004
  TableProvider,
2728
3005
  {
2729
- data,
3006
+ data: effectiveData,
2730
3007
  columns,
2731
3008
  loading,
2732
3009
  error,
@@ -2739,19 +3016,223 @@ function GridTable({
2739
3016
  enableMultiSort: sortConfig == null ? void 0 : sortConfig.multiSort,
2740
3017
  enableMultiSelect,
2741
3018
  getRowId,
2742
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3019
+ showOverflowTooltip,
3020
+ enableCellAutoSizeOnDoubleClick,
3021
+ subCellExpandTrigger,
3022
+ expandRowOnDoubleClick,
3023
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2743
3024
  GridTableContent,
2744
3025
  {
2745
- data,
3026
+ data: effectiveData,
2746
3027
  columns,
2747
3028
  loading,
2748
3029
  error,
2749
3030
  getRowId,
3031
+ themeMode,
3032
+ paginationConfig,
2750
3033
  ...props
2751
3034
  }
2752
3035
  )
2753
3036
  }
2754
3037
  );
3038
+ const withTheme = themeOverride && Object.keys(themeOverride).length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_bear5.BearProvider, { theme: themeOverride, defaultMode: themeMode === "dark" ? "dark" : "light", children: tableContent }) : tableContent;
3039
+ if (studio) {
3040
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
3041
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "grid-table-studio-main", style: { width: "100%" }, children: withTheme }),
3042
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3043
+ TableStudioPanel,
3044
+ {
3045
+ data: studioData,
3046
+ columns,
3047
+ propsSnapshot: {
3048
+ themeMode,
3049
+ themeOverride,
3050
+ showPagination: (_a = props.showPagination) != null ? _a : true,
3051
+ showGlobalFilter: (_b = props.showGlobalFilter) != null ? _b : true,
3052
+ enableRowSelection: props.enableRowSelection,
3053
+ enableRowExpansion: props.enableRowExpansion
3054
+ },
3055
+ onDataChange: setStudioData,
3056
+ open: studioOpen,
3057
+ onOpenChange: setStudioOpen
3058
+ }
3059
+ )
3060
+ ] });
3061
+ }
3062
+ return withTheme;
3063
+ }
3064
+
3065
+ // src/components/Pagination/Pagination.tsx
3066
+ var import_react16 = require("react");
3067
+ var import_jsx_runtime13 = require("react/jsx-runtime");
3068
+ function Pagination({
3069
+ page,
3070
+ pageSize,
3071
+ totalItems,
3072
+ totalPages,
3073
+ pageSizeOptions = [10, 20, 50, 100],
3074
+ showFirstLast = true,
3075
+ showPageNumbers = true,
3076
+ maxPageButtons = FIVE,
3077
+ className = "",
3078
+ style,
3079
+ onPageChange,
3080
+ onPageSizeChange
3081
+ }) {
3082
+ const { state } = useTableContext();
3083
+ const { translations } = state;
3084
+ const canGoPrevious = page > ONE;
3085
+ const canGoNext = page < totalPages;
3086
+ const startItem = (page - ONE) * pageSize + ONE;
3087
+ const endItem = Math.min(page * pageSize, totalItems);
3088
+ const handleFirstPage = (0, import_react16.useCallback)(() => {
3089
+ onPageChange(ONE);
3090
+ }, [onPageChange]);
3091
+ const handlePreviousPage = (0, import_react16.useCallback)(() => {
3092
+ if (canGoPrevious) {
3093
+ onPageChange(page - ONE);
3094
+ }
3095
+ }, [canGoPrevious, page, onPageChange]);
3096
+ const handleNextPage = (0, import_react16.useCallback)(() => {
3097
+ if (canGoNext) {
3098
+ onPageChange(page + ONE);
3099
+ }
3100
+ }, [canGoNext, page, onPageChange]);
3101
+ const handleLastPage = (0, import_react16.useCallback)(() => {
3102
+ onPageChange(totalPages);
3103
+ }, [onPageChange, totalPages]);
3104
+ const handlePageSizeChange = (0, import_react16.useCallback)(
3105
+ (event) => {
3106
+ onPageSizeChange(Number(event.target.value));
3107
+ },
3108
+ [onPageSizeChange]
3109
+ );
3110
+ const pageNumbers = (0, import_react16.useMemo)(() => {
3111
+ if (!showPageNumbers || totalPages <= ONE) return [];
3112
+ const pages = [];
3113
+ const halfMax = Math.floor(maxPageButtons / 2);
3114
+ let start = Math.max(ONE, page - halfMax);
3115
+ let end = Math.min(totalPages, page + halfMax);
3116
+ if (page <= halfMax) {
3117
+ end = Math.min(totalPages, maxPageButtons);
3118
+ }
3119
+ if (page > totalPages - halfMax) {
3120
+ start = Math.max(ONE, totalPages - maxPageButtons + ONE);
3121
+ }
3122
+ if (start > ONE) {
3123
+ pages.push(ONE);
3124
+ if (start > 2) {
3125
+ pages.push("ellipsis");
3126
+ }
3127
+ }
3128
+ for (let i = start; i <= end; i++) {
3129
+ if (!pages.includes(i)) {
3130
+ pages.push(i);
3131
+ }
3132
+ }
3133
+ if (end < totalPages) {
3134
+ if (end < totalPages - ONE) {
3135
+ pages.push("ellipsis");
3136
+ }
3137
+ pages.push(totalPages);
3138
+ }
3139
+ return pages;
3140
+ }, [page, totalPages, showPageNumbers, maxPageButtons]);
3141
+ if (totalItems === 0) {
3142
+ return null;
3143
+ }
3144
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
3145
+ "div",
3146
+ {
3147
+ className: `grid-pagination ${className}`,
3148
+ style,
3149
+ role: "navigation",
3150
+ "aria-label": "Pagination",
3151
+ children: [
3152
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "grid-pagination-info", children: [
3153
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "grid-pagination-range", children: [
3154
+ startItem,
3155
+ "-",
3156
+ endItem,
3157
+ " ",
3158
+ translations.of,
3159
+ " ",
3160
+ totalItems
3161
+ ] }),
3162
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "grid-pagination-size", children: [
3163
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { htmlFor: "page-size", children: [
3164
+ translations.rowsPerPage,
3165
+ ":"
3166
+ ] }),
3167
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3168
+ "select",
3169
+ {
3170
+ id: "page-size",
3171
+ value: pageSize,
3172
+ onChange: handlePageSizeChange,
3173
+ className: "px-2 py-1 text-sm rounded",
3174
+ children: pageSizeOptions.map((size) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: size, children: size }, size))
3175
+ }
3176
+ )
3177
+ ] })
3178
+ ] }),
3179
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "grid-pagination-controls", children: [
3180
+ showFirstLast && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3181
+ "button",
3182
+ {
3183
+ onClick: handleFirstPage,
3184
+ disabled: !canGoPrevious,
3185
+ className: "p-2 rounded text-theme-secondary",
3186
+ "aria-label": translations.first,
3187
+ children: "<<"
3188
+ }
3189
+ ),
3190
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3191
+ "button",
3192
+ {
3193
+ onClick: handlePreviousPage,
3194
+ disabled: !canGoPrevious,
3195
+ className: "p-2 rounded text-theme-secondary",
3196
+ "aria-label": translations.previous,
3197
+ children: "<"
3198
+ }
3199
+ ),
3200
+ showPageNumbers && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "grid-pagination-pages", children: pageNumbers.map(
3201
+ (pageNum, index) => pageNum === "ellipsis" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "px-2 text-theme-muted", children: "..." }, `ellipsis-${index}`) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3202
+ "button",
3203
+ {
3204
+ onClick: () => onPageChange(pageNum),
3205
+ className: `min-w-[32px] h-8 px-2 rounded text-sm ${pageNum === page ? "active" : ""}`,
3206
+ "aria-current": pageNum === page ? "page" : void 0,
3207
+ children: pageNum
3208
+ },
3209
+ pageNum
3210
+ )
3211
+ ) }),
3212
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3213
+ "button",
3214
+ {
3215
+ onClick: handleNextPage,
3216
+ disabled: !canGoNext,
3217
+ className: "p-2 rounded text-theme-secondary",
3218
+ "aria-label": translations.next,
3219
+ children: ">"
3220
+ }
3221
+ ),
3222
+ showFirstLast && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3223
+ "button",
3224
+ {
3225
+ onClick: handleLastPage,
3226
+ disabled: !canGoNext,
3227
+ className: "p-2 rounded text-theme-secondary",
3228
+ "aria-label": translations.last,
3229
+ children: ">>"
3230
+ }
3231
+ )
3232
+ ] })
3233
+ ]
3234
+ }
3235
+ );
2755
3236
  }
2756
3237
  // Annotate the CommonJS export names for ESM import in node:
2757
3238
  0 && (module.exports = {