glchat-a2ui-react-renderer 0.2.6 → 0.2.8

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 (108) hide show
  1. package/README.md +251 -124
  2. package/dist/index.d.ts +10 -4
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +13 -5
  5. package/dist/src/Provider.d.ts +21 -14
  6. package/dist/src/Provider.d.ts.map +1 -1
  7. package/dist/src/Provider.js +56 -42
  8. package/dist/src/SurfaceRenderer.d.ts +17 -0
  9. package/dist/src/SurfaceRenderer.d.ts.map +1 -0
  10. package/dist/src/SurfaceRenderer.js +28 -0
  11. package/dist/src/components/a2ui/Button/Button.d.ts +313 -3
  12. package/dist/src/components/a2ui/Button/Button.d.ts.map +1 -1
  13. package/dist/src/components/a2ui/Button/Button.js +31 -24
  14. package/dist/src/components/a2ui/{MultipleChoice → ChoicePicker}/CheckboxList.d.ts +1 -2
  15. package/dist/src/components/a2ui/ChoicePicker/CheckboxList.d.ts.map +1 -0
  16. package/dist/src/components/a2ui/ChoicePicker/CheckboxList.js +34 -0
  17. package/dist/src/components/a2ui/ChoicePicker/ChoicePicker.d.ts +9 -0
  18. package/dist/src/components/a2ui/ChoicePicker/ChoicePicker.d.ts.map +1 -0
  19. package/dist/src/components/a2ui/ChoicePicker/ChoicePicker.js +54 -0
  20. package/dist/src/components/a2ui/ChoicePicker/theme.d.ts +10 -0
  21. package/dist/src/components/a2ui/ChoicePicker/theme.d.ts.map +1 -0
  22. package/dist/src/components/a2ui/{MultipleChoice → ChoicePicker}/theme.js +15 -12
  23. package/dist/src/components/a2ui/TagInput/TagInput.d.ts +290 -0
  24. package/dist/src/components/a2ui/TagInput/TagInput.d.ts.map +1 -0
  25. package/dist/src/components/a2ui/TagInput/TagInput.js +110 -0
  26. package/dist/src/components/a2ui/TagInput/theme.d.ts +13 -0
  27. package/dist/src/components/a2ui/TagInput/theme.d.ts.map +1 -0
  28. package/dist/src/components/a2ui/TagInput/theme.js +74 -0
  29. package/dist/src/components/a2ui/Timeout/Timeout.d.ts +154 -3
  30. package/dist/src/components/a2ui/Timeout/Timeout.d.ts.map +1 -1
  31. package/dist/src/components/a2ui/Timeout/Timeout.js +40 -25
  32. package/dist/src/components/a2ui/common.d.ts +87 -0
  33. package/dist/src/components/a2ui/common.d.ts.map +1 -0
  34. package/dist/src/components/a2ui/common.js +23 -0
  35. package/dist/src/components/ui/Button/Button.d.ts +15 -0
  36. package/dist/src/components/ui/Button/Button.d.ts.map +1 -0
  37. package/dist/src/components/ui/Button/Button.js +16 -0
  38. package/dist/src/components/ui/Button/theme.d.ts +5 -0
  39. package/dist/src/components/ui/Button/theme.d.ts.map +1 -0
  40. package/dist/src/components/{a2ui → ui}/Button/theme.js +13 -10
  41. package/dist/src/components/ui/Checkbox/Checkbox.js +2 -2
  42. package/dist/src/components/ui/Checkbox/theme.d.ts +3 -3
  43. package/dist/src/components/ui/Checkbox/theme.d.ts.map +1 -1
  44. package/dist/src/components/ui/Checkbox/theme.js +3 -3
  45. package/dist/src/components/ui/MultiSelect/MultiSelect.d.ts +1 -1
  46. package/dist/src/components/ui/MultiSelect/MultiSelect.d.ts.map +1 -1
  47. package/dist/src/components/ui/MultiSelect/MultiSelect.js +12 -12
  48. package/dist/src/components/ui/MultiSelect/theme.d.ts +12 -12
  49. package/dist/src/components/ui/MultiSelect/theme.d.ts.map +1 -1
  50. package/dist/src/components/ui/MultiSelect/theme.js +13 -13
  51. package/dist/src/components/ui/Select/Select.js +8 -8
  52. package/dist/src/components/ui/Select/theme.d.ts +8 -8
  53. package/dist/src/components/ui/Select/theme.d.ts.map +1 -1
  54. package/dist/src/components/ui/Select/theme.js +8 -9
  55. package/dist/src/utils/catalog.d.ts +16 -4
  56. package/dist/src/utils/catalog.d.ts.map +1 -1
  57. package/dist/src/utils/catalog.js +32 -27
  58. package/dist/src/utils/useSurfaces.d.ts +9 -0
  59. package/dist/src/utils/useSurfaces.d.ts.map +1 -0
  60. package/dist/src/utils/useSurfaces.js +28 -0
  61. package/json/README.md +61 -0
  62. package/json/a2ui-sample-messages.json +193 -0
  63. package/json/glchat_standard_catalog_definition.json +1470 -0
  64. package/package.json +15 -6
  65. package/styles/globals.css +232 -38
  66. package/dist/src/AllSurfacesRenderer.d.ts +0 -14
  67. package/dist/src/AllSurfacesRenderer.d.ts.map +0 -1
  68. package/dist/src/AllSurfacesRenderer.js +0 -18
  69. package/dist/src/SingleSurfaceRenderer.d.ts +0 -15
  70. package/dist/src/SingleSurfaceRenderer.d.ts.map +0 -1
  71. package/dist/src/SingleSurfaceRenderer.js +0 -9
  72. package/dist/src/components/a2ui/Button/theme.d.ts +0 -14
  73. package/dist/src/components/a2ui/Button/theme.d.ts.map +0 -1
  74. package/dist/src/components/a2ui/Card/Card.d.ts +0 -4
  75. package/dist/src/components/a2ui/Card/Card.d.ts.map +0 -1
  76. package/dist/src/components/a2ui/Card/Card.js +0 -16
  77. package/dist/src/components/a2ui/Card/theme.d.ts +0 -10
  78. package/dist/src/components/a2ui/Card/theme.d.ts.map +0 -1
  79. package/dist/src/components/a2ui/Card/theme.js +0 -21
  80. package/dist/src/components/a2ui/CheckBox/CheckBox.d.ts +0 -4
  81. package/dist/src/components/a2ui/CheckBox/CheckBox.d.ts.map +0 -1
  82. package/dist/src/components/a2ui/CheckBox/CheckBox.js +0 -26
  83. package/dist/src/components/a2ui/CheckBox/theme.d.ts +0 -11
  84. package/dist/src/components/a2ui/CheckBox/theme.d.ts.map +0 -1
  85. package/dist/src/components/a2ui/CheckBox/theme.js +0 -17
  86. package/dist/src/components/a2ui/DateTimeInput/theme.d.ts +0 -8
  87. package/dist/src/components/a2ui/DateTimeInput/theme.d.ts.map +0 -1
  88. package/dist/src/components/a2ui/DateTimeInput/theme.js +0 -11
  89. package/dist/src/components/a2ui/MultipleChoice/CheckboxList.d.ts.map +0 -1
  90. package/dist/src/components/a2ui/MultipleChoice/CheckboxList.js +0 -45
  91. package/dist/src/components/a2ui/MultipleChoice/MultipleChoice.d.ts +0 -4
  92. package/dist/src/components/a2ui/MultipleChoice/MultipleChoice.d.ts.map +0 -1
  93. package/dist/src/components/a2ui/MultipleChoice/MultipleChoice.js +0 -72
  94. package/dist/src/components/a2ui/MultipleChoice/theme.d.ts +0 -13
  95. package/dist/src/components/a2ui/MultipleChoice/theme.d.ts.map +0 -1
  96. package/dist/src/components/a2ui/TextField/TextField.d.ts +0 -4
  97. package/dist/src/components/a2ui/TextField/TextField.d.ts.map +0 -1
  98. package/dist/src/components/a2ui/TextField/TextField.js +0 -54
  99. package/dist/src/components/a2ui/TextField/theme.d.ts +0 -28
  100. package/dist/src/components/a2ui/TextField/theme.d.ts.map +0 -1
  101. package/dist/src/components/a2ui/TextField/theme.js +0 -82
  102. package/dist/src/components/a2ui/Timeout/theme.d.ts +0 -8
  103. package/dist/src/components/a2ui/Timeout/theme.d.ts.map +0 -1
  104. package/dist/src/components/a2ui/Timeout/theme.js +0 -12
  105. package/dist/src/utils/theme.d.ts +0 -4
  106. package/dist/src/utils/theme.d.ts.map +0 -1
  107. package/dist/src/utils/theme.js +0 -92
  108. package/patches/@a2ui+web_core+0.10.0.patch +0 -55
