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
@@ -1,8 +0,0 @@
1
- import type { Theme } from '@a2ui/web_core/types/types';
2
- /**
3
- * DateTimeInput structural class map.
4
- */
5
- export declare const glchatDateTimeInputComponents: Theme['components']['DateTimeInput'];
6
- /** Applied inline on the native date/time input. */
7
- export declare const glchatDateTimeInputAdditionalStyles: NonNullable<Theme['additionalStyles']>['DateTimeInput'];
8
- //# sourceMappingURL=theme.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../src/components/a2ui/DateTimeInput/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAIxD;;GAEG;AACH,eAAO,MAAM,6BAA6B,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,eAAe,CAI9E,CAAC;AAEF,oDAAoD;AACpD,eAAO,MAAM,mCAAmC,EAAE,WAAW,CAC3D,KAAK,CAAC,kBAAkB,CAAC,CAC1B,CAAC,eAAe,CAAwD,CAAC"}
@@ -1,11 +0,0 @@
1
- import { glchatTextFieldInputStyles } from '../TextField/theme.js';
2
- /**
3
- * DateTimeInput structural class map.
4
- */
5
- export const glchatDateTimeInputComponents = {
6
- container: {},
7
- label: {},
8
- element: { 'glchat-a2ui-datetime-input': true },
9
- };
10
- /** Applied inline on the native date/time input. */
11
- export const glchatDateTimeInputAdditionalStyles = glchatTextFieldInputStyles;
@@ -1 +0,0 @@
1
- {"version":3,"file":"CheckboxList.d.ts","sourceRoot":"","sources":["../../../../../src/components/a2ui/MultipleChoice/CheckboxList.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAQvE,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,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,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,aAAa,EACb,UAAkB,EAClB,SAAS,GACV,EAAE,QAAQ,CAAC,iBAAiB,CAAC,2CA2E7B"}
@@ -1,45 +0,0 @@
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 { glchatCheckboxLabelStyles } from '../../ui/Checkbox/theme.js';
6
- import { glchatCheckboxListContainerStyles, glchatCheckboxListItemStyles, glchatCheckboxListSearchStyles, } from './theme.js';
7
- export function CheckboxList({ options, value, onValueChange, singleSelect, maxSelections, 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
- if (maxSelections !== void 0 && value.length >= maxSelections) {
27
- return;
28
- }
29
- onValueChange([...value, optionValue]);
30
- };
31
- const listClassName = ['glchat-a2ui-checkbox-list', className].filter(Boolean).join(' ');
32
- return (_jsxs("div", { className: listClassName, style: glchatCheckboxListContainerStyles, children: [filterable && (_jsx("input", { type: "text", value: search, onChange: (e) => setSearch(e.target.value), placeholder: "Search...", style: glchatCheckboxListSearchStyles })), filteredOptions.map((option) => {
33
- const isSelected = value.includes(option.value);
34
- const atMax = !singleSelect &&
35
- maxSelections !== void 0 &&
36
- value.length >= maxSelections &&
37
- !isSelected;
38
- const optionId = `${groupId}-${option.value}`;
39
- return (_jsxs("label", { htmlFor: optionId, className: "glchat-a2ui-checkbox-option", style: {
40
- ...glchatCheckboxListItemStyles,
41
- opacity: atMax ? 0.5 : 1,
42
- cursor: atMax ? 'not-allowed' : 'pointer',
43
- }, children: [_jsx(Checkbox, { id: optionId, checked: isSelected, disabled: atMax, onCheckedChange: () => toggleOption(option.value) }), _jsx("span", { style: glchatCheckboxLabelStyles, children: option.label })] }, option.value));
44
- })] }));
45
- }
@@ -1,4 +0,0 @@
1
- import { type A2UIComponentProps } from '@a2ui/react';
2
- import type { MultipleChoiceNode } from '@a2ui/web_core/types/types';
3
- export declare function CustomMultipleChoiceComponent({ node, surfaceId, }: Readonly<A2UIComponentProps<MultipleChoiceNode>>): import("react/jsx-runtime").JSX.Element;
4
- //# sourceMappingURL=MultipleChoice.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MultipleChoice.d.ts","sourceRoot":"","sources":["../../../../../src/components/a2ui/MultipleChoice/MultipleChoice.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAoGrE,wBAAgB,6BAA6B,CAAC,EAC5C,IAAI,EACJ,SAAS,GACV,EAAE,QAAQ,CAAC,kBAAkB,CAAC,kBAAkB,CAAC,CAAC,2CAuFlD"}
@@ -1,72 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { classMapToString, useA2UIComponent, } from '@a2ui/react';
4
- import { useCallback, useMemo } from 'react';
5
- import { MultiSelect } from '../../ui/MultiSelect/MultiSelect.js';
6
- import { Select, SelectContent, SelectItem, SelectTrigger, } from '../../ui/Select/Select.js';
7
- import { glchatSelectTriggerLabelStyles, glchatSelectTriggerPlaceholderStyles, } from '../../ui/Select/theme.js';
8
- import { CheckboxList } from './CheckboxList.js';
9
- import { glchatMultipleChoiceComponents } from './theme.js';
10
- function isSingleSelect(maxAllowedSelections) {
11
- return !maxAllowedSelections || maxAllowedSelections <= 1;
12
- }
13
- /** GLChat/Standard catalog uses `variant`; A2UI schema (in code) uses `type`. */
14
- function getVariant(properties) {
15
- const extended = properties;
16
- return extended.variant ?? properties.type;
17
- }
18
- function getSelectedValues(selections, getValue) {
19
- if (selections?.path) {
20
- const raw = getValue(selections.path);
21
- if (Array.isArray(raw)) {
22
- return raw.filter((item) => typeof item === 'string');
23
- }
24
- return [];
25
- }
26
- return selections?.literalArray ?? [];
27
- }
28
- function SingleSelectChips({ elementClass, options, value, onValueChange, }) {
29
- const selectedLabel = useMemo(() => {
30
- const match = options.find((opt) => opt.value === value);
31
- return match?.label ?? '';
32
- }, [options, value]);
33
- const triggerLabelStyle = useMemo(() => ({
34
- ...glchatSelectTriggerLabelStyles,
35
- ...(selectedLabel ? undefined : glchatSelectTriggerPlaceholderStyles),
36
- }), [selectedLabel]);
37
- return (_jsxs(Select, { value: value, onValueChange: onValueChange, children: [_jsx(SelectTrigger, { className: `glchat-a2ui-select-trigger ${elementClass}`.trim(), "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))) })] }));
38
- }
39
- export function CustomMultipleChoiceComponent({ node, surfaceId, }) {
40
- const { theme, resolveString, setValue, getValue } = useA2UIComponent(node, surfaceId);
41
- const { selections, options = [], maxAllowedSelections, filterable } = node.properties;
42
- const variant = getVariant(node.properties);
43
- const singleSelect = isSingleSelect(maxAllowedSelections);
44
- const selectionsPath = selections?.path;
45
- const hostStyle = node.weight === void 0 ? undefined : { '--weight': node.weight };
46
- const multipleChoiceTheme = theme.components.MultipleChoice ?? glchatMultipleChoiceComponents;
47
- const containerClass = classMapToString(multipleChoiceTheme.container);
48
- const elementClass = classMapToString(multipleChoiceTheme.element);
49
- const selectedValues = getSelectedValues(selections, getValue);
50
- const resolvedOptions = useMemo(() => options.map((option) => ({
51
- value: option.value,
52
- label: resolveString(option.label) ?? option.value,
53
- })), [options, resolveString]);
54
- const handleSingleValueChange = useCallback((nextValue) => {
55
- if (selectionsPath) {
56
- setValue(selectionsPath, [nextValue]);
57
- }
58
- }, [selectionsPath, setValue]);
59
- const handleMultiValueChange = useCallback((values) => {
60
- if (selectionsPath) {
61
- setValue(selectionsPath, values);
62
- }
63
- }, [selectionsPath, setValue]);
64
- const wrapper = (content) => (_jsx("div", { className: "a2ui-multiplechoice", style: hostStyle, children: _jsx("section", { className: containerClass, children: content }) }));
65
- if (variant === 'checkbox') {
66
- return wrapper(_jsx(CheckboxList, { className: elementClass, options: resolvedOptions, value: selectedValues, onValueChange: handleMultiValueChange, singleSelect: singleSelect, maxSelections: singleSelect ? 1 : maxAllowedSelections, filterable: filterable ?? false }));
67
- }
68
- if (singleSelect) {
69
- return wrapper(_jsx(SingleSelectChips, { elementClass: elementClass, options: resolvedOptions, value: selectedValues[0] ?? '', onValueChange: handleSingleValueChange }));
70
- }
71
- return wrapper(_jsx(MultiSelect, { className: elementClass, options: resolvedOptions, value: selectedValues, onValueChange: handleMultiValueChange, placeholder: "Select options", filterable: filterable ?? false, maxSelections: maxAllowedSelections }));
72
- }
@@ -1,13 +0,0 @@
1
- import type { CSSProperties } from 'react';
2
- import type { Theme } from '@a2ui/web_core/types/types';
3
- /**
4
- * MultipleChoice structural class map.
5
- */
6
- export declare const glchatMultipleChoiceComponents: Theme['components']['MultipleChoice'];
7
- /**
8
- * Checkbox variant — vertical list of options.
9
- */
10
- export declare const glchatCheckboxListContainerStyles: CSSProperties;
11
- export declare const glchatCheckboxListItemStyles: CSSProperties;
12
- export declare const glchatCheckboxListSearchStyles: CSSProperties;
13
- //# sourceMappingURL=theme.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../src/components/a2ui/MultipleChoice/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAExD;;GAEG;AACH,eAAO,MAAM,8BAA8B,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,gBAAgB,CAIhF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iCAAiC,EAAE,aAK/C,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,aAK1C,CAAC;AAEF,eAAO,MAAM,8BAA8B,EAAE,aAW5C,CAAC"}
@@ -1,4 +0,0 @@
1
- import { type A2UIComponentProps } from '@a2ui/react';
2
- import type { TextFieldNode } from '@a2ui/web_core/types/types';
3
- export declare function CustomTextFieldComponent({ node, surfaceId, }: Readonly<A2UIComponentProps<TextFieldNode>>): import("react/jsx-runtime").JSX.Element;
4
- //# sourceMappingURL=TextField.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../../../../../src/components/a2ui/TextField/TextField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsC,KAAK,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAC1F,OAAO,KAAK,EAAe,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAgD7E,wBAAgB,wBAAwB,CAAC,EACvC,IAAI,EACJ,SAAS,GACV,EAAE,QAAQ,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAC,2CAuD7C"}
@@ -1,54 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { classMapToString, useA2UIComponent } from '@a2ui/react';
3
- import { glchatTextFieldComponents, glchatTextFieldContainerStyles, glchatTextFieldInputStyles, glchatTextFieldLabelStyles, glchatTextFieldTextareaStyles, glchatTextFieldTextareaWrapperStyles, } from './theme.js';
4
- const TEXT_FIELD_PLACEHOLDER = 'Please enter a value';
5
- function dataModelValueToString(data) {
6
- if (data == null)
7
- return '';
8
- if (typeof data === 'string')
9
- return data;
10
- if (typeof data === 'number' || typeof data === 'boolean')
11
- return String(data);
12
- return '';
13
- }
14
- function resolveStringBinding(value, resolveString, getValue) {
15
- if (!value)
16
- return '';
17
- if (value.path) {
18
- return dataModelValueToString(getValue(value.path));
19
- }
20
- return resolveString(value) ?? '';
21
- }
22
- function getInputType(textFieldType) {
23
- switch (textFieldType) {
24
- case 'number':
25
- return 'number';
26
- case 'date':
27
- return 'date';
28
- case 'obscured':
29
- return 'password';
30
- default:
31
- return 'text';
32
- }
33
- }
34
- export function CustomTextFieldComponent({ node, surfaceId, }) {
35
- const { theme, resolveString, setValue, getValue } = useA2UIComponent(node, surfaceId);
36
- const { label, text, textFieldType } = node.properties;
37
- const resolvedLabel = resolveStringBinding(label, resolveString, getValue);
38
- const resolvedValue = resolveStringBinding(text, resolveString, getValue);
39
- const hostStyle = node.weight === void 0 ? undefined : { '--weight': node.weight };
40
- const textFieldTheme = theme.components.TextField ?? glchatTextFieldComponents;
41
- const containerClass = classMapToString(textFieldTheme.container);
42
- const labelClass = classMapToString(textFieldTheme.label);
43
- const elementClass = classMapToString(textFieldTheme.element);
44
- const isLongText = textFieldType === 'longText';
45
- return (_jsx("div", { className: "a2ui-text-field", style: hostStyle, children: _jsxs("div", { className: containerClass, style: glchatTextFieldContainerStyles, children: [_jsx("label", { className: labelClass, style: glchatTextFieldLabelStyles, children: resolvedLabel }), isLongText ? (_jsx("div", { style: glchatTextFieldTextareaWrapperStyles, children: _jsx("textarea", { className: `glchat-a2ui-text-field ${elementClass}`.trim(), value: resolvedValue, placeholder: TEXT_FIELD_PLACEHOLDER, style: glchatTextFieldTextareaStyles, onChange: (e) => {
46
- if (text?.path) {
47
- setValue(text.path, e.target.value);
48
- }
49
- } }) })) : (_jsx("input", { className: `glchat-a2ui-text-field ${elementClass}`.trim(), type: getInputType(textFieldType), value: resolvedValue, placeholder: TEXT_FIELD_PLACEHOLDER, style: glchatTextFieldInputStyles, onChange: (e) => {
50
- if (text?.path) {
51
- setValue(text.path, e.target.value);
52
- }
53
- } }))] }) }));
54
- }
@@ -1,28 +0,0 @@
1
- import type { CSSProperties } from 'react';
2
- import type { Theme } from '@a2ui/web_core/types/types';
3
- /**
4
- * TextField structural class map.
5
- */
6
- export declare const glchatTextFieldComponents: Theme['components']['TextField'];
7
- /**
8
- * TextField container inline styles.
9
- */
10
- export declare const glchatTextFieldContainerStyles: CSSProperties;
11
- /**
12
- * Label inline styles.
13
- */
14
- export declare const glchatTextFieldLabelStyles: CSSProperties;
15
- export declare const glchatTextFieldFontStyles: CSSProperties;
16
- /**
17
- * Input inline styles aligned with the glchat-ui Input component.
18
- */
19
- export declare const glchatTextFieldInputStyles: CSSProperties;
20
- /**
21
- * Textarea wrapper.
22
- */
23
- export declare const glchatTextFieldTextareaWrapperStyles: CSSProperties;
24
- /**
25
- * Textarea inline styles aligned with glchat-ui Textarea component.
26
- */
27
- export declare const glchatTextFieldTextareaStyles: CSSProperties;
28
- //# sourceMappingURL=theme.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../src/components/a2ui/TextField/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAExD;;GAEG;AACH,eAAO,MAAM,yBAAyB,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,WAAW,CAItE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,8BAA8B,EAAE,aAK5C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,0BAA0B,EAAE,aAIxC,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,aAGvC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,0BAA0B,EAAE,aAiBxC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oCAAoC,EAAE,aAGlD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,6BAA6B,EAAE,aAqB3C,CAAC"}
@@ -1,82 +0,0 @@
1
- /**
2
- * TextField structural class map.
3
- */
4
- export const glchatTextFieldComponents = {
5
- container: {},
6
- element: {},
7
- label: {},
8
- };
9
- /**
10
- * TextField container inline styles.
11
- */
12
- export const glchatTextFieldContainerStyles = {
13
- display: 'flex',
14
- flexDirection: 'column',
15
- gap: '0.5rem',
16
- width: '100%',
17
- };
18
- /**
19
- * Label inline styles.
20
- */
21
- export const glchatTextFieldLabelStyles = {
22
- fontSize: '0.875rem',
23
- fontWeight: '600',
24
- color: 'hsl(var(--card-foreground))',
25
- };
26
- export const glchatTextFieldFontStyles = {
27
- fontFamily: 'inherit',
28
- lineHeight: '1.5',
29
- };
30
- /**
31
- * Input inline styles aligned with the glchat-ui Input component.
32
- */
33
- export const glchatTextFieldInputStyles = {
34
- ...glchatTextFieldFontStyles,
35
- height: '2.5rem',
36
- width: '100%',
37
- borderRadius: 'var(--radius-md)',
38
- borderWidth: '1px',
39
- borderStyle: 'solid',
40
- borderColor: 'hsl(var(--border))',
41
- backgroundColor: 'hsl(var(--background))',
42
- paddingTop: '0.5rem',
43
- paddingBottom: '0.5rem',
44
- paddingLeft: '0.75rem',
45
- paddingRight: '0.75rem',
46
- fontSize: '0.875rem',
47
- color: 'hsl(var(--foreground))',
48
- caretColor: 'currentColor',
49
- boxSizing: 'border-box',
50
- };
51
- /**
52
- * Textarea wrapper.
53
- */
54
- export const glchatTextFieldTextareaWrapperStyles = {
55
- position: 'relative',
56
- height: '100%',
57
- };
58
- /**
59
- * Textarea inline styles aligned with glchat-ui Textarea component.
60
- */
61
- export const glchatTextFieldTextareaStyles = {
62
- ...glchatTextFieldFontStyles,
63
- display: 'flex',
64
- minHeight: '80px',
65
- width: '100%',
66
- overflowY: 'auto',
67
- whiteSpace: 'pre-wrap',
68
- overflowWrap: 'break-word',
69
- borderRadius: 'var(--radius-md)',
70
- borderWidth: '1px',
71
- borderStyle: 'solid',
72
- borderColor: 'hsl(var(--border))',
73
- backgroundColor: 'hsl(var(--background))',
74
- paddingTop: '0.5rem',
75
- paddingBottom: '0.5rem',
76
- paddingLeft: '0.75rem',
77
- paddingRight: '0.75rem',
78
- fontSize: '0.875rem',
79
- color: 'hsl(var(--foreground))',
80
- caretColor: 'currentColor',
81
- boxSizing: 'border-box',
82
- };
@@ -1,8 +0,0 @@
1
- import type { CSSProperties } from 'react';
2
- /**
3
- * Tokenized style for GLChat Timeout countdown text.
4
- *
5
- * `--foreground` is client-overridable
6
- */
7
- export declare function getGlchatTimeoutTextStyle(): CSSProperties;
8
- //# sourceMappingURL=theme.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../src/components/a2ui/Timeout/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C;;;;GAIG;AACH,wBAAgB,yBAAyB,IAAI,aAAa,CAMzD"}
@@ -1,12 +0,0 @@
1
- /**
2
- * Tokenized style for GLChat Timeout countdown text.
3
- *
4
- * `--foreground` is client-overridable
5
- */
6
- export function getGlchatTimeoutTextStyle() {
7
- return {
8
- color: `hsl(var(--foreground) / 0.5)`,
9
- fontSize: '0.875rem',
10
- lineHeight: '1.25rem',
11
- };
12
- }
@@ -1,4 +0,0 @@
1
- import type { Theme } from '@a2ui/web_core/types/types';
2
- export declare const glchatDefaultTheme: Theme;
3
- export declare function mergeGlchatTheme(override?: Partial<Theme>): Theme;
4
- //# sourceMappingURL=theme.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../src/utils/theme.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAexD,eAAO,MAAM,kBAAkB,EAAE,KAiBhC,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,CAwEjE"}
@@ -1,92 +0,0 @@
1
- import { litTheme } from '@a2ui/react';
2
- import { glchatButtonAdditionalStyles, glchatButtonComponents, } from '../components/a2ui/Button/theme.js';
3
- import { glchatCardAdditionalStyles, glchatCardComponents } from '../components/a2ui/Card/theme.js';
4
- import { glchatCheckBoxComponents } from '../components/a2ui/CheckBox/theme.js';
5
- import { glchatMultipleChoiceComponents } from '../components/a2ui/MultipleChoice/theme.js';
6
- import { glchatDateTimeInputAdditionalStyles, glchatDateTimeInputComponents, } from '../components/a2ui/DateTimeInput/theme.js';
7
- import { glchatTextFieldComponents } from '../components/a2ui/TextField/theme.js';
8
- export const glchatDefaultTheme = {
9
- ...litTheme,
10
- components: {
11
- ...litTheme.components,
12
- Card: glchatCardComponents,
13
- Button: glchatButtonComponents,
14
- CheckBox: glchatCheckBoxComponents,
15
- TextField: glchatTextFieldComponents,
16
- DateTimeInput: glchatDateTimeInputComponents,
17
- MultipleChoice: glchatMultipleChoiceComponents,
18
- },
19
- additionalStyles: {
20
- ...litTheme.additionalStyles,
21
- Card: { ...glchatCardAdditionalStyles },
22
- Button: { ...glchatButtonAdditionalStyles },
23
- DateTimeInput: { ...glchatDateTimeInputAdditionalStyles },
24
- },
25
- };
26
- export function mergeGlchatTheme(override) {
27
- if (!override) {
28
- return glchatDefaultTheme;
29
- }
30
- const patchComponents = override.components;
31
- const patchElements = override.elements;
32
- const patchMarkdown = override.markdown;
33
- const patchAdditional = override.additionalStyles;
34
- const components = patchComponents
35
- ? {
36
- ...glchatDefaultTheme.components,
37
- ...patchComponents,
38
- Card: {
39
- ...glchatDefaultTheme.components.Card,
40
- ...patchComponents.Card,
41
- },
42
- Button: {
43
- ...glchatDefaultTheme.components.Button,
44
- ...patchComponents.Button,
45
- },
46
- CheckBox: {
47
- ...glchatDefaultTheme.components.CheckBox,
48
- ...patchComponents.CheckBox,
49
- },
50
- TextField: {
51
- ...glchatDefaultTheme.components.TextField,
52
- ...patchComponents.TextField,
53
- },
54
- MultipleChoice: {
55
- ...glchatDefaultTheme.components.MultipleChoice,
56
- ...patchComponents.MultipleChoice,
57
- },
58
- DateTimeInput: {
59
- ...glchatDefaultTheme.components.DateTimeInput,
60
- ...patchComponents.DateTimeInput,
61
- },
62
- }
63
- : glchatDefaultTheme.components;
64
- const elements = patchElements
65
- ? { ...glchatDefaultTheme.elements, ...patchElements }
66
- : glchatDefaultTheme.elements;
67
- const markdown = patchMarkdown
68
- ? { ...glchatDefaultTheme.markdown, ...patchMarkdown }
69
- : glchatDefaultTheme.markdown;
70
- const additionalStyles = patchAdditional
71
- ? {
72
- ...glchatDefaultTheme.additionalStyles,
73
- ...patchAdditional,
74
- Card: {
75
- ...glchatDefaultTheme.additionalStyles?.Card,
76
- ...patchAdditional.Card,
77
- },
78
- Button: {
79
- ...glchatDefaultTheme.additionalStyles?.Button,
80
- ...patchAdditional.Button,
81
- },
82
- }
83
- : glchatDefaultTheme.additionalStyles;
84
- return {
85
- ...glchatDefaultTheme,
86
- ...override,
87
- components,
88
- elements,
89
- markdown,
90
- additionalStyles,
91
- };
92
- }
@@ -1,55 +0,0 @@
1
- diff --git a/node_modules/@a2ui/web_core/src/v0_8/schema/common-types.d.ts b/node_modules/@a2ui/web_core/src/v0_8/schema/common-types.d.ts
2
- index 9c7381f..bdc89a0 100644
3
- --- a/node_modules/@a2ui/web_core/src/v0_8/schema/common-types.d.ts
4
- +++ b/node_modules/@a2ui/web_core/src/v0_8/schema/common-types.d.ts
5
- @@ -596,6 +596,7 @@ export declare const ButtonSchema: z.ZodObject<{
6
- }[] | undefined;
7
- }>;
8
- primary: z.ZodOptional<z.ZodBoolean>;
9
- + destructive: z.ZodOptional<z.ZodBoolean>;
10
- }, "strip", z.ZodTypeAny, {
11
- child: string;
12
- action: {
13
- @@ -611,6 +612,7 @@ export declare const ButtonSchema: z.ZodObject<{
14
- }[] | undefined;
15
- };
16
- primary?: boolean | undefined;
17
- + destructive?: boolean | undefined;
18
- }, {
19
- child: string;
20
- action: {
21
- @@ -626,6 +628,7 @@ export declare const ButtonSchema: z.ZodObject<{
22
- }[] | undefined;
23
- };
24
- primary?: boolean | undefined;
25
- + destructive?: boolean | undefined;
26
- }>;
27
- export declare const CheckboxSchema: z.ZodObject<{
28
- label: z.ZodEffects<z.ZodObject<{
29
- diff --git a/node_modules/@a2ui/web_core/src/v0_8/schema/common-types.js b/node_modules/@a2ui/web_core/src/v0_8/schema/common-types.js
30
- index 2dd98d4..54ebcef 100644
31
- --- a/node_modules/@a2ui/web_core/src/v0_8/schema/common-types.js
32
- +++ b/node_modules/@a2ui/web_core/src/v0_8/schema/common-types.js
33
- @@ -223,6 +223,10 @@ export const ButtonSchema = z.object({
34
- .boolean()
35
- .optional()
36
- .describe('Indicates if this button should be styled as the primary action.'),
37
- + destructive: z
38
- + .boolean()
39
- + .optional()
40
- + .describe('Indicates if this button should be styled as a destructive action.'),
41
- });
42
- export const CheckboxSchema = z.object({
43
- label: StringValueSchema,
44
- diff --git a/node_modules/@a2ui/web_core/src/v0_8/types/types.d.ts b/node_modules/@a2ui/web_core/src/v0_8/types/types.d.ts
45
- index d5df150..ca74153 100644
46
- --- a/node_modules/@a2ui/web_core/src/v0_8/types/types.d.ts
47
- +++ b/node_modules/@a2ui/web_core/src/v0_8/types/types.d.ts
48
- @@ -376,6 +376,7 @@ export declare interface ResolvedButton {
49
- child: AnyComponentNode;
50
- action: Button['action'];
51
- primary?: boolean;
52
- + destructive?: boolean;
53
- }
54
- export declare interface ResolvedList {
55
- children: AnyComponentNode[];