glchat-a2ui-react-renderer 0.2.7 → 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.
- package/README.md +223 -178
- package/dist/index.d.ts +10 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -5
- package/dist/src/Provider.d.ts +21 -14
- package/dist/src/Provider.d.ts.map +1 -1
- package/dist/src/Provider.js +56 -42
- package/dist/src/SurfaceRenderer.d.ts +17 -0
- package/dist/src/SurfaceRenderer.d.ts.map +1 -0
- package/dist/src/SurfaceRenderer.js +28 -0
- package/dist/src/components/a2ui/Button/Button.d.ts +313 -3
- package/dist/src/components/a2ui/Button/Button.d.ts.map +1 -1
- package/dist/src/components/a2ui/Button/Button.js +29 -14
- package/dist/src/components/a2ui/{MultipleChoice → ChoicePicker}/CheckboxList.d.ts +1 -2
- package/dist/src/components/a2ui/ChoicePicker/CheckboxList.d.ts.map +1 -0
- package/dist/src/components/a2ui/{MultipleChoice → ChoicePicker}/CheckboxList.js +2 -13
- package/dist/src/components/a2ui/ChoicePicker/ChoicePicker.d.ts +9 -0
- package/dist/src/components/a2ui/ChoicePicker/ChoicePicker.d.ts.map +1 -0
- package/dist/src/components/a2ui/ChoicePicker/ChoicePicker.js +54 -0
- package/dist/src/components/a2ui/ChoicePicker/theme.d.ts +10 -0
- package/dist/src/components/a2ui/ChoicePicker/theme.d.ts.map +1 -0
- package/dist/src/components/a2ui/{MultipleChoice → ChoicePicker}/theme.js +12 -9
- package/dist/src/components/a2ui/TagInput/TagInput.d.ts +289 -3
- package/dist/src/components/a2ui/TagInput/TagInput.d.ts.map +1 -1
- package/dist/src/components/a2ui/TagInput/TagInput.js +44 -54
- package/dist/src/components/a2ui/TagInput/theme.d.ts +0 -9
- package/dist/src/components/a2ui/TagInput/theme.d.ts.map +1 -1
- package/dist/src/components/a2ui/TagInput/theme.js +1 -9
- package/dist/src/components/a2ui/Timeout/Timeout.d.ts +154 -3
- package/dist/src/components/a2ui/Timeout/Timeout.d.ts.map +1 -1
- package/dist/src/components/a2ui/Timeout/Timeout.js +40 -25
- package/dist/src/components/a2ui/common.d.ts +87 -0
- package/dist/src/components/a2ui/common.d.ts.map +1 -0
- package/dist/src/components/a2ui/common.js +23 -0
- package/dist/src/components/ui/Button/theme.d.ts +1 -1
- package/dist/src/components/ui/Button/theme.d.ts.map +1 -1
- package/dist/src/components/ui/Button/theme.js +11 -0
- package/dist/src/components/ui/MultiSelect/MultiSelect.d.ts +1 -1
- package/dist/src/components/ui/MultiSelect/MultiSelect.d.ts.map +1 -1
- package/dist/src/components/ui/Select/theme.d.ts.map +1 -1
- package/dist/src/components/ui/Select/theme.js +0 -1
- package/dist/src/utils/catalog.d.ts +16 -4
- package/dist/src/utils/catalog.d.ts.map +1 -1
- package/dist/src/utils/catalog.js +32 -23
- package/dist/src/utils/useSurfaces.d.ts +9 -0
- package/dist/src/utils/useSurfaces.d.ts.map +1 -0
- package/dist/src/utils/useSurfaces.js +28 -0
- package/json/README.md +36 -49
- package/json/a2ui-sample-messages.json +170 -315
- package/json/glchat_standard_catalog_definition.json +1236 -610
- package/package.json +11 -5
- package/styles/globals.css +196 -120
- package/dist/src/AllSurfacesRenderer.d.ts +0 -14
- package/dist/src/AllSurfacesRenderer.d.ts.map +0 -1
- package/dist/src/AllSurfacesRenderer.js +0 -18
- package/dist/src/SingleSurfaceRenderer.d.ts +0 -15
- package/dist/src/SingleSurfaceRenderer.d.ts.map +0 -1
- package/dist/src/SingleSurfaceRenderer.js +0 -9
- package/dist/src/components/a2ui/Button/theme.d.ts +0 -5
- package/dist/src/components/a2ui/Button/theme.d.ts.map +0 -1
- package/dist/src/components/a2ui/Button/theme.js +0 -5
- package/dist/src/components/a2ui/ButtonAsLink/ButtonAsLink.d.ts +0 -4
- package/dist/src/components/a2ui/ButtonAsLink/ButtonAsLink.d.ts.map +0 -1
- package/dist/src/components/a2ui/ButtonAsLink/ButtonAsLink.js +0 -42
- package/dist/src/components/a2ui/ButtonAsLink/theme.d.ts +0 -8
- package/dist/src/components/a2ui/ButtonAsLink/theme.d.ts.map +0 -1
- package/dist/src/components/a2ui/ButtonAsLink/theme.js +0 -8
- package/dist/src/components/a2ui/Card/theme.d.ts +0 -4
- package/dist/src/components/a2ui/Card/theme.d.ts.map +0 -1
- package/dist/src/components/a2ui/Card/theme.js +0 -15
- package/dist/src/components/a2ui/CheckBox/theme.d.ts +0 -4
- package/dist/src/components/a2ui/CheckBox/theme.d.ts.map +0 -1
- package/dist/src/components/a2ui/CheckBox/theme.js +0 -11
- package/dist/src/components/a2ui/DateTimeInput/theme.d.ts +0 -8
- package/dist/src/components/a2ui/DateTimeInput/theme.d.ts.map +0 -1
- package/dist/src/components/a2ui/DateTimeInput/theme.js +0 -11
- package/dist/src/components/a2ui/DestructiveButton/DestructiveButton.d.ts +0 -4
- package/dist/src/components/a2ui/DestructiveButton/DestructiveButton.d.ts.map +0 -1
- package/dist/src/components/a2ui/DestructiveButton/DestructiveButton.js +0 -22
- package/dist/src/components/a2ui/DestructiveButton/theme.d.ts +0 -8
- package/dist/src/components/a2ui/DestructiveButton/theme.d.ts.map +0 -1
- package/dist/src/components/a2ui/DestructiveButton/theme.js +0 -8
- package/dist/src/components/a2ui/MultipleChoice/CheckboxList.d.ts.map +0 -1
- package/dist/src/components/a2ui/MultipleChoice/MultipleChoice.d.ts +0 -4
- package/dist/src/components/a2ui/MultipleChoice/MultipleChoice.d.ts.map +0 -1
- package/dist/src/components/a2ui/MultipleChoice/MultipleChoice.js +0 -72
- package/dist/src/components/a2ui/MultipleChoice/theme.d.ts +0 -13
- package/dist/src/components/a2ui/MultipleChoice/theme.d.ts.map +0 -1
- package/dist/src/components/a2ui/TextField/theme.d.ts +0 -4
- package/dist/src/components/a2ui/TextField/theme.d.ts.map +0 -1
- package/dist/src/components/a2ui/TextField/theme.js +0 -9
- package/dist/src/components/a2ui/Timeout/theme.d.ts +0 -8
- package/dist/src/components/a2ui/Timeout/theme.d.ts.map +0 -1
- package/dist/src/components/a2ui/Timeout/theme.js +0 -12
- package/dist/src/components/a2ui/types.d.ts +0 -12
- package/dist/src/components/a2ui/types.d.ts.map +0 -1
- package/dist/src/components/a2ui/types.js +0 -1
- package/dist/src/components/ui/Button/ButtonAsLink.d.ts +0 -15
- package/dist/src/components/ui/Button/ButtonAsLink.d.ts.map +0 -1
- package/dist/src/components/ui/Button/ButtonAsLink.js +0 -17
- package/dist/src/components/ui/TextField/theme.d.ts +0 -4
- package/dist/src/components/ui/TextField/theme.d.ts.map +0 -1
- package/dist/src/components/ui/TextField/theme.js +0 -22
- package/dist/src/utils/href.d.ts +0 -11
- package/dist/src/utils/href.d.ts.map +0 -1
- package/dist/src/utils/href.js +0 -34
- package/dist/src/utils/theme.d.ts +0 -15
- package/dist/src/utils/theme.d.ts.map +0 -1
- package/dist/src/utils/theme.js +0 -93
- package/json/glchat_server_to_client_with_catalog.json +0 -1000
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { createComponentImplementation } from '@a2ui/react/v0_9';
|
|
4
|
+
import { ChoicePickerApi } from '@a2ui/web_core/v0_9/basic_catalog';
|
|
5
|
+
import { useCallback, useMemo } from 'react';
|
|
6
|
+
import { MultiSelect } from '../../ui/MultiSelect/MultiSelect.js';
|
|
7
|
+
import { Select, SelectContent, SelectItem, SelectTrigger } from '../../ui/Select/Select.js';
|
|
8
|
+
import { selectTriggerLabelStyles, selectTriggerPlaceholderStyles, } from '../../ui/Select/theme.js';
|
|
9
|
+
import { getWeightStyle } from '../common.js';
|
|
10
|
+
import { CheckboxList } from './CheckboxList.js';
|
|
11
|
+
import { choicePickerContainerStyles, choicePickerLabelStyles } from './theme.js';
|
|
12
|
+
function SingleSelectChips({ options, value, onValueChange, }) {
|
|
13
|
+
const selectedLabel = useMemo(() => {
|
|
14
|
+
const match = options.find((opt) => opt.value === value);
|
|
15
|
+
return match?.label ?? '';
|
|
16
|
+
}, [options, value]);
|
|
17
|
+
const triggerLabelStyle = useMemo(() => ({
|
|
18
|
+
...selectTriggerLabelStyles,
|
|
19
|
+
...(selectedLabel ? undefined : selectTriggerPlaceholderStyles),
|
|
20
|
+
}), [selectedLabel]);
|
|
21
|
+
return (_jsxs(Select, { value: value, onValueChange: onValueChange, children: [_jsx(SelectTrigger, { className: "glchat-a2ui-select-trigger", "aria-label": "Select option", children: _jsx("span", { style: triggerLabelStyle, ...(selectedLabel ? {} : { 'data-placeholder': '' }), children: selectedLabel || 'Select an item' }) }), _jsx(SelectContent, { className: "glchat-a2ui-select-content", children: options.map((option) => (_jsx(SelectItem, { value: option.value, children: option.label }, option.value))) })] }));
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* GLChat-styled ChoicePicker. Overrides the basic catalog `ChoicePicker`.
|
|
25
|
+
*
|
|
26
|
+
* - `variant`: `mutuallyExclusive` (single) or `multipleSelection` (multi).
|
|
27
|
+
* - `displayStyle`: `checkbox` renders a checkbox/radio list; otherwise a
|
|
28
|
+
* GLChat select (single) or multi-select dropdown is used.
|
|
29
|
+
*/
|
|
30
|
+
export const GlchatChoicePickerComponent = createComponentImplementation(ChoicePickerApi, ({ props }) => {
|
|
31
|
+
const singleSelect = props.variant !== 'multipleSelection';
|
|
32
|
+
const filterable = props.filterable ?? false;
|
|
33
|
+
const useCheckboxes = props.displayStyle === 'checkbox';
|
|
34
|
+
const label = typeof props.label === 'string' ? props.label : '';
|
|
35
|
+
const selectedValues = useMemo(() => (Array.isArray(props.value) ? props.value : []), [props.value]);
|
|
36
|
+
const resolvedOptions = useMemo(() => (props.options ?? []).map((option) => ({
|
|
37
|
+
value: option.value,
|
|
38
|
+
label: typeof option.label === 'string' ? option.label : option.value,
|
|
39
|
+
})), [props.options]);
|
|
40
|
+
const handleSingleValueChange = useCallback((nextValue) => {
|
|
41
|
+
props.setValue([nextValue]);
|
|
42
|
+
}, [props]);
|
|
43
|
+
const handleMultiValueChange = useCallback((values) => {
|
|
44
|
+
props.setValue(values);
|
|
45
|
+
}, [props]);
|
|
46
|
+
const wrapper = (content) => (_jsx("div", { className: "a2ui-choicepicker", style: getWeightStyle(props.weight), children: _jsxs("section", { style: choicePickerContainerStyles, children: [label ? _jsx("strong", { style: choicePickerLabelStyles, children: label }) : null, content] }) }));
|
|
47
|
+
if (useCheckboxes) {
|
|
48
|
+
return wrapper(_jsx(CheckboxList, { options: resolvedOptions, value: selectedValues, onValueChange: handleMultiValueChange, singleSelect: singleSelect, filterable: filterable }));
|
|
49
|
+
}
|
|
50
|
+
if (singleSelect) {
|
|
51
|
+
return wrapper(_jsx(SingleSelectChips, { options: resolvedOptions, value: selectedValues[0] ?? '', onValueChange: handleSingleValueChange }));
|
|
52
|
+
}
|
|
53
|
+
return wrapper(_jsx(MultiSelect, { options: resolvedOptions, value: selectedValues, onValueChange: handleMultiValueChange, placeholder: "Select options", filterable: filterable }));
|
|
54
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Checkbox display style — vertical list of options.
|
|
4
|
+
*/
|
|
5
|
+
export declare const checkboxListContainerStyles: CSSProperties;
|
|
6
|
+
export declare const checkboxListItemStyles: CSSProperties;
|
|
7
|
+
export declare const checkboxListSearchStyles: CSSProperties;
|
|
8
|
+
export declare const choicePickerContainerStyles: CSSProperties;
|
|
9
|
+
export declare const choicePickerLabelStyles: CSSProperties;
|
|
10
|
+
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../src/components/a2ui/ChoicePicker/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C;;GAEG;AACH,eAAO,MAAM,2BAA2B,EAAE,aAKzC,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,aAKpC,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,aAWtC,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE,aAKzC,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,aAIrC,CAAC"}
|
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*/
|
|
4
|
-
export const multipleChoiceComponents = {
|
|
5
|
-
container: {},
|
|
6
|
-
element: {},
|
|
7
|
-
label: {},
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* Checkbox variant — vertical list of options.
|
|
2
|
+
* Checkbox display style — vertical list of options.
|
|
11
3
|
*/
|
|
12
4
|
export const checkboxListContainerStyles = {
|
|
13
5
|
display: 'flex',
|
|
@@ -33,3 +25,14 @@ export const checkboxListSearchStyles = {
|
|
|
33
25
|
color: 'hsl(var(--foreground))',
|
|
34
26
|
boxSizing: 'border-box',
|
|
35
27
|
};
|
|
28
|
+
export const choicePickerContainerStyles = {
|
|
29
|
+
display: 'flex',
|
|
30
|
+
flexDirection: 'column',
|
|
31
|
+
gap: '0.5rem',
|
|
32
|
+
width: '100%',
|
|
33
|
+
};
|
|
34
|
+
export const choicePickerLabelStyles = {
|
|
35
|
+
fontSize: '0.875rem',
|
|
36
|
+
fontWeight: 600,
|
|
37
|
+
color: 'hsl(var(--card-foreground))',
|
|
38
|
+
};
|
|
@@ -1,4 +1,290 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Tag input field for adding and removing string tags (GLChat extension).
|
|
4
|
+
* Binds the selected tags to a string array in the data model via `value`.
|
|
5
|
+
*/
|
|
6
|
+
export declare const TagInputApi: {
|
|
7
|
+
name: string;
|
|
8
|
+
schema: z.ZodObject<{
|
|
9
|
+
label: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
10
|
+
path: z.ZodString;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
path: string;
|
|
13
|
+
}, {
|
|
14
|
+
path: string;
|
|
15
|
+
}>, z.ZodObject<{
|
|
16
|
+
call: z.ZodString;
|
|
17
|
+
args: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
18
|
+
returnType: z.ZodDefault<z.ZodEnum<["string", "number", "boolean", "array", "object", "any", "void"]>>;
|
|
19
|
+
}, "strip", z.ZodTypeAny, {
|
|
20
|
+
call: string;
|
|
21
|
+
args: Record<string, any>;
|
|
22
|
+
returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
|
|
23
|
+
}, {
|
|
24
|
+
call: string;
|
|
25
|
+
args: Record<string, any>;
|
|
26
|
+
returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
|
|
27
|
+
}>]>>;
|
|
28
|
+
value: z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodObject<{
|
|
29
|
+
path: z.ZodString;
|
|
30
|
+
}, "strip", z.ZodTypeAny, {
|
|
31
|
+
path: string;
|
|
32
|
+
}, {
|
|
33
|
+
path: string;
|
|
34
|
+
}>, z.ZodObject<{
|
|
35
|
+
call: z.ZodString;
|
|
36
|
+
args: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
37
|
+
returnType: z.ZodDefault<z.ZodEnum<["string", "number", "boolean", "array", "object", "any", "void"]>>;
|
|
38
|
+
}, "strip", z.ZodTypeAny, {
|
|
39
|
+
call: string;
|
|
40
|
+
args: Record<string, any>;
|
|
41
|
+
returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
|
|
42
|
+
}, {
|
|
43
|
+
call: string;
|
|
44
|
+
args: Record<string, any>;
|
|
45
|
+
returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
|
|
46
|
+
}>]>;
|
|
47
|
+
placeholder: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
48
|
+
path: z.ZodString;
|
|
49
|
+
}, "strip", z.ZodTypeAny, {
|
|
50
|
+
path: string;
|
|
51
|
+
}, {
|
|
52
|
+
path: string;
|
|
53
|
+
}>, z.ZodObject<{
|
|
54
|
+
call: z.ZodString;
|
|
55
|
+
args: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
56
|
+
returnType: z.ZodDefault<z.ZodEnum<["string", "number", "boolean", "array", "object", "any", "void"]>>;
|
|
57
|
+
}, "strip", z.ZodTypeAny, {
|
|
58
|
+
call: string;
|
|
59
|
+
args: Record<string, any>;
|
|
60
|
+
returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
|
|
61
|
+
}, {
|
|
62
|
+
call: string;
|
|
63
|
+
args: Record<string, any>;
|
|
64
|
+
returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
|
|
65
|
+
}>]>>;
|
|
66
|
+
disabled: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
|
|
67
|
+
path: z.ZodString;
|
|
68
|
+
}, "strip", z.ZodTypeAny, {
|
|
69
|
+
path: string;
|
|
70
|
+
}, {
|
|
71
|
+
path: string;
|
|
72
|
+
}>, z.ZodObject<{
|
|
73
|
+
call: z.ZodString;
|
|
74
|
+
args: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
75
|
+
returnType: z.ZodDefault<z.ZodEnum<["string", "number", "boolean", "array", "object", "any", "void"]>>;
|
|
76
|
+
}, "strip", z.ZodTypeAny, {
|
|
77
|
+
call: string;
|
|
78
|
+
args: Record<string, any>;
|
|
79
|
+
returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
|
|
80
|
+
}, {
|
|
81
|
+
call: string;
|
|
82
|
+
args: Record<string, any>;
|
|
83
|
+
returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
|
|
84
|
+
}>]>>;
|
|
85
|
+
disableTextInput: z.ZodOptional<z.ZodBoolean>;
|
|
86
|
+
validationRegexp: z.ZodOptional<z.ZodString>;
|
|
87
|
+
validationErrorMessage: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
88
|
+
path: z.ZodString;
|
|
89
|
+
}, "strip", z.ZodTypeAny, {
|
|
90
|
+
path: string;
|
|
91
|
+
}, {
|
|
92
|
+
path: string;
|
|
93
|
+
}>, z.ZodObject<{
|
|
94
|
+
call: z.ZodString;
|
|
95
|
+
args: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
96
|
+
returnType: z.ZodDefault<z.ZodEnum<["string", "number", "boolean", "array", "object", "any", "void"]>>;
|
|
97
|
+
}, "strip", z.ZodTypeAny, {
|
|
98
|
+
call: string;
|
|
99
|
+
args: Record<string, any>;
|
|
100
|
+
returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
|
|
101
|
+
}, {
|
|
102
|
+
call: string;
|
|
103
|
+
args: Record<string, any>;
|
|
104
|
+
returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
|
|
105
|
+
}>]>>;
|
|
106
|
+
accessibility: z.ZodOptional<z.ZodObject<{
|
|
107
|
+
label: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
108
|
+
path: z.ZodString;
|
|
109
|
+
}, "strip", z.ZodTypeAny, {
|
|
110
|
+
path: string;
|
|
111
|
+
}, {
|
|
112
|
+
path: string;
|
|
113
|
+
}>, z.ZodObject<{
|
|
114
|
+
call: z.ZodString;
|
|
115
|
+
args: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
116
|
+
returnType: z.ZodDefault<z.ZodEnum<["string", "number", "boolean", "array", "object", "any", "void"]>>;
|
|
117
|
+
}, "strip", z.ZodTypeAny, {
|
|
118
|
+
call: string;
|
|
119
|
+
args: Record<string, any>;
|
|
120
|
+
returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
|
|
121
|
+
}, {
|
|
122
|
+
call: string;
|
|
123
|
+
args: Record<string, any>;
|
|
124
|
+
returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
|
|
125
|
+
}>]>>;
|
|
126
|
+
description: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
127
|
+
path: z.ZodString;
|
|
128
|
+
}, "strip", z.ZodTypeAny, {
|
|
129
|
+
path: string;
|
|
130
|
+
}, {
|
|
131
|
+
path: string;
|
|
132
|
+
}>, z.ZodObject<{
|
|
133
|
+
call: z.ZodString;
|
|
134
|
+
args: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
135
|
+
returnType: z.ZodDefault<z.ZodEnum<["string", "number", "boolean", "array", "object", "any", "void"]>>;
|
|
136
|
+
}, "strip", z.ZodTypeAny, {
|
|
137
|
+
call: string;
|
|
138
|
+
args: Record<string, any>;
|
|
139
|
+
returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
|
|
140
|
+
}, {
|
|
141
|
+
call: string;
|
|
142
|
+
args: Record<string, any>;
|
|
143
|
+
returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
|
|
144
|
+
}>]>>;
|
|
145
|
+
}, "strip", z.ZodTypeAny, {
|
|
146
|
+
description?: string | {
|
|
147
|
+
path: string;
|
|
148
|
+
} | {
|
|
149
|
+
call: string;
|
|
150
|
+
args: Record<string, any>;
|
|
151
|
+
returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
|
|
152
|
+
} | undefined;
|
|
153
|
+
label?: string | {
|
|
154
|
+
path: string;
|
|
155
|
+
} | {
|
|
156
|
+
call: string;
|
|
157
|
+
args: Record<string, any>;
|
|
158
|
+
returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
|
|
159
|
+
} | undefined;
|
|
160
|
+
}, {
|
|
161
|
+
description?: string | {
|
|
162
|
+
path: string;
|
|
163
|
+
} | {
|
|
164
|
+
call: string;
|
|
165
|
+
args: Record<string, any>;
|
|
166
|
+
returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
|
|
167
|
+
} | undefined;
|
|
168
|
+
label?: string | {
|
|
169
|
+
path: string;
|
|
170
|
+
} | {
|
|
171
|
+
call: string;
|
|
172
|
+
args: Record<string, any>;
|
|
173
|
+
returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
|
|
174
|
+
} | undefined;
|
|
175
|
+
}>>;
|
|
176
|
+
weight: z.ZodOptional<z.ZodNumber>;
|
|
177
|
+
}, "strict", z.ZodTypeAny, {
|
|
178
|
+
value: string[] | {
|
|
179
|
+
path: string;
|
|
180
|
+
} | {
|
|
181
|
+
call: string;
|
|
182
|
+
args: Record<string, any>;
|
|
183
|
+
returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
|
|
184
|
+
};
|
|
185
|
+
disabled?: boolean | {
|
|
186
|
+
path: string;
|
|
187
|
+
} | {
|
|
188
|
+
call: string;
|
|
189
|
+
args: Record<string, any>;
|
|
190
|
+
returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
|
|
191
|
+
} | undefined;
|
|
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
|
+
placeholder?: string | {
|
|
210
|
+
path: string;
|
|
211
|
+
} | {
|
|
212
|
+
call: string;
|
|
213
|
+
args: Record<string, any>;
|
|
214
|
+
returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
|
|
215
|
+
} | undefined;
|
|
216
|
+
label?: string | {
|
|
217
|
+
path: string;
|
|
218
|
+
} | {
|
|
219
|
+
call: string;
|
|
220
|
+
args: Record<string, any>;
|
|
221
|
+
returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
|
|
222
|
+
} | undefined;
|
|
223
|
+
disableTextInput?: boolean | undefined;
|
|
224
|
+
validationRegexp?: string | undefined;
|
|
225
|
+
validationErrorMessage?: string | {
|
|
226
|
+
path: string;
|
|
227
|
+
} | {
|
|
228
|
+
call: string;
|
|
229
|
+
args: Record<string, any>;
|
|
230
|
+
returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
|
|
231
|
+
} | undefined;
|
|
232
|
+
}, {
|
|
233
|
+
value: string[] | {
|
|
234
|
+
path: string;
|
|
235
|
+
} | {
|
|
236
|
+
call: string;
|
|
237
|
+
args: Record<string, any>;
|
|
238
|
+
returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
|
|
239
|
+
};
|
|
240
|
+
disabled?: boolean | {
|
|
241
|
+
path: string;
|
|
242
|
+
} | {
|
|
243
|
+
call: string;
|
|
244
|
+
args: Record<string, any>;
|
|
245
|
+
returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
|
|
246
|
+
} | undefined;
|
|
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
|
+
placeholder?: string | {
|
|
265
|
+
path: string;
|
|
266
|
+
} | {
|
|
267
|
+
call: string;
|
|
268
|
+
args: Record<string, any>;
|
|
269
|
+
returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
|
|
270
|
+
} | undefined;
|
|
271
|
+
label?: string | {
|
|
272
|
+
path: string;
|
|
273
|
+
} | {
|
|
274
|
+
call: string;
|
|
275
|
+
args: Record<string, any>;
|
|
276
|
+
returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
|
|
277
|
+
} | undefined;
|
|
278
|
+
disableTextInput?: boolean | undefined;
|
|
279
|
+
validationRegexp?: string | undefined;
|
|
280
|
+
validationErrorMessage?: string | {
|
|
281
|
+
path: string;
|
|
282
|
+
} | {
|
|
283
|
+
call: string;
|
|
284
|
+
args: Record<string, any>;
|
|
285
|
+
returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
|
|
286
|
+
} | undefined;
|
|
287
|
+
}>;
|
|
288
|
+
};
|
|
289
|
+
export declare const GlchatTagInputComponent: import("@a2ui/react/v0_9").ReactComponentImplementation;
|
|
4
290
|
//# sourceMappingURL=TagInput.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TagInput.d.ts","sourceRoot":"","sources":["../../../../../src/components/a2ui/TagInput/TagInput.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TagInput.d.ts","sourceRoot":"","sources":["../../../../../src/components/a2ui/TagInput/TagInput.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAqBxB;;;GAGG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BA4LssN,CAAC;;;;;;;;;;;;;;;;;;;0BAAivB,CAAC;;;;;;;;;;;;;;;;;;;;;;;0BAA2sB,CAAC;;;;;;;0BAA0O,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAA5O,CAAC;;;;;;;0BAA0O,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;CAvJv4Q,CAAC;AAWF,eAAO,MAAM,uBAAuB,yDA2IlC,CAAC"}
|
|
@@ -1,37 +1,41 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { createComponentImplementation } from '@a2ui/react/v0_9';
|
|
4
|
+
import { DynamicBooleanSchema, DynamicStringListSchema, DynamicStringSchema, } from '@a2ui/web_core/v0_9';
|
|
4
5
|
import { X } from 'lucide-react';
|
|
5
6
|
import { useCallback, useEffect, useId, useMemo, useState } from 'react';
|
|
7
|
+
import { z } from 'zod';
|
|
6
8
|
import { multiSelectBadgeStyles } from '../../ui/MultiSelect/theme.js';
|
|
7
|
-
import {
|
|
9
|
+
import { CommonProps, describeDynamic, getWeightStyle } from '../common.js';
|
|
10
|
+
import { a2uiContainerStyles, containerStyles, errorStyles, fieldStyles, innerBorderlessStyles, innerInvalidStyles, innerStyles, inputStyles, labelStyles, removeIconStyles, tagTextStyles, } from './theme.js';
|
|
8
11
|
const TAG_INPUT_PLACEHOLDER = 'Enter a value';
|
|
9
12
|
const TAG_INPUT_VALIDATION_ERROR = 'Please enter a valid value.';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Tag input field for adding and removing string tags (GLChat extension).
|
|
15
|
+
* Binds the selected tags to a string array in the data model via `value`.
|
|
16
|
+
*/
|
|
17
|
+
export const TagInputApi = {
|
|
18
|
+
name: 'TagInput',
|
|
19
|
+
schema: z
|
|
20
|
+
.object({
|
|
21
|
+
...CommonProps,
|
|
22
|
+
label: describeDynamic(DynamicStringSchema, 'DynamicString', 'The text label for the field.').optional(),
|
|
23
|
+
value: describeDynamic(DynamicStringListSchema, 'DynamicStringList', 'The list of current tags. Should be bound to a string array in the data model.'),
|
|
24
|
+
placeholder: describeDynamic(DynamicStringSchema, 'DynamicString', 'Placeholder text shown when there are no tags.').optional(),
|
|
25
|
+
disabled: describeDynamic(DynamicBooleanSchema, 'DynamicBoolean', 'If true, the input is disabled.').optional(),
|
|
26
|
+
disableTextInput: z
|
|
27
|
+
.boolean()
|
|
28
|
+
.describe('If true, hides the text input and only displays existing tags.')
|
|
29
|
+
.optional(),
|
|
30
|
+
validationRegexp: z
|
|
31
|
+
.string()
|
|
32
|
+
.describe('A regular expression used to validate each tag before it is added.')
|
|
33
|
+
.optional(),
|
|
34
|
+
validationErrorMessage: describeDynamic(DynamicStringSchema, 'DynamicString', 'The error message shown when a tag fails validation.').optional(),
|
|
35
|
+
})
|
|
36
|
+
.strict()
|
|
37
|
+
.describe('A tag input field for adding and removing string tags.'),
|
|
38
|
+
};
|
|
35
39
|
function isValidTag(value, validationRegexp) {
|
|
36
40
|
if (!validationRegexp)
|
|
37
41
|
return true;
|
|
@@ -42,31 +46,26 @@ function isValidTag(value, validationRegexp) {
|
|
|
42
46
|
return false;
|
|
43
47
|
}
|
|
44
48
|
}
|
|
45
|
-
export
|
|
46
|
-
const { theme, resolveString, resolveBoolean, setValue, getValue } = useA2UIComponent(node, surfaceId);
|
|
47
|
-
const props = node.properties;
|
|
48
|
-
const valuesBinding = props.values;
|
|
49
|
-
const valuesPath = valuesBinding?.path;
|
|
49
|
+
export const GlchatTagInputComponent = createComponentImplementation(TagInputApi, ({ props }) => {
|
|
50
50
|
const errorMessageId = useId();
|
|
51
|
-
const externalValues = useMemo(() =>
|
|
51
|
+
const externalValues = useMemo(() => (Array.isArray(props.value) ? props.value : []), [props.value]);
|
|
52
52
|
const [tags, setTags] = useState(externalValues);
|
|
53
53
|
const [inputValue, setInputValue] = useState('');
|
|
54
54
|
const [validationError, setValidationError] = useState(false);
|
|
55
55
|
useEffect(() => {
|
|
56
56
|
setTags(externalValues);
|
|
57
57
|
}, [externalValues]);
|
|
58
|
-
const
|
|
59
|
-
const
|
|
60
|
-
const disabled =
|
|
58
|
+
const label = typeof props.label === 'string' ? props.label : '';
|
|
59
|
+
const placeholder = (typeof props.placeholder === 'string' ? props.placeholder : '') || TAG_INPUT_PLACEHOLDER;
|
|
60
|
+
const disabled = props.disabled === true;
|
|
61
61
|
const disableTextInput = props.disableTextInput === true;
|
|
62
62
|
const validationRegexp = typeof props.validationRegexp === 'string' ? props.validationRegexp : undefined;
|
|
63
|
-
const
|
|
63
|
+
const validationErrorMessage = (typeof props.validationErrorMessage === 'string' ? props.validationErrorMessage : '') ||
|
|
64
|
+
TAG_INPUT_VALIDATION_ERROR;
|
|
64
65
|
const updateTags = useCallback((nextTags) => {
|
|
65
66
|
setTags(nextTags);
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
}, [setValue, valuesPath]);
|
|
67
|
+
props.setValue(nextTags);
|
|
68
|
+
}, [props]);
|
|
70
69
|
const addTag = useCallback(() => {
|
|
71
70
|
if (disabled || disableTextInput)
|
|
72
71
|
return;
|
|
@@ -99,22 +98,13 @@ export function CustomTagInputComponent({ node, surfaceId, }) {
|
|
|
99
98
|
updateTags(tags.filter((tag) => tag !== tagToRemove));
|
|
100
99
|
setInputValue('');
|
|
101
100
|
}, [disabled, tags, updateTags]);
|
|
102
|
-
|
|
103
|
-
const tagInputTheme = theme.components.TagInput ?? components;
|
|
104
|
-
const containerClass = classMapToString(tagInputTheme.container);
|
|
105
|
-
const elementClass = classMapToString(tagInputTheme.element);
|
|
106
|
-
const labelClass = classMapToString(tagInputTheme.label);
|
|
107
|
-
const fieldClassName = ['glchat-a2ui-tag-input', elementClass].filter(Boolean).join(' ');
|
|
108
|
-
return (_jsx("div", { className: "a2ui-tag-input", style: hostStyle, children: _jsxs("div", { className: containerClass, style: a2uiContainerStyles, children: [resolvedLabel ? (_jsx("label", { className: labelClass, style: labelStyles, children: resolvedLabel })) : null, _jsxs("div", { className: fieldClassName, style: fieldStyles, children: [_jsx("div", { style: containerStyles, children: _jsxs("div", { style: {
|
|
101
|
+
return (_jsx("div", { className: "a2ui-tag-input", style: getWeightStyle(props.weight), children: _jsxs("div", { style: a2uiContainerStyles, children: [label ? _jsx("label", { style: labelStyles, children: label }) : null, _jsxs("div", { className: "glchat-a2ui-tag-input", style: fieldStyles, children: [_jsx("div", { style: containerStyles, children: _jsxs("div", { style: {
|
|
109
102
|
...innerStyles,
|
|
110
103
|
...(disableTextInput ? innerBorderlessStyles : undefined),
|
|
111
104
|
...(validationError ? innerInvalidStyles : undefined),
|
|
112
|
-
}, children: [tags.map((tag) => (_jsxs("div", { style: multiSelectBadgeStyles, children: [_jsx("p", { style: tagTextStyles, children: tag }), !disabled && (_jsx(X, { style: {
|
|
113
|
-
...removeIconStyles,
|
|
114
|
-
cursor: 'pointer',
|
|
115
|
-
}, strokeWidth: 1.5, onClick: () => removeTag(tag), "aria-hidden": true }))] }, tag))), !disableTextInput && (_jsx("input", { type: "text", className: "glchat-a2ui-tag-input-field", style: inputStyles, placeholder: tags.length === 0 ? resolvedPlaceholder : '', value: inputValue, onChange: (event) => {
|
|
105
|
+
}, children: [tags.map((tag) => (_jsxs("div", { style: multiSelectBadgeStyles, children: [_jsx("p", { style: tagTextStyles, children: tag }), !disabled && (_jsx(X, { style: { ...removeIconStyles, cursor: 'pointer' }, strokeWidth: 1.5, onClick: () => removeTag(tag), "aria-hidden": true }))] }, tag))), !disableTextInput && (_jsx("input", { type: "text", className: "glchat-a2ui-tag-input-field", style: inputStyles, placeholder: tags.length === 0 ? placeholder : '', value: inputValue, onChange: (event) => {
|
|
116
106
|
setInputValue(event.target.value);
|
|
117
107
|
if (validationError)
|
|
118
108
|
setValidationError(false);
|
|
119
|
-
}, "aria-invalid": validationError || undefined, "aria-describedby": validationError && validationRegexp ? errorMessageId : undefined, onKeyDown: handleInputKeyDown, onBlur: addTag, disabled: disabled }))] }) }), validationError && validationRegexp ? (_jsx("p", { id: errorMessageId, className: "glchat-a2ui-tag-input-error", style: errorStyles, role: "alert", children:
|
|
120
|
-
}
|
|
109
|
+
}, "aria-invalid": validationError || undefined, "aria-describedby": validationError && validationRegexp ? errorMessageId : undefined, onKeyDown: handleInputKeyDown, onBlur: addTag, disabled: disabled }))] }) }), validationError && validationRegexp ? (_jsx("p", { id: errorMessageId, className: "glchat-a2ui-tag-input-error", style: errorStyles, role: "alert", children: validationErrorMessage })) : null] })] }) }));
|
|
110
|
+
});
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
import type { CSSProperties } from 'react';
|
|
2
|
-
export type TagInputTheme = {
|
|
3
|
-
container: Record<string, boolean>;
|
|
4
|
-
element: Record<string, boolean>;
|
|
5
|
-
label: Record<string, boolean>;
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* TagInput structural class map.
|
|
9
|
-
*/
|
|
10
|
-
export declare const components: TagInputTheme;
|
|
11
2
|
export declare const a2uiContainerStyles: CSSProperties;
|
|
12
3
|
export declare const labelStyles: CSSProperties;
|
|
13
4
|
export declare const containerStyles: CSSProperties;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../src/components/a2ui/TagInput/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../src/components/a2ui/TagInput/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,eAAO,MAAM,mBAAmB,EAAE,aAKjC,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,aAIzB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,aAG7B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,aAWzB,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,aAEnC,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,aAEhC,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,aAS3B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,aAWzB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,aAM9B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,aAKzB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,aAKzB,CAAC"}
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TagInput structural class map.
|
|
3
|
-
*/
|
|
4
|
-
export const components = {
|
|
5
|
-
container: {},
|
|
6
|
-
element: {},
|
|
7
|
-
label: {},
|
|
8
|
-
};
|
|
9
1
|
export const a2uiContainerStyles = {
|
|
10
2
|
display: 'flex',
|
|
11
3
|
flexDirection: 'column',
|
|
@@ -24,7 +16,6 @@ export const containerStyles = {
|
|
|
24
16
|
export const innerStyles = {
|
|
25
17
|
display: 'flex',
|
|
26
18
|
flexWrap: 'wrap',
|
|
27
|
-
alignItems: 'center',
|
|
28
19
|
gap: '0.25rem',
|
|
29
20
|
borderRadius: 'var(--radius-md)',
|
|
30
21
|
borderWidth: '1px',
|
|
@@ -67,6 +58,7 @@ export const removeIconStyles = {
|
|
|
67
58
|
width: '0.75rem',
|
|
68
59
|
flexShrink: 0,
|
|
69
60
|
cursor: 'pointer',
|
|
61
|
+
marginLeft: '0.5rem',
|
|
70
62
|
};
|
|
71
63
|
export const fieldStyles = {
|
|
72
64
|
display: 'flex',
|