glchat-a2ui-react-renderer 0.0.2 → 0.0.4

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.
Files changed (39) hide show
  1. package/README.md +26 -29
  2. package/dist/src/components/Button.d.ts.map +1 -1
  3. package/dist/src/components/Button.js +22 -17
  4. package/dist/src/components/Card.d.ts.map +1 -1
  5. package/dist/src/components/Card.js +6 -6
  6. package/dist/src/components/Checkbox.d.ts.map +1 -1
  7. package/dist/src/components/Checkbox.js +1 -1
  8. package/dist/src/components/Column.d.ts +0 -4
  9. package/dist/src/components/Column.d.ts.map +1 -1
  10. package/dist/src/components/Column.js +11 -11
  11. package/dist/src/components/Image.d.ts.map +1 -1
  12. package/dist/src/components/Image.js +9 -13
  13. package/dist/src/components/Input.d.ts.map +1 -1
  14. package/dist/src/components/Input.js +2 -2
  15. package/dist/src/components/Label.d.ts +1 -2
  16. package/dist/src/components/Label.d.ts.map +1 -1
  17. package/dist/src/components/Label.js +1 -3
  18. package/dist/src/components/Row.d.ts +0 -4
  19. package/dist/src/components/Row.d.ts.map +1 -1
  20. package/dist/src/components/Row.js +11 -11
  21. package/dist/src/components/Separator.d.ts.map +1 -1
  22. package/dist/src/components/Separator.js +4 -19
  23. package/dist/src/components/Text.d.ts.map +1 -1
  24. package/dist/src/components/Text.js +9 -12
  25. package/dist/src/components/TextField.d.ts +0 -3
  26. package/dist/src/components/TextField.d.ts.map +1 -1
  27. package/dist/src/components/TextField.js +3 -3
  28. package/dist/src/components/Timeout.d.ts +0 -6
  29. package/dist/src/components/Timeout.d.ts.map +1 -1
  30. package/dist/src/components/Timeout.js +1 -5
  31. package/dist/src/helpers/css.d.ts +1 -6
  32. package/dist/src/helpers/css.d.ts.map +1 -1
  33. package/dist/src/helpers/css.js +2 -8
  34. package/dist/src/rendering/Surface.d.ts.map +1 -1
  35. package/dist/src/rendering/Surface.js +2 -6
  36. package/dist/src/rendering/catalog.d.ts.map +1 -1
  37. package/dist/src/rendering/catalog.js +3 -6
  38. package/dist/styles.css +395 -0
  39. 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
- ## Temporary solution
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: 'text-base text-gray-800', h1: 'text-2xl font-bold' },
49
- Button: 'px-4 py-2 rounded-lg bg-blue-600 text-white',
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
- // Button: (data, props) => <YourButton data={data} {...props} />,
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.clearSurfaces();
64
- processor.processMessages(parseJSONLStream(messages));
62
+ processor.processMessages(messages);
65
63
  refreshSurfaces();
66
64
  }, [messages, processor, refreshSurfaces]);
67
65
 
