@stereopt/data-table 0.1.3 → 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 +8 -5
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +12 -6
- package/package.json +4 -1
package/dist/index.cjs
CHANGED
|
@@ -26,12 +26,15 @@ __export(index_exports, {
|
|
|
26
26
|
module.exports = __toCommonJS(index_exports);
|
|
27
27
|
|
|
28
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({ data }) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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) }) }) });
|
|
35
38
|
}
|
|
36
39
|
// Annotate the CommonJS export names for ESM import in node:
|
|
37
40
|
0 && (module.exports = {
|
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ColumnDef } from '@tanstack/react-table';
|
|
2
3
|
|
|
3
4
|
interface DataTableProps<TData, TValue> {
|
|
5
|
+
columns: ColumnDef<TData, TValue>[];
|
|
4
6
|
data: TData[];
|
|
5
7
|
}
|
|
6
|
-
declare function DataTable<TData, TValue>({ data }: DataTableProps<TData, TValue>): react_jsx_runtime.JSX.Element;
|
|
8
|
+
declare function DataTable<TData, TValue>({ columns, data }: DataTableProps<TData, TValue>): react_jsx_runtime.JSX.Element;
|
|
7
9
|
|
|
8
10
|
export { DataTable, type DataTableProps, DataTable as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ColumnDef } from '@tanstack/react-table';
|
|
2
3
|
|
|
3
4
|
interface DataTableProps<TData, TValue> {
|
|
5
|
+
columns: ColumnDef<TData, TValue>[];
|
|
4
6
|
data: TData[];
|
|
5
7
|
}
|
|
6
|
-
declare function DataTable<TData, TValue>({ data }: DataTableProps<TData, TValue>): react_jsx_runtime.JSX.Element;
|
|
8
|
+
declare function DataTable<TData, TValue>({ columns, data }: DataTableProps<TData, TValue>): react_jsx_runtime.JSX.Element;
|
|
7
9
|
|
|
8
10
|
export { DataTable, type DataTableProps, DataTable as default };
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
// src/dataTable/DataTable.tsx
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import {
|
|
3
|
+
getCoreRowModel,
|
|
4
|
+
useReactTable
|
|
5
|
+
} from "@tanstack/react-table";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
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) }) }) });
|
|
8
14
|
}
|
|
9
15
|
export {
|
|
10
16
|
DataTable,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stereopt/data-table",
|
|
3
|
-
"version": "0.1.
|
|
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
|
}
|