@stereopt/data-table 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -25,10 +25,16 @@ __export(index_exports, {
25
25
  });
26
26
  module.exports = __toCommonJS(index_exports);
27
27
 
28
- // src/DataTable.tsx
28
+ // src/dataTable/DataTable.tsx
29
+ var import_react_table = require("@tanstack/react-table");
29
30
  var import_jsx_runtime = require("react/jsx-runtime");
30
- function DataTable() {
31
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: "Data Table" });
31
+ function DataTable({ columns, data }) {
32
+ const table = (0, import_react_table.useReactTable)({
33
+ data,
34
+ columns,
35
+ getCoreRowModel: (0, import_react_table.getCoreRowModel)()
36
+ });
37
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", { children: JSON.stringify(table, null, 2) }) }) });
32
38
  }
33
39
  // Annotate the CommonJS export names for ESM import in node:
34
40
  0 && (module.exports = {
package/dist/index.d.cts CHANGED
@@ -1,5 +1,10 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ColumnDef } from '@tanstack/react-table';
2
3
 
3
- declare function DataTable(): react_jsx_runtime.JSX.Element;
4
+ interface DataTableProps<TData, TValue> {
5
+ columns: ColumnDef<TData, TValue>[];
6
+ data: TData[];
7
+ }
8
+ declare function DataTable<TData, TValue>({ columns, data }: DataTableProps<TData, TValue>): react_jsx_runtime.JSX.Element;
4
9
 
5
- export { DataTable, DataTable as default };
10
+ export { DataTable, type DataTableProps, DataTable as default };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,10 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ColumnDef } from '@tanstack/react-table';
2
3
 
3
- declare function DataTable(): react_jsx_runtime.JSX.Element;
4
+ interface DataTableProps<TData, TValue> {
5
+ columns: ColumnDef<TData, TValue>[];
6
+ data: TData[];
7
+ }
8
+ declare function DataTable<TData, TValue>({ columns, data }: DataTableProps<TData, TValue>): react_jsx_runtime.JSX.Element;
4
9
 
5
- export { DataTable, DataTable as default };
10
+ export { DataTable, type DataTableProps, DataTable as default };
package/dist/index.js CHANGED
@@ -1,7 +1,16 @@
1
- // src/DataTable.tsx
1
+ // src/dataTable/DataTable.tsx
2
+ import {
3
+ getCoreRowModel,
4
+ useReactTable
5
+ } from "@tanstack/react-table";
2
6
  import { jsx } from "react/jsx-runtime";
3
- function DataTable() {
4
- return /* @__PURE__ */ jsx("div", { children: "Data Table" });
7
+ function DataTable({ columns, data }) {
8
+ const table = useReactTable({
9
+ data,
10
+ columns,
11
+ getCoreRowModel: getCoreRowModel()
12
+ });
13
+ return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("pre", { children: JSON.stringify(table, null, 2) }) }) });
5
14
  }
6
15
  export {
7
16
  DataTable,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stereopt/data-table",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Simple reusable React data table component",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -52,5 +52,8 @@
52
52
  "@types/react-dom": "^19.2.3",
53
53
  "tsup": "^8.5.1",
54
54
  "typescript": "^5.9.3"
55
+ },
56
+ "dependencies": {
57
+ "@tanstack/react-table": "^8.21.3"
55
58
  }
56
59
  }