@patternfly/chatbot 6.9.0-prerelease.2 → 6.9.0-prerelease.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/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +1 -1
- package/dist/cjs/MessageBar/MessageBar.js +1 -1
- package/dist/cjs/MessageBar/SendButton.js +2 -2
- package/dist/css/main.css +157 -57
- package/dist/css/main.css.map +1 -1
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +1 -1
- package/dist/esm/MessageBar/MessageBar.js +1 -1
- package/dist/esm/MessageBar/SendButton.js +2 -2
- package/package.json +3 -3
- package/patternfly-docs/content/extensions/chatbot/chatbot.md +1 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Analytics/Analytics.md +1 -1
- package/patternfly-docs/content/extensions/chatbot/examples/demos/Canvas.md +110 -0
- package/patternfly-docs/content/extensions/chatbot/examples/demos/Canvas.tsx +609 -0
- package/patternfly-docs/content/extensions/chatbot/examples/demos/Chatbot.md +25 -3
- package/patternfly-docs/patternfly-docs.config.js +1 -1
- package/src/Canvas/Canvas.scss +138 -0
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.scss +91 -77
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.tsx +13 -0
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.tsx +1 -0
- package/src/MessageBar/AttachButton.scss +4 -21
- package/src/MessageBar/MessageBar.test.tsx +3 -0
- package/src/MessageBar/MessageBar.tsx +2 -0
- package/src/MessageBar/SendButton.scss +1 -32
- package/src/MessageBar/SendButton.tsx +2 -2
- package/src/main.scss +1 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: Canvas
|
|
3
|
+
section: patterns
|
|
4
|
+
source: demo
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
import { useState, useRef, useCallback, useEffect, FunctionComponent, ReactNode } from 'react';
|
|
8
|
+
import {
|
|
9
|
+
Brand,
|
|
10
|
+
Divider,
|
|
11
|
+
Drawer,
|
|
12
|
+
DrawerActions,
|
|
13
|
+
DrawerCloseButton,
|
|
14
|
+
DrawerContent,
|
|
15
|
+
DrawerContentBody,
|
|
16
|
+
DrawerHead,
|
|
17
|
+
DrawerPanelContent,
|
|
18
|
+
DropdownItem,
|
|
19
|
+
DropdownList,
|
|
20
|
+
Flex,
|
|
21
|
+
FlexItem,
|
|
22
|
+
Label,
|
|
23
|
+
MenuToggle,
|
|
24
|
+
Popover,
|
|
25
|
+
Select,
|
|
26
|
+
SelectList,
|
|
27
|
+
SelectOption,
|
|
28
|
+
Title,
|
|
29
|
+
Tooltip
|
|
30
|
+
} from '@patternfly/react-core';
|
|
31
|
+
import { CodeEditor, CodeEditorControl, Language } from '@patternfly/react-code-editor';
|
|
32
|
+
import Chatbot, { ChatbotDisplayMode } from '@patternfly/chatbot/dist/dynamic/Chatbot';
|
|
33
|
+
import ChatbotContent from '@patternfly/chatbot/dist/dynamic/ChatbotContent';
|
|
34
|
+
import ChatbotFooter, { ChatbotFootnote } from '@patternfly/chatbot/dist/dynamic/ChatbotFooter';
|
|
35
|
+
import MessageBar from '@patternfly/chatbot/dist/dynamic/MessageBar';
|
|
36
|
+
import MessageBox from '@patternfly/chatbot/dist/dynamic/MessageBox';
|
|
37
|
+
import Message from '@patternfly/chatbot/dist/dynamic/Message';
|
|
38
|
+
import ChatbotConversationHistoryNav from '@patternfly/chatbot/dist/dynamic/ChatbotConversationHistoryNav';
|
|
39
|
+
import ChatbotHeader, {
|
|
40
|
+
ChatbotHeaderActions,
|
|
41
|
+
ChatbotHeaderCloseButton,
|
|
42
|
+
ChatbotHeaderMain,
|
|
43
|
+
ChatbotHeaderMenu,
|
|
44
|
+
ChatbotHeaderTitle
|
|
45
|
+
} from '@patternfly/chatbot/dist/dynamic/ChatbotHeader';
|
|
46
|
+
import RhUiImageFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-image-fill-icon';
|
|
47
|
+
import RhUiAddIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-add-icon';
|
|
48
|
+
import RhUiTaskFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-task-fill-icon';
|
|
49
|
+
import RhUiNotificationFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-notification-fill-icon';
|
|
50
|
+
import RhUiCalendarFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-calendar-fill-icon';
|
|
51
|
+
import RhUiExportIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-export-icon';
|
|
52
|
+
import RhUiRedoIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-redo-icon';
|
|
53
|
+
import RhUiUndoIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-undo-icon';
|
|
54
|
+
import RhUiServerUploadFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-server-upload-fill-icon';
|
|
55
|
+
import RhUiAiEditIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-ai-edit-icon';
|
|
56
|
+
import RhUiAiInfoIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-ai-info-icon';
|
|
57
|
+
import { useDropzone } from 'react-dropzone';
|
|
58
|
+
import PFIconLogoColor from '../UI/PF-IconLogo-Color.svg';
|
|
59
|
+
import PFIconLogoReverse from '../UI/PF-IconLogo-Reverse.svg';
|
|
60
|
+
import userAvatar from '../Messages/user_avatar.svg';
|
|
61
|
+
|
|
62
|
+
**Canvas** lets users work with generated or editable content alongside a conversation. Canvas content is fully flexible, allowing you to render any content suitable for your use case. It is recommended to only utilize canvas mode with a fullscreen Chatbot.
|
|
63
|
+
|
|
64
|
+
## Composable structure
|
|
65
|
+
|
|
66
|
+
When utilizing a canvas layout, it's recommended to use a PatternFly [drawer](/components/drawer). You must apply the `pf-chatbot__canvas*` classes from `@patternfly/chatbot` so the drawer matches ChatBot backgrounds and fills the fullscreen layout.
|
|
67
|
+
|
|
68
|
+
The general recommended structure is as follows:
|
|
69
|
+
|
|
70
|
+
```noLive
|
|
71
|
+
<Chatbot displayMode={ChatbotDisplayMode.fullscreen}>
|
|
72
|
+
<div className="pf-chatbot__canvas">
|
|
73
|
+
<Drawer className="pf-chatbot__canvas-drawer" isExpanded={...} isInline position="end">
|
|
74
|
+
<DrawerContent panelContent={/* CodeEditor or other canvas content */}>
|
|
75
|
+
<DrawerContentBody className="pf-chatbot__canvas-body">
|
|
76
|
+
<div className="pf-chatbot__canvas-column">
|
|
77
|
+
<ChatbotHeader .../>
|
|
78
|
+
<ChatbotContent ... />
|
|
79
|
+
<ChatbotFooter ... >
|
|
80
|
+
</div>
|
|
81
|
+
</DrawerContentBody>
|
|
82
|
+
</DrawerContent>
|
|
83
|
+
</Drawer>
|
|
84
|
+
</div>
|
|
85
|
+
</Chatbot>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Class names
|
|
89
|
+
|
|
90
|
+
| Class name | Purpose |
|
|
91
|
+
| --- | --- |
|
|
92
|
+
| `pf-chatbot__canvas` | Container for the fullscreen canvas layout and its background. |
|
|
93
|
+
| `pf-chatbot__canvas-drawer` | Styles the drawer that contains the canvas panel. |
|
|
94
|
+
| `pf-chatbot__canvas-section` | Styles the section used within the drawer for focus. |
|
|
95
|
+
| `pf-chatbot__canvas-body` | Ensures the drawer content body fills the available height. |
|
|
96
|
+
| `pf-chatbot__canvas-column` | Arranges the canvas header, content, and footer vertically. |
|
|
97
|
+
| `pf-chatbot__canvas-panel` | Styles the canvas drawer panel and removes the default panel spacing. |
|
|
98
|
+
| `pf-chatbot__canvas-panel-body` | Provides the canvas panel content area and its spacing. |
|
|
99
|
+
| `pf-chatbot__canvas-head` | Styles and positions the canvas panel header and close action. |
|
|
100
|
+
| `pf-chatbot__canvas-editor` | Makes the code editor fill the available canvas space. |
|
|
101
|
+
|
|
102
|
+
## Demos
|
|
103
|
+
|
|
104
|
+
### With code editor
|
|
105
|
+
|
|
106
|
+
This demo shows canvas mode being used to render a PatternFly [code editor](/components/code-editor). Canvas mode is launched by clicking a file chip below a message or the "Canvas" label below the message bar. You can also enable or disable canvas mode from the attach menu and dismiss the label to exit canvas mode.
|
|
107
|
+
|
|
108
|
+
```js file="./Canvas.tsx" isFullscreen
|
|
109
|
+
|
|
110
|
+
```
|