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
|
@@ -3,11 +3,11 @@ import type { Theme } from '@a2ui/web_core/types/types';
|
|
|
3
3
|
/**
|
|
4
4
|
* MultipleChoice structural class map.
|
|
5
5
|
*/
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const multipleChoiceComponents: Theme['components']['MultipleChoice'];
|
|
7
7
|
/**
|
|
8
8
|
* Checkbox variant — vertical list of options.
|
|
9
9
|
*/
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const
|
|
12
|
-
export declare const
|
|
10
|
+
export declare const checkboxListContainerStyles: CSSProperties;
|
|
11
|
+
export declare const checkboxListItemStyles: CSSProperties;
|
|
12
|
+
export declare const checkboxListSearchStyles: CSSProperties;
|
|
13
13
|
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../src/components/a2ui/MultipleChoice/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAExD;;GAEG;AACH,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../src/components/a2ui/MultipleChoice/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAExD;;GAEG;AACH,eAAO,MAAM,wBAAwB,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,gBAAgB,CAI1E,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,2BAA2B,EAAE,aAKzC,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,aAKpC,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,aAWtC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* MultipleChoice structural class map.
|
|
3
3
|
*/
|
|
4
|
-
export const
|
|
4
|
+
export const multipleChoiceComponents = {
|
|
5
5
|
container: {},
|
|
6
6
|
element: {},
|
|
7
7
|
label: {},
|
|
@@ -9,19 +9,19 @@ export const glchatMultipleChoiceComponents = {
|
|
|
9
9
|
/**
|
|
10
10
|
* Checkbox variant — vertical list of options.
|
|
11
11
|
*/
|
|
12
|
-
export const
|
|
12
|
+
export const checkboxListContainerStyles = {
|
|
13
13
|
display: 'flex',
|
|
14
14
|
flexDirection: 'column',
|
|
15
15
|
gap: '0.5rem',
|
|
16
16
|
width: '100%',
|
|
17
17
|
};
|
|
18
|
-
export const
|
|
18
|
+
export const checkboxListItemStyles = {
|
|
19
19
|
display: 'flex',
|
|
20
20
|
alignItems: 'center',
|
|
21
21
|
gap: '0.5rem',
|
|
22
22
|
width: '100%',
|
|
23
23
|
};
|
|
24
|
-
export const
|
|
24
|
+
export const checkboxListSearchStyles = {
|
|
25
25
|
width: '100%',
|
|
26
26
|
borderRadius: 'var(--radius-md)',
|
|
27
27
|
borderWidth: '1px',
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type A2UIComponentProps } from '@a2ui/react';
|
|
2
|
+
import type { CustomNode } from '@a2ui/web_core/types/types';
|
|
3
|
+
export declare function CustomTagInputComponent({ node, surfaceId, }: Readonly<A2UIComponentProps<CustomNode>>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
//# sourceMappingURL=TagInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TagInput.d.ts","sourceRoot":"","sources":["../../../../../src/components/a2ui/TagInput/TagInput.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,kBAAkB,EAGxB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAqE7D,wBAAgB,uBAAuB,CAAC,EACtC,IAAI,EACJ,SAAS,GACV,EAAE,QAAQ,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC,2CAiL1C"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { classMapToString, useA2UIComponent, } from '@a2ui/react';
|
|
4
|
+
import { X } from 'lucide-react';
|
|
5
|
+
import { useCallback, useEffect, useId, useMemo, useState } from 'react';
|
|
6
|
+
import { multiSelectBadgeStyles } from '../../ui/MultiSelect/theme.js';
|
|
7
|
+
import { a2uiContainerStyles, components, containerStyles, errorStyles, fieldStyles, innerBorderlessStyles, innerInvalidStyles, innerStyles, inputStyles, labelStyles, removeIconStyles, tagTextStyles, } from './theme.js';
|
|
8
|
+
const TAG_INPUT_PLACEHOLDER = 'Enter a value';
|
|
9
|
+
const TAG_INPUT_VALIDATION_ERROR = 'Please enter a valid value.';
|
|
10
|
+
function getSelectedValues(values, getValue) {
|
|
11
|
+
if (values?.path) {
|
|
12
|
+
const raw = getValue(values.path);
|
|
13
|
+
if (Array.isArray(raw)) {
|
|
14
|
+
return raw.filter((item) => typeof item === 'string');
|
|
15
|
+
}
|
|
16
|
+
return [];
|
|
17
|
+
}
|
|
18
|
+
return values?.literalArray ?? [];
|
|
19
|
+
}
|
|
20
|
+
function resolveStringBinding(value, resolveString, getValue) {
|
|
21
|
+
if (!value)
|
|
22
|
+
return '';
|
|
23
|
+
if (value.path) {
|
|
24
|
+
const raw = getValue(value.path);
|
|
25
|
+
if (raw == null)
|
|
26
|
+
return '';
|
|
27
|
+
if (typeof raw === 'string')
|
|
28
|
+
return raw;
|
|
29
|
+
if (typeof raw === 'number' || typeof raw === 'boolean')
|
|
30
|
+
return String(raw);
|
|
31
|
+
return '';
|
|
32
|
+
}
|
|
33
|
+
return resolveString(value) ?? '';
|
|
34
|
+
}
|
|
35
|
+
function isValidTag(value, validationRegexp) {
|
|
36
|
+
if (!validationRegexp)
|
|
37
|
+
return true;
|
|
38
|
+
try {
|
|
39
|
+
return new RegExp(validationRegexp).test(value);
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
export function CustomTagInputComponent({ node, surfaceId, }) {
|
|
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;
|
|
50
|
+
const errorMessageId = useId();
|
|
51
|
+
const externalValues = useMemo(() => getSelectedValues(valuesBinding, getValue), [getValue, valuesBinding]);
|
|
52
|
+
const [tags, setTags] = useState(externalValues);
|
|
53
|
+
const [inputValue, setInputValue] = useState('');
|
|
54
|
+
const [validationError, setValidationError] = useState(false);
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
setTags(externalValues);
|
|
57
|
+
}, [externalValues]);
|
|
58
|
+
const resolvedLabel = resolveStringBinding(props.label, resolveString, getValue);
|
|
59
|
+
const resolvedPlaceholder = resolveStringBinding(props.placeholder, resolveString, getValue) || TAG_INPUT_PLACEHOLDER;
|
|
60
|
+
const disabled = resolveBoolean(props.disabled) ?? false;
|
|
61
|
+
const disableTextInput = props.disableTextInput === true;
|
|
62
|
+
const validationRegexp = typeof props.validationRegexp === 'string' ? props.validationRegexp : undefined;
|
|
63
|
+
const resolvedValidationErrorMessage = resolveStringBinding(props.validationErrorMessage, resolveString, getValue) || TAG_INPUT_VALIDATION_ERROR;
|
|
64
|
+
const updateTags = useCallback((nextTags) => {
|
|
65
|
+
setTags(nextTags);
|
|
66
|
+
if (valuesPath) {
|
|
67
|
+
setValue(valuesPath, nextTags);
|
|
68
|
+
}
|
|
69
|
+
}, [setValue, valuesPath]);
|
|
70
|
+
const addTag = useCallback(() => {
|
|
71
|
+
if (disabled || disableTextInput)
|
|
72
|
+
return;
|
|
73
|
+
const trimmed = inputValue.trim();
|
|
74
|
+
if (!trimmed || tags.includes(trimmed))
|
|
75
|
+
return;
|
|
76
|
+
if (!isValidTag(trimmed, validationRegexp)) {
|
|
77
|
+
setValidationError(true);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
updateTags([...tags, trimmed]);
|
|
81
|
+
setInputValue('');
|
|
82
|
+
setValidationError(false);
|
|
83
|
+
}, [disabled, disableTextInput, inputValue, tags, updateTags, validationRegexp]);
|
|
84
|
+
const handleInputKeyDown = useCallback((event) => {
|
|
85
|
+
if (disabled || disableTextInput)
|
|
86
|
+
return;
|
|
87
|
+
if (event.key === 'Enter') {
|
|
88
|
+
event.preventDefault();
|
|
89
|
+
addTag();
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (event.key === 'Backspace' && !event.currentTarget.value) {
|
|
93
|
+
updateTags(tags.slice(0, -1));
|
|
94
|
+
}
|
|
95
|
+
}, [addTag, disabled, disableTextInput, tags, updateTags]);
|
|
96
|
+
const removeTag = useCallback((tagToRemove) => {
|
|
97
|
+
if (disabled)
|
|
98
|
+
return;
|
|
99
|
+
updateTags(tags.filter((tag) => tag !== tagToRemove));
|
|
100
|
+
setInputValue('');
|
|
101
|
+
}, [disabled, tags, updateTags]);
|
|
102
|
+
const hostStyle = node.weight === void 0 ? undefined : { '--weight': node.weight };
|
|
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: {
|
|
109
|
+
...innerStyles,
|
|
110
|
+
...(disableTextInput ? innerBorderlessStyles : undefined),
|
|
111
|
+
...(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) => {
|
|
116
|
+
setInputValue(event.target.value);
|
|
117
|
+
if (validationError)
|
|
118
|
+
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: resolvedValidationErrorMessage })) : null] })] }) }));
|
|
120
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
export declare const a2uiContainerStyles: CSSProperties;
|
|
12
|
+
export declare const labelStyles: CSSProperties;
|
|
13
|
+
export declare const containerStyles: CSSProperties;
|
|
14
|
+
export declare const innerStyles: CSSProperties;
|
|
15
|
+
export declare const innerBorderlessStyles: CSSProperties;
|
|
16
|
+
export declare const innerInvalidStyles: CSSProperties;
|
|
17
|
+
export declare const tagTextStyles: CSSProperties;
|
|
18
|
+
export declare const inputStyles: CSSProperties;
|
|
19
|
+
export declare const removeIconStyles: CSSProperties;
|
|
20
|
+
export declare const fieldStyles: CSSProperties;
|
|
21
|
+
export declare const errorStyles: CSSProperties;
|
|
22
|
+
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +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,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;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,aAIxB,CAAC;AAEF,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,aAYzB,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,aAK9B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,aAKzB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,aAKzB,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TagInput structural class map.
|
|
3
|
+
*/
|
|
4
|
+
export const components = {
|
|
5
|
+
container: {},
|
|
6
|
+
element: {},
|
|
7
|
+
label: {},
|
|
8
|
+
};
|
|
9
|
+
export const a2uiContainerStyles = {
|
|
10
|
+
display: 'flex',
|
|
11
|
+
flexDirection: 'column',
|
|
12
|
+
gap: '0.5rem',
|
|
13
|
+
width: '100%',
|
|
14
|
+
};
|
|
15
|
+
export const labelStyles = {
|
|
16
|
+
fontSize: '0.875rem',
|
|
17
|
+
fontWeight: 600,
|
|
18
|
+
color: 'hsl(var(--card-foreground))',
|
|
19
|
+
};
|
|
20
|
+
export const containerStyles = {
|
|
21
|
+
position: 'relative',
|
|
22
|
+
width: '100%',
|
|
23
|
+
};
|
|
24
|
+
export const innerStyles = {
|
|
25
|
+
display: 'flex',
|
|
26
|
+
flexWrap: 'wrap',
|
|
27
|
+
alignItems: 'center',
|
|
28
|
+
gap: '0.25rem',
|
|
29
|
+
borderRadius: 'var(--radius-md)',
|
|
30
|
+
borderWidth: '1px',
|
|
31
|
+
borderStyle: 'solid',
|
|
32
|
+
borderColor: 'hsl(var(--border))',
|
|
33
|
+
backgroundColor: 'hsl(var(--background))',
|
|
34
|
+
padding: '0.5rem',
|
|
35
|
+
boxSizing: 'border-box',
|
|
36
|
+
};
|
|
37
|
+
export const innerBorderlessStyles = {
|
|
38
|
+
borderWidth: 0,
|
|
39
|
+
};
|
|
40
|
+
export const innerInvalidStyles = {
|
|
41
|
+
borderColor: 'hsl(var(--destructive))',
|
|
42
|
+
};
|
|
43
|
+
export const tagTextStyles = {
|
|
44
|
+
flexGrow: 1,
|
|
45
|
+
overflow: 'hidden',
|
|
46
|
+
textOverflow: 'ellipsis',
|
|
47
|
+
whiteSpace: 'nowrap',
|
|
48
|
+
textAlign: 'left',
|
|
49
|
+
fontSize: '0.875rem',
|
|
50
|
+
fontWeight: 400,
|
|
51
|
+
margin: 0,
|
|
52
|
+
};
|
|
53
|
+
export const inputStyles = {
|
|
54
|
+
minWidth: '120px',
|
|
55
|
+
flex: 1,
|
|
56
|
+
backgroundColor: 'transparent',
|
|
57
|
+
fontSize: '0.875rem',
|
|
58
|
+
color: 'hsl(var(--foreground))',
|
|
59
|
+
border: 'none',
|
|
60
|
+
outline: 'none',
|
|
61
|
+
padding: 0,
|
|
62
|
+
fontFamily: 'inherit',
|
|
63
|
+
lineHeight: '1.5',
|
|
64
|
+
};
|
|
65
|
+
export const removeIconStyles = {
|
|
66
|
+
height: '0.75rem',
|
|
67
|
+
width: '0.75rem',
|
|
68
|
+
flexShrink: 0,
|
|
69
|
+
cursor: 'pointer',
|
|
70
|
+
};
|
|
71
|
+
export const fieldStyles = {
|
|
72
|
+
display: 'flex',
|
|
73
|
+
flexDirection: 'column',
|
|
74
|
+
gap: '0.25rem',
|
|
75
|
+
width: '100%',
|
|
76
|
+
};
|
|
77
|
+
export const errorStyles = {
|
|
78
|
+
margin: 0,
|
|
79
|
+
fontSize: '0.75rem',
|
|
80
|
+
lineHeight: '1.25rem',
|
|
81
|
+
color: 'hsl(var(--destructive))',
|
|
82
|
+
};
|
|
@@ -1,28 +1,4 @@
|
|
|
1
|
-
import type { CSSProperties } from 'react';
|
|
2
1
|
import type { Theme } from '@a2ui/web_core/types/types';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*/
|
|
6
|
-
export declare const glchatTextFieldComponents: Theme['components']['TextField'];
|
|
7
|
-
/**
|
|
8
|
-
* TextField container inline styles.
|
|
9
|
-
*/
|
|
10
|
-
export declare const glchatTextFieldContainerStyles: CSSProperties;
|
|
11
|
-
/**
|
|
12
|
-
* Label inline styles.
|
|
13
|
-
*/
|
|
14
|
-
export declare const glchatTextFieldLabelStyles: CSSProperties;
|
|
15
|
-
export declare const glchatTextFieldFontStyles: CSSProperties;
|
|
16
|
-
/**
|
|
17
|
-
* Input inline styles aligned with the glchat-ui Input component.
|
|
18
|
-
*/
|
|
19
|
-
export declare const glchatTextFieldInputStyles: CSSProperties;
|
|
20
|
-
/**
|
|
21
|
-
* Textarea wrapper.
|
|
22
|
-
*/
|
|
23
|
-
export declare const glchatTextFieldTextareaWrapperStyles: CSSProperties;
|
|
24
|
-
/**
|
|
25
|
-
* Textarea inline styles aligned with glchat-ui Textarea component.
|
|
26
|
-
*/
|
|
27
|
-
export declare const glchatTextFieldTextareaStyles: CSSProperties;
|
|
2
|
+
export declare const textFieldComponents: Theme['components']['TextField'];
|
|
3
|
+
export declare const textFieldAdditionalStyles: NonNullable<Theme['additionalStyles']>['TextField'];
|
|
28
4
|
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../src/components/a2ui/TextField/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../src/components/a2ui/TextField/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAIxD,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,WAAW,CAMhE,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,WAAW,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAC,WAAW,CACb,CAAC"}
|
|
@@ -1,82 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*/
|
|
4
|
-
export const glchatTextFieldComponents = {
|
|
1
|
+
import { textFieldInputStyles } from '../../ui/TextField/theme.js';
|
|
2
|
+
export const textFieldComponents = {
|
|
5
3
|
container: {},
|
|
6
|
-
element: {},
|
|
7
4
|
label: {},
|
|
5
|
+
element: {
|
|
6
|
+
'glchat-a2ui-text-field': true,
|
|
7
|
+
},
|
|
8
8
|
};
|
|
9
|
-
|
|
10
|
-
* TextField container inline styles.
|
|
11
|
-
*/
|
|
12
|
-
export const glchatTextFieldContainerStyles = {
|
|
13
|
-
display: 'flex',
|
|
14
|
-
flexDirection: 'column',
|
|
15
|
-
gap: '0.5rem',
|
|
16
|
-
width: '100%',
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* Label inline styles.
|
|
20
|
-
*/
|
|
21
|
-
export const glchatTextFieldLabelStyles = {
|
|
22
|
-
fontSize: '0.875rem',
|
|
23
|
-
fontWeight: '600',
|
|
24
|
-
color: 'hsl(var(--card-foreground))',
|
|
25
|
-
};
|
|
26
|
-
export const glchatTextFieldFontStyles = {
|
|
27
|
-
fontFamily: 'inherit',
|
|
28
|
-
lineHeight: '1.5',
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* Input inline styles aligned with the glchat-ui Input component.
|
|
32
|
-
*/
|
|
33
|
-
export const glchatTextFieldInputStyles = {
|
|
34
|
-
...glchatTextFieldFontStyles,
|
|
35
|
-
height: '2.5rem',
|
|
36
|
-
width: '100%',
|
|
37
|
-
borderRadius: 'var(--radius-md)',
|
|
38
|
-
borderWidth: '1px',
|
|
39
|
-
borderStyle: 'solid',
|
|
40
|
-
borderColor: 'hsl(var(--border))',
|
|
41
|
-
backgroundColor: 'hsl(var(--background))',
|
|
42
|
-
paddingTop: '0.5rem',
|
|
43
|
-
paddingBottom: '0.5rem',
|
|
44
|
-
paddingLeft: '0.75rem',
|
|
45
|
-
paddingRight: '0.75rem',
|
|
46
|
-
fontSize: '0.875rem',
|
|
47
|
-
color: 'hsl(var(--foreground))',
|
|
48
|
-
caretColor: 'currentColor',
|
|
49
|
-
boxSizing: 'border-box',
|
|
50
|
-
};
|
|
51
|
-
/**
|
|
52
|
-
* Textarea wrapper.
|
|
53
|
-
*/
|
|
54
|
-
export const glchatTextFieldTextareaWrapperStyles = {
|
|
55
|
-
position: 'relative',
|
|
56
|
-
height: '100%',
|
|
57
|
-
};
|
|
58
|
-
/**
|
|
59
|
-
* Textarea inline styles aligned with glchat-ui Textarea component.
|
|
60
|
-
*/
|
|
61
|
-
export const glchatTextFieldTextareaStyles = {
|
|
62
|
-
...glchatTextFieldFontStyles,
|
|
63
|
-
display: 'flex',
|
|
64
|
-
minHeight: '80px',
|
|
65
|
-
width: '100%',
|
|
66
|
-
overflowY: 'auto',
|
|
67
|
-
whiteSpace: 'pre-wrap',
|
|
68
|
-
overflowWrap: 'break-word',
|
|
69
|
-
borderRadius: 'var(--radius-md)',
|
|
70
|
-
borderWidth: '1px',
|
|
71
|
-
borderStyle: 'solid',
|
|
72
|
-
borderColor: 'hsl(var(--border))',
|
|
73
|
-
backgroundColor: 'hsl(var(--background))',
|
|
74
|
-
paddingTop: '0.5rem',
|
|
75
|
-
paddingBottom: '0.5rem',
|
|
76
|
-
paddingLeft: '0.75rem',
|
|
77
|
-
paddingRight: '0.75rem',
|
|
78
|
-
fontSize: '0.875rem',
|
|
79
|
-
color: 'hsl(var(--foreground))',
|
|
80
|
-
caretColor: 'currentColor',
|
|
81
|
-
boxSizing: 'border-box',
|
|
82
|
-
};
|
|
9
|
+
export const textFieldAdditionalStyles = textFieldInputStyles;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Theme } from '@a2ui/web_core/types/types';
|
|
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/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAExD,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,15 @@
|
|
|
1
|
+
import type { ButtonHTMLAttributes, CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import { type ButtonVariant } from './theme.js';
|
|
3
|
+
export type ButtonProps = {
|
|
4
|
+
variant?: ButtonVariant;
|
|
5
|
+
className?: string;
|
|
6
|
+
style?: CSSProperties;
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
} & Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'style'>;
|
|
9
|
+
export declare const Button: import("react").ForwardRefExoticComponent<{
|
|
10
|
+
variant?: ButtonVariant;
|
|
11
|
+
className?: string;
|
|
12
|
+
style?: CSSProperties;
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
} & Omit<ButtonHTMLAttributes<HTMLButtonElement>, "style"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
15
|
+
//# sourceMappingURL=Button.d.ts.map
|
|
@@ -0,0 +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;AAE5E,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;8GA+BpB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import { buttonBaseStyles, getButtonVariantStyles, } from './theme.js';
|
|
5
|
+
function mergeStyles(variant, style) {
|
|
6
|
+
return {
|
|
7
|
+
...buttonBaseStyles,
|
|
8
|
+
...getButtonVariantStyles(variant),
|
|
9
|
+
...style,
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export const Button = forwardRef(function Button({ variant = 'outline', className, style, children, type = 'button', ...props }, ref) {
|
|
13
|
+
const buttonClassName = ['glchat-a2ui-button', className].filter(Boolean).join(' ');
|
|
14
|
+
return (_jsx("button", { ref: ref, type: type, className: buttonClassName, style: mergeStyles(variant, style), ...props, children: children }));
|
|
15
|
+
});
|
|
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;AAE5E,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;8GAoCrB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import { buttonBaseStyles, getButtonVariantStyles, } from './theme.js';
|
|
5
|
+
function mergeStyles(variant, style) {
|
|
6
|
+
return {
|
|
7
|
+
textDecoration: 'none',
|
|
8
|
+
...buttonBaseStyles,
|
|
9
|
+
...getButtonVariantStyles(variant),
|
|
10
|
+
...style,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export const ButtonAsLink = forwardRef(function ButtonAsLink({ variant = 'outline', className, style, children, href, target, rel, ...props }, ref) {
|
|
14
|
+
const linkClassName = ['glchat-a2ui-button', className].filter(Boolean).join(' ');
|
|
15
|
+
return (_jsx("a", { ref: ref, href: href, className: linkClassName, style: mergeStyles(variant, style), ...props, target: target, rel: target === '_blank' ? (rel ?? 'noopener noreferrer') : rel, children: children }));
|
|
16
|
+
});
|
|
17
|
+
ButtonAsLink.displayName = 'ButtonAsLink';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
export type ButtonVariant = 'primary' | 'destructive' | 'outline';
|
|
3
|
+
export declare const buttonBaseStyles: CSSProperties;
|
|
4
|
+
export declare function getButtonVariantStyles(variant: ButtonVariant): CSSProperties;
|
|
5
|
+
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/Button/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,CAAC;AAElE,eAAO,MAAM,gBAAgB,EAAE,aAiBb,CAAC;AAEnB,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,aAAa,GAAG,aAAa,CAwC5E"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export const buttonBaseStyles = {
|
|
2
|
+
display: 'inline-flex',
|
|
3
|
+
alignItems: 'center',
|
|
4
|
+
justifyContent: 'center',
|
|
5
|
+
whiteSpace: 'nowrap',
|
|
6
|
+
borderWidth: '1px',
|
|
7
|
+
borderStyle: 'solid',
|
|
8
|
+
borderRadius: '10px',
|
|
9
|
+
fontWeight: '600',
|
|
10
|
+
fontSize: '1rem',
|
|
11
|
+
lineHeight: '1.5rem',
|
|
12
|
+
padding: '10px 16px',
|
|
13
|
+
cursor: 'pointer',
|
|
14
|
+
transitionProperty: 'color, background-color, background-image, border-color, box-shadow',
|
|
15
|
+
transitionTimingFunction: 'cubic-bezier(0.4, 0, 0.2, 1)',
|
|
16
|
+
transitionDuration: '150ms',
|
|
17
|
+
'--glchat-button-ring-color': 'hsl(var(--ring))',
|
|
18
|
+
};
|
|
19
|
+
export function getButtonVariantStyles(variant) {
|
|
20
|
+
if (variant === 'primary') {
|
|
21
|
+
return {
|
|
22
|
+
backgroundColor: 'hsl(var(--primary))',
|
|
23
|
+
borderColor: 'hsl(var(--primary))',
|
|
24
|
+
color: 'hsl(var(--primary-foreground))',
|
|
25
|
+
'--glchat-button-bg-hover': 'linear-gradient(hsla(var(--hover)), hsla(var(--hover))), linear-gradient(hsl(var(--primary)), hsl(var(--primary)))',
|
|
26
|
+
'--glchat-button-border-hover': 'hsl(var(--primary))',
|
|
27
|
+
'--glchat-button-bg-active': 'linear-gradient(hsla(var(--hover)), hsla(var(--hover))), linear-gradient(hsl(var(--primary)), hsl(var(--primary)))',
|
|
28
|
+
'--glchat-button-border-active': 'hsl(var(--primary))',
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
if (variant === 'destructive') {
|
|
32
|
+
return {
|
|
33
|
+
backgroundColor: 'hsl(var(--destructive))',
|
|
34
|
+
borderColor: 'hsl(var(--destructive))',
|
|
35
|
+
color: 'hsl(var(--destructive-foreground))',
|
|
36
|
+
'--glchat-button-bg-hover': 'linear-gradient(hsla(var(--hover)), hsla(var(--hover))), linear-gradient(hsl(var(--destructive)), hsl(var(--destructive)))',
|
|
37
|
+
'--glchat-button-border-hover': 'hsl(var(--destructive))',
|
|
38
|
+
'--glchat-button-bg-active': 'linear-gradient(hsla(var(--hover)), hsla(var(--hover))), linear-gradient(hsl(var(--destructive)), hsl(var(--destructive)))',
|
|
39
|
+
'--glchat-button-border-active': 'hsl(var(--destructive))',
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
backgroundColor: 'hsl(var(--background))',
|
|
44
|
+
borderColor: 'hsl(var(--border))',
|
|
45
|
+
color: 'hsl(var(--foreground))',
|
|
46
|
+
'--glchat-button-bg-hover': 'linear-gradient(hsla(var(--hover)), hsla(var(--hover))), linear-gradient(hsl(var(--background)), hsl(var(--background)))',
|
|
47
|
+
'--glchat-button-border-hover': 'hsl(var(--border))',
|
|
48
|
+
'--glchat-button-bg-active': 'linear-gradient(hsla(var(--hover)), hsla(var(--hover))), linear-gradient(hsl(var(--background)), hsl(var(--background)))',
|
|
49
|
+
'--glchat-button-border-active': 'hsl(var(--border))',
|
|
50
|
+
};
|
|
51
|
+
}
|
|
@@ -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: ['glchat-a2ui-checkbox', className].filter(Boolean).join(' '), style: { ...
|
|
6
|
+
import { checkboxIndicatorStyles, checkboxRootStyles, } from './theme.js';
|
|
7
|
+
const Checkbox = React.forwardRef(({ className, style, ...props }, ref) => (_jsx(CheckboxPrimitive.Root, { ref: ref, className: ['glchat-a2ui-checkbox', className].filter(Boolean).join(' '), style: { ...checkboxRootStyles, ...style }, ...props, children: _jsx(CheckboxPrimitive.Indicator, { style: checkboxIndicatorStyles, children: _jsx(Check, { style: { height: '1rem', width: '1rem' }, strokeWidth: 1.5, "aria-hidden": true }) }) })));
|
|
8
8
|
Checkbox.displayName = CheckboxPrimitive.Root.displayName;
|
|
9
9
|
export { Checkbox };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CSSProperties } from 'react';
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
2
|
+
export declare const checkboxRootStyles: CSSProperties;
|
|
3
|
+
export declare const checkboxIndicatorStyles: CSSProperties;
|
|
4
|
+
export declare const checkboxLabelStyles: CSSProperties;
|
|
5
5
|
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/Checkbox/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/Checkbox/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,eAAO,MAAM,kBAAkB,EAAE,aAchC,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,aAKrC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,aAIjC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const
|
|
1
|
+
export const checkboxRootStyles = {
|
|
2
2
|
height: '1rem',
|
|
3
3
|
width: '1rem',
|
|
4
4
|
flexShrink: 0,
|
|
@@ -13,13 +13,13 @@ export const glchatCheckboxRootStyles = {
|
|
|
13
13
|
cursor: 'pointer',
|
|
14
14
|
boxSizing: 'border-box',
|
|
15
15
|
};
|
|
16
|
-
export const
|
|
16
|
+
export const checkboxIndicatorStyles = {
|
|
17
17
|
display: 'flex',
|
|
18
18
|
alignItems: 'center',
|
|
19
19
|
justifyContent: 'center',
|
|
20
20
|
color: 'hsl(var(--primary-foreground))',
|
|
21
21
|
};
|
|
22
|
-
export const
|
|
22
|
+
export const checkboxLabelStyles = {
|
|
23
23
|
fontSize: '0.875rem',
|
|
24
24
|
color: 'hsl(var(--foreground))',
|
|
25
25
|
lineHeight: '1.25rem',
|