@a2ui-sdk/react 0.0.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/dist/0.8/A2UIRenderer.d.ts +31 -0
- package/dist/0.8/A2UIRenderer.js +19 -0
- package/dist/0.8/components/ComponentRenderer.d.ts +39 -0
- package/dist/0.8/components/ComponentRenderer.js +76 -0
- package/dist/0.8/components/UnknownComponent.d.ts +18 -0
- package/dist/0.8/components/display/AudioPlayerComponent.d.ts +5 -0
- package/dist/0.8/components/display/AudioPlayerComponent.js +19 -0
- package/dist/0.8/components/display/DividerComponent.d.ts +5 -0
- package/dist/0.8/components/display/DividerComponent.js +18 -0
- package/dist/0.8/components/display/IconComponent.d.ts +5 -0
- package/dist/0.8/components/display/IconComponent.js +68 -0
- package/dist/0.8/components/display/ImageComponent.d.ts +6 -0
- package/dist/0.8/components/display/ImageComponent.js +36 -0
- package/dist/0.8/components/display/TextComponent.d.ts +6 -0
- package/dist/0.8/components/display/TextComponent.js +32 -0
- package/dist/0.8/components/display/VideoComponent.d.ts +5 -0
- package/dist/0.8/components/display/VideoComponent.js +18 -0
- package/dist/0.8/components/display/index.d.ts +9 -0
- package/dist/0.8/components/index.d.ts +7 -0
- package/dist/0.8/components/interactive/ButtonComponent.d.ts +5 -0
- package/dist/0.8/components/interactive/ButtonComponent.js +29 -0
- package/dist/0.8/components/interactive/CheckBoxComponent.d.ts +5 -0
- package/dist/0.8/components/interactive/CheckBoxComponent.js +27 -0
- package/dist/0.8/components/interactive/DateTimeInputComponent.d.ts +5 -0
- package/dist/0.8/components/interactive/DateTimeInputComponent.js +46 -0
- package/dist/0.8/components/interactive/MultipleChoiceComponent.d.ts +7 -0
- package/dist/0.8/components/interactive/MultipleChoiceComponent.js +89 -0
- package/dist/0.8/components/interactive/SliderComponent.d.ts +5 -0
- package/dist/0.8/components/interactive/SliderComponent.js +48 -0
- package/dist/0.8/components/interactive/TextFieldComponent.d.ts +5 -0
- package/dist/0.8/components/interactive/TextFieldComponent.js +44 -0
- package/dist/0.8/components/interactive/index.d.ts +9 -0
- package/dist/0.8/components/layout/CardComponent.d.ts +5 -0
- package/dist/0.8/components/layout/CardComponent.js +14 -0
- package/dist/0.8/components/layout/ColumnComponent.d.ts +5 -0
- package/dist/0.8/components/layout/ColumnComponent.js +58 -0
- package/dist/0.8/components/layout/ListComponent.d.ts +5 -0
- package/dist/0.8/components/layout/ListComponent.js +51 -0
- package/dist/0.8/components/layout/ModalComponent.d.ts +5 -0
- package/dist/0.8/components/layout/ModalComponent.js +25 -0
- package/dist/0.8/components/layout/RowComponent.d.ts +5 -0
- package/dist/0.8/components/layout/RowComponent.js +58 -0
- package/dist/0.8/components/layout/TabsComponent.d.ts +5 -0
- package/dist/0.8/components/layout/TabsComponent.js +29 -0
- package/dist/0.8/components/layout/index.d.ts +9 -0
- package/dist/0.8/contexts/A2UIProvider.d.ts +56 -0
- package/dist/0.8/contexts/A2UIProvider.js +33 -0
- package/dist/0.8/contexts/ActionContext.d.ts +33 -0
- package/dist/0.8/contexts/ActionContext.js +41 -0
- package/dist/0.8/contexts/ComponentsMapContext.d.ts +63 -0
- package/dist/0.8/contexts/ComponentsMapContext.js +21 -0
- package/dist/0.8/contexts/DataModelContext.d.ts +43 -0
- package/dist/0.8/contexts/DataModelContext.js +86 -0
- package/dist/0.8/contexts/SurfaceContext.d.ts +45 -0
- package/dist/0.8/contexts/SurfaceContext.js +88 -0
- package/dist/0.8/hooks/useA2UIMessageHandler.d.ts +41 -0
- package/dist/0.8/hooks/useA2UIMessageHandler.js +54 -0
- package/dist/0.8/hooks/useComponent.d.ts +23 -0
- package/dist/0.8/hooks/useComponent.js +9 -0
- package/dist/0.8/hooks/useDataBinding.d.ts +50 -0
- package/dist/0.8/hooks/useDataBinding.js +28 -0
- package/dist/0.8/hooks/useDispatchAction.d.ts +22 -0
- package/dist/0.8/hooks/useDispatchAction.js +8 -0
- package/dist/0.8/index.d.ts +44 -0
- package/dist/0.8/index.js +17 -0
- package/dist/0.8/utils/dataBinding.d.ts +95 -0
- package/dist/0.8/utils/dataBinding.js +46 -0
- package/dist/0.8/utils/pathUtils.d.ts +63 -0
- package/dist/0.8/utils/pathUtils.js +44 -0
- package/dist/0.9/A2UIRenderer.d.ts +54 -0
- package/dist/0.9/A2UIRenderer.js +41 -0
- package/dist/0.9/components/ComponentRenderer.d.ts +39 -0
- package/dist/0.9/components/ComponentRenderer.js +34 -0
- package/dist/0.9/components/UnknownComponent.d.ts +11 -0
- package/dist/0.9/components/UnknownComponent.js +35 -0
- package/dist/0.9/components/display/AudioPlayerComponent.d.ts +5 -0
- package/dist/0.9/components/display/AudioPlayerComponent.js +21 -0
- package/dist/0.9/components/display/DividerComponent.d.ts +5 -0
- package/dist/0.9/components/display/DividerComponent.js +19 -0
- package/dist/0.9/components/display/IconComponent.d.ts +5 -0
- package/dist/0.9/components/display/IconComponent.js +68 -0
- package/dist/0.9/components/display/ImageComponent.d.ts +6 -0
- package/dist/0.9/components/display/ImageComponent.js +43 -0
- package/dist/0.9/components/display/TextComponent.d.ts +6 -0
- package/dist/0.9/components/display/TextComponent.js +31 -0
- package/dist/0.9/components/display/VideoComponent.d.ts +5 -0
- package/dist/0.9/components/display/VideoComponent.js +30 -0
- package/dist/0.9/components/display/index.d.ts +9 -0
- package/dist/0.9/components/index.d.ts +12 -0
- package/dist/0.9/components/index.js +68 -0
- package/dist/0.9/components/interactive/ButtonComponent.d.ts +6 -0
- package/dist/0.9/components/interactive/ButtonComponent.js +29 -0
- package/dist/0.9/components/interactive/CheckBoxComponent.d.ts +5 -0
- package/dist/0.9/components/interactive/CheckBoxComponent.js +41 -0
- package/dist/0.9/components/interactive/ChoicePickerComponent.d.ts +7 -0
- package/dist/0.9/components/interactive/ChoicePickerComponent.js +80 -0
- package/dist/0.9/components/interactive/DateTimeInputComponent.d.ts +5 -0
- package/dist/0.9/components/interactive/DateTimeInputComponent.js +50 -0
- package/dist/0.9/components/interactive/SliderComponent.d.ts +6 -0
- package/dist/0.9/components/interactive/SliderComponent.js +47 -0
- package/dist/0.9/components/interactive/TextFieldComponent.d.ts +5 -0
- package/dist/0.9/components/interactive/TextFieldComponent.js +57 -0
- package/dist/0.9/components/interactive/index.d.ts +9 -0
- package/dist/0.9/components/layout/CardComponent.d.ts +5 -0
- package/dist/0.9/components/layout/CardComponent.js +15 -0
- package/dist/0.9/components/layout/ColumnComponent.d.ts +6 -0
- package/dist/0.9/components/layout/ColumnComponent.js +50 -0
- package/dist/0.9/components/layout/ListComponent.d.ts +17 -0
- package/dist/0.9/components/layout/ListComponent.js +42 -0
- package/dist/0.9/components/layout/ModalComponent.d.ts +5 -0
- package/dist/0.9/components/layout/ModalComponent.js +30 -0
- package/dist/0.9/components/layout/RowComponent.d.ts +6 -0
- package/dist/0.9/components/layout/RowComponent.js +50 -0
- package/dist/0.9/components/layout/TabsComponent.d.ts +5 -0
- package/dist/0.9/components/layout/TabsComponent.js +30 -0
- package/dist/0.9/components/layout/TemplateRenderer.d.ts +25 -0
- package/dist/0.9/components/layout/TemplateRenderer.js +49 -0
- package/dist/0.9/components/layout/index.d.ts +10 -0
- package/dist/0.9/contexts/A2UIProvider.d.ts +58 -0
- package/dist/0.9/contexts/A2UIProvider.js +34 -0
- package/dist/0.9/contexts/ActionContext.d.ts +33 -0
- package/dist/0.9/contexts/ActionContext.js +47 -0
- package/dist/0.9/contexts/ComponentsMapContext.d.ts +73 -0
- package/dist/0.9/contexts/ComponentsMapContext.js +21 -0
- package/dist/0.9/contexts/ScopeContext.d.ts +53 -0
- package/dist/0.9/contexts/ScopeContext.js +22 -0
- package/dist/0.9/contexts/SurfaceContext.d.ts +50 -0
- package/dist/0.9/contexts/SurfaceContext.js +118 -0
- package/dist/0.9/hooks/useA2UIMessageHandler.d.ts +44 -0
- package/dist/0.9/hooks/useA2UIMessageHandler.js +87 -0
- package/dist/0.9/hooks/useComponent.d.ts +23 -0
- package/dist/0.9/hooks/useComponent.js +9 -0
- package/dist/0.9/hooks/useDataBinding.d.ts +59 -0
- package/dist/0.9/hooks/useDataBinding.js +43 -0
- package/dist/0.9/hooks/useDispatchAction.d.ts +22 -0
- package/dist/0.9/hooks/useDispatchAction.js +17 -0
- package/dist/0.9/hooks/useValidation.d.ts +25 -0
- package/dist/0.9/hooks/useValidation.js +14 -0
- package/dist/0.9/index.d.ts +35 -0
- package/dist/0.9/index.js +26 -0
- package/dist/0.9/utils/dataBinding.d.ts +126 -0
- package/dist/0.9/utils/dataBinding.js +41 -0
- package/dist/0.9/utils/pathUtils.d.ts +109 -0
- package/dist/0.9/utils/pathUtils.js +74 -0
- package/dist/0.9/utils/validation.d.ts +49 -0
- package/dist/0.9/utils/validation.js +75 -0
- package/dist/components/ui/button.d.ts +10 -0
- package/dist/components/ui/button.js +53 -0
- package/dist/components/ui/card.d.ts +9 -0
- package/dist/components/ui/card.js +29 -0
- package/dist/components/ui/checkbox.d.ts +4 -0
- package/dist/components/ui/checkbox.js +31 -0
- package/dist/components/ui/dialog.d.ts +15 -0
- package/dist/components/ui/dialog.js +77 -0
- package/dist/components/ui/input.d.ts +3 -0
- package/dist/components/ui/input.js +21 -0
- package/dist/components/ui/label.d.ts +4 -0
- package/dist/components/ui/label.js +22 -0
- package/dist/components/ui/native-select.d.ts +7 -0
- package/dist/components/ui/select.d.ts +15 -0
- package/dist/components/ui/select.js +144 -0
- package/dist/components/ui/separator.d.ts +4 -0
- package/dist/components/ui/separator.js +26 -0
- package/dist/components/ui/slider.d.ts +4 -0
- package/dist/components/ui/slider.js +63 -0
- package/dist/components/ui/tabs.d.ts +7 -0
- package/dist/components/ui/tabs.js +67 -0
- package/dist/components/ui/textarea.d.ts +3 -0
- package/dist/components/ui/textarea.js +18 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +6 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.js +8 -0
- package/package.json +75 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as h } from "react/jsx-runtime";
|
|
2
|
+
import { memo as x } from "react";
|
|
3
|
+
import { useStringBinding as l } from "../../hooks/useDataBinding.js";
|
|
4
|
+
import { cn as c } from "../../../lib/utils.js";
|
|
5
|
+
const e = {
|
|
6
|
+
h1: "text-3xl font-bold tracking-tight",
|
|
7
|
+
h2: "text-2xl font-semibold tracking-tight",
|
|
8
|
+
h3: "text-xl font-semibold",
|
|
9
|
+
h4: "text-lg font-semibold",
|
|
10
|
+
h5: "text-base font-semibold",
|
|
11
|
+
caption: "text-sm text-muted-foreground",
|
|
12
|
+
body: "text-base"
|
|
13
|
+
}, d = {
|
|
14
|
+
h1: "h1",
|
|
15
|
+
h2: "h2",
|
|
16
|
+
h3: "h3",
|
|
17
|
+
h4: "h4",
|
|
18
|
+
h5: "h5",
|
|
19
|
+
caption: "span",
|
|
20
|
+
body: "p"
|
|
21
|
+
}, p = x(function({
|
|
22
|
+
surfaceId: n,
|
|
23
|
+
component: i
|
|
24
|
+
}) {
|
|
25
|
+
const t = i, s = l(n, t.text, ""), o = t.variant ?? "body", m = c(e[o] || e.body), r = d[o] || "p", a = t.weight ? { flexGrow: t.weight } : void 0;
|
|
26
|
+
return /* @__PURE__ */ h(r, { className: m, style: a, children: s });
|
|
27
|
+
});
|
|
28
|
+
p.displayName = "A2UI.Text";
|
|
29
|
+
export {
|
|
30
|
+
p as TextComponent
|
|
31
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsxs as n, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { memo as d } from "react";
|
|
3
|
+
import { useStringBinding as m } from "../../hooks/useDataBinding.js";
|
|
4
|
+
import { cn as l } from "../../../lib/utils.js";
|
|
5
|
+
const c = d(function({
|
|
6
|
+
surfaceId: e,
|
|
7
|
+
component: t
|
|
8
|
+
}) {
|
|
9
|
+
const o = t, r = m(e, o.url, "");
|
|
10
|
+
if (!r)
|
|
11
|
+
return null;
|
|
12
|
+
const i = o.weight ? { flexGrow: o.weight } : void 0;
|
|
13
|
+
return /* @__PURE__ */ n(
|
|
14
|
+
"video",
|
|
15
|
+
{
|
|
16
|
+
src: r,
|
|
17
|
+
controls: !0,
|
|
18
|
+
className: l("w-full rounded-lg"),
|
|
19
|
+
style: i,
|
|
20
|
+
children: [
|
|
21
|
+
/* @__PURE__ */ s("track", { kind: "captions" }),
|
|
22
|
+
"Your browser does not support the video tag."
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
});
|
|
27
|
+
c.displayName = "A2UI.Video";
|
|
28
|
+
export {
|
|
29
|
+
c as VideoComponent
|
|
30
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Display components exports.
|
|
3
|
+
*/
|
|
4
|
+
export { TextComponent } from './TextComponent';
|
|
5
|
+
export { ImageComponent } from './ImageComponent';
|
|
6
|
+
export { IconComponent } from './IconComponent';
|
|
7
|
+
export { VideoComponent } from './VideoComponent';
|
|
8
|
+
export { AudioPlayerComponent } from './AudioPlayerComponent';
|
|
9
|
+
export { DividerComponent } from './DividerComponent';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
import { A2UIComponentProps } from '../contexts/ComponentsMapContext';
|
|
3
|
+
export { ComponentRenderer, registerComponent } from './ComponentRenderer';
|
|
4
|
+
export { UnknownComponent } from './UnknownComponent';
|
|
5
|
+
export { TextComponent, ImageComponent, IconComponent, VideoComponent, AudioPlayerComponent, DividerComponent, } from './display';
|
|
6
|
+
export { RowComponent, ColumnComponent, ListComponent, CardComponent, TabsComponent, ModalComponent, TemplateRenderer, } from './layout';
|
|
7
|
+
export { ButtonComponent, TextFieldComponent, CheckBoxComponent, ChoicePickerComponent, SliderComponent, DateTimeInputComponent, } from './interactive';
|
|
8
|
+
/**
|
|
9
|
+
* Default component registry mapping component type names to React components.
|
|
10
|
+
* Contains all 18 standard catalog components.
|
|
11
|
+
*/
|
|
12
|
+
export declare const componentRegistry: Record<string, ComponentType<A2UIComponentProps>>;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { TextComponent as o } from "./display/TextComponent.js";
|
|
2
|
+
import { ImageComponent as m } from "./display/ImageComponent.js";
|
|
3
|
+
import { IconComponent as e } from "./display/IconComponent.js";
|
|
4
|
+
import { VideoComponent as t } from "./display/VideoComponent.js";
|
|
5
|
+
import { AudioPlayerComponent as r } from "./display/AudioPlayerComponent.js";
|
|
6
|
+
import { DividerComponent as n } from "./display/DividerComponent.js";
|
|
7
|
+
import { RowComponent as p } from "./layout/RowComponent.js";
|
|
8
|
+
import { ColumnComponent as i } from "./layout/ColumnComponent.js";
|
|
9
|
+
import { ListComponent as C } from "./layout/ListComponent.js";
|
|
10
|
+
import { CardComponent as f } from "./layout/CardComponent.js";
|
|
11
|
+
import { TabsComponent as d } from "./layout/TabsComponent.js";
|
|
12
|
+
import { ModalComponent as a } from "./layout/ModalComponent.js";
|
|
13
|
+
import { TemplateRenderer as z } from "./layout/TemplateRenderer.js";
|
|
14
|
+
import { ButtonComponent as l } from "./interactive/ButtonComponent.js";
|
|
15
|
+
import { TextFieldComponent as c } from "./interactive/TextFieldComponent.js";
|
|
16
|
+
import { CheckBoxComponent as x } from "./interactive/CheckBoxComponent.js";
|
|
17
|
+
import { ChoicePickerComponent as T } from "./interactive/ChoicePickerComponent.js";
|
|
18
|
+
import { SliderComponent as u } from "./interactive/SliderComponent.js";
|
|
19
|
+
import { DateTimeInputComponent as s } from "./interactive/DateTimeInputComponent.js";
|
|
20
|
+
import { ComponentRenderer as G } from "./ComponentRenderer.js";
|
|
21
|
+
import { UnknownComponent as J } from "./UnknownComponent.js";
|
|
22
|
+
const U = {
|
|
23
|
+
// Display components (6)
|
|
24
|
+
Text: o,
|
|
25
|
+
Image: m,
|
|
26
|
+
Icon: e,
|
|
27
|
+
Video: t,
|
|
28
|
+
AudioPlayer: r,
|
|
29
|
+
Divider: n,
|
|
30
|
+
// Layout components (6)
|
|
31
|
+
Row: p,
|
|
32
|
+
Column: i,
|
|
33
|
+
List: C,
|
|
34
|
+
Card: f,
|
|
35
|
+
Tabs: d,
|
|
36
|
+
Modal: a,
|
|
37
|
+
// Interactive components (6)
|
|
38
|
+
Button: l,
|
|
39
|
+
TextField: c,
|
|
40
|
+
CheckBox: x,
|
|
41
|
+
ChoicePicker: T,
|
|
42
|
+
Slider: u,
|
|
43
|
+
DateTimeInput: s
|
|
44
|
+
};
|
|
45
|
+
export {
|
|
46
|
+
r as AudioPlayerComponent,
|
|
47
|
+
l as ButtonComponent,
|
|
48
|
+
f as CardComponent,
|
|
49
|
+
x as CheckBoxComponent,
|
|
50
|
+
T as ChoicePickerComponent,
|
|
51
|
+
i as ColumnComponent,
|
|
52
|
+
G as ComponentRenderer,
|
|
53
|
+
s as DateTimeInputComponent,
|
|
54
|
+
n as DividerComponent,
|
|
55
|
+
e as IconComponent,
|
|
56
|
+
m as ImageComponent,
|
|
57
|
+
C as ListComponent,
|
|
58
|
+
a as ModalComponent,
|
|
59
|
+
p as RowComponent,
|
|
60
|
+
u as SliderComponent,
|
|
61
|
+
d as TabsComponent,
|
|
62
|
+
z as TemplateRenderer,
|
|
63
|
+
o as TextComponent,
|
|
64
|
+
c as TextFieldComponent,
|
|
65
|
+
J as UnknownComponent,
|
|
66
|
+
t as VideoComponent,
|
|
67
|
+
U as componentRegistry
|
|
68
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { A2UIComponentProps } from '../../contexts/ComponentsMapContext';
|
|
2
|
+
/**
|
|
3
|
+
* Button component - triggers actions on click.
|
|
4
|
+
* When checks are defined and fail, the button is disabled.
|
|
5
|
+
*/
|
|
6
|
+
export declare const ButtonComponent: import('react').NamedExoticComponent<A2UIComponentProps>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { memo as s, useCallback as a } from "react";
|
|
3
|
+
import { useDispatchAction as p } from "../../hooks/useDispatchAction.js";
|
|
4
|
+
import { useValidation as d } from "../../hooks/useValidation.js";
|
|
5
|
+
import { Button as u } from "../../../components/ui/button.js";
|
|
6
|
+
import { ComponentRenderer as f } from "../ComponentRenderer.js";
|
|
7
|
+
const h = s(function({
|
|
8
|
+
surfaceId: o,
|
|
9
|
+
component: e
|
|
10
|
+
}) {
|
|
11
|
+
const t = e, n = p(), { valid: c } = d(o, t.checks), m = a(() => {
|
|
12
|
+
t.action && n(o, t.id, t.action);
|
|
13
|
+
}, [n, o, t.id, t.action]), r = t.weight ? { flexGrow: t.weight } : void 0, l = !c;
|
|
14
|
+
return /* @__PURE__ */ i(
|
|
15
|
+
u,
|
|
16
|
+
{
|
|
17
|
+
variant: t.primary ? "default" : "outline",
|
|
18
|
+
onClick: m,
|
|
19
|
+
disabled: l,
|
|
20
|
+
className: "inline-flex items-center justify-center",
|
|
21
|
+
style: r,
|
|
22
|
+
children: t.child ? /* @__PURE__ */ i(f, { surfaceId: o, componentId: t.child }) : "Button"
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
});
|
|
26
|
+
h.displayName = "A2UI.Button";
|
|
27
|
+
export {
|
|
28
|
+
h as ButtonComponent
|
|
29
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsxs as s, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { memo as f, useCallback as k } from "react";
|
|
3
|
+
import { useStringBinding as C, useFormBinding as g } from "../../hooks/useDataBinding.js";
|
|
4
|
+
import { useValidation as v } from "../../hooks/useValidation.js";
|
|
5
|
+
import { Checkbox as u } from "../../../components/ui/checkbox.js";
|
|
6
|
+
import { Label as b } from "../../../components/ui/label.js";
|
|
7
|
+
import { cn as B } from "../../../lib/utils.js";
|
|
8
|
+
const N = f(function({
|
|
9
|
+
surfaceId: t,
|
|
10
|
+
component: m
|
|
11
|
+
}) {
|
|
12
|
+
const e = m, i = C(t, e.label, ""), [a, n] = g(
|
|
13
|
+
t,
|
|
14
|
+
e.value,
|
|
15
|
+
!1
|
|
16
|
+
), { valid: h, errors: r } = v(t, e.checks), d = k(
|
|
17
|
+
(c) => {
|
|
18
|
+
n(c);
|
|
19
|
+
},
|
|
20
|
+
[n]
|
|
21
|
+
), l = `checkbox-${e.id}`, p = e.weight ? { flexGrow: e.weight } : void 0;
|
|
22
|
+
return /* @__PURE__ */ s("div", { className: B("flex flex-col gap-1"), style: p, children: [
|
|
23
|
+
/* @__PURE__ */ s("div", { className: "flex items-center gap-3", children: [
|
|
24
|
+
/* @__PURE__ */ o(
|
|
25
|
+
u,
|
|
26
|
+
{
|
|
27
|
+
id: l,
|
|
28
|
+
checked: a,
|
|
29
|
+
onCheckedChange: d,
|
|
30
|
+
"aria-invalid": !h
|
|
31
|
+
}
|
|
32
|
+
),
|
|
33
|
+
i && /* @__PURE__ */ o(b, { htmlFor: l, className: "cursor-pointer", children: i })
|
|
34
|
+
] }),
|
|
35
|
+
r.length > 0 && /* @__PURE__ */ o("div", { className: "text-sm text-destructive ml-6", children: r.map((c, x) => /* @__PURE__ */ o("p", { children: c }, x)) })
|
|
36
|
+
] });
|
|
37
|
+
});
|
|
38
|
+
N.displayName = "A2UI.CheckBox";
|
|
39
|
+
export {
|
|
40
|
+
N as CheckBoxComponent
|
|
41
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { A2UIComponentProps } from '../../contexts/ComponentsMapContext';
|
|
2
|
+
/**
|
|
3
|
+
* ChoicePicker component - choice picker input.
|
|
4
|
+
* When variant === 'mutuallyExclusive', renders as a dropdown.
|
|
5
|
+
* When variant === 'multipleSelection' or undefined, renders as checkboxes.
|
|
6
|
+
*/
|
|
7
|
+
export declare const ChoicePickerComponent: import('react').NamedExoticComponent<A2UIComponentProps>;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { jsxs as m, jsx as e, Fragment as V } from "react/jsx-runtime";
|
|
2
|
+
import { memo as F, useCallback as S } from "react";
|
|
3
|
+
import { useStringBinding as k, useFormBinding as P } from "../../hooks/useDataBinding.js";
|
|
4
|
+
import { useValidation as w } from "../../hooks/useValidation.js";
|
|
5
|
+
import { Select as T, SelectTrigger as $, SelectValue as j, SelectContent as B, SelectItem as L } from "../../../components/ui/select.js";
|
|
6
|
+
import { Checkbox as E } from "../../../components/ui/checkbox.js";
|
|
7
|
+
import { Label as p } from "../../../components/ui/label.js";
|
|
8
|
+
import { cn as v } from "../../../lib/utils.js";
|
|
9
|
+
function b({
|
|
10
|
+
surfaceId: g,
|
|
11
|
+
label: c
|
|
12
|
+
}) {
|
|
13
|
+
const d = k(g, c, "");
|
|
14
|
+
return /* @__PURE__ */ e(V, { children: d });
|
|
15
|
+
}
|
|
16
|
+
const G = F(function({
|
|
17
|
+
surfaceId: c,
|
|
18
|
+
component: d
|
|
19
|
+
}) {
|
|
20
|
+
const r = d, o = k(c, r.label, ""), x = (r.variant ?? "multipleSelection") === "mutuallyExclusive", { valid: f, errors: s } = w(c, r.checks), [t, a] = P(
|
|
21
|
+
c,
|
|
22
|
+
r.value,
|
|
23
|
+
x ? "" : []
|
|
24
|
+
), y = S(
|
|
25
|
+
(l) => {
|
|
26
|
+
a(l);
|
|
27
|
+
},
|
|
28
|
+
[a]
|
|
29
|
+
), N = S(
|
|
30
|
+
(l, i) => {
|
|
31
|
+
const n = Array.isArray(t) ? t : t ? [t] : [];
|
|
32
|
+
a(i ? [...n, l] : n.filter((u) => u !== l));
|
|
33
|
+
},
|
|
34
|
+
[t, a]
|
|
35
|
+
), h = `choicepicker-${r.id}`, C = r.weight ? { flexGrow: r.weight } : void 0;
|
|
36
|
+
if (!r.options || r.options.length === 0)
|
|
37
|
+
return null;
|
|
38
|
+
if (x) {
|
|
39
|
+
const l = Array.isArray(t) ? t[0] || "" : t;
|
|
40
|
+
return /* @__PURE__ */ m("div", { className: v("flex flex-col gap-2"), style: C, children: [
|
|
41
|
+
o && /* @__PURE__ */ e(p, { htmlFor: h, children: o }),
|
|
42
|
+
/* @__PURE__ */ m(T, { value: l, onValueChange: y, children: [
|
|
43
|
+
/* @__PURE__ */ e(
|
|
44
|
+
$,
|
|
45
|
+
{
|
|
46
|
+
id: h,
|
|
47
|
+
className: v(!f && "border-destructive"),
|
|
48
|
+
"aria-invalid": !f,
|
|
49
|
+
children: /* @__PURE__ */ e(j, { placeholder: "Select an option" })
|
|
50
|
+
}
|
|
51
|
+
),
|
|
52
|
+
/* @__PURE__ */ e(B, { children: r.options.map((i) => /* @__PURE__ */ e(L, { value: i.value, children: /* @__PURE__ */ e(b, { surfaceId: c, label: i.label }) }, i.value)) })
|
|
53
|
+
] }),
|
|
54
|
+
s.length > 0 && /* @__PURE__ */ e("div", { className: "text-sm text-destructive", children: s.map((i, n) => /* @__PURE__ */ e("p", { children: i }, n)) })
|
|
55
|
+
] });
|
|
56
|
+
}
|
|
57
|
+
const A = Array.isArray(t) ? t : t ? [t] : [];
|
|
58
|
+
return /* @__PURE__ */ m("div", { className: v("flex flex-col gap-2"), style: C, children: [
|
|
59
|
+
o && /* @__PURE__ */ e(p, { children: o }),
|
|
60
|
+
r.options.map((l) => {
|
|
61
|
+
const i = A.includes(l.value), n = `${h}-${l.value}`;
|
|
62
|
+
return /* @__PURE__ */ m("div", { className: "flex items-center gap-2", children: [
|
|
63
|
+
/* @__PURE__ */ e(
|
|
64
|
+
E,
|
|
65
|
+
{
|
|
66
|
+
id: n,
|
|
67
|
+
checked: i,
|
|
68
|
+
onCheckedChange: (u) => N(l.value, u === !0)
|
|
69
|
+
}
|
|
70
|
+
),
|
|
71
|
+
/* @__PURE__ */ e(p, { htmlFor: n, className: "cursor-pointer", children: /* @__PURE__ */ e(b, { surfaceId: c, label: l.label }) })
|
|
72
|
+
] }, l.value);
|
|
73
|
+
}),
|
|
74
|
+
s.length > 0 && /* @__PURE__ */ e("div", { className: "text-sm text-destructive", children: s.map((l, i) => /* @__PURE__ */ e("p", { children: l }, i)) })
|
|
75
|
+
] });
|
|
76
|
+
});
|
|
77
|
+
G.displayName = "A2UI.ChoicePicker";
|
|
78
|
+
export {
|
|
79
|
+
G as ChoicePickerComponent
|
|
80
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsxs as c, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { memo as k, useCallback as w } from "react";
|
|
3
|
+
import { CalendarIcon as y, ClockIcon as T } from "lucide-react";
|
|
4
|
+
import { useStringBinding as C, useFormBinding as D } from "../../hooks/useDataBinding.js";
|
|
5
|
+
import { useValidation as I } from "../../hooks/useValidation.js";
|
|
6
|
+
import { cn as m } from "../../../lib/utils.js";
|
|
7
|
+
import { Label as N } from "../../../components/ui/label.js";
|
|
8
|
+
const V = k(function({
|
|
9
|
+
surfaceId: i,
|
|
10
|
+
component: p
|
|
11
|
+
}) {
|
|
12
|
+
const e = p, a = C(i, e.label, ""), r = e.enableDate ?? !0, u = e.enableTime ?? !1, { valid: o, errors: l } = I(i, e.checks), [b, d] = D(
|
|
13
|
+
i,
|
|
14
|
+
e.value,
|
|
15
|
+
""
|
|
16
|
+
), f = w(
|
|
17
|
+
(n) => {
|
|
18
|
+
d(n.target.value);
|
|
19
|
+
},
|
|
20
|
+
[d]
|
|
21
|
+
), s = `datetime-${e.id}`, g = r && u ? "datetime-local" : r ? "date" : "time", v = r ? y : T, h = e.weight ? { flexGrow: e.weight } : void 0;
|
|
22
|
+
return /* @__PURE__ */ c("div", { className: m("flex flex-col gap-2"), style: h, children: [
|
|
23
|
+
a && /* @__PURE__ */ t(N, { htmlFor: s, children: a }),
|
|
24
|
+
/* @__PURE__ */ c("div", { className: "relative", children: [
|
|
25
|
+
/* @__PURE__ */ t(
|
|
26
|
+
"input",
|
|
27
|
+
{
|
|
28
|
+
id: s,
|
|
29
|
+
type: g,
|
|
30
|
+
value: b,
|
|
31
|
+
onChange: f,
|
|
32
|
+
"aria-invalid": !o,
|
|
33
|
+
className: m(
|
|
34
|
+
"file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
35
|
+
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
36
|
+
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
37
|
+
"pr-9 [&::-webkit-calendar-picker-indicator]:opacity-0 [&::-webkit-calendar-picker-indicator]:absolute [&::-webkit-calendar-picker-indicator]:right-0 [&::-webkit-calendar-picker-indicator]:w-9 [&::-webkit-calendar-picker-indicator]:h-full [&::-webkit-calendar-picker-indicator]:cursor-pointer",
|
|
38
|
+
!o && "border-destructive"
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
),
|
|
42
|
+
/* @__PURE__ */ t(v, { className: "pointer-events-none absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" })
|
|
43
|
+
] }),
|
|
44
|
+
l.length > 0 && /* @__PURE__ */ t("div", { className: "text-sm text-destructive", children: l.map((n, x) => /* @__PURE__ */ t("p", { children: n }, x)) })
|
|
45
|
+
] });
|
|
46
|
+
});
|
|
47
|
+
V.displayName = "A2UI.DateTimeInput";
|
|
48
|
+
export {
|
|
49
|
+
V as DateTimeInputComponent
|
|
50
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { A2UIComponentProps } from '../../contexts/ComponentsMapContext';
|
|
2
|
+
/**
|
|
3
|
+
* Slider component - range slider input.
|
|
4
|
+
* Note: In 0.9, minValue/maxValue are renamed to min/max.
|
|
5
|
+
*/
|
|
6
|
+
export declare const SliderComponent: import('react').NamedExoticComponent<A2UIComponentProps>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { jsxs as c, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { memo as g, useCallback as v } from "react";
|
|
3
|
+
import { useStringBinding as S, useFormBinding as b } from "../../hooks/useDataBinding.js";
|
|
4
|
+
import { useValidation as C } from "../../hooks/useValidation.js";
|
|
5
|
+
import { Slider as N } from "../../../components/ui/slider.js";
|
|
6
|
+
import { Label as w } from "../../../components/ui/label.js";
|
|
7
|
+
import { cn as y } from "../../../lib/utils.js";
|
|
8
|
+
const V = g(function({
|
|
9
|
+
surfaceId: n,
|
|
10
|
+
component: p
|
|
11
|
+
}) {
|
|
12
|
+
const e = p, o = S(n, e.label, ""), l = e.min ?? 0, r = e.max ?? 100, { valid: h, errors: s } = C(n, e.checks), [m, a] = b(
|
|
13
|
+
n,
|
|
14
|
+
e.value,
|
|
15
|
+
l
|
|
16
|
+
), f = v(
|
|
17
|
+
(t) => {
|
|
18
|
+
t.length > 0 && a(t[0]);
|
|
19
|
+
},
|
|
20
|
+
[a]
|
|
21
|
+
), d = `slider-${e.id}`, x = e.weight ? { flexGrow: e.weight } : void 0;
|
|
22
|
+
return /* @__PURE__ */ c("div", { className: y("flex flex-col gap-2 py-2"), style: x, children: [
|
|
23
|
+
o && /* @__PURE__ */ i(w, { htmlFor: d, children: o }),
|
|
24
|
+
/* @__PURE__ */ i(
|
|
25
|
+
N,
|
|
26
|
+
{
|
|
27
|
+
id: d,
|
|
28
|
+
value: [m],
|
|
29
|
+
onValueChange: f,
|
|
30
|
+
min: l,
|
|
31
|
+
max: r,
|
|
32
|
+
step: 1,
|
|
33
|
+
"aria-invalid": !h
|
|
34
|
+
}
|
|
35
|
+
),
|
|
36
|
+
/* @__PURE__ */ c("div", { className: "flex justify-between text-sm text-muted-foreground", children: [
|
|
37
|
+
/* @__PURE__ */ i("span", { children: l }),
|
|
38
|
+
/* @__PURE__ */ i("span", { className: "font-medium text-foreground", children: m }),
|
|
39
|
+
/* @__PURE__ */ i("span", { children: r })
|
|
40
|
+
] }),
|
|
41
|
+
s.length > 0 && /* @__PURE__ */ i("div", { className: "text-sm text-destructive", children: s.map((t, u) => /* @__PURE__ */ i("p", { children: t }, u)) })
|
|
42
|
+
] });
|
|
43
|
+
});
|
|
44
|
+
V.displayName = "A2UI.Slider";
|
|
45
|
+
export {
|
|
46
|
+
V as SliderComponent
|
|
47
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { jsxs as T, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { memo as f, useCallback as b } from "react";
|
|
3
|
+
import { useStringBinding as C, useFormBinding as F } from "../../hooks/useDataBinding.js";
|
|
4
|
+
import { useValidation as y } from "../../hooks/useValidation.js";
|
|
5
|
+
import { Input as N } from "../../../components/ui/input.js";
|
|
6
|
+
import { Textarea as w } from "../../../components/ui/textarea.js";
|
|
7
|
+
import { Label as j } from "../../../components/ui/label.js";
|
|
8
|
+
import { cn as a } from "../../../lib/utils.js";
|
|
9
|
+
const k = {
|
|
10
|
+
shortText: "text",
|
|
11
|
+
longText: "text",
|
|
12
|
+
// Uses textarea
|
|
13
|
+
number: "number",
|
|
14
|
+
obscured: "password"
|
|
15
|
+
}, B = f(function({
|
|
16
|
+
surfaceId: n,
|
|
17
|
+
component: x
|
|
18
|
+
}) {
|
|
19
|
+
const e = x, s = C(n, e.label, ""), [l, m] = F(
|
|
20
|
+
n,
|
|
21
|
+
e.value,
|
|
22
|
+
""
|
|
23
|
+
), { valid: o, errors: c } = y(n, e.checks), d = b(
|
|
24
|
+
(r) => {
|
|
25
|
+
m(r.target.value);
|
|
26
|
+
},
|
|
27
|
+
[m]
|
|
28
|
+
), i = `textfield-${e.id}`, p = e.variant ?? "shortText", u = k[p] || "text", h = p === "longText", g = e.weight ? { flexGrow: e.weight } : void 0;
|
|
29
|
+
return /* @__PURE__ */ T("div", { className: a("flex flex-col gap-2"), style: g, children: [
|
|
30
|
+
s && /* @__PURE__ */ t(j, { htmlFor: i, children: s }),
|
|
31
|
+
h ? /* @__PURE__ */ t(
|
|
32
|
+
w,
|
|
33
|
+
{
|
|
34
|
+
id: i,
|
|
35
|
+
value: l,
|
|
36
|
+
onChange: d,
|
|
37
|
+
className: a("min-h-[100px]", !o && "border-destructive"),
|
|
38
|
+
"aria-invalid": !o
|
|
39
|
+
}
|
|
40
|
+
) : /* @__PURE__ */ t(
|
|
41
|
+
N,
|
|
42
|
+
{
|
|
43
|
+
id: i,
|
|
44
|
+
type: u,
|
|
45
|
+
value: l,
|
|
46
|
+
onChange: d,
|
|
47
|
+
className: a(!o && "border-destructive"),
|
|
48
|
+
"aria-invalid": !o
|
|
49
|
+
}
|
|
50
|
+
),
|
|
51
|
+
c.length > 0 && /* @__PURE__ */ t("div", { className: "text-sm text-destructive", children: c.map((r, v) => /* @__PURE__ */ t("p", { children: r }, v)) })
|
|
52
|
+
] });
|
|
53
|
+
});
|
|
54
|
+
B.displayName = "A2UI.TextField";
|
|
55
|
+
export {
|
|
56
|
+
B as TextFieldComponent
|
|
57
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interactive components exports.
|
|
3
|
+
*/
|
|
4
|
+
export { ButtonComponent } from './ButtonComponent';
|
|
5
|
+
export { TextFieldComponent } from './TextFieldComponent';
|
|
6
|
+
export { CheckBoxComponent } from './CheckBoxComponent';
|
|
7
|
+
export { ChoicePickerComponent } from './ChoicePickerComponent';
|
|
8
|
+
export { SliderComponent } from './SliderComponent';
|
|
9
|
+
export { DateTimeInputComponent } from './DateTimeInputComponent';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { memo as d } from "react";
|
|
3
|
+
import { Card as n, CardContent as i } from "../../../components/ui/card.js";
|
|
4
|
+
import { ComponentRenderer as p } from "../ComponentRenderer.js";
|
|
5
|
+
const c = d(function({
|
|
6
|
+
surfaceId: t,
|
|
7
|
+
component: m
|
|
8
|
+
}) {
|
|
9
|
+
const o = m, e = o.weight ? { flexGrow: o.weight } : void 0;
|
|
10
|
+
return o.child ? /* @__PURE__ */ r(n, { style: e, children: /* @__PURE__ */ r(i, { className: "p-4", children: /* @__PURE__ */ r(p, { surfaceId: t, componentId: o.child }) }) }) : /* @__PURE__ */ r(n, { style: e });
|
|
11
|
+
});
|
|
12
|
+
c.displayName = "A2UI.Card";
|
|
13
|
+
export {
|
|
14
|
+
c as CardComponent
|
|
15
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { A2UIComponentProps } from '../../contexts/ComponentsMapContext';
|
|
2
|
+
/**
|
|
3
|
+
* Column component - vertical flex container.
|
|
4
|
+
* Supports both static children and template binding for dynamic children.
|
|
5
|
+
*/
|
|
6
|
+
export declare const ColumnComponent: import('react').NamedExoticComponent<A2UIComponentProps>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { memo as f } from "react";
|
|
3
|
+
import { useDataModel as u } from "../../hooks/useDataBinding.js";
|
|
4
|
+
import { useScope as y } from "../../contexts/ScopeContext.js";
|
|
5
|
+
import { cn as d } from "../../../lib/utils.js";
|
|
6
|
+
import { ComponentRenderer as j } from "../ComponentRenderer.js";
|
|
7
|
+
import { TemplateRenderer as h } from "./TemplateRenderer.js";
|
|
8
|
+
const C = {
|
|
9
|
+
start: "justify-start",
|
|
10
|
+
center: "justify-center",
|
|
11
|
+
end: "justify-end",
|
|
12
|
+
spaceBetween: "justify-between",
|
|
13
|
+
spaceAround: "justify-around",
|
|
14
|
+
spaceEvenly: "justify-evenly",
|
|
15
|
+
stretch: "justify-stretch"
|
|
16
|
+
}, g = {
|
|
17
|
+
start: "items-start",
|
|
18
|
+
center: "items-center",
|
|
19
|
+
end: "items-end",
|
|
20
|
+
stretch: "items-stretch"
|
|
21
|
+
}, v = f(function({
|
|
22
|
+
surfaceId: o,
|
|
23
|
+
component: m
|
|
24
|
+
}) {
|
|
25
|
+
const e = m, c = u(o), { basePath: a } = y(), l = e.justify ?? "start", p = e.align ?? "stretch", r = d(
|
|
26
|
+
"flex flex-col gap-4",
|
|
27
|
+
C[l],
|
|
28
|
+
g[p]
|
|
29
|
+
), s = e.weight ? { flexGrow: e.weight } : void 0, t = e.children;
|
|
30
|
+
return Array.isArray(t) ? /* @__PURE__ */ n("div", { className: r, style: s, children: t.map((i) => /* @__PURE__ */ n(
|
|
31
|
+
j,
|
|
32
|
+
{
|
|
33
|
+
surfaceId: o,
|
|
34
|
+
componentId: i
|
|
35
|
+
},
|
|
36
|
+
i
|
|
37
|
+
)) }) : t && typeof t == "object" && "componentId" in t ? /* @__PURE__ */ n("div", { className: r, style: s, children: /* @__PURE__ */ n(
|
|
38
|
+
h,
|
|
39
|
+
{
|
|
40
|
+
surfaceId: o,
|
|
41
|
+
template: t,
|
|
42
|
+
dataModel: c,
|
|
43
|
+
basePath: a
|
|
44
|
+
}
|
|
45
|
+
) }) : /* @__PURE__ */ n("div", { className: r, style: s });
|
|
46
|
+
});
|
|
47
|
+
v.displayName = "A2UI.Column";
|
|
48
|
+
export {
|
|
49
|
+
v as ColumnComponent
|
|
50
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { A2UIComponentProps } from '../../contexts/ComponentsMapContext';
|
|
2
|
+
/**
|
|
3
|
+
* List component - displays children in a list layout.
|
|
4
|
+
* Supports both static children and template binding for dynamic children.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* // Static children
|
|
8
|
+
* { component: "List", id: "list-1", children: ["item-1", "item-2"] }
|
|
9
|
+
*
|
|
10
|
+
* // Template binding (dynamic children)
|
|
11
|
+
* {
|
|
12
|
+
* component: "List",
|
|
13
|
+
* id: "list-1",
|
|
14
|
+
* children: { componentId: "item-template", path: "/items" }
|
|
15
|
+
* }
|
|
16
|
+
*/
|
|
17
|
+
export declare const ListComponent: import('react').NamedExoticComponent<A2UIComponentProps>;
|