@patternfly/chatbot 6.8.0-prerelease.2 → 6.8.0-prerelease.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.
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.js +2 -5
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +3 -3
- package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.js +1 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderNewChatButton.js +2 -2
- package/dist/cjs/MarkdownContent/MarkdownContent.js +15 -1
- package/dist/cjs/Message/CodeBlockMessage/CodeBlockMessage.js +2 -2
- package/dist/cjs/Message/LinkMessage/LinkMessage.js +5 -1
- package/dist/cjs/Message/Message.test.js +3 -1
- package/dist/cjs/Message/QuickStarts/QuickStartTileDescription.js +2 -5
- package/dist/cjs/MessageBox/JumpButton.test.js +2 -2
- package/dist/cjs/MessageBox/MessageBox.js +79 -28
- package/dist/cjs/MessageBox/MessageBox.test.d.ts +1 -1
- package/dist/cjs/MessageBox/MessageBox.test.js +59 -0
- package/dist/cjs/ResponseActions/ResponseActionButton.test.js +6 -6
- package/dist/cjs/ResponseActions/ResponseActions.test.js +6 -7
- package/dist/cjs/index.d.ts +0 -2
- package/dist/cjs/index.js +1 -4
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.js +2 -2
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +4 -4
- package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.js +2 -2
- package/dist/esm/ChatbotHeader/ChatbotHeaderNewChatButton.js +2 -2
- package/dist/esm/MarkdownContent/MarkdownContent.js +15 -1
- package/dist/esm/Message/CodeBlockMessage/CodeBlockMessage.js +2 -2
- package/dist/esm/Message/LinkMessage/LinkMessage.js +6 -2
- package/dist/esm/Message/Message.test.js +3 -1
- package/dist/esm/Message/QuickStarts/QuickStartTileDescription.js +2 -2
- package/dist/esm/MessageBox/JumpButton.test.js +2 -2
- package/dist/esm/MessageBox/MessageBox.js +80 -29
- package/dist/esm/MessageBox/MessageBox.test.d.ts +1 -1
- package/dist/esm/MessageBox/MessageBox.test.js +59 -0
- package/dist/esm/ResponseActions/ResponseActionButton.test.js +7 -7
- package/dist/esm/ResponseActions/ResponseActions.test.js +7 -8
- package/dist/esm/index.d.ts +0 -2
- package/dist/esm/index.js +0 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/patternfly-a11y.config.js +2 -1
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithCustomResponseActions.tsx +3 -4
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithMarkdownToolResponse.tsx +3 -3
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithQuickResponses.tsx +3 -3
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithToolResponse.tsx +5 -5
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/Messages.md +1 -1
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/UserMessageWithExtraContent.tsx +7 -31
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderBasic.tsx +4 -6
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawer.tsx +3 -3
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerResizable.tsx +2 -2
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerWithPin.tsx +2 -2
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerWithSearchActions.tsx +3 -3
- package/patternfly-docs/content/extensions/chatbot/examples/UI/CompactSettings.tsx +10 -5
- package/patternfly-docs/content/extensions/chatbot/examples/UI/Settings.tsx +10 -5
- package/patternfly-docs/content/extensions/chatbot/examples/UI/UI.md +1 -15
- package/patternfly-docs/content/extensions/chatbot/examples/demos/AttachmentDemos.md +1 -3
- package/patternfly-docs/content/extensions/chatbot/examples/demos/Chatbot.md +2 -5
- package/patternfly-docs/content/extensions/chatbot/examples/demos/Chatbot.tsx +4 -7
- package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotAttachment.tsx +4 -6
- package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotCompact.tsx +4 -7
- package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotDisplayMode.tsx +4 -7
- package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotScrolling.tsx +4 -8
- package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotTranscripts.tsx +4 -7
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.tsx +2 -3
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.tsx +4 -4
- package/src/ChatbotHeader/ChatbotHeaderCloseButton.tsx +2 -2
- package/src/ChatbotHeader/ChatbotHeaderNewChatButton.tsx +2 -3
- package/src/MarkdownContent/MarkdownContent.tsx +14 -0
- package/src/Message/CodeBlockMessage/CodeBlockMessage.tsx +2 -2
- package/src/Message/LinkMessage/LinkMessage.tsx +21 -2
- package/src/Message/Message.test.tsx +3 -1
- package/src/Message/QuickStarts/QuickStartTileDescription.tsx +2 -2
- package/src/MessageBox/JumpButton.test.tsx +1 -1
- package/src/MessageBox/MessageBox.test.tsx +91 -0
- package/src/MessageBox/MessageBox.tsx +137 -40
- package/src/ResponseActions/ResponseActionButton.test.tsx +7 -7
- package/src/ResponseActions/ResponseActions.test.tsx +7 -8
- package/dist/cjs/LoadingMessage/LoadingMessage.d.ts +0 -6
- package/dist/cjs/LoadingMessage/LoadingMessage.js +0 -12
- package/dist/cjs/LoadingMessage/LoadingMessage.test.d.ts +0 -1
- package/dist/cjs/LoadingMessage/LoadingMessage.test.js +0 -20
- package/dist/cjs/LoadingMessage/index.d.ts +0 -2
- package/dist/cjs/LoadingMessage/index.js +0 -23
- package/dist/dynamic/LoadingMessage/package.json +0 -1
- package/dist/esm/LoadingMessage/LoadingMessage.d.ts +0 -6
- package/dist/esm/LoadingMessage/LoadingMessage.js +0 -5
- package/dist/esm/LoadingMessage/LoadingMessage.test.d.ts +0 -1
- package/dist/esm/LoadingMessage/LoadingMessage.test.js +0 -15
- package/dist/esm/LoadingMessage/index.d.ts +0 -2
- package/dist/esm/LoadingMessage/index.js +0 -2
- package/src/LoadingMessage/LoadingMessage.test.tsx +0 -15
- package/src/LoadingMessage/LoadingMessage.tsx +0 -27
- package/src/LoadingMessage/__snapshots__/LoadingMessage.test.tsx.snap +0 -64
- package/src/LoadingMessage/index.ts +0 -3
|
@@ -70,30 +70,16 @@ import { MessageBar } from '@patternfly/chatbot/dist/dynamic/MessageBar';
|
|
|
70
70
|
import SourceDetailsMenuItem from '@patternfly/chatbot/dist/dynamic/SourceDetailsMenuItem';
|
|
71
71
|
import { ChatbotModal } from '@patternfly/chatbot/dist/dynamic/ChatbotModal';
|
|
72
72
|
import SettingsForm from '@patternfly/chatbot/dist/dynamic/Settings';
|
|
73
|
-
import RhUiAttentionBellIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-attention-bell-icon';
|
|
74
|
-
import RhUiCalendarIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-calendar-icon';
|
|
75
|
-
import RhUiClipboardIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-clipboard-icon';
|
|
76
|
-
import RhUiCodeIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-code-icon';
|
|
77
|
-
import RhUiAddIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-add-icon';
|
|
78
|
-
import { ThumbtackIcon } from '@patternfly/react-icons';
|
|
79
|
-
import RhUiUploadIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-upload-icon';
|
|
80
73
|
import { useDropzone } from 'react-dropzone';
|
|
81
|
-
|
|
82
74
|
import ChatbotConversationHistoryNav from '@patternfly/chatbot/dist/dynamic/ChatbotConversationHistoryNav';
|
|
83
75
|
import { Button, Label, DropdownItem, DropdownList, Checkbox, MenuToggle, Select, SelectList, SelectOption } from '@patternfly/react-core';
|
|
84
|
-
|
|
85
|
-
import OutlinedWindowRestoreIcon from '@patternfly/react-icons/dist/esm/icons/outlined-window-restore-icon';
|
|
86
|
-
import ExpandIcon from '@patternfly/react-icons/dist/esm/icons/expand-icon';
|
|
87
|
-
import OpenDrawerRightIcon from '@patternfly/react-icons/dist/esm/icons/open-drawer-right-icon';
|
|
88
|
-
import CogIcon from '@patternfly/react-icons/dist/esm/icons/cog-icon';
|
|
89
|
-
import PenToSquareIcon from '@patternfly/react-icons/dist/esm/icons/pen-to-square-icon';
|
|
90
76
|
import PFHorizontalLogoColor from './PF-HorizontalLogo-Color.svg';
|
|
91
77
|
import PFHorizontalLogoReverse from './PF-HorizontalLogo-Reverse.svg';
|
|
92
78
|
import userAvatar from '../Messages/user_avatar.svg';
|
|
93
79
|
import patternflyAvatar from '../Messages/patternfly_avatar.jpg';
|
|
94
80
|
import termsAndConditionsHeader from './PF-TermsAndConditionsHeader.svg';
|
|
95
81
|
import onboardingHeader from './RH-Hat-Image.svg';
|
|
96
|
-
import {
|
|
82
|
+
import { RhMicronsSortDownLargeToSmallIcon, RhUiAddIcon, RhUiAttentionBellIcon, RhUiCalendarIcon, RhUiClipboardIcon, RhUiCodeIcon, RhUiCommentsIcon, RhUiEditFillIcon, RhUiExpandIcon, RhUiFilterFillIcon, RhUiOpenDrawerRightIcon, RhUiRestoreWindowIcon, RhUiSearchIcon, RhUiSettingsFillIcon, RhUiThumbtackFillIcon, RhUiUploadIcon } from '@patternfly/react-icons';
|
|
97
83
|
import { FunctionComponent, FormEvent, useState, useRef, MouseEvent, isValidElement, cloneElement, Children, ReactNode, Ref, MouseEvent as ReactMouseEvent, CSSProperties, useEffect} from 'react';
|
|
98
84
|
import FilePreview from '@patternfly/chatbot/dist/dynamic/FilePreview';
|
|
99
85
|
|
|
@@ -37,9 +37,7 @@ ChatbotHeaderSelectorDropdown,
|
|
|
37
37
|
ChatbotHeaderOptionsDropdown
|
|
38
38
|
} from '@patternfly/chatbot/dist/dynamic/ChatbotHeader';
|
|
39
39
|
import ChatbotAlert from '@patternfly/chatbot/dist/dynamic/ChatbotAlert';
|
|
40
|
-
import
|
|
41
|
-
import OpenDrawerRightIcon from '@patternfly/react-icons/dist/esm/icons/open-drawer-right-icon';
|
|
42
|
-
import OutlinedWindowRestoreIcon from '@patternfly/react-icons/dist/esm/icons/outlined-window-restore-icon';
|
|
40
|
+
import { RhUiExpandIcon, RhUiOpenDrawerRightIcon, RhUiRestoreWindowIcon } from '@patternfly/react-icons';
|
|
43
41
|
import PFIconLogoColor from '../UI/PF-IconLogo-Color.svg';
|
|
44
42
|
import PFIconLogoReverse from '../UI/PF-IconLogo-Reverse.svg';
|
|
45
43
|
import userAvatar from '../Messages/user_avatar.svg';
|
|
@@ -48,12 +48,9 @@ ChatbotHeaderOptionsDropdown,
|
|
|
48
48
|
ChatbotHeaderCloseButton,
|
|
49
49
|
} from '@patternfly/chatbot/dist/dynamic/ChatbotHeader';
|
|
50
50
|
|
|
51
|
-
import
|
|
52
|
-
import OpenDrawerRightIcon from '@patternfly/react-icons/dist/esm/icons/open-drawer-right-icon';
|
|
53
|
-
import OutlinedWindowRestoreIcon from '@patternfly/react-icons/dist/esm/icons/outlined-window-restore-icon';
|
|
51
|
+
import { RhUiExpandIcon, RhUiOpenDrawerRightIcon, RhUiRestoreWindowIcon } from '@patternfly/react-icons';
|
|
54
52
|
import { BarsIcon } from '@patternfly/react-icons/dist/esm/icons/bars-icon';
|
|
55
|
-
import {
|
|
56
|
-
import { WrenchIcon } from '@patternfly/react-icons/dist/esm/icons/wrench-icon';
|
|
53
|
+
import { RhUiBuildFillIcon, RhUiCopyFillIcon } from '@patternfly/react-icons';
|
|
57
54
|
import {
|
|
58
55
|
Button,
|
|
59
56
|
DescriptionList,
|
|
@@ -21,10 +21,7 @@ import ChatbotHeader, {
|
|
|
21
21
|
ChatbotHeaderOptionsDropdown
|
|
22
22
|
} from '@patternfly/chatbot/dist/dynamic/ChatbotHeader';
|
|
23
23
|
|
|
24
|
-
import
|
|
25
|
-
import OpenDrawerRightIcon from '@patternfly/react-icons/dist/esm/icons/open-drawer-right-icon';
|
|
26
|
-
import OutlinedWindowRestoreIcon from '@patternfly/react-icons/dist/esm/icons/outlined-window-restore-icon';
|
|
27
|
-
|
|
24
|
+
import { RhUiExpandIcon, RhUiOpenDrawerRightIcon, RhUiRestoreWindowIcon } from '@patternfly/react-icons';
|
|
28
25
|
import PFHorizontalLogoColor from '../UI/PF-HorizontalLogo-Color.svg';
|
|
29
26
|
import PFHorizontalLogoReverse from '../UI/PF-HorizontalLogo-Reverse.svg';
|
|
30
27
|
import PFIconLogoColor from '../UI/PF-IconLogo-Color.svg';
|
|
@@ -393,7 +390,7 @@ export const ChatbotDemo: FunctionComponent = () => {
|
|
|
393
390
|
<DropdownItem
|
|
394
391
|
value={ChatbotDisplayMode.default}
|
|
395
392
|
key="switchDisplayOverlay"
|
|
396
|
-
icon={<
|
|
393
|
+
icon={<RhUiRestoreWindowIcon aria-hidden />}
|
|
397
394
|
isSelected={displayMode === ChatbotDisplayMode.default}
|
|
398
395
|
>
|
|
399
396
|
<span>Overlay</span>
|
|
@@ -401,7 +398,7 @@ export const ChatbotDemo: FunctionComponent = () => {
|
|
|
401
398
|
<DropdownItem
|
|
402
399
|
value={ChatbotDisplayMode.docked}
|
|
403
400
|
key="switchDisplayDock"
|
|
404
|
-
icon={<
|
|
401
|
+
icon={<RhUiOpenDrawerRightIcon aria-hidden />}
|
|
405
402
|
isSelected={displayMode === ChatbotDisplayMode.docked}
|
|
406
403
|
>
|
|
407
404
|
<span>Dock to window</span>
|
|
@@ -409,7 +406,7 @@ export const ChatbotDemo: FunctionComponent = () => {
|
|
|
409
406
|
<DropdownItem
|
|
410
407
|
value={ChatbotDisplayMode.fullscreen}
|
|
411
408
|
key="switchDisplayFullscreen"
|
|
412
|
-
icon={<
|
|
409
|
+
icon={<RhUiExpandIcon aria-hidden />}
|
|
413
410
|
isSelected={displayMode === ChatbotDisplayMode.fullscreen}
|
|
414
411
|
>
|
|
415
412
|
<span>Fullscreen</span>
|
|
@@ -20,9 +20,7 @@ import ChatbotHeader, {
|
|
|
20
20
|
ChatbotHeaderMain
|
|
21
21
|
} from '@patternfly/chatbot/dist/dynamic/ChatbotHeader';
|
|
22
22
|
import ChatbotAlert from '@patternfly/chatbot/dist/dynamic/ChatbotAlert';
|
|
23
|
-
import
|
|
24
|
-
import OpenDrawerRightIcon from '@patternfly/react-icons/dist/esm/icons/open-drawer-right-icon';
|
|
25
|
-
import OutlinedWindowRestoreIcon from '@patternfly/react-icons/dist/esm/icons/outlined-window-restore-icon';
|
|
23
|
+
import { RhUiExpandIcon, RhUiOpenDrawerRightIcon, RhUiRestoreWindowIcon } from '@patternfly/react-icons';
|
|
26
24
|
import PFHorizontalLogoColor from '../UI/PF-HorizontalLogo-Color.svg';
|
|
27
25
|
import PFHorizontalLogoReverse from '../UI/PF-HorizontalLogo-Reverse.svg';
|
|
28
26
|
import PFIconLogoColor from '../UI/PF-IconLogo-Color.svg';
|
|
@@ -197,7 +195,7 @@ export const BasicDemo: FunctionComponent = () => {
|
|
|
197
195
|
<DropdownItem
|
|
198
196
|
value={ChatbotDisplayMode.default}
|
|
199
197
|
key="switchDisplayOverlay"
|
|
200
|
-
icon={<
|
|
198
|
+
icon={<RhUiRestoreWindowIcon aria-hidden />}
|
|
201
199
|
isSelected={displayMode === ChatbotDisplayMode.default}
|
|
202
200
|
>
|
|
203
201
|
<span>Overlay</span>
|
|
@@ -205,7 +203,7 @@ export const BasicDemo: FunctionComponent = () => {
|
|
|
205
203
|
<DropdownItem
|
|
206
204
|
value={ChatbotDisplayMode.docked}
|
|
207
205
|
key="switchDisplayDock"
|
|
208
|
-
icon={<
|
|
206
|
+
icon={<RhUiOpenDrawerRightIcon aria-hidden />}
|
|
209
207
|
isSelected={displayMode === ChatbotDisplayMode.docked}
|
|
210
208
|
>
|
|
211
209
|
<span>Dock to window</span>
|
|
@@ -213,7 +211,7 @@ export const BasicDemo: FunctionComponent = () => {
|
|
|
213
211
|
<DropdownItem
|
|
214
212
|
value={ChatbotDisplayMode.fullscreen}
|
|
215
213
|
key="switchDisplayFullscreen"
|
|
216
|
-
icon={<
|
|
214
|
+
icon={<RhUiExpandIcon aria-hidden />}
|
|
217
215
|
isSelected={displayMode === ChatbotDisplayMode.fullscreen}
|
|
218
216
|
>
|
|
219
217
|
<span>Fullscreen</span>
|
|
@@ -21,10 +21,7 @@ import ChatbotHeader, {
|
|
|
21
21
|
ChatbotHeaderOptionsDropdown
|
|
22
22
|
} from '@patternfly/chatbot/dist/dynamic/ChatbotHeader';
|
|
23
23
|
|
|
24
|
-
import
|
|
25
|
-
import OpenDrawerRightIcon from '@patternfly/react-icons/dist/esm/icons/open-drawer-right-icon';
|
|
26
|
-
import OutlinedWindowRestoreIcon from '@patternfly/react-icons/dist/esm/icons/outlined-window-restore-icon';
|
|
27
|
-
|
|
24
|
+
import { RhUiExpandIcon, RhUiOpenDrawerRightIcon, RhUiRestoreWindowIcon } from '@patternfly/react-icons';
|
|
28
25
|
import PFHorizontalLogoColor from '../UI/PF-HorizontalLogo-Color.svg';
|
|
29
26
|
import PFHorizontalLogoReverse from '../UI/PF-HorizontalLogo-Reverse.svg';
|
|
30
27
|
import PFIconLogoColor from '../UI/PF-IconLogo-Color.svg';
|
|
@@ -381,7 +378,7 @@ export const ChatbotDemo: FunctionComponent = () => {
|
|
|
381
378
|
<DropdownItem
|
|
382
379
|
value={ChatbotDisplayMode.default}
|
|
383
380
|
key="switchDisplayOverlay"
|
|
384
|
-
icon={<
|
|
381
|
+
icon={<RhUiRestoreWindowIcon aria-hidden />}
|
|
385
382
|
isSelected={displayMode === ChatbotDisplayMode.default}
|
|
386
383
|
>
|
|
387
384
|
<span>Overlay</span>
|
|
@@ -389,7 +386,7 @@ export const ChatbotDemo: FunctionComponent = () => {
|
|
|
389
386
|
<DropdownItem
|
|
390
387
|
value={ChatbotDisplayMode.docked}
|
|
391
388
|
key="switchDisplayDock"
|
|
392
|
-
icon={<
|
|
389
|
+
icon={<RhUiOpenDrawerRightIcon aria-hidden />}
|
|
393
390
|
isSelected={displayMode === ChatbotDisplayMode.docked}
|
|
394
391
|
>
|
|
395
392
|
<span>Dock to window</span>
|
|
@@ -397,7 +394,7 @@ export const ChatbotDemo: FunctionComponent = () => {
|
|
|
397
394
|
<DropdownItem
|
|
398
395
|
value={ChatbotDisplayMode.fullscreen}
|
|
399
396
|
key="switchDisplayFullscreen"
|
|
400
|
-
icon={<
|
|
397
|
+
icon={<RhUiExpandIcon aria-hidden />}
|
|
401
398
|
isSelected={displayMode === ChatbotDisplayMode.fullscreen}
|
|
402
399
|
>
|
|
403
400
|
<span>Fullscreen</span>
|
|
@@ -43,10 +43,7 @@ import ChatbotHeader, {
|
|
|
43
43
|
} from '@patternfly/chatbot/dist/dynamic/ChatbotHeader';
|
|
44
44
|
import PFIconLogoColor from '../UI/PF-IconLogo-Color.svg';
|
|
45
45
|
import PFIconLogoReverse from '../UI/PF-IconLogo-Reverse.svg';
|
|
46
|
-
import { BarsIcon } from '@patternfly/react-icons';
|
|
47
|
-
import ExpandIcon from '@patternfly/react-icons/dist/esm/icons/expand-icon';
|
|
48
|
-
import OpenDrawerRightIcon from '@patternfly/react-icons/dist/esm/icons/open-drawer-right-icon';
|
|
49
|
-
import OutlinedWindowRestoreIcon from '@patternfly/react-icons/dist/esm/icons/outlined-window-restore-icon';
|
|
46
|
+
import { BarsIcon, RhUiExpandIcon, RhUiOpenDrawerRightIcon, RhUiRestoreWindowIcon } from '@patternfly/react-icons';
|
|
50
47
|
import userAvatar from '../Messages/user_avatar.svg';
|
|
51
48
|
import '@patternfly/react-core/dist/styles/base.css';
|
|
52
49
|
import '@patternfly/chatbot/dist/css/main.css';
|
|
@@ -365,7 +362,7 @@ export const ChatbotDisplayModeDemo: FunctionComponent = () => {
|
|
|
365
362
|
<DropdownItem
|
|
366
363
|
value={ChatbotDisplayMode.default}
|
|
367
364
|
key="switchDisplayOverlay"
|
|
368
|
-
icon={<
|
|
365
|
+
icon={<RhUiRestoreWindowIcon aria-hidden />}
|
|
369
366
|
isSelected={displayMode === ChatbotDisplayMode.default}
|
|
370
367
|
>
|
|
371
368
|
<span>Overlay</span>
|
|
@@ -373,7 +370,7 @@ export const ChatbotDisplayModeDemo: FunctionComponent = () => {
|
|
|
373
370
|
<DropdownItem
|
|
374
371
|
value={ChatbotDisplayMode.drawer}
|
|
375
372
|
key="switchDisplayDock"
|
|
376
|
-
icon={<
|
|
373
|
+
icon={<RhUiOpenDrawerRightIcon aria-hidden />}
|
|
377
374
|
isSelected={displayMode === ChatbotDisplayMode.drawer}
|
|
378
375
|
>
|
|
379
376
|
<span>Drawer</span>
|
|
@@ -381,7 +378,7 @@ export const ChatbotDisplayModeDemo: FunctionComponent = () => {
|
|
|
381
378
|
<DropdownItem
|
|
382
379
|
value={ChatbotDisplayMode.fullscreen}
|
|
383
380
|
key="switchDisplayFullscreen"
|
|
384
|
-
icon={<
|
|
381
|
+
icon={<RhUiExpandIcon aria-hidden />}
|
|
385
382
|
isSelected={displayMode === ChatbotDisplayMode.fullscreen}
|
|
386
383
|
>
|
|
387
384
|
<span>Fullscreen</span>
|
|
@@ -21,11 +21,7 @@ import ChatbotHeader, {
|
|
|
21
21
|
ChatbotHeaderSelectorDropdown,
|
|
22
22
|
ChatbotHeaderOptionsDropdown
|
|
23
23
|
} from '@patternfly/chatbot/dist/dynamic/ChatbotHeader';
|
|
24
|
-
|
|
25
|
-
import ExpandIcon from '@patternfly/react-icons/dist/esm/icons/expand-icon';
|
|
26
|
-
import OpenDrawerRightIcon from '@patternfly/react-icons/dist/esm/icons/open-drawer-right-icon';
|
|
27
|
-
import OutlinedWindowRestoreIcon from '@patternfly/react-icons/dist/esm/icons/outlined-window-restore-icon';
|
|
28
|
-
|
|
24
|
+
import { RhUiExpandIcon, RhUiOpenDrawerRightIcon, RhUiRestoreWindowIcon } from '@patternfly/react-icons';
|
|
29
25
|
import PFHorizontalLogoColor from '../UI/PF-HorizontalLogo-Color.svg';
|
|
30
26
|
import PFHorizontalLogoReverse from '../UI/PF-HorizontalLogo-Reverse.svg';
|
|
31
27
|
import PFIconLogoColor from '../UI/PF-IconLogo-Color.svg';
|
|
@@ -450,7 +446,7 @@ export const ChatbotScrollingDemo: React.FunctionComponent = () => {
|
|
|
450
446
|
<DropdownItem
|
|
451
447
|
value={ChatbotDisplayMode.default}
|
|
452
448
|
key="switchDisplayOverlay"
|
|
453
|
-
icon={<
|
|
449
|
+
icon={<RhUiRestoreWindowIcon aria-hidden />}
|
|
454
450
|
isSelected={displayMode === ChatbotDisplayMode.default}
|
|
455
451
|
>
|
|
456
452
|
<span>Overlay</span>
|
|
@@ -458,7 +454,7 @@ export const ChatbotScrollingDemo: React.FunctionComponent = () => {
|
|
|
458
454
|
<DropdownItem
|
|
459
455
|
value={ChatbotDisplayMode.docked}
|
|
460
456
|
key="switchDisplayDock"
|
|
461
|
-
icon={<
|
|
457
|
+
icon={<RhUiOpenDrawerRightIcon aria-hidden />}
|
|
462
458
|
isSelected={displayMode === ChatbotDisplayMode.docked}
|
|
463
459
|
>
|
|
464
460
|
<span>Dock to window</span>
|
|
@@ -466,7 +462,7 @@ export const ChatbotScrollingDemo: React.FunctionComponent = () => {
|
|
|
466
462
|
<DropdownItem
|
|
467
463
|
value={ChatbotDisplayMode.fullscreen}
|
|
468
464
|
key="switchDisplayFullscreen"
|
|
469
|
-
icon={<
|
|
465
|
+
icon={<RhUiExpandIcon aria-hidden />}
|
|
470
466
|
isSelected={displayMode === ChatbotDisplayMode.fullscreen}
|
|
471
467
|
>
|
|
472
468
|
<span>Fullscreen</span>
|
|
@@ -21,10 +21,7 @@ import ChatbotHeader, {
|
|
|
21
21
|
ChatbotHeaderOptionsDropdown
|
|
22
22
|
} from '@patternfly/chatbot/dist/dynamic/ChatbotHeader';
|
|
23
23
|
|
|
24
|
-
import
|
|
25
|
-
import OpenDrawerRightIcon from '@patternfly/react-icons/dist/esm/icons/open-drawer-right-icon';
|
|
26
|
-
import OutlinedWindowRestoreIcon from '@patternfly/react-icons/dist/esm/icons/outlined-window-restore-icon';
|
|
27
|
-
|
|
24
|
+
import { RhUiExpandIcon, RhUiOpenDrawerRightIcon, RhUiRestoreWindowIcon } from '@patternfly/react-icons';
|
|
28
25
|
import PFHorizontalLogoColor from '../UI/PF-HorizontalLogo-Color.svg';
|
|
29
26
|
import PFHorizontalLogoReverse from '../UI/PF-HorizontalLogo-Reverse.svg';
|
|
30
27
|
import PFIconLogoColor from '../UI/PF-IconLogo-Color.svg';
|
|
@@ -470,7 +467,7 @@ export const ChatbotDemo: FunctionComponent = () => {
|
|
|
470
467
|
<DropdownItem
|
|
471
468
|
value={ChatbotDisplayMode.default}
|
|
472
469
|
key="switchDisplayOverlay"
|
|
473
|
-
icon={<
|
|
470
|
+
icon={<RhUiRestoreWindowIcon aria-hidden />}
|
|
474
471
|
isSelected={displayMode === ChatbotDisplayMode.default}
|
|
475
472
|
>
|
|
476
473
|
<span>Overlay</span>
|
|
@@ -478,7 +475,7 @@ export const ChatbotDemo: FunctionComponent = () => {
|
|
|
478
475
|
<DropdownItem
|
|
479
476
|
value={ChatbotDisplayMode.docked}
|
|
480
477
|
key="switchDisplayDock"
|
|
481
|
-
icon={<
|
|
478
|
+
icon={<RhUiOpenDrawerRightIcon aria-hidden />}
|
|
482
479
|
isSelected={displayMode === ChatbotDisplayMode.docked}
|
|
483
480
|
>
|
|
484
481
|
<span>Dock to window</span>
|
|
@@ -486,7 +483,7 @@ export const ChatbotDemo: FunctionComponent = () => {
|
|
|
486
483
|
<DropdownItem
|
|
487
484
|
value={ChatbotDisplayMode.fullscreen}
|
|
488
485
|
key="switchDisplayFullscreen"
|
|
489
|
-
icon={<
|
|
486
|
+
icon={<RhUiExpandIcon aria-hidden />}
|
|
490
487
|
isSelected={displayMode === ChatbotDisplayMode.fullscreen}
|
|
491
488
|
>
|
|
492
489
|
<span>Fullscreen</span>
|
|
@@ -7,8 +7,7 @@ import { useState } from 'react';
|
|
|
7
7
|
|
|
8
8
|
// Import PatternFly components
|
|
9
9
|
import { MenuToggleElement, Tooltip, MenuToggle, Dropdown, DropdownProps } from '@patternfly/react-core';
|
|
10
|
-
|
|
11
|
-
import EllipsisIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-v-icon';
|
|
10
|
+
import { RhUiEllipsisVerticalFillIcon } from '@patternfly/react-icons/dist/esm/icons/rh-ui-ellipsis-vertical-fill-icon';
|
|
12
11
|
|
|
13
12
|
export interface ChatbotConversationHistoryDropdownProps extends Omit<DropdownProps, 'toggle'> {
|
|
14
13
|
/** Dropdown items rendered in conversation settings dropdown */
|
|
@@ -53,7 +52,7 @@ export const ChatbotConversationHistoryDropdown: FunctionComponent<ChatbotConver
|
|
|
53
52
|
id={id}
|
|
54
53
|
role="menuitem"
|
|
55
54
|
>
|
|
56
|
-
<
|
|
55
|
+
<RhUiEllipsisVerticalFillIcon />
|
|
57
56
|
</MenuToggle>
|
|
58
57
|
</Tooltip>
|
|
59
58
|
);
|
|
@@ -45,7 +45,7 @@ import {
|
|
|
45
45
|
MenuContentProps
|
|
46
46
|
} from '@patternfly/react-core';
|
|
47
47
|
|
|
48
|
-
import {
|
|
48
|
+
import { RhUiClockIcon, RhUiCommentIcon, RhUiEditFillIcon } from '@patternfly/react-icons';
|
|
49
49
|
import { ChatbotDisplayMode } from '../Chatbot/Chatbot';
|
|
50
50
|
import ConversationHistoryDropdown from './ChatbotConversationHistoryDropdown';
|
|
51
51
|
import LoadingState from './LoadingState';
|
|
@@ -195,7 +195,7 @@ export const ChatbotConversationHistoryNav: FunctionComponent<ChatbotConversatio
|
|
|
195
195
|
isCompact,
|
|
196
196
|
title = 'Chat history',
|
|
197
197
|
navTitleProps,
|
|
198
|
-
navTitleIcon = <
|
|
198
|
+
navTitleIcon = <RhUiClockIcon />,
|
|
199
199
|
searchInputScreenReaderText,
|
|
200
200
|
searchActionStart,
|
|
201
201
|
searchActionEnd,
|
|
@@ -218,7 +218,7 @@ export const ChatbotConversationHistoryNav: FunctionComponent<ChatbotConversatio
|
|
|
218
218
|
<MenuItem
|
|
219
219
|
className={`pf-chatbot__menu-item ${activeItemId && activeItemId === conversation.id ? 'pf-chatbot__menu-item--active' : ''}`}
|
|
220
220
|
itemId={conversation.id}
|
|
221
|
-
{...(conversation.noIcon ? {} : { icon: conversation.icon ?? <
|
|
221
|
+
{...(conversation.noIcon ? {} : { icon: conversation.icon ?? <RhUiCommentIcon /> })}
|
|
222
222
|
/* eslint-disable indent */
|
|
223
223
|
{...(conversation.menuItems
|
|
224
224
|
? {
|
|
@@ -354,7 +354,7 @@ export const ChatbotConversationHistoryNav: FunctionComponent<ChatbotConversatio
|
|
|
354
354
|
<Button
|
|
355
355
|
size={isCompact ? 'sm' : undefined}
|
|
356
356
|
onClick={onNewChat}
|
|
357
|
-
icon={<
|
|
357
|
+
icon={<RhUiEditFillIcon />}
|
|
358
358
|
{...newChatButtonProps}
|
|
359
359
|
>
|
|
360
360
|
{newChatButtonText}
|
|
@@ -2,7 +2,7 @@ import type { Ref, FunctionComponent } from 'react';
|
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
|
|
4
4
|
import { Button, ButtonProps, Icon, Tooltip, TooltipProps } from '@patternfly/react-core';
|
|
5
|
-
import {
|
|
5
|
+
import { RhMicronsCloseIcon } from '@patternfly/react-icons';
|
|
6
6
|
|
|
7
7
|
export interface ChatbotHeaderCloseButtonProps extends ButtonProps {
|
|
8
8
|
/** Callback function for when button is clicked */
|
|
@@ -47,7 +47,7 @@ const ChatbotHeaderCloseButtonBase: FunctionComponent<ChatbotHeaderCloseButtonPr
|
|
|
47
47
|
ref={innerRef}
|
|
48
48
|
icon={
|
|
49
49
|
<Icon size={isCompact ? 'lg' : 'xl'} isInline>
|
|
50
|
-
<
|
|
50
|
+
<RhMicronsCloseIcon />
|
|
51
51
|
</Icon>
|
|
52
52
|
}
|
|
53
53
|
size={isCompact ? 'sm' : undefined}
|
|
@@ -2,8 +2,7 @@ import type { Ref, FunctionComponent } from 'react';
|
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
|
|
4
4
|
import { Button, ButtonProps, Icon, Tooltip, TooltipProps } from '@patternfly/react-core';
|
|
5
|
-
import {
|
|
6
|
-
|
|
5
|
+
import { RhUiEditFillIcon } from '@patternfly/react-icons/dist/esm/icons/rh-ui-edit-fill-icon';
|
|
7
6
|
export interface ChatbotHeaderNewChatButtonProps extends ButtonProps {
|
|
8
7
|
/** Callback function for when button is clicked */
|
|
9
8
|
onClick: () => void;
|
|
@@ -47,7 +46,7 @@ const ChatbotHeaderNewChatButtonBase: FunctionComponent<ChatbotHeaderNewChatButt
|
|
|
47
46
|
ref={innerRef}
|
|
48
47
|
icon={
|
|
49
48
|
<Icon size={isCompact ? 'lg' : 'xl'} isInline>
|
|
50
|
-
<
|
|
49
|
+
<RhUiEditFillIcon />
|
|
51
50
|
</Icon>
|
|
52
51
|
}
|
|
53
52
|
size={isCompact ? 'sm' : undefined}
|
|
@@ -257,6 +257,20 @@ export const MarkdownContent: FunctionComponent<MarkdownContentProps> = ({
|
|
|
257
257
|
remarkRehypeOptions={{
|
|
258
258
|
// removes sr-only class from footnote labels applied by default
|
|
259
259
|
footnoteLabelProperties: { className: [''] },
|
|
260
|
+
// omit default ↩ text; backref icon is rendered in LinkMessage
|
|
261
|
+
footnoteBackContent: (_referenceIndex, rereferenceIndex) => {
|
|
262
|
+
if (rereferenceIndex > 1) {
|
|
263
|
+
return [
|
|
264
|
+
{
|
|
265
|
+
type: 'element',
|
|
266
|
+
tagName: 'sup',
|
|
267
|
+
properties: {},
|
|
268
|
+
children: [{ type: 'text', value: String(rereferenceIndex) }]
|
|
269
|
+
}
|
|
270
|
+
];
|
|
271
|
+
}
|
|
272
|
+
return [];
|
|
273
|
+
},
|
|
260
274
|
...reactMarkdownProps?.remarkRehypeOptions
|
|
261
275
|
}}
|
|
262
276
|
disallowedElements={disallowedElements}
|
|
@@ -18,8 +18,8 @@ import {
|
|
|
18
18
|
} from '@patternfly/react-core';
|
|
19
19
|
|
|
20
20
|
import { CheckIcon } from '@patternfly/react-icons/dist/esm/icons/check-icon';
|
|
21
|
-
import { CopyIcon } from '@patternfly/react-icons/dist/esm/icons/copy-icon';
|
|
22
21
|
import { css } from '@patternfly/react-styles';
|
|
22
|
+
import { RhUiCopyFillIcon } from '@patternfly/react-icons';
|
|
23
23
|
|
|
24
24
|
export interface CodeBlockMessageProps {
|
|
25
25
|
/** Content rendered in code block */
|
|
@@ -142,7 +142,7 @@ const CodeBlockMessage = ({
|
|
|
142
142
|
className="pf-chatbot__button--copy"
|
|
143
143
|
onClick={(event) => handleCopy(event, children)}
|
|
144
144
|
>
|
|
145
|
-
{copied ? <CheckIcon /> : <
|
|
145
|
+
{copied ? <CheckIcon /> : <RhUiCopyFillIcon />}
|
|
146
146
|
</Button>
|
|
147
147
|
<Tooltip id={tooltipID} content="Copy" position="top" triggerRef={buttonRef} />
|
|
148
148
|
</CodeBlockAction>
|
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
// ============================================================================
|
|
4
4
|
|
|
5
5
|
import { Button, ButtonProps } from '@patternfly/react-core';
|
|
6
|
-
import {
|
|
6
|
+
import { RhMicronsExternalLinkIcon, RhUiBackwardsIcon } from '@patternfly/react-icons';
|
|
7
7
|
import { ExtraProps } from 'react-markdown';
|
|
8
8
|
import { css } from '@patternfly/react-styles';
|
|
9
9
|
|
|
10
|
+
const isFootnoteBackref = (className?: string) => className?.includes('data-footnote-backref');
|
|
11
|
+
|
|
10
12
|
export interface LinkMessageProps {
|
|
11
13
|
/** Flag indicating that the content should retain message styles when using Markdown. */
|
|
12
14
|
shouldRetainStyles?: boolean;
|
|
@@ -26,7 +28,7 @@ const LinkMessage = ({
|
|
|
26
28
|
component="a"
|
|
27
29
|
variant="link"
|
|
28
30
|
href={href}
|
|
29
|
-
icon={<
|
|
31
|
+
icon={<RhMicronsExternalLinkIcon />}
|
|
30
32
|
iconPosition="end"
|
|
31
33
|
isInline
|
|
32
34
|
target={target}
|
|
@@ -40,6 +42,23 @@ const LinkMessage = ({
|
|
|
40
42
|
);
|
|
41
43
|
}
|
|
42
44
|
|
|
45
|
+
if (isFootnoteBackref(props.className)) {
|
|
46
|
+
return (
|
|
47
|
+
<Button
|
|
48
|
+
isInline
|
|
49
|
+
component="a"
|
|
50
|
+
href={href}
|
|
51
|
+
variant="link"
|
|
52
|
+
id={id}
|
|
53
|
+
icon={<RhUiBackwardsIcon />}
|
|
54
|
+
{...props}
|
|
55
|
+
className={css(shouldRetainStyles && 'pf-m-markdown', props?.className)}
|
|
56
|
+
>
|
|
57
|
+
{children}
|
|
58
|
+
</Button>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
43
62
|
return (
|
|
44
63
|
// need to explicitly call this out or id doesn't seem to get passed - required for footnotes
|
|
45
64
|
<Button
|
|
@@ -23,10 +23,12 @@ jest.mock('@patternfly/react-icons', () => ({
|
|
|
23
23
|
RhUiVolumeUpFillIcon: () => <div>RhUiVolumeUpFillIcon</div>,
|
|
24
24
|
RhUiExportIcon: () => <div>RhUiExportIcon</div>,
|
|
25
25
|
RhUiExportFillIcon: () => <div>RhUiExportFillIcon</div>,
|
|
26
|
+
RhMicronsInformationFillIcon: () => <div>RhMicronsInformationFillIcon</div>,
|
|
26
27
|
CheckIcon: () => <div>CheckIcon</div>,
|
|
27
28
|
CloseIcon: () => <div>CloseIcon</div>,
|
|
28
29
|
ExternalLinkSquareAltIcon: () => <div>ExternalLinkSquareAltIcon</div>,
|
|
29
|
-
TimesIcon: () => <div>TimesIcon</div
|
|
30
|
+
TimesIcon: () => <div>TimesIcon</div>,
|
|
31
|
+
RhUiBackwardsIcon: () => <div>RhUiBackwardsIcon</div>
|
|
30
32
|
}));
|
|
31
33
|
|
|
32
34
|
const ALL_ACTIONS = [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { FC } from 'react';
|
|
2
2
|
import { useRef } from 'react';
|
|
3
3
|
import { Button, Flex, pluralize, Popover } from '@patternfly/react-core';
|
|
4
|
-
import
|
|
4
|
+
import { RhMicronsInformationFillIcon } from '@patternfly/react-icons';
|
|
5
5
|
|
|
6
6
|
interface QuickStartTileDescriptionProps {
|
|
7
7
|
/** QuickStart description */
|
|
@@ -57,7 +57,7 @@ const QuickStartTileDescription: FC<QuickStartTileDescriptionProps> = ({
|
|
|
57
57
|
}}
|
|
58
58
|
aria-label={quickStartButtonAriaLabel}
|
|
59
59
|
>
|
|
60
|
-
<
|
|
60
|
+
<RhMicronsInformationFillIcon />
|
|
61
61
|
</Button>
|
|
62
62
|
<Popover
|
|
63
63
|
aria-label={pluralizedPrereq}
|
|
@@ -18,7 +18,7 @@ describe('JumpButton', () => {
|
|
|
18
18
|
await userEvent.click(screen.getByRole('button', { name: /Back to bottom/i }));
|
|
19
19
|
expect(spy).toHaveBeenCalledTimes(1);
|
|
20
20
|
});
|
|
21
|
-
it('should be hidden if isHidden prop is used',
|
|
21
|
+
it('should be hidden if isHidden prop is used', () => {
|
|
22
22
|
render(<JumpButton position="bottom" onClick={jest.fn()} isHidden />);
|
|
23
23
|
expect(screen.queryByRole('button', { name: /Back to bottom/i })).toBeFalsy();
|
|
24
24
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createRef } from 'react';
|
|
2
2
|
import { act, fireEvent, render, screen, waitFor } from '@testing-library/react';
|
|
3
|
+
import '@testing-library/jest-dom';
|
|
3
4
|
import { MessageBox, MessageBoxHandle } from './MessageBox';
|
|
4
5
|
import userEvent from '@testing-library/user-event';
|
|
5
6
|
|
|
@@ -313,4 +314,94 @@ describe('MessageBox', () => {
|
|
|
313
314
|
|
|
314
315
|
expect(ref.current?.isSmartScrollActive()).toBe(true);
|
|
315
316
|
});
|
|
317
|
+
|
|
318
|
+
it('should keep auto-scroll active during programmatic scroll to bottom', async () => {
|
|
319
|
+
const ref = createRef<MessageBoxHandle>();
|
|
320
|
+
render(
|
|
321
|
+
<MessageBox ref={ref} enableSmartScroll>
|
|
322
|
+
<div>Test message content</div>
|
|
323
|
+
</MessageBox>
|
|
324
|
+
);
|
|
325
|
+
|
|
326
|
+
const element = ref.current!;
|
|
327
|
+
Object.defineProperty(element, 'scrollHeight', { configurable: true, value: 1000 });
|
|
328
|
+
Object.defineProperty(element, 'clientHeight', { configurable: true, value: 300 });
|
|
329
|
+
Object.defineProperty(element, 'scrollTop', { configurable: true, value: 0, writable: true });
|
|
330
|
+
|
|
331
|
+
act(() => {
|
|
332
|
+
ref.current?.scrollToBottom({ behavior: 'smooth' });
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
expect(ref.current?.isSmartScrollActive()).toBe(true);
|
|
336
|
+
|
|
337
|
+
act(() => {
|
|
338
|
+
element.scrollTop = 500;
|
|
339
|
+
element.dispatchEvent(new Event('scroll', { bubbles: true }));
|
|
340
|
+
});
|
|
341
|
+
|
|
342
|
+
expect(ref.current?.isSmartScrollActive()).toBe(true);
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
it('should not scroll to bottom on initial layout when the message box is at the top', () => {
|
|
346
|
+
render(
|
|
347
|
+
<MessageBox enableSmartScroll>
|
|
348
|
+
<div>Tall message content</div>
|
|
349
|
+
</MessageBox>
|
|
350
|
+
);
|
|
351
|
+
|
|
352
|
+
const region = screen.getByRole('region');
|
|
353
|
+
Object.defineProperty(region, 'scrollHeight', { configurable: true, value: 1000 });
|
|
354
|
+
Object.defineProperty(region, 'clientHeight', { configurable: true, value: 300 });
|
|
355
|
+
Object.defineProperty(region, 'scrollTop', { configurable: true, value: 0, writable: true });
|
|
356
|
+
|
|
357
|
+
act(() => {
|
|
358
|
+
region.dispatchEvent(new Event('scroll'));
|
|
359
|
+
});
|
|
360
|
+
|
|
361
|
+
expect(region.scrollTop).toBe(0);
|
|
362
|
+
});
|
|
363
|
+
|
|
364
|
+
it('should show the bottom jump button at the top on initial load when overflowing', async () => {
|
|
365
|
+
render(
|
|
366
|
+
<MessageBox enableSmartScroll>
|
|
367
|
+
<div>Tall message content</div>
|
|
368
|
+
</MessageBox>
|
|
369
|
+
);
|
|
370
|
+
|
|
371
|
+
const region = screen.getByRole('region');
|
|
372
|
+
Object.defineProperty(region, 'scrollHeight', { configurable: true, value: 1000 });
|
|
373
|
+
Object.defineProperty(region, 'clientHeight', { configurable: true, value: 300 });
|
|
374
|
+
Object.defineProperty(region, 'scrollTop', { configurable: true, value: 0, writable: true });
|
|
375
|
+
|
|
376
|
+
act(() => {
|
|
377
|
+
region.dispatchEvent(new Event('scroll'));
|
|
378
|
+
});
|
|
379
|
+
|
|
380
|
+
await waitFor(() => {
|
|
381
|
+
expect(screen.queryByRole('button', { name: /Back to top/i })).toBeFalsy();
|
|
382
|
+
expect(screen.getByRole('button', { name: /Back to bottom/i })).toBeTruthy();
|
|
383
|
+
});
|
|
384
|
+
});
|
|
385
|
+
|
|
386
|
+
it('should hide the bottom jump button while smart scroll is actively following content', async () => {
|
|
387
|
+
render(
|
|
388
|
+
<MessageBox enableSmartScroll>
|
|
389
|
+
<div>Test message content</div>
|
|
390
|
+
</MessageBox>
|
|
391
|
+
);
|
|
392
|
+
|
|
393
|
+
const region = screen.getByRole('region');
|
|
394
|
+
Object.defineProperty(region, 'scrollHeight', { configurable: true, value: 1000 });
|
|
395
|
+
Object.defineProperty(region, 'clientHeight', { configurable: true, value: 300 });
|
|
396
|
+
Object.defineProperty(region, 'scrollTop', { configurable: true, value: 640, writable: true });
|
|
397
|
+
|
|
398
|
+
act(() => {
|
|
399
|
+
region.dispatchEvent(new Event('scroll'));
|
|
400
|
+
});
|
|
401
|
+
|
|
402
|
+
await waitFor(() => {
|
|
403
|
+
expect(screen.getByRole('button', { name: /Back to top/i })).toBeTruthy();
|
|
404
|
+
expect(screen.queryByRole('button', { name: /Back to bottom/i })).toBeFalsy();
|
|
405
|
+
});
|
|
406
|
+
});
|
|
316
407
|
});
|