@algorithm-shift/design-system 1.2.72 → 1.2.74

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.d.mts CHANGED
@@ -306,6 +306,11 @@ interface CustomPaginationProps {
306
306
 
307
307
  type PaginationMode = 'client' | 'server';
308
308
 
309
+ interface CellClickProps {
310
+ id: string;
311
+ column: any;
312
+ }
313
+
309
314
  interface ExtendedTableProps extends TableProps {
310
315
  paginationMode?: PaginationMode;
311
316
  page?: number;
@@ -314,6 +319,7 @@ interface ExtendedTableProps extends TableProps {
314
319
  onSortChange?: (props: SortChangeProps) => void;
315
320
  onFilterChange?: (props: FilterChangeProps) => void;
316
321
  onGlobalSearch?: (props: SearchChangeProps) => void;
322
+ onCellClick?: (props: CellClickProps) => void;
317
323
  sort_by?: string;
318
324
  sort_order?: string;
319
325
  }
package/dist/index.d.ts CHANGED
@@ -306,6 +306,11 @@ interface CustomPaginationProps {
306
306
 
307
307
  type PaginationMode = 'client' | 'server';
308
308
 
309
+ interface CellClickProps {
310
+ id: string;
311
+ column: any;
312
+ }
313
+
309
314
  interface ExtendedTableProps extends TableProps {
310
315
  paginationMode?: PaginationMode;
311
316
  page?: number;
@@ -314,6 +319,7 @@ interface ExtendedTableProps extends TableProps {
314
319
  onSortChange?: (props: SortChangeProps) => void;
315
320
  onFilterChange?: (props: FilterChangeProps) => void;
316
321
  onGlobalSearch?: (props: SearchChangeProps) => void;
322
+ onCellClick?: (props: CellClickProps) => void;
317
323
  sort_by?: string;
318
324
  sort_order?: string;
319
325
  }
package/dist/index.js CHANGED
@@ -28469,7 +28469,8 @@ function DataTable({
28469
28469
  onSortChange,
28470
28470
  onFilterChange,
28471
28471
  onGlobalSearch,
28472
- globalSearch
28472
+ globalSearch,
28473
+ onCellClick
28473
28474
  }) {
28474
28475
  const [columnFilters, setColumnFilters] = React7.useState([]);
28475
28476
  const [columnVisibility, setColumnVisibility] = React7.useState({});
@@ -28682,7 +28683,24 @@ function DataTable({
28682
28683
  ] })
28683
28684
  ] }) }, header.id);
28684
28685
  }) }, hg.id)) }),
28685
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(TableBody, { children: loading ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(TableCell, { colSpan: columns.length, className: "h-24 text-center", children: "Loading..." }) }) : table.getRowModel().rows.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(TableRow, { children: row.getVisibleCells().map((cell) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(TableCell, { children: (0, import_react_table.flexRender)(cell.column.columnDef.cell, cell.getContext()) }, cell.id)) }, row.id)) : /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(TableCell, { colSpan: columns.length, className: "h-24 text-center", children: "No results." }) }) })
28686
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(TableBody, { children: loading ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(TableCell, { colSpan: columns.length, className: "h-24 text-center", children: "Loading..." }) }) : table.getRowModel().rows.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(TableRow, { children: row.getVisibleCells().map((cell) => {
28687
+ const meta = cell.column.columnDef.meta || {};
28688
+ const isClickable = meta?.isClickable;
28689
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
28690
+ TableCell,
28691
+ {
28692
+ className: `${meta?.cellClass ?? ""} ${isClickable ? "cursor-pointer hover:bg-gray-100 underline" : ""}`,
28693
+ style: meta?.cellStyle,
28694
+ onClick: () => {
28695
+ if (isClickable && onCellClick) {
28696
+ onCellClick(cell.row.original, cell.column.id);
28697
+ }
28698
+ },
28699
+ children: (0, import_react_table.flexRender)(cell.column.columnDef.cell, cell.getContext())
28700
+ },
28701
+ cell.id
28702
+ );
28703
+ }) }, row.id)) : /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(TableCell, { colSpan: columns.length, className: "h-24 text-center", children: "No results." }) }) })
28686
28704
  ] }),
28687
28705
  pagination && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex items-center justify-between py-3 px-2 text-sm w-full", children: [
28688
28706
  /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { children: [
@@ -28772,7 +28790,10 @@ var Table4 = ({
28772
28790
  onSortChange: (col, dir) => onSortChange?.({ sort_by: col, sort_order: dir }),
28773
28791
  onFilterChange: (filters) => onFilterChange?.({ columnKey: filters.columnKey, columnTerm: filters.columnTerm }),
28774
28792
  onGlobalSearch: (term) => onGlobalSearch?.({ searchTerm: term }),
28775
- globalSearch
28793
+ globalSearch,
28794
+ onCellClick: (cell) => {
28795
+ props.onCellClick?.({ id: cell.id, column: cell });
28796
+ }
28776
28797
  }
28777
28798
  ) });
28778
28799
  };