@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.
Files changed (99) hide show
  1. package/dist/0.8/components/ComponentRenderer.d.ts +1 -19
  2. package/dist/0.8/components/ComponentRenderer.js +21 -63
  3. package/dist/0.8/components/UnknownComponent.d.ts +3 -3
  4. package/dist/0.8/components/display/AudioPlayerComponent.d.ts +3 -2
  5. package/dist/0.8/components/display/DividerComponent.d.ts +3 -2
  6. package/dist/0.8/components/display/IconComponent.d.ts +3 -2
  7. package/dist/0.8/components/display/ImageComponent.d.ts +3 -2
  8. package/dist/0.8/components/display/TextComponent.d.ts +3 -2
  9. package/dist/0.8/components/display/VideoComponent.d.ts +3 -2
  10. package/dist/0.8/components/display/index.d.ts +1 -1
  11. package/dist/0.8/components/index.d.ts +2 -2
  12. package/dist/0.8/components/interactive/ButtonComponent.d.ts +3 -2
  13. package/dist/0.8/components/interactive/CheckBoxComponent.d.ts +3 -2
  14. package/dist/0.8/components/interactive/DateTimeInputComponent.d.ts +3 -2
  15. package/dist/0.8/components/interactive/MultipleChoiceComponent.d.ts +3 -2
  16. package/dist/0.8/components/interactive/SliderComponent.d.ts +3 -2
  17. package/dist/0.8/components/interactive/TextFieldComponent.d.ts +3 -2
  18. package/dist/0.8/components/interactive/index.d.ts +1 -1
  19. package/dist/0.8/components/layout/CardComponent.d.ts +3 -2
  20. package/dist/0.8/components/layout/ColumnComponent.d.ts +3 -2
  21. package/dist/0.8/components/layout/ListComponent.d.ts +3 -2
  22. package/dist/0.8/components/layout/ModalComponent.d.ts +3 -2
  23. package/dist/0.8/components/layout/RowComponent.d.ts +3 -2
  24. package/dist/0.8/components/layout/TabsComponent.d.ts +3 -2
  25. package/dist/0.8/components/layout/index.d.ts +1 -1
  26. package/dist/0.8/components/types.d.ts +8 -0
  27. package/dist/0.8/contexts/A2UIProvider.d.ts +37 -23
  28. package/dist/0.8/contexts/A2UIProvider.js +16 -22
  29. package/dist/0.8/contexts/ActionContext.js +5 -5
  30. package/dist/0.8/contexts/ComponentsMapContext.d.ts +8 -21
  31. package/dist/0.8/contexts/ComponentsMapContext.js +12 -16
  32. package/dist/0.8/contexts/DataModelContext.js +3 -3
  33. package/dist/0.8/index.d.ts +5 -3
  34. package/dist/0.8/index.js +11 -9
  35. package/dist/0.8/standard-catalog/index.d.ts +57 -0
  36. package/dist/0.8/standard-catalog/index.js +66 -0
  37. package/dist/0.9/A2UIRenderer.d.ts +9 -29
  38. package/dist/0.9/A2UIRenderer.js +27 -26
  39. package/dist/0.9/components/ComponentRenderer.d.ts +5 -19
  40. package/dist/0.9/components/ComponentRenderer.js +30 -17
  41. package/dist/0.9/components/UnknownComponent.d.ts +8 -2
  42. package/dist/0.9/components/UnknownComponent.js +13 -11
  43. package/dist/0.9/components/display/AudioPlayerComponent.d.ts +3 -2
  44. package/dist/0.9/components/display/AudioPlayerComponent.js +16 -14
  45. package/dist/0.9/components/display/DividerComponent.d.ts +3 -2
  46. package/dist/0.9/components/display/DividerComponent.js +4 -5
  47. package/dist/0.9/components/display/IconComponent.d.ts +3 -2
  48. package/dist/0.9/components/display/IconComponent.js +12 -12
  49. package/dist/0.9/components/display/ImageComponent.d.ts +3 -2
  50. package/dist/0.9/components/display/ImageComponent.js +18 -15
  51. package/dist/0.9/components/display/TextComponent.d.ts +3 -2
  52. package/dist/0.9/components/display/TextComponent.js +10 -8
  53. package/dist/0.9/components/display/VideoComponent.d.ts +3 -2
  54. package/dist/0.9/components/display/VideoComponent.js +7 -6
  55. package/dist/0.9/components/index.d.ts +4 -8
  56. package/dist/0.9/components/interactive/ButtonComponent.d.ts +3 -2
  57. package/dist/0.9/components/interactive/ButtonComponent.js +25 -20
  58. package/dist/0.9/components/interactive/CheckBoxComponent.d.ts +3 -2
  59. package/dist/0.9/components/interactive/CheckBoxComponent.js +33 -29
  60. package/dist/0.9/components/interactive/ChoicePickerComponent.d.ts +3 -2
  61. package/dist/0.9/components/interactive/ChoicePickerComponent.js +59 -53
  62. package/dist/0.9/components/interactive/DateTimeInputComponent.d.ts +3 -2
  63. package/dist/0.9/components/interactive/DateTimeInputComponent.js +32 -26
  64. package/dist/0.9/components/interactive/SliderComponent.d.ts +3 -2
  65. package/dist/0.9/components/interactive/SliderComponent.js +38 -32
  66. package/dist/0.9/components/interactive/TextFieldComponent.d.ts +3 -2
  67. package/dist/0.9/components/interactive/TextFieldComponent.js +41 -40
  68. package/dist/0.9/components/layout/CardComponent.d.ts +3 -2
  69. package/dist/0.9/components/layout/CardComponent.js +11 -10
  70. package/dist/0.9/components/layout/ColumnComponent.d.ts +3 -2
  71. package/dist/0.9/components/layout/ColumnComponent.js +26 -23
  72. package/dist/0.9/components/layout/ListComponent.d.ts +3 -2
  73. package/dist/0.9/components/layout/ListComponent.js +30 -27
  74. package/dist/0.9/components/layout/ModalComponent.d.ts +3 -2
  75. package/dist/0.9/components/layout/ModalComponent.js +11 -22
  76. package/dist/0.9/components/layout/RowComponent.d.ts +3 -2
  77. package/dist/0.9/components/layout/RowComponent.js +31 -28
  78. package/dist/0.9/components/layout/TabsComponent.d.ts +3 -2
  79. package/dist/0.9/components/layout/TabsComponent.js +21 -21
  80. package/dist/0.9/components/types.d.ts +8 -0
  81. package/dist/0.9/contexts/A2UIProvider.d.ts +45 -28
  82. package/dist/0.9/contexts/A2UIProvider.js +18 -26
  83. package/dist/0.9/contexts/ActionContext.js +5 -5
  84. package/dist/0.9/contexts/ComponentsMapContext.d.ts +8 -31
  85. package/dist/0.9/contexts/ComponentsMapContext.js +12 -16
  86. package/dist/0.9/contexts/ScopeContext.js +3 -3
  87. package/dist/0.9/contexts/SurfaceContext.d.ts +3 -3
  88. package/dist/0.9/contexts/SurfaceContext.js +3 -3
  89. package/dist/0.9/hooks/useComponent.d.ts +2 -2
  90. package/dist/0.9/hooks/useDataBinding.js +3 -3
  91. package/dist/0.9/index.d.ts +6 -4
  92. package/dist/0.9/index.js +12 -10
  93. package/dist/0.9/standard-catalog/index.d.ts +61 -0
  94. package/dist/0.9/standard-catalog/index.js +69 -0
  95. package/dist/components/ui/button.d.ts +1 -1
  96. package/dist/lib/utils.d.ts +5 -0
  97. package/dist/lib/utils.js +6 -4
  98. package/package.json +14 -5
  99. package/dist/0.9/components/index.js +0 -68