68
- // Subscribe once to user actions (button clicks, etc.).
66
+ // Subscribe to user actions (button clicks, etc.).
69
67
  useEffect(() => {
70
- const unsubscribe = processor.events.subscribe((event) => {
71
- fetch('/api/action', {
72
- method: 'POST',
73
- body: JSON.stringify(event.message),
74
- })
75
- .then((res) => res.json())
76
- .then((messages) => {
77
- processor.clearSurfaces();
78
- processor.processMessages(messages);
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, refreshSurfaces]);
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
- Components use Tailwind CSS classes by default. Ensure your app has Tailwind (and the design tokens used by the components, e.g. `border-primary`, `bg-background`) or override with your own CSS. Pass a **theme** (see complete example above) to supply custom `className` strings per component or part (Text, TextField, Button, etc.) without replacing the catalog.
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;;;;8EAiFnB,CAAC;AAEF,QAAA,MAAM,MAAM,2GAsBX,CAAC;AAIF,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,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(cn('group inline-flex font-semibold border items-center justify-center whitespace-nowrap ring-offset-background transition-colors', 'disabled:pointer-events-none disabled:opacity-secondary'), {
6
+ const buttonVariants = cva('a2ui-button', {
7
7
  variants: {
8
8
  variant: {
9
- primary: cn('border-primary bg-primary text-primary-foreground', 'hover:border-primary-hover hover:bg-primary-hover', 'focus:bg-primary-hover focus:outline-none focus:ring-2 focus:ring-ring', 'focus-visible:bg-primary-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring', 'active:bg-primary-hover active:outline-none active:ring-2 active:ring-ring'),
10
- secondary: cn('border-primary-subtle bg-primary-subtle text-primary-subtle-foreground', 'hover:border-primary-subtle-hover hover:bg-primary-subtle-hover ', 'focus:border-primary-subtle-hover focus:bg-primary-subtle-hover focus:outline-none focus:ring-2 focus:ring-ring', 'focus-visible:border-primary-subtle-hover focus-visible:bg-primary-subtle-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring', 'active:border-primary-subtle-hover active:bg-primary-subtle-hover active:outline-none active:ring-2 active:ring-ring'),
11
- destructive: cn('border-destructive bg-destructive text-destructive-foreground', 'hover:border-destructive-hover hover:bg-destructive-hover', 'focus:bg-destructive-hover focus:border-destructive-hover focus:outline-none focus:ring-2 focus:ring-ring', 'focus-visible:bg-destructive-hover focus-visible:border-destructive-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring', 'active:bg-destructive-hover active:border-destructive-hover active:outline-none active:ring-2 active:ring-ring'),
12
- 'destructive-subtle': cn('border-destructive-alternate bg-destructive-alternate text-destructive', 'hover:border-destructive-alternate-hover hover:bg-destructive-alternate-hover', 'focus:bg-destructive-alternate-hover focus:border-destructive-alternate-hover focus:outline-none focus:ring-2 focus:ring-ring', 'focus-visible:bg-destructive-alternate-hover focus-visible:border-destructive-alternate-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring', 'active:bg-destructive-alternate-hover active:border-destructive-alternate-hover active:outline-none active:ring-2 active:ring-ring'),
13
- outline: cn('bg-background text-foreground border-border', 'hover:bg-background-hover', 'focus:bg-background-hover', 'focus-visible:bg-background-hover', 'active:bg-background-hover'),
14
- 'ghost-primary': cn('group-hover:underline group-hover:decoration-primary group-active:underline group-active:decoration-primary', 'text-primary border-transparent', 'hover:bg-primary-hover hover:border-primary-hover', 'focus:bg-primary-hover focus:border-primary-hover', 'focus-visible:bg-primary-hover focus-visible:border-primary-hover', 'active:bg-primary-hover active:border-primary-hover'),
15
- 'ghost-neutral': cn('border-transparent text-foreground', 'hover:bg-background-hover hover:border-background-hover', 'focus:bg-background-hover focus:border-background-hover', 'focus-visible:bg-background-hover focus-visible:border-background-hover', 'active:bg-background-hover active:border-background-hover'),
16
- 'ghost-destructive': cn('border-transparent text-destructive', 'hover:bg-destructive-alternate hover:border-destructive-alternate', 'focus:bg-destructive-alternate focus:border-destructive-alternate', 'focus-visible:bg-destructive-alternate focus-visible:border-destructive-alternate', 'active:bg-destructive-alternate active:border-destructive-alternate'),
17
- 'link-primary': cn('border-transparent text-primary'),
18
- 'link-neutral': cn('border-transparent text-foreground'),
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: 'text-sm px-[12px] py-[6px] rounded-[6px]',
22
- small: 'text-base px-[16px] py-[8px] rounded-[8px]',
23
- medium: 'text-base px-[16px] py-[10px] rounded-[10px]',
24
- large: 'text-lg px-[20px] py-[10px] rounded-[12px]',
25
- icon: 'h-10 w-10 rounded-[8px]',
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: 'rounded-full',
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,6GAYR,CAAC;AAGH,QAAA,MAAM,UAAU,6GASd,CAAC;AAGH,QAAA,MAAM,SAAS,uHASb,CAAC;AAGH,QAAA,MAAM,eAAe,yHAKnB,CAAC;AAGH,QAAA,MAAM,WAAW,6GAKf,CAAC;AAGH,QAAA,MAAM,UAAU,6GASd,CAAC;AAGH,OAAO,EACL,IAAI,EACJ,WAAW,EACX,eAAe,EACf,UAAU,EACV,UAAU,EACV,SAAS,GACV,CAAC"}
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('rounded-lg border bg-card text-card-foreground shadow-sm transition-colors duration-300 hover:bg-card-hover', className), ...props })));
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('flex flex-col space-y-1.5 p-6', className), ...props })));
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('font-semibold leading-none tracking-tight', className), ...props })));
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('text-sm', className), ...props })));
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('p-6 pt-0', className), ...props })));
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('flex items-center p-6 pt-0', className), ...props })));
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,iKAkBZ,CAAC;AAGH,OAAO,EAAE,QAAQ,EAAE,CAAC"}
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('peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground', className), ...props, children: _jsx(CheckboxPrimitive.Indicator, { className: cn('flex items-center justify-center text-current'), children: _jsx(Check, { className: "h-4 w-4", strokeWidth: 1.5 }) }) })));
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;;;;;;GAMG;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"}
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('flex flex-col gap-2', distributionClasses[distribution], alignmentClasses[alignment], className), children: children }));
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":"AAWA,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"}
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: 'object-cover',
13
- contain: 'object-contain',
14
- fill: 'object-fill',
15
- none: 'object-none',
16
- scaleDown: 'object-scale-down',
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: 'rounded-full w-12 h-12',
20
- hero: 'w-full h-64',
21
- thumbnail: 'w-24 h-24',
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('max-w-full h-auto', fitClasses[fit], usageHint && usageHintClasses[usageHint], className) }));
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,qFAuBV,CAAC;AAGF,OAAO,EAAE,KAAK,EAAE,CAAC"}
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: "relative flex w-full items-center", children: [_jsx("input", { type: type, className: cn('invalid:text-error invalid:ring-error flex h-10 w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground caret-current file:border-0 file:bg-transparent file:text-sm file:font-medium focus:border-primary focus:outline-none focus-visible:border-primary focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50', { 'border-destructive': error }, className), ref: ref, ...props }), actionElement &&
6
- (type === 'text' || type === 'password' || type === 'number') && (_jsx("span", { className: "absolute inset-y-0 right-0 z-10 flex items-center pr-3", children: actionElement }))] }));
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
- import { type VariantProps } from 'class-variance-authority';
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;AAG/B,OAAO,EAAE,KAAK,YAAY,EAAO,MAAM,0BAA0B,CAAC;AAMlE,QAAA,MAAM,KAAK,4PAUT,CAAC;AAGH,OAAO,EAAE,KAAK,EAAE,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
- import { cva } from 'class-variance-authority';
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;;;;;;GAMG;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"}
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('flex flex-row gap-2', distributionClasses[distribution], alignmentClasses[alignment], className), children: children }));
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":"AAoBA,OAAO,KAAK,kBAAkB,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,QAAA,MAAM,SAAS,6JAoBd,CAAC;AAGF,OAAO,EAAE,SAAS,EAAE,CAAC"}
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('shrink-0 bg-border', orientation === 'horizontal' ? 'h-[2px] w-full' : 'h-full w-[2px]', className), ...props })));
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":"AAUA,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;AAED,wBAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,SAAkB,EAAE,SAAS,EAAE,EAAE,SAAS,2CAkB1E"}
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":"AAiBA,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,gEAAgE;IAChE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gDAAgD;IAChD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mEAAmE;IACnE,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,2CAsDpB"}
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('border-input mt-2 w-full rounded-md border bg-background px-3 py-2 text-sm ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring', elementClassName);
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, 'min-h-[100px]') })] }));
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('mt-2', elementClassName) })] }));
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,qHAAqH;IACrH,aAAa,EAAE,MAAM,CAAC;IACtB,sBAAsB;IACtB,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAiBD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,EAC1B,aAAa,EACb,SAAkB,EAClB,SAAS,GACV,EAAE,gBAAgB,2CAyBlB"}
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('tabular-nums', className), children: _jsx(A2UIText, { text: display, usageHint: usageHint }) }));
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 and resolves Tailwind CSS class conflicts.
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;;;;;;;GAOG;AACH,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAElD"}
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"}
@@ -1,13 +1,7 @@
1
1
  import clsx from 'clsx';
