@colspec/react 0.1.0 → 0.1.1
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/README.md +8 -6
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -15,28 +15,30 @@ import { ColspecProvider, useContractTable } from "@colspec/react";
|
|
|
15
15
|
import { createTableRegistry } from "@colspec/tanstack";
|
|
16
16
|
|
|
17
17
|
// 1. Register the functions contracts may refer to. Do this once.
|
|
18
|
-
const registry = createTableRegistry<
|
|
19
|
-
cells: {
|
|
18
|
+
const registry = createTableRegistry<Product>({
|
|
19
|
+
cells: {
|
|
20
|
+
"inventory.statusBadge": ({ getValue }) => <Badge status={getValue()} />,
|
|
21
|
+
},
|
|
20
22
|
});
|
|
21
23
|
|
|
22
24
|
// 2. Provide the registry.
|
|
23
25
|
export function App() {
|
|
24
26
|
return (
|
|
25
27
|
<ColspecProvider registry={registry}>
|
|
26
|
-
<
|
|
28
|
+
<Products />
|
|
27
29
|
</ColspecProvider>
|
|
28
30
|
);
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
// 3. Build the table from a validated contract.
|
|
32
|
-
function
|
|
34
|
+
function Products({
|
|
33
35
|
contract,
|
|
34
36
|
data,
|
|
35
37
|
}: {
|
|
36
38
|
contract: TableContract;
|
|
37
|
-
data:
|
|
39
|
+
data: Product[];
|
|
38
40
|
}) {
|
|
39
|
-
const table = useContractTable<
|
|
41
|
+
const table = useContractTable<Product>({ contract, data });
|
|
40
42
|
|
|
41
43
|
return (
|
|
42
44
|
<table>
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@colspec/react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@tanstack/react-table": "^9.2.6",
|
|
6
6
|
"react": "^19.3.0"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@colspec/core": "0.1.
|
|
10
|
-
"@colspec/tanstack": "0.1.
|
|
9
|
+
"@colspec/core": "0.1.1",
|
|
10
|
+
"@colspec/tanstack": "0.1.1"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
13
|
"@repo/eslint-config": "0.0.0",
|