@@ -1,9 +1,9 @@
1
- import { jsx as i } from "react/jsx-runtime";
2
- import { memo as t } from "react";
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 ee } from "../../../lib/utils.js";
6
- const re = {
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
- }, oe = t(function({
55
+ }, or = i(function({
56
56
  surfaceId: n,
57
- component: a
57
+ name: a
58
58
  }) {
59
- const e = l(n, a.name, "");
60
- if (!e)
59
+ const r = l(n, a, "");
60
+ if (!r)
61
61
  return null;
62
- const r = re[e];
63
- return r ? /* @__PURE__ */ i(r, { className: ee("w-5 h-5") }) : (console.warn(`[A2UI 0.9] Unknown icon name: ${e}`), null);
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
- oe.displayName = "A2UI.Icon";
65
+ or.displayName = "A2UI.Icon";
66
66
  export {
67
- oe as IconComponent
67
+ or as IconComponent
68
68
  };
@@ -1,6 +1,7 @@
1
- import { A2UIComponentProps } from '../../contexts/ComponentsMapContext';
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 m } from "react/jsx-runtime";
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 n = {
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
- }, g = {
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
- }, w = s(function({
18
+ }, g = s(function({
19
19
  surfaceId: r,
20
- component: a
20
+ url: l,
21
+ fit: a = "cover",
22
+ variant: o,
23
+ weight: e
21
24
  }) {
22
- const o = a, e = f(r, o.url, "");
23
- if (!e)
25
+ const n = f(r, l, "");
26
+ if (!n)
24
27
  return null;
25
- const i = o.fit ?? "cover", t = o.variant, c = o.weight ? { flexGrow: o.weight } : void 0, l = u(
26
- n[i] || n.cover,
27
- t && g[t]
28
+ const c = e ? { flexGrow: e } : void 0, m = u(
29
+ t[a] || t.cover,
30
+ o && d[o]
28
31
  );
29
- return /* @__PURE__ */ m(
32
+ return /* @__PURE__ */ i(
30
33
  "img",
31
34
  {
32
- src: e,
35
+ src: n,
33
36
  alt: "",
34
- className: l,
37
+ className: m,
35
38
  style: c,
36
39
  loading: "lazy"
37
40
  }
38
41
  );
39
42
  });
40
- w.displayName = "A2UI.Image";
43
+ g.displayName = "A2UI.Image";
41
44
  export {
42
- w as ImageComponent
45
+ g as ImageComponent
43
46
  };
@@ -1,6 +1,7 @@
1
- import { A2UIComponentProps } from '../../contexts/ComponentsMapContext';
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 h } from "react/jsx-runtime";
1
+ import { jsx as r } from "react/jsx-runtime";
2
2
  import { memo as x } from "react";
3
- import { useStringBinding as l } from "../../hooks/useDataBinding.js";
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
- }, p = x(function({
21
+ }, a = x(function({
22
22
  surfaceId: n,
23
- component: i
23
+ text: s,
24
+ variant: t = "body",
25
+ weight: o
24
26
  }) {
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
+ 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
- p.displayName = "A2UI.Text";
30
+ a.displayName = "A2UI.Text";
29
31
  export {
30
- p as TextComponent
32
+ a as TextComponent
31
33
  };
@@ -1,5 +1,6 @@
1
- import { A2UIComponentProps } from '../../contexts/ComponentsMapContext';
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 n, jsx as s } from "react/jsx-runtime";
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
- component: t
7
+ url: n,
8
+ weight: o
8
9
  }) {
9
- const o = t, r = m(e, o.url, "");
10
+ const r = m(e, n, "");
10
11
  if (!r)
11
12
  return null;
12
- const i = o.weight ? { flexGrow: o.weight } : void 0;
13
- return /* @__PURE__ */ n(
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: i,
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
- import { ComponentType } from 'react';
2
- import { A2UIComponentProps } from '../contexts/ComponentsMapContext';
3
- export { ComponentRenderer, registerComponent } from './ComponentRenderer';
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 { A2UIComponentProps } from '../../contexts/ComponentsMapContext';
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 i } from "react/jsx-runtime";
2
- import { memo as s, useCallback as a } from "react";
3
- import { useDispatchAction as p } from "../../hooks/useDispatchAction.js";
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 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
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 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
+ 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: t.primary ? "default" : "outline",
18
- onClick: m,
19
- disabled: l,
22
+ variant: m ? "default" : "outline",
23
+ onClick: p,
24
+ disabled: !a,
20
25
  className: "inline-flex items-center justify-center",
21
- style: r,
22
- children: t.child ? /* @__PURE__ */ i(f, { surfaceId: o, componentId: t.child }) : "Button"
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
- h.displayName = "A2UI.Button";
31
+ b.displayName = "A2UI.Button";
27
32
  export {
28
- h as ButtonComponent
33
+ b as ButtonComponent
29
34
  };
@@ -1,5 +1,6 @@
1
- import { A2UIComponentProps } from '../../contexts/ComponentsMapContext';
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 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
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 e = m, i = C(t, e.label, ""), [a, n] = g(
13
- t,
14
- e.value,
16
+ const r = u(o, a, ""), [p, i] = b(
17
+ o,
18
+ d,
15
19
  !1
16
- ), { valid: h, errors: r } = v(t, e.checks), d = k(
17
- (c) => {
18
- n(c);
20
+ ), { valid: x, errors: c } = B(o, h), f = g(
21
+ (n) => {
22
+ i(n);
19
23
  },
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,
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: a,
29
- onCheckedChange: d,
30
- "aria-invalid": !h
32
+ checked: p,
33
+ onCheckedChange: f,
34
+ "aria-invalid": !x
31
35
  }
32
36
  ),
33
- i && /* @__PURE__ */ o(b, { htmlFor: l, className: "cursor-pointer", children: i })
37
+ r && /* @__PURE__ */ e(j, { htmlFor: l, className: "cursor-pointer", children: r })
34
38
  ] }),
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)) })
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
- N.displayName = "A2UI.CheckBox";
42
+ F.displayName = "A2UI.CheckBox";
39
43
  export {
40
- N as CheckBoxComponent
44
+ F as CheckBoxComponent
41
45
  };
@@ -1,7 +1,8 @@
1
- import { A2UIComponentProps } from '../../contexts/ComponentsMapContext';
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 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
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 = k(g, c, "");
14
- return /* @__PURE__ */ e(V, { children: d });
13
+ const d = y(x, t, "");
14
+ return /* @__PURE__ */ e(j, { children: d });
15
15
  }
