@a2ui-sdk/react 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @a2ui-sdk/react
|
|
2
2
|
|
|
3
|
-
React implementation for rendering A2UI protocol. This package provides React components and hooks for integrating A2UI
|
|
3
|
+
React implementation for rendering A2UI protocol. This package provides React components and hooks for integrating A2UI renderer into your application.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { memo as
|
|
3
|
-
import { useDataBinding as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
1
|
+
import { jsxs as p, jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { memo as x, useCallback as C } from "react";
|
|
3
|
+
import { useDataBinding as k, useFormBinding as d } from "../../hooks/useDataBinding.js";
|
|
4
|
+
import { useScopeBasePath as f } from "../../contexts/ScopeContext.js";
|
|
5
|
+
import { Checkbox as b } from "../../../components/ui/checkbox.js";
|
|
6
|
+
import { Label as g } from "../../../components/ui/label.js";
|
|
7
|
+
import { cn as u } from "../../../lib/utils.js";
|
|
8
|
+
const B = x(function({
|
|
8
9
|
surfaceId: e,
|
|
9
|
-
componentId:
|
|
10
|
-
label:
|
|
11
|
-
value:
|
|
10
|
+
componentId: o,
|
|
11
|
+
label: s,
|
|
12
|
+
value: a
|
|
12
13
|
}) {
|
|
13
|
-
const
|
|
14
|
-
(
|
|
15
|
-
|
|
14
|
+
const c = k(e, s, ""), [i, t] = d(e, a, !1), r = f(), h = C(
|
|
15
|
+
(l) => {
|
|
16
|
+
t(l);
|
|
16
17
|
},
|
|
17
|
-
[
|
|
18
|
-
),
|
|
19
|
-
return /* @__PURE__ */
|
|
20
|
-
/* @__PURE__ */
|
|
21
|
-
|
|
18
|
+
[t]
|
|
19
|
+
), n = r ? `checkbox-${o}-${r.replace(/\//g, "-")}` : `checkbox-${o}`;
|
|
20
|
+
return /* @__PURE__ */ p("div", { className: u("flex items-center gap-3"), children: [
|
|
21
|
+
/* @__PURE__ */ m(b, { id: n, checked: i, onCheckedChange: h }),
|
|
22
|
+
c && /* @__PURE__ */ m(g, { htmlFor: n, className: "cursor-pointer", children: c })
|
|
22
23
|
] });
|
|
23
24
|
});
|
|
24
|
-
|
|
25
|
+
B.displayName = "A2UI.CheckBox";
|
|
25
26
|
export {
|
|
26
|
-
|
|
27
|
+
B as CheckBoxComponent
|
|
27
28
|
};
|
|
@@ -1,45 +1,46 @@
|
|
|
1
1
|
import { jsxs as m, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { memo as
|
|
3
|
-
import { useStringBinding as
|
|
4
|
-
import { useValidation as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
2
|
+
import { memo as u, useCallback as v } from "react";
|
|
3
|
+
import { useStringBinding as b, useFormBinding as B } from "../../hooks/useDataBinding.js";
|
|
4
|
+
import { useValidation as N } from "../../hooks/useValidation.js";
|
|
5
|
+
import { useScopeBasePath as $ } from "../../contexts/ScopeContext.js";
|
|
6
|
+
import { Checkbox as j } from "../../../components/ui/checkbox.js";
|
|
7
|
+
import { Label as y } from "../../../components/ui/label.js";
|
|
8
|
+
import { cn as F } from "../../../lib/utils.js";
|
|
9
|
+
const P = u(function({
|
|
9
10
|
surfaceId: o,
|
|
10
|
-
componentId:
|
|
11
|
-
label:
|
|
11
|
+
componentId: r,
|
|
12
|
+
label: h,
|
|
12
13
|
value: d,
|
|
13
|
-
checks:
|
|
14
|
-
weight:
|
|
14
|
+
checks: p,
|
|
15
|
+
weight: c
|
|
15
16
|
}) {
|
|
16
|
-
const
|
|
17
|
+
const i = b(o, h, ""), [x, n] = B(
|
|
17
18
|
o,
|
|
18
19
|
d,
|
|
19
20
|
!1
|
|
20
|
-
), { valid:
|
|
21
|
-
(
|
|
22
|
-
|
|
21
|
+
), { valid: f, errors: s } = N(o, p), a = $(), C = v(
|
|
22
|
+
(t) => {
|
|
23
|
+
n(t);
|
|
23
24
|
},
|
|
24
|
-
[
|
|
25
|
-
), l = `checkbox-${
|
|
26
|
-
return /* @__PURE__ */ m("div", { className:
|
|
25
|
+
[n]
|
|
26
|
+
), l = a ? `checkbox-${r}-${a.replace(/\//g, "-")}` : `checkbox-${r}`, k = c ? { flexGrow: c } : void 0;
|
|
27
|
+
return /* @__PURE__ */ m("div", { className: F("flex flex-col gap-1"), style: k, children: [
|
|
27
28
|
/* @__PURE__ */ m("div", { className: "flex items-center gap-3", children: [
|
|
28
29
|
/* @__PURE__ */ e(
|
|
29
|
-
|
|
30
|
+
j,
|
|
30
31
|
{
|
|
31
32
|
id: l,
|
|
32
|
-
checked:
|
|
33
|
-
onCheckedChange:
|
|
34
|
-
"aria-invalid": !
|
|
33
|
+
checked: x,
|
|
34
|
+
onCheckedChange: C,
|
|
35
|
+
"aria-invalid": !f
|
|
35
36
|
}
|
|
36
37
|
),
|
|
37
|
-
|
|
38
|
+
i && /* @__PURE__ */ e(y, { htmlFor: l, className: "cursor-pointer", children: i })
|
|
38
39
|
] }),
|
|
39
|
-
|
|
40
|
+
s.length > 0 && /* @__PURE__ */ e("div", { className: "text-sm text-destructive ml-6", children: s.map((t, g) => /* @__PURE__ */ e("p", { children: t }, g)) })
|
|
40
41
|
] });
|
|
41
42
|
});
|
|
42
|
-
|
|
43
|
+
P.displayName = "A2UI.CheckBox";
|
|
43
44
|
export {
|
|
44
|
-
|
|
45
|
+
P as CheckBoxComponent
|
|
45
46
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@a2ui-sdk/react",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "A2UI SDK for React",
|
|
5
5
|
"homepage": "https://a2ui-sdk.js.org/",
|
|
6
6
|
"repository": {
|
|
@@ -66,8 +66,8 @@
|
|
|
66
66
|
"vitest": "^4.0.16"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@a2ui-sdk/types": "0.3.
|
|
70
|
-
"@a2ui-sdk/utils": "0.3.
|
|
69
|
+
"@a2ui-sdk/types": "0.3.1",
|
|
70
|
+
"@a2ui-sdk/utils": "0.3.1",
|
|
71
71
|
"@radix-ui/react-checkbox": "^1.3.3",
|
|
72
72
|
"@radix-ui/react-dialog": "^1.1.15",
|
|
73
73
|
"@radix-ui/react-label": "^2.1.8",
|