glchat-a2ui-react-renderer 0.2.4 → 0.2.6
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/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 -0
- package/dist/src/components/{Button → a2ui/Button}/Button.js +1 -1
- package/dist/src/components/a2ui/Button/theme.d.ts.map +1 -0
- package/dist/src/components/a2ui/Card/Card.d.ts.map +1 -0
- package/dist/src/components/a2ui/Card/theme.d.ts.map +1 -0
- package/dist/src/components/a2ui/CheckBox/CheckBox.d.ts +4 -0
- package/dist/src/components/a2ui/CheckBox/CheckBox.d.ts.map +1 -0
- package/dist/src/components/a2ui/CheckBox/CheckBox.js +26 -0
- package/dist/src/components/a2ui/CheckBox/theme.d.ts +11 -0
- package/dist/src/components/a2ui/CheckBox/theme.d.ts.map +1 -0
- package/dist/src/components/a2ui/CheckBox/theme.js +17 -0
- package/dist/src/components/a2ui/DateTimeInput/theme.d.ts +8 -0
- package/dist/src/components/a2ui/DateTimeInput/theme.d.ts.map +1 -0
- package/dist/src/components/a2ui/DateTimeInput/theme.js +11 -0
- package/dist/src/components/a2ui/MultipleChoice/CheckboxList.d.ts +12 -0
- package/dist/src/components/a2ui/MultipleChoice/CheckboxList.d.ts.map +1 -0
- package/dist/src/components/a2ui/MultipleChoice/CheckboxList.js +45 -0
- package/dist/src/components/a2ui/MultipleChoice/MultipleChoice.d.ts +4 -0
- package/dist/src/components/a2ui/MultipleChoice/MultipleChoice.d.ts.map +1 -0
- package/dist/src/components/a2ui/MultipleChoice/MultipleChoice.js +72 -0
- package/dist/src/components/a2ui/MultipleChoice/theme.d.ts +13 -0
- package/dist/src/components/a2ui/MultipleChoice/theme.d.ts.map +1 -0
- package/dist/src/components/a2ui/MultipleChoice/theme.js +35 -0
- package/dist/src/components/a2ui/TextField/TextField.d.ts +4 -0
- package/dist/src/components/a2ui/TextField/TextField.d.ts.map +1 -0
- package/dist/src/components/a2ui/TextField/TextField.js +54 -0
- package/dist/src/components/a2ui/TextField/theme.d.ts +28 -0
- package/dist/src/components/a2ui/TextField/theme.d.ts.map +1 -0
- package/dist/src/components/a2ui/TextField/theme.js +82 -0
- package/dist/src/components/a2ui/Timeout/Timeout.d.ts.map +1 -0
- package/dist/src/components/{Timeout → a2ui/Timeout}/Timeout.js +1 -1
- package/dist/src/components/a2ui/Timeout/theme.d.ts.map +1 -0
- package/dist/src/components/ui/Checkbox/Checkbox.d.ts +8 -0
- package/dist/src/components/ui/Checkbox/Checkbox.d.ts.map +1 -0
- package/dist/src/components/ui/Checkbox/Checkbox.js +9 -0
- package/dist/src/components/ui/Checkbox/theme.d.ts +5 -0
- package/dist/src/components/ui/Checkbox/theme.d.ts.map +1 -0
- package/dist/src/components/ui/Checkbox/theme.js +26 -0
- package/dist/src/components/ui/MultiSelect/MultiSelect.d.ts +15 -0
- package/dist/src/components/ui/MultiSelect/MultiSelect.d.ts.map +1 -0
- package/dist/src/components/ui/MultiSelect/MultiSelect.js +137 -0
- package/dist/src/components/ui/MultiSelect/theme.d.ts +18 -0
- package/dist/src/components/ui/MultiSelect/theme.d.ts.map +1 -0
- package/dist/src/components/ui/MultiSelect/theme.js +130 -0
- package/dist/src/components/ui/Select/Select.d.ts +19 -0
- package/dist/src/components/ui/Select/Select.d.ts.map +1 -0
- package/dist/src/components/ui/Select/Select.js +27 -0
- package/dist/src/components/ui/Select/theme.d.ts +29 -0
- package/dist/src/components/ui/Select/theme.d.ts.map +1 -0
- package/dist/src/components/ui/Select/theme.js +99 -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 +13 -4
- package/dist/src/utils/theme.d.ts.map +1 -1
- package/dist/src/utils/theme.js +27 -2
- package/package.json +5 -3
- package/styles/globals.css +122 -0
- package/dist/src/components/Button/Button.d.ts.map +0 -1
- package/dist/src/components/Button/theme.d.ts.map +0 -1
- package/dist/src/components/Card/Card.d.ts.map +0 -1
- package/dist/src/components/Card/theme.d.ts.map +0 -1
- package/dist/src/components/Timeout/Timeout.d.ts.map +0 -1
- package/dist/src/components/Timeout/theme.d.ts.map +0 -1
- /package/dist/src/components/{Button → a2ui/Button}/Button.d.ts +0 -0
- /package/dist/src/components/{Button → a2ui/Button}/theme.d.ts +0 -0
- /package/dist/src/components/{Button → a2ui/Button}/theme.js +0 -0
- /package/dist/src/components/{Card → a2ui/Card}/Card.d.ts +0 -0
- /package/dist/src/components/{Card → a2ui/Card}/Card.js +0 -0
- /package/dist/src/components/{Card → a2ui/Card}/theme.d.ts +0 -0
- /package/dist/src/components/{Card → a2ui/Card}/theme.js +0 -0
- /package/dist/src/components/{Timeout → a2ui/Timeout}/Timeout.d.ts +0 -0
- /package/dist/src/components/{Timeout → a2ui/Timeout}/theme.d.ts +0 -0
- /package/dist/src/components/{Timeout → a2ui/Timeout}/theme.js +0 -0
package/dist/src/Provider.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
import { ComponentRegistry, type
|
|
2
|
+
import { ComponentRegistry, type ServerToClientMessage } from '@a2ui/react';
|
|
3
|
+
import type { UserAction } from '@a2ui/web_core/types/client-event';
|
|
3
4
|
import type { Theme } from '@a2ui/web_core/types/types';
|
|
4
5
|
export type A2UIMessage = ServerToClientMessage;
|
|
5
|
-
export type ActionPayload =
|
|
6
|
-
export type ActionHandler = (action:
|
|
6
|
+
export type ActionPayload = UserAction;
|
|
7
|
+
export type ActionHandler = (action: UserAction) => void | Promise<void>;
|
|
7
8
|
export type MessageErrorHandler = (error: unknown) => void;
|
|
8
9
|
export type ProviderProps = {
|
|
9
10
|
messages?: A2UIMessage[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../src/Provider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,EAEL,iBAAiB,EAGjB,KAAK,
|
|
1
|
+
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../src/Provider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,EAEL,iBAAiB,EAGjB,KAAK,qBAAqB,EAC3B,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAKxD,MAAM,MAAM,WAAW,GAAG,qBAAqB,CAAC;AAEhD,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC;AACvC,MAAM,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAEzE,MAAM,MAAM,mBAAmB,GAAG,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;AAE3D,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC;IACzB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B,QAAQ,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,QAAQ,CAAC,EAAE,iBAAiB,CAAC;CAC9B,CAAC;AA8BF,wBAAgB,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,aAAa,CAAC,2CAsCtD;AAED,wBAAgB,eAAe,IAAI,iBAAiB,CAInD"}
|
package/dist/src/Provider.js
CHANGED
|
@@ -38,12 +38,7 @@ export function Provider(props) {
|
|
|
38
38
|
const handler = providerOnActionRef.current;
|
|
39
39
|
if (!handler)
|
|
40
40
|
return;
|
|
41
|
-
handler(
|
|
42
|
-
actionName: userAction.name,
|
|
43
|
-
sourceComponentId: userAction.sourceComponentId,
|
|
44
|
-
timestamp: userAction.timestamp,
|
|
45
|
-
context: userAction.context ?? {},
|
|
46
|
-
});
|
|
41
|
+
handler(userAction);
|
|
47
42
|
}, []);
|
|
48
43
|
// Register (or override) components after `@a2ui/react` has initialized its defaults.
|
|
49
44
|
// This avoids the official default catalog overwriting our custom component registrations.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../../src/components/a2ui/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,kBAAkB,EACxB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAM7D,wBAAgB,qBAAqB,CAAC,EACpC,IAAI,EACJ,SAAS,GACV,EAAE,QAAQ,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC,2CAwC1C"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { ComponentNode, classMapToString, stylesToObject, useA2UIComponent, } from '@a2ui/react';
|
|
3
3
|
import { useMemo } from 'react';
|
|
4
|
-
import { getGlchatButtonVariantStyles } from './theme';
|
|
4
|
+
import { getGlchatButtonVariantStyles } from './theme.js';
|
|
5
5
|
export function CustomButtonComponent({ node, surfaceId, }) {
|
|
6
6
|
const { sendAction, theme } = useA2UIComponent(node, surfaceId);
|
|
7
7
|
const { child, action, primary, destructive } = node.properties;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../src/components/a2ui/Button/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAExD,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,CAAC;AAExE;;GAEG;AACH,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAM,CAAC;AAExE;;;GAGG;AACH,eAAO,MAAM,4BAA4B,EAAE,WAAW,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAC,QAAQ,CAiB/D,CAAC;AAE5B,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,mBAAmB,GAAG,aAAa,CAwCxF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../../../../src/components/a2ui/Card/Card.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,kBAAkB,EACxB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAG3D,wBAAgB,mBAAmB,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,QAAQ,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC,2CA2B9F"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../src/components/a2ui/Card/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAExD;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,MAAM,CAE5D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,0BAA0B,EAAE,WAAW,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAC,MAAM,CAWrF,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type A2UIComponentProps } from '@a2ui/react';
|
|
2
|
+
import type { CheckboxNode } from '@a2ui/web_core/types/types';
|
|
3
|
+
export declare function CustomCheckBoxComponent({ node, surfaceId, }: Readonly<A2UIComponentProps<CheckboxNode>>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
//# sourceMappingURL=CheckBox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckBox.d.ts","sourceRoot":"","sources":["../../../../../src/components/a2ui/CheckBox/CheckBox.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAW/D,wBAAgB,uBAAuB,CAAC,EACtC,IAAI,EACJ,SAAS,GACV,EAAE,QAAQ,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAC,2CAkD5C"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { classMapToString, useA2UIComponent, } from '@a2ui/react';
|
|
4
|
+
import { useCallback, useId } from 'react';
|
|
5
|
+
import { Checkbox } from '../../ui/Checkbox/Checkbox.js';
|
|
6
|
+
import { glchatCheckboxLabelStyles } from '../../ui/Checkbox/theme.js';
|
|
7
|
+
import { glchatCheckBoxComponents, glchatCheckBoxContainerStyles, } from './theme.js';
|
|
8
|
+
export function CustomCheckBoxComponent({ node, surfaceId, }) {
|
|
9
|
+
const { theme, resolveString, resolveBoolean, setValue } = useA2UIComponent(node, surfaceId);
|
|
10
|
+
const props = node.properties;
|
|
11
|
+
const inputId = useId();
|
|
12
|
+
const label = resolveString(props.label);
|
|
13
|
+
const valuePath = props.value?.path;
|
|
14
|
+
const checked = resolveBoolean(props.value) ?? false;
|
|
15
|
+
const handleCheckedChange = useCallback((nextChecked) => {
|
|
16
|
+
if (valuePath) {
|
|
17
|
+
setValue(valuePath, nextChecked);
|
|
18
|
+
}
|
|
19
|
+
}, [valuePath, setValue]);
|
|
20
|
+
const hostStyle = node.weight === void 0 ? undefined : { '--weight': node.weight };
|
|
21
|
+
const checkBoxTheme = theme.components.CheckBox ?? glchatCheckBoxComponents;
|
|
22
|
+
const containerClass = classMapToString(checkBoxTheme.container);
|
|
23
|
+
const elementClass = classMapToString(checkBoxTheme.element);
|
|
24
|
+
const labelClass = classMapToString(checkBoxTheme.label);
|
|
25
|
+
return (_jsx("div", { className: "a2ui-checkbox", style: hostStyle, children: _jsxs("section", { className: containerClass, style: glchatCheckBoxContainerStyles, children: [_jsx(Checkbox, { id: inputId, className: elementClass, checked: checked, onCheckedChange: (state) => handleCheckedChange(state === true) }), label ? (_jsx("label", { htmlFor: inputId, className: labelClass, style: glchatCheckboxLabelStyles, children: label })) : null] }) }));
|
|
26
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
import type { Theme } from '@a2ui/web_core/types/types';
|
|
3
|
+
/**
|
|
4
|
+
* A2UI CheckBox structural class map.
|
|
5
|
+
*/
|
|
6
|
+
export declare const glchatCheckBoxComponents: Theme['components']['CheckBox'];
|
|
7
|
+
/**
|
|
8
|
+
* A2UI CheckBox row layout — checkbox + label side by side.
|
|
9
|
+
*/
|
|
10
|
+
export declare const glchatCheckBoxContainerStyles: CSSProperties;
|
|
11
|
+
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../src/components/a2ui/CheckBox/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,UAAU,CAIpE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,6BAA6B,EAAE,aAK3C,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A2UI CheckBox structural class map.
|
|
3
|
+
*/
|
|
4
|
+
export const glchatCheckBoxComponents = {
|
|
5
|
+
container: {},
|
|
6
|
+
element: {},
|
|
7
|
+
label: {},
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* A2UI CheckBox row layout — checkbox + label side by side.
|
|
11
|
+
*/
|
|
12
|
+
export const glchatCheckBoxContainerStyles = {
|
|
13
|
+
display: 'flex',
|
|
14
|
+
alignItems: 'center',
|
|
15
|
+
gap: '0.5rem',
|
|
16
|
+
width: '100%',
|
|
17
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Theme } from '@a2ui/web_core/types/types';
|
|
2
|
+
/**
|
|
3
|
+
* DateTimeInput structural class map.
|
|
4
|
+
*/
|
|
5
|
+
export declare const glchatDateTimeInputComponents: Theme['components']['DateTimeInput'];
|
|
6
|
+
/** Applied inline on the native date/time input. */
|
|
7
|
+
export declare const glchatDateTimeInputAdditionalStyles: NonNullable<Theme['additionalStyles']>['DateTimeInput'];
|
|
8
|
+
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../src/components/a2ui/DateTimeInput/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAIxD;;GAEG;AACH,eAAO,MAAM,6BAA6B,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,eAAe,CAI9E,CAAC;AAEF,oDAAoD;AACpD,eAAO,MAAM,mCAAmC,EAAE,WAAW,CAC3D,KAAK,CAAC,kBAAkB,CAAC,CAC1B,CAAC,eAAe,CAAwD,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { glchatTextFieldInputStyles } from '../TextField/theme.js';
|
|
2
|
+
/**
|
|
3
|
+
* DateTimeInput structural class map.
|
|
4
|
+
*/
|
|
5
|
+
export const glchatDateTimeInputComponents = {
|
|
6
|
+
container: {},
|
|
7
|
+
label: {},
|
|
8
|
+
element: { 'glchat-a2ui-datetime-input': true },
|
|
9
|
+
};
|
|
10
|
+
/** Applied inline on the native date/time input. */
|
|
11
|
+
export const glchatDateTimeInputAdditionalStyles = glchatTextFieldInputStyles;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { MultiSelectOption } from '../../ui/MultiSelect/theme.js';
|
|
2
|
+
export type CheckboxListProps = {
|
|
3
|
+
options: MultiSelectOption[];
|
|
4
|
+
value: string[];
|
|
5
|
+
onValueChange: (value: string[]) => void;
|
|
6
|
+
singleSelect: boolean;
|
|
7
|
+
maxSelections?: number;
|
|
8
|
+
filterable?: boolean;
|
|
9
|
+
className?: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function CheckboxList({ options, value, onValueChange, singleSelect, maxSelections, filterable, className, }: Readonly<CheckboxListProps>): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
//# sourceMappingURL=CheckboxList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckboxList.d.ts","sourceRoot":"","sources":["../../../../../src/components/a2ui/MultipleChoice/CheckboxList.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAQvE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,iBAAiB,EAAE,CAAC;IAC7B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACzC,YAAY,EAAE,OAAO,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,wBAAgB,YAAY,CAAC,EAC3B,OAAO,EACP,KAAK,EACL,aAAa,EACb,YAAY,EACZ,aAAa,EACb,UAAkB,EAClB,SAAS,GACV,EAAE,QAAQ,CAAC,iBAAiB,CAAC,2CA2E7B"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useId, useMemo, useState } from 'react';
|
|
4
|
+
import { Checkbox } from '../../ui/Checkbox/Checkbox.js';
|
|
5
|
+
import { glchatCheckboxLabelStyles } from '../../ui/Checkbox/theme.js';
|
|
6
|
+
import { glchatCheckboxListContainerStyles, glchatCheckboxListItemStyles, glchatCheckboxListSearchStyles, } from './theme.js';
|
|
7
|
+
export function CheckboxList({ options, value, onValueChange, singleSelect, maxSelections, filterable = false, className, }) {
|
|
8
|
+
const [search, setSearch] = useState('');
|
|
9
|
+
const groupId = useId();
|
|
10
|
+
const filteredOptions = useMemo(() => {
|
|
11
|
+
if (!filterable || !search.trim())
|
|
12
|
+
return options;
|
|
13
|
+
const query = search.toLocaleLowerCase();
|
|
14
|
+
return options.filter((opt) => opt.label.toLocaleLowerCase().includes(query));
|
|
15
|
+
}, [filterable, options, search]);
|
|
16
|
+
const toggleOption = (optionValue) => {
|
|
17
|
+
const isSelected = value.includes(optionValue);
|
|
18
|
+
if (singleSelect) {
|
|
19
|
+
onValueChange(isSelected ? [] : [optionValue]);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (isSelected) {
|
|
23
|
+
onValueChange(value.filter((v) => v !== optionValue));
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (maxSelections !== void 0 && value.length >= maxSelections) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
onValueChange([...value, optionValue]);
|
|
30
|
+
};
|
|
31
|
+
const listClassName = ['glchat-a2ui-checkbox-list', className].filter(Boolean).join(' ');
|
|
32
|
+
return (_jsxs("div", { className: listClassName, style: glchatCheckboxListContainerStyles, children: [filterable && (_jsx("input", { type: "text", value: search, onChange: (e) => setSearch(e.target.value), placeholder: "Search...", style: glchatCheckboxListSearchStyles })), filteredOptions.map((option) => {
|
|
33
|
+
const isSelected = value.includes(option.value);
|
|
34
|
+
const atMax = !singleSelect &&
|
|
35
|
+
maxSelections !== void 0 &&
|
|
36
|
+
value.length >= maxSelections &&
|
|
37
|
+
!isSelected;
|
|
38
|
+
const optionId = `${groupId}-${option.value}`;
|
|
39
|
+
return (_jsxs("label", { htmlFor: optionId, className: "glchat-a2ui-checkbox-option", style: {
|
|
40
|
+
...glchatCheckboxListItemStyles,
|
|
41
|
+
opacity: atMax ? 0.5 : 1,
|
|
42
|
+
cursor: atMax ? 'not-allowed' : 'pointer',
|
|
43
|
+
}, children: [_jsx(Checkbox, { id: optionId, checked: isSelected, disabled: atMax, onCheckedChange: () => toggleOption(option.value) }), _jsx("span", { style: glchatCheckboxLabelStyles, children: option.label })] }, option.value));
|
|
44
|
+
})] }));
|
|
45
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type A2UIComponentProps } from '@a2ui/react';
|
|
2
|
+
import type { MultipleChoiceNode } from '@a2ui/web_core/types/types';
|
|
3
|
+
export declare function CustomMultipleChoiceComponent({ node, surfaceId, }: Readonly<A2UIComponentProps<MultipleChoiceNode>>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
//# sourceMappingURL=MultipleChoice.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MultipleChoice.d.ts","sourceRoot":"","sources":["../../../../../src/components/a2ui/MultipleChoice/MultipleChoice.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAoGrE,wBAAgB,6BAA6B,CAAC,EAC5C,IAAI,EACJ,SAAS,GACV,EAAE,QAAQ,CAAC,kBAAkB,CAAC,kBAAkB,CAAC,CAAC,2CAuFlD"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { classMapToString, useA2UIComponent, } from '@a2ui/react';
|
|
4
|
+
import { useCallback, useMemo } from 'react';
|
|
5
|
+
import { MultiSelect } from '../../ui/MultiSelect/MultiSelect.js';
|
|
6
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, } from '../../ui/Select/Select.js';
|
|
7
|
+
import { glchatSelectTriggerLabelStyles, glchatSelectTriggerPlaceholderStyles, } from '../../ui/Select/theme.js';
|
|
8
|
+
import { CheckboxList } from './CheckboxList.js';
|
|
9
|
+
import { glchatMultipleChoiceComponents } from './theme.js';
|
|
10
|
+
function isSingleSelect(maxAllowedSelections) {
|
|
11
|
+
return !maxAllowedSelections || maxAllowedSelections <= 1;
|
|
12
|
+
}
|
|
13
|
+
/** GLChat/Standard catalog uses `variant`; A2UI schema (in code) uses `type`. */
|
|
14
|
+
function getVariant(properties) {
|
|
15
|
+
const extended = properties;
|
|
16
|
+
return extended.variant ?? properties.type;
|
|
17
|
+
}
|
|
18
|
+
function getSelectedValues(selections, getValue) {
|
|
19
|
+
if (selections?.path) {
|
|
20
|
+
const raw = getValue(selections.path);
|
|
21
|
+
if (Array.isArray(raw)) {
|
|
22
|
+
return raw.filter((item) => typeof item === 'string');
|
|
23
|
+
}
|
|
24
|
+
return [];
|
|
25
|
+
}
|
|
26
|
+
return selections?.literalArray ?? [];
|
|
27
|
+
}
|
|
28
|
+
function SingleSelectChips({ elementClass, options, value, onValueChange, }) {
|
|
29
|
+
const selectedLabel = useMemo(() => {
|
|
30
|
+
const match = options.find((opt) => opt.value === value);
|
|
31
|
+
return match?.label ?? '';
|
|
32
|
+
}, [options, value]);
|
|
33
|
+
const triggerLabelStyle = useMemo(() => ({
|
|
34
|
+
...glchatSelectTriggerLabelStyles,
|
|
35
|
+
...(selectedLabel ? undefined : glchatSelectTriggerPlaceholderStyles),
|
|
36
|
+
}), [selectedLabel]);
|
|
37
|
+
return (_jsxs(Select, { value: value, onValueChange: onValueChange, children: [_jsx(SelectTrigger, { className: `glchat-a2ui-select-trigger ${elementClass}`.trim(), "aria-label": "Select option", children: _jsx("span", { style: triggerLabelStyle, ...(selectedLabel ? {} : { 'data-placeholder': '' }), children: selectedLabel || 'Select an item' }) }), _jsx(SelectContent, { className: "glchat-a2ui-select-content", children: options.map((option) => (_jsx(SelectItem, { value: option.value, children: option.label }, option.value))) })] }));
|
|
38
|
+
}
|
|
39
|
+
export function CustomMultipleChoiceComponent({ node, surfaceId, }) {
|
|
40
|
+
const { theme, resolveString, setValue, getValue } = useA2UIComponent(node, surfaceId);
|
|
41
|
+
const { selections, options = [], maxAllowedSelections, filterable } = node.properties;
|
|
42
|
+
const variant = getVariant(node.properties);
|
|
43
|
+
const singleSelect = isSingleSelect(maxAllowedSelections);
|
|
44
|
+
const selectionsPath = selections?.path;
|
|
45
|
+
const hostStyle = node.weight === void 0 ? undefined : { '--weight': node.weight };
|
|
46
|
+
const multipleChoiceTheme = theme.components.MultipleChoice ?? glchatMultipleChoiceComponents;
|
|
47
|
+
const containerClass = classMapToString(multipleChoiceTheme.container);
|
|
48
|
+
const elementClass = classMapToString(multipleChoiceTheme.element);
|
|
49
|
+
const selectedValues = getSelectedValues(selections, getValue);
|
|
50
|
+
const resolvedOptions = useMemo(() => options.map((option) => ({
|
|
51
|
+
value: option.value,
|
|
52
|
+
label: resolveString(option.label) ?? option.value,
|
|
53
|
+
})), [options, resolveString]);
|
|
54
|
+
const handleSingleValueChange = useCallback((nextValue) => {
|
|
55
|
+
if (selectionsPath) {
|
|
56
|
+
setValue(selectionsPath, [nextValue]);
|
|
57
|
+
}
|
|
58
|
+
}, [selectionsPath, setValue]);
|
|
59
|
+
const handleMultiValueChange = useCallback((values) => {
|
|
60
|
+
if (selectionsPath) {
|
|
61
|
+
setValue(selectionsPath, values);
|
|
62
|
+
}
|
|
63
|
+
}, [selectionsPath, setValue]);
|
|
64
|
+
const wrapper = (content) => (_jsx("div", { className: "a2ui-multiplechoice", style: hostStyle, children: _jsx("section", { className: containerClass, children: content }) }));
|
|
65
|
+
if (variant === 'checkbox') {
|
|
66
|
+
return wrapper(_jsx(CheckboxList, { className: elementClass, options: resolvedOptions, value: selectedValues, onValueChange: handleMultiValueChange, singleSelect: singleSelect, maxSelections: singleSelect ? 1 : maxAllowedSelections, filterable: filterable ?? false }));
|
|
67
|
+
}
|
|
68
|
+
if (singleSelect) {
|
|
69
|
+
return wrapper(_jsx(SingleSelectChips, { elementClass: elementClass, options: resolvedOptions, value: selectedValues[0] ?? '', onValueChange: handleSingleValueChange }));
|
|
70
|
+
}
|
|
71
|
+
return wrapper(_jsx(MultiSelect, { className: elementClass, options: resolvedOptions, value: selectedValues, onValueChange: handleMultiValueChange, placeholder: "Select options", filterable: filterable ?? false, maxSelections: maxAllowedSelections }));
|
|
72
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
import type { Theme } from '@a2ui/web_core/types/types';
|
|
3
|
+
/**
|
|
4
|
+
* MultipleChoice structural class map.
|
|
5
|
+
*/
|
|
6
|
+
export declare const glchatMultipleChoiceComponents: Theme['components']['MultipleChoice'];
|
|
7
|
+
/**
|
|
8
|
+
* Checkbox variant — vertical list of options.
|
|
9
|
+
*/
|
|
10
|
+
export declare const glchatCheckboxListContainerStyles: CSSProperties;
|
|
11
|
+
export declare const glchatCheckboxListItemStyles: CSSProperties;
|
|
12
|
+
export declare const glchatCheckboxListSearchStyles: CSSProperties;
|
|
13
|
+
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +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,8BAA8B,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,gBAAgB,CAIhF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iCAAiC,EAAE,aAK/C,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,aAK1C,CAAC;AAEF,eAAO,MAAM,8BAA8B,EAAE,aAW5C,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MultipleChoice structural class map.
|
|
3
|
+
*/
|
|
4
|
+
export const glchatMultipleChoiceComponents = {
|
|
5
|
+
container: {},
|
|
6
|
+
element: {},
|
|
7
|
+
label: {},
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Checkbox variant — vertical list of options.
|
|
11
|
+
*/
|
|
12
|
+
export const glchatCheckboxListContainerStyles = {
|
|
13
|
+
display: 'flex',
|
|
14
|
+
flexDirection: 'column',
|
|
15
|
+
gap: '0.5rem',
|
|
16
|
+
width: '100%',
|
|
17
|
+
};
|
|
18
|
+
export const glchatCheckboxListItemStyles = {
|
|
19
|
+
display: 'flex',
|
|
20
|
+
alignItems: 'center',
|
|
21
|
+
gap: '0.5rem',
|
|
22
|
+
width: '100%',
|
|
23
|
+
};
|
|
24
|
+
export const glchatCheckboxListSearchStyles = {
|
|
25
|
+
width: '100%',
|
|
26
|
+
borderRadius: 'var(--radius-md)',
|
|
27
|
+
borderWidth: '1px',
|
|
28
|
+
borderStyle: 'solid',
|
|
29
|
+
borderColor: 'hsl(var(--border))',
|
|
30
|
+
backgroundColor: 'hsl(var(--background))',
|
|
31
|
+
padding: '0.5rem 0.75rem',
|
|
32
|
+
fontSize: '0.875rem',
|
|
33
|
+
color: 'hsl(var(--foreground))',
|
|
34
|
+
boxSizing: 'border-box',
|
|
35
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type A2UIComponentProps } from '@a2ui/react';
|
|
2
|
+
import type { TextFieldNode } from '@a2ui/web_core/types/types';
|
|
3
|
+
export declare function CustomTextFieldComponent({ node, surfaceId, }: Readonly<A2UIComponentProps<TextFieldNode>>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
//# sourceMappingURL=TextField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../../../../../src/components/a2ui/TextField/TextField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsC,KAAK,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAC1F,OAAO,KAAK,EAAe,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAgD7E,wBAAgB,wBAAwB,CAAC,EACvC,IAAI,EACJ,SAAS,GACV,EAAE,QAAQ,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAC,2CAuD7C"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { classMapToString, useA2UIComponent } from '@a2ui/react';
|
|
3
|
+
import { glchatTextFieldComponents, glchatTextFieldContainerStyles, glchatTextFieldInputStyles, glchatTextFieldLabelStyles, glchatTextFieldTextareaStyles, glchatTextFieldTextareaWrapperStyles, } from './theme.js';
|
|
4
|
+
const TEXT_FIELD_PLACEHOLDER = 'Please enter a value';
|
|
5
|
+
function dataModelValueToString(data) {
|
|
6
|
+
if (data == null)
|
|
7
|
+
return '';
|
|
8
|
+
if (typeof data === 'string')
|
|
9
|
+
return data;
|
|
10
|
+
if (typeof data === 'number' || typeof data === 'boolean')
|
|
11
|
+
return String(data);
|
|
12
|
+
return '';
|
|
13
|
+
}
|
|
14
|
+
function resolveStringBinding(value, resolveString, getValue) {
|
|
15
|
+
if (!value)
|
|
16
|
+
return '';
|
|
17
|
+
if (value.path) {
|
|
18
|
+
return dataModelValueToString(getValue(value.path));
|
|
19
|
+
}
|
|
20
|
+
return resolveString(value) ?? '';
|
|
21
|
+
}
|
|
22
|
+
function getInputType(textFieldType) {
|
|
23
|
+
switch (textFieldType) {
|
|
24
|
+
case 'number':
|
|
25
|
+
return 'number';
|
|
26
|
+
case 'date':
|
|
27
|
+
return 'date';
|
|
28
|
+
case 'obscured':
|
|
29
|
+
return 'password';
|
|
30
|
+
default:
|
|
31
|
+
return 'text';
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export function CustomTextFieldComponent({ node, surfaceId, }) {
|
|
35
|
+
const { theme, resolveString, setValue, getValue } = useA2UIComponent(node, surfaceId);
|
|
36
|
+
const { label, text, textFieldType } = node.properties;
|
|
37
|
+
const resolvedLabel = resolveStringBinding(label, resolveString, getValue);
|
|
38
|
+
const resolvedValue = resolveStringBinding(text, resolveString, getValue);
|
|
39
|
+
const hostStyle = node.weight === void 0 ? undefined : { '--weight': node.weight };
|
|
40
|
+
const textFieldTheme = theme.components.TextField ?? glchatTextFieldComponents;
|
|
41
|
+
const containerClass = classMapToString(textFieldTheme.container);
|
|
42
|
+
const labelClass = classMapToString(textFieldTheme.label);
|
|
43
|
+
const elementClass = classMapToString(textFieldTheme.element);
|
|
44
|
+
const isLongText = textFieldType === 'longText';
|
|
45
|
+
return (_jsx("div", { className: "a2ui-text-field", style: hostStyle, children: _jsxs("div", { className: containerClass, style: glchatTextFieldContainerStyles, children: [_jsx("label", { className: labelClass, style: glchatTextFieldLabelStyles, children: resolvedLabel }), isLongText ? (_jsx("div", { style: glchatTextFieldTextareaWrapperStyles, children: _jsx("textarea", { className: `glchat-a2ui-text-field ${elementClass}`.trim(), value: resolvedValue, placeholder: TEXT_FIELD_PLACEHOLDER, style: glchatTextFieldTextareaStyles, onChange: (e) => {
|
|
46
|
+
if (text?.path) {
|
|
47
|
+
setValue(text.path, e.target.value);
|
|
48
|
+
}
|
|
49
|
+
} }) })) : (_jsx("input", { className: `glchat-a2ui-text-field ${elementClass}`.trim(), type: getInputType(textFieldType), value: resolvedValue, placeholder: TEXT_FIELD_PLACEHOLDER, style: glchatTextFieldInputStyles, onChange: (e) => {
|
|
50
|
+
if (text?.path) {
|
|
51
|
+
setValue(text.path, e.target.value);
|
|
52
|
+
}
|
|
53
|
+
} }))] }) }));
|
|
54
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
import type { Theme } from '@a2ui/web_core/types/types';
|
|
3
|
+
/**
|
|
4
|
+
* TextField structural class map.
|
|
5
|
+
*/
|
|
6
|
+
export declare const glchatTextFieldComponents: Theme['components']['TextField'];
|
|
7
|
+
/**
|
|
8
|
+
* TextField container inline styles.
|
|
9
|
+
*/
|
|
10
|
+
export declare const glchatTextFieldContainerStyles: CSSProperties;
|
|
11
|
+
/**
|
|
12
|
+
* Label inline styles.
|
|
13
|
+
*/
|
|
14
|
+
export declare const glchatTextFieldLabelStyles: CSSProperties;
|
|
15
|
+
export declare const glchatTextFieldFontStyles: CSSProperties;
|
|
16
|
+
/**
|
|
17
|
+
* Input inline styles aligned with the glchat-ui Input component.
|
|
18
|
+
*/
|
|
19
|
+
export declare const glchatTextFieldInputStyles: CSSProperties;
|
|
20
|
+
/**
|
|
21
|
+
* Textarea wrapper.
|
|
22
|
+
*/
|
|
23
|
+
export declare const glchatTextFieldTextareaWrapperStyles: CSSProperties;
|
|
24
|
+
/**
|
|
25
|
+
* Textarea inline styles aligned with glchat-ui Textarea component.
|
|
26
|
+
*/
|
|
27
|
+
export declare const glchatTextFieldTextareaStyles: CSSProperties;
|
|
28
|
+
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../src/components/a2ui/TextField/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAExD;;GAEG;AACH,eAAO,MAAM,yBAAyB,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,WAAW,CAItE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,8BAA8B,EAAE,aAK5C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,0BAA0B,EAAE,aAIxC,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,aAGvC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,0BAA0B,EAAE,aAiBxC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oCAAoC,EAAE,aAGlD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,6BAA6B,EAAE,aAqB3C,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TextField structural class map.
|
|
3
|
+
*/
|
|
4
|
+
export const glchatTextFieldComponents = {
|
|
5
|
+
container: {},
|
|
6
|
+
element: {},
|
|
7
|
+
label: {},
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* TextField container inline styles.
|
|
11
|
+
*/
|
|
12
|
+
export const glchatTextFieldContainerStyles = {
|
|
13
|
+
display: 'flex',
|
|
14
|
+
flexDirection: 'column',
|
|
15
|
+
gap: '0.5rem',
|
|
16
|
+
width: '100%',
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Label inline styles.
|
|
20
|
+
*/
|
|
21
|
+
export const glchatTextFieldLabelStyles = {
|
|
22
|
+
fontSize: '0.875rem',
|
|
23
|
+
fontWeight: '600',
|
|
24
|
+
color: 'hsl(var(--card-foreground))',
|
|
25
|
+
};
|
|
26
|
+
export const glchatTextFieldFontStyles = {
|
|
27
|
+
fontFamily: 'inherit',
|
|
28
|
+
lineHeight: '1.5',
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Input inline styles aligned with the glchat-ui Input component.
|
|
32
|
+
*/
|
|
33
|
+
export const glchatTextFieldInputStyles = {
|
|
34
|
+
...glchatTextFieldFontStyles,
|
|
35
|
+
height: '2.5rem',
|
|
36
|
+
width: '100%',
|
|
37
|
+
borderRadius: 'var(--radius-md)',
|
|
38
|
+
borderWidth: '1px',
|
|
39
|
+
borderStyle: 'solid',
|
|
40
|
+
borderColor: 'hsl(var(--border))',
|
|
41
|
+
backgroundColor: 'hsl(var(--background))',
|
|
42
|
+
paddingTop: '0.5rem',
|
|
43
|
+
paddingBottom: '0.5rem',
|
|
44
|
+
paddingLeft: '0.75rem',
|
|
45
|
+
paddingRight: '0.75rem',
|
|
46
|
+
fontSize: '0.875rem',
|
|
47
|
+
color: 'hsl(var(--foreground))',
|
|
48
|
+
caretColor: 'currentColor',
|
|
49
|
+
boxSizing: 'border-box',
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Textarea wrapper.
|
|
53
|
+
*/
|
|
54
|
+
export const glchatTextFieldTextareaWrapperStyles = {
|
|
55
|
+
position: 'relative',
|
|
56
|
+
height: '100%',
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Textarea inline styles aligned with glchat-ui Textarea component.
|
|
60
|
+
*/
|
|
61
|
+
export const glchatTextFieldTextareaStyles = {
|
|
62
|
+
...glchatTextFieldFontStyles,
|
|
63
|
+
display: 'flex',
|
|
64
|
+
minHeight: '80px',
|
|
65
|
+
width: '100%',
|
|
66
|
+
overflowY: 'auto',
|
|
67
|
+
whiteSpace: 'pre-wrap',
|
|
68
|
+
overflowWrap: 'break-word',
|
|
69
|
+
borderRadius: 'var(--radius-md)',
|
|
70
|
+
borderWidth: '1px',
|
|
71
|
+
borderStyle: 'solid',
|
|
72
|
+
borderColor: 'hsl(var(--border))',
|
|
73
|
+
backgroundColor: 'hsl(var(--background))',
|
|
74
|
+
paddingTop: '0.5rem',
|
|
75
|
+
paddingBottom: '0.5rem',
|
|
76
|
+
paddingLeft: '0.75rem',
|
|
77
|
+
paddingRight: '0.75rem',
|
|
78
|
+
fontSize: '0.875rem',
|
|
79
|
+
color: 'hsl(var(--foreground))',
|
|
80
|
+
caretColor: 'currentColor',
|
|
81
|
+
boxSizing: 'border-box',
|
|
82
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Timeout.d.ts","sourceRoot":"","sources":["../../../../../src/components/a2ui/Timeout/Timeout.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,kBAAkB,EAExB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAM7D,wBAAgB,sBAAsB,CAAC,EACrC,IAAI,EACJ,SAAS,GACV,EAAE,QAAQ,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC,2CAwC1C"}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { classMapToString, useA2UIComponent, } from '@a2ui/react';
|
|
3
3
|
import { useEffect, useMemo, useState } from 'react';
|
|
4
4
|
import { getGlchatTimeoutTextStyle } from './theme.js';
|
|
5
|
-
import { formatAsHhMmSs, getRemainingSeconds } from '
|
|
5
|
+
import { formatAsHhMmSs, getRemainingSeconds } from '../../../utils/time.js';
|
|
6
6
|
export function CustomTimeoutComponent({ node, surfaceId, }) {
|
|
7
7
|
const { resolveString, theme } = useA2UIComponent(node, surfaceId);
|
|
8
8
|
const props = node.properties;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../src/components/a2ui/Timeout/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C;;;;GAIG;AACH,wBAAgB,yBAAyB,IAAI,aAAa,CAMzD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import type { CSSProperties } from 'react';
|
|
4
|
+
declare const Checkbox: React.ForwardRefExoticComponent<Omit<CheckboxPrimitive.CheckboxProps & React.RefAttributes<HTMLButtonElement>, "ref"> & {
|
|
5
|
+
style?: CSSProperties;
|
|
6
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
7
|
+
export { Checkbox };
|
|
8
|
+
//# sourceMappingURL=Checkbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/Checkbox/Checkbox.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,iBAAiB,MAAM,0BAA0B,CAAC;AAE9D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAW3C,QAAA,MAAM,QAAQ;YAHJ,aAAa;2CAiBrB,CAAC;AAGH,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
4
|
+
import { Check } from 'lucide-react';
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import { glchatCheckboxIndicatorStyles, glchatCheckboxRootStyles, } 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: { ...glchatCheckboxRootStyles, ...style }, ...props, children: _jsx(CheckboxPrimitive.Indicator, { style: glchatCheckboxIndicatorStyles, children: _jsx(Check, { style: { height: '1rem', width: '1rem' }, strokeWidth: 1.5, "aria-hidden": true }) }) })));
|
|
8
|
+
Checkbox.displayName = CheckboxPrimitive.Root.displayName;
|
|
9
|
+
export { Checkbox };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
export declare const glchatCheckboxRootStyles: CSSProperties;
|
|
3
|
+
export declare const glchatCheckboxIndicatorStyles: CSSProperties;
|
|
4
|
+
export declare const glchatCheckboxLabelStyles: CSSProperties;
|
|
5
|
+
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +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,wBAAwB,EAAE,aActC,CAAC;AAEF,eAAO,MAAM,6BAA6B,EAAE,aAK3C,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,aAIvC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export const glchatCheckboxRootStyles = {
|
|
2
|
+
height: '1rem',
|
|
3
|
+
width: '1rem',
|
|
4
|
+
flexShrink: 0,
|
|
5
|
+
borderRadius: 'var(--radius-sm)',
|
|
6
|
+
borderWidth: '1px',
|
|
7
|
+
borderStyle: 'solid',
|
|
8
|
+
borderColor: 'hsl(var(--primary))',
|
|
9
|
+
backgroundColor: 'hsl(var(--background))',
|
|
10
|
+
display: 'inline-flex',
|
|
11
|
+
alignItems: 'center',
|
|
12
|
+
justifyContent: 'center',
|
|
13
|
+
cursor: 'pointer',
|
|
14
|
+
boxSizing: 'border-box',
|
|
15
|
+
};
|
|
16
|
+
export const glchatCheckboxIndicatorStyles = {
|
|
17
|
+
display: 'flex',
|
|
18
|
+
alignItems: 'center',
|
|
19
|
+
justifyContent: 'center',
|
|
20
|
+
color: 'hsl(var(--primary-foreground))',
|
|
21
|
+
};
|
|
22
|
+
export const glchatCheckboxLabelStyles = {
|
|
23
|
+
fontSize: '0.875rem',
|
|
24
|
+
color: 'hsl(var(--foreground))',
|
|
25
|
+
lineHeight: '1.25rem',
|
|
26
|
+
};
|