lecom-ui 2.6.9 → 2.7.0

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.
@@ -5,7 +5,8 @@ import { Table, TableHeader, TableRow, TableHead, TableBody, TableCell } from '.
5
5
  function DataTable({
6
6
  columns,
7
7
  data,
8
- noResults
8
+ noResults,
9
+ onRowSelectionChange
9
10
  }) {
10
11
  const [sorting, setSorting] = React.useState([]);
11
12
  const [rowSelection, setRowSelection] = React.useState({});
@@ -28,6 +29,9 @@ function DataTable({
28
29
  }
29
30
  return meta["style"] ?? {};
30
31
  };
32
+ React.useEffect(() => {
33
+ onRowSelectionChange?.(rowSelection);
34
+ }, [onRowSelectionChange, rowSelection]);
31
35
  return /* @__PURE__ */ React.createElement("div", { className: "bg-white rounded-[8px] py-0 px-2 pb-2" }, /* @__PURE__ */ React.createElement(Table, null, /* @__PURE__ */ React.createElement(TableHeader, { className: "[&_tr]:border-b-[1.5px] [&_tr]:border-grey-400" }, table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ React.createElement(TableRow, { key: headerGroup.id }, headerGroup.headers.map((header) => /* @__PURE__ */ React.createElement(
32
36
  TableHead,
33
37
  {
package/dist/index.d.ts CHANGED
@@ -243,8 +243,11 @@ interface DataTableProps<TData, TValue> {
243
243
  columns: ColumnDef<TData, TValue>[];
244
244
  data: TData[];
245
245
  noResults?: React.ReactNode;
246
+ onRowSelectionChange?: (rowSelection: {
247
+ [key: string]: string;
248
+ }) => void;
246
249
  }
247
- declare function DataTable<TData, TValue>({ columns, data, noResults, }: DataTableProps<TData, TValue>): React.JSX.Element;
250
+ declare function DataTable<TData, TValue>({ columns, data, noResults, onRowSelectionChange, }: DataTableProps<TData, TValue>): React.JSX.Element;
248
251
 
249
252
  declare const Dialog: React.FC<DialogPrimitive.DialogProps>;
250
253
  declare const DialogTrigger: React.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lecom-ui",
3
- "version": "2.6.9",
3
+ "version": "2.7.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "dist/index.js",