@ng-json-render/primitives 0.0.2 → 1.0.0-beta.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
CHANGED
|
@@ -1,7 +1,53 @@
|
|
|
1
|
-
# primitives
|
|
1
|
+
# @ng-json-render/primitives
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
20 Tailwind-styled components and `primitivesRegistry` for [`@ng-json-render/core`](https://www.npmjs.com/package/@ng-json-render/core). Ships no catalog; to let a model use these components, add them to your own `defineCatalog(...)`.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[Docs](https://mainawycliffe.github.io/ng-json-render/components) · [GitHub](https://github.com/mainawycliffe/ng-json-render)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm i @ng-json-render/primitives @ng-json-render/core @json-render/core
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Requires Angular 19–22 and Tailwind CSS v4 ([setup](https://tailwindcss.com/docs/installation/framework-guides/angular)). Add the package to Tailwind's sources:
|
|
14
|
+
|
|
15
|
+
```css
|
|
16
|
+
/* src/styles.css */
|
|
17
|
+
@import 'tailwindcss';
|
|
18
|
+
@source '../node_modules/@ng-json-render/primitives';
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
provideJsonRender({ registry: primitivesRegistry });
|
|
25
|
+
// or combine with your own components:
|
|
26
|
+
mergeRegistries(primitivesRegistry, defineRegistry({ MyCard }));
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Components
|
|
30
|
+
|
|
31
|
+
| Group | Type | Main props |
|
|
32
|
+
| --- | --- | --- |
|
|
33
|
+
| Layout | `Container` | `maxWidth` |
|
|
34
|
+
| | `Stack` | `direction` (`row` \| `column`), `gap`, `align`, `justify`, `wrap` |
|
|
35
|
+
| | `Grid` | `columns`, `gap`, `minItemWidth` |
|
|
36
|
+
| | `Card` | `title`, `subtitle` |
|
|
37
|
+
| | `Divider` | none |
|
|
38
|
+
| Content | `Heading` | `value`, `level` (1–4) |
|
|
39
|
+
| | `Text` | `value`, `weight`, `size` |
|
|
40
|
+
| | `Badge` | `label`, `tone` |
|
|
41
|
+
| | `Stat` | `label`, `value`, `delta` (percentage number) |
|
|
42
|
+
| Feedback | `Alert` | `title`, `message`, `tone` |
|
|
43
|
+
| | `Progress` | `value` (0–100), `label` |
|
|
44
|
+
| Data | `BarChart` | `data: { label, value }[]`, `height` |
|
|
45
|
+
| | `LineChart` | `data: number[]`, `height`, `label?` |
|
|
46
|
+
| | `Table` | `columns`, `rows` |
|
|
47
|
+
| Forms | `Input` | `value` (model), `label`, `placeholder`, `type`, `hint` |
|
|
48
|
+
| | `Textarea` | `value` (model), `label`, `placeholder`, `rows` |
|
|
49
|
+
| | `Select` | `value` (model), `label`, `placeholder`, `options` |
|
|
50
|
+
| | `Checkbox`, `Switch` | `checked` (model), `label` |
|
|
51
|
+
| | `Button` | `label`, `variant`, `disabled`; emits `press` |
|
|
52
|
+
|
|
53
|
+
Bind form values with `{ "$bindState": "/path" }`. The [primitives skill](https://github.com/mainawycliffe/ng-json-render/blob/main/skills/ng-json-render-primitives/SKILL.md) lists every prop type and default, and includes a catalog you can copy.
|