@marcoschwartz/lite-ui 0.24.13 → 0.24.14

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
@@ -288,8 +288,9 @@ interface TableProps<T = any> {
288
288
  hoverable?: boolean;
289
289
  className?: string;
290
290
  responsive?: boolean;
291
+ onRowClick?: (row: T, index: number) => void;
291
292
  }
292
- declare function Table<T extends Record<string, any>>({ columns, data, keyField, striped, hoverable, className, responsive, }: TableProps<T>): react_jsx_runtime.JSX.Element;
293
+ declare function Table<T extends Record<string, any>>({ columns, data, keyField, striped, hoverable, className, responsive, onRowClick, }: TableProps<T>): react_jsx_runtime.JSX.Element;
293
294
 
294
295
  interface PaginationProps {
295
296
  currentPage: number;
package/dist/index.d.ts CHANGED
@@ -288,8 +288,9 @@ interface TableProps<T = any> {
288
288
  hoverable?: boolean;
289
289
  className?: string;
290
290
  responsive?: boolean;
291
+ onRowClick?: (row: T, index: number) => void;
291
292
  }
292
- declare function Table<T extends Record<string, any>>({ columns, data, keyField, striped, hoverable, className, responsive, }: TableProps<T>): react_jsx_runtime.JSX.Element;
293
+ declare function Table<T extends Record<string, any>>({ columns, data, keyField, striped, hoverable, className, responsive, onRowClick, }: TableProps<T>): react_jsx_runtime.JSX.Element;
293
294
 
294
295
  interface PaginationProps {
295
296
  currentPage: number;
package/dist/index.js CHANGED
@@ -2343,7 +2343,8 @@ function Table({
2343
2343
  striped = false,
2344
2344
  hoverable = true,
2345
2345
  className = "",
2346
- responsive = true
2346
+ responsive = true,
2347
+ onRowClick
2347
2348
  }) {
2348
2349
  return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className, children: [
2349
2350
  /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: `${responsive ? "hidden md:block" : ""} overflow-x-auto`, children: [
@@ -2363,12 +2364,14 @@ function Table({
2363
2364
  /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("tbody", { className: "bg-[hsl(var(--card))] divide-y divide-[hsl(var(--border))]", children: data.map((row, rowIndex) => {
2364
2365
  const rowClasses = [
2365
2366
  striped && rowIndex % 2 === 1 ? "bg-[hsl(var(--muted))]/50" : "",
2366
- hoverable ? "hover:bg-[hsl(var(--muted))] transition-colors" : ""
2367
+ hoverable ? "hover:bg-[hsl(var(--muted))] transition-colors" : "",
2368
+ onRowClick ? "cursor-pointer" : ""
2367
2369
  ].filter(Boolean).join(" ");
2368
2370
  return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
2369
2371
  "tr",
2370
2372
  {
2371
2373
  className: rowClasses,
2374
+ onClick: onRowClick ? () => onRowClick(row, rowIndex) : void 0,
2372
2375
  children: columns.map((column, colIndex) => {
2373
2376
  const isLast = colIndex === columns.length - 1;
2374
2377
  return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
@@ -2392,6 +2395,7 @@ function Table({
2392
2395
  const cardClasses = [
2393
2396
  "bg-[hsl(var(--card))] border border-[hsl(var(--border))] rounded-[--radius] p-4 shadow-sm",
2394
2397
  hoverable ? "hover:shadow-md transition-shadow" : "",
2398
+ onRowClick ? "cursor-pointer" : "",
2395
2399
  "relative isolate"
2396
2400
  // Ensure cards are isolated layers
2397
2401
  ].filter(Boolean).join(" ");
@@ -2399,6 +2403,7 @@ function Table({
2399
2403
  "div",
2400
2404
  {
2401
2405
  className: cardClasses,
2406
+ onClick: onRowClick ? () => onRowClick(row, rowIndex) : void 0,
2402
2407
  children: columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
2403
2408
  "div",
2404
2409
  {