habarico 0.0.0-stage → 7.2.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.
- package/LICENSE +21 -0
- package/README.md +99 -2
- package/lib/index.cjs +106220 -0
- package/lib/index.cjs.map +1 -0
- package/lib/index.d.ts +6696 -0
- package/lib/index.esm.js +105700 -0
- package/lib/index.esm.js.map +1 -0
- package/package.json +159 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Eluvia.land s.r.o.
|
|
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
CHANGED
|
@@ -1,3 +1,100 @@
|
|
|
1
|
-
#
|
|
1
|
+
# habarico
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Habarico is a schema-driven admin library for React. It fetches the JSON schemas a Habarico backend
|
|
4
|
+
exposes and renders a complete admin interface from them at runtime — lists, detail pages, forms,
|
|
5
|
+
actions, menus and dashboards — without a hand-written screen per resource. Every generated part
|
|
6
|
+
can be replaced with a component of your own.
|
|
7
|
+
|
|
8
|
+
Built on [React Admin](https://marmelab.com/react-admin/), MUI v7 and MUI X v9; runs on React 18
|
|
9
|
+
or 19.
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pnpm add habarico
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Peer dependencies (React, React Admin, MUI) are not bundled — install them in the project at the
|
|
18
|
+
same versions the library declares.
|
|
19
|
+
|
|
20
|
+
> **Router requirement:** the unsaved-changes guard uses React Router's `useBlocker`, which needs a
|
|
21
|
+
> data router. Let `SchemaAdmin` create one itself, or wrap it in `createBrowserRouter` — a legacy
|
|
22
|
+
> `<BrowserRouter>` silently disables the guard.
|
|
23
|
+
|
|
24
|
+
## Local development against a checkout
|
|
25
|
+
|
|
26
|
+
To run a project against your working copy instead of the published package, link it from the
|
|
27
|
+
project directory — the free library first, the paid one second:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pydev link-library <path-to-libs>/habarico-base/node <path-to-libs>/habarico-enterprise/node-enterprise
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
`<path-to-libs>` is the directory holding your library checkouts — the same placeholder the Ruby services use in their compose files. Relative or absolute, both work.
|
|
34
|
+
|
|
35
|
+
Link only what you develop; either package works on its own. When you link both, the order matters —
|
|
36
|
+
`habarico-enterprise` resolves its own `habarico` through the project, so the free library
|
|
37
|
+
has to be linked first or both end up with their own copy of React.
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pnpm watch # in the library you edit
|
|
41
|
+
pydev unlink-library <same paths>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
See [Installation](https://docs.habarico.com/node/installation) for the details.
|
|
45
|
+
|
|
46
|
+
## Quick start
|
|
47
|
+
|
|
48
|
+
```tsx
|
|
49
|
+
import {SchemaAdmin, SchemaResource} from 'habarico';
|
|
50
|
+
|
|
51
|
+
const SERVICES = {
|
|
52
|
+
eshop: {
|
|
53
|
+
url: 'https://api.example.com/api/v1/eshop/admin',
|
|
54
|
+
label: 'E-shop',
|
|
55
|
+
},
|
|
56
|
+
} as const;
|
|
57
|
+
|
|
58
|
+
const App = () => (
|
|
59
|
+
<SchemaAdmin
|
|
60
|
+
schemaProvider={schemaProvider}
|
|
61
|
+
authProvider={authProvider}
|
|
62
|
+
dataProviderFactory={dataProviderFactory}
|
|
63
|
+
serviceConfigMap={SERVICES}
|
|
64
|
+
>
|
|
65
|
+
<SchemaResource name="eshop/product" />
|
|
66
|
+
<SchemaResource name="eshop/order" />
|
|
67
|
+
</SchemaAdmin>
|
|
68
|
+
);
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
That is the whole frontend: the resources render themselves from the schemas the backend serves.
|
|
72
|
+
|
|
73
|
+
## Documentation
|
|
74
|
+
|
|
75
|
+
Full documentation is at **[docs.habarico.com/node](https://docs.habarico.com/node/intro)** — this file
|
|
76
|
+
is only a quick start.
|
|
77
|
+
|
|
78
|
+
| Section | What it covers |
|
|
79
|
+
| --- | --- |
|
|
80
|
+
| [Installation](https://docs.habarico.com/node/installation) | Packages, the router requirement, local development against a checkout |
|
|
81
|
+
| [Base components](https://docs.habarico.com/node/base-components/) | `SchemaAdmin` and `SchemaResource` — every prop |
|
|
82
|
+
| [View components](https://docs.habarico.com/node/view-components/) | List, show, create, edit and action views |
|
|
83
|
+
| [Providers](https://docs.habarico.com/node/providers/) | Auth, data and schema providers, and the customisation registries |
|
|
84
|
+
| [Input](https://docs.habarico.com/node/input-components/) and [field components](https://docs.habarico.com/node/field-components/) | Every built-in input and field type |
|
|
85
|
+
| [Hooks](https://docs.habarico.com/node/hooks/) | The hooks behind the generated screens |
|
|
86
|
+
| [Dashboard](https://docs.habarico.com/node/dashboard/) | Widgets, data sources and the add-widget wizard |
|
|
87
|
+
| [Types and schemas](https://docs.habarico.com/node/types-and-schemas/) | The shape of what the backend sends |
|
|
88
|
+
|
|
89
|
+
The backends serving those schemas are documented at
|
|
90
|
+
[docs.habarico.com/python/intro](https://docs.habarico.com/python/intro) and
|
|
91
|
+
[docs.habarico.com/ruby/intro](https://docs.habarico.com/ruby/intro); the contract between them is the
|
|
92
|
+
[API reference](https://docs.habarico.com/api).
|
|
93
|
+
|
|
94
|
+
The architecture of the library itself — its four layers and what belongs where — is documented in
|
|
95
|
+
`src/foundation/README.md`, `src/design/README.md`, `src/admin/README.md` and
|
|
96
|
+
`src/schema/README.md`, next to the code they describe.
|
|
97
|
+
|
|
98
|
+
## License
|
|
99
|
+
|
|
100
|
+
[MIT](LICENSE)
|