@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 surfaces into your application.
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 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({
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: m,
10
- label: r,
11
- value: s
10
+ componentId: o,
11
+ label: s,
12
+ value: a
12
13
  }) {
13
- const o = d(e, r, ""), [i, n] = x(e, s, !1), a = C(
14
- (h) => {
15
- n(h);
14
+ const c = k(e, s, ""), [i, t] = d(e, a, !1), r = f(), h = C(
15
+ (l) => {
16
+ t(l);
16
17
  },
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 })
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
- g.displayName = "A2UI.CheckBox";
25
+ B.displayName = "A2UI.CheckBox";
25
26
  export {
26
- g as CheckBoxComponent
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 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({
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: s,
11
- label: a,
11
+ componentId: r,
12
+ label: h,
12
13
  value: d,
13
- checks: h,
14
- weight: t
14
+ checks: p,
15
+ weight: c
15
16
  }) {
16
- const r = u(o, a, ""), [p, i] = b(
17
+ const i = b(o, h, ""), [x, n] = B(
17
18
  o,
18
19
  d,
19
20
  !1
20
- ), { valid: x, errors: c } = B(o, h), f = g(
21
- (n) => {
22
- i(n);
21
+ ), { valid: f, errors: s } = N(o, p), a = $(), C = v(
22
+ (t) => {
23
+ n(t);
23
24
  },
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: [
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
- N,
30
+ j,
30
31
  {
31
32
  id: l,
32
- checked: p,
33
- onCheckedChange: f,
34
- "aria-invalid": !x
33
+ checked: x,
34
+ onCheckedChange: C,
35
+ "aria-invalid": !f
35
36
  }
36
37
  ),
37
- r && /* @__PURE__ */ e(j, { htmlFor: l, className: "cursor-pointer", children: r })
38
+ i && /* @__PURE__ */ e(y, { htmlFor: l, className: "cursor-pointer", children: i })
38
39
  ] }),
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)) })
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
- F.displayName = "A2UI.CheckBox";
43
+ P.displayName = "A2UI.CheckBox";
43
44
  export {
44
- F as CheckBoxComponent
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.0",
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.0",
70
- "@a2ui-sdk/utils": "0.3.0",
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",