@@ -0,0 +1,17 @@
1
+ import type { ReactNode } from 'react';
2
+ export type SurfaceRendererProps = {
3
+ /** When set, render only this surface. When omitted, render all active surfaces. */
4
+ surfaceId?: string;
5
+ className?: string;
6
+ /** Shown while no surface(s) are available to render. */
7
+ fallback?: ReactNode;
8
+ };
9
+ /**
10
+ * Renders one or all active A2UI surfaces from the nearest `Provider`.
11
+ *
12
+ * - Omit `surfaceId` to render every active surface.
13
+ * - Set `surfaceId` to render a single surface.
14
+ * - Shows `fallback` (default: empty) until surface(s) exist.
15
+ */
16
+ export declare function SurfaceRenderer(props: Readonly<SurfaceRendererProps>): import("react").JSX.Element;
17
+ //# sourceMappingURL=SurfaceRenderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SurfaceRenderer.d.ts","sourceRoot":"","sources":["../../src/SurfaceRenderer.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAOvC,MAAM,MAAM,oBAAoB,GAAG;IACjC,oFAAoF;IACpF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yDAAyD;IACzD,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,QAAQ,CAAC,oBAAoB,CAAC,+BA4BpE"}
@@ -0,0 +1,28 @@
1
+ 'use client';
2
+ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
3
+ import { A2uiSurface } from '@a2ui/react/v0_9';
4
+ import { useSurfaceGroup } from './Provider.js';
5
+ import { useSurfaces } from './utils/useSurfaces.js';
6
+ const DEFAULT_FALLBACK = _jsx(_Fragment, {});
7
+ /**
8
+ * Renders one or all active A2UI surfaces from the nearest `Provider`.
9
+ *
10
+ * - Omit `surfaceId` to render every active surface.
11
+ * - Set `surfaceId` to render a single surface.
12
+ * - Shows `fallback` (default: empty) until surface(s) exist.
13
+ */
14
+ export function SurfaceRenderer(props) {
15
+ const model = useSurfaceGroup();
16
+ const surfaces = useSurfaces(model);
17
+ const fallback = props.fallback ?? DEFAULT_FALLBACK;
18
+ const surfaceClassName = props.className ? `a2ui-surface ${props.className}` : 'a2ui-surface';
19
+ if (props.surfaceId !== undefined) {
20
+ const surface = model.getSurface(props.surfaceId);
21
+ if (!surface)
22
+ return _jsx(_Fragment, { children: fallback });
23
+ return (_jsx("div", { className: surfaceClassName, children: _jsx(A2uiSurface, { surface: surface }) }));
24
+ }
25
+ if (surfaces.length === 0)
26
+ return _jsx(_Fragment, { children: fallback });
27
+ return (_jsx(_Fragment, { children: surfaces.map((surface) => (_jsx("div", { className: surfaceClassName, children: _jsx(A2uiSurface, { surface: surface }) }, surface.id))) }));
28
+ }
@@ -1,4 +1,314 @@
1
- import { type A2UIComponentProps } from '@a2ui/react';
2
- import type { ButtonNode } from '@a2ui/web_core/types/types';
3
- export declare function CustomButtonComponent({ node, surfaceId, }: Readonly<A2UIComponentProps<ButtonNode>>): import("react/jsx-runtime").JSX.Element;
1
+ import { z } from 'zod';
2
+ /**
3
+ * GLChat Button schema — upstream `ButtonApi` with an extra `destructive` variant.
4
+ */
5
+ export declare const GlchatButtonApi: {
6
+ name: string;
7
+ schema: z.ZodObject<{
8
+ child: z.ZodString;
9
+ action: z.ZodUnion<[z.ZodObject<{
10
+ event: z.ZodObject<{
11
+ name: z.ZodString;
12
+ context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodAny, "many">, z.ZodObject<{
13
+ path: z.ZodString;
14
+ }, "strip", z.ZodTypeAny, {
15
+ path: string;
16
+ }, {
17
+ path: string;
18
+ }>, z.ZodObject<{
19
+ call: z.ZodString;
20
+ args: z.ZodRecord<z.ZodString, z.ZodAny>;
21
+ returnType: z.ZodDefault<z.ZodEnum<["string", "number", "boolean", "array", "object", "any", "void"]>>;
22
+ }, "strip", z.ZodTypeAny, {
23
+ call: string;
24
+ args: Record<string, any>;
25
+ returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
26
+ }, {
27
+ call: string;
28
+ args: Record<string, any>;
29
+ returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
30
+ }>]>>>;
31
+ }, "strip", z.ZodTypeAny, {
32
+ name: string;
33
+ context?: Record<string, string | number | boolean | any[] | {
34
+ path: string;
35
+ } | {
36
+ call: string;
37
+ args: Record<string, any>;
38
+ returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
39
+ }> | undefined;
40
+ }, {
41
+ name: string;
42
+ context?: Record<string, string | number | boolean | any[] | {
43
+ path: string;
44
+ } | {
45
+ call: string;
46
+ args: Record<string, any>;
47
+ returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
48
+ }> | undefined;
49
+ }>;
50
+ }, "strip", z.ZodTypeAny, {
51
+ event: {
52
+ name: string;
53
+ context?: Record<string, string | number | boolean | any[] | {
54
+ path: string;
55
+ } | {
56
+ call: string;
57
+ args: Record<string, any>;
58
+ returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
59
+ }> | undefined;
60
+ };
61
+ }, {
62
+ event: {
63
+ name: string;
64
+ context?: Record<string, string | number | boolean | any[] | {
65
+ path: string;
66
+ } | {
67
+ call: string;
68
+ args: Record<string, any>;
69
+ returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
70
+ }> | undefined;
71
+ };
72
+ }>, z.ZodObject<{
73
+ functionCall: z.ZodObject<{
74
+ call: z.ZodString;
75
+ args: z.ZodRecord<z.ZodString, z.ZodAny>;
76
+ returnType: z.ZodDefault<z.ZodEnum<["string", "number", "boolean", "array", "object", "any", "void"]>>;
77
+ }, "strip", z.ZodTypeAny, {
78
+ call: string;
79
+ args: Record<string, any>;
80
+ returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
81
+ }, {
82
+ call: string;
83
+ args: Record<string, any>;
84
+ returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
85
+ }>;
86
+ }, "strip", z.ZodTypeAny, {
87
+ functionCall: {
88
+ call: string;
89
+ args: Record<string, any>;
90
+ returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
91
+ };
92
+ }, {
93
+ functionCall: {
94
+ call: string;
95
+ args: Record<string, any>;
96
+ returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
97
+ };
98
+ }>]>;
99
+ checks: z.ZodOptional<z.ZodArray<z.ZodObject<{
100
+ condition: z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
101
+ path: z.ZodString;
102
+ }, "strip", z.ZodTypeAny, {
103
+ path: string;
104
+ }, {
105
+ path: string;
106
+ }>, z.ZodObject<{
107
+ call: z.ZodString;
108
+ args: z.ZodRecord<z.ZodString, z.ZodAny>;
109
+ returnType: z.ZodDefault<z.ZodEnum<["string", "number", "boolean", "array", "object", "any", "void"]>>;
110
+ }, "strip", z.ZodTypeAny, {
111
+ call: string;
112
+ args: Record<string, any>;
113
+ returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
114
+ }, {
115
+ call: string;
116
+ args: Record<string, any>;
117
+ returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
118
+ }>]>;
119
+ message: z.ZodString;
120
+ }, "strip", z.ZodTypeAny, {
121
+ message: string;
122
+ condition: boolean | {
123
+ path: string;
124
+ } | {
125
+ call: string;
126
+ args: Record<string, any>;
127
+ returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
128
+ };
129
+ }, {
130
+ message: string;
131
+ condition: boolean | {
132
+ path: string;
133
+ } | {
134
+ call: string;
135
+ args: Record<string, any>;
136
+ returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
137
+ };
138
+ }>, "many">>;
139
+ accessibility: z.ZodOptional<z.ZodObject<{
140
+ label: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
141
+ path: z.ZodString;
142
+ }, "strip", z.ZodTypeAny, {
143
+ path: string;
144
+ }, {
145
+ path: string;
146
+ }>, z.ZodObject<{
147
+ call: z.ZodString;
148
+ args: z.ZodRecord<z.ZodString, z.ZodAny>;
149
+ returnType: z.ZodDefault<z.ZodEnum<["string", "number", "boolean", "array", "object", "any", "void"]>>;
150
+ }, "strip", z.ZodTypeAny, {
151
+ call: string;
152
+ args: Record<string, any>;
153
+ returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
154
+ }, {
155
+ call: string;
156
+ args: Record<string, any>;
157
+ returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
158
+ }>]>>;
159
+ description: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
160
+ path: z.ZodString;
161
+ }, "strip", z.ZodTypeAny, {
162
+ path: string;
163
+ }, {
164
+ path: string;
165
+ }>, z.ZodObject<{
166
+ call: z.ZodString;
167
+ args: z.ZodRecord<z.ZodString, z.ZodAny>;
168
+ returnType: z.ZodDefault<z.ZodEnum<["string", "number", "boolean", "array", "object", "any", "void"]>>;
169
+ }, "strip", z.ZodTypeAny, {
170
+ call: string;
171
+ args: Record<string, any>;
172
+ returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
173
+ }, {
174
+ call: string;
175
+ args: Record<string, any>;
176
+ returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
177
+ }>]>>;
178
+ }, "strip", z.ZodTypeAny, {
179
+ description?: string | {
180
+ path: string;
181
+ } | {
182
+ call: string;
183
+ args: Record<string, any>;
184
+ returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
185
+ } | undefined;
186
+ label?: string | {
187
+ path: string;
188
+ } | {
189
+ call: string;
190
+ args: Record<string, any>;
191
+ returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
192
+ } | undefined;
193
+ }, {
194
+ description?: string | {
195
+ path: string;
196
+ } | {
197
+ call: string;
198
+ args: Record<string, any>;
199
+ returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
200
+ } | undefined;
201
+ label?: string | {
202
+ path: string;
203
+ } | {
204
+ call: string;
205
+ args: Record<string, any>;
206
+ returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
207
+ } | undefined;
208
+ }>>;
209
+ weight: z.ZodOptional<z.ZodNumber>;
210
+ } & {
211
+ variant: z.ZodOptional<z.ZodDefault<z.ZodEnum<["default", "primary", "borderless", "destructive"]>>>;
212
+ }, "strict", z.ZodTypeAny, {
213
+ child: string;
214
+ action: {
215
+ event: {
216
+ name: string;
217
+ context?: Record<string, string | number | boolean | any[] | {
218
+ path: string;
219
+ } | {
220
+ call: string;
221
+ args: Record<string, any>;
222
+ returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
223
+ }> | undefined;
224
+ };
225
+ } | {
226
+ functionCall: {
227
+ call: string;
228
+ args: Record<string, any>;
229
+ returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
230
+ };
231
+ };
232
+ weight?: number | undefined;
233
+ variant?: "primary" | "destructive" | "borderless" | "default" | undefined;
234
+ checks?: {
235
+ message: string;
236
+ condition: boolean | {
237
+ path: string;
238
+ } | {
239
+ call: string;
240
+ args: Record<string, any>;
241
+ returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
242
+ };
243
+ }[] | undefined;
244
+ accessibility?: {
245
+ description?: string | {
246
+ path: string;
247
+ } | {
248
+ call: string;
249
+ args: Record<string, any>;
250
+ returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
251
+ } | undefined;
252
+ label?: string | {
253
+ path: string;
254
+ } | {
255
+ call: string;
256
+ args: Record<string, any>;
257
+ returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
258
+ } | undefined;
259
+ } | undefined;
260
+ }, {
261
+ child: string;
262
+ action: {
263
+ event: {
264
+ name: string;
265
+ context?: Record<string, string | number | boolean | any[] | {
266
+ path: string;
267
+ } | {
268
+ call: string;
269
+ args: Record<string, any>;
270
+ returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
271
+ }> | undefined;
272
+ };
273
+ } | {
274
+ functionCall: {
275
+ call: string;
276
+ args: Record<string, any>;
277
+ returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
278
+ };
279
+ };
280
+ weight?: number | undefined;
281
+ variant?: "primary" | "destructive" | "borderless" | "default" | undefined;
282
+ checks?: {
283
+ message: string;
284
+ condition: boolean | {
285
+ path: string;
286
+ } | {
287
+ call: string;
288
+ args: Record<string, any>;
289
+ returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
290
+ };
291
+ }[] | undefined;
292
+ accessibility?: {
293
+ description?: string | {
294
+ path: string;
295
+ } | {
296
+ call: string;
297
+ args: Record<string, any>;
298
+ returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
299
+ } | undefined;
300
+ label?: string | {
301
+ path: string;
302
+ } | {
303
+ call: string;
304
+ args: Record<string, any>;
305
+ returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
306
+ } | undefined;
307
+ } | undefined;
308
+ }>;
309
+ };
310
+ /**
311
+ * GLChat-styled Button. Overrides the basic catalog `Button` with extended variants.
312
+ */
313
+ export declare const GlchatButtonComponent: import("@a2ui/react/v0_9").ReactComponentImplementation;
4
314
  //# sourceMappingURL=Button.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../../src/components/a2ui/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,kBAAkB,EACxB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAM7D,wBAAgB,qBAAqB,CAAC,EACpC,IAAI,EACJ,SAAS,GACV,EAAE,QAAQ,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC,2CAwC1C"}
