@uipath/apollo-react 3.26.1 → 3.26.2
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
CHANGED
|
@@ -2,9 +2,61 @@
|
|
|
2
2
|
|
|
3
3
|
React component library with Material UI theming for the Apollo Design System.
|
|
4
4
|
|
|
5
|
+
## ⚠️ Important: Package Usage Guide
|
|
6
|
+
|
|
7
|
+
### When to Use apollo-react
|
|
8
|
+
|
|
9
|
+
**✅ Actively Supported - Use for:**
|
|
10
|
+
- **Canvas/workflow components** - Hierarchical canvas, agent workflows, XYFlow integration (unique to this package)
|
|
11
|
+
- **ApChat** - AI chat interface component
|
|
12
|
+
- **Icons** - React icon components
|
|
13
|
+
- **Core tokens** - Re-exported from @uipath/apollo-core
|
|
14
|
+
|
|
15
|
+
**⚠️ Maintenance Mode - Avoid for New Development:**
|
|
16
|
+
- **Material UI (`./material`)** - Entire Material UI section including themes and Ap* components
|
|
17
|
+
|
|
18
|
+
### For New Development: Use `@uipath/apollo-wind`
|
|
19
|
+
|
|
20
|
+
For new UI components, theming, and general application development, use `@uipath/apollo-wind` (Tailwind CSS + shadcn/ui) instead. It provides a modern, maintainable approach to building UI.
|
|
21
|
+
|
|
22
|
+
> **Note:** Canvas components will remain in apollo-react but will be refactored internally to consume apollo-wind components instead of Material UI, improving maintainability while keeping the same public API.
|
|
23
|
+
|
|
24
|
+
### Material UI Section (⚠️ Maintenance Mode)
|
|
25
|
+
|
|
26
|
+
The Material UI themes and components (`./material`) are maintained for backwards compatibility only. The themes apply Apollo design tokens to all Material UI components:
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
import { ThemeProvider } from '@mui/material/styles';
|
|
30
|
+
import { Button, TextField } from '@mui/material';
|
|
31
|
+
import { apolloMaterialUiThemeDark } from '@uipath/apollo-react/material/theme';
|
|
32
|
+
|
|
33
|
+
function App() {
|
|
34
|
+
return (
|
|
35
|
+
<ThemeProvider theme={apolloMaterialUiThemeDark}>
|
|
36
|
+
<Button variant="contained">Styled with Apollo theme</Button>
|
|
37
|
+
<TextField label="Uses Apollo tokens" />
|
|
38
|
+
</ThemeProvider>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**Why maintenance mode?**
|
|
44
|
+
- Moving to Tailwind CSS (apollo-wind) for better maintainability
|
|
45
|
+
- Material UI theming adds complexity
|
|
46
|
+
- Ap* components duplicate MUI's API surface
|
|
47
|
+
|
|
5
48
|
## Overview
|
|
6
49
|
|
|
7
|
-
|
|
50
|
+
`@uipath/apollo-react` provides:
|
|
51
|
+
|
|
52
|
+
**Actively Maintained:**
|
|
53
|
+
- **Canvas/Workflow Components** - Hierarchical canvas for agent workflows with XYFlow integration
|
|
54
|
+
- **ApChat** - Full-featured AI chat interface component with i18n support
|
|
55
|
+
- **Icons** - 1300+ React icon components
|
|
56
|
+
- **Design Tokens** - Re-exported from @uipath/apollo-core
|
|
57
|
+
|
|
58
|
+
**Maintenance Mode (Backwards Compatibility Only):**
|
|
59
|
+
- **Material UI (`./material`)** - Themes and Ap* components (use `@uipath/apollo-wind` for new development)
|
|
8
60
|
|
|
9
61
|
## Installation
|
|
10
62
|
|
|
@@ -16,73 +68,320 @@ pnpm add @uipath/apollo-react
|
|
|
16
68
|
yarn add @uipath/apollo-react
|
|
17
69
|
```
|
|
18
70
|
|
|
19
|
-
##
|
|
71
|
+
## Quick Start
|
|
20
72
|
|
|
21
|
-
###
|
|
73
|
+
### Apollo Themes with Standard Material UI
|
|
22
74
|
|
|
23
75
|
```typescript
|
|
24
|
-
import '@
|
|
76
|
+
import { ThemeProvider } from '@mui/material/styles';
|
|
77
|
+
import { Button, TextField } from '@mui/material';
|
|
78
|
+
import { apolloMaterialUiThemeDark } from '@uipath/apollo-react/material/theme';
|
|
79
|
+
|
|
80
|
+
function App() {
|
|
81
|
+
return (
|
|
82
|
+
<ThemeProvider theme={apolloMaterialUiThemeDark}>
|
|
83
|
+
<Button variant="contained">Apollo-themed Button</Button>
|
|
84
|
+
<TextField label="Apollo-themed Input" />
|
|
85
|
+
</ThemeProvider>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
25
88
|
```
|
|
26
89
|
|
|
27
|
-
###
|
|
90
|
+
### Using Ap* Wrapper Components
|
|
28
91
|
|
|
29
92
|
```typescript
|
|
30
|
-
import { ApButton, ApTextField } from '@uipath/apollo-react/components';
|
|
93
|
+
import { ApButton, ApTextField } from '@uipath/apollo-react/material/components';
|
|
94
|
+
import { ThemeProvider } from '@mui/material/styles';
|
|
95
|
+
import { apolloMaterialUiThemeDark } from '@uipath/apollo-react/material/theme';
|
|
31
96
|
|
|
32
97
|
function App() {
|
|
33
98
|
return (
|
|
34
|
-
<
|
|
99
|
+
<ThemeProvider theme={apolloMaterialUiThemeDark}>
|
|
35
100
|
<ApButton variant="primary">Click me</ApButton>
|
|
36
101
|
<ApTextField label="Name" />
|
|
37
|
-
</
|
|
102
|
+
</ThemeProvider>
|
|
38
103
|
);
|
|
39
104
|
}
|
|
40
105
|
```
|
|
41
106
|
|
|
42
|
-
|
|
107
|
+
## Package Exports
|
|
108
|
+
|
|
109
|
+
### Main Entry Point
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
// Re-exports from material, canvas, icons, core
|
|
113
|
+
import { ApButton, HierarchicalCanvas } from '@uipath/apollo-react';
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Material UI Components (⚠️ Maintenance Mode)
|
|
117
|
+
|
|
118
|
+
> **⚠️ Deprecation Notice:** Ap* components are Material UI wrappers maintained for legacy support. For new projects, use `@uipath/apollo-wind` or standard Material UI components with Apollo themes.
|
|
119
|
+
|
|
120
|
+
```typescript
|
|
121
|
+
// All components from single import
|
|
122
|
+
import { ApButton, ApTextField, ApModal } from '@uipath/apollo-react/material/components';
|
|
123
|
+
|
|
124
|
+
// Individual component imports (for smaller bundles)
|
|
125
|
+
import { ApButton } from '@uipath/apollo-react/material/components/ap-button';
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
**Recommended alternative:**
|
|
129
|
+
```typescript
|
|
130
|
+
// Use standard MUI components with Apollo theme instead
|
|
131
|
+
import { Button, TextField } from '@mui/material';
|
|
132
|
+
import { apolloMaterialUiThemeDark } from '@uipath/apollo-react/material/theme';
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Theme System
|
|
43
136
|
|
|
44
137
|
```typescript
|
|
45
|
-
import {
|
|
138
|
+
import {
|
|
139
|
+
apolloMaterialUiThemeDark,
|
|
140
|
+
apolloMaterialUiThemeLight,
|
|
141
|
+
apolloMaterialUiThemeDarkHC,
|
|
142
|
+
apolloMaterialUiThemeLightHC
|
|
143
|
+
} from '@uipath/apollo-react/material/theme';
|
|
46
144
|
```
|
|
47
145
|
|
|
48
|
-
###
|
|
146
|
+
### Canvas Components
|
|
49
147
|
|
|
50
148
|
```typescript
|
|
51
|
-
|
|
52
|
-
import {
|
|
149
|
+
// Main canvas components
|
|
150
|
+
import {
|
|
151
|
+
HierarchicalCanvas,
|
|
152
|
+
AgentCanvas,
|
|
153
|
+
BaseCanvas,
|
|
154
|
+
BaseNode,
|
|
155
|
+
GroupNode
|
|
156
|
+
} from '@uipath/apollo-react/canvas';
|
|
157
|
+
|
|
158
|
+
// Canvas utilities and hooks
|
|
159
|
+
import { useCanvasStore } from '@uipath/apollo-react/canvas/hooks';
|
|
160
|
+
import { Breadcrumb } from '@uipath/apollo-react/canvas/controls';
|
|
161
|
+
|
|
162
|
+
// XYFlow re-exports
|
|
163
|
+
import { ReactFlow, Panel } from '@uipath/apollo-react/canvas/xyflow/react';
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### ApChat Component
|
|
167
|
+
|
|
168
|
+
```typescript
|
|
169
|
+
import { ApChat } from '@uipath/apollo-react/ap-chat';
|
|
170
|
+
import {
|
|
171
|
+
AutopilotChatService,
|
|
172
|
+
AutopilotChatMode,
|
|
173
|
+
type ApChatTheme
|
|
174
|
+
} from '@uipath/apollo-react/ap-chat/service';
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Icons
|
|
178
|
+
|
|
179
|
+
```typescript
|
|
180
|
+
// Import specific icons
|
|
181
|
+
import { AddCanvas, Close, ChevronDown } from '@uipath/apollo-react/icons';
|
|
182
|
+
|
|
183
|
+
// Icon types
|
|
184
|
+
import type { IconName } from '@uipath/apollo-react/icons';
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Design Tokens
|
|
188
|
+
|
|
189
|
+
```typescript
|
|
190
|
+
// Re-exported from @uipath/apollo-core
|
|
191
|
+
import {
|
|
192
|
+
ColorPrimary500,
|
|
193
|
+
SpacingMd,
|
|
194
|
+
FontFamilyBase
|
|
195
|
+
} from '@uipath/apollo-react/core';
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## Themes (⚠️ Maintenance Mode)
|
|
199
|
+
|
|
200
|
+
Four Material UI themes with Apollo design tokens. These themes work with all Material UI components, not just Ap* components.
|
|
201
|
+
|
|
202
|
+
| Theme | Description | Import |
|
|
203
|
+
|-------|-------------|--------|
|
|
204
|
+
| **Light** | Standard light theme | `apolloMaterialUiThemeLight` |
|
|
205
|
+
| **Dark** | Standard dark theme | `apolloMaterialUiThemeDark` |
|
|
206
|
+
| **Light High Contrast** | Accessibility-focused light | `apolloMaterialUiThemeLightHC` |
|
|
207
|
+
| **Dark High Contrast** | Accessibility-focused dark | `apolloMaterialUiThemeDarkHC` |
|
|
208
|
+
|
|
209
|
+
### Theme Usage with Standard Material UI Components
|
|
210
|
+
|
|
211
|
+
The Apollo themes apply to **all Material UI components**, allowing you to use the standard MUI library with Apollo design tokens:
|
|
212
|
+
|
|
213
|
+
```typescript
|
|
214
|
+
import { ThemeProvider } from '@mui/material/styles';
|
|
215
|
+
import { CssBaseline, Button, TextField, Card, AppBar } from '@mui/material';
|
|
216
|
+
import { apolloMaterialUiThemeDark } from '@uipath/apollo-react/material/theme';
|
|
53
217
|
|
|
54
218
|
function App() {
|
|
55
219
|
return (
|
|
56
220
|
<ThemeProvider theme={apolloMaterialUiThemeDark}>
|
|
57
|
-
|
|
221
|
+
<CssBaseline />
|
|
222
|
+
{/* Standard MUI components automatically use Apollo styling */}
|
|
223
|
+
<AppBar>
|
|
224
|
+
<Button variant="contained">Apollo-styled Button</Button>
|
|
225
|
+
<TextField label="Apollo-styled Input" />
|
|
226
|
+
</AppBar>
|
|
58
227
|
</ThemeProvider>
|
|
59
228
|
);
|
|
60
229
|
}
|
|
61
230
|
```
|
|
62
231
|
|
|
63
|
-
|
|
232
|
+
This approach allows you to integrate Apollo design tokens into existing Material UI applications without using Ap* wrapper components.
|
|
64
233
|
|
|
65
|
-
|
|
66
|
-
|-------|-------------|--------|
|
|
67
|
-
| **Light** | Standard light theme | `apolloMaterialUiThemeLight` |
|
|
68
|
-
| **Dark** | Standard dark theme | `apolloMaterialUiThemeDark` |
|
|
69
|
-
| **Light High Contrast** | High contrast light theme for accessibility | `apolloMaterialUiThemeLightHC` |
|
|
70
|
-
| **Dark High Contrast** | High contrast dark theme for accessibility | `apolloMaterialUiThemeDarkHC` |
|
|
234
|
+
## Icons
|
|
71
235
|
|
|
72
|
-
|
|
236
|
+
Access to 1300+ Apollo icons as React components:
|
|
73
237
|
|
|
74
|
-
|
|
238
|
+
```typescript
|
|
239
|
+
import {
|
|
240
|
+
AddCanvas,
|
|
241
|
+
Close,
|
|
242
|
+
ChevronDown,
|
|
243
|
+
AlertError
|
|
244
|
+
} from '@uipath/apollo-react/icons';
|
|
245
|
+
|
|
246
|
+
function MyComponent() {
|
|
247
|
+
return (
|
|
248
|
+
<div>
|
|
249
|
+
<AddCanvas />
|
|
250
|
+
<ChevronDown />
|
|
251
|
+
</div>
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
Icons are auto-generated from `@uipath/apollo-core` with React wrappers. Icon names use PascalCase.
|
|
257
|
+
|
|
258
|
+
## Internationalization (i18n)
|
|
259
|
+
|
|
260
|
+
ApChat component includes built-in i18n support for chat-related features using Lingui. The `locale` prop accepts supported locales:
|
|
261
|
+
|
|
262
|
+
```typescript
|
|
263
|
+
import { ApChat } from '@uipath/apollo-react/ap-chat';
|
|
264
|
+
import type { SupportedLocale } from '@uipath/apollo-react/ap-chat';
|
|
265
|
+
|
|
266
|
+
// Supported locales: 'en', 'de', 'es', 'es-MX', 'fr', 'ja', 'ko', 'pt', 'pt-BR', 'ru', 'tr', 'zh-CN', 'zh-TW'
|
|
267
|
+
<ApChat chatServiceInstance={chatService} locale="en" />
|
|
268
|
+
```
|
|
75
269
|
|
|
76
|
-
|
|
77
|
-
- `ApTextField`
|
|
78
|
-
- `ApCard`
|
|
79
|
-
- etc.
|
|
270
|
+
## Advanced Usage
|
|
80
271
|
|
|
81
|
-
|
|
272
|
+
### ApChat with Service
|
|
273
|
+
|
|
274
|
+
ApChat requires setting up a service instance. See the complete documentation in the package:
|
|
275
|
+
|
|
276
|
+
```typescript
|
|
277
|
+
import { ApChat } from '@uipath/apollo-react/ap-chat';
|
|
278
|
+
import {
|
|
279
|
+
AutopilotChatService,
|
|
280
|
+
AutopilotChatMode,
|
|
281
|
+
AutopilotChatEvent
|
|
282
|
+
} from '@uipath/apollo-react/ap-chat/service';
|
|
283
|
+
import { useState, useEffect } from 'react';
|
|
284
|
+
|
|
285
|
+
function ChatInterface() {
|
|
286
|
+
const [chatService, setChatService] = useState<AutopilotChatService | null>(null);
|
|
287
|
+
|
|
288
|
+
useEffect(() => {
|
|
289
|
+
// Initialize service
|
|
290
|
+
const service = AutopilotChatService.Instantiate({
|
|
291
|
+
instanceName: 'my-chat',
|
|
292
|
+
config: {
|
|
293
|
+
mode: AutopilotChatMode.SideBySide
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
setChatService(service);
|
|
298
|
+
|
|
299
|
+
// Subscribe to events using the AutopilotChatEvent enum
|
|
300
|
+
const unsubscribeRequest = service.on(AutopilotChatEvent.Request, (data) => {
|
|
301
|
+
console.log('User request:', data);
|
|
302
|
+
// Handle user input
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
const unsubscribeFeedback = service.on(AutopilotChatEvent.Feedback, (data) => {
|
|
306
|
+
console.log('User feedback:', data);
|
|
307
|
+
// Handle feedback
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
return () => {
|
|
311
|
+
unsubscribeRequest();
|
|
312
|
+
unsubscribeFeedback();
|
|
313
|
+
service.close();
|
|
314
|
+
};
|
|
315
|
+
}, []);
|
|
316
|
+
|
|
317
|
+
if (!chatService) return null;
|
|
318
|
+
|
|
319
|
+
return (
|
|
320
|
+
<ApChat
|
|
321
|
+
chatServiceInstance={chatService}
|
|
322
|
+
locale="en"
|
|
323
|
+
theme="light"
|
|
324
|
+
/>
|
|
325
|
+
);
|
|
326
|
+
}
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
**Note:** ApChat has extensive configuration options and events. Refer to the [complete API documentation](./src/material/components/ap-chat/DOCS.md) for all available events, methods, and configuration options.
|
|
330
|
+
|
|
331
|
+
## TypeScript Support
|
|
332
|
+
|
|
333
|
+
Full TypeScript support with exported types:
|
|
334
|
+
|
|
335
|
+
```typescript
|
|
336
|
+
import type {
|
|
337
|
+
ApButtonProps,
|
|
338
|
+
ApTextFieldProps,
|
|
339
|
+
AutopilotChatService,
|
|
340
|
+
ApChatTheme
|
|
341
|
+
} from '@uipath/apollo-react';
|
|
342
|
+
|
|
343
|
+
import type { CanvasLevel } from '@uipath/apollo-react/canvas/types';
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
## Directory Structure
|
|
347
|
+
|
|
348
|
+
```
|
|
349
|
+
apollo-react/
|
|
350
|
+
├── src/
|
|
351
|
+
│ ├── material/ # Material UI components
|
|
352
|
+
│ │ ├── components/ # Ap* components
|
|
353
|
+
│ │ └── theme/ # MUI theme overrides
|
|
354
|
+
│ ├── canvas/ # Canvas/workflow components
|
|
355
|
+
│ │ ├── components/ # Canvas components
|
|
356
|
+
│ │ ├── controls/ # Canvas controls
|
|
357
|
+
│ │ ├── hooks/ # Canvas hooks
|
|
358
|
+
│ │ ├── layouts/ # Layout algorithms
|
|
359
|
+
│ │ ├── stores/ # Zustand state stores
|
|
360
|
+
│ │ ├── xyflow/ # XYFlow re-exports
|
|
361
|
+
│ │ └── styles/ # Canvas styles
|
|
362
|
+
│ ├── icons/ # Icon React components
|
|
363
|
+
│ ├── core/ # Re-exported apollo-core
|
|
364
|
+
│ ├── i18n/ # Internationalization
|
|
365
|
+
│ └── types/ # TypeScript types
|
|
366
|
+
├── scripts/
|
|
367
|
+
│ └── icons-build.ts # Icon generation
|
|
368
|
+
└── dist/ # Built output
|
|
369
|
+
├── material/ # Material UI exports
|
|
370
|
+
├── canvas/ # Canvas exports
|
|
371
|
+
├── icons/ # Icon exports
|
|
372
|
+
└── core/ # Token exports
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
## Peer Dependencies
|
|
376
|
+
|
|
377
|
+
```json
|
|
378
|
+
{
|
|
379
|
+
"react": ">=18.3.0",
|
|
380
|
+
"react-dom": ">=18.3.0"
|
|
381
|
+
}
|
|
382
|
+
```
|
|
82
383
|
|
|
83
|
-
|
|
84
|
-
- `core`: Re-exported apollo-core tokens
|
|
85
|
-
- `theme`: Material UI theme overrides (apolloMaterialUiThemeDark, apolloMaterialUiThemeLight)
|
|
384
|
+
Material UI packages and other dependencies are included.
|
|
86
385
|
|
|
87
386
|
## License
|
|
88
387
|
|
|
@@ -33,7 +33,7 @@ const CaseManagementProject = ({ w = 22, h = 22 })=>/*#__PURE__*/ (0, jsx_runtim
|
|
|
33
33
|
width: w,
|
|
34
34
|
height: h,
|
|
35
35
|
fill: "none",
|
|
36
|
-
viewBox: "0 0
|
|
36
|
+
viewBox: "0 0 16 16",
|
|
37
37
|
children: [
|
|
38
38
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("path", {
|
|
39
39
|
fill: "currentColor",
|