glchat-a2ui-react-renderer 0.2.7 → 0.3.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 (110) hide show
  1. package/README.md +223 -178
  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 +29 -14
  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/{MultipleChoice → ChoicePicker}/CheckboxList.js +2 -13
  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 +12 -9
  23. package/dist/src/components/a2ui/TagInput/TagInput.d.ts +289 -3
  24. package/dist/src/components/a2ui/TagInput/TagInput.d.ts.map +1 -1
  25. package/dist/src/components/a2ui/TagInput/TagInput.js +44 -54
  26. package/dist/src/components/a2ui/TagInput/theme.d.ts +0 -9
  27. package/dist/src/components/a2ui/TagInput/theme.d.ts.map +1 -1
  28. package/dist/src/components/a2ui/TagInput/theme.js +1 -9
  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/theme.d.ts +1 -1
  36. package/dist/src/components/ui/Button/theme.d.ts.map +1 -1
  37. package/dist/src/components/ui/Button/theme.js +11 -0
  38. package/dist/src/components/ui/MultiSelect/MultiSelect.d.ts +1 -1
  39. package/dist/src/components/ui/MultiSelect/MultiSelect.d.ts.map +1 -1
  40. package/dist/src/components/ui/Select/theme.d.ts.map +1 -1
  41. package/dist/src/components/ui/Select/theme.js +0 -1
  42. package/dist/src/utils/catalog.d.ts +16 -4
  43. package/dist/src/utils/catalog.d.ts.map +1 -1
  44. package/dist/src/utils/catalog.js +32 -23
  45. package/dist/src/utils/useSurfaces.d.ts +9 -0
  46. package/dist/src/utils/useSurfaces.d.ts.map +1 -0
  47. package/dist/src/utils/useSurfaces.js +28 -0
  48. package/json/README.md +36 -49
  49. package/json/a2ui-sample-messages.json +170 -315
  50. package/json/glchat_standard_catalog_definition.json +1236 -610
  51. package/package.json +11 -5
  52. package/styles/globals.css +196 -120
  53. package/dist/src/AllSurfacesRenderer.d.ts +0 -14
  54. package/dist/src/AllSurfacesRenderer.d.ts.map +0 -1
  55. package/dist/src/AllSurfacesRenderer.js +0 -18
  56. package/dist/src/SingleSurfaceRenderer.d.ts +0 -15
  57. package/dist/src/SingleSurfaceRenderer.d.ts.map +0 -1
  58. package/dist/src/SingleSurfaceRenderer.js +0 -9
  59. package/dist/src/components/a2ui/Button/theme.d.ts +0 -5
  60. package/dist/src/components/a2ui/Button/theme.d.ts.map +0 -1
  61. package/dist/src/components/a2ui/Button/theme.js +0 -5
  62. package/dist/src/components/a2ui/ButtonAsLink/ButtonAsLink.d.ts +0 -4
  63. package/dist/src/components/a2ui/ButtonAsLink/ButtonAsLink.d.ts.map +0 -1
  64. package/dist/src/components/a2ui/ButtonAsLink/ButtonAsLink.js +0 -42
  65. package/dist/src/components/a2ui/ButtonAsLink/theme.d.ts +0 -8
  66. package/dist/src/components/a2ui/ButtonAsLink/theme.d.ts.map +0 -1
  67. package/dist/src/components/a2ui/ButtonAsLink/theme.js +0 -8
  68. package/dist/src/components/a2ui/Card/theme.d.ts +0 -4
  69. package/dist/src/components/a2ui/Card/theme.d.ts.map +0 -1
  70. package/dist/src/components/a2ui/Card/theme.js +0 -15
  71. package/dist/src/components/a2ui/CheckBox/theme.d.ts +0 -4
  72. package/dist/src/components/a2ui/CheckBox/theme.d.ts.map +0 -1
  73. package/dist/src/components/a2ui/CheckBox/theme.js +0 -11
  74. package/dist/src/components/a2ui/DateTimeInput/theme.d.ts +0 -8
  75. package/dist/src/components/a2ui/DateTimeInput/theme.d.ts.map +0 -1
  76. package/dist/src/components/a2ui/DateTimeInput/theme.js +0 -11
  77. package/dist/src/components/a2ui/DestructiveButton/DestructiveButton.d.ts +0 -4
  78. package/dist/src/components/a2ui/DestructiveButton/DestructiveButton.d.ts.map +0 -1
  79. package/dist/src/components/a2ui/DestructiveButton/DestructiveButton.js +0 -22
  80. package/dist/src/components/a2ui/DestructiveButton/theme.d.ts +0 -8
  81. package/dist/src/components/a2ui/DestructiveButton/theme.d.ts.map +0 -1
  82. package/dist/src/components/a2ui/DestructiveButton/theme.js +0 -8
  83. package/dist/src/components/a2ui/MultipleChoice/CheckboxList.d.ts.map +0 -1
  84. package/dist/src/components/a2ui/MultipleChoice/MultipleChoice.d.ts +0 -4
  85. package/dist/src/components/a2ui/MultipleChoice/MultipleChoice.d.ts.map +0 -1
  86. package/dist/src/components/a2ui/MultipleChoice/MultipleChoice.js +0 -72
  87. package/dist/src/components/a2ui/MultipleChoice/theme.d.ts +0 -13
  88. package/dist/src/components/a2ui/MultipleChoice/theme.d.ts.map +0 -1
  89. package/dist/src/components/a2ui/TextField/theme.d.ts +0 -4
  90. package/dist/src/components/a2ui/TextField/theme.d.ts.map +0 -1
  91. package/dist/src/components/a2ui/TextField/theme.js +0 -9
  92. package/dist/src/components/a2ui/Timeout/theme.d.ts +0 -8
  93. package/dist/src/components/a2ui/Timeout/theme.d.ts.map +0 -1
  94. package/dist/src/components/a2ui/Timeout/theme.js +0 -12
  95. package/dist/src/components/a2ui/types.d.ts +0 -12
  96. package/dist/src/components/a2ui/types.d.ts.map +0 -1
  97. package/dist/src/components/a2ui/types.js +0 -1
  98. package/dist/src/components/ui/Button/ButtonAsLink.d.ts +0 -15
  99. package/dist/src/components/ui/Button/ButtonAsLink.d.ts.map +0 -1
  100. package/dist/src/components/ui/Button/ButtonAsLink.js +0 -17
  101. package/dist/src/components/ui/TextField/theme.d.ts +0 -4
  102. package/dist/src/components/ui/TextField/theme.d.ts.map +0 -1
  103. package/dist/src/components/ui/TextField/theme.js +0 -22
  104. package/dist/src/utils/href.d.ts +0 -11
  105. package/dist/src/utils/href.d.ts.map +0 -1
  106. package/dist/src/utils/href.js +0 -34
  107. package/dist/src/utils/theme.d.ts +0 -15
  108. package/dist/src/utils/theme.d.ts.map +0 -1
  109. package/dist/src/utils/theme.js +0 -93
  110. package/json/glchat_server_to_client_with_catalog.json +0 -1000
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glchat-a2ui-react-renderer",
3
- "version": "0.2.7",
3
+ "version": "0.3.0",
4
4
  "description": "A2UI (Agent-to-UI) React renderer for GLChat — render declarative UI from AI agent messages",
