glchat-a2ui-react-renderer 0.2.5 → 0.2.7
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 +88 -6
- package/dist/src/Provider.d.ts +4 -3
- package/dist/src/Provider.d.ts.map +1 -1
- package/dist/src/Provider.js +1 -6
- package/dist/src/components/a2ui/Button/Button.d.ts.map +1 -1
- package/dist/src/components/a2ui/Button/Button.js +6 -14
- package/dist/src/components/a2ui/Button/theme.d.ts +3 -12
- package/dist/src/components/a2ui/Button/theme.d.ts.map +1 -1
- package/dist/src/components/a2ui/Button/theme.js +4 -58
- package/dist/src/components/a2ui/ButtonAsLink/ButtonAsLink.d.ts +4 -0
- package/dist/src/components/a2ui/ButtonAsLink/ButtonAsLink.d.ts.map +1 -0
- package/dist/src/components/a2ui/ButtonAsLink/ButtonAsLink.js +42 -0
- package/dist/src/components/a2ui/ButtonAsLink/theme.d.ts +8 -0
- package/dist/src/components/a2ui/ButtonAsLink/theme.d.ts.map +1 -0
- package/dist/src/components/a2ui/ButtonAsLink/theme.js +8 -0
- package/dist/src/components/a2ui/Card/theme.d.ts +2 -8
- package/dist/src/components/a2ui/Card/theme.d.ts.map +1 -1
- package/dist/src/components/a2ui/Card/theme.js +2 -8
- package/dist/src/components/a2ui/CheckBox/theme.d.ts +2 -9
- package/dist/src/components/a2ui/CheckBox/theme.d.ts.map +1 -1
- package/dist/src/components/a2ui/CheckBox/theme.js +2 -8
- package/dist/src/components/a2ui/DateTimeInput/theme.d.ts +2 -2
- package/dist/src/components/a2ui/DateTimeInput/theme.d.ts.map +1 -1
- package/dist/src/components/a2ui/DateTimeInput/theme.js +3 -3
- package/dist/src/components/a2ui/DestructiveButton/DestructiveButton.d.ts +4 -0
- package/dist/src/components/a2ui/DestructiveButton/DestructiveButton.d.ts.map +1 -0
- package/dist/src/components/a2ui/DestructiveButton/DestructiveButton.js +22 -0
- package/dist/src/components/a2ui/DestructiveButton/theme.d.ts +8 -0
- package/dist/src/components/a2ui/DestructiveButton/theme.d.ts.map +1 -0
- package/dist/src/components/a2ui/DestructiveButton/theme.js +8 -0
- package/dist/src/components/a2ui/MultipleChoice/CheckboxList.js +5 -5
- package/dist/src/components/a2ui/MultipleChoice/MultipleChoice.js +5 -5
- package/dist/src/components/a2ui/MultipleChoice/theme.d.ts +4 -4
- package/dist/src/components/a2ui/MultipleChoice/theme.d.ts.map +1 -1
- package/dist/src/components/a2ui/MultipleChoice/theme.js +4 -4
- package/dist/src/components/a2ui/TagInput/TagInput.d.ts +4 -0
- package/dist/src/components/a2ui/TagInput/TagInput.d.ts.map +1 -0
- package/dist/src/components/a2ui/TagInput/TagInput.js +120 -0
- package/dist/src/components/a2ui/TagInput/theme.d.ts +22 -0
- package/dist/src/components/a2ui/TagInput/theme.d.ts.map +1 -0
- package/dist/src/components/a2ui/TagInput/theme.js +82 -0
- package/dist/src/components/a2ui/TextField/theme.d.ts +2 -26
- package/dist/src/components/a2ui/TextField/theme.d.ts.map +1 -1
- package/dist/src/components/a2ui/TextField/theme.js +6 -79
- package/dist/src/components/a2ui/types.d.ts +12 -0
- package/dist/src/components/a2ui/types.d.ts.map +1 -0
- package/dist/src/components/a2ui/types.js +1 -0
- package/dist/src/components/ui/Button/Button.d.ts +15 -0
- package/dist/src/components/ui/Button/Button.d.ts.map +1 -0
- package/dist/src/components/ui/Button/Button.js +16 -0
- 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/Button/theme.d.ts +5 -0
- package/dist/src/components/ui/Button/theme.d.ts.map +1 -0
- package/dist/src/components/ui/Button/theme.js +51 -0
- package/dist/src/components/ui/Checkbox/Checkbox.js +2 -2
- package/dist/src/components/ui/Checkbox/theme.d.ts +3 -3
- package/dist/src/components/ui/Checkbox/theme.d.ts.map +1 -1
- package/dist/src/components/ui/Checkbox/theme.js +3 -3
- package/dist/src/components/ui/MultiSelect/MultiSelect.js +12 -12
- package/dist/src/components/ui/MultiSelect/theme.d.ts +12 -12
- package/dist/src/components/ui/MultiSelect/theme.d.ts.map +1 -1
- package/dist/src/components/ui/MultiSelect/theme.js +13 -13
- package/dist/src/components/ui/Select/Select.js +8 -8
- package/dist/src/components/ui/Select/theme.d.ts +8 -8
- package/dist/src/components/ui/Select/theme.d.ts.map +1 -1
- package/dist/src/components/ui/Select/theme.js +8 -8
- package/dist/src/components/ui/TextField/theme.d.ts +4 -0
- package/dist/src/components/ui/TextField/theme.d.ts.map +1 -0
- package/dist/src/components/ui/TextField/theme.js +22 -0
- package/dist/src/utils/catalog.d.ts +1 -1
- package/dist/src/utils/catalog.d.ts.map +1 -1
- package/dist/src/utils/catalog.js +7 -11
- 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/utils/theme.d.ts +11 -0
- package/dist/src/utils/theme.d.ts.map +1 -1
- package/dist/src/utils/theme.js +80 -79
- package/json/README.md +74 -0
- package/json/a2ui-sample-messages.json +338 -0
- package/json/glchat_server_to_client_with_catalog.json +1000 -0
- package/json/glchat_standard_catalog_definition.json +844 -0
- package/package.json +6 -3
- package/styles/globals.css +135 -17
- package/dist/src/components/a2ui/Card/Card.d.ts +0 -4
- package/dist/src/components/a2ui/Card/Card.d.ts.map +0 -1
- package/dist/src/components/a2ui/Card/Card.js +0 -16
- package/dist/src/components/a2ui/CheckBox/CheckBox.d.ts +0 -4
- package/dist/src/components/a2ui/CheckBox/CheckBox.d.ts.map +0 -1
- package/dist/src/components/a2ui/CheckBox/CheckBox.js +0 -26
- package/dist/src/components/a2ui/TextField/TextField.d.ts +0 -4
- package/dist/src/components/a2ui/TextField/TextField.d.ts.map +0 -1
- package/dist/src/components/a2ui/TextField/TextField.js +0 -54
- package/patches/@a2ui+web_core+0.10.0.patch +0 -55
|
@@ -6,7 +6,7 @@ import { useCallback, useMemo, useState } from 'react';
|
|
|
6
6
|
const optionHoverStyle = {
|
|
7
7
|
backgroundColor: 'hsl(var(--foreground) / 0.1)',
|
|
8
8
|
};
|
|
9
|
-
import {
|
|
9
|
+
import { multiSelectBadgeStyles, multiSelectCheckboxCheckedStyles, multiSelectCheckboxStyles, multiSelectContentStyles, multiSelectFooterButtonStyles, multiSelectFooterStyles, multiSelectListStyles, multiSelectOptionStyles, multiSelectPlaceholderStyles, multiSelectSearchInputStyles, multiSelectSeparatorStyles, multiSelectTriggerStyles, } from './theme.js';
|
|
10
10
|
function mergeStyles(base, override) {
|
|
11
11
|
return override ? { ...base, ...override } : base;
|
|
12
12
|
}
|
|
@@ -55,7 +55,7 @@ export function MultiSelect({ options, value, onValueChange, placeholder = 'Sele
|
|
|
55
55
|
setOpen(next);
|
|
56
56
|
if (!next)
|
|
57
57
|
setSearch('');
|
|
58
|
-
}, children: [_jsx(PopoverPrimitive.Trigger, { type: "button", disabled: disabled, className: triggerClassName, style: mergeStyles(
|
|
58
|
+
}, children: [_jsx(PopoverPrimitive.Trigger, { type: "button", disabled: disabled, className: triggerClassName, style: mergeStyles(multiSelectTriggerStyles, style), children: value.length > 0 ? (_jsxs("div", { style: {
|
|
59
59
|
display: 'flex',
|
|
60
60
|
minHeight: 0,
|
|
61
61
|
width: '100%',
|
|
@@ -75,7 +75,7 @@ export function MultiSelect({ options, value, onValueChange, placeholder = 'Sele
|
|
|
75
75
|
overflowX: 'hidden',
|
|
76
76
|
}, children: value.map((selectedValue) => {
|
|
77
77
|
const option = options.find((o) => o.value === selectedValue);
|
|
78
|
-
return (_jsxs("div", { style:
|
|
78
|
+
return (_jsxs("div", { style: multiSelectBadgeStyles, children: [_jsx("span", { style: {
|
|
79
79
|
overflow: 'hidden',
|
|
80
80
|
textOverflow: 'ellipsis',
|
|
81
81
|
whiteSpace: 'nowrap',
|
|
@@ -100,17 +100,17 @@ export function MultiSelect({ options, value, onValueChange, placeholder = 'Sele
|
|
|
100
100
|
event.stopPropagation();
|
|
101
101
|
if (!disabled)
|
|
102
102
|
handleClear();
|
|
103
|
-
}, "aria-hidden": true }), _jsx("div", { style:
|
|
103
|
+
}, "aria-hidden": true }), _jsx("div", { style: multiSelectSeparatorStyles }), _jsx(ChevronDown, { style: { height: '1rem', width: '1rem', flexShrink: 0, opacity: 0.5 }, strokeWidth: 1.5, "aria-hidden": true })] })] })) : (_jsxs("div", { style: {
|
|
104
104
|
display: 'flex',
|
|
105
105
|
width: '100%',
|
|
106
106
|
alignItems: 'center',
|
|
107
107
|
justifyContent: 'space-between',
|
|
108
|
-
}, children: [_jsx("span", { style:
|
|
109
|
-
...
|
|
108
|
+
}, children: [_jsx("span", { style: multiSelectPlaceholderStyles, children: placeholder }), _jsx(ChevronDown, { style: { height: '1rem', width: '1rem', opacity: 0.5 }, strokeWidth: 1.5, "aria-hidden": true })] })) }), _jsx(PopoverPrimitive.Portal, { children: _jsxs(PopoverPrimitive.Content, { align: "start", sideOffset: 4, className: "glchat-a2ui-multiselect-content", style: multiSelectContentStyles, onEscapeKeyDown: () => setOpen(false), children: [filterable && (_jsx("input", { type: "text", value: search, onChange: (e) => setSearch(e.target.value), placeholder: "Search...", style: multiSelectSearchInputStyles })), _jsxs("div", { style: multiSelectListStyles, children: [options.length > 0 && (_jsxs("button", { type: "button", className: "glchat-a2ui-multiselect-option", style: {
|
|
109
|
+
...multiSelectOptionStyles,
|
|
110
110
|
...(hoveredOption === '__all__' ? optionHoverStyle : {}),
|
|
111
111
|
}, onMouseEnter: () => setHoveredOption('__all__'), onMouseLeave: () => setHoveredOption(null), onClick: toggleAll, children: [_jsx("span", { style: isAllSelected
|
|
112
|
-
?
|
|
113
|
-
:
|
|
112
|
+
? multiSelectCheckboxCheckedStyles
|
|
113
|
+
: multiSelectCheckboxStyles, children: isAllSelected && (_jsx(Check, { style: { height: '1rem', width: '1rem' }, strokeWidth: 1.5 })) }), _jsx("span", { children: "Select all" })] })), filteredOptions.length === 0 ? (_jsx("div", { style: {
|
|
114
114
|
padding: '0.5rem 0.75rem',
|
|
115
115
|
fontSize: '0.875rem',
|
|
116
116
|
color: 'hsl(var(--foreground) / 0.5)',
|
|
@@ -120,18 +120,18 @@ export function MultiSelect({ options, value, onValueChange, placeholder = 'Sele
|
|
|
120
120
|
value.length >= maxSelections &&
|
|
121
121
|
!isSelected;
|
|
122
122
|
return (_jsxs("button", { type: "button", className: "glchat-a2ui-multiselect-option", disabled: atMax, style: {
|
|
123
|
-
...
|
|
123
|
+
...multiSelectOptionStyles,
|
|
124
124
|
...(hoveredOption === option.value ? optionHoverStyle : {}),
|
|
125
125
|
opacity: atMax ? 0.5 : 1,
|
|
126
126
|
cursor: atMax ? 'not-allowed' : 'pointer',
|
|
127
127
|
}, onMouseEnter: () => setHoveredOption(option.value), onMouseLeave: () => setHoveredOption(null), onClick: () => toggleOption(option.value), children: [_jsx("span", { style: isSelected
|
|
128
|
-
?
|
|
129
|
-
:
|
|
128
|
+
? multiSelectCheckboxCheckedStyles
|
|
129
|
+
: multiSelectCheckboxStyles, children: isSelected && (_jsx(Check, { style: { height: '1rem', width: '1rem' }, strokeWidth: 1.5 })) }), _jsx("span", { style: {
|
|
130
130
|
overflow: 'hidden',
|
|
131
131
|
display: '-webkit-box',
|
|
132
132
|
WebkitLineClamp: 2,
|
|
133
133
|
WebkitBoxOrient: 'vertical',
|
|
134
134
|
width: '100%',
|
|
135
135
|
}, children: option.label })] }, option.value));
|
|
136
|
-
}))] }), _jsxs("div", { style:
|
|
136
|
+
}))] }), _jsxs("div", { style: multiSelectFooterStyles, children: [value.length > 0 && (_jsxs(_Fragment, { children: [_jsx("button", { type: "button", style: multiSelectFooterButtonStyles, onClick: handleClear, children: "Clear" }), _jsx("div", { style: multiSelectSeparatorStyles })] })), _jsx("button", { type: "button", style: multiSelectFooterButtonStyles, onClick: () => setOpen(false), children: "Close" })] })] }) })] }));
|
|
137
137
|
}
|
|
@@ -3,16 +3,16 @@ export type MultiSelectOption = {
|
|
|
3
3
|
label: string;
|
|
4
4
|
value: string;
|
|
5
5
|
};
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
8
|
-
export declare const
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const
|
|
12
|
-
export declare const
|
|
13
|
-
export declare const
|
|
14
|
-
export declare const
|
|
15
|
-
export declare const
|
|
16
|
-
export declare const
|
|
17
|
-
export declare const
|
|
6
|
+
export declare const multiSelectTriggerStyles: CSSProperties;
|
|
7
|
+
export declare const multiSelectBadgeStyles: CSSProperties;
|
|
8
|
+
export declare const multiSelectPlaceholderStyles: CSSProperties;
|
|
9
|
+
export declare const multiSelectContentStyles: CSSProperties;
|
|
10
|
+
export declare const multiSelectSearchInputStyles: CSSProperties;
|
|
11
|
+
export declare const multiSelectListStyles: CSSProperties;
|
|
12
|
+
export declare const multiSelectOptionStyles: CSSProperties;
|
|
13
|
+
export declare const multiSelectCheckboxStyles: CSSProperties;
|
|
14
|
+
export declare const multiSelectCheckboxCheckedStyles: CSSProperties;
|
|
15
|
+
export declare const multiSelectFooterStyles: CSSProperties;
|
|
16
|
+
export declare const multiSelectFooterButtonStyles: CSSProperties;
|
|
17
|
+
export declare const multiSelectSeparatorStyles: CSSProperties;
|
|
18
18
|
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/MultiSelect/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/MultiSelect/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,aAgBtC,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,aAcpC,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,aAI1C,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,aAWtC,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,aAW1C,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,aAKnC,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,aAgBrC,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,aAYvC,CAAC;AAEF,eAAO,MAAM,gCAAgC,EAAE,aAK9C,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,aASrC,CAAC;AAEF,eAAO,MAAM,6BAA6B,EAAE,aAS3C,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,aAMxC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const
|
|
1
|
+
export const multiSelectTriggerStyles = {
|
|
2
2
|
display: 'flex',
|
|
3
3
|
minHeight: '2.5rem',
|
|
4
4
|
width: '100%',
|
|
@@ -15,7 +15,7 @@ export const glchatMultiSelectTriggerStyles = {
|
|
|
15
15
|
boxSizing: 'border-box',
|
|
16
16
|
cursor: 'pointer',
|
|
17
17
|
};
|
|
18
|
-
export const
|
|
18
|
+
export const multiSelectBadgeStyles = {
|
|
19
19
|
display: 'flex',
|
|
20
20
|
alignItems: 'center',
|
|
21
21
|
justifyContent: 'space-between',
|
|
@@ -30,12 +30,12 @@ export const glchatMultiSelectBadgeStyles = {
|
|
|
30
30
|
fontWeight: 400,
|
|
31
31
|
maxWidth: '9rem',
|
|
32
32
|
};
|
|
33
|
-
export const
|
|
33
|
+
export const multiSelectPlaceholderStyles = {
|
|
34
34
|
fontSize: '0.875rem',
|
|
35
35
|
fontWeight: 400,
|
|
36
36
|
color: 'hsl(var(--foreground) / 0.5)',
|
|
37
37
|
};
|
|
38
|
-
export const
|
|
38
|
+
export const multiSelectContentStyles = {
|
|
39
39
|
zIndex: 50,
|
|
40
40
|
width: 'var(--radix-popover-trigger-width)',
|
|
41
41
|
borderRadius: 'var(--radius-md)',
|
|
@@ -47,7 +47,7 @@ export const glchatMultiSelectContentStyles = {
|
|
|
47
47
|
padding: 0,
|
|
48
48
|
boxShadow: '0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)',
|
|
49
49
|
};
|
|
50
|
-
export const
|
|
50
|
+
export const multiSelectSearchInputStyles = {
|
|
51
51
|
width: '100%',
|
|
52
52
|
borderWidth: 0,
|
|
53
53
|
borderBottomWidth: '1px',
|
|
@@ -59,13 +59,13 @@ export const glchatMultiSelectSearchInputStyles = {
|
|
|
59
59
|
color: 'hsl(var(--foreground))',
|
|
60
60
|
outline: 'none',
|
|
61
61
|
};
|
|
62
|
-
export const
|
|
62
|
+
export const multiSelectListStyles = {
|
|
63
63
|
maxHeight: '250px',
|
|
64
64
|
overflowY: 'auto',
|
|
65
65
|
paddingTop: '0.25rem',
|
|
66
66
|
paddingBottom: '0.25rem',
|
|
67
67
|
};
|
|
68
|
-
export const
|
|
68
|
+
export const multiSelectOptionStyles = {
|
|
69
69
|
display: 'flex',
|
|
70
70
|
width: '100%',
|
|
71
71
|
cursor: 'pointer',
|
|
@@ -82,7 +82,7 @@ export const glchatMultiSelectOptionStyles = {
|
|
|
82
82
|
color: 'hsl(var(--foreground))',
|
|
83
83
|
textAlign: 'left',
|
|
84
84
|
};
|
|
85
|
-
export const
|
|
85
|
+
export const multiSelectCheckboxStyles = {
|
|
86
86
|
display: 'flex',
|
|
87
87
|
height: '1rem',
|
|
88
88
|
width: '1rem',
|
|
@@ -95,13 +95,13 @@ export const glchatMultiSelectCheckboxStyles = {
|
|
|
95
95
|
borderStyle: 'solid',
|
|
96
96
|
borderColor: 'hsl(var(--foreground))',
|
|
97
97
|
};
|
|
98
|
-
export const
|
|
99
|
-
...
|
|
98
|
+
export const multiSelectCheckboxCheckedStyles = {
|
|
99
|
+
...multiSelectCheckboxStyles,
|
|
100
100
|
borderColor: 'hsl(var(--primary))',
|
|
101
101
|
backgroundColor: 'hsl(var(--primary))',
|
|
102
102
|
color: 'hsl(var(--primary-foreground))',
|
|
103
103
|
};
|
|
104
|
-
export const
|
|
104
|
+
export const multiSelectFooterStyles = {
|
|
105
105
|
display: 'flex',
|
|
106
106
|
alignItems: 'center',
|
|
107
107
|
justifyContent: 'space-between',
|
|
@@ -111,7 +111,7 @@ export const glchatMultiSelectFooterStyles = {
|
|
|
111
111
|
padding: '0.25rem',
|
|
112
112
|
fontSize: '0.875rem',
|
|
113
113
|
};
|
|
114
|
-
export const
|
|
114
|
+
export const multiSelectFooterButtonStyles = {
|
|
115
115
|
flex: 1,
|
|
116
116
|
height: '2rem',
|
|
117
117
|
cursor: 'pointer',
|
|
@@ -121,7 +121,7 @@ export const glchatMultiSelectFooterButtonStyles = {
|
|
|
121
121
|
color: 'hsl(var(--foreground))',
|
|
122
122
|
fontSize: '0.875rem',
|
|
123
123
|
};
|
|
124
|
-
export const
|
|
124
|
+
export const multiSelectSeparatorStyles = {
|
|
125
125
|
width: '1px',
|
|
126
126
|
minHeight: '1.5rem',
|
|
127
127
|
backgroundColor: 'hsl(var(--border))',
|
|
@@ -3,25 +3,25 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
4
4
|
import { Check, ChevronDown, ChevronUp } from 'lucide-react';
|
|
5
5
|
import * as React from 'react';
|
|
6
|
-
import {
|
|
6
|
+
import { selectContentStyles, selectItemIndicatorStyles, selectItemStyles, selectScrollButtonStyles, selectTriggerStyles, selectViewportStyles, } from './theme.js';
|
|
7
7
|
const Select = SelectPrimitive.Root;
|
|
8
8
|
const SelectGroup = SelectPrimitive.Group;
|
|
9
9
|
const SelectValue = SelectPrimitive.Value;
|
|
10
|
-
const SelectTrigger = React.forwardRef(({ className, style, children, ...props }, ref) => (_jsxs(SelectPrimitive.Trigger, { ref: ref, className: className, style: { ...
|
|
10
|
+
const SelectTrigger = React.forwardRef(({ className, style, children, ...props }, ref) => (_jsxs(SelectPrimitive.Trigger, { ref: ref, className: className, style: { ...selectTriggerStyles, ...style }, ...props, children: [children, _jsx(SelectPrimitive.Icon, { asChild: true, children: _jsx(ChevronDown, { style: { height: '1rem', width: '1rem', opacity: 0.5, flexShrink: 0 }, "aria-hidden": true }) })] })));
|
|
11
11
|
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
12
|
-
const SelectScrollUpButton = React.forwardRef(({ style, ...props }, ref) => (_jsx(SelectPrimitive.ScrollUpButton, { ref: ref, style: { ...
|
|
12
|
+
const SelectScrollUpButton = React.forwardRef(({ style, ...props }, ref) => (_jsx(SelectPrimitive.ScrollUpButton, { ref: ref, style: { ...selectScrollButtonStyles, ...style }, ...props, children: _jsx(ChevronUp, { style: { height: '1rem', width: '1rem' }, "aria-hidden": true }) })));
|
|
13
13
|
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
|
|
14
|
-
const SelectScrollDownButton = React.forwardRef(({ style, ...props }, ref) => (_jsx(SelectPrimitive.ScrollDownButton, { ref: ref, style: { ...
|
|
14
|
+
const SelectScrollDownButton = React.forwardRef(({ style, ...props }, ref) => (_jsx(SelectPrimitive.ScrollDownButton, { ref: ref, style: { ...selectScrollButtonStyles, ...style }, ...props, children: _jsx(ChevronDown, { style: { height: '1rem', width: '1rem' }, "aria-hidden": true }) })));
|
|
15
15
|
SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
|
|
16
|
-
const SelectContent = React.forwardRef(({ className, children, position = 'popper', style, ...props }, ref) => (_jsx(SelectPrimitive.Portal, { children: _jsxs(SelectPrimitive.Content, { ref: ref, className: className, position: position, style: { ...
|
|
16
|
+
const SelectContent = React.forwardRef(({ className, children, position = 'popper', style, ...props }, ref) => (_jsx(SelectPrimitive.Portal, { children: _jsxs(SelectPrimitive.Content, { ref: ref, className: className, position: position, style: { ...selectContentStyles, ...style }, ...props, children: [_jsx(SelectScrollUpButton, {}), _jsx(SelectPrimitive.Viewport, { style: position === 'popper'
|
|
17
17
|
? {
|
|
18
|
-
...
|
|
18
|
+
...selectViewportStyles,
|
|
19
19
|
height: 'var(--radix-select-trigger-height)',
|
|
20
20
|
width: '100%',
|
|
21
21
|
minWidth: 'var(--radix-select-trigger-width)',
|
|
22
22
|
}
|
|
23
|
-
:
|
|
23
|
+
: selectViewportStyles, children: children }), _jsx(SelectScrollDownButton, {})] }) })));
|
|
24
24
|
SelectContent.displayName = SelectPrimitive.Content.displayName;
|
|
25
|
-
const SelectItem = React.forwardRef(({ className, children, style, ...props }, ref) => (_jsxs(SelectPrimitive.Item, { ref: ref, className: ['glchat-a2ui-select-item', className].filter(Boolean).join(' '), style: { ...
|
|
25
|
+
const SelectItem = React.forwardRef(({ className, children, style, ...props }, ref) => (_jsxs(SelectPrimitive.Item, { ref: ref, className: ['glchat-a2ui-select-item', className].filter(Boolean).join(' '), style: { ...selectItemStyles, ...style }, ...props, children: [_jsx(SelectPrimitive.ItemText, { children: children }), _jsx("span", { style: selectItemIndicatorStyles, children: _jsx(SelectPrimitive.ItemIndicator, { children: _jsx(Check, { style: { height: '1rem', width: '1rem', color: 'hsl(var(--primary))' }, "aria-hidden": true }) }) })] })));
|
|
26
26
|
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
27
27
|
export { Select, SelectContent, SelectGroup, SelectItem, SelectScrollDownButton, SelectScrollUpButton, SelectTrigger, SelectValue, };
|
|
@@ -3,27 +3,27 @@ import type { CSSProperties } from 'react';
|
|
|
3
3
|
* SelectTrigger inline styles — glchat-ui Select baseline.
|
|
4
4
|
*/
|
|
5
5
|
/** Label text inside SelectTrigger (not Radix SelectValue). */
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
8
|
-
export declare const
|
|
6
|
+
export declare const selectTriggerLabelStyles: CSSProperties;
|
|
7
|
+
export declare const selectTriggerPlaceholderStyles: CSSProperties;
|
|
8
|
+
export declare const selectTriggerStyles: CSSProperties;
|
|
9
9
|
/**
|
|
10
10
|
* SelectContent inline styles — dropdown panel.
|
|
11
11
|
*/
|
|
12
|
-
export declare const
|
|
12
|
+
export declare const selectContentStyles: CSSProperties;
|
|
13
13
|
/**
|
|
14
14
|
* SelectViewport padding wrapper.
|
|
15
15
|
*/
|
|
16
|
-
export declare const
|
|
16
|
+
export declare const selectViewportStyles: CSSProperties;
|
|
17
17
|
/**
|
|
18
18
|
* SelectItem inline styles.
|
|
19
19
|
*/
|
|
20
|
-
export declare const
|
|
20
|
+
export declare const selectItemStyles: CSSProperties;
|
|
21
21
|
/**
|
|
22
22
|
* SelectItem check indicator container.
|
|
23
23
|
*/
|
|
24
|
-
export declare const
|
|
24
|
+
export declare const selectItemIndicatorStyles: CSSProperties;
|
|
25
25
|
/**
|
|
26
26
|
* Scroll button styles.
|
|
27
27
|
*/
|
|
28
|
-
export declare const
|
|
28
|
+
export declare const selectScrollButtonStyles: CSSProperties;
|
|
29
29
|
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/Select/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C;;GAEG;AACH,+DAA+D;AAC/D,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/Select/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C;;GAEG;AACH,+DAA+D;AAC/D,eAAO,MAAM,wBAAwB,EAAE,aAOtC,CAAC;AAEF,eAAO,MAAM,8BAA8B,EAAE,aAE5C,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,aAmBjC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,aAcjC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,aAElC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,aAc9B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,yBAAyB,EAAE,aAOvC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB,EAAE,aAOtC,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* SelectTrigger inline styles — glchat-ui Select baseline.
|
|
3
3
|
*/
|
|
4
4
|
/** Label text inside SelectTrigger (not Radix SelectValue). */
|
|
5
|
-
export const
|
|
5
|
+
export const selectTriggerLabelStyles = {
|
|
6
6
|
flex: 1,
|
|
7
7
|
minWidth: 0,
|
|
8
8
|
overflow: 'hidden',
|
|
@@ -10,10 +10,10 @@ export const glchatSelectTriggerLabelStyles = {
|
|
|
10
10
|
whiteSpace: 'nowrap',
|
|
11
11
|
textAlign: 'left',
|
|
12
12
|
};
|
|
13
|
-
export const
|
|
13
|
+
export const selectTriggerPlaceholderStyles = {
|
|
14
14
|
color: 'hsl(var(--foreground) / 0.5)',
|
|
15
15
|
};
|
|
16
|
-
export const
|
|
16
|
+
export const selectTriggerStyles = {
|
|
17
17
|
display: 'flex',
|
|
18
18
|
height: '2.5rem',
|
|
19
19
|
width: '100%',
|
|
@@ -36,7 +36,7 @@ export const glchatSelectTriggerStyles = {
|
|
|
36
36
|
/**
|
|
37
37
|
* SelectContent inline styles — dropdown panel.
|
|
38
38
|
*/
|
|
39
|
-
export const
|
|
39
|
+
export const selectContentStyles = {
|
|
40
40
|
position: 'relative',
|
|
41
41
|
zIndex: 50,
|
|
42
42
|
maxHeight: 'var(--radix-select-content-available-height)',
|
|
@@ -54,13 +54,13 @@ export const glchatSelectContentStyles = {
|
|
|
54
54
|
/**
|
|
55
55
|
* SelectViewport padding wrapper.
|
|
56
56
|
*/
|
|
57
|
-
export const
|
|
57
|
+
export const selectViewportStyles = {
|
|
58
58
|
padding: '0.25rem',
|
|
59
59
|
};
|
|
60
60
|
/**
|
|
61
61
|
* SelectItem inline styles.
|
|
62
62
|
*/
|
|
63
|
-
export const
|
|
63
|
+
export const selectItemStyles = {
|
|
64
64
|
position: 'relative',
|
|
65
65
|
display: 'flex',
|
|
66
66
|
width: '100%',
|
|
@@ -78,7 +78,7 @@ export const glchatSelectItemStyles = {
|
|
|
78
78
|
/**
|
|
79
79
|
* SelectItem check indicator container.
|
|
80
80
|
*/
|
|
81
|
-
export const
|
|
81
|
+
export const selectItemIndicatorStyles = {
|
|
82
82
|
marginLeft: 'auto',
|
|
83
83
|
display: 'flex',
|
|
84
84
|
height: '0.875rem',
|
|
@@ -89,7 +89,7 @@ export const glchatSelectItemIndicatorStyles = {
|
|
|
89
89
|
/**
|
|
90
90
|
* Scroll button styles.
|
|
91
91
|
*/
|
|
92
|
-
export const
|
|
92
|
+
export const selectScrollButtonStyles = {
|
|
93
93
|
display: 'flex',
|
|
94
94
|
cursor: 'default',
|
|
95
95
|
alignItems: 'center',
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/TextField/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,eAAO,MAAM,mBAAmB,EAAE,aAGjC,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,aAiBlC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export const textFieldFontStyles = {
|
|
2
|
+
fontFamily: 'inherit',
|
|
3
|
+
lineHeight: '1.5',
|
|
4
|
+
};
|
|
5
|
+
export const textFieldInputStyles = {
|
|
6
|
+
...textFieldFontStyles,
|
|
7
|
+
height: '2.5rem',
|
|
8
|
+
width: '100%',
|
|
9
|
+
borderRadius: 'var(--radius-md)',
|
|
10
|
+
borderWidth: '1px',
|
|
11
|
+
borderStyle: 'solid',
|
|
12
|
+
borderColor: 'hsl(var(--border))',
|
|
13
|
+
backgroundColor: 'hsl(var(--background))',
|
|
14
|
+
paddingTop: '0.5rem',
|
|
15
|
+
paddingBottom: '0.5rem',
|
|
16
|
+
paddingLeft: '0.75rem',
|
|
17
|
+
paddingRight: '0.75rem',
|
|
18
|
+
fontSize: '0.875rem',
|
|
19
|
+
color: 'hsl(var(--foreground))',
|
|
20
|
+
caretColor: 'currentColor',
|
|
21
|
+
boxSizing: 'border-box',
|
|
22
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ComponentRegistry } from '@a2ui/react';
|
|
2
2
|
/**
|
|
3
3
|
* Ensures the registry has the official default A2UI components
|
|
4
|
-
* extended with GLChat-specific components (Button/
|
|
4
|
+
* extended with GLChat-specific components (Button/ButtonAsLink/DestructiveButton/MultipleChoice/TagInput/Timeout).
|
|
5
5
|
*/
|
|
6
6
|
export declare function ensureGlchatComponentsRegistered(registry: ComponentRegistry): void;
|
|
7
7
|
//# sourceMappingURL=catalog.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../src/utils/catalog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAA0B,MAAM,aAAa,CAAC;AAW7E;;;GAGG;AACH,wBAAgB,gCAAgC,CAAC,QAAQ,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../src/utils/catalog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAA0B,MAAM,aAAa,CAAC;AAW7E;;;GAGG;AACH,wBAAgB,gCAAgC,CAAC,QAAQ,EAAE,iBAAiB,QAgB3E"}
|
|
@@ -1,30 +1,26 @@
|
|
|
1
1
|
import { registerDefaultCatalog } from '@a2ui/react';
|
|
2
2
|
import { CustomButtonComponent } from '../components/a2ui/Button/Button.js';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { CustomButtonAsLinkComponent } from '../components/a2ui/ButtonAsLink/ButtonAsLink.js';
|
|
4
|
+
import { CustomDestructiveButtonComponent } from '../components/a2ui/DestructiveButton/DestructiveButton.js';
|
|
5
5
|
import { CustomMultipleChoiceComponent } from '../components/a2ui/MultipleChoice/MultipleChoice.js';
|
|
6
|
-
import {
|
|
6
|
+
import { CustomTagInputComponent } from '../components/a2ui/TagInput/TagInput.js';
|
|
7
7
|
import { CustomTimeoutComponent } from '../components/a2ui/Timeout/Timeout.js';
|
|
8
8
|
const registeredRegistries = new WeakSet();
|
|
9
9
|
/**
|
|
10
10
|
* Ensures the registry has the official default A2UI components
|
|
11
|
-
* extended with GLChat-specific components (Button/
|
|
11
|
+
* extended with GLChat-specific components (Button/ButtonAsLink/DestructiveButton/MultipleChoice/TagInput/Timeout).
|
|
12
12
|
*/
|
|
13
13
|
export function ensureGlchatComponentsRegistered(registry) {
|
|
14
14
|
if (registeredRegistries.has(registry))
|
|
15
15
|
return;
|
|
16
16
|
registerDefaultCatalog(registry);
|
|
17
17
|
registry.unregister('Button');
|
|
18
|
-
registry.unregister('Card');
|
|
19
|
-
registry.unregister('CheckBox');
|
|
20
|
-
registry.unregister('TextField');
|
|
21
18
|
registry.unregister('MultipleChoice');
|
|
22
|
-
registry.unregister('Timeout');
|
|
23
19
|
registry.register('Button', { component: CustomButtonComponent });
|
|
24
|
-
registry.register('
|
|
25
|
-
registry.register('
|
|
26
|
-
registry.register('TextField', { component: CustomTextFieldComponent });
|
|
20
|
+
registry.register('ButtonAsLink', { component: CustomButtonAsLinkComponent });
|
|
21
|
+
registry.register('DestructiveButton', { component: CustomDestructiveButtonComponent });
|
|
27
22
|
registry.register('MultipleChoice', { component: CustomMultipleChoiceComponent });
|
|
23
|
+
registry.register('TagInput', { component: CustomTagInputComponent });
|
|
28
24
|
registry.register('Timeout', { component: CustomTimeoutComponent });
|
|
29
25
|
registeredRegistries.add(registry);
|
|
30
26
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a safe anchor target value, or undefined when the value is missing or invalid.
|
|
3
|
+
*/
|
|
4
|
+
export declare function sanitizeTarget(target: string): string | undefined;
|
|
5
|
+
/**
|
|
6
|
+
* Returns a safe href for use in anchor elements.
|
|
7
|
+
* Blocks dangerous schemes (e.g. javascript:, data:) and only allows
|
|
8
|
+
* relative paths, fragments, and a small set of absolute URL schemes.
|
|
9
|
+
*/
|
|
10
|
+
export declare function sanitizeHref(href: string): string;
|
|
11
|
+
//# sourceMappingURL=href.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"href.d.ts","sourceRoot":"","sources":["../../../src/utils/href.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAGjE;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAmBjD"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const DANGEROUS_SCHEME_PATTERN = /^(javascript|data|vbscript|file|blob):/i;
|
|
2
|
+
const ABSOLUTE_SCHEME_PATTERN = /^[a-z][a-z0-9+.-]*:/i;
|
|
3
|
+
const SCHEME_CAPTURE_PATTERN = /^([a-z][a-z0-9+.-]*):/i;
|
|
4
|
+
const ALLOWED_ABSOLUTE_SCHEMES = new Set(['http', 'https', 'mailto', 'tel']);
|
|
5
|
+
const ALLOWED_TARGETS = new Set(['_self', '_blank', '_parent', '_top']);
|
|
6
|
+
/**
|
|
7
|
+
* Returns a safe anchor target value, or undefined when the value is missing or invalid.
|
|
8
|
+
*/
|
|
9
|
+
export function sanitizeTarget(target) {
|
|
10
|
+
const value = target.trim();
|
|
11
|
+
return ALLOWED_TARGETS.has(value) ? value : undefined;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Returns a safe href for use in anchor elements.
|
|
15
|
+
* Blocks dangerous schemes (e.g. javascript:, data:) and only allows
|
|
16
|
+
* relative paths, fragments, and a small set of absolute URL schemes.
|
|
17
|
+
*/
|
|
18
|
+
export function sanitizeHref(href) {
|
|
19
|
+
const value = href.trim();
|
|
20
|
+
if (!value || value === '#')
|
|
21
|
+
return '#';
|
|
22
|
+
if (DANGEROUS_SCHEME_PATTERN.test(value))
|
|
23
|
+
return '#';
|
|
24
|
+
if (value.startsWith('/') ||
|
|
25
|
+
value.startsWith('./') ||
|
|
26
|
+
value.startsWith('../') ||
|
|
27
|
+
value.startsWith('#') ||
|
|
28
|
+
!ABSOLUTE_SCHEME_PATTERN.test(value)) {
|
|
29
|
+
return value;
|
|
30
|
+
}
|
|
31
|
+
const schemeMatch = SCHEME_CAPTURE_PATTERN.exec(value);
|
|
32
|
+
const scheme = schemeMatch?.[1]?.toLowerCase();
|
|
33
|
+
return scheme && ALLOWED_ABSOLUTE_SCHEMES.has(scheme) ? value : '#';
|
|
34
|
+
}
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
import type { Theme } from '@a2ui/web_core/types/types';
|
|
2
|
+
/**
|
|
3
|
+
* Default theme passed to Provider. Starts from upstream litTheme and layers
|
|
4
|
+
* GLChat component class maps and inline styles from each a2ui component theme file.
|
|
5
|
+
*/
|
|
2
6
|
export declare const glchatDefaultTheme: Theme;
|
|
7
|
+
/**
|
|
8
|
+
* Merges consumer overrides into glchatDefaultTheme.
|
|
9
|
+
*
|
|
10
|
+
* Top-level theme keys (elements, markdown, etc.) are shallow-merged.
|
|
11
|
+
* GLChat component entries are deep-merged so partial overrides (e.g. only
|
|
12
|
+
* components.Button) do not wipe the rest of that component's defaults.
|
|
13
|
+
*/
|
|
3
14
|
export declare function mergeGlchatTheme(override?: Partial<Theme>): Theme;
|
|
4
15
|
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../src/utils/theme.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../src/utils/theme.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AA6DxD;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,KAIhC,CAAC;AAmCF;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,CA6BjE"}
|