1
+ {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../../src/components/a2ui/Button/Button.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;8BAqC0wsE,CAAC;;;;uBAA0M,CAAC;;;;;;;;;uBAA6Y,CAAC;;;;;8BAA8N,CAAC;;;;;;uBAAmP,CAAC;;;;;;;;;;;uBAA6a,CAAC;;;;;8BAA8N,CAAC;;;;;;;;;;;;;;;0BAAmuB,CAAC;;;;;;;;;;;;0BAA4e,CAAC;;;;;;;;;;;;;;;;;;;;;0BAA27B,CAAC;;;;;;;;;;;;;;;;;;;0BAAwrB,CAAC;;;;;;;;;;;;;;;;;;;;;0BAAw8B,CAAC;;;;;;;;;;;;;;;;;;;0BAAy4B,CAAC;;;uBAAmK,CAAC;;;;;;;iBAAqR,CAAC;;;;;;;;uBAAwS,CAAC;;;;;0BAAgK,CAAC;;iBAAiI,CAAC;;;;;0BAAgK,CAAC;;;;;;;;;;;uBAA98M,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAA6a,CAAC;;;;;8BAA8N,CAAC;;;;;;;0BAAgtC,CAAC;;;;;;;;;;;;0BAAonD,CAAC;;;;;;;;;0BAAstF,CAAC;;;;;;;0BAAkS,CAAC;;;;CA1B/x7E,CAAC;AASF;;GAEG;AACH,eAAO,MAAM,qBAAqB,yDAajC,CAAC"}
@@ -1,26 +1,33 @@
1
+ 'use client';
1
2
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { ComponentNode, classMapToString, stylesToObject, useA2UIComponent, } from '@a2ui/react';
3
- import { useMemo } from 'react';
4
- import { getGlchatButtonVariantStyles } from './theme.js';
5
- export function CustomButtonComponent({ node, surfaceId, }) {
6
- const { sendAction, theme } = useA2UIComponent(node, surfaceId);
7
- const { child, action, primary, destructive } = node.properties;
8
- const variant = useMemo(() => {
9
- if (primary)
10
- return 'primary';
11
- if (destructive)
12
- return 'destructive';
13
- return 'outline';
14
- }, [primary, destructive]);
15
- const buttonStyle = useMemo(() => ({
16
- ...stylesToObject(theme.additionalStyles?.Button),
17
- ...getGlchatButtonVariantStyles(variant),
18
- }), [theme.additionalStyles?.Button, variant]);
19
- const handleClick = () => {
20
- if (action) {
21
- sendAction(action);
22
- }
23
- };
24
- const hostStyle = node.weight === void 0 ? undefined : { '--weight': node.weight };
25
- return (_jsx("div", { className: "a2ui-button", style: hostStyle, children: _jsx("button", { type: "button", className: `glchat-a2ui-button ${classMapToString(theme.components.Button)}`, style: buttonStyle, onClick: handleClick, children: child ? _jsx(ComponentNode, { node: child, surfaceId: surfaceId }) : null }) }));
3
+ import { createComponentImplementation } from '@a2ui/react/v0_9';
4
+ import { ButtonApi } from '@a2ui/web_core/v0_9/basic_catalog';
5
+ import { z } from 'zod';
6
+ import { Button } from '../../ui/Button/Button.js';
7
+ import { getWeightStyle } from '../common.js';
8
+ /**
9
+ * GLChat Button schema — upstream `ButtonApi` with an extra `destructive` variant.
10
+ */
11
+ export const GlchatButtonApi = {
12
+ name: 'Button',
13
+ schema: ButtonApi.schema.extend({
14
+ variant: z
15
+ .enum(['default', 'primary', 'borderless', 'destructive'])
16
+ .default('default')
17
+ .describe("A hint for the button style. If omitted, a default button style is used. 'primary' indicates this is the main call-to-action button. 'borderless' means the button has no visual border or background, making its child content appear like a clickable link. 'destructive' indicates a dangerous or irreversible action.")
18
+ .optional(),
19
+ }),
20
+ };
21
+ function toButtonVariant(variant) {
22
+ if (variant === 'primary')
23
+ return 'primary';
24
+ if (variant === 'borderless')
25
+ return 'borderless';
26
+ if (variant === 'destructive')
27
+ return 'destructive';
28
+ return 'outline';
26
29
  }
30
+ /**
31
+ * GLChat-styled Button. Overrides the basic catalog `Button` with extended variants.
32
+ */
33
+ export const GlchatButtonComponent = createComponentImplementation(GlchatButtonApi, ({ props, buildChild }) => (_jsx("div", { className: "a2ui-button", style: getWeightStyle(props.weight), children: _jsx(Button, { variant: toButtonVariant(props.variant), disabled: props.isValid === false, onClick: props.action, children: props.child ? buildChild(props.child) : null }) })));
@@ -4,9 +4,8 @@ export type CheckboxListProps = {
4
4
  value: string[];
5
5
  onValueChange: (value: string[]) => void;
6
6
  singleSelect: boolean;
7
- maxSelections?: number;
8
7
  filterable?: boolean;
9
8
  className?: string;
10
9
  };
11
- export declare function CheckboxList({ options, value, onValueChange, singleSelect, maxSelections, filterable, className, }: Readonly<CheckboxListProps>): import("react/jsx-runtime").JSX.Element;
10
+ export declare function CheckboxList({ options, value, onValueChange, singleSelect, filterable, className, }: Readonly<CheckboxListProps>): import("react").JSX.Element;
12
11
  //# sourceMappingURL=CheckboxList.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CheckboxList.d.ts","sourceRoot":"","sources":["../../../../../src/components/a2ui/ChoicePicker/CheckboxList.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAOvE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,iBAAiB,EAAE,CAAC;IAC7B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACzC,YAAY,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,wBAAgB,YAAY,CAAC,EAC3B,OAAO,EACP,KAAK,EACL,aAAa,EACb,YAAY,EACZ,UAAkB,EAClB,SAAS,GACV,EAAE,QAAQ,CAAC,iBAAiB,CAAC,+BA6D7B"}
@@ -0,0 +1,34 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useId, useMemo, useState } from 'react';
4
+ import { Checkbox } from '../../ui/Checkbox/Checkbox.js';
5
+ import { checkboxLabelStyles } from '../../ui/Checkbox/theme.js';
6
+ import { checkboxListContainerStyles, checkboxListItemStyles, checkboxListSearchStyles, } from './theme.js';
7
+ export function CheckboxList({ options, value, onValueChange, singleSelect, filterable = false, className, }) {
8
+ const [search, setSearch] = useState('');
9
+ const groupId = useId();
10
+ const filteredOptions = useMemo(() => {
11
+ if (!filterable || !search.trim())
12
+ return options;
13
+ const query = search.toLocaleLowerCase();
14
+ return options.filter((opt) => opt.label.toLocaleLowerCase().includes(query));
15
+ }, [filterable, options, search]);
16
+ const toggleOption = (optionValue) => {
17
+ const isSelected = value.includes(optionValue);
18
+ if (singleSelect) {
19
+ onValueChange(isSelected ? [] : [optionValue]);
20
+ return;
21
+ }
22
+ if (isSelected) {
23
+ onValueChange(value.filter((v) => v !== optionValue));
24
+ return;
25
+ }
26
+ onValueChange([...value, optionValue]);
27
+ };
28
+ const listClassName = ['glchat-a2ui-checkbox-list', className].filter(Boolean).join(' ');
29
+ return (_jsxs("div", { className: listClassName, style: checkboxListContainerStyles, children: [filterable && (_jsx("input", { type: "text", value: search, onChange: (e) => setSearch(e.target.value), placeholder: "Search...", style: checkboxListSearchStyles })), filteredOptions.map((option) => {
30
+ const isSelected = value.includes(option.value);
31
+ const optionId = `${groupId}-${option.value}`;
32
+ return (_jsxs("label", { htmlFor: optionId, className: "glchat-a2ui-checkbox-option", style: { ...checkboxListItemStyles, cursor: 'pointer' }, children: [_jsx(Checkbox, { id: optionId, checked: isSelected, onCheckedChange: () => toggleOption(option.value) }), _jsx("span", { style: checkboxLabelStyles, children: option.label })] }, option.value));
33
+ })] }));
34
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * GLChat-styled ChoicePicker. Overrides the basic catalog `ChoicePicker`.
3
+ *
4
+ * - `variant`: `mutuallyExclusive` (single) or `multipleSelection` (multi).
5
+ * - `displayStyle`: `checkbox` renders a checkbox/radio list; otherwise a
6
+ * GLChat select (single) or multi-select dropdown is used.
7
+ */
8
+ export declare const GlchatChoicePickerComponent: import("@a2ui/react/v0_9").ReactComponentImplementation;
9
+ //# sourceMappingURL=ChoicePicker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChoicePicker.d.ts","sourceRoot":"","sources":["../../../../../src/components/a2ui/ChoicePicker/ChoicePicker.tsx"],"names":[],"mappings":"AA6DA;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,yDA6EvC,CAAC"}
@@ -0,0 +1,54 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { createComponentImplementation } from '@a2ui/react/v0_9';
4
+ import { ChoicePickerApi } from '@a2ui/web_core/v0_9/basic_catalog';
5
+ import { useCallback, useMemo } from 'react';
6
+ import { MultiSelect } from '../../ui/MultiSelect/MultiSelect.js';
7
+ import { Select, SelectContent, SelectItem, SelectTrigger } from '../../ui/Select/Select.js';
8
+ import { selectTriggerLabelStyles, selectTriggerPlaceholderStyles, } from '../../ui/Select/theme.js';
9
+ import { getWeightStyle } from '../common.js';
10
+ import { CheckboxList } from './CheckboxList.js';
11
+ import { choicePickerContainerStyles, choicePickerLabelStyles } from './theme.js';
12
+ function SingleSelectChips({ options, value, onValueChange, }) {
13
+ const selectedLabel = useMemo(() => {
14
+ const match = options.find((opt) => opt.value === value);
15
+ return match?.label ?? '';
16
+ }, [options, value]);
17
+ const triggerLabelStyle = useMemo(() => ({
18
+ ...selectTriggerLabelStyles,
19
+ ...(selectedLabel ? undefined : selectTriggerPlaceholderStyles),
20
+ }), [selectedLabel]);
21
+ return (_jsxs(Select, { value: value, onValueChange: onValueChange, children: [_jsx(SelectTrigger, { className: "glchat-a2ui-select-trigger", "aria-label": "Select option", children: _jsx("span", { style: triggerLabelStyle, ...(selectedLabel ? {} : { 'data-placeholder': '' }), children: selectedLabel || 'Select an item' }) }), _jsx(SelectContent, { className: "glchat-a2ui-select-content", children: options.map((option) => (_jsx(SelectItem, { value: option.value, children: option.label }, option.value))) })] }));
22
+ }
23
+ /**
24
+ * GLChat-styled ChoicePicker. Overrides the basic catalog `ChoicePicker`.
25
+ *
26
+ * - `variant`: `mutuallyExclusive` (single) or `multipleSelection` (multi).
27
+ * - `displayStyle`: `checkbox` renders a checkbox/radio list; otherwise a
28
+ * GLChat select (single) or multi-select dropdown is used.
29
+ */
30
+ export const GlchatChoicePickerComponent = createComponentImplementation(ChoicePickerApi, ({ props }) => {
31
+ const singleSelect = props.variant !== 'multipleSelection';
32
+ const filterable = props.filterable ?? false;
33
+ const useCheckboxes = props.displayStyle === 'checkbox';
34
+ const label = typeof props.label === 'string' ? props.label : '';
35
+ const selectedValues = useMemo(() => (Array.isArray(props.value) ? props.value : []), [props.value]);
36
+ const resolvedOptions = useMemo(() => (props.options ?? []).map((option) => ({
37
+ value: option.value,
38
+ label: typeof option.label === 'string' ? option.label : option.value,
39
+ })), [props.options]);
40
+ const handleSingleValueChange = useCallback((nextValue) => {
41
+ props.setValue([nextValue]);
42
+ }, [props]);
43
+ const handleMultiValueChange = useCallback((values) => {
44
+ props.setValue(values);
45
+ }, [props]);
46
+ const wrapper = (content) => (_jsx("div", { className: "a2ui-choicepicker", style: getWeightStyle(props.weight), children: _jsxs("section", { style: choicePickerContainerStyles, children: [label ? _jsx("strong", { style: choicePickerLabelStyles, children: label }) : null, content] }) }));
47
+ if (useCheckboxes) {
48
+ return wrapper(_jsx(CheckboxList, { options: resolvedOptions, value: selectedValues, onValueChange: handleMultiValueChange, singleSelect: singleSelect, filterable: filterable }));
49
+ }
50
+ if (singleSelect) {
51
+ return wrapper(_jsx(SingleSelectChips, { options: resolvedOptions, value: selectedValues[0] ?? '', onValueChange: handleSingleValueChange }));
52
+ }
53
+ return wrapper(_jsx(MultiSelect, { options: resolvedOptions, value: selectedValues, onValueChange: handleMultiValueChange, placeholder: "Select options", filterable: filterable }));
54
+ });
@@ -0,0 +1,10 @@
1
+ import type { CSSProperties } from 'react';
2
+ /**
3
+ * Checkbox display style — vertical list of options.
4
+ */
5
+ export declare const checkboxListContainerStyles: CSSProperties;
6
+ export declare const checkboxListItemStyles: CSSProperties;
7
+ export declare const checkboxListSearchStyles: CSSProperties;
8
+ export declare const choicePickerContainerStyles: CSSProperties;
9
+ export declare const choicePickerLabelStyles: CSSProperties;
10
+ //# sourceMappingURL=theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../src/components/a2ui/ChoicePicker/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C;;GAEG;AACH,eAAO,MAAM,2BAA2B,EAAE,aAKzC,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,aAKpC,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,aAWtC,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE,aAKzC,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,aAIrC,CAAC"}
@@ -1,27 +1,19 @@
1
1
  /**
2
- * MultipleChoice structural class map.
2
+ * Checkbox display style — vertical list of options.
3
3
  */
4
- export const glchatMultipleChoiceComponents = {
5
- container: {},
6
- element: {},
7
- label: {},
8
- };
9
- /**
10
- * Checkbox variant — vertical list of options.
11
- */
12
- export const glchatCheckboxListContainerStyles = {
4
+ export const checkboxListContainerStyles = {
13
5
  display: 'flex',
14
6
  flexDirection: 'column',
15
7
  gap: '0.5rem',
16
8
  width: '100%',
17
9
  };
18
- export const glchatCheckboxListItemStyles = {
10
+ export const checkboxListItemStyles = {
19
11
  display: 'flex',
20
12
  alignItems: 'center',
21
13
  gap: '0.5rem',
22
14
  width: '100%',
23
15
  };
24
- export const glchatCheckboxListSearchStyles = {
16
+ export const checkboxListSearchStyles = {
25
17
  width: '100%',
26
18
  borderRadius: 'var(--radius-md)',
27
19
  borderWidth: '1px',
@@ -33,3 +25,14 @@ export const glchatCheckboxListSearchStyles = {
33
25
  color: 'hsl(var(--foreground))',
34
26
  boxSizing: 'border-box',
35
27
  };
28
+ export const choicePickerContainerStyles = {
29
+ display: 'flex',
30
+ flexDirection: 'column',
31
+ gap: '0.5rem',
32
+ width: '100%',
33
+ };
34
+ export const choicePickerLabelStyles = {
35
+ fontSize: '0.875rem',
36
+ fontWeight: 600,
37
+ color: 'hsl(var(--card-foreground))',
38
+ };