2
- import { twMerge } from 'tailwind-merge';
3
2
  /**
4
- * Conditionally joins class names and resolves Tailwind CSS class conflicts.
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 twMerge(clsx(inputs));
6
+ return clsx(inputs);
13
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Surface.d.ts","sourceRoot":"","sources":["../../../src/rendering/Surface.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAGnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,KAAK,EAGV,YAAY,EACZ,KAAK,EAEN,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,KAAK,gBAAgB,EAItB,MAAM,cAAc,CAAC;AAEtB,MAAM,WAAW,gBAAgB;IAC/B,wDAAwD;IACxD,SAAS,EAAE,MAAM,CAAC;IAClB,mDAAmD;IACnD,OAAO,EAAE,YAAY,CAAC;IACtB;;;OAGG;IACH,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,gFAAgF;IAChF,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,6DAA6D;IAC7D,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B,8FAA8F;IAC9F,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,EAC1B,SAAS,EACT,OAAO,EACP,SAAS,EACT,eAAe,EACf,OAAyB,EACzB,KAAK,GACN,EAAE,gBAAgB,GAAG,KAAK,CAAC,SAAS,CAqEpC"}
1
+ {"version":3,"file":"Surface.d.ts","sourceRoot":"","sources":["../../../src/rendering/Surface.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAG3C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,KAAK,EAGV,YAAY,EACZ,KAAK,EAEN,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,KAAK,gBAAgB,EAItB,MAAM,cAAc,CAAC;AAEtB,MAAM,WAAW,gBAAgB;IAC/B,wDAAwD;IACxD,SAAS,EAAE,MAAM,CAAC;IAClB,mDAAmD;IACnD,OAAO,EAAE,YAAY,CAAC;IACtB;;;OAGG;IACH,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,gFAAgF;IAChF,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,6DAA6D;IAC7D,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B,8FAA8F;IAC9F,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,EAC1B,SAAS,EACT,OAAO,EACP,SAAS,EACT,eAAe,EACf,OAAyB,EACzB,KAAK,GACN,EAAE,gBAAgB,GAAG,KAAK,CAAC,SAAS,CA6DpC"}
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { useCallback, useRef } from 'react';
3
+ import { useCallback } from 'react';
4
4
  import { resolveActionContext } from '../runtime/bindingResolver.js';
5
5
  import { DEFAULT_CATALOG, renderComponentFromCatalog, } from './catalog.js';
6
6
  /**
@@ -9,7 +9,6 @@ import { DEFAULT_CATALOG, renderComponentFromCatalog, } from './catalog.js';
9
9
  * one A2UISurface per surface.
10
10
  */
