@pretable/react 0.0.1 → 0.0.2
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/LICENSE +21 -0
- package/README.md +50 -0
- package/dist/index.cjs +1605 -200
- package/dist/index.d.cts +316 -67
- package/dist/index.d.ts +316 -67
- package/dist/index.mjs +1603 -200
- package/package.json +23 -7
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Brian Love
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# @pretable/react
|
|
2
|
+
|
|
3
|
+
The React surface for [pretable](https://pretable.dev/). Ships three components and one hook on top of `@pretable/core`'s headless engine.
|
|
4
|
+
|
|
5
|
+
## When to reach for what
|
|
6
|
+
|
|
7
|
+
- **`<Pretable>`** — drop-in. Pass `columns` and `rows` and you're done. Best for quick wins.
|
|
8
|
+
- **`<PretableSurface>`** — controlled. Pass `state` to drive sort, filter, selection, focus, or column layout from the outside. Best for production apps.
|
|
9
|
+
- **`usePretable`** — the hook. Returns `{ grid, snapshot, renderSnapshot, telemetry }` for custom rendering. Best when you need more control than `<PretableSurface>` provides — e.g., a non-default DOM layout or a different framework.
|
|
10
|
+
|
|
11
|
+
`<InspectionGrid>` and `<LabeledGridSurface>` are special-purpose surfaces tagged `@beta` — they work, but expect shape changes pre-1.0.
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
npm install @pretable/react @pretable/core @pretable/ui
|
|
17
|
+
# or pnpm add … / yarn add …
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
`@pretable/ui` ships the CSS theme; import the stylesheet once at the root of your app.
|
|
21
|
+
|
|
22
|
+
## Minimal example
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
import { Pretable } from "@pretable/react";
|
|
26
|
+
import "@pretable/ui/grid.css";
|
|
27
|
+
|
|
28
|
+
function App() {
|
|
29
|
+
return (
|
|
30
|
+
<Pretable
|
|
31
|
+
columns={[
|
|
32
|
+
{ id: "name", header: "Name" },
|
|
33
|
+
{ id: "age", header: "Age", sortable: true },
|
|
34
|
+
]}
|
|
35
|
+
rows={[
|
|
36
|
+
{ id: "1", name: "Ada", age: 36 },
|
|
37
|
+
{ id: "2", name: "Grace", age: 85 },
|
|
38
|
+
]}
|
|
39
|
+
/>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Full public surface
|
|
45
|
+
|
|
46
|
+
See **[`react.api.md`](./react.api.md)** for every exported component, hook, type, and function with their full signatures. The file is generated by [API Extractor](https://api-extractor.com/) and committed to the repo; CI fails if it drifts.
|
|
47
|
+
|
|
48
|
+
## License
|
|
49
|
+
|
|
50
|
+
MIT — see [LICENSE](../../LICENSE).
|