@chobantonov/jsonforms-react-shadcn-webcomponent 0.0.0-stage → 0.1.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 +91 -2
- package/dist/JsonFormsShadcnElement.d.ts +29 -0
- package/dist/index.d.ts +3 -0
- package/dist/jsonforms-react-shadcn.js +1 -0
- package/dist/register.d.ts +2 -0
- package/dist/register.js +6 -0
- package/dist/register.js.map +1 -0
- package/dist/renderers.d.ts +2 -0
- package/dist/src-CLRAt7jc.mjs +9482 -0
- package/dist/src-CLRAt7jc.mjs.map +1 -0
- package/dist/standalone/AgGridControlRenderer.impl-BZS8_ocu-Dp2429lF.mjs +39184 -0
- package/dist/standalone/AgGridControlRenderer.impl-BZS8_ocu-Dp2429lF.mjs.map +1 -0
- package/dist/standalone/DynamicJSXRenderer-DyB3ZpZV-Dr83kPeb.mjs +14893 -0
- package/dist/standalone/DynamicJSXRenderer-DyB3ZpZV-Dr83kPeb.mjs.map +1 -0
- package/dist/standalone/FileArrayInput.esm-BG196JYM.mjs +760 -0
- package/dist/standalone/FileArrayInput.esm-BG196JYM.mjs.map +1 -0
- package/dist/standalone/MarkupLabelRenderer.impl-CWfdcUuH-BgJ-v1Ei.mjs +12 -0
- package/dist/standalone/MarkupLabelRenderer.impl-CWfdcUuH-BgJ-v1Ei.mjs.map +1 -0
- package/dist/standalone/MonacoControlRenderer.impl-CyjMHbOd-BP-CDX3S.mjs +773 -0
- package/dist/standalone/MonacoControlRenderer.impl-CyjMHbOd-BP-CDX3S.mjs.map +1 -0
- package/dist/standalone/RactiveTemplate-Cat7CxUp-BnyPMY_h.mjs +8028 -0
- package/dist/standalone/RactiveTemplate-Cat7CxUp-BnyPMY_h.mjs.map +1 -0
- package/dist/standalone/celTemplate-D_AGhaIL-ryXLzhcw.mjs +137 -0
- package/dist/standalone/celTemplate-D_AGhaIL-ryXLzhcw.mjs.map +1 -0
- package/dist/standalone/classPrivateFieldGet2-CAMXi-8L.mjs +22 -0
- package/dist/standalone/dynamicCel.esm-DrqwYtar.mjs +43 -0
- package/dist/standalone/dynamicCel.esm-DrqwYtar.mjs.map +1 -0
- package/dist/standalone/index.js +24493 -0
- package/dist/standalone/index.js.map +1 -0
- package/dist/standalone/jsonforms-react-extended.esm-CFwqhFcu.mjs +13760 -0
- package/dist/standalone/jsonforms-react-extended.esm-CFwqhFcu.mjs.map +1 -0
- package/dist/standalone/lib-DHN5bkVZ.mjs +3149 -0
- package/dist/standalone/lib-DHN5bkVZ.mjs.map +1 -0
- package/dist/standalone/markdown-C_y73Q0w-DE-0r4-5.mjs +3060 -0
- package/dist/standalone/markdown-C_y73Q0w-DE-0r4-5.mjs.map +1 -0
- package/dist/standalone/plainRecord.esm-D_l3rehZ.mjs +123 -0
- package/dist/standalone/plainRecord.esm-D_l3rehZ.mjs.map +1 -0
- package/dist/standalone/react-dom-DUZYP7tL.mjs +5644 -0
- package/dist/standalone/react-dom-DUZYP7tL.mjs.map +1 -0
- package/package.json +82 -3
- package/src/JsonFormsShadcnElement.tsx +208 -0
- package/src/components/ui/alert.tsx +65 -0
- package/src/components/ui/avatar.tsx +108 -0
- package/src/components/ui/breadcrumb.tsx +111 -0
- package/src/components/ui/button.tsx +64 -0
- package/src/components/ui/calendar.tsx +223 -0
- package/src/components/ui/card.tsx +91 -0
- package/src/components/ui/checkbox.tsx +31 -0
- package/src/components/ui/collapsible.tsx +21 -0
- package/src/components/ui/dialog.tsx +175 -0
- package/src/components/ui/index.ts +12 -0
- package/src/components/ui/input.tsx +22 -0
- package/src/components/ui/item.tsx +193 -0
- package/src/components/ui/pagination.tsx +132 -0
- package/src/components/ui/popover.tsx +88 -0
- package/src/components/ui/radio-group.tsx +44 -0
- package/src/components/ui/resizable.tsx +52 -0
- package/src/components/ui/scroll-area.tsx +57 -0
- package/src/components/ui/select.tsx +189 -0
- package/src/components/ui/separator.tsx +27 -0
- package/src/components/ui/slider.tsx +62 -0
- package/src/components/ui/switch.tsx +34 -0
- package/src/components/ui/tabs.tsx +90 -0
- package/src/components/ui/textarea.tsx +17 -0
- package/src/components/ui/tooltip.tsx +56 -0
- package/src/components/ui/utils.ts +5 -0
- package/src/index.tsx +4 -0
- package/src/register.ts +13 -0
- package/src/renderers.ts +14 -0
- package/src/styles.css +29 -0
- package/src/vite-env.d.ts +4 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Krasimir Chobantonov
|
|
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,92 @@
|
|
|
1
|
-
#
|
|
1
|
+
# React shadcn Web Component
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`<jsonforms-react-shadcn>` includes the shadcn base and extended renderer
|
|
4
|
+
registries, generated UI components, and styles inside its shadow root. Its
|
|
5
|
+
browser distribution is `dist/standalone/`: a registration module and
|
|
6
|
+
supporting chunks that load directly in a plain HTML page.
|
|
7
|
+
|
|
8
|
+
## Plain HTML and self-hosting
|
|
9
|
+
|
|
10
|
+
Run `pnpm run wc:shadcn:build` from the workspace root. Copy the entire
|
|
11
|
+
`dist/standalone/` directory to your web server. Serve it over HTTP(S), then
|
|
12
|
+
load `index.js` as a module:
|
|
13
|
+
|
|
14
|
+
```html
|
|
15
|
+
<!doctype html>
|
|
16
|
+
<html lang="en">
|
|
17
|
+
<head>
|
|
18
|
+
<meta charset="utf-8" />
|
|
19
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
20
|
+
<title>shadcn JSON Forms</title>
|
|
21
|
+
</head>
|
|
22
|
+
<body>
|
|
23
|
+
<jsonforms-react-shadcn id="form"></jsonforms-react-shadcn>
|
|
24
|
+
<pre id="result"></pre>
|
|
25
|
+
<script type="module" src="./standalone/index.js"></script>
|
|
26
|
+
<script type="module">
|
|
27
|
+
await customElements.whenDefined('jsonforms-react-shadcn');
|
|
28
|
+
const form = document.getElementById('form');
|
|
29
|
+
form.addEventListener('change', (event) => {
|
|
30
|
+
if (event instanceof CustomEvent) {
|
|
31
|
+
document.getElementById('result').textContent = JSON.stringify(
|
|
32
|
+
event.detail.data,
|
|
33
|
+
null,
|
|
34
|
+
2,
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
form.schema = {
|
|
39
|
+
type: 'object',
|
|
40
|
+
properties: { name: { type: 'string' } },
|
|
41
|
+
};
|
|
42
|
+
form.uischema = { type: 'Control', scope: '#/properties/name' };
|
|
43
|
+
form.data = { name: 'Ada' };
|
|
44
|
+
</script>
|
|
45
|
+
</body>
|
|
46
|
+
</html>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
The module registers the custom element automatically. Keep its supporting
|
|
50
|
+
chunks beside `index.js`; the bundle loads them by relative URL when needed.
|
|
51
|
+
|
|
52
|
+
## npm CDN after publication
|
|
53
|
+
|
|
54
|
+
Once a version is published to npm, replace `VERSION` with that exact version
|
|
55
|
+
and use **one** of these script tags in place of the local `src` above:
|
|
56
|
+
|
|
57
|
+
```html
|
|
58
|
+
<script
|
|
59
|
+
type="module"
|
|
60
|
+
src="https://cdn.jsdelivr.net/npm/@chobantonov/jsonforms-react-shadcn-webcomponent@VERSION/dist/standalone/index.js"
|
|
61
|
+
></script>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Or use UNPKG:
|
|
65
|
+
|
|
66
|
+
```html
|
|
67
|
+
<script
|
|
68
|
+
type="module"
|
|
69
|
+
src="https://unpkg.com/@chobantonov/jsonforms-react-shadcn-webcomponent@VERSION/dist/standalone/index.js"
|
|
70
|
+
></script>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Neither React Web Component package is currently on public npm, so those URLs
|
|
74
|
+
are templates, not live examples. The existing `dist/register.js` and
|
|
75
|
+
`dist/jsonforms-react-shadcn.js` are application-bundler modules with bare
|
|
76
|
+
package imports; they cannot be loaded directly from a plain HTML page
|
|
77
|
+
through a file CDN. [UNPKG](https://unpkg.com/) and
|
|
78
|
+
[jsDelivr](https://www.jsdelivr.com/documentation) serve published npm files
|
|
79
|
+
by version and path.
|
|
80
|
+
|
|
81
|
+
## Application bundlers
|
|
82
|
+
|
|
83
|
+
In a TypeScript application, import `registerJsonFormsShadcn` from
|
|
84
|
+
`@chobantonov/jsonforms-react-shadcn-webcomponent` and call it before creating
|
|
85
|
+
the element. The app's bundler resolves its React and JSON Forms peer
|
|
86
|
+
dependencies. This project owns its generated components in
|
|
87
|
+
`src/components/ui`; the renderer packages use the consuming application's
|
|
88
|
+
components and aliases. See the
|
|
89
|
+
[base renderer setup](../jsonforms-react-shadcn-renderers/README.md) for an
|
|
90
|
+
application-bundler integration. The element accepts `schema`, `uischema`,
|
|
91
|
+
`data`, `config`, and `external` as JavaScript properties or JSON string
|
|
92
|
+
attributes. It emits `change` and `handle-action` events.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { FormElement, type FormElementState } from '@chobantonov/jsonforms-react-renderer-common/webcomponent/element';
|
|
2
|
+
import { ShadcnRendererSettings } from '@chobantonov/jsonforms-react-shadcn-extended-renderers';
|
|
3
|
+
import { createTranslator, parseBoolean, parseJson, parseMode, type JsonInput } from '@chobantonov/jsonforms-react-renderer-common/webcomponent/input';
|
|
4
|
+
export { createTranslator, parseBoolean, parseJson, parseMode };
|
|
5
|
+
export type { JsonInput };
|
|
6
|
+
export declare const JSON_FORMS_SHADCN_TAG = "jsonforms-react-shadcn";
|
|
7
|
+
type ElementState = FormElementState & {
|
|
8
|
+
accentColor?: string;
|
|
9
|
+
borderRadius?: JsonInput;
|
|
10
|
+
density?: ShadcnRendererSettings['density'];
|
|
11
|
+
};
|
|
12
|
+
export declare class JsonFormsShadcnElement extends FormElement {
|
|
13
|
+
static get observedAttributes(): string[];
|
|
14
|
+
private root?;
|
|
15
|
+
readonly errorStore: import("@chobantonov/jsonforms-react-extended-renderers").AdditionalErrorStore;
|
|
16
|
+
private ajv;
|
|
17
|
+
protected state: ElementState;
|
|
18
|
+
constructor();
|
|
19
|
+
connectedCallback(): void;
|
|
20
|
+
disconnectedCallback(): void;
|
|
21
|
+
set accentColor(value: string);
|
|
22
|
+
set borderRadius(value: JsonInput);
|
|
23
|
+
set density(value: ShadcnRendererSettings['density']);
|
|
24
|
+
protected setValue(name: string, value: JsonInput): void;
|
|
25
|
+
private emitChange;
|
|
26
|
+
private emitAction;
|
|
27
|
+
private render;
|
|
28
|
+
}
|
|
29
|
+
export declare const registerJsonFormsShadcn: (tagName?: string) => void;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { n as JSON_FORMS_SHADCN_TAG, r as JsonFormsShadcnElement, t as TRUST_DYNAMIC_FUNCTIONS, i as createTranslator, a as parseBoolean, o as parseJson, s as parseMode, c as registerJsonFormsShadcn, l as shadcnWebcomponentCells, u as shadcnWebcomponentRenderers } from "./src-CLRAt7jc.mjs";
|
package/dist/register.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register.js","names":["registerJsonFormsShadcn","JSON_FORMS_SHADCN_TAG","JsonFormsShadcnElement"],"sources":["../src/register.ts"],"sourcesContent":["import {\n JSON_FORMS_SHADCN_TAG,\n JsonFormsShadcnElement,\n registerJsonFormsShadcn,\n} from './index';\n\nregisterJsonFormsShadcn();\n\nexport {\n JSON_FORMS_SHADCN_TAG,\n JsonFormsShadcnElement,\n registerJsonFormsShadcn,\n};\n"],"mappings":";;AAMAA,EAAwB"}
|