11
11
  export function A2UISurface({ surfaceId, surface, processor, refreshSurfaces, catalog = DEFAULT_CATALOG, theme, }) {
12
- const surfaceRef = useRef(null);
13
12
  const handleAction = useCallback((action, sourceComponentId) => {
14
13
  const resolvedContext = action.context != null
15
14
  ? resolveActionContext(action.context, surface.dataModel)
@@ -25,9 +24,6 @@ export function A2UISurface({ surfaceId, surface, processor, refreshSurfaces, ca
25
24
  if (processor) {
26
25
  processor.dispatch(message);
27
26
  }
28
- if (surfaceRef.current) {
29
- surfaceRef.current.dispatchEvent(new CustomEvent('a2uiaction', { detail: message, bubbles: true }));
30
- }
31
27
  }, [processor, surfaceId, surface.dataModel]);
32
28
  const renderComponentById = useCallback((componentId) => {
33
29
  const componentDef = surface.componentBuffer.get(componentId);
@@ -51,5 +47,5 @@ export function A2UISurface({ surfaceId, surface, processor, refreshSurfaces, ca
51
47
  if (!surface.ready || !surface.rootId) {
52
48
  return null;
53
49
  }
54
- return (_jsx("div", { ref: surfaceRef, className: "a2ui-surface", "data-surface-id": surfaceId, children: renderComponentById(surface.rootId) }));
50
+ return (_jsx("div", { className: "a2ui-surface", "data-surface-id": surfaceId, children: renderComponentById(surface.rootId) }));
55
51
  }
@@ -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;AAiOjE;;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"}
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, { className: "p-6", children: props.renderChild?.(data.child) }) }));
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('flex items-center gap-2 text-sm text-foreground', cbTheme?.container), children: [_jsx(Checkbox, { id: checkboxId, checked: Boolean(checked), onCheckedChange: handleChange, className: cbTheme?.element }), label != null && (_jsx(Label, { htmlFor: checkboxId, className: cn('font-normal', cbTheme?.label), children: String(label) }))] }));
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: cn({
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);
@@ -0,0 +1,395 @@
1
+ /**
2
+ * Use: import 'glchat-a2ui-react-renderer/styles.css' in client 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
+ flex-wrap: wrap;
96
+ gap: 8px;
97
+ }
98
+
99
+ .a2ui-row--justify-start { justify-content: flex-start; }
100
+ .a2ui-row--justify-end { justify-content: flex-end; }
101
+ .a2ui-row--justify-center { justify-content: center; }
102
+ .a2ui-row--justify-between { justify-content: space-between; }
103
+ .a2ui-row--justify-around { justify-content: space-around; }
104
+ .a2ui-row--justify-evenly { justify-content: space-evenly; }
105
+
106
+ .a2ui-row--items-start { align-items: flex-start; }
107
+ .a2ui-row--items-end { align-items: flex-end; }
108
+ .a2ui-row--items-center { align-items: center; }
109
+ .a2ui-row--items-stretch { align-items: stretch; }
110
+
111
+ .a2ui-column {
112
+ display: flex;
113
+ flex-direction: column;
114
+ gap: 8px;
115
+ }
116
+
117
+ .a2ui-column--justify-start { justify-content: flex-start; }
118
+ .a2ui-column--justify-end { justify-content: flex-end; }
119
+ .a2ui-column--justify-center { justify-content: center; }
120
+ .a2ui-column--justify-between { justify-content: space-between; }
121
+ .a2ui-column--justify-around { justify-content: space-around; }
122
+ .a2ui-column--justify-evenly { justify-content: space-evenly; }
123
+
124
+ .a2ui-column--items-start { align-items: flex-start; }
125
+ .a2ui-column--items-end { align-items: flex-end; }
126
+ .a2ui-column--items-center { align-items: center; }
127
+ .a2ui-column--items-stretch { align-items: stretch; }
128
+
129
+ /* ---------------------------------------------------------------------------
130
+ Text
131
+ --------------------------------------------------------------------------- */
132
+ .a2ui-text-h1 { font-size: 2.25rem; font-weight: 700; }
133
+ .a2ui-text-h2 { font-size: 1.875rem; font-weight: 700; }
134
+ .a2ui-text-h3 { font-size: 1.5rem; font-weight: 600; }
135
+ .a2ui-text-h4 { font-size: 1.25rem; font-weight: 600; }
136
+ .a2ui-text-h5 { font-size: 1.125rem; font-weight: 500; }
137
+ .a2ui-text-body { font-size: 1rem; }
138
+ .a2ui-text-caption { font-size: 0.875rem; color: hsl(var(--a2ui-muted-foreground)); }
139
+
140
+ /* ---------------------------------------------------------------------------
141
+ Button
142
+ --------------------------------------------------------------------------- */
143
+ .a2ui-button {
144
+ display: inline-flex;
145
+ align-items: center;
146
+ justify-content: center;
147
+ font-weight: 600;
148
+ white-space: nowrap;
149
+ border-width: 1px;
150
+ border-style: solid;
151
+ cursor: pointer;
152
+ transition: background-color 0.15s, border-color 0.15s, color 0.15s;
153
+ }
154
+
155
+ .a2ui-button:disabled {
156
+ pointer-events: none;
157
+ opacity: 0.6;
158
+ }
159
+
160
+ .a2ui-button--primary {
161
+ border-color: hsl(var(--a2ui-primary));
162
+ background-color: hsl(var(--a2ui-primary));
163
+ color: hsl(var(--a2ui-primary-foreground));
164
+ }
165
+ .a2ui-button--primary:hover,
166
+ .a2ui-button--primary:focus { background-color: hsl(var(--a2ui-primary-hover)); border-color: hsl(var(--a2ui-primary-hover)); }
167
+ .a2ui-button--primary:focus-visible { outline: 2px solid hsl(var(--a2ui-ring)); outline-offset: 2px; }
168
+
169
+ .a2ui-button--secondary {
170
+ border-color: hsl(var(--a2ui-primary-subtle));
171
+ background-color: hsl(var(--a2ui-primary-subtle));
172
+ color: hsl(var(--a2ui-primary-subtle-foreground));
173
+ }
174
+ .a2ui-button--secondary:hover,
175
+ .a2ui-button--secondary:focus { background-color: hsl(var(--a2ui-primary-subtle-hover)); border-color: hsl(var(--a2ui-primary-subtle-hover)); }
176
+ .a2ui-button--secondary:focus-visible { outline: 2px solid hsl(var(--a2ui-ring)); outline-offset: 2px; }
177
+
178
+ .a2ui-button--destructive {
179
+ border-color: hsl(var(--a2ui-destructive));
180
+ background-color: hsl(var(--a2ui-destructive));
181
+ color: hsl(var(--a2ui-destructive-foreground));
182
+ }
183
+ .a2ui-button--destructive:hover,
184
+ .a2ui-button--destructive:focus { background-color: hsl(var(--a2ui-destructive-hover)); border-color: hsl(var(--a2ui-destructive-hover)); }
185
+ .a2ui-button--destructive:focus-visible { outline: 2px solid hsl(var(--a2ui-ring)); outline-offset: 2px; }
186
+
187
+ .a2ui-button--destructive-subtle {
188
+ border-color: hsl(var(--a2ui-destructive-alternate));
189
+ background-color: hsl(var(--a2ui-destructive-alternate));
190
+ color: hsl(var(--a2ui-destructive-alternate-foreground));
191
+ }
192
+ .a2ui-button--destructive-subtle:hover,
193
+ .a2ui-button--destructive-subtle:focus { background-color: hsl(var(--a2ui-destructive-alternate-hover)); border-color: hsl(var(--a2ui-destructive-alternate-hover)); }
194
+ .a2ui-button--destructive-subtle:focus-visible { outline: 2px solid hsl(var(--a2ui-ring)); outline-offset: 2px; }
195
+
196
+ .a2ui-button--outline {
197
+ background-color: hsl(var(--a2ui-background));
198
+ color: hsl(var(--a2ui-foreground));
199
+ border-color: hsl(var(--a2ui-border));
200
+ }
201
+ .a2ui-button--outline:hover,
202
+ .a2ui-button--outline:focus,
203
+ .a2ui-button--outline:focus-visible { background-color: hsl(var(--a2ui-background-hover)); }
204
+
205
+ .a2ui-button--ghost-primary {
206
+ border-color: transparent;
207
+ color: hsl(var(--a2ui-primary));
208
+ }
209
+ .a2ui-button--ghost-primary:hover,
210
+ .a2ui-button--ghost-primary:focus { background-color: hsl(var(--a2ui-primary-subtle)); }
211
+ .a2ui-button--ghost-primary:hover { text-decoration: underline; text-decoration-color: hsl(var(--a2ui-primary)); }
212
+
213
+ .a2ui-button--ghost-neutral {
214
+ border-color: transparent;
215
+ color: hsl(var(--a2ui-foreground));
216
+ }
217
+ .a2ui-button--ghost-neutral:hover,
218
+ .a2ui-button--ghost-neutral:focus { background-color: hsl(var(--a2ui-background-hover)); }
219
+
220
+ .a2ui-button--ghost-destructive {
221
+ border-color: transparent;
222
+ color: hsl(var(--a2ui-destructive));
223
+ }
224
+ .a2ui-button--ghost-destructive:hover,
225
+ .a2ui-button--ghost-destructive:focus { background-color: hsl(var(--a2ui-destructive-alternate)); }
226
+
227
+ .a2ui-button--link-primary { border-color: transparent; color: hsl(var(--a2ui-primary)); }
228
+ .a2ui-button--link-neutral { border-color: transparent; color: hsl(var(--a2ui-foreground)); }
229
+
230
+ /* Button sizes */
231
+ .a2ui-button--tiny { font-size: 0.875rem; padding: 6px 12px; border-radius: 6px; }
232
+ .a2ui-button--small { font-size: 1rem; padding: 8px 16px; border-radius: 8px; }
233
+ .a2ui-button--medium { font-size: 1rem; padding: 10px 16px; border-radius: 10px; }
234
+ .a2ui-button--large { font-size: 1.125rem; padding: 10px 20px; border-radius: 12px; }
235
+ .a2ui-button--icon { width: 40px; height: 40px; padding: 0; border-radius: 8px; }
236
+ .a2ui-button--pill { border-radius: 9999px; }
237
+
238
+ /* ---------------------------------------------------------------------------
239
+ Card
240
+ --------------------------------------------------------------------------- */
241
+ .a2ui-card {
242
+ border-radius: 8px;
243
+ border: 1px solid hsl(var(--a2ui-border));
244
+ background-color: hsl(var(--a2ui-card));
245
+ color: hsl(var(--a2ui-card-foreground));
246
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
247
+ transition: background-color 0.3s;
248
+ }
249
+ .a2ui-card:hover { background-color: hsl(var(--a2ui-background-hover)); }
250
+
251
+ .a2ui-card-header {
252
+ display: flex;
253
+ flex-direction: column;
254
+ gap: 6px;
255
+ padding: 24px;
256
+ }
257
+
258
+ .a2ui-card-title {
259
+ font-weight: 600;
260
+ line-height: 1.2;
261
+ letter-spacing: -0.025em;
262
+ }
263
+
264
+ .a2ui-card-description {
265
+ font-size: 0.875rem;
266
+ }
267
+
268
+ .a2ui-card-content {
269
+ padding: 24px;
270
+ }
271
+
272
+ .a2ui-card-footer {
273
+ display: flex;
274
+ align-items: center;
275
+ padding: 0 24px 24px;
276
+ }
277
+
278
+ /* ---------------------------------------------------------------------------
279
+ Input
280
+ --------------------------------------------------------------------------- */
281
+ .a2ui-input-wrap {
282
+ position: relative;
283
+ display: flex;
284
+ width: 100%;
285
+ align-items: center;
286
+ }
287
+
288
+ .a2ui-input {
289
+ display: flex;
290
+ height: 40px;
291
+ width: 100%;
292
+ border-radius: 6px;
293
+ border: 1px solid hsl(var(--a2ui-border));
294
+ background-color: hsl(var(--a2ui-background));
295
+ padding: 8px 12px;
296
+ font-size: 0.875rem;
297
+ color: hsl(var(--a2ui-foreground));
298
+ }
299
+ .a2ui-input::placeholder { color: hsl(var(--a2ui-muted-foreground)); }
300
+ .a2ui-input:focus {
301
+ outline: none;
302
+ border-color: hsl(var(--a2ui-primary));
303
+ }
304
+ .a2ui-input:disabled { cursor: not-allowed; opacity: 0.5; }
305
+ .a2ui-input.invalid { border-color: hsl(var(--a2ui-error)); }
306
+ .a2ui-input-action { position: absolute; right: 12px; top: 0; bottom: 0; display: flex; align-items: center; z-index: 10; }
307
+
308
+ .a2ui-textarea {
309
+ min-height: 100px;
310
+ resize: vertical;
311
+ }
312
+
313
+ /* ---------------------------------------------------------------------------
314
+ TextField
315
+ --------------------------------------------------------------------------- */
316
+ .a2ui-textfield-label { margin-bottom: 8px; }
317
+ .a2ui-textfield-input { margin-top: 8px; }
318
+
319
+ /* ---------------------------------------------------------------------------
320
+ Label
321
+ --------------------------------------------------------------------------- */
322
+ .a2ui-label {
323
+ font-size: 0.875rem;
324
+ font-weight: 500;
325
+ line-height: 1;
326
+ }
327
+ .a2ui-label.peer-disabled { cursor: not-allowed; opacity: 0.7; }
328
+
329
+ /* ---------------------------------------------------------------------------
330
+ Checkbox
331
+ --------------------------------------------------------------------------- */
332
+ .a2ui-checkbox {
333
+ width: 16px;
334
+ height: 16px;
335
+ flex-shrink: 0;
336
+ border-radius: 4px;
337
+ border: 1px solid hsl(var(--a2ui-primary));
338
+ background: transparent;
339
+ cursor: pointer;
340
+ display: inline-flex;
341
+ align-items: center;
342
+ justify-content: center;
343
+ }
344
+ .a2ui-checkbox:focus-visible {
345
+ outline: 2px solid hsl(var(--a2ui-ring));
346
+ outline-offset: 2px;
347
+ }
348
+ .a2ui-checkbox:disabled { cursor: not-allowed; opacity: 0.5; }
349
+ .a2ui-checkbox[data-state="checked"] {
350
+ background-color: hsl(var(--a2ui-primary));
351
+ color: hsl(var(--a2ui-primary-foreground));
352
+ }
353
+ .a2ui-checkbox-indicator { display: flex; align-items: center; justify-content: center; color: currentColor; }
354
+
355
+ .a2ui-checkbox-group {
356
+ display: flex;
357
+ align-items: center;
358
+ gap: 8px;
359
+ font-size: 0.875rem;
360
+ color: hsl(var(--a2ui-foreground));
361
+ }
362
+ .a2ui-checkbox-group .a2ui-label { font-weight: 400; }
363
+
364
+ /* ---------------------------------------------------------------------------
365
+ Separator
366
+ --------------------------------------------------------------------------- */
367
+ .a2ui-separator {
368
+ flex-shrink: 0;
369
+ background-color: hsl(var(--a2ui-border));
370
+ }
371
+ .a2ui-separator--horizontal { height: 2px; width: 100%; }
372
+ .a2ui-separator--vertical { height: 100%; width: 2px; }
373
+
374
+ /* ---------------------------------------------------------------------------
375
+ Image
376
+ --------------------------------------------------------------------------- */
377
+ .a2ui-image {
378
+ max-width: 100%;
379
+ height: auto;
380
+ }
381
+ .a2ui-image--cover { object-fit: cover; }
382
+ .a2ui-image--contain { object-fit: contain; }
383
+ .a2ui-image--fill { object-fit: fill; }
384
+ .a2ui-image--none { object-fit: none; }
385
+ .a2ui-image--scale-down { object-fit: scale-down; }
386
+ .a2ui-image--avatar { border-radius: 9999px; width: 48px; height: 48px; }
387
+ .a2ui-image--hero { width: 100%; height: 256px; }
388
+ .a2ui-image--thumbnail { width: 96px; height: 96px; }
389
+
390
+ /* ---------------------------------------------------------------------------
391
+ Timeout
392
+ --------------------------------------------------------------------------- */
393
+ .a2ui-timeout {
394
+ font-variant-numeric: tabular-nums;
395
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glchat-a2ui-react-renderer",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
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": false,
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",