@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 { ActionHandler } from '@a2ui-sdk/types/0.8';
|
|
2
|
+
/**
|
|
3
|
+
* Props for A2UIRenderer.
|
|
4
|
+
*/
|
|
5
|
+
export interface A2UIRendererProps {
|
|
6
|
+
/** Callback when an action is dispatched */
|
|
7
|
+
onAction?: ActionHandler;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Component for rendering A2UI surfaces.
|
|
11
|
+
*
|
|
12
|
+
* Renders all surfaces from the A2UI context. Must be used within an A2UIProvider.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* // Basic usage
|
|
17
|
+
* <A2UIProvider messages={messages}>
|
|
18
|
+
* <A2UIRenderer onAction={handleAction} />
|
|
19
|
+
* </A2UIProvider>
|
|
20
|
+
*
|
|
21
|
+
* // With custom middleware for hooks access
|
|
22
|
+
* <A2UIProvider messages={messages}>
|
|
23
|
+
* <MyCustomComponent />
|
|
24
|
+
* <A2UIRenderer onAction={handleAction} />
|
|
25
|
+
* </A2UIProvider>
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare function A2UIRenderer({ onAction }: A2UIRendererProps): import("react/jsx-runtime").JSX.Element | null;
|
|
29
|
+
export declare namespace A2UIRenderer {
|
|
30
|
+
var displayName: string;
|
|
31
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useSurfaceContext as m } from "./contexts/SurfaceContext.js";
|
|
3
|
+
import { ActionProvider as f } from "./contexts/ActionContext.js";
|
|
4
|
+
import { ComponentRenderer as p } from "./components/ComponentRenderer.js";
|
|
5
|
+
function u({ onAction: t }) {
|
|
6
|
+
const { surfaces: i } = m(), r = Array.from(i.entries());
|
|
7
|
+
return r.length === 0 ? null : /* @__PURE__ */ n(f, { onAction: t, children: r.map(([e, o]) => o.root ? /* @__PURE__ */ n(
|
|
8
|
+
p,
|
|
9
|
+
{
|
|
10
|
+
surfaceId: e,
|
|
11
|
+
componentId: o.root
|
|
12
|
+
},
|
|
13
|
+
e
|
|
14
|
+
) : null) });
|
|
15
|
+
}
|
|
16
|
+
u.displayName = "A2UI.Renderer";
|
|
17
|
+
export {
|
|
18
|
+
u as A2UIRenderer
|
|
19
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
import { BaseComponentProps } from '@a2ui-sdk/types/0.8';
|
|
3
|
+
/**
|
|
4
|
+
* Component registry mapping component type names to React components.
|
|
5
|
+
*/
|
|
6
|
+
export declare const componentRegistry: Record<string, ComponentType<BaseComponentProps & Record<string, unknown>>>;
|
|
7
|
+
/**
|
|
8
|
+
* Props for ComponentRenderer.
|
|
9
|
+
*/
|
|
10
|
+
export interface ComponentRendererProps {
|
|
11
|
+
surfaceId: string;
|
|
12
|
+
componentId: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Renders a component based on its type from the component registry.
|
|
16
|
+
* Supports custom component overrides via ComponentsMapContext.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* // Render a component by ID
|
|
21
|
+
* <ComponentRenderer surfaceId="surface-1" componentId="text-1" />
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare const ComponentRenderer: import('react').NamedExoticComponent<ComponentRendererProps>;
|
|
25
|
+
/**
|
|
26
|
+
* Registers a custom component type.
|
|
27
|
+
*
|
|
28
|
+
* @param type - The component type name
|
|
29
|
+
* @param component - The React component to register
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```tsx
|
|
33
|
+
* registerComponent('CustomChart', ({ surfaceId, data }) => {
|
|
34
|
+
* const chartData = useDataBinding(surfaceId, data, []);
|
|
35
|
+
* return <Chart data={chartData} />;
|
|
36
|
+
* });
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare function registerComponent(type: string, component: ComponentType<BaseComponentProps & Record<string, unknown>>): void;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { jsx as C } from "react/jsx-runtime";
|
|
2
|
+
import { memo as f, useContext as l } from "react";
|
|
3
|
+
import { useComponent as s } from "../hooks/useComponent.js";
|
|
4
|
+
import { ComponentsMapContext as u } from "../contexts/ComponentsMapContext.js";
|
|
5
|
+
import { TextComponent as a } from "./display/TextComponent.js";
|
|
6
|
+
import { ImageComponent as c } from "./display/ImageComponent.js";
|
|
7
|
+
import { IconComponent as d } from "./display/IconComponent.js";
|
|
8
|
+
import { VideoComponent as x } from "./display/VideoComponent.js";
|
|
9
|
+
import { AudioPlayerComponent as T } from "./display/AudioPlayerComponent.js";
|
|
10
|
+
import { DividerComponent as h } from "./display/DividerComponent.js";
|
|
11
|
+
import { RowComponent as w } from "./layout/RowComponent.js";
|
|
12
|
+
import { ColumnComponent as g } from "./layout/ColumnComponent.js";
|
|
13
|
+
import { ListComponent as y } from "./layout/ListComponent.js";
|
|
14
|
+
import { CardComponent as A } from "./layout/CardComponent.js";
|
|
15
|
+
import { TabsComponent as M } from "./layout/TabsComponent.js";
|
|
16
|
+
import { ModalComponent as R } from "./layout/ModalComponent.js";
|
|
17
|
+
import { ButtonComponent as I } from "./interactive/ButtonComponent.js";
|
|
18
|
+
import { CheckBoxComponent as U } from "./interactive/CheckBoxComponent.js";
|
|
19
|
+
import { TextFieldComponent as B } from "./interactive/TextFieldComponent.js";
|
|
20
|
+
import { DateTimeInputComponent as D } from "./interactive/DateTimeInputComponent.js";
|
|
21
|
+
import { MultipleChoiceComponent as $ } from "./interactive/MultipleChoiceComponent.js";
|
|
22
|
+
import { SliderComponent as b } from "./interactive/SliderComponent.js";
|
|
23
|
+
const k = {
|
|
24
|
+
// Display components
|
|
25
|
+
Text: a,
|
|
26
|
+
Image: c,
|
|
27
|
+
Icon: d,
|
|
28
|
+
Video: x,
|
|
29
|
+
AudioPlayer: T,
|
|
30
|
+
Divider: h,
|
|
31
|
+
// Layout components
|
|
32
|
+
Row: w,
|
|
33
|
+
Column: g,
|
|
34
|
+
List: y,
|
|
35
|
+
Card: A,
|
|
36
|
+
Tabs: M,
|
|
37
|
+
Modal: R,
|
|
38
|
+
// Interactive components
|
|
39
|
+
Button: I,
|
|
40
|
+
CheckBox: U,
|
|
41
|
+
TextField: B,
|
|
42
|
+
DateTimeInput: D,
|
|
43
|
+
MultipleChoice: $,
|
|
44
|
+
Slider: b
|
|
45
|
+
}, j = f(function({
|
|
46
|
+
surfaceId: t,
|
|
47
|
+
componentId: o
|
|
48
|
+
}) {
|
|
49
|
+
const e = s(t, o), r = l(u);
|
|
50
|
+
if (!e)
|
|
51
|
+
return console.warn(
|
|
52
|
+
`A2UI: Component not found: ${o} on surface ${t}`
|
|
53
|
+
), null;
|
|
54
|
+
const p = Object.entries(e.component);
|
|
55
|
+
if (p.length === 0)
|
|
56
|
+
return console.warn(`A2UI: Component ${o} has no type definition`), null;
|
|
57
|
+
const [m, i] = p[0];
|
|
58
|
+
let n;
|
|
59
|
+
return r ? n = r.getComponent(m) : n = k[m], n ? (
|
|
60
|
+
// eslint-disable-next-line react-hooks/static-components
|
|
61
|
+
/* @__PURE__ */ C(
|
|
62
|
+
n,
|
|
63
|
+
{
|
|
64
|
+
surfaceId: t,
|
|
65
|
+
componentId: o,
|
|
66
|
+
weight: e.weight,
|
|
67
|
+
...i
|
|
68
|
+
}
|
|
69
|
+
)
|
|
70
|
+
) : (console.warn(`A2UI: Unknown component type: ${m}`), null);
|
|
71
|
+
});
|
|
72
|
+
j.displayName = "A2UI.ComponentRenderer";
|
|
73
|
+
export {
|
|
74
|
+
j as ComponentRenderer,
|
|
75
|
+
k as componentRegistry
|
|
76
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BaseComponentProps } from '@a2ui-sdk/types/0.8';
|
|
2
|
+
/**
|
|
3
|
+
* Props for UnknownComponent.
|
|
4
|
+
*/
|
|
5
|
+
export interface UnknownComponentProps extends BaseComponentProps {
|
|
6
|
+
/** The unknown component type name */
|
|
7
|
+
componentType: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Placeholder component for unknown types in development mode.
|
|
11
|
+
*
|
|
12
|
+
* Displays a warning box with the unknown component type name
|
|
13
|
+
* to help developers identify configuration issues.
|
|
14
|
+
*/
|
|
15
|
+
export declare function UnknownComponent({ componentId, componentType, }: UnknownComponentProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare namespace UnknownComponent {
|
|
17
|
+
var displayName: string;
|
|
18
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsxs as s, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { memo as m } from "react";
|
|
3
|
+
import { useDataBinding as n } from "../../hooks/useDataBinding.js";
|
|
4
|
+
import { cn as a } from "../../../lib/utils.js";
|
|
5
|
+
const u = m(function({
|
|
6
|
+
surfaceId: o,
|
|
7
|
+
url: i,
|
|
8
|
+
description: l
|
|
9
|
+
}) {
|
|
10
|
+
const e = n(o, i, ""), r = n(o, l, "");
|
|
11
|
+
return e ? /* @__PURE__ */ s("div", { className: a("flex flex-col gap-2"), children: [
|
|
12
|
+
r && /* @__PURE__ */ t("p", { className: "text-sm text-muted-foreground", children: r }),
|
|
13
|
+
/* @__PURE__ */ t("audio", { src: e, controls: !0, className: "w-full", children: "Your browser does not support the audio element." })
|
|
14
|
+
] }) : null;
|
|
15
|
+
});
|
|
16
|
+
u.displayName = "A2UI.AudioPlayer";
|
|
17
|
+
export {
|
|
18
|
+
u as AudioPlayerComponent
|
|
19
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { memo as t } from "react";
|
|
3
|
+
import { Separator as e } from "../../../components/ui/separator.js";
|
|
4
|
+
const i = t(function({
|
|
5
|
+
axis: o = "horizontal"
|
|
6
|
+
}) {
|
|
7
|
+
return /* @__PURE__ */ r(
|
|
8
|
+
e,
|
|
9
|
+
{
|
|
10
|
+
orientation: o,
|
|
11
|
+
className: o === "vertical" ? "self-stretch h-auto!" : "w-full"
|
|
12
|
+
}
|
|
13
|
+
);
|
|
14
|
+
});
|
|
15
|
+
i.displayName = "A2UI.Divider";
|
|
16
|
+
export {
|
|
17
|
+
i as DividerComponent
|
|
18
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { memo as i } from "react";
|
|
3
|
+
import { useDataBinding as l } from "../../hooks/useDataBinding.js";
|
|
4
|
+
import { AlertTriangle as c, EyeOff as f, Eye as s, Upload as m, StarOff as p, StarHalf as d, Star as h, ShoppingCart as C, Share2 as u, Settings as w, Send as O, Search as g, RefreshCw as k, Printer as y, Image as H, Phone as o, User as I, CreditCard as S, Bell as U, BellOff as A, MoreHorizontal as M, MoreVertical as P, Menu as v, Mail as B, Unlock as D, Lock as F, MapPin as N, Info as T, Home as b, HelpCircle as x, Folder as z, HeartOff as E, Heart as L, AlertCircle as R, CalendarDays as V, Pencil as j, Download as X, Trash2 as $, X as q, Check as G, Camera as J, Calendar as K, Paperclip as Q, ArrowRight as W, ArrowLeft as Y, Plus as Z, UserCircle as _ } from "lucide-react";
|
|
5
|
+
import { cn as ee } from "../../../lib/utils.js";
|
|
6
|
+
const re = {
|
|
7
|
+
accountCircle: _,
|
|
8
|
+
add: Z,
|
|
9
|
+
arrowBack: Y,
|
|
10
|
+
arrowForward: W,
|
|
11
|
+
attachFile: Q,
|
|
12
|
+
calendarToday: K,
|
|
13
|
+
call: o,
|
|
14
|
+
camera: J,
|
|
15
|
+
check: G,
|
|
16
|
+
close: q,
|
|
17
|
+
delete: $,
|
|
18
|
+
download: X,
|
|
19
|
+
edit: j,
|
|
20
|
+
event: V,
|
|
21
|
+
error: R,
|
|
22
|
+
favorite: L,
|
|
23
|
+
favoriteOff: E,
|
|
24
|
+
folder: z,
|
|
25
|
+
help: x,
|
|
26
|
+
home: b,
|
|
27
|
+
info: T,
|
|
28
|
+
locationOn: N,
|
|
29
|
+
lock: F,
|
|
30
|
+
lockOpen: D,
|
|
31
|
+
mail: B,
|
|
32
|
+
menu: v,
|
|
33
|
+
moreVert: P,
|
|
34
|
+
moreHoriz: M,
|
|
35
|
+
notificationsOff: A,
|
|
36
|
+
notifications: U,
|
|
37
|
+
payment: S,
|
|
38
|
+
person: I,
|
|
39
|
+
phone: o,
|
|
40
|
+
photo: H,
|
|
41
|
+
print: y,
|
|
42
|
+
refresh: k,
|
|
43
|
+
search: g,
|
|
44
|
+
send: O,
|
|
45
|
+
settings: w,
|
|
46
|
+
share: u,
|
|
47
|
+
shoppingCart: C,
|
|
48
|
+
star: h,
|
|
49
|
+
starHalf: d,
|
|
50
|
+
starOff: p,
|
|
51
|
+
upload: m,
|
|
52
|
+
visibility: s,
|
|
53
|
+
visibilityOff: f,
|
|
54
|
+
warning: c
|
|
55
|
+
}, oe = i(function({
|
|
56
|
+
surfaceId: a,
|
|
57
|
+
name: n
|
|
58
|
+
}) {
|
|
59
|
+
const e = l(a, n, "");
|
|
60
|
+
if (!e)
|
|
61
|
+
return null;
|
|
62
|
+
const r = re[e];
|
|
63
|
+
return r ? /* @__PURE__ */ t(r, { className: ee("w-5 h-5") }) : (console.warn(`A2UI: Unknown icon name: ${e}`), null);
|
|
64
|
+
});
|
|
65
|
+
oe.displayName = "A2UI.Icon";
|
|
66
|
+
export {
|
|
67
|
+
oe as IconComponent
|
|
68
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ImageComponentProps } from '@a2ui-sdk/types/0.8';
|
|
2
|
+
/**
|
|
3
|
+
* Image component for displaying images.
|
|
4
|
+
* Supports different sizes via usageHint and object-fit via fit property.
|
|
5
|
+
*/
|
|
6
|
+
export declare const ImageComponent: import('react').NamedExoticComponent<ImageComponentProps>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { memo as m } from "react";
|
|
3
|
+
import { useDataBinding as i } from "../../hooks/useDataBinding.js";
|
|
4
|
+
import { cn as s } from "../../../lib/utils.js";
|
|
5
|
+
const t = {
|
|
6
|
+
contain: "object-contain",
|
|
7
|
+
cover: "object-cover",
|
|
8
|
+
fill: "object-fill",
|
|
9
|
+
none: "object-none",
|
|
10
|
+
"scale-down": "object-scale-down"
|
|
11
|
+
}, u = {
|
|
12
|
+
icon: "w-6 h-6",
|
|
13
|
+
avatar: "w-10 h-10 rounded-full",
|
|
14
|
+
smallFeature: "w-16 h-16",
|
|
15
|
+
mediumFeature: "w-32 h-32",
|
|
16
|
+
largeFeature: "w-48 h-48",
|
|
17
|
+
header: "w-full h-48"
|
|
18
|
+
}, f = m(function({
|
|
19
|
+
surfaceId: n,
|
|
20
|
+
url: a,
|
|
21
|
+
fit: r = "cover",
|
|
22
|
+
usageHint: e
|
|
23
|
+
}) {
|
|
24
|
+
const o = i(n, a, "");
|
|
25
|
+
if (!o)
|
|
26
|
+
return null;
|
|
27
|
+
const c = s(
|
|
28
|
+
t[r] || t.cover,
|
|
29
|
+
e && u[e]
|
|
30
|
+
);
|
|
31
|
+
return /* @__PURE__ */ l("img", { src: o, alt: "", className: c, loading: "lazy" });
|
|
32
|
+
});
|
|
33
|
+
f.displayName = "A2UI.Image";
|
|
34
|
+
export {
|
|
35
|
+
f as ImageComponent
|
|
36
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { TextComponentProps } from '@a2ui-sdk/types/0.8';
|
|
2
|
+
/**
|
|
3
|
+
* Text component for displaying text content.
|
|
4
|
+
* Supports basic Markdown formatting and different text styles via usageHint.
|
|
5
|
+
*/
|
|
6
|
+
export declare const TextComponent: import('react').NamedExoticComponent<TextComponentProps>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as h } from "react/jsx-runtime";
|
|
2
|
+
import { memo as x } from "react";
|
|
3
|
+
import { useDataBinding as l } from "../../hooks/useDataBinding.js";
|
|
4
|
+
import { cn as r } from "../../../lib/utils.js";
|
|
5
|
+
const o = {
|
|
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
|
+
}, a = {
|
|
14
|
+
h1: "h1",
|
|
15
|
+
h2: "h2",
|
|
16
|
+
h3: "h3",
|
|
17
|
+
h4: "h4",
|
|
18
|
+
h5: "h5",
|
|
19
|
+
caption: "span",
|
|
20
|
+
body: "p"
|
|
21
|
+
}, c = x(function({
|
|
22
|
+
surfaceId: e,
|
|
23
|
+
text: n,
|
|
24
|
+
usageHint: t = "body"
|
|
25
|
+
}) {
|
|
26
|
+
const m = l(e, n, ""), s = r(o[t] || o.body), i = a[t] || "p";
|
|
27
|
+
return /* @__PURE__ */ h(i, { className: s, children: m });
|
|
28
|
+
});
|
|
29
|
+
c.displayName = "A2UI.Text";
|
|
30
|
+
export {
|
|
31
|
+
c as TextComponent
|
|
32
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsxs as t, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { memo as i } from "react";
|
|
3
|
+
import { useDataBinding as s } from "../../hooks/useDataBinding.js";
|
|
4
|
+
import { cn as m } from "../../../lib/utils.js";
|
|
5
|
+
const d = i(function({
|
|
6
|
+
surfaceId: r,
|
|
7
|
+
url: e
|
|
8
|
+
}) {
|
|
9
|
+
const o = s(r, e, "");
|
|
10
|
+
return o ? /* @__PURE__ */ t("video", { src: o, controls: !0, className: m("w-full rounded-lg"), children: [
|
|
11
|
+
/* @__PURE__ */ n("track", { kind: "captions" }),
|
|
12
|
+
"Your browser does not support the video tag."
|
|
13
|
+
] }) : null;
|
|
14
|
+
});
|
|
15
|
+
d.displayName = "A2UI.Video";
|
|
16
|
+
export {
|
|
17
|
+
d as VideoComponent
|
|
18
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A2UI React Renderer - Display Components
|
|
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,29 @@
|
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { memo as p, useCallback as s } from "react";
|
|
3
|
+
import { useDispatchAction as c } from "../../hooks/useDispatchAction.js";
|
|
4
|
+
import { Button as u } from "../../../components/ui/button.js";
|
|
5
|
+
import { ComponentRenderer as a } from "../ComponentRenderer.js";
|
|
6
|
+
const f = p(function({
|
|
7
|
+
surfaceId: t,
|
|
8
|
+
componentId: n,
|
|
9
|
+
child: e,
|
|
10
|
+
primary: r = !1,
|
|
11
|
+
action: o
|
|
12
|
+
}) {
|
|
13
|
+
const i = c(), l = s(() => {
|
|
14
|
+
o && i(t, n, o);
|
|
15
|
+
}, [i, t, n, o]);
|
|
16
|
+
return /* @__PURE__ */ m(
|
|
17
|
+
u,
|
|
18
|
+
{
|
|
19
|
+
variant: r ? "default" : "outline",
|
|
20
|
+
onClick: l,
|
|
21
|
+
className: "inline-flex items-center justify-center",
|
|
22
|
+
children: e ? /* @__PURE__ */ m(a, { surfaceId: t, componentId: e }) : "Button"
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
});
|
|
26
|
+
f.displayName = "A2UI.Button";
|
|
27
|
+
export {
|
|
28
|
+
f as ButtonComponent
|
|
29
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsxs as l, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { memo as p, useCallback as C } from "react";
|
|
3
|
+
import { useDataBinding as d, useFormBinding as x } from "../../hooks/useDataBinding.js";
|
|
4
|
+
import { Checkbox as k } from "../../../components/ui/checkbox.js";
|
|
5
|
+
import { Label as f } from "../../../components/ui/label.js";
|
|
6
|
+
import { cn as b } from "../../../lib/utils.js";
|
|
7
|
+
const g = p(function({
|
|
8
|
+
surfaceId: e,
|
|
9
|
+
componentId: m,
|
|
10
|
+
label: r,
|
|
11
|
+
value: s
|
|
12
|
+
}) {
|
|
13
|
+
const o = d(e, r, ""), [i, n] = x(e, s, !1), a = C(
|
|
14
|
+
(h) => {
|
|
15
|
+
n(h);
|
|
16
|
+
},
|
|
17
|
+
[n]
|
|
18
|
+
), c = `checkbox-${m}`;
|
|
19
|
+
return /* @__PURE__ */ l("div", { className: b("flex items-center gap-3"), children: [
|
|
20
|
+
/* @__PURE__ */ t(k, { id: c, checked: i, onCheckedChange: a }),
|
|
21
|
+
o && /* @__PURE__ */ t(f, { htmlFor: c, className: "cursor-pointer", children: o })
|
|
22
|
+
] });
|
|
23
|
+
});
|
|
24
|
+
g.displayName = "A2UI.CheckBox";
|
|
25
|
+
export {
|
|
26
|
+
g as CheckBoxComponent
|
|
27
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsxs as a, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { memo as x, useCallback as h } from "react";
|
|
3
|
+
import { CalendarIcon as k, ClockIcon as v } from "lucide-react";
|
|
4
|
+
import { useDataBinding as w, useFormBinding as y } from "../../hooks/useDataBinding.js";
|
|
5
|
+
import { cn as l } from "../../../lib/utils.js";
|
|
6
|
+
import { Label as C } from "../../../components/ui/label.js";
|
|
7
|
+
const I = x(function({
|
|
8
|
+
surfaceId: t,
|
|
9
|
+
componentId: d,
|
|
10
|
+
label: c,
|
|
11
|
+
value: s,
|
|
12
|
+
enableDate: e = !0,
|
|
13
|
+
enableTime: p = !1
|
|
14
|
+
}) {
|
|
15
|
+
const r = w(t, c, ""), [m, n] = y(t, s, ""), u = h(
|
|
16
|
+
(g) => {
|
|
17
|
+
n(g.target.value);
|
|
18
|
+
},
|
|
19
|
+
[n]
|
|
20
|
+
), o = `datetime-${d}`, f = e && p ? "datetime-local" : e ? "date" : "time", b = e ? k : v;
|
|
21
|
+
return /* @__PURE__ */ a("div", { className: l("flex flex-col gap-2"), children: [
|
|
22
|
+
r && /* @__PURE__ */ i(C, { htmlFor: o, children: r }),
|
|
23
|
+
/* @__PURE__ */ a("div", { className: "relative", children: [
|
|
24
|
+
/* @__PURE__ */ i(
|
|
25
|
+
"input",
|
|
26
|
+
{
|
|
27
|
+
id: o,
|
|
28
|
+
type: f,
|
|
29
|
+
value: m,
|
|
30
|
+
onChange: u,
|
|
31
|
+
className: l(
|
|
32
|
+
"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",
|
|
33
|
+
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
34
|
+
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
35
|
+
"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"
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
),
|
|
39
|
+
/* @__PURE__ */ i(b, { className: "pointer-events-none absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" })
|
|
40
|
+
] })
|
|
41
|
+
] });
|
|
42
|
+
});
|
|
43
|
+
I.displayName = "A2UI.DateTimeInput";
|
|
44
|
+
export {
|
|
45
|
+
I as DateTimeInputComponent
|
|
46
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MultipleChoiceComponentProps } from '@a2ui-sdk/types/0.8';
|
|
2
|
+
/**
|
|
3
|
+
* MultipleChoice component - dropdown/select input.
|
|
4
|
+
* When maxAllowedSelections === 1, renders as a dropdown.
|
|
5
|
+
* When maxAllowedSelections > 1 or undefined, renders as checkboxes for multi-select.
|
|
6
|
+
*/
|
|
7
|
+
export declare const MultipleChoiceComponent: import('react').NamedExoticComponent<MultipleChoiceComponentProps>;
|