16
- const G = F(function({
17
- surfaceId: c,
18
- component: d
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 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(
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
- a(l);
32
+ i(l);
27
33
  },
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));
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
- [t, a]
35
- ), h = `choicepicker-${r.id}`, C = r.weight ? { flexGrow: r.weight } : void 0;
36
- if (!r.options || r.options.length === 0)
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 (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: [
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: v(!f && "border-destructive"),
48
- "aria-invalid": !f,
49
- children: /* @__PURE__ */ e(j, { placeholder: "Select an option" })
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(B, { children: r.options.map((i) => /* @__PURE__ */ e(L, { value: i.value, children: /* @__PURE__ */ e(b, { surfaceId: c, label: i.label }) }, i.value)) })
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
- s.length > 0 && /* @__PURE__ */ e("div", { className: "text-sm text-destructive", children: s.map((i, n) => /* @__PURE__ */ e("p", { children: i }, n)) })
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 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}`;
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
- E,
70
+ w,
65
71
  {
66
72
  id: n,
67
- checked: i,
68
- onCheckedChange: (u) => N(l.value, u === !0)
73
+ checked: c,
74
+ onCheckedChange: (u) => T(l.value, u === !0)
69
75
  }
70
76
  ),
71
- /* @__PURE__ */ e(p, { htmlFor: n, className: "cursor-pointer", children: /* @__PURE__ */ e(b, { surfaceId: c, label: l.label }) })
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
- s.length > 0 && /* @__PURE__ */ e("div", { className: "text-sm text-destructive", children: s.map((l, i) => /* @__PURE__ */ e("p", { children: l }, i)) })
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
- G.displayName = "A2UI.ChoicePicker";
83
+ z.displayName = "A2UI.ChoicePicker";
78
84
  export {
79
- G as ChoicePickerComponent
85
+ z as ChoicePickerComponent
80
86
  };
@@ -1,5 +1,6 @@
1
- import { A2UIComponentProps } from '../../contexts/ComponentsMapContext';
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 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";
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 N } from "../../../components/ui/label.js";
8
- const V = k(function({
7
+ import { Label as D } from "../../../components/ui/label.js";
8
+ const F = C(function({
9
9
  surfaceId: i,
10
- component: p
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 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(
18
+ const o = V(i, u, ""), { valid: a, errors: l } = B(i, g), [v, d] = j(
13
19
  i,
14
- e.value,
20
+ f,
15
21
  ""
16
- ), f = w(
17
- (n) => {
18
- d(n.target.value);
22
+ ), x = N(
23
+ (r) => {
24
+ d(r.target.value);
19
25
  },
20
26
  [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 }),
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__ */ t(
31
+ /* @__PURE__ */ e(
26
32
  "input",
27
33
  {
28
34
  id: s,
29
- type: g,
30
- value: b,
31
- onChange: f,
32
- "aria-invalid": !o,
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
- !o && "border-destructive"
44
+ !a && "border-destructive"
39
45
  )
40
46
  }
41
47
  ),
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" })
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__ */ t("div", { className: "text-sm text-destructive", children: l.map((n, x) => /* @__PURE__ */ t("p", { children: n }, x)) })
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
- V.displayName = "A2UI.DateTimeInput";
53
+ F.displayName = "A2UI.DateTimeInput";
48
54
  export {
49
- V as DateTimeInputComponent
55
+ F as DateTimeInputComponent
50
56
  };