glchat-a2ui-react-renderer 0.0.2 → 0.0.3
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 +26 -29
- package/dist/src/components/Button.d.ts.map +1 -1
- package/dist/src/components/Button.js +22 -17
- package/dist/src/components/Card.d.ts.map +1 -1
- package/dist/src/components/Card.js +6 -6
- package/dist/src/components/Checkbox.d.ts.map +1 -1
- package/dist/src/components/Checkbox.js +1 -1
- package/dist/src/components/Column.d.ts +0 -4
- package/dist/src/components/Column.d.ts.map +1 -1
- package/dist/src/components/Column.js +11 -11
- package/dist/src/components/Image.d.ts.map +1 -1
- package/dist/src/components/Image.js +9 -13
- package/dist/src/components/Input.d.ts.map +1 -1
- package/dist/src/components/Input.js +2 -2
- package/dist/src/components/Label.d.ts +1 -2
- package/dist/src/components/Label.d.ts.map +1 -1
- package/dist/src/components/Label.js +1 -3
- package/dist/src/components/Row.d.ts +0 -4
- package/dist/src/components/Row.d.ts.map +1 -1
- package/dist/src/components/Row.js +11 -11
- package/dist/src/components/Separator.d.ts.map +1 -1
- package/dist/src/components/Separator.js +4 -19
- package/dist/src/components/Text.d.ts.map +1 -1
- package/dist/src/components/Text.js +9 -12
- package/dist/src/components/TextField.d.ts +0 -3
- package/dist/src/components/TextField.d.ts.map +1 -1
- package/dist/src/components/TextField.js +3 -3
- package/dist/src/components/Timeout.d.ts +0 -6
- package/dist/src/components/Timeout.d.ts.map +1 -1
- package/dist/src/components/Timeout.js +1 -5
- package/dist/src/helpers/css.d.ts +1 -6
- package/dist/src/helpers/css.d.ts.map +1 -1
- package/dist/src/helpers/css.js +2 -8
- package/dist/src/rendering/catalog.d.ts.map +1 -1
- package/dist/src/rendering/catalog.js +3 -6
- package/dist/styles.css +394 -0
- package/package.json +9 -6
package/README.md
CHANGED
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
A2UI (Agent-to-UI) React renderer for [GLChat](https://github.com/GDP-ADMIN/glchat-sdk). Renders declarative UI from AI agent messages using the [A2UI protocol](https://a2ui.org/).
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
**This library is temporary** while waiting for the [official A2UI React renderer](https://a2ui.org/renderers/) to be released (planned Q1 2026). When the official React renderer is available, we recommend migrating to it. This implementation is structured to align with the official Lit and Angular renderers so that switching later should involve minimal changes.
|
|
5
|
+
**This library is temporary** while waiting for the [official A2UI React renderer](https://a2ui.org/renderers/) to be released (planned Q1 2026). When the official React renderer is available, we recommend migrating to the official library. This implementation is structured to align with the official Lit and Angular renderers so that switching later should involve minimal changes.
|
|
8
6
|
|
|
9
7
|
## Implementation guide
|
|
10
8
|
|
|
@@ -30,8 +28,6 @@ npm install glchat-a2ui-react-renderer
|
|
|
30
28
|
|
|
31
29
|
## Usage
|
|
32
30
|
|
|
33
|
-
One example with all props. **User actions:** subscribe to `processor.events` once; send `event.message` to the backend, then call `event.completion(messages)` after `processMessages(messages)`.
|
|
34
|
-
|
|
35
31
|
```tsx
|
|
36
32
|
import { useEffect } from 'react';
|
|
37
33
|
import {
|
|
@@ -42,46 +38,45 @@ import {
|
|
|
42
38
|
} from 'glchat-a2ui-react-renderer';
|
|
43
39
|
import type { Theme, ComponentCatalog } from 'glchat-a2ui-react-renderer';
|
|
44
40
|
|
|
41
|
+
// Import styles (required)
|
|
42
|
+
import 'glchat-a2ui-react-renderer/styles.css';
|
|
43
|
+
|
|
45
44
|
// Optional: theme = classNames per component (styling only)
|
|
46
45
|
const theme: Theme = {
|
|
47
46
|
components: {
|
|
48
|
-
Text: { body: '
|
|
49
|
-
Button: '
|
|
47
|
+
Text: { body: 'a2ui-text-body', h1: 'a2ui-text-h1' },
|
|
48
|
+
Button: 'a2ui-button a2ui-button--primary',
|
|
50
49
|
},
|
|
51
50
|
};
|
|
52
51
|
|
|
53
52
|
// Optional: catalog = replace how a component type is rendered (e.g. custom Button)
|
|
54
53
|
const catalog: ComponentCatalog = {
|
|
55
54
|
...DEFAULT_CATALOG,
|
|
56
|
-
|
|
55
|
+
Button: (data, props) => <YourButton data={data} {...props} />,
|
|
57
56
|
};
|
|
58
57
|
|
|
59
58
|
function ChatSurfaces({ messages }: { messages: string }) {
|
|
60
59
|
const { processor, surfaces, refreshSurfaces } = useA2UIProcessor();
|
|
61
60
|
|
|
62
61
|
useEffect(() => {
|
|
63
|
-
processor.
|
|
64
|
-
processor.processMessages(parseJSONLStream(messages));
|
|
62
|
+
processor.processMessages(messages);
|
|
65
63
|
refreshSurfaces();
|
|
66
64
|
}, [messages, processor, refreshSurfaces]);
|
|
67
65
|
|
|
68
|
-
// Subscribe
|
|
66
|
+
// Subscribe to user actions (button clicks, etc.).
|
|
69
67
|
useEffect(() => {
|
|
70
|
-
const unsubscribe = processor.events.subscribe((event) => {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
})
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
refreshSurfaces();
|
|
80
|
-
event.completion(messages);
|
|
81
|
-
});
|
|
68
|
+
const unsubscribe = processor.events.subscribe(async (event) => {
|
|
69
|
+
// do something with the user action (e.g. send it back to the agent)
|
|
70
|
+
try {
|
|
71
|
+
await processYourUserAction(event.message);
|
|
72
|
+
} catch (err) {
|
|
73
|
+
// handle error
|
|
74
|
+
} finally {
|
|
75
|
+
event.completion([]);
|
|
76
|
+
}
|
|
82
77
|
});
|
|
83
78
|
return unsubscribe;
|
|
84
|
-
}, [processor
|
|
79
|
+
}, [processor]);
|
|
85
80
|
|
|
86
81
|
return (
|
|
87
82
|
<>
|
|
@@ -110,10 +105,6 @@ function ChatSurfaces({ messages }: { messages: string }) {
|
|
|
110
105
|
| `theme` | No | ClassNames per component/part for built-in components. |
|
|
111
106
|
| `catalog` | No | Custom renderers: type → `(data, props) => ReactNode`; defaults to built-in catalog. |
|
|
112
107
|
|
|
113
|
-
### Streaming
|
|
114
|
-
|
|
115
|
-
Append incoming chunks, parse with `parseJSONLStream(chunk)` or your own parser, then call `processor.processMessages(allMessages)` and `refreshSurfaces()` when new messages arrive.
|
|
116
|
-
|
|
117
108
|
## Exports
|
|
118
109
|
|
|
119
110
|
- **Primary API:** `MessageProcessor`, `A2UISurface`, `A2UISurfaceProps`, `useA2UIProcessor`, `UseA2UIProcessorResult`
|
|
@@ -128,7 +119,13 @@ The default catalog includes: **Text**, **Button**, **Card**, **Row**, **Column*
|
|
|
128
119
|
|
|
129
120
|
## Styling
|
|
130
121
|
|
|
131
|
-
|
|
122
|
+
The renderer uses **plain CSS** with scoped class names (`a2ui-*`) to avoid clashes with your app's styles. Import the stylesheet in your app entry:
|
|
123
|
+
|
|
124
|
+
```tsx
|
|
125
|
+
import 'glchat-a2ui-react-renderer/styles.css';
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Override theme via CSS variables on `:root` or `.a2ui-surface` (e.g. `--a2ui-primary`, `--a2ui-destructive`). Pass a **theme** prop to supply custom `className` strings per component or part without replacing the catalog.
|
|
132
129
|
|
|
133
130
|
## Docs
|
|
134
131
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/components/Button.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAO,MAAM,0BAA0B,CAAC;AAE7D,MAAM,WAAW,WACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EACnD,YAAY,CAAC,OAAO,cAAc,CAAC;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,QAAA,MAAM,cAAc;;;;
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/components/Button.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAO,MAAM,0BAA0B,CAAC;AAE7D,MAAM,WAAW,WACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EACnD,YAAY,CAAC,OAAO,cAAc,CAAC;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,QAAA,MAAM,cAAc;;;;8EA+BlB,CAAC;AAEH,QAAA,MAAM,MAAM,2GAsBX,CAAC;AAIF,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -3,32 +3,37 @@ import { Slot } from '@radix-ui/react-slot';
|
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
4
|
import { cn } from '../helpers/css.js';
|
|
5
5
|
import { cva } from 'class-variance-authority';
|
|
6
|
-
const buttonVariants = cva(
|
|
6
|
+
const buttonVariants = cva('a2ui-button', {
|
|
7
7
|
variants: {
|
|
8
8
|
variant: {
|
|
9
|
-
primary:
|
|
10
|
-
secondary:
|
|
11
|
-
destructive:
|
|
12
|
-
'destructive-subtle':
|
|
13
|
-
outline:
|
|
14
|
-
'ghost-primary':
|
|
15
|
-
'ghost-neutral':
|
|
16
|
-
'ghost-destructive':
|
|
17
|
-
'link-primary':
|
|
18
|
-
'link-neutral':
|
|
9
|
+
primary: 'a2ui-button--primary',
|
|
10
|
+
secondary: 'a2ui-button--secondary',
|
|
11
|
+
destructive: 'a2ui-button--destructive',
|
|
12
|
+
'destructive-subtle': 'a2ui-button--destructive-subtle',
|
|
13
|
+
outline: 'a2ui-button--outline',
|
|
14
|
+
'ghost-primary': 'a2ui-button--ghost-primary',
|
|
15
|
+
'ghost-neutral': 'a2ui-button--ghost-neutral',
|
|
16
|
+
'ghost-destructive': 'a2ui-button--ghost-destructive',
|
|
17
|
+
'link-primary': 'a2ui-button--link-primary',
|
|
18
|
+
'link-neutral': 'a2ui-button--link-neutral',
|
|
19
19
|
},
|
|
20
20
|
size: {
|
|
21
|
-
tiny: '
|
|
22
|
-
small: '
|
|
23
|
-
medium: '
|
|
24
|
-
large: '
|
|
25
|
-
icon: '
|
|
21
|
+
tiny: 'a2ui-button--tiny',
|
|
22
|
+
small: 'a2ui-button--small',
|
|
23
|
+
medium: 'a2ui-button--medium',
|
|
24
|
+
large: 'a2ui-button--large',
|
|
25
|
+
icon: 'a2ui-button--icon',
|
|
26
26
|
},
|
|
27
27
|
shape: {
|
|
28
28
|
normal: '',
|
|
29
|
-
pill: '
|
|
29
|
+
pill: 'a2ui-button--pill',
|
|
30
30
|
},
|
|
31
31
|
},
|
|
32
|
+
defaultVariants: {
|
|
33
|
+
variant: 'primary',
|
|
34
|
+
size: 'medium',
|
|
35
|
+
shape: 'normal',
|
|
36
|
+
},
|
|
32
37
|
});
|
|
33
38
|
const Button = forwardRef(({ className, variant = 'primary', size = 'medium', shape = 'normal', asChild = false, ...props }, ref) => {
|
|
34
39
|
const Comp = asChild ? Slot : 'button';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../../src/components/Card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,QAAA,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../../src/components/Card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,QAAA,MAAM,IAAI,6GAKR,CAAC;AAGH,QAAA,MAAM,UAAU,6GAKd,CAAC;AAGH,QAAA,MAAM,SAAS,uHAKb,CAAC;AAGH,QAAA,MAAM,eAAe,yHAKnB,CAAC;AAGH,QAAA,MAAM,WAAW,6GAKf,CAAC;AAGH,QAAA,MAAM,UAAU,6GAKd,CAAC;AAGH,OAAO,EACL,IAAI,EACJ,WAAW,EACX,eAAe,EACf,UAAU,EACV,UAAU,EACV,SAAS,GACV,CAAC"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { cn } from '../helpers/css.js';
|
|
4
|
-
const Card = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn('
|
|
4
|
+
const Card = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn('a2ui-card', className), ...props })));
|
|
5
5
|
Card.displayName = 'Card';
|
|
6
|
-
const CardHeader = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn('
|
|
6
|
+
const CardHeader = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn('a2ui-card-header', className), ...props })));
|
|
7
7
|
CardHeader.displayName = 'CardHeader';
|
|
8
|
-
const CardTitle = React.forwardRef(({ className, ...props }, ref) => (_jsx("h3", { ref: ref, className: cn('
|
|
8
|
+
const CardTitle = React.forwardRef(({ className, ...props }, ref) => (_jsx("h3", { ref: ref, className: cn('a2ui-card-title', className), ...props })));
|
|
9
9
|
CardTitle.displayName = 'CardTitle';
|
|
10
|
-
const CardDescription = React.forwardRef(({ className, ...props }, ref) => (_jsx("p", { ref: ref, className: cn('
|
|
10
|
+
const CardDescription = React.forwardRef(({ className, ...props }, ref) => (_jsx("p", { ref: ref, className: cn('a2ui-card-description', className), ...props })));
|
|
11
11
|
CardDescription.displayName = 'CardDescription';
|
|
12
|
-
const CardContent = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn('
|
|
12
|
+
const CardContent = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn('a2ui-card-content', className), ...props })));
|
|
13
13
|
CardContent.displayName = 'CardContent';
|
|
14
|
-
const CardFooter = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn('
|
|
14
|
+
const CardFooter = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn('a2ui-card-footer', className), ...props })));
|
|
15
15
|
CardFooter.displayName = 'CardFooter';
|
|
16
16
|
export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../src/components/Checkbox.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,iBAAiB,MAAM,0BAA0B,CAAC;AAE9D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,QAAA,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../src/components/Checkbox.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,iBAAiB,MAAM,0BAA0B,CAAC;AAE9D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,QAAA,MAAM,QAAQ,iKAaZ,CAAC;AAGH,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -4,6 +4,6 @@ import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
|
4
4
|
import { Check } from 'lucide-react';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { cn } from '../helpers/css.js';
|
|
7
|
-
const Checkbox = React.forwardRef(({ className, ...props }, ref) => (_jsx(CheckboxPrimitive.Root, { ref: ref, className: cn('
|
|
7
|
+
const Checkbox = React.forwardRef(({ className, ...props }, ref) => (_jsx(CheckboxPrimitive.Root, { ref: ref, className: cn('a2ui-checkbox peer', className), ...props, children: _jsx(CheckboxPrimitive.Indicator, { className: "a2ui-checkbox-indicator", children: _jsx(Check, { width: 16, height: 16, strokeWidth: 1.5 }) }) })));
|
|
8
8
|
Checkbox.displayName = CheckboxPrimitive.Root.displayName;
|
|
9
9
|
export { Checkbox };
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A2UI Column component
|
|
3
|
-
* @param children - The content of the column
|
|
4
|
-
* @param distribution - The distribution of the column
|
|
5
|
-
* @param alignment - The alignment of the column
|
|
6
|
-
* @param className - The class name to apply to the column
|
|
7
3
|
*/
|
|
8
4
|
import type { ReactNode } from 'react';
|
|
9
5
|
interface ColumnProps {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Column.d.ts","sourceRoot":"","sources":["../../../src/components/Column.tsx"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"Column.d.ts","sourceRoot":"","sources":["../../../src/components/Column.tsx"],"names":[],"mappings":"AAEA;;GAEG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,UAAU,WAAW;IACnB,QAAQ,EAAE,SAAS,CAAC;IACpB,YAAY,CAAC,EACT,OAAO,GACP,KAAK,GACL,QAAQ,GACR,cAAc,GACd,aAAa,GACb,aAAa,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,SAAS,CAAC;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAkBD,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,YAAsB,EACtB,SAAqB,EACrB,SAAS,GACV,EAAE,WAAW,2CAab"}
|
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { cn } from '../helpers/css.js';
|
|
4
4
|
const distributionClasses = {
|
|
5
|
-
start: 'justify-start',
|
|
6
|
-
end: 'justify-end',
|
|
7
|
-
center: 'justify-center',
|
|
8
|
-
spaceBetween: 'justify-between',
|
|
9
|
-
spaceAround: 'justify-around',
|
|
10
|
-
spaceEvenly: 'justify-evenly',
|
|
5
|
+
start: 'a2ui-column--justify-start',
|
|
6
|
+
end: 'a2ui-column--justify-end',
|
|
7
|
+
center: 'a2ui-column--justify-center',
|
|
8
|
+
spaceBetween: 'a2ui-column--justify-between',
|
|
9
|
+
spaceAround: 'a2ui-column--justify-around',
|
|
10
|
+
spaceEvenly: 'a2ui-column--justify-evenly',
|
|
11
11
|
};
|
|
12
12
|
const alignmentClasses = {
|
|
13
|
-
start: 'items-start',
|
|
14
|
-
end: 'items-end',
|
|
15
|
-
center: 'items-center',
|
|
16
|
-
stretch: 'items-stretch',
|
|
13
|
+
start: 'a2ui-column--items-start',
|
|
14
|
+
end: 'a2ui-column--items-end',
|
|
15
|
+
center: 'a2ui-column--items-center',
|
|
16
|
+
stretch: 'a2ui-column--items-stretch',
|
|
17
17
|
};
|
|
18
18
|
export function A2UIColumn({ children, distribution = 'start', alignment = 'stretch', className, }) {
|
|
19
|
-
return (_jsx("div", { className: cn('
|
|
19
|
+
return (_jsx("div", { className: cn('a2ui-column', distributionClasses[distribution], alignmentClasses[alignment], className), children: children }));
|
|
20
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../../../src/components/Image.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../../../src/components/Image.tsx"],"names":[],"mappings":"AAOA,UAAU,cAAc;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,WAAW,CAAC;IAC1D,SAAS,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,WAAW,CAAC;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAgBD,wBAAgB,SAAS,CAAC,EACxB,GAAG,EACH,GAAa,EACb,SAAS,EACT,SAAS,GACV,EAAE,cAAc,2CAahB"}
|
|
@@ -2,24 +2,20 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
/**
|
|
4
4
|
* A2UI Image component
|
|
5
|
-
* @param url - The URL of the image
|
|
6
|
-
* @param fit - The fit of the image
|
|
7
|
-
* @param usageHint - The usage hint of the image
|
|
8
|
-
* @param className - The class name to apply to the image
|
|
9
5
|
*/
|
|
10
6
|
import { cn } from '../helpers/css.js';
|
|
11
7
|
const fitClasses = {
|
|
12
|
-
cover: '
|
|
13
|
-
contain: '
|
|
14
|
-
fill: '
|
|
15
|
-
none: '
|
|
16
|
-
scaleDown: '
|
|
8
|
+
cover: 'a2ui-image--cover',
|
|
9
|
+
contain: 'a2ui-image--contain',
|
|
10
|
+
fill: 'a2ui-image--fill',
|
|
11
|
+
none: 'a2ui-image--none',
|
|
12
|
+
scaleDown: 'a2ui-image--scale-down',
|
|
17
13
|
};
|
|
18
14
|
const usageHintClasses = {
|
|
19
|
-
avatar: '
|
|
20
|
-
hero: '
|
|
21
|
-
thumbnail: '
|
|
15
|
+
avatar: 'a2ui-image--avatar',
|
|
16
|
+
hero: 'a2ui-image--hero',
|
|
17
|
+
thumbnail: 'a2ui-image--thumbnail',
|
|
22
18
|
};
|
|
23
19
|
export function A2UIImage({ url, fit = 'cover', usageHint, className, }) {
|
|
24
|
-
return (_jsx("img", { src: url, alt: "a2ui image", className: cn('
|
|
20
|
+
return (_jsx("img", { src: url, alt: "a2ui image", className: cn('a2ui-image', fitClasses[fit], usageHint && usageHintClasses[usageHint], className) }));
|
|
25
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../src/components/Input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,MAAM,WAAW,UACf,SAAQ,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC;IACnD,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,QAAA,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../src/components/Input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,MAAM,WAAW,UACf,SAAQ,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC;IACnD,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,QAAA,MAAM,KAAK,qFAqBV,CAAC;AAGF,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
|
@@ -2,8 +2,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { cn } from '../helpers/css.js';
|
|
4
4
|
const Input = React.forwardRef(({ actionElement, className, type, error, ...props }, ref) => {
|
|
5
|
-
return (_jsxs("div", { className: "
|
|
6
|
-
(type === 'text' || type === 'password' || type === 'number') && (_jsx("span", { className: "
|
|
5
|
+
return (_jsxs("div", { className: "a2ui-input-wrap", children: [_jsx("input", { type: type, className: cn('a2ui-input', { 'invalid': error }, className), ref: ref, ...props }), actionElement &&
|
|
6
|
+
(type === 'text' || type === 'password' || type === 'number') && (_jsx("span", { className: "a2ui-input-action", children: actionElement }))] }));
|
|
7
7
|
});
|
|
8
8
|
Input.displayName = 'Input';
|
|
9
9
|
export { Input };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
|
|
4
|
-
declare const Label: React.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & VariantProps<(props?: import("class-variance-authority/types").ClassProp | undefined) => string> & React.RefAttributes<HTMLLabelElement>>;
|
|
3
|
+
declare const Label: React.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & React.RefAttributes<HTMLLabelElement>>;
|
|
5
4
|
export { Label };
|
|
6
5
|
//# sourceMappingURL=Label.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Label.d.ts","sourceRoot":"","sources":["../../../src/components/Label.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,cAAc,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Label.d.ts","sourceRoot":"","sources":["../../../src/components/Label.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,cAAc,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,QAAA,MAAM,KAAK,yJAST,CAAC;AAGH,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
|
@@ -3,8 +3,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { cn } from '../helpers/css.js';
|
|
6
|
-
|
|
7
|
-
const labelVariants = cva('text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70');
|
|
8
|
-
const Label = React.forwardRef(({ className, ...props }, ref) => (_jsx(LabelPrimitive.Root, { ref: ref, className: cn(labelVariants(), className), ...props })));
|
|
6
|
+
const Label = React.forwardRef(({ className, ...props }, ref) => (_jsx(LabelPrimitive.Root, { ref: ref, className: cn('a2ui-label', className), ...props })));
|
|
9
7
|
Label.displayName = LabelPrimitive.Root.displayName;
|
|
10
8
|
export { Label };
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A2UI Row component
|
|
3
|
-
* @param children - The content of the row
|
|
4
|
-
* @param distribution - The distribution of the row
|
|
5
|
-
* @param alignment - The alignment of the row
|
|
6
|
-
* @param className - The class name to apply to the row
|
|
7
3
|
*/
|
|
8
4
|
import type { ReactNode } from 'react';
|
|
9
5
|
interface RowProps {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Row.d.ts","sourceRoot":"","sources":["../../../src/components/Row.tsx"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"Row.d.ts","sourceRoot":"","sources":["../../../src/components/Row.tsx"],"names":[],"mappings":"AAEA;;GAEG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,UAAU,QAAQ;IAChB,QAAQ,EAAE,SAAS,CAAC;IACpB,YAAY,CAAC,EACT,OAAO,GACP,KAAK,GACL,QAAQ,GACR,cAAc,GACd,aAAa,GACb,aAAa,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,SAAS,CAAC;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAkBD,wBAAgB,OAAO,CAAC,EACtB,QAAQ,EACR,YAAsB,EACtB,SAAqB,EACrB,SAAS,GACV,EAAE,QAAQ,2CAaV"}
|
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { cn } from '../helpers/css.js';
|
|
4
4
|
const distributionClasses = {
|
|
5
|
-
start: 'justify-start',
|
|
6
|
-
end: 'justify-end',
|
|
7
|
-
center: 'justify-center',
|
|
8
|
-
spaceBetween: 'justify-between',
|
|
9
|
-
spaceAround: 'justify-around',
|
|
10
|
-
spaceEvenly: 'justify-evenly',
|
|
5
|
+
start: 'a2ui-row--justify-start',
|
|
6
|
+
end: 'a2ui-row--justify-end',
|
|
7
|
+
center: 'a2ui-row--justify-center',
|
|
8
|
+
spaceBetween: 'a2ui-row--justify-between',
|
|
9
|
+
spaceAround: 'a2ui-row--justify-around',
|
|
10
|
+
spaceEvenly: 'a2ui-row--justify-evenly',
|
|
11
11
|
};
|
|
12
12
|
const alignmentClasses = {
|
|
13
|
-
start: 'items-start',
|
|
14
|
-
end: 'items-end',
|
|
15
|
-
center: 'items-center',
|
|
16
|
-
stretch: 'items-stretch',
|
|
13
|
+
start: 'a2ui-row--items-start',
|
|
14
|
+
end: 'a2ui-row--items-end',
|
|
15
|
+
center: 'a2ui-row--items-center',
|
|
16
|
+
stretch: 'a2ui-row--items-stretch',
|
|
17
17
|
};
|
|
18
18
|
export function A2UIRow({ children, distribution = 'start', alignment = 'stretch', className, }) {
|
|
19
|
-
return (_jsx("div", { className: cn('
|
|
19
|
+
return (_jsx("div", { className: cn('a2ui-row', distributionClasses[distribution], alignmentClasses[alignment], className), children: children }));
|
|
20
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Separator.d.ts","sourceRoot":"","sources":["../../../src/components/Separator.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Separator.d.ts","sourceRoot":"","sources":["../../../src/components/Separator.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,kBAAkB,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,QAAA,MAAM,SAAS,6JAuBd,CAAC;AAGF,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -1,26 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
/*
|
|
4
|
-
* Separator.tsx
|
|
5
|
-
*
|
|
6
|
-
* Authors:
|
|
7
|
-
* Vincent Chuardi (vincent.chuardi@gdplabs.id)
|
|
8
|
-
* Created at: July 17th 2024
|
|
9
|
-
* -----
|
|
10
|
-
* Last Modified: October 16th 2024
|
|
11
|
-
* Modified By: Ryan Ignatius Hadiwijaya (ryan.i.hadiwijaya@gdplabs.id)
|
|
12
|
-
* -----
|
|
13
|
-
* Reviewers:
|
|
14
|
-
*
|
|
15
|
-
* ---
|
|
16
|
-
* References:
|
|
17
|
-
* NONE
|
|
18
|
-
* ---
|
|
19
|
-
* Copyright (c) 2024 GDP LABS. All rights reserved.
|
|
20
|
-
*/
|
|
21
3
|
import * as SeparatorPrimitive from '@radix-ui/react-separator';
|
|
22
4
|
import * as React from 'react';
|
|
23
5
|
import { cn } from '../helpers/css.js';
|
|
24
|
-
const Separator = React.forwardRef(({ className, orientation = 'horizontal', decorative = true, ...props }, ref) => (_jsx(SeparatorPrimitive.Root, { ref: ref, decorative: decorative, orientation: orientation, className: cn('
|
|
6
|
+
const Separator = React.forwardRef(({ className, orientation = 'horizontal', decorative = true, ...props }, ref) => (_jsx(SeparatorPrimitive.Root, { ref: ref, decorative: decorative, orientation: orientation, className: cn('a2ui-separator', {
|
|
7
|
+
'a2ui-separator--horizontal': orientation === 'horizontal',
|
|
8
|
+
'a2ui-separator--vertical': orientation === 'vertical',
|
|
9
|
+
}, className), ...props })));
|
|
25
10
|
Separator.displayName = SeparatorPrimitive.Root.displayName;
|
|
26
11
|
export { Separator };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../../src/components/Text.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../../src/components/Text.tsx"],"names":[],"mappings":"AAOA,UAAU,SAAS;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS,CAAC;IAClE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAYD,wBAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,SAAkB,EAAE,SAAS,EAAE,EAAE,SAAS,2CAM1E"}
|
|
@@ -2,21 +2,18 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
/**
|
|
4
4
|
* A2UI Text component
|
|
5
|
-
* @param text - The text to display
|
|
6
|
-
* @param usageHint - The usage hint of the text
|
|
7
|
-
* @param className - The class name to apply to the text
|
|
8
5
|
*/
|
|
9
6
|
import { cn } from '../helpers/css.js';
|
|
7
|
+
const baseClasses = {
|
|
8
|
+
h1: 'a2ui-text-h1',
|
|
9
|
+
h2: 'a2ui-text-h2',
|
|
10
|
+
h3: 'a2ui-text-h3',
|
|
11
|
+
h4: 'a2ui-text-h4',
|
|
12
|
+
h5: 'a2ui-text-h5',
|
|
13
|
+
body: 'a2ui-text-body',
|
|
14
|
+
caption: 'a2ui-text-caption',
|
|
15
|
+
};
|
|
10
16
|
export function A2UIText({ text, usageHint = 'body', className }) {
|
|
11
|
-
const baseClasses = {
|
|
12
|
-
h1: 'text-4xl font-bold',
|
|
13
|
-
h2: 'text-3xl font-bold',
|
|
14
|
-
h3: 'text-2xl font-semibold',
|
|
15
|
-
h4: 'text-xl font-semibold',
|
|
16
|
-
h5: 'text-lg font-medium',
|
|
17
|
-
body: 'text-base',
|
|
18
|
-
caption: 'text-sm text-muted-foreground',
|
|
19
|
-
};
|
|
20
17
|
const Component = ['body', 'caption'].includes(usageHint) ? 'p' : usageHint;
|
|
21
18
|
return (_jsx(Component, { className: cn(baseClasses[usageHint], className), children: text }));
|
|
22
19
|
}
|
|
@@ -4,11 +4,8 @@ interface A2UITextFieldProps {
|
|
|
4
4
|
onChange?: (value: string | number) => void;
|
|
5
5
|
textFieldType?: 'shortText' | 'longText' | 'number' | 'obscured' | 'date';
|
|
6
6
|
validationRegexp?: string;
|
|
7
|
-
/** Container wrapper className (theme: TextField.container). */
|
|
8
7
|
className?: string;
|
|
9
|
-
/** Label className (theme: TextField.label). */
|
|
10
8
|
labelClassName?: string;
|
|
11
|
-
/** Input/textarea element className (theme: TextField.element). */
|
|
12
9
|
elementClassName?: string;
|
|
13
10
|
}
|
|
14
11
|
export declare function A2UITextField({ label, value, onChange, textFieldType, validationRegexp, className, labelClassName, elementClassName, }: A2UITextFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../../../src/components/TextField.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../../../src/components/TextField.tsx"],"names":[],"mappings":"AAWA,UAAU,kBAAkB;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,KAAK,IAAI,CAAC;IAC5C,aAAa,CAAC,EAAE,WAAW,GAAG,UAAU,GAAG,QAAQ,GAAG,UAAU,GAAG,MAAM,CAAC;IAC1E,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,KAAK,EACL,QAAQ,EACR,aAA2B,EAC3B,gBAAgB,EAChB,SAAS,EACT,cAAc,EACd,gBAAgB,GACjB,EAAE,kBAAkB,2CA2DpB"}
|
|
@@ -23,9 +23,9 @@ export function A2UITextField({ label, value, onChange, textFieldType = 'shortTe
|
|
|
23
23
|
: textFieldType === 'date'
|
|
24
24
|
? 'date'
|
|
25
25
|
: 'text';
|
|
26
|
-
const inputClasses = cn('
|
|
26
|
+
const inputClasses = cn('a2ui-input a2ui-textfield-input', elementClassName);
|
|
27
27
|
if (textFieldType === 'longText') {
|
|
28
|
-
return (_jsxs("div", { className: className, children: [label && _jsx(Label, { className: labelClassName, children: label }), _jsx("textarea", { value: value, onChange: handleChange, className: cn(inputClasses, '
|
|
28
|
+
return (_jsxs("div", { className: cn('a2ui-textfield', className), children: [label && (_jsx(Label, { className: cn('a2ui-textfield-label', labelClassName), children: label })), _jsx("textarea", { value: value, onChange: handleChange, className: cn(inputClasses, 'a2ui-textarea') })] }));
|
|
29
29
|
}
|
|
30
|
-
return (_jsxs("div", { className: className, children: [label && _jsx(Label, { className: labelClassName, children: label }), _jsx(Input, { type: inputType, value: value, onChange: handleChange, pattern: validationRegexp, className: cn('
|
|
30
|
+
return (_jsxs("div", { className: cn('a2ui-textfield', className), children: [label && (_jsx(Label, { className: cn('a2ui-textfield-label', labelClassName), children: label })), _jsx(Input, { type: inputType, value: value, onChange: handleChange, pattern: validationRegexp, className: cn('a2ui-textfield-input', elementClassName) })] }));
|
|
31
31
|
}
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
export type TimeoutUsageHint = 'body' | 'caption' | 'h3' | 'h4' | 'h5';
|
|
2
2
|
export interface A2UITimeoutProps {
|
|
3
|
-
/** Target time in UTC (ISO 8601 string, e.g. '2025-02-11T15:30:00.000Z'). Countdown shows time until this moment. */
|
|
4
3
|
targetTimeUtc: string;
|
|
5
|
-
/** Text style hint */
|
|
6
4
|
usageHint?: TimeoutUsageHint;
|
|
7
5
|
className?: string;
|
|
8
6
|
}
|
|
9
|
-
/**
|
|
10
|
-
* A2UI Timeout component: displays a countdown to a target UTC time.
|
|
11
|
-
* Recomputes remaining time from the target each second to stay in sync.
|
|
12
|
-
*/
|
|
13
7
|
export declare function A2UITimeout({ targetTimeUtc, usageHint, className, }: A2UITimeoutProps): import("react/jsx-runtime").JSX.Element;
|
|
14
8
|
//# sourceMappingURL=Timeout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Timeout.d.ts","sourceRoot":"","sources":["../../../src/components/Timeout.tsx"],"names":[],"mappings":"AAQA,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEvE,MAAM,WAAW,gBAAgB;IAC/B,
|
|
1
|
+
{"version":3,"file":"Timeout.d.ts","sourceRoot":"","sources":["../../../src/components/Timeout.tsx"],"names":[],"mappings":"AAQA,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEvE,MAAM,WAAW,gBAAgB;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAiBD,wBAAgB,WAAW,CAAC,EAC1B,aAAa,EACb,SAAkB,EAClB,SAAS,GACV,EAAE,gBAAgB,2CAyBlB"}
|
|
@@ -17,10 +17,6 @@ function formatAsHhMmSs(seconds) {
|
|
|
17
17
|
const ss = s % 60;
|
|
18
18
|
return `${String(h).padStart(2, '0')}:${String(mm).padStart(2, '0')}:${String(ss).padStart(2, '0')}`;
|
|
19
19
|
}
|
|
20
|
-
/**
|
|
21
|
-
* A2UI Timeout component: displays a countdown to a target UTC time.
|
|
22
|
-
* Recomputes remaining time from the target each second to stay in sync.
|
|
23
|
-
*/
|
|
24
20
|
export function A2UITimeout({ targetTimeUtc, usageHint = 'body', className, }) {
|
|
25
21
|
const [remaining, setRemaining] = useState(() => getRemainingSeconds(targetTimeUtc));
|
|
26
22
|
useEffect(() => {
|
|
@@ -36,5 +32,5 @@ export function A2UITimeout({ targetTimeUtc, usageHint = 'body', className, }) {
|
|
|
36
32
|
return () => clearInterval(t);
|
|
37
33
|
}, [targetTimeUtc]);
|
|
38
34
|
const display = formatAsHhMmSs(remaining);
|
|
39
|
-
return (_jsx("div", { className: cn('
|
|
35
|
+
return (_jsx("div", { className: cn('a2ui-timeout', className), children: _jsx(A2UIText, { text: display, usageHint: usageHint }) }));
|
|
40
36
|
}
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { ClassValue } from 'clsx';
|
|
2
2
|
/**
|
|
3
|
-
* Conditionally joins class names
|
|
4
|
-
* @param {ClassValue[]} inputs A variadic list of class values. Each item can be:
|
|
5
|
-
* - a string (e.g., 'text-sm')
|
|
6
|
-
* - an object with conditional classes (e.g., { 'text-red-500': isError })
|
|
7
|
-
* - an array of class values
|
|
8
|
-
* @returns {string} A single string of class names with conflicts resolved according to Tailwind’s rules.
|
|
3
|
+
* Conditionally joins class names.
|
|
9
4
|
*/
|
|
10
5
|
export declare function cn(...inputs: ClassValue[]): string;
|
|
11
6
|
//# sourceMappingURL=css.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"css.d.ts","sourceRoot":"","sources":["../../../src/helpers/css.ts"],"names":[],"mappings":"AAAA,OAAa,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAExC
|
|
1
|
+
{"version":3,"file":"css.d.ts","sourceRoot":"","sources":["../../../src/helpers/css.ts"],"names":[],"mappings":"AAAA,OAAa,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAExC;;GAEG;AACH,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAElD"}
|
package/dist/src/helpers/css.js
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import clsx from 'clsx';
|
|
2
|
-
import { twMerge } from 'tailwind-merge';
|
|
3
2
|
/**
|
|
4
|
-
* Conditionally joins class names
|
|
5
|
-
* @param {ClassValue[]} inputs A variadic list of class values. Each item can be:
|
|
6
|
-
* - a string (e.g., 'text-sm')
|
|
7
|
-
* - an object with conditional classes (e.g., { 'text-red-500': isError })
|
|
8
|
-
* - an array of class values
|
|
9
|
-
* @returns {string} A single string of class names with conflicts resolved according to Tailwind’s rules.
|
|
3
|
+
* Conditionally joins class names.
|
|
10
4
|
*/
|
|
11
5
|
export function cn(...inputs) {
|
|
12
|
-
return
|
|
6
|
+
return clsx(inputs);
|
|
13
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../src/rendering/catalog.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAkBxC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,KAAK,EAAE,gBAAgB,EAAc,SAAS,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAIlF;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,SAAS,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,KAAK,IAAI,CAAC;IACzE,WAAW,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAC;IACvD,0FAA0F;IAC1F,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,yEAAyE;IACzE,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAC9B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,KAAK,EAAE,oBAAoB,KACxB,KAAK,CAAC,SAAS,CAAC;AAErB;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../src/rendering/catalog.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAkBxC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,KAAK,EAAE,gBAAgB,EAAc,SAAS,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAIlF;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,SAAS,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,KAAK,IAAI,CAAC;IACzE,WAAW,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAC;IACvD,0FAA0F;IAC1F,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,yEAAyE;IACzE,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAC9B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,KAAK,EAAE,oBAAoB,KACxB,KAAK,CAAC,SAAS,CAAC;AAErB;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;AA2NjE;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,gBAW7B,CAAC;AAEF;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,gBAAgB,EACzB,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,oBAAoB,GAC1B,KAAK,CAAC,SAAS,CAUjB"}
|
|
@@ -42,7 +42,7 @@ function renderButton(data, props) {
|
|
|
42
42
|
}
|
|
43
43
|
function renderCard(data, props) {
|
|
44
44
|
const cardClassName = props.theme?.components?.Card;
|
|
45
|
-
return (_jsx(Card, { className: cardClassName, children: _jsx(CardContent, {
|
|
45
|
+
return (_jsx(Card, { className: cardClassName, children: _jsx(CardContent, { children: props.renderChild?.(data.child) }) }));
|
|
46
46
|
}
|
|
47
47
|
function renderRow(data, props) {
|
|
48
48
|
const children = data.children ?? [];
|
|
@@ -87,7 +87,7 @@ function renderCheckBox(data, props) {
|
|
|
87
87
|
};
|
|
88
88
|
const checkboxId = props.sourceComponentId ? `${props.sourceComponentId}-checkbox` : undefined;
|
|
89
89
|
const cbTheme = props.theme?.components?.CheckBox;
|
|
90
|
-
return (_jsxs("div", { className: cn('
|
|
90
|
+
return (_jsxs("div", { className: cn('a2ui-checkbox-group', cbTheme?.container), children: [_jsx(Checkbox, { id: checkboxId, checked: Boolean(checked), onCheckedChange: handleChange, className: cbTheme?.element }), label != null && (_jsx(Label, { htmlFor: checkboxId, className: cn(cbTheme?.label), children: String(label) }))] }));
|
|
91
91
|
}
|
|
92
92
|
function renderImage(data, props) {
|
|
93
93
|
const imageClassName = props.theme?.components?.Image;
|
|
@@ -96,10 +96,7 @@ function renderImage(data, props) {
|
|
|
96
96
|
function renderDivider(data, props) {
|
|
97
97
|
const axis = data.axis ?? 'horizontal';
|
|
98
98
|
const dividerTheme = props.theme?.components?.Divider;
|
|
99
|
-
return (_jsx(Separator, { orientation: axis, className:
|
|
100
|
-
'h-px w-full': axis === 'horizontal',
|
|
101
|
-
'h-full w-px': axis === 'vertical',
|
|
102
|
-
}, dividerTheme) }));
|
|
99
|
+
return (_jsx(Separator, { orientation: axis, className: dividerTheme }));
|
|
103
100
|
}
|
|
104
101
|
function renderTimeout(data, props) {
|
|
105
102
|
const targetTimeUtc = resolveBoundValue(data.targetTimeUtc, props.dataModel);
|
package/dist/styles.css
ADDED
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Use: import 'glchat-a2ui-react-renderer/styles.css' in your app.
|
|
3
|
+
* Variables use HSL format (H S% L%) — override via :root or .a2ui-surface.
|
|
4
|
+
* Colors aligned with glchat-ui default theme.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/* ---------------------------------------------------------------------------
|
|
8
|
+
Variables (HSL: H S% L%)
|
|
9
|
+
--------------------------------------------------------------------------- */
|
|
10
|
+
:root {
|
|
11
|
+
/* From glchat-ui globals.css :root */
|
|
12
|
+
--a2ui-background: 0 0% 100%;
|
|
13
|
+
--a2ui-background-hover: 0 0% 98%;
|
|
14
|
+
--a2ui-foreground: 0 0% 11%;
|
|
15
|
+
--a2ui-muted: 0 0% 96.1%;
|
|
16
|
+
--a2ui-muted-foreground: 0 0% 45.1%;
|
|
17
|
+
--a2ui-border: 0 0% 86%;
|
|
18
|
+
|
|
19
|
+
--a2ui-primary: 198 100% 31%;
|
|
20
|
+
--a2ui-primary-foreground: 0 0% 100%;
|
|
21
|
+
--a2ui-primary-subtle: 198 57% 85%;
|
|
22
|
+
--a2ui-primary-subtle-foreground: 198 100% 28%;
|
|
23
|
+
|
|
24
|
+
--a2ui-destructive: 0 97% 59%;
|
|
25
|
+
--a2ui-destructive-foreground: 0 0% 100%;
|
|
26
|
+
--a2ui-destructive-alternate: 8 100% 97%;
|
|
27
|
+
--a2ui-destructive-alternate-foreground: 356 83% 38%;
|
|
28
|
+
|
|
29
|
+
--a2ui-ring: 198 100% 31%;
|
|
30
|
+
--a2ui-card: 0 0% 100%;
|
|
31
|
+
--a2ui-card-foreground: 0 0% 11%;
|
|
32
|
+
--a2ui-hover: 0 0% 0% / 5%;
|
|
33
|
+
--a2ui-error: 0 97% 59%;
|
|
34
|
+
|
|
35
|
+
/* Hover shades (slightly darker than base) */
|
|
36
|
+
--a2ui-primary-hover: 198 100% 26%;
|
|
37
|
+
--a2ui-primary-subtle-hover: 198 57% 78%;
|
|
38
|
+
--a2ui-destructive-hover: 0 97% 50%;
|
|
39
|
+
--a2ui-destructive-alternate-hover: 8 100% 95%;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.dark .a2ui-surface,
|
|
43
|
+
.a2ui-surface.dark {
|
|
44
|
+
/* From glchat-ui globals.css .dark */
|
|
45
|
+
--a2ui-background: 0 0% 11%;
|
|
46
|
+
--a2ui-background-hover: 0 0% 7%;
|
|
47
|
+
--a2ui-foreground: 0 0% 100%;
|
|
48
|
+
--a2ui-muted: 0 0% 14.9%;
|
|
49
|
+
--a2ui-muted-foreground: 0 0% 63.9%;
|
|
50
|
+
--a2ui-border: 0 0% 25%;
|
|
51
|
+
|
|
52
|
+
--a2ui-primary: 196 71% 39%;
|
|
53
|
+
--a2ui-primary-foreground: 0 0% 100%;
|
|
54
|
+
--a2ui-primary-subtle: 198 99% 17%;
|
|
55
|
+
--a2ui-primary-subtle-foreground: 198 57% 85%;
|
|
56
|
+
|
|
57
|
+
--a2ui-destructive: 4 100% 75%;
|
|
58
|
+
--a2ui-destructive-foreground: 0 0% 100%;
|
|
59
|
+
--a2ui-destructive-alternate: 354 92% 28%;
|
|
60
|
+
--a2ui-destructive-alternate-foreground: 8 100% 97%;
|
|
61
|
+
|
|
62
|
+
--a2ui-ring: 196 71% 39%;
|
|
63
|
+
--a2ui-card: 0 0% 11%;
|
|
64
|
+
--a2ui-card-foreground: 0 0% 100%;
|
|
65
|
+
--a2ui-hover: 0 0% 100% / 5%;
|
|
66
|
+
--a2ui-error: 4 100% 75%;
|
|
67
|
+
|
|
68
|
+
--a2ui-primary-hover: 196 71% 33%;
|
|
69
|
+
--a2ui-primary-subtle-hover: 198 99% 20%;
|
|
70
|
+
--a2ui-destructive-hover: 4 100% 65%;
|
|
71
|
+
--a2ui-destructive-alternate-hover: 354 92% 32%;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* Surface root — scoped base for embedded surfaces */
|
|
75
|
+
.a2ui-surface {
|
|
76
|
+
font-family: ui-sans-serif, system-ui, sans-serif;
|
|
77
|
+
font-size: 16px;
|
|
78
|
+
line-height: 1.5;
|
|
79
|
+
color: hsl(var(--a2ui-foreground));
|
|
80
|
+
box-sizing: border-box;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.a2ui-surface *,
|
|
84
|
+
.a2ui-surface *::before,
|
|
85
|
+
.a2ui-surface *::after {
|
|
86
|
+
box-sizing: border-box;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/* ---------------------------------------------------------------------------
|
|
90
|
+
Layout: Row, Column
|
|
91
|
+
--------------------------------------------------------------------------- */
|
|
92
|
+
.a2ui-row {
|
|
93
|
+
display: flex;
|
|
94
|
+
flex-direction: row;
|
|
95
|
+
gap: 8px;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.a2ui-row--justify-start { justify-content: flex-start; }
|
|
99
|
+
.a2ui-row--justify-end { justify-content: flex-end; }
|
|
100
|
+
.a2ui-row--justify-center { justify-content: center; }
|
|
101
|
+
.a2ui-row--justify-between { justify-content: space-between; }
|
|
102
|
+
.a2ui-row--justify-around { justify-content: space-around; }
|
|
103
|
+
.a2ui-row--justify-evenly { justify-content: space-evenly; }
|
|
104
|
+
|
|
105
|
+
.a2ui-row--items-start { align-items: flex-start; }
|
|
106
|
+
.a2ui-row--items-end { align-items: flex-end; }
|
|
107
|
+
.a2ui-row--items-center { align-items: center; }
|
|
108
|
+
.a2ui-row--items-stretch { align-items: stretch; }
|
|
109
|
+
|
|
110
|
+
.a2ui-column {
|
|
111
|
+
display: flex;
|
|
112
|
+
flex-direction: column;
|
|
113
|
+
gap: 8px;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.a2ui-column--justify-start { justify-content: flex-start; }
|
|
117
|
+
.a2ui-column--justify-end { justify-content: flex-end; }
|
|
118
|
+
.a2ui-column--justify-center { justify-content: center; }
|
|
119
|
+
.a2ui-column--justify-between { justify-content: space-between; }
|
|
120
|
+
.a2ui-column--justify-around { justify-content: space-around; }
|
|
121
|
+
.a2ui-column--justify-evenly { justify-content: space-evenly; }
|
|
122
|
+
|
|
123
|
+
.a2ui-column--items-start { align-items: flex-start; }
|
|
124
|
+
.a2ui-column--items-end { align-items: flex-end; }
|
|
125
|
+
.a2ui-column--items-center { align-items: center; }
|
|
126
|
+
.a2ui-column--items-stretch { align-items: stretch; }
|
|
127
|
+
|
|
128
|
+
/* ---------------------------------------------------------------------------
|
|
129
|
+
Text
|
|
130
|
+
--------------------------------------------------------------------------- */
|
|
131
|
+
.a2ui-text-h1 { font-size: 2.25rem; font-weight: 700; }
|
|
132
|
+
.a2ui-text-h2 { font-size: 1.875rem; font-weight: 700; }
|
|
133
|
+
.a2ui-text-h3 { font-size: 1.5rem; font-weight: 600; }
|
|
134
|
+
.a2ui-text-h4 { font-size: 1.25rem; font-weight: 600; }
|
|
135
|
+
.a2ui-text-h5 { font-size: 1.125rem; font-weight: 500; }
|
|
136
|
+
.a2ui-text-body { font-size: 1rem; }
|
|
137
|
+
.a2ui-text-caption { font-size: 0.875rem; color: hsl(var(--a2ui-muted-foreground)); }
|
|
138
|
+
|
|
139
|
+
/* ---------------------------------------------------------------------------
|
|
140
|
+
Button
|
|
141
|
+
--------------------------------------------------------------------------- */
|
|
142
|
+
.a2ui-button {
|
|
143
|
+
display: inline-flex;
|
|
144
|
+
align-items: center;
|
|
145
|
+
justify-content: center;
|
|
146
|
+
font-weight: 600;
|
|
147
|
+
white-space: nowrap;
|
|
148
|
+
border-width: 1px;
|
|
149
|
+
border-style: solid;
|
|
150
|
+
cursor: pointer;
|
|
151
|
+
transition: background-color 0.15s, border-color 0.15s, color 0.15s;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.a2ui-button:disabled {
|
|
155
|
+
pointer-events: none;
|
|
156
|
+
opacity: 0.6;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.a2ui-button--primary {
|
|
160
|
+
border-color: hsl(var(--a2ui-primary));
|
|
161
|
+
background-color: hsl(var(--a2ui-primary));
|
|
162
|
+
color: hsl(var(--a2ui-primary-foreground));
|
|
163
|
+
}
|
|
164
|
+
.a2ui-button--primary:hover,
|
|
165
|
+
.a2ui-button--primary:focus { background-color: hsl(var(--a2ui-primary-hover)); border-color: hsl(var(--a2ui-primary-hover)); }
|
|
166
|
+
.a2ui-button--primary:focus-visible { outline: 2px solid hsl(var(--a2ui-ring)); outline-offset: 2px; }
|
|
167
|
+
|
|
168
|
+
.a2ui-button--secondary {
|
|
169
|
+
border-color: hsl(var(--a2ui-primary-subtle));
|
|
170
|
+
background-color: hsl(var(--a2ui-primary-subtle));
|
|
171
|
+
color: hsl(var(--a2ui-primary-subtle-foreground));
|
|
172
|
+
}
|
|
173
|
+
.a2ui-button--secondary:hover,
|
|
174
|
+
.a2ui-button--secondary:focus { background-color: hsl(var(--a2ui-primary-subtle-hover)); border-color: hsl(var(--a2ui-primary-subtle-hover)); }
|
|
175
|
+
.a2ui-button--secondary:focus-visible { outline: 2px solid hsl(var(--a2ui-ring)); outline-offset: 2px; }
|
|
176
|
+
|
|
177
|
+
.a2ui-button--destructive {
|
|
178
|
+
border-color: hsl(var(--a2ui-destructive));
|
|
179
|
+
background-color: hsl(var(--a2ui-destructive));
|
|
180
|
+
color: hsl(var(--a2ui-destructive-foreground));
|
|
181
|
+
}
|
|
182
|
+
.a2ui-button--destructive:hover,
|
|
183
|
+
.a2ui-button--destructive:focus { background-color: hsl(var(--a2ui-destructive-hover)); border-color: hsl(var(--a2ui-destructive-hover)); }
|
|
184
|
+
.a2ui-button--destructive:focus-visible { outline: 2px solid hsl(var(--a2ui-ring)); outline-offset: 2px; }
|
|
185
|
+
|
|
186
|
+
.a2ui-button--destructive-subtle {
|
|
187
|
+
border-color: hsl(var(--a2ui-destructive-alternate));
|
|
188
|
+
background-color: hsl(var(--a2ui-destructive-alternate));
|
|
189
|
+
color: hsl(var(--a2ui-destructive-alternate-foreground));
|
|
190
|
+
}
|
|
191
|
+
.a2ui-button--destructive-subtle:hover,
|
|
192
|
+
.a2ui-button--destructive-subtle:focus { background-color: hsl(var(--a2ui-destructive-alternate-hover)); border-color: hsl(var(--a2ui-destructive-alternate-hover)); }
|
|
193
|
+
.a2ui-button--destructive-subtle:focus-visible { outline: 2px solid hsl(var(--a2ui-ring)); outline-offset: 2px; }
|
|
194
|
+
|
|
195
|
+
.a2ui-button--outline {
|
|
196
|
+
background-color: hsl(var(--a2ui-background));
|
|
197
|
+
color: hsl(var(--a2ui-foreground));
|
|
198
|
+
border-color: hsl(var(--a2ui-border));
|
|
199
|
+
}
|
|
200
|
+
.a2ui-button--outline:hover,
|
|
201
|
+
.a2ui-button--outline:focus,
|
|
202
|
+
.a2ui-button--outline:focus-visible { background-color: hsl(var(--a2ui-background-hover)); }
|
|
203
|
+
|
|
204
|
+
.a2ui-button--ghost-primary {
|
|
205
|
+
border-color: transparent;
|
|
206
|
+
color: hsl(var(--a2ui-primary));
|
|
207
|
+
}
|
|
208
|
+
.a2ui-button--ghost-primary:hover,
|
|
209
|
+
.a2ui-button--ghost-primary:focus { background-color: hsl(var(--a2ui-primary-subtle)); }
|
|
210
|
+
.a2ui-button--ghost-primary:hover { text-decoration: underline; text-decoration-color: hsl(var(--a2ui-primary)); }
|
|
211
|
+
|
|
212
|
+
.a2ui-button--ghost-neutral {
|
|
213
|
+
border-color: transparent;
|
|
214
|
+
color: hsl(var(--a2ui-foreground));
|
|
215
|
+
}
|
|
216
|
+
.a2ui-button--ghost-neutral:hover,
|
|
217
|
+
.a2ui-button--ghost-neutral:focus { background-color: hsl(var(--a2ui-background-hover)); }
|
|
218
|
+
|
|
219
|
+
.a2ui-button--ghost-destructive {
|
|
220
|
+
border-color: transparent;
|
|
221
|
+
color: hsl(var(--a2ui-destructive));
|
|
222
|
+
}
|
|
223
|
+
.a2ui-button--ghost-destructive:hover,
|
|
224
|
+
.a2ui-button--ghost-destructive:focus { background-color: hsl(var(--a2ui-destructive-alternate)); }
|
|
225
|
+
|
|
226
|
+
.a2ui-button--link-primary { border-color: transparent; color: hsl(var(--a2ui-primary)); }
|
|
227
|
+
.a2ui-button--link-neutral { border-color: transparent; color: hsl(var(--a2ui-foreground)); }
|
|
228
|
+
|
|
229
|
+
/* Button sizes */
|
|
230
|
+
.a2ui-button--tiny { font-size: 0.875rem; padding: 6px 12px; border-radius: 6px; }
|
|
231
|
+
.a2ui-button--small { font-size: 1rem; padding: 8px 16px; border-radius: 8px; }
|
|
232
|
+
.a2ui-button--medium { font-size: 1rem; padding: 10px 16px; border-radius: 10px; }
|
|
233
|
+
.a2ui-button--large { font-size: 1.125rem; padding: 10px 20px; border-radius: 12px; }
|
|
234
|
+
.a2ui-button--icon { width: 40px; height: 40px; padding: 0; border-radius: 8px; }
|
|
235
|
+
.a2ui-button--pill { border-radius: 9999px; }
|
|
236
|
+
|
|
237
|
+
/* ---------------------------------------------------------------------------
|
|
238
|
+
Card
|
|
239
|
+
--------------------------------------------------------------------------- */
|
|
240
|
+
.a2ui-card {
|
|
241
|
+
border-radius: 8px;
|
|
242
|
+
border: 1px solid hsl(var(--a2ui-border));
|
|
243
|
+
background-color: hsl(var(--a2ui-card));
|
|
244
|
+
color: hsl(var(--a2ui-card-foreground));
|
|
245
|
+
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
|
|
246
|
+
transition: background-color 0.3s;
|
|
247
|
+
}
|
|
248
|
+
.a2ui-card:hover { background-color: hsl(var(--a2ui-background-hover)); }
|
|
249
|
+
|
|
250
|
+
.a2ui-card-header {
|
|
251
|
+
display: flex;
|
|
252
|
+
flex-direction: column;
|
|
253
|
+
gap: 6px;
|
|
254
|
+
padding: 24px;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.a2ui-card-title {
|
|
258
|
+
font-weight: 600;
|
|
259
|
+
line-height: 1.2;
|
|
260
|
+
letter-spacing: -0.025em;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
.a2ui-card-description {
|
|
264
|
+
font-size: 0.875rem;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.a2ui-card-content {
|
|
268
|
+
padding: 24px;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
.a2ui-card-footer {
|
|
272
|
+
display: flex;
|
|
273
|
+
align-items: center;
|
|
274
|
+
padding: 0 24px 24px;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/* ---------------------------------------------------------------------------
|
|
278
|
+
Input
|
|
279
|
+
--------------------------------------------------------------------------- */
|
|
280
|
+
.a2ui-input-wrap {
|
|
281
|
+
position: relative;
|
|
282
|
+
display: flex;
|
|
283
|
+
width: 100%;
|
|
284
|
+
align-items: center;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.a2ui-input {
|
|
288
|
+
display: flex;
|
|
289
|
+
height: 40px;
|
|
290
|
+
width: 100%;
|
|
291
|
+
border-radius: 6px;
|
|
292
|
+
border: 1px solid hsl(var(--a2ui-border));
|
|
293
|
+
background-color: hsl(var(--a2ui-background));
|
|
294
|
+
padding: 8px 12px;
|
|
295
|
+
font-size: 0.875rem;
|
|
296
|
+
color: hsl(var(--a2ui-foreground));
|
|
297
|
+
}
|
|
298
|
+
.a2ui-input::placeholder { color: hsl(var(--a2ui-muted-foreground)); }
|
|
299
|
+
.a2ui-input:focus {
|
|
300
|
+
outline: none;
|
|
301
|
+
border-color: hsl(var(--a2ui-primary));
|
|
302
|
+
}
|
|
303
|
+
.a2ui-input:disabled { cursor: not-allowed; opacity: 0.5; }
|
|
304
|
+
.a2ui-input.invalid { border-color: hsl(var(--a2ui-error)); }
|
|
305
|
+
.a2ui-input-action { position: absolute; right: 12px; top: 0; bottom: 0; display: flex; align-items: center; z-index: 10; }
|
|
306
|
+
|
|
307
|
+
.a2ui-textarea {
|
|
308
|
+
min-height: 100px;
|
|
309
|
+
resize: vertical;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/* ---------------------------------------------------------------------------
|
|
313
|
+
TextField
|
|
314
|
+
--------------------------------------------------------------------------- */
|
|
315
|
+
.a2ui-textfield-label { margin-bottom: 8px; }
|
|
316
|
+
.a2ui-textfield-input { margin-top: 8px; }
|
|
317
|
+
|
|
318
|
+
/* ---------------------------------------------------------------------------
|
|
319
|
+
Label
|
|
320
|
+
--------------------------------------------------------------------------- */
|
|
321
|
+
.a2ui-label {
|
|
322
|
+
font-size: 0.875rem;
|
|
323
|
+
font-weight: 500;
|
|
324
|
+
line-height: 1;
|
|
325
|
+
}
|
|
326
|
+
.a2ui-label.peer-disabled { cursor: not-allowed; opacity: 0.7; }
|
|
327
|
+
|
|
328
|
+
/* ---------------------------------------------------------------------------
|
|
329
|
+
Checkbox
|
|
330
|
+
--------------------------------------------------------------------------- */
|
|
331
|
+
.a2ui-checkbox {
|
|
332
|
+
width: 16px;
|
|
333
|
+
height: 16px;
|
|
334
|
+
flex-shrink: 0;
|
|
335
|
+
border-radius: 4px;
|
|
336
|
+
border: 1px solid hsl(var(--a2ui-primary));
|
|
337
|
+
background: transparent;
|
|
338
|
+
cursor: pointer;
|
|
339
|
+
display: inline-flex;
|
|
340
|
+
align-items: center;
|
|
341
|
+
justify-content: center;
|
|
342
|
+
}
|
|
343
|
+
.a2ui-checkbox:focus-visible {
|
|
344
|
+
outline: 2px solid hsl(var(--a2ui-ring));
|
|
345
|
+
outline-offset: 2px;
|
|
346
|
+
}
|
|
347
|
+
.a2ui-checkbox:disabled { cursor: not-allowed; opacity: 0.5; }
|
|
348
|
+
.a2ui-checkbox[data-state="checked"] {
|
|
349
|
+
background-color: hsl(var(--a2ui-primary));
|
|
350
|
+
color: hsl(var(--a2ui-primary-foreground));
|
|
351
|
+
}
|
|
352
|
+
.a2ui-checkbox-indicator { display: flex; align-items: center; justify-content: center; color: currentColor; }
|
|
353
|
+
|
|
354
|
+
.a2ui-checkbox-group {
|
|
355
|
+
display: flex;
|
|
356
|
+
align-items: center;
|
|
357
|
+
gap: 8px;
|
|
358
|
+
font-size: 0.875rem;
|
|
359
|
+
color: hsl(var(--a2ui-foreground));
|
|
360
|
+
}
|
|
361
|
+
.a2ui-checkbox-group .a2ui-label { font-weight: 400; }
|
|
362
|
+
|
|
363
|
+
/* ---------------------------------------------------------------------------
|
|
364
|
+
Separator
|
|
365
|
+
--------------------------------------------------------------------------- */
|
|
366
|
+
.a2ui-separator {
|
|
367
|
+
flex-shrink: 0;
|
|
368
|
+
background-color: hsl(var(--a2ui-border));
|
|
369
|
+
}
|
|
370
|
+
.a2ui-separator--horizontal { height: 2px; width: 100%; }
|
|
371
|
+
.a2ui-separator--vertical { height: 100%; width: 2px; }
|
|
372
|
+
|
|
373
|
+
/* ---------------------------------------------------------------------------
|
|
374
|
+
Image
|
|
375
|
+
--------------------------------------------------------------------------- */
|
|
376
|
+
.a2ui-image {
|
|
377
|
+
max-width: 100%;
|
|
378
|
+
height: auto;
|
|
379
|
+
}
|
|
380
|
+
.a2ui-image--cover { object-fit: cover; }
|
|
381
|
+
.a2ui-image--contain { object-fit: contain; }
|
|
382
|
+
.a2ui-image--fill { object-fit: fill; }
|
|
383
|
+
.a2ui-image--none { object-fit: none; }
|
|
384
|
+
.a2ui-image--scale-down { object-fit: scale-down; }
|
|
385
|
+
.a2ui-image--avatar { border-radius: 9999px; width: 48px; height: 48px; }
|
|
386
|
+
.a2ui-image--hero { width: 100%; height: 256px; }
|
|
387
|
+
.a2ui-image--thumbnail { width: 96px; height: 96px; }
|
|
388
|
+
|
|
389
|
+
/* ---------------------------------------------------------------------------
|
|
390
|
+
Timeout
|
|
391
|
+
--------------------------------------------------------------------------- */
|
|
392
|
+
.a2ui-timeout {
|
|
393
|
+
font-variant-numeric: tabular-nums;
|
|
394
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "glchat-a2ui-react-renderer",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "A2UI (Agent-to-UI) React renderer for GLChat — render declarative UI from AI agent messages",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "GDP Labs",
|
|
@@ -21,17 +21,21 @@
|
|
|
21
21
|
"require": {
|
|
22
22
|
"types": "./dist/index.d.ts"
|
|
23
23
|
}
|
|
24
|
-
}
|
|
24
|
+
},
|
|
25
|
+
"./styles.css": "./dist/styles.css"
|
|
25
26
|
},
|
|
26
|
-
"sideEffects":
|
|
27
|
+
"sideEffects": [
|
|
28
|
+
"**/*.css"
|
|
29
|
+
],
|
|
27
30
|
"files": [
|
|
28
31
|
"dist",
|
|
29
32
|
"README.md",
|
|
30
33
|
"LICENSE"
|
|
31
34
|
],
|
|
32
35
|
"scripts": {
|
|
33
|
-
"build": "npm run build:ts",
|
|
36
|
+
"build": "npm run build:ts && npm run build:css",
|
|
34
37
|
"build:ts": "tsc -p tsconfig.build.json",
|
|
38
|
+
"build:css": "cp src/styles.css dist/styles.css",
|
|
35
39
|
"prepare": "npm run build",
|
|
36
40
|
"lint": "npx publint",
|
|
37
41
|
"test": "vitest run",
|
|
@@ -47,8 +51,7 @@
|
|
|
47
51
|
"@radix-ui/react-slot": "^1.2.4",
|
|
48
52
|
"class-variance-authority": "^0.7.1",
|
|
49
53
|
"clsx": "^2.1.1",
|
|
50
|
-
"lucide-react": "^0.563.0"
|
|
51
|
-
"tailwind-merge": "^2.6.1"
|
|
54
|
+
"lucide-react": "^0.563.0"
|
|
52
55
|
},
|
|
53
56
|
"devDependencies": {
|
|
54
57
|
"@testing-library/react": "^16.0.1",
|