@lumerahq/ui 0.11.0-dev.2 → 0.11.0
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 +71 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ npm install @lumerahq/ui
|
|
|
10
10
|
|
|
11
11
|
## Features
|
|
12
12
|
|
|
13
|
-
- **
|
|
13
|
+
- **Application Components** - Assistant chat surfaces, data tables, record sheets, and automation runner
|
|
14
14
|
- **Data Table** - Full-featured table with filtering, sorting, and pagination
|
|
15
15
|
- **Bridge Module** - Parent-iframe communication for embedded apps
|
|
16
16
|
- **API Utilities** - Lumera client with SQL, CRUD, file, and email operations
|
|
@@ -19,12 +19,81 @@ npm install @lumerahq/ui
|
|
|
19
19
|
|
|
20
20
|
## Usage
|
|
21
21
|
|
|
22
|
+
### Styles
|
|
23
|
+
|
|
24
|
+
Import the package stylesheet once in the app entrypoint before rendering any `@lumerahq/ui` component:
|
|
25
|
+
|
|
26
|
+
```tsx
|
|
27
|
+
import '@lumerahq/ui/styles.css';
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
This stylesheet is required for the shared Tailwind/shadcn theme variables, Inter font, assistant markdown styles, and assistant animations. It is not included automatically when importing from `@lumerahq/ui/components`, `@lumerahq/ui/hooks`, or `@lumerahq/ui/lib`.
|
|
31
|
+
|
|
32
|
+
The stylesheet defines theme tokens as CSS custom properties. Override them on `:root`, `.dark`, or a wrapper class to retheme the assistant without changing component code:
|
|
33
|
+
|
|
34
|
+
```css
|
|
35
|
+
.my-assistant-theme {
|
|
36
|
+
--brand: #2563eb;
|
|
37
|
+
--primary: var(--brand);
|
|
38
|
+
--ring: var(--brand);
|
|
39
|
+
--primary-foreground: #ffffff;
|
|
40
|
+
--background: #ffffff;
|
|
41
|
+
--foreground: #111827;
|
|
42
|
+
--card: #ffffff;
|
|
43
|
+
--border: #d1d5db;
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
22
47
|
### Components
|
|
23
48
|
|
|
24
49
|
```tsx
|
|
25
|
-
import {
|
|
50
|
+
import { AutomationRunner, DataTable, RecordSheet } from '@lumerahq/ui';
|
|
26
51
|
```
|
|
27
52
|
|
|
53
|
+
### Assistant Chat
|
|
54
|
+
|
|
55
|
+
Use `AssistantPage` for a full-page chat, `AssistantWidget` for a floating widget, or `AssistantChat` when embedding the chat surface inside custom chrome.
|
|
56
|
+
|
|
57
|
+
```tsx
|
|
58
|
+
import { useMemo } from 'react';
|
|
59
|
+
import {
|
|
60
|
+
AssistantPage,
|
|
61
|
+
createLumeraAgentChatTransport,
|
|
62
|
+
type AgentChatToolRenderer,
|
|
63
|
+
} from '@lumerahq/ui';
|
|
64
|
+
import '@lumerahq/ui/styles.css';
|
|
65
|
+
|
|
66
|
+
const toolRenderers: AgentChatToolRenderer[] = [
|
|
67
|
+
{
|
|
68
|
+
match: (tc) => tc.name === 'send_invoice',
|
|
69
|
+
summary: (tc) => {
|
|
70
|
+
const input = tc.input as { invoiceId?: string };
|
|
71
|
+
return `Sent invoice ${input.invoiceId ?? ''}`.trim();
|
|
72
|
+
},
|
|
73
|
+
expandedView: (tc) => <pre>{tc.output ?? ''}</pre>,
|
|
74
|
+
},
|
|
75
|
+
];
|
|
76
|
+
|
|
77
|
+
export function AppAssistant({ agentId }: { agentId: string }) {
|
|
78
|
+
const transport = useMemo(() => createLumeraAgentChatTransport({ agentId }), [agentId]);
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
<div style={{ height: '100vh' }}>
|
|
82
|
+
<AssistantPage
|
|
83
|
+
agentId={agentId}
|
|
84
|
+
transport={transport}
|
|
85
|
+
title="Finance assistant"
|
|
86
|
+
suggestions={['Review open invoices', 'Draft collection notes']}
|
|
87
|
+
toolRenderers={toolRenderers}
|
|
88
|
+
className="h-full"
|
|
89
|
+
/>
|
|
90
|
+
</div>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Custom tool renderers are checked before the built-in renderer registry, so they can add support for custom tools or override how a built-in tool appears. Pass the same renderer array to `AssistantPage`, `AssistantChat`, or `AssistantWidget` through the `toolRenderers` prop. For the lower-level `AgentChat` component, pass it as `renderers={{ toolRenderers }}`.
|
|
96
|
+
|
|
28
97
|
### API Utilities
|
|
29
98
|
|
|
30
99
|
```tsx
|