glchat-a2ui-react-renderer 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +59 -10
- package/dist/index.d.ts +8 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -8
- package/dist/src/Provider.d.ts +24 -17
- package/dist/src/Provider.d.ts.map +1 -1
- package/dist/src/Provider.js +36 -52
- package/dist/src/SurfaceRenderer.d.ts +2 -4
- package/dist/src/SurfaceRenderer.d.ts.map +1 -1
- package/dist/src/SurfaceRenderer.js +8 -21
- package/dist/src/components/a2ui/v0_8/Button/Button.d.ts +4 -0
- package/dist/src/components/a2ui/v0_8/Button/Button.d.ts.map +1 -0
- package/dist/src/components/a2ui/v0_8/Button/Button.js +18 -0
- package/dist/src/components/a2ui/v0_8/Button/theme.d.ts +4 -0
- package/dist/src/components/a2ui/v0_8/Button/theme.d.ts.map +1 -0
- package/dist/src/components/a2ui/v0_8/Button/theme.js +4 -0
- package/dist/src/components/a2ui/v0_8/ButtonAsLink/ButtonAsLink.d.ts +4 -0
- package/dist/src/components/a2ui/v0_8/ButtonAsLink/ButtonAsLink.d.ts.map +1 -0
- package/dist/src/components/a2ui/v0_8/ButtonAsLink/ButtonAsLink.js +43 -0
- package/dist/src/components/a2ui/v0_8/ButtonAsLink/theme.d.ts +7 -0
- package/dist/src/components/a2ui/v0_8/ButtonAsLink/theme.d.ts.map +1 -0
- package/dist/src/components/a2ui/v0_8/ButtonAsLink/theme.js +7 -0
- package/dist/src/components/a2ui/v0_8/Card/theme.d.ts +4 -0
- package/dist/src/components/a2ui/v0_8/Card/theme.d.ts.map +1 -0
- package/dist/src/components/a2ui/v0_8/Card/theme.js +15 -0
- package/dist/src/components/a2ui/v0_8/DateTimeInput/theme.d.ts +7 -0
- package/dist/src/components/a2ui/v0_8/DateTimeInput/theme.d.ts.map +1 -0
- package/dist/src/components/a2ui/v0_8/DateTimeInput/theme.js +9 -0
- package/dist/src/components/a2ui/v0_8/DestructiveButton/DestructiveButton.d.ts +4 -0
- package/dist/src/components/a2ui/v0_8/DestructiveButton/DestructiveButton.d.ts.map +1 -0
- package/dist/src/components/a2ui/v0_8/DestructiveButton/DestructiveButton.js +23 -0
- package/dist/src/components/a2ui/v0_8/DestructiveButton/theme.d.ts +7 -0
- package/dist/src/components/a2ui/v0_8/DestructiveButton/theme.d.ts.map +1 -0
- package/dist/src/components/a2ui/v0_8/DestructiveButton/theme.js +7 -0
- package/dist/src/components/a2ui/v0_8/MultipleChoice/MultipleChoice.d.ts +4 -0
- package/dist/src/components/a2ui/v0_8/MultipleChoice/MultipleChoice.d.ts.map +1 -0
- package/dist/src/components/a2ui/v0_8/MultipleChoice/MultipleChoice.js +72 -0
- package/dist/src/components/a2ui/v0_8/TagInput/TagInput.d.ts +4 -0
- package/dist/src/components/a2ui/v0_8/TagInput/TagInput.d.ts.map +1 -0
- package/dist/src/components/a2ui/v0_8/TagInput/TagInput.js +49 -0
- package/dist/src/components/a2ui/v0_8/TagInput/theme.d.ts +11 -0
- package/dist/src/components/a2ui/v0_8/TagInput/theme.d.ts.map +1 -0
- package/dist/src/components/a2ui/v0_8/TagInput/theme.js +9 -0
- package/dist/src/components/a2ui/v0_8/TextField/theme.d.ts +7 -0
- package/dist/src/components/a2ui/v0_8/TextField/theme.d.ts.map +1 -0
- package/dist/src/components/a2ui/v0_8/TextField/theme.js +9 -0
- package/dist/src/components/a2ui/v0_8/Timeout/Timeout.d.ts +4 -0
- package/dist/src/components/a2ui/v0_8/Timeout/Timeout.d.ts.map +1 -0
- package/dist/src/components/a2ui/v0_8/Timeout/Timeout.js +29 -0
- package/dist/src/components/a2ui/v0_8/Timeout/theme.d.ts +8 -0
- package/dist/src/components/a2ui/v0_8/Timeout/theme.d.ts.map +1 -0
- package/dist/src/components/a2ui/v0_8/Timeout/theme.js +12 -0
- package/dist/src/components/a2ui/v0_8/types.d.ts +12 -0
- package/dist/src/components/a2ui/v0_8/types.d.ts.map +1 -0
- package/dist/src/components/a2ui/v0_8/types.js +1 -0
- package/dist/src/components/a2ui/v0_9/Button/Button.d.ts.map +1 -0
- package/dist/src/components/a2ui/{Button → v0_9/Button}/Button.js +1 -1
- package/dist/src/components/a2ui/v0_9/ChoicePicker/ChoicePicker.d.ts.map +1 -0
- package/dist/src/components/a2ui/{ChoicePicker → v0_9/ChoicePicker}/ChoicePicker.js +4 -4
- package/dist/src/components/a2ui/v0_9/ChoicePicker/theme.d.ts +4 -0
- package/dist/src/components/a2ui/v0_9/ChoicePicker/theme.d.ts.map +1 -0
- package/dist/src/components/a2ui/v0_9/ChoicePicker/theme.js +11 -0
- package/dist/src/components/a2ui/{TagInput → v0_9/TagInput}/TagInput.d.ts +32 -32
- package/dist/src/components/a2ui/v0_9/TagInput/TagInput.d.ts.map +1 -0
- package/dist/src/components/a2ui/v0_9/TagInput/TagInput.js +40 -0
- package/dist/src/components/a2ui/v0_9/Timeout/Timeout.d.ts.map +1 -0
- package/dist/src/components/a2ui/{Timeout → v0_9/Timeout}/Timeout.js +1 -1
- package/dist/src/components/a2ui/v0_9/common.d.ts.map +1 -0
- package/dist/src/components/ui/Button/Button.d.ts.map +1 -1
- package/dist/src/components/ui/Button/Button.js +2 -2
- package/dist/src/components/ui/Button/ButtonAsLink.d.ts +15 -0
- package/dist/src/components/ui/Button/ButtonAsLink.d.ts.map +1 -0
- package/dist/src/components/ui/Button/ButtonAsLink.js +17 -0
- package/dist/src/components/ui/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/src/components/ui/Checkbox/Checkbox.js +2 -2
- package/dist/src/components/{a2ui/ChoicePicker → ui/CheckboxList}/CheckboxList.d.ts +3 -2
- package/dist/src/components/ui/CheckboxList/CheckboxList.d.ts.map +1 -0
- package/dist/src/components/{a2ui/ChoicePicker → ui/CheckboxList}/CheckboxList.js +16 -5
- package/dist/src/components/{a2ui/ChoicePicker → ui/CheckboxList}/theme.d.ts +0 -5
- package/dist/src/components/ui/CheckboxList/theme.d.ts.map +1 -0
- package/dist/src/components/{a2ui/ChoicePicker → ui/CheckboxList}/theme.js +0 -14
- package/dist/src/components/ui/MultiSelect/MultiSelect.d.ts.map +1 -1
- package/dist/src/components/ui/MultiSelect/MultiSelect.js +2 -3
- package/dist/src/components/ui/Select/Select.d.ts.map +1 -1
- package/dist/src/components/ui/Select/Select.js +2 -1
- package/dist/src/components/ui/TagInput/TagInput.d.ts +18 -0
- package/dist/src/components/ui/TagInput/TagInput.d.ts.map +1 -0
- package/dist/src/components/{a2ui → ui}/TagInput/TagInput.js +16 -48
- package/dist/src/components/ui/TagInput/theme.d.ts.map +1 -0
- package/dist/src/components/{a2ui → ui}/TagInput/theme.js +1 -1
- package/dist/src/utils/css.d.ts +4 -0
- package/dist/src/utils/css.d.ts.map +1 -0
- package/dist/src/utils/css.js +5 -0
- package/dist/src/utils/detectVersion.d.ts +9 -0
- package/dist/src/utils/detectVersion.d.ts.map +1 -0
- package/dist/src/utils/detectVersion.js +29 -0
- package/dist/src/utils/href.d.ts +11 -0
- package/dist/src/utils/href.d.ts.map +1 -0
- package/dist/src/utils/href.js +34 -0
- package/dist/src/v0_8/Provider.d.ts +17 -0
- package/dist/src/v0_8/Provider.d.ts.map +1 -0
- package/dist/src/v0_8/Provider.js +59 -0
- package/dist/src/v0_8/SurfaceRenderer.d.ts +3 -0
- package/dist/src/v0_8/SurfaceRenderer.d.ts.map +1 -0
- package/dist/src/v0_8/SurfaceRenderer.js +21 -0
- package/dist/src/v0_8/registry.d.ts +12 -0
- package/dist/src/v0_8/registry.d.ts.map +1 -0
- package/dist/src/v0_8/registry.js +35 -0
- package/dist/src/v0_8/theme.d.ts +11 -0
- package/dist/src/v0_8/theme.d.ts.map +1 -0
- package/dist/src/v0_8/theme.js +77 -0
- package/dist/src/v0_9/Provider.d.ts +16 -0
- package/dist/src/v0_9/Provider.d.ts.map +1 -0
- package/dist/src/v0_9/Provider.js +65 -0
- package/dist/src/v0_9/SurfaceRenderer.d.ts +3 -0
- package/dist/src/v0_9/SurfaceRenderer.d.ts.map +1 -0
- package/dist/src/v0_9/SurfaceRenderer.js +21 -0
- package/dist/src/{utils → v0_9}/catalog.d.ts +1 -2
- package/dist/src/v0_9/catalog.d.ts.map +1 -0
- package/dist/src/{utils → v0_9}/catalog.js +5 -6
- package/dist/src/v0_9/useSurfaces.d.ts.map +1 -0
- package/json/README.md +24 -42
- package/json/v0_8/a2ui-sample-messages.json +2024 -0
- package/json/v0_8/glchat_standard_catalog_definition.json +870 -0
- package/json/{a2ui-sample-messages.json → v0_9/a2ui-sample-messages.json} +12 -2
- package/json/{glchat_standard_catalog_definition.json → v0_9/glchat_standard_catalog_definition.json} +286 -68
- package/package.json +4 -5
- package/styles/globals.css +157 -68
- package/dist/src/components/a2ui/Button/Button.d.ts.map +0 -1
- package/dist/src/components/a2ui/ChoicePicker/CheckboxList.d.ts.map +0 -1
- package/dist/src/components/a2ui/ChoicePicker/ChoicePicker.d.ts.map +0 -1
- package/dist/src/components/a2ui/ChoicePicker/theme.d.ts.map +0 -1
- package/dist/src/components/a2ui/TagInput/TagInput.d.ts.map +0 -1
- package/dist/src/components/a2ui/TagInput/theme.d.ts.map +0 -1
- package/dist/src/components/a2ui/Timeout/Timeout.d.ts.map +0 -1
- package/dist/src/components/a2ui/common.d.ts.map +0 -1
- package/dist/src/components/ui/Checkbox/theme.d.ts +0 -5
- package/dist/src/components/ui/Checkbox/theme.d.ts.map +0 -1
- package/dist/src/components/ui/Checkbox/theme.js +0 -26
- package/dist/src/utils/catalog.d.ts.map +0 -1
- package/dist/src/utils/useSurfaces.d.ts.map +0 -1
- /package/dist/src/components/a2ui/{Button → v0_9/Button}/Button.d.ts +0 -0
- /package/dist/src/components/a2ui/{ChoicePicker → v0_9/ChoicePicker}/ChoicePicker.d.ts +0 -0
- /package/dist/src/components/a2ui/{Timeout → v0_9/Timeout}/Timeout.d.ts +0 -0
- /package/dist/src/components/a2ui/{common.d.ts → v0_9/common.d.ts} +0 -0
- /package/dist/src/components/a2ui/{common.js → v0_9/common.js} +0 -0
- /package/dist/src/components/{a2ui → ui}/TagInput/theme.d.ts +0 -0
- /package/dist/src/{utils → v0_9}/useSurfaces.d.ts +0 -0
- /package/dist/src/{utils → v0_9}/useSurfaces.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../../src/components/a2ui/v0_8/DestructiveButton/theme.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,sBAAsB,GAAG;IACnC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC,CAAC;AAEF,8EAA8E;AAC9E,eAAO,MAAM,2BAA2B,EAAE,sBAKzC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type A2UIComponentProps } from '@a2ui/react/v0_8';
|
|
2
|
+
import type { MultipleChoiceNode } from '@a2ui/web_core/v0_8';
|
|
3
|
+
export declare function CustomMultipleChoiceComponent({ node, surfaceId, }: Readonly<A2UIComponentProps<MultipleChoiceNode>>): import("react").JSX.Element;
|
|
4
|
+
//# sourceMappingURL=MultipleChoice.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MultipleChoice.d.ts","sourceRoot":"","sources":["../../../../../../src/components/a2ui/v0_8/MultipleChoice/MultipleChoice.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAoG9D,wBAAgB,6BAA6B,CAAC,EAC5C,IAAI,EACJ,SAAS,GACV,EAAE,QAAQ,CAAC,kBAAkB,CAAC,kBAAkB,CAAC,CAAC,+BAsFlD"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { classMapToString, useA2UIComponent, } from '@a2ui/react/v0_8';
|
|
4
|
+
import { useCallback, useMemo } from 'react';
|
|
5
|
+
import { MultiSelect } from '../../../../components/ui/MultiSelect/MultiSelect.js';
|
|
6
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, } from '../../../../components/ui/Select/Select.js';
|
|
7
|
+
import { selectTriggerLabelStyles, selectTriggerPlaceholderStyles, } from '../../../../components/ui/Select/theme.js';
|
|
8
|
+
import { cn } from '../../../../utils/css.js';
|
|
9
|
+
import { CheckboxList } from '../../../../components/ui/CheckboxList/CheckboxList.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
|
+
...selectTriggerLabelStyles,
|
|
35
|
+
...(selectedLabel ? undefined : selectTriggerPlaceholderStyles),
|
|
36
|
+
}), [selectedLabel]);
|
|
37
|
+
return (_jsxs(Select, { value: value, onValueChange: onValueChange, children: [_jsx(SelectTrigger, { className: cn('glchat-a2ui-select-trigger', elementClass), "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;
|
|
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
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type A2UIComponentProps } from '@a2ui/react/v0_8';
|
|
2
|
+
import type { CustomNode } from '@a2ui/web_core/v0_8';
|
|
3
|
+
export declare function CustomTagInputComponent({ node, surfaceId, }: Readonly<A2UIComponentProps<CustomNode>>): import("react").JSX.Element;
|
|
4
|
+
//# sourceMappingURL=TagInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TagInput.d.ts","sourceRoot":"","sources":["../../../../../../src/components/a2ui/v0_8/TagInput/TagInput.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,kBAAkB,EAGxB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AA0CtD,wBAAgB,uBAAuB,CAAC,EACtC,IAAI,EACJ,SAAS,GACV,EAAE,QAAQ,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC,+BA6D1C"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { classMapToString, useA2UIComponent, } from '@a2ui/react/v0_8';
|
|
4
|
+
import { useCallback, useMemo } from 'react';
|
|
5
|
+
import { TagInput } from '../../../../components/ui/TagInput/TagInput.js';
|
|
6
|
+
import { components } from './theme.js';
|
|
7
|
+
function getSelectedValues(values, getValue) {
|
|
8
|
+
if (values?.path) {
|
|
9
|
+
const raw = getValue(values.path);
|
|
10
|
+
if (Array.isArray(raw)) {
|
|
11
|
+
return raw.filter((item) => typeof item === 'string');
|
|
12
|
+
}
|
|
13
|
+
return [];
|
|
14
|
+
}
|
|
15
|
+
return values?.literalArray ?? [];
|
|
16
|
+
}
|
|
17
|
+
function resolveStringBinding(value, resolveString, getValue) {
|
|
18
|
+
if (!value)
|
|
19
|
+
return '';
|
|
20
|
+
if (value.path) {
|
|
21
|
+
const raw = getValue(value.path);
|
|
22
|
+
if (raw == null)
|
|
23
|
+
return '';
|
|
24
|
+
if (typeof raw === 'string')
|
|
25
|
+
return raw;
|
|
26
|
+
if (typeof raw === 'number' || typeof raw === 'boolean')
|
|
27
|
+
return String(raw);
|
|
28
|
+
return '';
|
|
29
|
+
}
|
|
30
|
+
return resolveString(value) ?? '';
|
|
31
|
+
}
|
|
32
|
+
export function CustomTagInputComponent({ node, surfaceId, }) {
|
|
33
|
+
const { theme, resolveString, resolveBoolean, setValue, getValue } = useA2UIComponent(node, surfaceId);
|
|
34
|
+
const props = node.properties;
|
|
35
|
+
const valuesBinding = props.values;
|
|
36
|
+
const valuesPath = valuesBinding?.path;
|
|
37
|
+
const tags = useMemo(() => getSelectedValues(valuesBinding, getValue), [getValue, valuesBinding]);
|
|
38
|
+
const label = resolveStringBinding(props.label, resolveString, getValue);
|
|
39
|
+
const placeholder = resolveStringBinding(props.placeholder, resolveString, getValue);
|
|
40
|
+
const validationErrorMessage = resolveStringBinding(props.validationErrorMessage, resolveString, getValue);
|
|
41
|
+
const handleValueChange = useCallback((nextTags) => {
|
|
42
|
+
if (valuesPath) {
|
|
43
|
+
setValue(valuesPath, nextTags);
|
|
44
|
+
}
|
|
45
|
+
}, [setValue, valuesPath]);
|
|
46
|
+
const hostStyle = node.weight === void 0 ? undefined : { '--weight': node.weight };
|
|
47
|
+
const tagInputTheme = theme.components.TagInput ?? components;
|
|
48
|
+
return (_jsx(TagInput, { value: tags, onValueChange: handleValueChange, label: label, placeholder: placeholder, disabled: resolveBoolean(props.disabled) ?? false, disableTextInput: props.disableTextInput === true, validationRegexp: typeof props.validationRegexp === 'string' ? props.validationRegexp : undefined, validationErrorMessage: validationErrorMessage, style: hostStyle, containerClassName: classMapToString(tagInputTheme.container), labelClassName: classMapToString(tagInputTheme.label), fieldClassName: classMapToString(tagInputTheme.element) }));
|
|
49
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type TagInputTheme = {
|
|
2
|
+
container: Record<string, boolean>;
|
|
3
|
+
element: Record<string, boolean>;
|
|
4
|
+
label: Record<string, boolean>;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* TagInput structural class map for the v0.8 A2UI theme.
|
|
8
|
+
* Visual styles live in `@/components/ui/TagInput/theme`.
|
|
9
|
+
*/
|
|
10
|
+
export declare const components: TagInputTheme;
|
|
11
|
+
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../../src/components/a2ui/v0_8/TagInput/theme.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG;IAC1B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,UAAU,EAAE,aAIxB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Theme } from '@a2ui/web_core/v0_8';
|
|
2
|
+
/**
|
|
3
|
+
* Empty maps clear litTheme utility classes (e.g. horizontal flex).
|
|
4
|
+
* Visual styles live in styles/globals.css under `.a2ui-textfield`.
|
|
5
|
+
*/
|
|
6
|
+
export declare const textFieldComponents: Theme['components']['TextField'];
|
|
7
|
+
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../../src/components/a2ui/v0_8/TextField/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEjD;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,WAAW,CAIhE,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type A2UIComponentProps } from '@a2ui/react/v0_8';
|
|
2
|
+
import type { CustomNode } from '@a2ui/web_core/v0_8';
|
|
3
|
+
export declare function CustomTimeoutComponent({ node, surfaceId, }: Readonly<A2UIComponentProps<CustomNode>>): import("react").JSX.Element;
|
|
4
|
+
//# sourceMappingURL=Timeout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Timeout.d.ts","sourceRoot":"","sources":["../../../../../../src/components/a2ui/v0_8/Timeout/Timeout.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,kBAAkB,EAExB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAMtD,wBAAgB,sBAAsB,CAAC,EACrC,IAAI,EACJ,SAAS,GACV,EAAE,QAAQ,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC,+BAuC1C"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { classMapToString, useA2UIComponent, } from '@a2ui/react/v0_8';
|
|
3
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
4
|
+
import { getGlchatTimeoutTextStyle } from './theme.js';
|
|
5
|
+
import { formatAsHhMmSs, getRemainingSeconds } from '../../../../utils/time.js';
|
|
6
|
+
export function CustomTimeoutComponent({ node, surfaceId, }) {
|
|
7
|
+
const { resolveString, theme } = useA2UIComponent(node, surfaceId);
|
|
8
|
+
const props = node.properties;
|
|
9
|
+
const resolvedTargetTimeUtcString = useMemo(() => {
|
|
10
|
+
const raw = props.targetTimeUtc;
|
|
11
|
+
if (!raw)
|
|
12
|
+
return '';
|
|
13
|
+
return String(resolveString(raw) ?? '');
|
|
14
|
+
}, [props.targetTimeUtc, resolveString]);
|
|
15
|
+
const [remaining, setRemaining] = useState(() => getRemainingSeconds(resolvedTargetTimeUtcString));
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
// eslint-disable-next-line react-hooks/set-state-in-effect -- countdown reset when target changes
|
|
18
|
+
setRemaining(getRemainingSeconds(resolvedTargetTimeUtcString));
|
|
19
|
+
if (!resolvedTargetTimeUtcString)
|
|
20
|
+
return;
|
|
21
|
+
const t = setInterval(() => {
|
|
22
|
+
setRemaining(getRemainingSeconds(resolvedTargetTimeUtcString));
|
|
23
|
+
}, 1000);
|
|
24
|
+
return () => clearInterval(t);
|
|
25
|
+
}, [resolvedTargetTimeUtcString]);
|
|
26
|
+
const hostStyle = node.weight === void 0 ? undefined : { '--weight': node.weight };
|
|
27
|
+
const textStyle = getGlchatTimeoutTextStyle();
|
|
28
|
+
return (_jsx("div", { className: "a2ui-text", style: hostStyle, children: _jsx("section", { className: classMapToString(theme.components.Text.all), style: textStyle, children: _jsx("p", { children: formatAsHhMmSs(remaining) }) }) }));
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../../src/components/a2ui/v0_8/Timeout/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C;;;;GAIG;AACH,wBAAgB,yBAAyB,IAAI,aAAa,CAMzD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Theme } from '@a2ui/web_core/v0_8';
|
|
2
|
+
import type { ButtonAsLinkTheme } from './ButtonAsLink/theme.js';
|
|
3
|
+
import type { DestructiveButtonTheme } from './DestructiveButton/theme.js';
|
|
4
|
+
export type ExtendedAdditionalStyles = NonNullable<Theme['additionalStyles']> & {
|
|
5
|
+
DestructiveButton?: Record<string, string>;
|
|
6
|
+
ButtonAsLink?: Record<string, string>;
|
|
7
|
+
};
|
|
8
|
+
export type ExtendedComponents = Theme['components'] & {
|
|
9
|
+
DestructiveButton?: DestructiveButtonTheme;
|
|
10
|
+
ButtonAsLink?: ButtonAsLinkTheme;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/components/a2ui/v0_8/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEjD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAE3E,MAAM,MAAM,wBAAwB,GAAG,WAAW,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,GAAG;IAC9E,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3C,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC,YAAY,CAAC,GAAG;IACrD,iBAAiB,CAAC,EAAE,sBAAsB,CAAC;IAC3C,YAAY,CAAC,EAAE,iBAAiB,CAAC;CAClC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../../../src/components/a2ui/v0_9/Button/Button.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;8BAqC4vsE,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;;;;CA1Bjx7E,CAAC;AASF;;GAEG;AACH,eAAO,MAAM,qBAAqB,yDAajC,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { createComponentImplementation } from '@a2ui/react/v0_9';
|
|
4
4
|
import { ButtonApi } from '@a2ui/web_core/v0_9/basic_catalog';
|
|
5
5
|
import { z } from 'zod';
|
|
6
|
-
import { Button } from '
|
|
6
|
+
import { Button } from '../../../../components/ui/Button/Button.js';
|
|
7
7
|
import { getWeightStyle } from '../common.js';
|
|
8
8
|
/**
|
|
9
9
|
* GLChat Button schema — upstream `ButtonApi` with an extra `destructive` variant.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChoicePicker.d.ts","sourceRoot":"","sources":["../../../../../../src/components/a2ui/v0_9/ChoicePicker/ChoicePicker.tsx"],"names":[],"mappings":"AA6DA;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,yDA6EvC,CAAC"}
|
|
@@ -3,11 +3,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { createComponentImplementation } from '@a2ui/react/v0_9';
|
|
4
4
|
import { ChoicePickerApi } from '@a2ui/web_core/v0_9/basic_catalog';
|
|
5
5
|
import { useCallback, useMemo } from 'react';
|
|
6
|
-
import { MultiSelect } from '
|
|
7
|
-
import { Select, SelectContent, SelectItem, SelectTrigger } from '
|
|
8
|
-
import { selectTriggerLabelStyles, selectTriggerPlaceholderStyles, } from '
|
|
6
|
+
import { MultiSelect } from '../../../../components/ui/MultiSelect/MultiSelect.js';
|
|
7
|
+
import { Select, SelectContent, SelectItem, SelectTrigger } from '../../../../components/ui/Select/Select.js';
|
|
8
|
+
import { selectTriggerLabelStyles, selectTriggerPlaceholderStyles, } from '../../../../components/ui/Select/theme.js';
|
|
9
9
|
import { getWeightStyle } from '../common.js';
|
|
10
|
-
import { CheckboxList } from '
|
|
10
|
+
import { CheckboxList } from '../../../../components/ui/CheckboxList/CheckboxList.js';
|
|
11
11
|
import { choicePickerContainerStyles, choicePickerLabelStyles } from './theme.js';
|
|
12
12
|
function SingleSelectChips({ options, value, onValueChange, }) {
|
|
13
13
|
const selectedLabel = useMemo(() => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../../src/components/a2ui/v0_9/ChoicePicker/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,eAAO,MAAM,2BAA2B,EAAE,aAKzC,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,aAIrC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const choicePickerContainerStyles = {
|
|
2
|
+
display: 'flex',
|
|
3
|
+
flexDirection: 'column',
|
|
4
|
+
gap: '0.5rem',
|
|
5
|
+
width: '100%',
|
|
6
|
+
};
|
|
7
|
+
export const choicePickerLabelStyles = {
|
|
8
|
+
fontSize: '0.875rem',
|
|
9
|
+
fontWeight: 600,
|
|
10
|
+
color: 'hsl(var(--card-foreground))',
|
|
11
|
+
};
|
|
@@ -190,22 +190,6 @@ export declare const TagInputApi: {
|
|
|
190
190
|
returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
|
|
191
191
|
} | undefined;
|
|
192
192
|
weight?: number | undefined;
|
|
193
|
-
accessibility?: {
|
|
194
|
-
description?: string | {
|
|
195
|
-
path: string;
|
|
196
|
-
} | {
|
|
197
|
-
call: string;
|
|
198
|
-
args: Record<string, any>;
|
|
199
|
-
returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
|
|
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";
|
|
207
|
-
} | undefined;
|
|
208
|
-
} | undefined;
|
|
209
193
|
placeholder?: string | {
|
|
210
194
|
path: string;
|
|
211
195
|
} | {
|
|
@@ -229,6 +213,22 @@ export declare const TagInputApi: {
|
|
|
229
213
|
args: Record<string, any>;
|
|
230
214
|
returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
|
|
231
215
|
} | undefined;
|
|
216
|
+
accessibility?: {
|
|
217
|
+
description?: string | {
|
|
218
|
+
path: string;
|
|
219
|
+
} | {
|
|
220
|
+
call: string;
|
|
221
|
+
args: Record<string, any>;
|
|
222
|
+
returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
|
|
223
|
+
} | undefined;
|
|
224
|
+
label?: string | {
|
|
225
|
+
path: string;
|
|
226
|
+
} | {
|
|
227
|
+
call: string;
|
|
228
|
+
args: Record<string, any>;
|
|
229
|
+
returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
|
|
230
|
+
} | undefined;
|
|
231
|
+
} | undefined;
|
|
232
232
|
}, {
|
|
233
233
|
value: string[] | {
|
|
234
234
|
path: string;
|
|
@@ -245,22 +245,6 @@ export declare const TagInputApi: {
|
|
|
245
245
|
returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
|
|
246
246
|
} | undefined;
|
|
247
247
|
weight?: number | undefined;
|
|
248
|
-
accessibility?: {
|
|
249
|
-
description?: string | {
|
|
250
|
-
path: string;
|
|
251
|
-
} | {
|
|
252
|
-
call: string;
|
|
253
|
-
args: Record<string, any>;
|
|
254
|
-
returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
|
|
255
|
-
} | undefined;
|
|
256
|
-
label?: string | {
|
|
257
|
-
path: string;
|
|
258
|
-
} | {
|
|
259
|
-
call: string;
|
|
260
|
-
args: Record<string, any>;
|
|
261
|
-
returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
|
|
262
|
-
} | undefined;
|
|
263
|
-
} | undefined;
|
|
264
248
|
placeholder?: string | {
|
|
265
249
|
path: string;
|
|
266
250
|
} | {
|
|
@@ -284,6 +268,22 @@ export declare const TagInputApi: {
|
|
|
284
268
|
args: Record<string, any>;
|
|
285
269
|
returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
|
|
286
270
|
} | undefined;
|
|
271
|
+
accessibility?: {
|
|
272
|
+
description?: string | {
|
|
273
|
+
path: string;
|
|
274
|
+
} | {
|
|
275
|
+
call: string;
|
|
276
|
+
args: Record<string, any>;
|
|
277
|
+
returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
|
|
278
|
+
} | undefined;
|
|
279
|
+
label?: string | {
|
|
280
|
+
path: string;
|
|
281
|
+
} | {
|
|
282
|
+
call: string;
|
|
283
|
+
args: Record<string, any>;
|
|
284
|
+
returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
|
|
285
|
+
} | undefined;
|
|
286
|
+
} | undefined;
|
|
287
287
|
}>;
|
|
288
288
|
};
|
|
289
289
|
export declare const GlchatTagInputComponent: import("@a2ui/react/v0_9").ReactComponentImplementation;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TagInput.d.ts","sourceRoot":"","sources":["../../../../../../src/components/a2ui/v0_9/TagInput/TagInput.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB;;;GAGG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAiEmrW,CAAC;;;;;;;;;;;;;;;;;;;0BAAivB,CAAC;;;;;;;;;;;;;;;;;;;;;;;0BAA2sB,CAAC;;;;;;;0BAA0O,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAA5O,CAAC;;;;;;;0BAA0O,CAAC;;;;CAxBp3Z,CAAC;AAEF,eAAO,MAAM,uBAAuB,yDAqBlC,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createComponentImplementation } from '@a2ui/react/v0_9';
|
|
4
|
+
import { DynamicBooleanSchema, DynamicStringListSchema, DynamicStringSchema, } from '@a2ui/web_core/v0_9';
|
|
5
|
+
import { useCallback } from 'react';
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
import { TagInput } from '../../../../components/ui/TagInput/TagInput.js';
|
|
8
|
+
import { CommonProps, describeDynamic, getWeightStyle } from '../common.js';
|
|
9
|
+
/**
|
|
10
|
+
* Tag input field for adding and removing string tags (GLChat extension).
|
|
11
|
+
* Binds the selected tags to a string array in the data model via `value`.
|
|
12
|
+
*/
|
|
13
|
+
export const TagInputApi = {
|
|
14
|
+
name: 'TagInput',
|
|
15
|
+
schema: z
|
|
16
|
+
.object({
|
|
17
|
+
...CommonProps,
|
|
18
|
+
label: describeDynamic(DynamicStringSchema, 'DynamicString', 'The text label for the field.').optional(),
|
|
19
|
+
value: describeDynamic(DynamicStringListSchema, 'DynamicStringList', 'The list of current tags. Should be bound to a string array in the data model.'),
|
|
20
|
+
placeholder: describeDynamic(DynamicStringSchema, 'DynamicString', 'Placeholder text shown when there are no tags.').optional(),
|
|
21
|
+
disabled: describeDynamic(DynamicBooleanSchema, 'DynamicBoolean', 'If true, the input is disabled.').optional(),
|
|
22
|
+
disableTextInput: z
|
|
23
|
+
.boolean()
|
|
24
|
+
.describe('If true, hides the text input and only displays existing tags.')
|
|
25
|
+
.optional(),
|
|
26
|
+
validationRegexp: z
|
|
27
|
+
.string()
|
|
28
|
+
.describe('A regular expression used to validate each tag before it is added.')
|
|
29
|
+
.optional(),
|
|
30
|
+
validationErrorMessage: describeDynamic(DynamicStringSchema, 'DynamicString', 'The error message shown when a tag fails validation.').optional(),
|
|
31
|
+
})
|
|
32
|
+
.strict()
|
|
33
|
+
.describe('A tag input field for adding and removing string tags.'),
|
|
34
|
+
};
|
|
35
|
+
export const GlchatTagInputComponent = createComponentImplementation(TagInputApi, ({ props }) => {
|
|
36
|
+
const handleValueChange = useCallback((nextTags) => {
|
|
37
|
+
props.setValue(nextTags);
|
|
38
|
+
}, [props]);
|
|
39
|
+
return (_jsx(TagInput, { value: props.value, onValueChange: handleValueChange, label: props.label, placeholder: props.placeholder, disabled: props.disabled === true, disableTextInput: props.disableTextInput === true, validationRegexp: props.validationRegexp, validationErrorMessage: props.validationErrorMessage, style: getWeightStyle(props.weight) }));
|
|
40
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Timeout.d.ts","sourceRoot":"","sources":["../../../../../../src/components/a2ui/v0_9/Timeout/Timeout.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB;;;GAGG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAgDg2X,CAAC;;;;;;;;;;;;;;;;;;;0BAAivB,CAAC;;;;;;;;;;;;;;;;;;;;;;;0BAA2sB,CAAC;;;;;;;0BAA0O,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAA5O,CAAC;;;;;;;0BAA0O,CAAC;;;;CA/Bhib,CAAC;AAQF,eAAO,MAAM,sBAAsB,yDAsBjC,CAAC"}
|
|
@@ -4,7 +4,7 @@ import { createComponentImplementation } from '@a2ui/react/v0_9';
|
|
|
4
4
|
import { DynamicStringSchema } from '@a2ui/web_core/v0_9';
|
|
5
5
|
import { useEffect, useState } from 'react';
|
|
6
6
|
import { z } from 'zod';
|
|
7
|
-
import { formatAsHhMmSs, getRemainingSeconds } from '
|
|
7
|
+
import { formatAsHhMmSs, getRemainingSeconds } from '../../../../utils/time.js';
|
|
8
8
|
import { CommonProps, describeDynamic, getWeightStyle } from '../common.js';
|
|
9
9
|
/**
|
|
10
10
|
* Countdown to a target UTC time (GLChat extension). Displays the remaining
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../../src/components/a2ui/v0_9/common.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,CAAC,EAAE,KAAK,UAAU,EAAE,MAAM,KAAK,CAAC;AAEzC;;;GAGG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;sBAsBylZ,CAAC;;;;;;;;;;;;;;;;;;;sBAAivB,CAAC;;;;;;;;;;;;;;;;;;;;;;;sBAA2sB,CAAC;;;;;;;sBAA0O,CAAC;;;;CAnB1xc,CAAC;AAEF;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,CAGpF;AAED,8FAA8F;AAC9F,wBAAgB,eAAe,CAAC,CAAC,SAAS,UAAU,EAClD,MAAM,EAAE,CAAC,EACT,GAAG,EAAE,MAAM,EACX,WAAW,EAAE,MAAM,GAClB,CAAC,CAEH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/Button/Button.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/Button/Button.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAI5E,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,GAAG,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC,CAAC;AAa3D,eAAO,MAAM,MAAM;cAjBP,aAAa;gBACX,MAAM;YACV,aAAa;eACV,SAAS;8GA6BpB,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
|
+
import { cn } from '../../../utils/css.js';
|
|
4
5
|
import { buttonBaseStyles, getButtonVariantStyles, } from './theme.js';
|
|
5
6
|
function mergeStyles(variant, style) {
|
|
6
7
|
return {
|
|
@@ -10,7 +11,6 @@ function mergeStyles(variant, style) {
|
|
|
10
11
|
};
|
|
11
12
|
}
|
|
12
13
|
export const Button = forwardRef(function Button({ variant = 'outline', className, style, children, type = 'button', ...props }, ref) {
|
|
13
|
-
|
|
14
|
-
return (_jsx("button", { ref: ref, type: type, className: buttonClassName, style: mergeStyles(variant, style), ...props, children: children }));
|
|
14
|
+
return (_jsx("button", { ref: ref, type: type, className: cn('glchat-a2ui-button', className), style: mergeStyles(variant, style), ...props, children: children }));
|
|
15
15
|
});
|
|
16
16
|
Button.displayName = 'Button';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { AnchorHTMLAttributes, CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import { type ButtonVariant } from './theme.js';
|
|
3
|
+
export type ButtonAsLinkProps = {
|
|
4
|
+
variant?: ButtonVariant;
|
|
5
|
+
className?: string;
|
|
6
|
+
style?: CSSProperties;
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
} & Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'style'>;
|
|
9
|
+
export declare const ButtonAsLink: import("react").ForwardRefExoticComponent<{
|
|
10
|
+
variant?: ButtonVariant;
|
|
11
|
+
className?: string;
|
|
12
|
+
style?: CSSProperties;
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
} & Omit<AnchorHTMLAttributes<HTMLAnchorElement>, "style"> & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
15
|
+
//# sourceMappingURL=ButtonAsLink.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonAsLink.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/Button/ButtonAsLink.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAI5E,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,GAAG,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC,CAAC;AAc3D,eAAO,MAAM,YAAY;cAlBb,aAAa;gBACX,MAAM;YACV,aAAa;eACV,SAAS;8GAkCrB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import { cn } from '../../../utils/css.js';
|
|
5
|
+
import { buttonBaseStyles, getButtonVariantStyles, } from './theme.js';
|
|
6
|
+
function mergeStyles(variant, style) {
|
|
7
|
+
return {
|
|
8
|
+
textDecoration: 'none',
|
|
9
|
+
...buttonBaseStyles,
|
|
10
|
+
...getButtonVariantStyles(variant),
|
|
11
|
+
...style,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export const ButtonAsLink = forwardRef(function ButtonAsLink({ variant = 'outline', className, style, children, href, target, rel, ...props }, ref) {
|
|
15
|
+
return (_jsx("a", { ref: ref, href: href, className: cn('glchat-a2ui-button', className), style: mergeStyles(variant, style), ...props, target: target, rel: target === '_blank' ? (rel ?? 'noopener noreferrer') : rel, children: children }));
|
|
16
|
+
});
|
|
17
|
+
ButtonAsLink.displayName = 'ButtonAsLink';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/Checkbox/Checkbox.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,iBAAiB,MAAM,0BAA0B,CAAC;AAE9D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/Checkbox/Checkbox.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,iBAAiB,MAAM,0BAA0B,CAAC;AAE9D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAQ3C,QAAA,MAAM,QAAQ;YAHJ,aAAa;2CAiBrB,CAAC;AAGH,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
4
4
|
import { Check } from 'lucide-react';
|
|
5
5
|
import * as React from 'react';
|
|
6
|
-
import {
|
|
7
|
-
const Checkbox = React.forwardRef(({ className, style, ...props }, ref) => (_jsx(CheckboxPrimitive.Root, { ref: ref, className:
|
|
6
|
+
import { cn } from '../../../utils/css.js';
|
|
7
|
+
const Checkbox = React.forwardRef(({ className, style, ...props }, ref) => (_jsx(CheckboxPrimitive.Root, { ref: ref, className: cn('glchat-a2ui-checkbox', className), style: style, ...props, children: _jsx(CheckboxPrimitive.Indicator, { children: _jsx(Check, { strokeWidth: 1.5, "aria-hidden": true }) }) })));
|
|
8
8
|
Checkbox.displayName = CheckboxPrimitive.Root.displayName;
|
|
9
9
|
export { Checkbox };
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import type { MultiSelectOption } from '
|
|
1
|
+
import type { MultiSelectOption } from '../../../components/ui/MultiSelect/theme.js';
|
|
2
2
|
export type CheckboxListProps = {
|
|
3
3
|
options: MultiSelectOption[];
|
|
4
4
|
value: string[];
|
|
5
5
|
onValueChange: (value: string[]) => void;
|
|
6
6
|
singleSelect: boolean;
|
|
7
|
+
maxSelections?: number;
|
|
7
8
|
filterable?: boolean;
|
|
8
9
|
className?: string;
|
|
9
10
|
};
|
|
10
|
-
export declare function CheckboxList({ options, value, onValueChange, singleSelect, filterable, className, }: Readonly<CheckboxListProps>): import("react").JSX.Element;
|
|
11
|
+
export declare function CheckboxList({ options, value, onValueChange, singleSelect, maxSelections, filterable, className, }: Readonly<CheckboxListProps>): import("react").JSX.Element;
|
|
11
12
|
//# sourceMappingURL=CheckboxList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckboxList.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/CheckboxList/CheckboxList.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAS9E,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,+BA2E7B"}
|