jsonforms-nuxt-ui-renderers 0.1.7 → 0.2.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 +55 -0
- package/dist/index.cjs +560 -497
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +63 -1
- package/dist/index.d.ts +63 -1
- package/dist/index.js +556 -497
- package/dist/index.js.map +1 -1
- package/dist/styles.css +138 -0
- package/dist/styles.css.map +1 -0
- package/dist/styles.d.cts +2 -0
- package/dist/styles.d.ts +2 -0
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -18,10 +18,13 @@ Nuxt UI should be installed/configured in your Nuxt app (see Nuxt UI docs).
|
|
|
18
18
|
```ts
|
|
19
19
|
import { JsonForms } from '@jsonforms/vue'
|
|
20
20
|
import { nuxtUiRenderers } from 'jsonforms-nuxt-ui-renderers'
|
|
21
|
+
import 'jsonforms-nuxt-ui-renderers/styles.css'
|
|
21
22
|
|
|
22
23
|
// <JsonForms :schema="schema" :uischema="uischema" :data="data" :renderers="nuxtUiRenderers" />
|
|
23
24
|
```
|
|
24
25
|
|
|
26
|
+
Import `styles.css` for default styling of layout panels, labels, and typography. The package uses semantic class names (`jf-*`) and does not depend on Tailwind or any specific CSS framework.
|
|
27
|
+
|
|
25
28
|
### Important
|
|
26
29
|
|
|
27
30
|
- These renderers **resolve Nuxt UI components by name** (e.g. `UFormField`, `UInput`, `UTextarea`, `USelectMenu`, `USwitch`, `UButton`).
|
|
@@ -61,6 +64,58 @@ This package is intentionally small and opinionated: it ships a **single** rende
|
|
|
61
64
|
- If no matching detail UI schema is registered, a default one is generated via JSONForms `Generate.uiSchema(...)`
|
|
62
65
|
- The root object is rendered as a `VerticalLayout`; nested objects default to a `Group` using the control’s label
|
|
63
66
|
|
|
67
|
+
## Theming
|
|
68
|
+
|
|
69
|
+
The package uses semantic class names (`jf-*`) for layout and typography. Two ways to customize:
|
|
70
|
+
|
|
71
|
+
### Option 1: Default styles + CSS variables
|
|
72
|
+
|
|
73
|
+
Import the default stylesheet and override variables in your app:
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
import 'jsonforms-nuxt-ui-renderers/styles.css'
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
CSS variables (in `styles.css`) you can override in `:root`:
|
|
80
|
+
|
|
81
|
+
| Variable | Default | Description |
|
|
82
|
+
|----------|---------|-------------|
|
|
83
|
+
| `--jf-panel-border` | `1px solid rgba(0,0,0,0.06)` | Panel border |
|
|
84
|
+
| `--jf-panel-border-radius` | `0.25rem` | Panel corner radius |
|
|
85
|
+
| `--jf-panel-padding` | `0.75rem` | Panel padding |
|
|
86
|
+
| `--jf-gap` | `0.75rem` | Layout gap |
|
|
87
|
+
| `--jf-gap-wide` | `1.5rem` | Wide layout gap |
|
|
88
|
+
| `--jf-label-section-size` | `0.875rem` | Label font size |
|
|
89
|
+
| `--jf-label-section-weight` | `600` | Label font weight |
|
|
90
|
+
| `--jf-text-muted-color` | `rgb(107 114 128)` | Muted text (light) |
|
|
91
|
+
| `--jf-text-muted-color-dark` | `rgb(156 163 175)` | Muted text (dark) |
|
|
92
|
+
| `--jf-text-item-title-color` | `rgb(55 65 81)` | Item title (light) |
|
|
93
|
+
| `--jf-text-item-title-color-dark` | `rgb(229 231 235)` | Item title (dark) |
|
|
94
|
+
| `--jf-text-label-color` | `rgb(75 85 99)` | Label (light) |
|
|
95
|
+
| `--jf-text-label-color-dark` | `rgb(209 213 219)` | Label (dark) |
|
|
96
|
+
|
|
97
|
+
### Option 2: Theme overrides (e.g. Tailwind)
|
|
98
|
+
|
|
99
|
+
Pass custom classes to match your app. You can omit `styles.css` when using full overrides:
|
|
100
|
+
|
|
101
|
+
```ts
|
|
102
|
+
import { createNuxtUiRenderers } from 'jsonforms-nuxt-ui-renderers'
|
|
103
|
+
|
|
104
|
+
const renderers = createNuxtUiRenderers({
|
|
105
|
+
theme: {
|
|
106
|
+
panel: 'rounded border border-default bg-muted/40 p-3',
|
|
107
|
+
groupNested: 'rounded bg-muted/20 p-3',
|
|
108
|
+
layoutVertical: 'flex flex-col gap-3',
|
|
109
|
+
layoutHorizontal: 'flex flex-col gap-3 md:flex-row md:flex-wrap',
|
|
110
|
+
labelSection: 'text-sm font-semibold',
|
|
111
|
+
textMuted: 'text-sm text-muted',
|
|
112
|
+
// ... see NuxtUiRenderersTheme for all keys
|
|
113
|
+
},
|
|
114
|
+
})
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Theme keys: `panel`, `groupNested`, `layoutVertical`, `layoutVerticalWide`, `layoutHorizontal`, `layoutHorizontalItem`, `arrayItemToolbar`, `labelSection`, `labelSectionSpaced`, `textMuted`, `textMutedXs`, `textItemTitle`, `textItemSuffix`, `textLabel`, `flexBetween`, `flexBetweenStart`, `flexActions`.
|
|
118
|
+
|
|
64
119
|
## Contributing
|
|
65
120
|
|
|
66
121
|
- Install deps: `pnpm install`
|