@a2ui-sdk/react 0.1.0 → 0.2.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/components/ComponentRenderer.d.ts +1 -19
- package/dist/0.8/components/ComponentRenderer.js +21 -63
- package/dist/0.8/components/UnknownComponent.d.ts +3 -3
- package/dist/0.8/components/display/AudioPlayerComponent.d.ts +3 -2
- package/dist/0.8/components/display/DividerComponent.d.ts +3 -2
- package/dist/0.8/components/display/IconComponent.d.ts +3 -2
- package/dist/0.8/components/display/ImageComponent.d.ts +3 -2
- package/dist/0.8/components/display/TextComponent.d.ts +3 -2
- package/dist/0.8/components/display/VideoComponent.d.ts +3 -2
- package/dist/0.8/components/display/index.d.ts +1 -1
- package/dist/0.8/components/index.d.ts +2 -2
- package/dist/0.8/components/interactive/ButtonComponent.d.ts +3 -2
- package/dist/0.8/components/interactive/CheckBoxComponent.d.ts +3 -2
- package/dist/0.8/components/interactive/DateTimeInputComponent.d.ts +3 -2
- package/dist/0.8/components/interactive/MultipleChoiceComponent.d.ts +3 -2
- package/dist/0.8/components/interactive/SliderComponent.d.ts +3 -2
- package/dist/0.8/components/interactive/TextFieldComponent.d.ts +3 -2
- package/dist/0.8/components/interactive/index.d.ts +1 -1
- package/dist/0.8/components/layout/CardComponent.d.ts +3 -2
- package/dist/0.8/components/layout/ColumnComponent.d.ts +3 -2
- package/dist/0.8/components/layout/ListComponent.d.ts +3 -2
- package/dist/0.8/components/layout/ModalComponent.d.ts +3 -2
- package/dist/0.8/components/layout/RowComponent.d.ts +3 -2
- package/dist/0.8/components/layout/TabsComponent.d.ts +3 -2
- package/dist/0.8/components/layout/index.d.ts +1 -1
- package/dist/0.8/components/types.d.ts +8 -0
- package/dist/0.8/contexts/A2UIProvider.d.ts +37 -23
- package/dist/0.8/contexts/A2UIProvider.js +16 -22
- package/dist/0.8/contexts/ActionContext.js +5 -5
- package/dist/0.8/contexts/ComponentsMapContext.d.ts +8 -21
- package/dist/0.8/contexts/ComponentsMapContext.js +12 -16
- package/dist/0.8/contexts/DataModelContext.js +3 -3
- package/dist/0.8/index.d.ts +5 -3
- package/dist/0.8/index.js +11 -9
- package/dist/0.8/standard-catalog/index.d.ts +57 -0
- package/dist/0.8/standard-catalog/index.js +66 -0
- package/dist/0.9/A2UIRenderer.d.ts +9 -29
- package/dist/0.9/A2UIRenderer.js +27 -26
- package/dist/0.9/components/ComponentRenderer.d.ts +5 -19
- package/dist/0.9/components/ComponentRenderer.js +30 -17
- package/dist/0.9/components/UnknownComponent.d.ts +8 -2
- package/dist/0.9/components/UnknownComponent.js +13 -11
- package/dist/0.9/components/display/AudioPlayerComponent.d.ts +3 -2
- package/dist/0.9/components/display/AudioPlayerComponent.js +16 -14
- package/dist/0.9/components/display/DividerComponent.d.ts +3 -2
- package/dist/0.9/components/display/DividerComponent.js +4 -5
- package/dist/0.9/components/display/IconComponent.d.ts +3 -2
- package/dist/0.9/components/display/IconComponent.js +12 -12
- package/dist/0.9/components/display/ImageComponent.d.ts +3 -2
- package/dist/0.9/components/display/ImageComponent.js +18 -15
- package/dist/0.9/components/display/TextComponent.d.ts +3 -2
- package/dist/0.9/components/display/TextComponent.js +10 -8
- package/dist/0.9/components/display/VideoComponent.d.ts +3 -2
- package/dist/0.9/components/display/VideoComponent.js +7 -6
- package/dist/0.9/components/index.d.ts +4 -8
- package/dist/0.9/components/interactive/ButtonComponent.d.ts +3 -2
- package/dist/0.9/components/interactive/ButtonComponent.js +25 -20
- package/dist/0.9/components/interactive/CheckBoxComponent.d.ts +3 -2
- package/dist/0.9/components/interactive/CheckBoxComponent.js +33 -29
- package/dist/0.9/components/interactive/ChoicePickerComponent.d.ts +3 -2
- package/dist/0.9/components/interactive/ChoicePickerComponent.js +59 -53
- package/dist/0.9/components/interactive/DateTimeInputComponent.d.ts +3 -2
- package/dist/0.9/components/interactive/DateTimeInputComponent.js +32 -26
- package/dist/0.9/components/interactive/SliderComponent.d.ts +3 -2
- package/dist/0.9/components/interactive/SliderComponent.js +38 -32
- package/dist/0.9/components/interactive/TextFieldComponent.d.ts +3 -2
- package/dist/0.9/components/interactive/TextFieldComponent.js +41 -40
- package/dist/0.9/components/layout/CardComponent.d.ts +3 -2
- package/dist/0.9/components/layout/CardComponent.js +11 -10
- package/dist/0.9/components/layout/ColumnComponent.d.ts +3 -2
- package/dist/0.9/components/layout/ColumnComponent.js +26 -23
- package/dist/0.9/components/layout/ListComponent.d.ts +3 -2
- package/dist/0.9/components/layout/ListComponent.js +30 -27
- package/dist/0.9/components/layout/ModalComponent.d.ts +3 -2
- package/dist/0.9/components/layout/ModalComponent.js +11 -22
- package/dist/0.9/components/layout/RowComponent.d.ts +3 -2
- package/dist/0.9/components/layout/RowComponent.js +31 -28
- package/dist/0.9/components/layout/TabsComponent.d.ts +3 -2
- package/dist/0.9/components/layout/TabsComponent.js +21 -21
- package/dist/0.9/components/types.d.ts +8 -0
- package/dist/0.9/contexts/A2UIProvider.d.ts +45 -28
- package/dist/0.9/contexts/A2UIProvider.js +18 -26
- package/dist/0.9/contexts/ActionContext.js +5 -5
- package/dist/0.9/contexts/ComponentsMapContext.d.ts +8 -31
- package/dist/0.9/contexts/ComponentsMapContext.js +12 -16
- package/dist/0.9/contexts/ScopeContext.js +3 -3
- package/dist/0.9/contexts/SurfaceContext.d.ts +3 -3
- package/dist/0.9/contexts/SurfaceContext.js +3 -3
- package/dist/0.9/hooks/useComponent.d.ts +2 -2
- package/dist/0.9/hooks/useDataBinding.js +3 -3
- package/dist/0.9/index.d.ts +6 -4
- package/dist/0.9/index.js +12 -10
- package/dist/0.9/standard-catalog/index.d.ts +61 -0
- package/dist/0.9/standard-catalog/index.js +69 -0
- package/dist/components/ui/button.d.ts +1 -1
- package/dist/lib/utils.d.ts +5 -0
- package/dist/lib/utils.js +6 -4
- package/package.json +14 -5
- package/dist/0.9/components/index.js +0 -68
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { memo as
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { memo as i } from "react";
|
|
3
3
|
import { useStringBinding as l } from "../../hooks/useDataBinding.js";
|
|
4
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 g, Search as O, RefreshCw as S, Printer as k, Image as y, Phone as o, User as H, CreditCard as I, Bell as U, BellOff as A, MoreHorizontal as M, MoreVertical as P, Menu as v, Mail as B, Unlock as F, Lock as N, MapPin as T, Info as b, Home as x, HelpCircle as z, Folder as D, 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
|
|
6
|
-
const
|
|
5
|
+
import { cn as rr } from "../../../lib/utils.js";
|
|
6
|
+
const er = {
|
|
7
7
|
accountCircle: _,
|
|
8
8
|
add: Z,
|
|
9
9
|
arrowBack: Y,
|
|
@@ -52,17 +52,17 @@ const re = {
|
|
|
52
52
|
visibility: s,
|
|
53
53
|
visibilityOff: f,
|
|
54
54
|
warning: c
|
|
55
|
-
},
|
|
55
|
+
}, or = i(function({
|
|
56
56
|
surfaceId: n,
|
|
57
|
-
|
|
57
|
+
name: a
|
|
58
58
|
}) {
|
|
59
|
-
const
|
|
60
|
-
if (!
|
|
59
|
+
const r = l(n, a, "");
|
|
60
|
+
if (!r)
|
|
61
61
|
return null;
|
|
62
|
-
const
|
|
63
|
-
return
|
|
62
|
+
const e = er[r];
|
|
63
|
+
return e ? /* @__PURE__ */ t(e, { className: rr("w-5 h-5") }) : (console.warn(`[A2UI 0.9] Unknown icon name: ${r}`), null);
|
|
64
64
|
});
|
|
65
|
-
|
|
65
|
+
or.displayName = "A2UI.Icon";
|
|
66
66
|
export {
|
|
67
|
-
|
|
67
|
+
or as IconComponent
|
|
68
68
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ImageComponentProps } from '@a2ui-sdk/types/0.9/standard-catalog';
|
|
2
|
+
import { A2UIComponentProps } from '../types';
|
|
2
3
|
/**
|
|
3
4
|
* Image component for displaying images.
|
|
4
5
|
* Supports different sizes via variant and object-fit via fit property.
|
|
5
6
|
*/
|
|
6
|
-
export declare const ImageComponent: import('react').NamedExoticComponent<A2UIComponentProps
|
|
7
|
+
export declare const ImageComponent: import('react').NamedExoticComponent<A2UIComponentProps<ImageComponentProps>>;
|
|
@@ -1,43 +1,46 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import { memo as s } from "react";
|
|
3
3
|
import { useStringBinding as f } from "../../hooks/useDataBinding.js";
|
|
4
4
|
import { cn as u } from "../../../lib/utils.js";
|
|
5
|
-
const
|
|
5
|
+
const t = {
|
|
6
6
|
contain: "object-contain",
|
|
7
7
|
cover: "object-cover",
|
|
8
8
|
fill: "object-fill",
|
|
9
9
|
none: "object-none",
|
|
10
10
|
"scale-down": "object-scale-down"
|
|
11
|
-
},
|
|
11
|
+
}, d = {
|
|
12
12
|
icon: "w-6 h-6",
|
|
13
13
|
avatar: "w-10 h-10 rounded-full",
|
|
14
14
|
smallFeature: "w-16 h-16",
|
|
15
15
|
mediumFeature: "w-32 h-32",
|
|
16
16
|
largeFeature: "w-48 h-48",
|
|
17
17
|
header: "w-full h-48"
|
|
18
|
-
},
|
|
18
|
+
}, g = s(function({
|
|
19
19
|
surfaceId: r,
|
|
20
|
-
|
|
20
|
+
url: l,
|
|
21
|
+
fit: a = "cover",
|
|
22
|
+
variant: o,
|
|
23
|
+
weight: e
|
|
21
24
|
}) {
|
|
22
|
-
const
|
|
23
|
-
if (!
|
|
25
|
+
const n = f(r, l, "");
|
|
26
|
+
if (!n)
|
|
24
27
|
return null;
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
const c = e ? { flexGrow: e } : void 0, m = u(
|
|
29
|
+
t[a] || t.cover,
|
|
30
|
+
o && d[o]
|
|
28
31
|
);
|
|
29
|
-
return /* @__PURE__ */
|
|
32
|
+
return /* @__PURE__ */ i(
|
|
30
33
|
"img",
|
|
31
34
|
{
|
|
32
|
-
src:
|
|
35
|
+
src: n,
|
|
33
36
|
alt: "",
|
|
34
|
-
className:
|
|
37
|
+
className: m,
|
|
35
38
|
style: c,
|
|
36
39
|
loading: "lazy"
|
|
37
40
|
}
|
|
38
41
|
);
|
|
39
42
|
});
|
|
40
|
-
|
|
43
|
+
g.displayName = "A2UI.Image";
|
|
41
44
|
export {
|
|
42
|
-
|
|
45
|
+
g as ImageComponent
|
|
43
46
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TextComponentProps } from '@a2ui-sdk/types/0.9/standard-catalog';
|
|
2
|
+
import { A2UIComponentProps } from '../types';
|
|
2
3
|
/**
|
|
3
4
|
* Text component for displaying text content.
|
|
4
5
|
* Supports different text styles via variant.
|
|
5
6
|
*/
|
|
6
|
-
export declare const TextComponent: import('react').NamedExoticComponent<A2UIComponentProps
|
|
7
|
+
export declare const TextComponent: import('react').NamedExoticComponent<A2UIComponentProps<TextComponentProps>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import { memo as x } from "react";
|
|
3
|
-
import { useStringBinding as
|
|
3
|
+
import { useStringBinding as h } from "../../hooks/useDataBinding.js";
|
|
4
4
|
import { cn as c } from "../../../lib/utils.js";
|
|
5
5
|
const e = {
|
|
6
6
|
h1: "text-3xl font-bold tracking-tight",
|
|
@@ -18,14 +18,16 @@ const e = {
|
|
|
18
18
|
h5: "h5",
|
|
19
19
|
caption: "span",
|
|
20
20
|
body: "p"
|
|
21
|
-
},
|
|
21
|
+
}, a = x(function({
|
|
22
22
|
surfaceId: n,
|
|
23
|
-
|
|
23
|
+
text: s,
|
|
24
|
+
variant: t = "body",
|
|
25
|
+
weight: o
|
|
24
26
|
}) {
|
|
25
|
-
const
|
|
26
|
-
return /* @__PURE__ */
|
|
27
|
+
const m = h(n, s, ""), i = c(e[t] || e.body), l = d[t] || "p";
|
|
28
|
+
return /* @__PURE__ */ r(l, { className: i, style: o ? { flexGrow: o } : void 0, children: m });
|
|
27
29
|
});
|
|
28
|
-
|
|
30
|
+
a.displayName = "A2UI.Text";
|
|
29
31
|
export {
|
|
30
|
-
|
|
32
|
+
a as TextComponent
|
|
31
33
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { VideoComponentProps } from '@a2ui-sdk/types/0.9/standard-catalog';
|
|
2
|
+
import { A2UIComponentProps } from '../types';
|
|
2
3
|
/**
|
|
3
4
|
* Video component for displaying video content.
|
|
4
5
|
*/
|
|
5
|
-
export declare const VideoComponent: import('react').NamedExoticComponent<A2UIComponentProps
|
|
6
|
+
export declare const VideoComponent: import('react').NamedExoticComponent<A2UIComponentProps<VideoComponentProps>>;
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as i, jsx as s } from "react/jsx-runtime";
|
|
2
2
|
import { memo as d } from "react";
|
|
3
3
|
import { useStringBinding as m } from "../../hooks/useDataBinding.js";
|
|
4
4
|
import { cn as l } from "../../../lib/utils.js";
|
|
5
5
|
const c = d(function({
|
|
6
6
|
surfaceId: e,
|
|
7
|
-
|
|
7
|
+
url: n,
|
|
8
|
+
weight: o
|
|
8
9
|
}) {
|
|
9
|
-
const
|
|
10
|
+
const r = m(e, n, "");
|
|
10
11
|
if (!r)
|
|
11
12
|
return null;
|
|
12
|
-
const
|
|
13
|
-
return /* @__PURE__ */
|
|
13
|
+
const t = o ? { flexGrow: o } : void 0;
|
|
14
|
+
return /* @__PURE__ */ i(
|
|
14
15
|
"video",
|
|
15
16
|
{
|
|
16
17
|
src: r,
|
|
17
18
|
controls: !0,
|
|
18
19
|
className: l("w-full rounded-lg"),
|
|
19
|
-
style:
|
|
20
|
+
style: t,
|
|
20
21
|
children: [
|
|
21
22
|
/* @__PURE__ */ s("track", { kind: "captions" }),
|
|
22
23
|
"Your browser does not support the video tag."
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Components exports and registry.
|
|
3
|
+
*/
|
|
4
|
+
export { ComponentRenderer } from './ComponentRenderer';
|
|
4
5
|
export { UnknownComponent } from './UnknownComponent';
|
|
5
6
|
export { TextComponent, ImageComponent, IconComponent, VideoComponent, AudioPlayerComponent, DividerComponent, } from './display';
|
|
6
7
|
export { RowComponent, ColumnComponent, ListComponent, CardComponent, TabsComponent, ModalComponent, TemplateRenderer, } from './layout';
|
|
7
8
|
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>>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ButtonComponentProps } from '@a2ui-sdk/types/0.9/standard-catalog';
|
|
2
|
+
import { A2UIComponentProps } from '../types';
|
|
2
3
|
/**
|
|
3
4
|
* Button component - triggers actions on click.
|
|
4
5
|
* When checks are defined and fail, the button is disabled.
|
|
5
6
|
*/
|
|
6
|
-
export declare const ButtonComponent: import('react').NamedExoticComponent<A2UIComponentProps
|
|
7
|
+
export declare const ButtonComponent: import('react').NamedExoticComponent<A2UIComponentProps<ButtonComponentProps>>;
|
|
@@ -1,29 +1,34 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { memo as
|
|
3
|
-
import { useDispatchAction as
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { memo as c, useCallback as f } from "react";
|
|
3
|
+
import { useDispatchAction as u } from "../../hooks/useDispatchAction.js";
|
|
4
4
|
import { useValidation as d } from "../../hooks/useValidation.js";
|
|
5
|
-
import { Button as
|
|
6
|
-
import { ComponentRenderer as
|
|
7
|
-
const
|
|
8
|
-
surfaceId:
|
|
9
|
-
|
|
5
|
+
import { Button as C } from "../../../components/ui/button.js";
|
|
6
|
+
import { ComponentRenderer as B } from "../ComponentRenderer.js";
|
|
7
|
+
const b = c(function({
|
|
8
|
+
surfaceId: t,
|
|
9
|
+
componentId: n,
|
|
10
|
+
child: e,
|
|
11
|
+
primary: m = !1,
|
|
12
|
+
action: o,
|
|
13
|
+
checks: r,
|
|
14
|
+
weight: i
|
|
10
15
|
}) {
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
}, [
|
|
14
|
-
return /* @__PURE__ */
|
|
15
|
-
|
|
16
|
+
const s = u(), { valid: a } = d(t, r), p = f(() => {
|
|
17
|
+
o && s(t, n, o);
|
|
18
|
+
}, [s, t, n, o]);
|
|
19
|
+
return /* @__PURE__ */ l(
|
|
20
|
+
C,
|
|
16
21
|
{
|
|
17
|
-
variant:
|
|
18
|
-
onClick:
|
|
19
|
-
disabled:
|
|
22
|
+
variant: m ? "default" : "outline",
|
|
23
|
+
onClick: p,
|
|
24
|
+
disabled: !a,
|
|
20
25
|
className: "inline-flex items-center justify-center",
|
|
21
|
-
style:
|
|
22
|
-
children:
|
|
26
|
+
style: i ? { flexGrow: i } : void 0,
|
|
27
|
+
children: e ? /* @__PURE__ */ l(B, { surfaceId: t, componentId: e }) : "Button"
|
|
23
28
|
}
|
|
24
29
|
);
|
|
25
30
|
});
|
|
26
|
-
|
|
31
|
+
b.displayName = "A2UI.Button";
|
|
27
32
|
export {
|
|
28
|
-
|
|
33
|
+
b as ButtonComponent
|
|
29
34
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CheckBoxComponentProps } from '@a2ui-sdk/types/0.9/standard-catalog';
|
|
2
|
+
import { A2UIComponentProps } from '../types';
|
|
2
3
|
/**
|
|
3
4
|
* CheckBox component - checkbox input with label.
|
|
4
5
|
*/
|
|
5
|
-
export declare const CheckBoxComponent: import('react').NamedExoticComponent<A2UIComponentProps
|
|
6
|
+
export declare const CheckBoxComponent: import('react').NamedExoticComponent<A2UIComponentProps<CheckBoxComponentProps>>;
|
|
@@ -1,41 +1,45 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { memo as
|
|
3
|
-
import { useStringBinding as
|
|
4
|
-
import { useValidation as
|
|
5
|
-
import { Checkbox as
|
|
6
|
-
import { Label as
|
|
7
|
-
import { cn as
|
|
8
|
-
const
|
|
9
|
-
surfaceId:
|
|
10
|
-
|
|
1
|
+
import { jsxs as m, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { memo as v, useCallback as g } from "react";
|
|
3
|
+
import { useStringBinding as u, useFormBinding as b } from "../../hooks/useDataBinding.js";
|
|
4
|
+
import { useValidation as B } from "../../hooks/useValidation.js";
|
|
5
|
+
import { Checkbox as N } from "../../../components/ui/checkbox.js";
|
|
6
|
+
import { Label as j } from "../../../components/ui/label.js";
|
|
7
|
+
import { cn as y } from "../../../lib/utils.js";
|
|
8
|
+
const F = v(function({
|
|
9
|
+
surfaceId: o,
|
|
10
|
+
componentId: s,
|
|
11
|
+
label: a,
|
|
12
|
+
value: d,
|
|
13
|
+
checks: h,
|
|
14
|
+
weight: t
|
|
11
15
|
}) {
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
const r = u(o, a, ""), [p, i] = b(
|
|
17
|
+
o,
|
|
18
|
+
d,
|
|
15
19
|
!1
|
|
16
|
-
), { valid:
|
|
17
|
-
(
|
|
18
|
-
n
|
|
20
|
+
), { valid: x, errors: c } = B(o, h), f = g(
|
|
21
|
+
(n) => {
|
|
22
|
+
i(n);
|
|
19
23
|
},
|
|
20
|
-
[
|
|
21
|
-
), l = `checkbox-${
|
|
22
|
-
return /* @__PURE__ */
|
|
23
|
-
/* @__PURE__ */
|
|
24
|
-
/* @__PURE__ */
|
|
25
|
-
|
|
24
|
+
[i]
|
|
25
|
+
), l = `checkbox-${s}`, C = t ? { flexGrow: t } : void 0;
|
|
26
|
+
return /* @__PURE__ */ m("div", { className: y("flex flex-col gap-1"), style: C, children: [
|
|
27
|
+
/* @__PURE__ */ m("div", { className: "flex items-center gap-3", children: [
|
|
28
|
+
/* @__PURE__ */ e(
|
|
29
|
+
N,
|
|
26
30
|
{
|
|
27
31
|
id: l,
|
|
28
|
-
checked:
|
|
29
|
-
onCheckedChange:
|
|
30
|
-
"aria-invalid": !
|
|
32
|
+
checked: p,
|
|
33
|
+
onCheckedChange: f,
|
|
34
|
+
"aria-invalid": !x
|
|
31
35
|
}
|
|
32
36
|
),
|
|
33
|
-
|
|
37
|
+
r && /* @__PURE__ */ e(j, { htmlFor: l, className: "cursor-pointer", children: r })
|
|
34
38
|
] }),
|
|
35
|
-
|
|
39
|
+
c.length > 0 && /* @__PURE__ */ e("div", { className: "text-sm text-destructive ml-6", children: c.map((n, k) => /* @__PURE__ */ e("p", { children: n }, k)) })
|
|
36
40
|
] });
|
|
37
41
|
});
|
|
38
|
-
|
|
42
|
+
F.displayName = "A2UI.CheckBox";
|
|
39
43
|
export {
|
|
40
|
-
|
|
44
|
+
F as CheckBoxComponent
|
|
41
45
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ChoicePickerComponentProps } from '@a2ui-sdk/types/0.9/standard-catalog';
|
|
2
|
+
import { A2UIComponentProps } from '../types';
|
|
2
3
|
/**
|
|
3
4
|
* ChoicePicker component - choice picker input.
|
|
4
5
|
* When variant === 'mutuallyExclusive', renders as a dropdown.
|
|
5
6
|
* When variant === 'multipleSelection' or undefined, renders as checkboxes.
|
|
6
7
|
*/
|
|
7
|
-
export declare const ChoicePickerComponent: import('react').NamedExoticComponent<A2UIComponentProps
|
|
8
|
+
export declare const ChoicePickerComponent: import('react').NamedExoticComponent<A2UIComponentProps<ChoicePickerComponentProps>>;
|
|
@@ -1,80 +1,86 @@
|
|
|
1
|
-
import { jsxs as m, jsx as e, Fragment as
|
|
2
|
-
import { memo as
|
|
3
|
-
import { useStringBinding as
|
|
4
|
-
import { useValidation as
|
|
5
|
-
import { Select as
|
|
6
|
-
import { Checkbox as
|
|
7
|
-
import { Label as
|
|
8
|
-
import { cn as
|
|
9
|
-
function
|
|
10
|
-
surfaceId:
|
|
11
|
-
label:
|
|
1
|
+
import { jsxs as m, jsx as e, Fragment as j } from "react/jsx-runtime";
|
|
2
|
+
import { memo as B, useCallback as b } from "react";
|
|
3
|
+
import { useStringBinding as y, useFormBinding as L } from "../../hooks/useDataBinding.js";
|
|
4
|
+
import { useValidation as E } from "../../hooks/useValidation.js";
|
|
5
|
+
import { Select as G, SelectTrigger as M, SelectValue as O, SelectContent as U, SelectItem as q } from "../../../components/ui/select.js";
|
|
6
|
+
import { Checkbox as w } from "../../../components/ui/checkbox.js";
|
|
7
|
+
import { Label as v } from "../../../components/ui/label.js";
|
|
8
|
+
import { cn as p } from "../../../lib/utils.js";
|
|
9
|
+
function k({
|
|
10
|
+
surfaceId: x,
|
|
11
|
+
label: t
|
|
12
12
|
}) {
|
|
13
|
-
const d =
|
|
14
|
-
return /* @__PURE__ */ e(
|
|
13
|
+
const d = y(x, t, "");
|
|
14
|
+
return /* @__PURE__ */ e(j, { children: d });
|
|
15
15
|
}
|
|
16
|
-
const
|
|
17
|
-
surfaceId:
|
|
18
|
-
|
|
16
|
+
const z = B(function({
|
|
17
|
+
surfaceId: t,
|
|
18
|
+
componentId: d,
|
|
19
|
+
label: N,
|
|
20
|
+
variant: A = "multipleSelection",
|
|
21
|
+
options: a,
|
|
22
|
+
value: V,
|
|
23
|
+
checks: F,
|
|
24
|
+
weight: g
|
|
19
25
|
}) {
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
),
|
|
26
|
+
const s = y(t, N, ""), f = A === "mutuallyExclusive", { valid: C, errors: o } = E(t, F), [r, i] = L(
|
|
27
|
+
t,
|
|
28
|
+
V,
|
|
29
|
+
f ? "" : []
|
|
30
|
+
), P = b(
|
|
25
31
|
(l) => {
|
|
26
|
-
|
|
32
|
+
i(l);
|
|
27
33
|
},
|
|
28
|
-
[
|
|
29
|
-
),
|
|
30
|
-
(l,
|
|
31
|
-
const n = Array.isArray(
|
|
32
|
-
|
|
34
|
+
[i]
|
|
35
|
+
), T = b(
|
|
36
|
+
(l, c) => {
|
|
37
|
+
const n = Array.isArray(r) ? r : r ? [r] : [];
|
|
38
|
+
i(c ? [...n, l] : n.filter((u) => u !== l));
|
|
33
39
|
},
|
|
34
|
-
[
|
|
35
|
-
), h = `choicepicker-${
|
|
36
|
-
if (!
|
|
40
|
+
[r, i]
|
|
41
|
+
), h = `choicepicker-${d}`, S = g ? { flexGrow: g } : void 0;
|
|
42
|
+
if (!a || a.length === 0)
|
|
37
43
|
return null;
|
|
38
|
-
if (
|
|
39
|
-
const l = Array.isArray(
|
|
40
|
-
return /* @__PURE__ */ m("div", { className:
|
|
41
|
-
|
|
42
|
-
/* @__PURE__ */ m(
|
|
44
|
+
if (f) {
|
|
45
|
+
const l = Array.isArray(r) ? r[0] || "" : r;
|
|
46
|
+
return /* @__PURE__ */ m("div", { className: p("flex flex-col gap-2"), style: S, children: [
|
|
47
|
+
s && /* @__PURE__ */ e(v, { htmlFor: h, children: s }),
|
|
48
|
+
/* @__PURE__ */ m(G, { value: l, onValueChange: P, children: [
|
|
43
49
|
/* @__PURE__ */ e(
|
|
44
|
-
|
|
50
|
+
M,
|
|
45
51
|
{
|
|
46
52
|
id: h,
|
|
47
|
-
className:
|
|
48
|
-
"aria-invalid": !
|
|
49
|
-
children: /* @__PURE__ */ e(
|
|
53
|
+
className: p(!C && "border-destructive"),
|
|
54
|
+
"aria-invalid": !C,
|
|
55
|
+
children: /* @__PURE__ */ e(O, { placeholder: "Select an option" })
|
|
50
56
|
}
|
|
51
57
|
),
|
|
52
|
-
/* @__PURE__ */ e(
|
|
58
|
+
/* @__PURE__ */ e(U, { children: a.map((c) => /* @__PURE__ */ e(q, { value: c.value, children: /* @__PURE__ */ e(k, { surfaceId: t, label: c.label }) }, c.value)) })
|
|
53
59
|
] }),
|
|
54
|
-
|
|
60
|
+
o.length > 0 && /* @__PURE__ */ e("div", { className: "text-sm text-destructive", children: o.map((c, n) => /* @__PURE__ */ e("p", { children: c }, n)) })
|
|
55
61
|
] });
|
|
56
62
|
}
|
|
57
|
-
const
|
|
58
|
-
return /* @__PURE__ */ m("div", { className:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const
|
|
63
|
+
const $ = Array.isArray(r) ? r : r ? [r] : [];
|
|
64
|
+
return /* @__PURE__ */ m("div", { className: p("flex flex-col gap-2"), style: S, children: [
|
|
65
|
+
s && /* @__PURE__ */ e(v, { children: s }),
|
|
66
|
+
a.map((l) => {
|
|
67
|
+
const c = $.includes(l.value), n = `${h}-${l.value}`;
|
|
62
68
|
return /* @__PURE__ */ m("div", { className: "flex items-center gap-2", children: [
|
|
63
69
|
/* @__PURE__ */ e(
|
|
64
|
-
|
|
70
|
+
w,
|
|
65
71
|
{
|
|
66
72
|
id: n,
|
|
67
|
-
checked:
|
|
68
|
-
onCheckedChange: (u) =>
|
|
73
|
+
checked: c,
|
|
74
|
+
onCheckedChange: (u) => T(l.value, u === !0)
|
|
69
75
|
}
|
|
70
76
|
),
|
|
71
|
-
/* @__PURE__ */ e(
|
|
77
|
+
/* @__PURE__ */ e(v, { htmlFor: n, className: "cursor-pointer", children: /* @__PURE__ */ e(k, { surfaceId: t, label: l.label }) })
|
|
72
78
|
] }, l.value);
|
|
73
79
|
}),
|
|
74
|
-
|
|
80
|
+
o.length > 0 && /* @__PURE__ */ e("div", { className: "text-sm text-destructive", children: o.map((l, c) => /* @__PURE__ */ e("p", { children: l }, c)) })
|
|
75
81
|
] });
|
|
76
82
|
});
|
|
77
|
-
|
|
83
|
+
z.displayName = "A2UI.ChoicePicker";
|
|
78
84
|
export {
|
|
79
|
-
|
|
85
|
+
z as ChoicePickerComponent
|
|
80
86
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DateTimeInputComponentProps } from '@a2ui-sdk/types/0.9/standard-catalog';
|
|
2
|
+
import { A2UIComponentProps } from '../types';
|
|
2
3
|
/**
|
|
3
4
|
* DateTimeInput component - date/time picker using native HTML5 inputs.
|
|
4
5
|
*/
|
|
5
|
-
export declare const DateTimeInputComponent: import('react').NamedExoticComponent<A2UIComponentProps
|
|
6
|
+
export declare const DateTimeInputComponent: import('react').NamedExoticComponent<A2UIComponentProps<DateTimeInputComponentProps>>;
|
|
@@ -1,50 +1,56 @@
|
|
|
1
|
-
import { jsxs as c, jsx as
|
|
2
|
-
import { memo as
|
|
3
|
-
import { CalendarIcon as
|
|
4
|
-
import { useStringBinding as
|
|
5
|
-
import { useValidation as
|
|
1
|
+
import { jsxs as c, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { memo as C, useCallback as N } from "react";
|
|
3
|
+
import { CalendarIcon as I, ClockIcon as T } from "lucide-react";
|
|
4
|
+
import { useStringBinding as V, useFormBinding as j } from "../../hooks/useDataBinding.js";
|
|
5
|
+
import { useValidation as B } from "../../hooks/useValidation.js";
|
|
6
6
|
import { cn as m } from "../../../lib/utils.js";
|
|
7
|
-
import { Label as
|
|
8
|
-
const
|
|
7
|
+
import { Label as D } from "../../../components/ui/label.js";
|
|
8
|
+
const F = C(function({
|
|
9
9
|
surfaceId: i,
|
|
10
|
-
|
|
10
|
+
componentId: p,
|
|
11
|
+
label: u,
|
|
12
|
+
value: f,
|
|
13
|
+
enableDate: t = !0,
|
|
14
|
+
enableTime: b = !1,
|
|
15
|
+
checks: g,
|
|
16
|
+
weight: n
|
|
11
17
|
}) {
|
|
12
|
-
const
|
|
18
|
+
const o = V(i, u, ""), { valid: a, errors: l } = B(i, g), [v, d] = j(
|
|
13
19
|
i,
|
|
14
|
-
|
|
20
|
+
f,
|
|
15
21
|
""
|
|
16
|
-
),
|
|
17
|
-
(
|
|
18
|
-
d(
|
|
22
|
+
), x = N(
|
|
23
|
+
(r) => {
|
|
24
|
+
d(r.target.value);
|
|
19
25
|
},
|
|
20
26
|
[d]
|
|
21
|
-
), s = `datetime-${
|
|
22
|
-
return /* @__PURE__ */ c("div", { className: m("flex flex-col gap-2"), style:
|
|
23
|
-
|
|
27
|
+
), s = `datetime-${p}`, h = t && b ? "datetime-local" : t ? "date" : "time", k = t ? I : T, w = n ? { flexGrow: n } : void 0;
|
|
28
|
+
return /* @__PURE__ */ c("div", { className: m("flex flex-col gap-2"), style: w, children: [
|
|
29
|
+
o && /* @__PURE__ */ e(D, { htmlFor: s, children: o }),
|
|
24
30
|
/* @__PURE__ */ c("div", { className: "relative", children: [
|
|
25
|
-
/* @__PURE__ */
|
|
31
|
+
/* @__PURE__ */ e(
|
|
26
32
|
"input",
|
|
27
33
|
{
|
|
28
34
|
id: s,
|
|
29
|
-
type:
|
|
30
|
-
value:
|
|
31
|
-
onChange:
|
|
32
|
-
"aria-invalid": !
|
|
35
|
+
type: h,
|
|
36
|
+
value: v,
|
|
37
|
+
onChange: x,
|
|
38
|
+
"aria-invalid": !a,
|
|
33
39
|
className: m(
|
|
34
40
|
"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
41
|
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
36
42
|
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
37
43
|
"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
|
-
!
|
|
44
|
+
!a && "border-destructive"
|
|
39
45
|
)
|
|
40
46
|
}
|
|
41
47
|
),
|
|
42
|
-
/* @__PURE__ */
|
|
48
|
+
/* @__PURE__ */ e(k, { className: "pointer-events-none absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" })
|
|
43
49
|
] }),
|
|
44
|
-
l.length > 0 && /* @__PURE__ */
|
|
50
|
+
l.length > 0 && /* @__PURE__ */ e("div", { className: "text-sm text-destructive", children: l.map((r, y) => /* @__PURE__ */ e("p", { children: r }, y)) })
|
|
45
51
|
] });
|
|
46
52
|
});
|
|
47
|
-
|
|
53
|
+
F.displayName = "A2UI.DateTimeInput";
|
|
48
54
|
export {
|
|
49
|
-
|
|
55
|
+
F as DateTimeInputComponent
|
|
50
56
|
};
|