5
5
  "author": {
6
6
  "name": "GDP Labs",
@@ -26,7 +26,6 @@
26
26
  "./styles/globals.css": "./styles/globals.css",
27
27
  "./styles/theme-v4.css": "./styles/theme-v4.css",
28
28
  "./json/glchat_standard_catalog_definition.json": "./json/glchat_standard_catalog_definition.json",
29
- "./json/glchat_server_to_client_with_catalog.json": "./json/glchat_server_to_client_with_catalog.json",
30
29
  "./json/a2ui-sample-messages.json": "./json/a2ui-sample-messages.json"
31
30
  },
32
31
  "sideEffects": [
@@ -43,8 +42,8 @@
43
42
  "scripts": {
44
43
  "build": "npm run build:ts",
45
44
  "build:ts": "tsc -p tsconfig.build.json",
45
+ "generate:json": "npm run build:ts && node scripts/generate-json.mjs",
46
46
  "prepare": "npm run build",
47
- "postinstall": "patch-package",
48
47
  "lint": "eslint . && npx publint",
49
48
  "lint:pub": "npx publint",
50
49
  "format": "prettier --write .",
@@ -57,6 +56,7 @@
57
56
  "react": ">=18.0.0"
58
57
  },
59
58
  "dependencies": {
59
+ "@a2ui/markdown-it": "^0.0.4",
60
60
  "@a2ui/react": "^0.10.0",
61
61
  "@a2ui/web_core": "^0.10.0",
62
62
  "@radix-ui/react-checkbox": "^1.3.3",
@@ -68,7 +68,8 @@
68
68
  "class-variance-authority": "^0.7.1",
69
69
  "clsx": "^2.1.1",
70
70
  "lucide-react": "^0.563.0",
71
- "patch-package": "^8.0.1"
71
+ "patch-package": "^8.0.1",
72
+ "zod": "^3.25.76"
72
73
  },
73
74
  "devDependencies": {
74
75
  "@testing-library/react": "^16.0.1",
@@ -83,11 +84,16 @@
83
84
  "typescript": "^5.7.2",
84
85
  "typescript-eslint": "^8.57.2",
85
86
  "vitest": "^3.2.4",
86
- "vitest-sonar-reporter": "^2.0.4"
87
+ "vitest-sonar-reporter": "^3.0.0"
87
88
  },
88
89
  "publishConfig": {
89
90
  "access": "public"
90
91
  },
92
+ "overrides": {
93
+ "@a2ui/markdown-it": {
94
+ "@a2ui/web_core": "$@a2ui/web_core"
95
+ }
96
+ },
91
97
  "keywords": [
92
98
  "a2ui",
93
99
  "agent-to-ui",
@@ -50,6 +50,9 @@
50
50
 
51
51
  --hover: 0 0% 0% / 5%;
52
52
 
53
+ --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI',
54
+ sans-serif;
55
+
53
56
  /* Spacing tokens */
54
57
  --radius: 0.5rem;
55
58
  --radius-md: calc(var(--radius) - 2px);
@@ -104,101 +107,149 @@
104
107
  --hover: 0 0% 100% / 5%;
105
108
  }
106
109
 
110
+ /*
111
+ * Map A2UI basic-catalog tokens to GLChat design tokens inside rendered surfaces.
112
+ * Card, TextField, DateTimeInput, and CheckBox read these via inline styles / --a2ui-*
113
+ * variables; other GLChat overrides use glchat-a2ui-* classes.
114
+ */
115
+ .a2ui-surface {
116
+ font-family: var(--font-sans);
117
+ --a2ui-font-family-title: var(--font-sans);
118
+ --a2ui-font-family-monospace: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
119
+ 'Liberation Mono', 'Courier New', monospace;
120
+
121
+ /** Card */
122
+ --a2ui-card-background: hsl(var(--card));
123
+ --a2ui-color-surface: hsl(var(--card));
124
+ --a2ui-color-on-surface: hsl(var(--card-foreground));
125
+ --a2ui-card-border: 1px solid hsl(var(--border));
126
+ --a2ui-card-border-radius: var(--radius);
127
+ --a2ui-card-padding: 1rem;
128
+ --a2ui-card-box-shadow: none;
129
+ --a2ui-card-margin: 0;
130
+
131
+ /** TextField */
132
+ --a2ui-color-input: hsl(var(--background));
133
+ --a2ui-color-on-input: hsl(var(--foreground));
134
+ --a2ui-color-border: hsl(var(--border));
135
+ --a2ui-color-primary: hsl(var(--primary));
136
+ --a2ui-border: 1px solid hsl(var(--border));
137
+ --a2ui-label-font-size: 0.875rem;
138
+ --a2ui-label-font-weight: 600;
139
+ --a2ui-textfield-label-font-size: 0.875rem;
140
+ --a2ui-textfield-label-font-weight: 600;
141
+ --a2ui-textfield-border-radius: var(--radius-md);
142
+ --a2ui-textfield-padding: 0.5rem 0.75rem;
143
+ --a2ui-textfield-color-border-focus: hsl(var(--primary));
144
+ --a2ui-textfield-color-border-hover: hsl(var(--border));
145
+ --a2ui-textfield-color-error: hsl(var(--destructive));
146
+ --a2ui-font-size-xs: 0.75rem;
147
+
148
+ /** DateTimeInput */
149
+ --a2ui-datetimeinput-background: hsl(var(--background));
150
+ --a2ui-datetimeinput-color: hsl(var(--foreground));
151
+ --a2ui-datetimeinput-border: 1px solid hsl(var(--border));
152
+ --a2ui-datetimeinput-border-radius: var(--radius-md);
153
+ --a2ui-datetimeinput-padding: 0.5rem 0.75rem;
154
+ --a2ui-datetimeinput-label-font-size: 0.875rem;
155
+ --a2ui-datetimeinput-label-font-weight: 600;
156
+
157
+ /* Checkbox */
158
+ --a2ui-checkbox-size: 1rem;
159
+ --a2ui-checkbox-background: hsl(var(--background));
160
+ --a2ui-checkbox-border: 1px solid hsl(var(--primary));
161
+ --a2ui-checkbox-border-radius: var(--radius-sm);
162
+ --a2ui-checkbox-gap: 0.5rem;
163
+ --a2ui-checkbox-margin: 0;
164
+ --a2ui-checkbox-label-font-size: 0.875rem;
165
+ --a2ui-checkbox-label-font-weight: 400;
166
+ --a2ui-checkbox-color-error: hsl(var(--destructive));
167
+ }
168
+
169
+ /* Card */
170
+ .a2ui-surface .a2ui-card {
171
+ width: 100%;
172
+ }
173
+
107
174
  /* Button */
108
- .a2ui-surface .a2ui-button > button.glchat-a2ui-button,
109
- .a2ui-surface .a2ui-button > button {
175
+ .a2ui-surface .a2ui-button > button.glchat-a2ui-button {
110
176
  font-weight: 600 !important;
111
177
  }
112
178
 
113
179
  .a2ui-surface .a2ui-button > button.glchat-a2ui-button .a2ui-text p,
114
- .a2ui-surface .a2ui-button > button.glchat-a2ui-button p,
115
- .a2ui-surface .a2ui-button > button .a2ui-text p,
116
- .a2ui-surface .a2ui-button > button p {
180
+ .a2ui-surface .a2ui-button > button.glchat-a2ui-button p {
117
181
  font-weight: 600 !important;
118
182
  }
119
183
 
120
- .a2ui-surface .a2ui-button > button.glchat-a2ui-button:hover,
121
- .a2ui-surface .a2ui-button > button:hover {
184
+ .a2ui-surface .a2ui-button > button.glchat-a2ui-button:hover {
122
185
  background-image: var(--glchat-button-bg-hover) !important;
123
186
  border-color: var(--glchat-button-border-hover) !important;
124
187
  }
125
188
 
126
189
  .a2ui-surface .a2ui-button > button.glchat-a2ui-button:focus,
127
- .a2ui-surface .a2ui-button > button.glchat-a2ui-button:focus-visible,
128
- .a2ui-surface .a2ui-button > button:focus,
129
- .a2ui-surface .a2ui-button > button:focus-visible {
190
+ .a2ui-surface .a2ui-button > button.glchat-a2ui-button:focus-visible {
130
191
  outline: none !important;
131
192
  background-image: var(--glchat-button-bg-hover) !important;
132
193
  box-shadow: 0 0 0 2px var(--glchat-button-ring-color) !important;
133
194
  }
134
195
 
135
- .a2ui-surface .a2ui-button > button.glchat-a2ui-button:active,
136
- .a2ui-surface .a2ui-button > button:active {
196
+ .a2ui-surface .a2ui-button > button.glchat-a2ui-button:active {
137
197
  background-image: var(--glchat-button-bg-active) !important;
138
198
  border-color: var(--glchat-button-border-active) !important;
139
199
  outline: none !important;
140
200
  box-shadow: 0 0 0 2px var(--glchat-button-ring-color) !important;
141
201
  }
142
202
 
143
- .a2ui-surface .a2ui-button > button.glchat-a2ui-button:disabled,
144
- .a2ui-surface .a2ui-button > button:disabled {
203
+ .a2ui-surface .a2ui-button > button.glchat-a2ui-button:disabled {
145
204
  opacity: 0.5 !important;
146
205
  cursor: default !important;
147
206
  pointer-events: none !important;
148
207
  }
149
208
 
150
- /* ButtonAsLink */
151
- .a2ui-surface .a2ui-button-as-link > a.glchat-a2ui-button,
152
- .a2ui-surface .a2ui-button-as-link > a {
153
- font-weight: 600 !important;
154
- text-decoration: none !important;
155
- }
156
-
157
- .a2ui-surface .a2ui-button-as-link > a.glchat-a2ui-button .a2ui-text p,
158
- .a2ui-surface .a2ui-button-as-link > a.glchat-a2ui-button p,
159
- .a2ui-surface .a2ui-button-as-link > a .a2ui-text p,
160
- .a2ui-surface .a2ui-button-as-link > a p {
161
- font-weight: 600 !important;
162
- }
163
-
164
- .a2ui-surface .a2ui-button-as-link > a.glchat-a2ui-button:hover,
165
- .a2ui-surface .a2ui-button-as-link > a:hover {
166
- background-image: var(--glchat-button-bg-hover) !important;
167
- border-color: var(--glchat-button-border-hover) !important;
168
- }
169
-
170
- .a2ui-surface .a2ui-button-as-link > a.glchat-a2ui-button:focus,
171
- .a2ui-surface .a2ui-button-as-link > a.glchat-a2ui-button:focus-visible,
172
- .a2ui-surface .a2ui-button-as-link > a:focus,
173
- .a2ui-surface .a2ui-button-as-link > a:focus-visible {
174
- outline: none !important;
175
- background-image: var(--glchat-button-bg-hover) !important;
176
- box-shadow: 0 0 0 2px var(--glchat-button-ring-color) !important;
177
- }
178
-
179
- .a2ui-surface .a2ui-button-as-link > a.glchat-a2ui-button:active,
180
- .a2ui-surface .a2ui-button-as-link > a:active {
181
- background-image: var(--glchat-button-bg-active) !important;
182
- border-color: var(--glchat-button-border-active) !important;
183
- outline: none !important;
184
- box-shadow: 0 0 0 2px var(--glchat-button-ring-color) !important;
185
- }
186
-
187
- /* TextField */
188
- .a2ui-surface .a2ui-textfield > section {
209
+ /* Input - Container */
210
+ .a2ui-surface div:has(> input[type='text']:not(.glchat-a2ui-tag-input-field)),
211
+ .a2ui-surface div:has(> input[type='number']),
212
+ .a2ui-surface div:has(> input[type='password']),
213
+ .a2ui-surface div:has(> textarea),
214
+ .a2ui-surface div:has(> input[type='date']),
215
+ .a2ui-surface div:has(> input[type='time']),
216
+ .a2ui-surface div:has(> input[type='datetime-local']),
217
+ .a2ui-surface div:has(> input[type='range']) {
189
218
  display: flex;
190
219
  flex-direction: column;
191
220
  gap: 0.5rem;
192
221
  width: 100%;
222
+ box-sizing: border-box;
193
223
  }
194
224
 
195
- .a2ui-surface .a2ui-textfield label {
225
+ /* TextField - Label */
226
+ .a2ui-surface div:has(> input[type='text']) > label,
227
+ .a2ui-surface div:has(> input[type='number']) > label,
228
+ .a2ui-surface div:has(> input[type='password']) > label,
229
+ .a2ui-surface div:has(> textarea) > label {
196
230
  font-size: 0.875rem;
197
231
  font-weight: 600;
198
232
  color: hsl(var(--card-foreground));
199
233
  }
200
234
 
201
- .a2ui-surface .a2ui-textfield textarea.glchat-a2ui-text-field {
235
+ .a2ui-surface div:has(> input[type='text']:not(.glchat-a2ui-tag-input-field)) > input,
236
+ .a2ui-surface div:has(> input[type='number']) > input,
237
+ .a2ui-surface div:has(> input[type='password']) > input,
238
+ .a2ui-surface div:has(> textarea) > textarea {
239
+ box-sizing: border-box;
240
+ width: 100%;
241
+ border-radius: var(--radius-md);
242
+ border: 1px solid hsl(var(--border));
243
+ background-color: hsl(var(--background));
244
+ padding: 0.5rem 0.75rem;
245
+ font-family: inherit;
246
+ font-size: 0.875rem;
247
+ line-height: 1.5;
248
+ color: hsl(var(--foreground));
249
+ caret-color: currentColor;
250
+ }
251
+
252
+ .a2ui-surface div:has(> textarea) > textarea {
202
253
  min-height: 80px;
203
254
  height: auto;
204
255
  overflow-y: auto;
@@ -206,31 +257,49 @@
206
257
  overflow-wrap: break-word;
207
258
  }
208
259
 
209
- .a2ui-surface .a2ui-textfield input.glchat-a2ui-text-field,
210
- .a2ui-surface .a2ui-textfield textarea.glchat-a2ui-text-field {
211
- font-family: inherit !important;
212
- line-height: 1.5 !important;
213
- }
214
-
215
- .a2ui-surface .a2ui-textfield input.glchat-a2ui-text-field:focus,
216
- .a2ui-surface .a2ui-textfield input.glchat-a2ui-text-field:focus-visible,
217
- .a2ui-surface .a2ui-textfield textarea.glchat-a2ui-text-field:focus,
218
- .a2ui-surface .a2ui-textfield textarea.glchat-a2ui-text-field:focus-visible {
260
+ .a2ui-surface div:has(> input[type='text']:not(.glchat-a2ui-tag-input-field)) > input:focus,
261
+ .a2ui-surface div:has(> input[type='text']:not(.glchat-a2ui-tag-input-field)) > input:focus-visible,
262
+ .a2ui-surface div:has(> input[type='number']) > input:focus,
263
+ .a2ui-surface div:has(> input[type='number']) > input:focus-visible,
264
+ .a2ui-surface div:has(> input[type='password']) > input:focus,
265
+ .a2ui-surface div:has(> input[type='password']) > input:focus-visible,
266
+ .a2ui-surface div:has(> textarea) > textarea:focus,
267
+ .a2ui-surface div:has(> textarea) > textarea:focus-visible {
219
268
  border-color: hsl(var(--primary)) !important;
220
269
  outline: none !important;
221
270
  }
222
271
 
223
- .a2ui-surface .a2ui-textfield input.glchat-a2ui-text-field:disabled,
224
- .a2ui-surface .a2ui-textfield textarea.glchat-a2ui-text-field:disabled {
272
+ .a2ui-surface div:has(> input[type='text']:not(.glchat-a2ui-tag-input-field)) > input:disabled,
273
+ .a2ui-surface div:has(> input[type='number']) > input:disabled,
274
+ .a2ui-surface div:has(> input[type='password']) > input:disabled,
275
+ .a2ui-surface div:has(> textarea) > textarea:disabled {
225
276
  cursor: not-allowed !important;
226
277
  opacity: 0.5 !important;
227
278
  }
228
279
 
229
- .a2ui-surface .a2ui-textfield input.glchat-a2ui-text-field::placeholder,
230
- .a2ui-surface .a2ui-textfield textarea.glchat-a2ui-text-field::placeholder {
280
+ .a2ui-surface div:has(> input[type='text']:not(.glchat-a2ui-tag-input-field)) > input::placeholder,
281
+ .a2ui-surface div:has(> input[type='number']) > input::placeholder,
282
+ .a2ui-surface div:has(> input[type='password']) > input::placeholder,
283
+ .a2ui-surface div:has(> textarea) > textarea::placeholder {
231
284
  color: hsl(var(--foreground) / 0.5);
232
285
  }
233
286
 
287
+ .a2ui-surface div:has(> input[type='text']:not(.glchat-a2ui-tag-input-field)) > input:has(+ span),
288
+ .a2ui-surface div:has(> input[type='number']) > input:has(+ span),
289
+ .a2ui-surface div:has(> input[type='password']) > input:has(+ span),
290
+ .a2ui-surface div:has(> textarea) > textarea:has(+ span) {
291
+ border-color: hsl(var(--destructive)) !important;
292
+ }
293
+
294
+ .a2ui-surface div:has(> input[type='text']:not(.glchat-a2ui-tag-input-field)) > span,
295
+ .a2ui-surface div:has(> input[type='number']) > span,
296
+ .a2ui-surface div:has(> input[type='password']) > span,
297
+ .a2ui-surface div:has(> textarea) > span {
298
+ font-size: 0.75rem;
299
+ line-height: 1.25rem;
300
+ color: hsl(var(--destructive));
301
+ }
302
+
234
303
  /* TagInput */
235
304
  .a2ui-surface .a2ui-tag-input input.glchat-a2ui-tag-input-field {
236
305
  font-family: inherit !important;
@@ -254,53 +323,60 @@
254
323
  color: hsl(var(--destructive)) !important;
255
324
  }
256
325
 
257
- /* DateTimeInput (stock @a2ui/react — theme additionalStyles + globals) */
258
- .a2ui-surface .a2ui-datetime-input > section {
259
- display: flex;
260
- flex-direction: column;
261
- gap: 0.5rem;
262
- width: 100%;
263
- }
264
-
265
- .a2ui-surface .a2ui-datetime-input label {
326
+ /* DateTimeInput */
327
+ .a2ui-surface div:has(> input[type='date']) > label,
328
+ .a2ui-surface div:has(> input[type='time']) > label,
329
+ .a2ui-surface div:has(> input[type='datetime-local']) > label {
266
330
  font-size: 0.875rem;
267
331
  font-weight: 600;
268
332
  color: hsl(var(--card-foreground));
269
333
  }
270
334
 
271
- .a2ui-surface .a2ui-datetime-input input.glchat-a2ui-datetime-input {
272
- font-family: inherit !important;
273
- line-height: 1.5 !important;
335
+ .a2ui-surface div:has(> input[type='date']) > input,
336
+ .a2ui-surface div:has(> input[type='time']) > input,
337
+ .a2ui-surface div:has(> input[type='datetime-local']) > input {
338
+ box-sizing: border-box;
339
+ width: 100%;
340
+ height: 2.5rem;
341
+ font-family: inherit;
342
+ line-height: 1.5;
343
+ font-size: 0.875rem;
274
344
  }
275
345
 
276
- .a2ui-surface .a2ui-datetime-input input.glchat-a2ui-datetime-input:focus,
277
- .a2ui-surface .a2ui-datetime-input input.glchat-a2ui-datetime-input:focus-visible {
346
+ .a2ui-surface div:has(> input[type='date']) > input:focus,
347
+ .a2ui-surface div:has(> input[type='date']) > input:focus-visible,
348
+ .a2ui-surface div:has(> input[type='time']) > input:focus,
349
+ .a2ui-surface div:has(> input[type='time']) > input:focus-visible,
350
+ .a2ui-surface div:has(> input[type='datetime-local']) > input:focus,
351
+ .a2ui-surface div:has(> input[type='datetime-local']) > input:focus-visible {
278
352
  border-color: hsl(var(--primary)) !important;
279
353
  outline: none !important;
280
354
  }
281
355
 
282
- .a2ui-surface .a2ui-datetime-input input.glchat-a2ui-datetime-input:disabled {
356
+ .a2ui-surface div:has(> input[type='date']) > input:disabled,
357
+ .a2ui-surface div:has(> input[type='time']) > input:disabled,
358
+ .a2ui-surface div:has(> input[type='datetime-local']) > input:disabled {
283
359
  cursor: not-allowed !important;
284
360
  opacity: 0.5 !important;
285
361
  }
286
362
 
287
- /* MultipleChoice */
288
- .a2ui-surface .a2ui-multiplechoice button.glchat-a2ui-select-trigger:focus,
289
- .a2ui-surface .a2ui-multiplechoice button.glchat-a2ui-select-trigger:focus-visible {
363
+ /* ChoicePicker - Single-select dropdown */
364
+ .a2ui-surface .a2ui-choicepicker button.glchat-a2ui-select-trigger:focus,
365
+ .a2ui-surface .a2ui-choicepicker button.glchat-a2ui-select-trigger:focus-visible {
290
366
  border-color: hsl(var(--primary)) !important;
291
367
  outline: none !important;
292
368
  }
293
369
 
294
- .a2ui-surface .a2ui-multiplechoice button.glchat-a2ui-select-trigger:disabled {
370
+ .a2ui-surface .a2ui-choicepicker button.glchat-a2ui-select-trigger:disabled {
295
371
  cursor: not-allowed !important;
296
372
  opacity: 0.5 !important;
297
373
  }
298
374
 
299
- .a2ui-surface .a2ui-multiplechoice button.glchat-a2ui-select-trigger [data-placeholder] {
375
+ .a2ui-surface .a2ui-choicepicker button.glchat-a2ui-select-trigger [data-placeholder] {
300
376
  color: hsl(var(--foreground) / 0.5);
301
377
  }
302
378
 
303
- /* Single-select dropdown */
379
+ /* ChoicePicker - Select dropdown content (portaled) */
304
380
  .glchat-a2ui-select-content .glchat-a2ui-select-item[data-highlighted],
305
381
  .glchat-a2ui-select-content .glchat-a2ui-select-item:hover {
306
382
  background-color: hsl(var(--foreground) / 0.1) !important;
@@ -312,13 +388,13 @@
312
388
  outline: none !important;
313
389
  }
314
390
 
315
- .a2ui-surface .a2ui-multiplechoice button.glchat-a2ui-multiselect-trigger:focus,
316
- .a2ui-surface .a2ui-multiplechoice button.glchat-a2ui-multiselect-trigger:focus-visible {
391
+ .a2ui-surface .a2ui-choicepicker button.glchat-a2ui-multiselect-trigger:focus,
392
+ .a2ui-surface .a2ui-choicepicker button.glchat-a2ui-multiselect-trigger:focus-visible {
317
393
  border-color: hsl(var(--primary)) !important;
318
394
  outline: none !important;
319
395
  }
320
396
 
321
- .a2ui-surface .a2ui-multiplechoice button.glchat-a2ui-multiselect-trigger:disabled {
397
+ .a2ui-surface .a2ui-choicepicker button.glchat-a2ui-multiselect-trigger:disabled {
322
398
  cursor: not-allowed !important;
323
399
  opacity: 0.5 !important;
324
400
  }
@@ -329,50 +405,50 @@
329
405
  outline: none !important;
330
406
  }
331
407
 
332
- /* CheckBox — stock A2UI CheckBox (native input) */
333
- .a2ui-surface .a2ui-checkbox input[type='checkbox'] {
334
- height: 1rem;
335
- width: 1rem;
336
- flex-shrink: 0;
337
- margin: 0;
338
- border-radius: var(--radius-sm);
339
- border: 1px solid hsl(var(--primary));
340
- background-color: hsl(var(--background));
341
- accent-color: hsl(var(--primary));
342
- cursor: pointer;
408
+ /* ChoicePicker - checkbox variant */
409
+ .a2ui-surface .glchat-a2ui-checkbox[data-state='checked'] {
410
+ background-color: hsl(var(--primary)) !important;
411
+ color: hsl(var(--primary-foreground)) !important;
343
412
  }
344
413
 
345
- .a2ui-surface .a2ui-checkbox input[type='checkbox']:focus-visible {
414
+ .a2ui-surface .glchat-a2ui-checkbox:focus-visible {
346
415
  outline: none !important;
347
- box-shadow: 0 0 0 2px hsl(var(--ring)) !important;
416
+ box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring)) !important;
348
417
  }
349
418
 
350
- .a2ui-surface .a2ui-checkbox input[type='checkbox']:disabled {
419
+ .a2ui-surface .glchat-a2ui-checkbox:disabled {
351
420
  cursor: not-allowed !important;
352
421
  opacity: 0.5 !important;
353
422
  }
354
423
 
355
- .a2ui-surface .a2ui-checkbox label {
356
- font-size: 0.875rem;
357
- color: hsl(var(--foreground));
358
- line-height: 1.25rem;
424
+ /* CheckBox */
425
+ .a2ui-surface input[type='checkbox'] {
426
+ appearance: none !important;
427
+ -webkit-appearance: none !important;
428
+ box-sizing: border-box;
429
+ flex-shrink: 0;
430
+ margin: 0;
431
+ display: inline-grid;
432
+ place-content: center;
433
+ vertical-align: middle;
359
434
  }
360
435
 
361
- /* Checkbox (Radix) — MultipleChoice checkbox variant */
362
- .a2ui-surface .a2ui-checkbox .glchat-a2ui-checkbox[data-state='checked'],
363
- .a2ui-surface .glchat-a2ui-checkbox[data-state='checked'] {
436
+ .a2ui-surface input[type='checkbox']:checked {
364
437
  background-color: hsl(var(--primary)) !important;
365
- color: hsl(var(--primary-foreground)) !important;
438
+ border-color: hsl(var(--primary)) !important;
439
+ border-radius: var(--a2ui-checkbox-border-radius, var(--radius-sm)) !important;
440
+ background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e") !important;
441
+ background-size: 100% 100% !important;
442
+ background-repeat: no-repeat !important;
443
+ background-position: center !important;
366
444
  }
367
445
 
368
- .a2ui-surface .a2ui-checkbox .glchat-a2ui-checkbox:focus-visible,
369
- .a2ui-surface .glchat-a2ui-checkbox:focus-visible {
446
+ .a2ui-surface input[type='checkbox']:focus-visible {
370
447
  outline: none !important;
371
- box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring)) !important;
448
+ box-shadow: 0 0 0 2px hsl(var(--ring)) !important;
372
449
  }
373
450
 
374
- .a2ui-surface .a2ui-checkbox .glchat-a2ui-checkbox:disabled,
375
- .a2ui-surface .glchat-a2ui-checkbox:disabled {
451
+ .a2ui-surface input[type='checkbox']:disabled {
376
452
  cursor: not-allowed !important;
377
453
  opacity: 0.5 !important;
378
454
  }
@@ -1,14 +0,0 @@
1
- import type { ReactNode } from 'react';
2
- export type AllSurfacesRendererProps = {
3
- className?: string;
4
- fallback?: ReactNode;
5
- loadingFallback?: ReactNode;
6
- };
7
- /**
8
- * Convenience renderer that mounts an `A2UIRenderer` for every known surface.
9
- *
10
- * This lets the consumer avoid thinking about `surfaceId` in the simplest case,
11
- * while still keeping the main provider/renderer separation (provider owns state + onAction).
12
- */
13
- export declare function AllSurfacesRenderer(props: Readonly<AllSurfacesRendererProps>): import("react/jsx-runtime").JSX.Element | null;
14
- //# sourceMappingURL=AllSurfacesRenderer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AllSurfacesRenderer.d.ts","sourceRoot":"","sources":["../../src/AllSurfacesRenderer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMvC,MAAM,MAAM,wBAAwB,GAAG;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,eAAe,CAAC,EAAE,SAAS,CAAC;CAC7B,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,QAAQ,CAAC,wBAAwB,CAAC,kDAsB5E"}
@@ -1,18 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
3
- import { A2UIRenderer, useA2UI } from '@a2ui/react';
4
- import { useA2UIRegistry } from './Provider.js';
5
- /**
6
- * Convenience renderer that mounts an `A2UIRenderer` for every known surface.
7
- *
8
- * This lets the consumer avoid thinking about `surfaceId` in the simplest case,
9
- * while still keeping the main provider/renderer separation (provider owns state + onAction).
10
- */
11
- export function AllSurfacesRenderer(props) {
12
- const registry = useA2UIRegistry();
13
- const { getSurfaces } = useA2UI();
14
- const surfaceIds = Array.from(getSurfaces().keys());
15
- if (surfaceIds.length === 0)
16
- return null;
17
- return (_jsx(_Fragment, { children: surfaceIds.map((surfaceId) => (_jsx(A2UIRenderer, { surfaceId: surfaceId, registry: registry, className: props.className, fallback: props.fallback, loadingFallback: props.loadingFallback }, surfaceId))) }));
18
- }
@@ -1,15 +0,0 @@
1
- import type { ReactNode } from 'react';
2
- import { type ComponentRegistry } from '@a2ui/react';
3
- export type SingleSurfaceRendererProps = {
4
- /**
5
- * Surface ID to render.
6
- * `@a2ui/react` requires this; we default to `main` for compatibility.
7
- */
8
- surfaceId?: string;
9
- className?: string;
10
- fallback?: ReactNode;
11
- loadingFallback?: ReactNode;
12
- registry?: ComponentRegistry;
13
- };
14
- export declare function SingleSurfaceRenderer(props: Readonly<SingleSurfaceRendererProps>): import("react/jsx-runtime").JSX.Element;
15
- //# sourceMappingURL=SingleSurfaceRenderer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SingleSurfaceRenderer.d.ts","sourceRoot":"","sources":["../../src/SingleSurfaceRenderer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,EAAgB,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAInE,MAAM,MAAM,0BAA0B,GAAG;IACvC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,eAAe,CAAC,EAAE,SAAS,CAAC;IAC5B,QAAQ,CAAC,EAAE,iBAAiB,CAAC;CAC9B,CAAC;AAEF,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,QAAQ,CAAC,0BAA0B,CAAC,2CAahF"}
@@ -1,9 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { A2UIRenderer } from '@a2ui/react';
4
- import { useA2UIRegistry } from './Provider.js';
5
- export function SingleSurfaceRenderer(props) {
6
- const registryFromCtx = useA2UIRegistry();
7
- const registry = props.registry ?? registryFromCtx;
8
- return (_jsx(A2UIRenderer, { surfaceId: props.surfaceId ?? 'main', registry: registry, className: props.className, fallback: props.fallback, loadingFallback: props.loadingFallback }));
9
- }
@@ -1,5 +0,0 @@
1
- import type { Theme } from '@a2ui/web_core/types/types';
2
- export declare const buttonComponents: Theme['components']['Button'];
3
- /** Theme override slot. Base and variant styles are applied by the UI Button primitive. */
4
- export declare const buttonAdditionalStyles: NonNullable<Theme['additionalStyles']>['Button'];
5
- //# sourceMappingURL=theme.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../src/components/a2ui/Button/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAExD,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,QAAQ,CAE1D,CAAC;AAEF,2FAA2F;AAC3F,eAAO,MAAM,sBAAsB,EAAE,WAAW,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAC,QAAQ,CAAM,CAAC"}
@@ -1,5 +0,0 @@
1
- export const buttonComponents = {
2
- 'glchat-a2ui-button': true,
3
- };
4
- /** Theme override slot. Base and variant styles are applied by the UI Button primitive. */
5
- export const buttonAdditionalStyles = {};
@@ -1,4 +0,0 @@
1
- import { type A2UIComponentProps } from '@a2ui/react';
2
- import type { CustomNode } from '@a2ui/web_core/types/types';
3
- export declare function CustomButtonAsLinkComponent({ node, surfaceId, }: Readonly<A2UIComponentProps<CustomNode>>): import("react/jsx-runtime").JSX.Element;
4
- //# sourceMappingURL=ButtonAsLink.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ButtonAsLink.d.ts","sourceRoot":"","sources":["../../../../../src/components/a2ui/ButtonAsLink/ButtonAsLink.tsx"],"names":[],"mappings":"AAEA,OAAO,EAKL,KAAK,kBAAkB,EAExB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAoB,UAAU,EAAE,MAAM,4BAA4B,CAAC;AA0C/E,wBAAgB,2BAA2B,CAAC,EAC1C,IAAI,EACJ,SAAS,GACV,EAAE,QAAQ,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC,2CA8C1C"}
@@ -1,42 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { ComponentNode, classMapToString, stylesToObject, useA2UIComponent, } from '@a2ui/react';
4
- import { useMemo } from 'react';
5
- import { sanitizeHref, sanitizeTarget } from '../../../utils/href.js';
6
- import { ButtonAsLink } from '../../ui/Button/ButtonAsLink.js';
7
- import { buttonAsLinkComponents } from './theme.js';
8
- function resolveStringValue(value, resolveString, getValue) {
9
- if (!value)
10
- return undefined;
11
- if (value.path) {
12
- const raw = getValue(value.path);
13
- if (raw == null)
14
- return undefined;
15
- if (typeof raw === 'string')
16
- return raw;
17
- if (typeof raw === 'number' || typeof raw === 'boolean')
18
- return String(raw);
19
- return undefined;
20
- }
21
- return resolveString(value) ?? undefined;
22
- }
23
- function resolveHref(href, resolveString, getValue) {
24
- const resolved = resolveStringValue(href, resolveString, getValue);
25
- return sanitizeHref(resolved ?? '#');
26
- }
27
- export function CustomButtonAsLinkComponent({ node, surfaceId, }) {
28
- const { theme, resolveString, getValue } = useA2UIComponent(node, surfaceId);
29
- const { child, href, target } = node.properties;
30
- const buttonAsLinkTheme = useMemo(() => {
31
- const components = theme.components;
32
- return components.ButtonAsLink ?? buttonAsLinkComponents;
33
- }, [theme.components]);
34
- const linkStyle = useMemo(() => stylesToObject(theme.additionalStyles?.ButtonAsLink), [theme.additionalStyles]);
35
- const resolvedHref = useMemo(() => resolveHref(href, resolveString, getValue), [getValue, href, resolveString]);
36
- const resolvedTarget = useMemo(() => {
37
- const raw = resolveStringValue(target, resolveString, getValue);
38
- return raw ? sanitizeTarget(raw) : undefined;
39
- }, [getValue, resolveString, target]);
40
- const hostStyle = node.weight === void 0 ? undefined : { '--weight': node.weight };
41
- return (_jsx("div", { className: `a2ui-button a2ui-button-as-link ${classMapToString(buttonAsLinkTheme.container)}`.trim(), style: hostStyle, children: _jsx(ButtonAsLink, { href: resolvedHref, target: resolvedTarget, className: classMapToString(buttonAsLinkTheme.element), style: linkStyle, children: child ? _jsx(ComponentNode, { node: child, surfaceId: surfaceId }) : null }) }));
42
- }