@patternfly/chatbot 6.3.0-prerelease.3 → 6.3.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/AttachmentEdit/AttachmentEdit.d.ts +2 -0
- package/dist/cjs/AttachmentEdit/AttachmentEdit.js +2 -2
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.d.ts +2 -0
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +2 -2
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +4 -0
- package/dist/cjs/ChatbotModal/ChatbotModal.d.ts +3 -0
- package/dist/cjs/ChatbotModal/ChatbotModal.js +2 -2
- package/dist/cjs/ChatbotModal/ChatbotModal.test.d.ts +1 -0
- package/dist/cjs/ChatbotModal/ChatbotModal.test.js +28 -0
- package/dist/cjs/CodeModal/CodeModal.d.ts +2 -0
- package/dist/cjs/CodeModal/CodeModal.js +3 -3
- package/dist/cjs/CodeModal/CodeModal.test.d.ts +1 -0
- package/dist/cjs/CodeModal/CodeModal.test.js +15 -0
- package/dist/cjs/FileDetails/FileDetails.js +1 -1
- package/dist/cjs/PreviewAttachment/PreviewAttachment.d.ts +2 -0
- package/dist/cjs/PreviewAttachment/PreviewAttachment.js +2 -2
- package/dist/css/main.css +36 -9
- package/dist/css/main.css.map +1 -1
- package/dist/esm/AttachmentEdit/AttachmentEdit.d.ts +2 -0
- package/dist/esm/AttachmentEdit/AttachmentEdit.js +2 -2
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.d.ts +2 -0
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +2 -2
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +4 -0
- package/dist/esm/ChatbotModal/ChatbotModal.d.ts +3 -0
- package/dist/esm/ChatbotModal/ChatbotModal.js +2 -2
- package/dist/esm/ChatbotModal/ChatbotModal.test.d.ts +1 -0
- package/dist/esm/ChatbotModal/ChatbotModal.test.js +23 -0
- package/dist/esm/CodeModal/CodeModal.d.ts +2 -0
- package/dist/esm/CodeModal/CodeModal.js +3 -3
- package/dist/esm/CodeModal/CodeModal.test.d.ts +1 -0
- package/dist/esm/CodeModal/CodeModal.test.js +10 -0
- package/dist/esm/FileDetails/FileDetails.js +1 -1
- package/dist/esm/PreviewAttachment/PreviewAttachment.d.ts +2 -0
- package/dist/esm/PreviewAttachment/PreviewAttachment.js +2 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/AttachmentEdit.tsx +10 -1
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/PreviewAttachment.tsx +10 -1
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawer.tsx +9 -0
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerWithActions.tsx +9 -0
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerWithSelection.tsx +11 -2
- package/src/AttachmentEdit/AttachmentEdit.tsx +5 -1
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.scss +28 -2
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.tsx +18 -0
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.tsx +4 -1
- package/src/ChatbotModal/ChatbotModal.scss +15 -4
- package/src/ChatbotModal/ChatbotModal.test.tsx +59 -0
- package/src/ChatbotModal/ChatbotModal.tsx +5 -1
- package/src/CodeModal/CodeModal.scss +11 -3
- package/src/CodeModal/CodeModal.test.tsx +24 -0
- package/src/CodeModal/CodeModal.tsx +6 -2
- package/src/FileDetails/FileDetails.tsx +1 -1
- package/src/FileDetails/__snapshots__/FileDetails.test.tsx.snap +1 -1
- package/src/FileDetailsLabel/__snapshots__/FileDetailsLabel.test.tsx.snap +1 -1
- package/src/PreviewAttachment/PreviewAttachment.tsx +5 -1
@@ -4,7 +4,7 @@
|
|
4
4
|
import React from 'react';
|
5
5
|
import CodeModal from '../CodeModal';
|
6
6
|
import { ChatbotDisplayMode } from '../Chatbot';
|
7
|
-
export const PreviewAttachment = ({ fileName, code, handleModalToggle, isModalOpen, onDismiss = undefined, onEdit, title = 'Preview attachment', displayMode = ChatbotDisplayMode.default }) => {
|
7
|
+
export const PreviewAttachment = ({ fileName, code, handleModalToggle, isModalOpen, onDismiss = undefined, onEdit, title = 'Preview attachment', displayMode = ChatbotDisplayMode.default, isCompact }) => {
|
8
8
|
const handleEdit = (_event) => {
|
9
9
|
handleModalToggle(_event);
|
10
10
|
onEdit(_event);
|
@@ -13,6 +13,6 @@ export const PreviewAttachment = ({ fileName, code, handleModalToggle, isModalOp
|
|
13
13
|
handleModalToggle(_event);
|
14
14
|
onDismiss && onDismiss(_event);
|
15
15
|
};
|
16
|
-
return (React.createElement(CodeModal, { codeEditorControlClassName: "pf-chatbot__code-modal--controls", code: code, fileName: fileName, handleModalToggle: handleModalToggle, isCopyEnabled: true, isLineNumbersVisible: false, isModalOpen: isModalOpen, onPrimaryAction: handleEdit, onSecondaryAction: handleDismiss, primaryActionBtn: "Edit", secondaryActionBtn: "Dismiss", title: title, isReadOnly: true, displayMode: displayMode }));
|
16
|
+
return (React.createElement(CodeModal, { codeEditorControlClassName: "pf-chatbot__code-modal--controls", code: code, fileName: fileName, handleModalToggle: handleModalToggle, isCopyEnabled: true, isLineNumbersVisible: false, isModalOpen: isModalOpen, onPrimaryAction: handleEdit, onSecondaryAction: handleDismiss, primaryActionBtn: "Edit", secondaryActionBtn: "Dismiss", title: title, isReadOnly: true, displayMode: displayMode, isCompact: isCompact }));
|
17
17
|
};
|
18
18
|
export default PreviewAttachment;
|
@@ -1 +1 @@
|
|
1
|
-
{"root":["../src/index.ts","../src/AttachMenu/AttachMenu.tsx","../src/AttachMenu/index.ts","../src/AttachmentEdit/AttachmentEdit.test.tsx","../src/AttachmentEdit/AttachmentEdit.tsx","../src/AttachmentEdit/index.ts","../src/Chatbot/Chatbot.test.tsx","../src/Chatbot/Chatbot.tsx","../src/Chatbot/index.ts","../src/ChatbotAlert/ChatbotAlert.test.tsx","../src/ChatbotAlert/ChatbotAlert.tsx","../src/ChatbotAlert/index.ts","../src/ChatbotContent/ChatbotContent.test.tsx","../src/ChatbotContent/ChatbotContent.tsx","../src/ChatbotContent/index.ts","../src/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.test.tsx","../src/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.tsx","../src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.tsx","../src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.tsx","../src/ChatbotConversationHistoryNav/EmptyState.tsx","../src/ChatbotConversationHistoryNav/LoadingState.tsx","../src/ChatbotConversationHistoryNav/index.ts","../src/ChatbotFooter/ChatbotFooter.test.tsx","../src/ChatbotFooter/ChatbotFooter.tsx","../src/ChatbotFooter/ChatbotFooternote.test.tsx","../src/ChatbotFooter/ChatbotFootnote.tsx","../src/ChatbotFooter/index.ts","../src/ChatbotHeader/ChatbotHeader.test.tsx","../src/ChatbotHeader/ChatbotHeader.tsx","../src/ChatbotHeader/ChatbotHeaderActions.test.tsx","../src/ChatbotHeader/ChatbotHeaderActions.tsx","../src/ChatbotHeader/ChatbotHeaderCloseButton.test.tsx","../src/ChatbotHeader/ChatbotHeaderCloseButton.tsx","../src/ChatbotHeader/ChatbotHeaderMain.test.tsx","../src/ChatbotHeader/ChatbotHeaderMain.tsx","../src/ChatbotHeader/ChatbotHeaderMenu.test.tsx","../src/ChatbotHeader/ChatbotHeaderMenu.tsx","../src/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.tsx","../src/ChatbotHeader/ChatbotHeaderOptionsDropdown.tsx","../src/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.tsx","../src/ChatbotHeader/ChatbotHeaderSelectorDropdown.tsx","../src/ChatbotHeader/ChatbotHeaderTitle.test.tsx","../src/ChatbotHeader/ChatbotHeaderTitle.tsx","../src/ChatbotHeader/index.ts","../src/ChatbotModal/ChatbotModal.tsx","../src/ChatbotModal/index.ts","../src/ChatbotPopover/ChatbotPopover.tsx","../src/ChatbotPopover/index.ts","../src/ChatbotToggle/ChatbotToggle.test.tsx","../src/ChatbotToggle/ChatbotToggle.tsx","../src/ChatbotToggle/index.ts","../src/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.tsx","../src/ChatbotWelcomePrompt/ChatbotWelcomePrompt.tsx","../src/ChatbotWelcomePrompt/index.ts","../src/CodeModal/CodeModal.tsx","../src/CodeModal/index.ts","../src/Compare/Compare.test.tsx","../src/Compare/Compare.tsx","../src/Compare/index.ts","../src/FileDetails/FileDetails.test.tsx","../src/FileDetails/FileDetails.tsx","../src/FileDetails/index.ts","../src/FileDetailsLabel/FileDetailsLabel.test.tsx","../src/FileDetailsLabel/FileDetailsLabel.tsx","../src/FileDetailsLabel/index.ts","../src/FileDropZone/FileDropZone.test.tsx","../src/FileDropZone/FileDropZone.tsx","../src/FileDropZone/index.ts","../src/LoadingMessage/LoadingMessage.test.tsx","../src/LoadingMessage/LoadingMessage.tsx","../src/LoadingMessage/index.ts","../src/Message/Message.test.tsx","../src/Message/Message.tsx","../src/Message/MessageInput.tsx","../src/Message/MessageLoading.tsx","../src/Message/index.ts","../src/Message/CodeBlockMessage/CodeBlockMessage.tsx","../src/Message/ErrorMessage/ErrorMessage.tsx","../src/Message/ImageMessage/ImageMessage.tsx","../src/Message/LinkMessage/LinkMessage.tsx","../src/Message/ListMessage/ListItemMessage.tsx","../src/Message/ListMessage/OrderedListMessage.tsx","../src/Message/ListMessage/UnorderedListMessage.tsx","../src/Message/QuickResponse/QuickResponse.tsx","../src/Message/QuickStarts/FallbackImg.tsx","../src/Message/QuickStarts/QuickStartTile.tsx","../src/Message/QuickStarts/QuickStartTileDescription.test.tsx","../src/Message/QuickStarts/QuickStartTileDescription.tsx","../src/Message/QuickStarts/QuickStartTileHeader.tsx","../src/Message/QuickStarts/monitor-sampleapp-quickstart-with-image.ts","../src/Message/QuickStarts/monitor-sampleapp-quickstart.ts","../src/Message/QuickStarts/types.ts","../src/Message/TableMessage/TableMessage.tsx","../src/Message/TableMessage/TbodyMessage.tsx","../src/Message/TableMessage/TdMessage.tsx","../src/Message/TableMessage/ThMessage.tsx","../src/Message/TableMessage/TheadMessage.tsx","../src/Message/TableMessage/TrMessage.tsx","../src/Message/TextMessage/TextMessage.tsx","../src/Message/UserFeedback/CloseButton.tsx","../src/Message/UserFeedback/UserFeedback.test.tsx","../src/Message/UserFeedback/UserFeedback.tsx","../src/Message/UserFeedback/UserFeedbackComplete.test.tsx","../src/Message/UserFeedback/UserFeedbackComplete.tsx","../src/MessageBar/AttachButton.test.tsx","../src/MessageBar/AttachButton.tsx","../src/MessageBar/MessageBar.test.tsx","../src/MessageBar/MessageBar.tsx","../src/MessageBar/MicrophoneButton.tsx","../src/MessageBar/SendButton.test.tsx","../src/MessageBar/SendButton.tsx","../src/MessageBar/StopButton.test.tsx","../src/MessageBar/StopButton.tsx","../src/MessageBar/index.ts","../src/MessageBox/JumpButton.test.tsx","../src/MessageBox/JumpButton.tsx","../src/MessageBox/MessageBox.test.tsx","../src/MessageBox/MessageBox.tsx","../src/MessageBox/index.ts","../src/PreviewAttachment/PreviewAttachment.test.tsx","../src/PreviewAttachment/PreviewAttachment.tsx","../src/PreviewAttachment/index.ts","../src/ResponseActions/ResponseActionButton.test.tsx","../src/ResponseActions/ResponseActionButton.tsx","../src/ResponseActions/ResponseActions.test.tsx","../src/ResponseActions/ResponseActions.tsx","../src/ResponseActions/index.ts","../src/Settings/SettingsForm.test.tsx","../src/Settings/SettingsForm.tsx","../src/Settings/index.ts","../src/SourceDetailsMenuItem/SourceDetailsMenuItem.tsx","../src/SourceDetailsMenuItem/index.ts","../src/SourcesCard/SourcesCard.test.tsx","../src/SourcesCard/SourcesCard.tsx","../src/SourcesCard/index.ts","../src/TermsOfUse/TermsOfUse.test.tsx","../src/TermsOfUse/TermsOfUse.tsx","../src/TermsOfUse/index.ts","../src/__mocks__/rehype-external-links.ts","../src/__mocks__/rehype-sanitize.ts","../src/__mocks__/rehype-unwrap-images.tsx","../src/tracking/console_tracking_provider.ts","../src/tracking/index.ts","../src/tracking/posthog_tracking_provider.ts","../src/tracking/segment_tracking_provider.ts","../src/tracking/trackingProviderProxy.ts","../src/tracking/tracking_api.ts","../src/tracking/tracking_registry.ts","../src/tracking/tracking_spi.ts","../src/tracking/umami_tracking_provider.ts"],"version":"5.6.3"}
|
1
|
+
{"root":["../src/index.ts","../src/AttachMenu/AttachMenu.tsx","../src/AttachMenu/index.ts","../src/AttachmentEdit/AttachmentEdit.test.tsx","../src/AttachmentEdit/AttachmentEdit.tsx","../src/AttachmentEdit/index.ts","../src/Chatbot/Chatbot.test.tsx","../src/Chatbot/Chatbot.tsx","../src/Chatbot/index.ts","../src/ChatbotAlert/ChatbotAlert.test.tsx","../src/ChatbotAlert/ChatbotAlert.tsx","../src/ChatbotAlert/index.ts","../src/ChatbotContent/ChatbotContent.test.tsx","../src/ChatbotContent/ChatbotContent.tsx","../src/ChatbotContent/index.ts","../src/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.test.tsx","../src/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.tsx","../src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.tsx","../src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.tsx","../src/ChatbotConversationHistoryNav/EmptyState.tsx","../src/ChatbotConversationHistoryNav/LoadingState.tsx","../src/ChatbotConversationHistoryNav/index.ts","../src/ChatbotFooter/ChatbotFooter.test.tsx","../src/ChatbotFooter/ChatbotFooter.tsx","../src/ChatbotFooter/ChatbotFooternote.test.tsx","../src/ChatbotFooter/ChatbotFootnote.tsx","../src/ChatbotFooter/index.ts","../src/ChatbotHeader/ChatbotHeader.test.tsx","../src/ChatbotHeader/ChatbotHeader.tsx","../src/ChatbotHeader/ChatbotHeaderActions.test.tsx","../src/ChatbotHeader/ChatbotHeaderActions.tsx","../src/ChatbotHeader/ChatbotHeaderCloseButton.test.tsx","../src/ChatbotHeader/ChatbotHeaderCloseButton.tsx","../src/ChatbotHeader/ChatbotHeaderMain.test.tsx","../src/ChatbotHeader/ChatbotHeaderMain.tsx","../src/ChatbotHeader/ChatbotHeaderMenu.test.tsx","../src/ChatbotHeader/ChatbotHeaderMenu.tsx","../src/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.tsx","../src/ChatbotHeader/ChatbotHeaderOptionsDropdown.tsx","../src/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.tsx","../src/ChatbotHeader/ChatbotHeaderSelectorDropdown.tsx","../src/ChatbotHeader/ChatbotHeaderTitle.test.tsx","../src/ChatbotHeader/ChatbotHeaderTitle.tsx","../src/ChatbotHeader/index.ts","../src/ChatbotModal/ChatbotModal.test.tsx","../src/ChatbotModal/ChatbotModal.tsx","../src/ChatbotModal/index.ts","../src/ChatbotPopover/ChatbotPopover.tsx","../src/ChatbotPopover/index.ts","../src/ChatbotToggle/ChatbotToggle.test.tsx","../src/ChatbotToggle/ChatbotToggle.tsx","../src/ChatbotToggle/index.ts","../src/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.tsx","../src/ChatbotWelcomePrompt/ChatbotWelcomePrompt.tsx","../src/ChatbotWelcomePrompt/index.ts","../src/CodeModal/CodeModal.test.tsx","../src/CodeModal/CodeModal.tsx","../src/CodeModal/index.ts","../src/Compare/Compare.test.tsx","../src/Compare/Compare.tsx","../src/Compare/index.ts","../src/FileDetails/FileDetails.test.tsx","../src/FileDetails/FileDetails.tsx","../src/FileDetails/index.ts","../src/FileDetailsLabel/FileDetailsLabel.test.tsx","../src/FileDetailsLabel/FileDetailsLabel.tsx","../src/FileDetailsLabel/index.ts","../src/FileDropZone/FileDropZone.test.tsx","../src/FileDropZone/FileDropZone.tsx","../src/FileDropZone/index.ts","../src/LoadingMessage/LoadingMessage.test.tsx","../src/LoadingMessage/LoadingMessage.tsx","../src/LoadingMessage/index.ts","../src/Message/Message.test.tsx","../src/Message/Message.tsx","../src/Message/MessageInput.tsx","../src/Message/MessageLoading.tsx","../src/Message/index.ts","../src/Message/CodeBlockMessage/CodeBlockMessage.tsx","../src/Message/ErrorMessage/ErrorMessage.tsx","../src/Message/ImageMessage/ImageMessage.tsx","../src/Message/LinkMessage/LinkMessage.tsx","../src/Message/ListMessage/ListItemMessage.tsx","../src/Message/ListMessage/OrderedListMessage.tsx","../src/Message/ListMessage/UnorderedListMessage.tsx","../src/Message/QuickResponse/QuickResponse.tsx","../src/Message/QuickStarts/FallbackImg.tsx","../src/Message/QuickStarts/QuickStartTile.tsx","../src/Message/QuickStarts/QuickStartTileDescription.test.tsx","../src/Message/QuickStarts/QuickStartTileDescription.tsx","../src/Message/QuickStarts/QuickStartTileHeader.tsx","../src/Message/QuickStarts/monitor-sampleapp-quickstart-with-image.ts","../src/Message/QuickStarts/monitor-sampleapp-quickstart.ts","../src/Message/QuickStarts/types.ts","../src/Message/TableMessage/TableMessage.tsx","../src/Message/TableMessage/TbodyMessage.tsx","../src/Message/TableMessage/TdMessage.tsx","../src/Message/TableMessage/ThMessage.tsx","../src/Message/TableMessage/TheadMessage.tsx","../src/Message/TableMessage/TrMessage.tsx","../src/Message/TextMessage/TextMessage.tsx","../src/Message/UserFeedback/CloseButton.tsx","../src/Message/UserFeedback/UserFeedback.test.tsx","../src/Message/UserFeedback/UserFeedback.tsx","../src/Message/UserFeedback/UserFeedbackComplete.test.tsx","../src/Message/UserFeedback/UserFeedbackComplete.tsx","../src/MessageBar/AttachButton.test.tsx","../src/MessageBar/AttachButton.tsx","../src/MessageBar/MessageBar.test.tsx","../src/MessageBar/MessageBar.tsx","../src/MessageBar/MicrophoneButton.tsx","../src/MessageBar/SendButton.test.tsx","../src/MessageBar/SendButton.tsx","../src/MessageBar/StopButton.test.tsx","../src/MessageBar/StopButton.tsx","../src/MessageBar/index.ts","../src/MessageBox/JumpButton.test.tsx","../src/MessageBox/JumpButton.tsx","../src/MessageBox/MessageBox.test.tsx","../src/MessageBox/MessageBox.tsx","../src/MessageBox/index.ts","../src/PreviewAttachment/PreviewAttachment.test.tsx","../src/PreviewAttachment/PreviewAttachment.tsx","../src/PreviewAttachment/index.ts","../src/ResponseActions/ResponseActionButton.test.tsx","../src/ResponseActions/ResponseActionButton.tsx","../src/ResponseActions/ResponseActions.test.tsx","../src/ResponseActions/ResponseActions.tsx","../src/ResponseActions/index.ts","../src/Settings/SettingsForm.test.tsx","../src/Settings/SettingsForm.tsx","../src/Settings/index.ts","../src/SourceDetailsMenuItem/SourceDetailsMenuItem.tsx","../src/SourceDetailsMenuItem/index.ts","../src/SourcesCard/SourcesCard.test.tsx","../src/SourcesCard/SourcesCard.tsx","../src/SourcesCard/index.ts","../src/TermsOfUse/TermsOfUse.test.tsx","../src/TermsOfUse/TermsOfUse.tsx","../src/TermsOfUse/index.ts","../src/__mocks__/rehype-external-links.ts","../src/__mocks__/rehype-sanitize.ts","../src/__mocks__/rehype-unwrap-images.tsx","../src/tracking/console_tracking_provider.ts","../src/tracking/index.ts","../src/tracking/posthog_tracking_provider.ts","../src/tracking/segment_tracking_provider.ts","../src/tracking/trackingProviderProxy.ts","../src/tracking/tracking_api.ts","../src/tracking/tracking_registry.ts","../src/tracking/tracking_spi.ts","../src/tracking/umami_tracking_provider.ts"],"version":"5.6.3"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@patternfly/chatbot",
|
3
|
-
"version": "6.3.0-prerelease.
|
3
|
+
"version": "6.3.0-prerelease.4",
|
4
4
|
"description": "This library provides React components based on PatternFly 6 that can be used to build chatbots.",
|
5
5
|
"main": "dist/cjs/index.js",
|
6
6
|
"module": "dist/esm/index.js",
|
@@ -1,9 +1,10 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import { Button } from '@patternfly/react-core';
|
2
|
+
import { Button, Checkbox } from '@patternfly/react-core';
|
3
3
|
import { AttachmentEdit } from '@patternfly/chatbot/dist/dynamic/AttachmentEdit';
|
4
4
|
|
5
5
|
export const AttachmentEditModalExample: React.FunctionComponent = () => {
|
6
6
|
const [isModalOpen, setIsModalOpen] = React.useState(false);
|
7
|
+
const [isCompact, setIsCompact] = React.useState(false);
|
7
8
|
|
8
9
|
const handleModalToggle = (_event: React.MouseEvent | MouseEvent | KeyboardEvent) => {
|
9
10
|
setIsModalOpen(!isModalOpen);
|
@@ -11,6 +12,13 @@ export const AttachmentEditModalExample: React.FunctionComponent = () => {
|
|
11
12
|
|
12
13
|
return (
|
13
14
|
<>
|
15
|
+
<Checkbox
|
16
|
+
label="Show compact version"
|
17
|
+
isChecked={isCompact}
|
18
|
+
onChange={() => setIsCompact(!isCompact)}
|
19
|
+
id="modal-compact-edit"
|
20
|
+
name="modal-compact-edit"
|
21
|
+
></Checkbox>
|
14
22
|
<Button onClick={handleModalToggle}>Launch modal</Button>
|
15
23
|
<AttachmentEdit
|
16
24
|
code="I am a code snippet"
|
@@ -20,6 +28,7 @@ export const AttachmentEditModalExample: React.FunctionComponent = () => {
|
|
20
28
|
onCancel={() => null}
|
21
29
|
// eslint-disable-next-line no-console
|
22
30
|
onSave={(_event, code) => console.log(`The new code is "${code}"`)}
|
31
|
+
isCompact={isCompact}
|
23
32
|
/>
|
24
33
|
</>
|
25
34
|
);
|
@@ -1,9 +1,10 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import { Button } from '@patternfly/react-core';
|
2
|
+
import { Button, Checkbox } from '@patternfly/react-core';
|
3
3
|
import { PreviewAttachment } from '@patternfly/chatbot/dist/dynamic/PreviewAttachment';
|
4
4
|
|
5
5
|
export const PreviewAttachmentExample: React.FunctionComponent = () => {
|
6
6
|
const [isModalOpen, setIsModalOpen] = React.useState(false);
|
7
|
+
const [isCompact, setIsCompact] = React.useState(false);
|
7
8
|
|
8
9
|
const handleModalToggle = (_event: React.MouseEvent | MouseEvent | KeyboardEvent) => {
|
9
10
|
setIsModalOpen(!isModalOpen);
|
@@ -11,6 +12,13 @@ export const PreviewAttachmentExample: React.FunctionComponent = () => {
|
|
11
12
|
|
12
13
|
return (
|
13
14
|
<>
|
15
|
+
<Checkbox
|
16
|
+
label="Show compact version"
|
17
|
+
isChecked={isCompact}
|
18
|
+
onChange={() => setIsCompact(!isCompact)}
|
19
|
+
id="modal-compact-preview"
|
20
|
+
name="modal-compact-preview"
|
21
|
+
></Checkbox>
|
14
22
|
<Button onClick={handleModalToggle}>Launch modal</Button>
|
15
23
|
<PreviewAttachment
|
16
24
|
code="I am a code snippet"
|
@@ -19,6 +27,7 @@ export const PreviewAttachmentExample: React.FunctionComponent = () => {
|
|
19
27
|
isModalOpen={isModalOpen}
|
20
28
|
onDismiss={() => null}
|
21
29
|
onEdit={() => null}
|
30
|
+
isCompact={isCompact}
|
22
31
|
/>
|
23
32
|
</>
|
24
33
|
);
|
@@ -62,6 +62,7 @@ const EMPTY_STATE = {
|
|
62
62
|
export const ChatbotHeaderTitleDemo: React.FunctionComponent = () => {
|
63
63
|
const [isOpen, setIsOpen] = React.useState(true);
|
64
64
|
const [isButtonOrderReversed, setIsButtonOrderReversed] = React.useState(false);
|
65
|
+
const [isCompact, setIsCompact] = React.useState(false);
|
65
66
|
const [conversations, setConversations] = React.useState<Conversation[] | { [key: string]: Conversation[] }>(
|
66
67
|
initialConversations
|
67
68
|
);
|
@@ -136,6 +137,13 @@ export const ChatbotHeaderTitleDemo: React.FunctionComponent = () => {
|
|
136
137
|
id="drawer-has-no-results"
|
137
138
|
name="drawer-has-no-results"
|
138
139
|
></Checkbox>
|
140
|
+
<Checkbox
|
141
|
+
label="Show compact version"
|
142
|
+
isChecked={isCompact}
|
143
|
+
onChange={() => setIsCompact(!isCompact)}
|
144
|
+
id="drawer-compact"
|
145
|
+
name="drawer-compact"
|
146
|
+
></Checkbox>
|
139
147
|
<ChatbotConversationHistoryNav
|
140
148
|
displayMode={displayMode}
|
141
149
|
onDrawerToggle={() => setIsOpen(!isOpen)}
|
@@ -162,6 +170,7 @@ export const ChatbotHeaderTitleDemo: React.FunctionComponent = () => {
|
|
162
170
|
errorState={hasError ? ERROR : undefined}
|
163
171
|
emptyState={isEmpty ? EMPTY_STATE : undefined}
|
164
172
|
noResultsState={hasNoResults ? NO_RESULTS : undefined}
|
173
|
+
isCompact={isCompact}
|
165
174
|
/>
|
166
175
|
</>
|
167
176
|
);
|
package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerWithActions.tsx
CHANGED
@@ -51,6 +51,7 @@ const conversations: { [key: string]: Conversation[] } = {
|
|
51
51
|
|
52
52
|
export const ChatbotHeaderTitleDemo: React.FunctionComponent = () => {
|
53
53
|
const [isDrawerOpen, setIsDrawerOpen] = React.useState(true);
|
54
|
+
const [isCompact, setIsCompact] = React.useState(false);
|
54
55
|
const displayMode = ChatbotDisplayMode.embedded;
|
55
56
|
|
56
57
|
return (
|
@@ -62,6 +63,13 @@ export const ChatbotHeaderTitleDemo: React.FunctionComponent = () => {
|
|
62
63
|
id="drawer-actions-visible"
|
63
64
|
name="drawer-actions-visible"
|
64
65
|
></Checkbox>
|
66
|
+
<Checkbox
|
67
|
+
label="Show compact version"
|
68
|
+
isChecked={isCompact}
|
69
|
+
onChange={() => setIsCompact(!isCompact)}
|
70
|
+
id="drawer-actions-compact"
|
71
|
+
name="drawer-actions-compact"
|
72
|
+
></Checkbox>
|
65
73
|
<ChatbotConversationHistoryNav
|
66
74
|
displayMode={displayMode}
|
67
75
|
onDrawerToggle={() => setIsDrawerOpen(!isDrawerOpen)}
|
@@ -69,6 +77,7 @@ export const ChatbotHeaderTitleDemo: React.FunctionComponent = () => {
|
|
69
77
|
setIsDrawerOpen={setIsDrawerOpen}
|
70
78
|
conversations={conversations}
|
71
79
|
drawerContent={<div>Drawer content</div>}
|
80
|
+
isCompact={isCompact}
|
72
81
|
/>
|
73
82
|
</>
|
74
83
|
);
|
package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerWithSelection.tsx
CHANGED
@@ -25,6 +25,7 @@ const menuItems = [
|
|
25
25
|
export const ChatbotHeaderDrawerWithSelection: React.FunctionComponent = () => {
|
26
26
|
const [isDrawerOpen, setIsDrawerOpen] = React.useState(true);
|
27
27
|
const [currentSelection, setCurrentSelection] = React.useState('2');
|
28
|
+
const [isCompact, setIsCompact] = React.useState(false);
|
28
29
|
const displayMode = ChatbotDisplayMode.embedded;
|
29
30
|
|
30
31
|
const conversations: { [key: string]: Conversation[] } = {
|
@@ -60,8 +61,15 @@ export const ChatbotHeaderDrawerWithSelection: React.FunctionComponent = () => {
|
|
60
61
|
label="Display drawer"
|
61
62
|
isChecked={isDrawerOpen}
|
62
63
|
onChange={() => setIsDrawerOpen(!isDrawerOpen)}
|
63
|
-
id="drawer-
|
64
|
-
name="drawer-
|
64
|
+
id="drawer-selected-visible"
|
65
|
+
name="drawer-selected-visible"
|
66
|
+
></Checkbox>
|
67
|
+
<Checkbox
|
68
|
+
label="Show compact version"
|
69
|
+
isChecked={isCompact}
|
70
|
+
onChange={() => setIsCompact(!isCompact)}
|
71
|
+
id="drawer-selected-compact"
|
72
|
+
name="drawer-selected-compact"
|
65
73
|
></Checkbox>
|
66
74
|
<ChatbotConversationHistoryNav
|
67
75
|
displayMode={displayMode}
|
@@ -72,6 +80,7 @@ export const ChatbotHeaderDrawerWithSelection: React.FunctionComponent = () => {
|
|
72
80
|
drawerContent={<div>Drawer content</div>}
|
73
81
|
activeItemId={currentSelection}
|
74
82
|
onSelectActiveItem={(_e, id) => setCurrentSelection(id as string)}
|
83
|
+
isCompact={isCompact}
|
75
84
|
/>
|
76
85
|
</>
|
77
86
|
);
|
@@ -22,6 +22,8 @@ export interface AttachmentEditProps {
|
|
22
22
|
title?: string;
|
23
23
|
/** Display mode for the Chatbot parent; this influences the styles applied */
|
24
24
|
displayMode?: ChatbotDisplayMode;
|
25
|
+
/** Sets modal to compact styling. */
|
26
|
+
isCompact?: boolean;
|
25
27
|
}
|
26
28
|
|
27
29
|
export const AttachmentEdit: React.FunctionComponent<AttachmentEditProps> = ({
|
@@ -32,7 +34,8 @@ export const AttachmentEdit: React.FunctionComponent<AttachmentEditProps> = ({
|
|
32
34
|
onCancel,
|
33
35
|
onSave,
|
34
36
|
title = 'Edit attachment',
|
35
|
-
displayMode = ChatbotDisplayMode.default
|
37
|
+
displayMode = ChatbotDisplayMode.default,
|
38
|
+
isCompact
|
36
39
|
}: AttachmentEditProps) => {
|
37
40
|
const handleSave = (_event: React.MouseEvent | MouseEvent | KeyboardEvent, code) => {
|
38
41
|
handleModalToggle(_event);
|
@@ -56,6 +59,7 @@ export const AttachmentEdit: React.FunctionComponent<AttachmentEditProps> = ({
|
|
56
59
|
secondaryActionBtn="Cancel"
|
57
60
|
title={title}
|
58
61
|
displayMode={displayMode}
|
62
|
+
isCompact={isCompact}
|
59
63
|
/>
|
60
64
|
);
|
61
65
|
};
|
@@ -9,8 +9,8 @@
|
|
9
9
|
// Drawer input
|
10
10
|
// ----------------------------------------------------------------------------
|
11
11
|
.pf-chatbot__input {
|
12
|
-
padding-inline-start: var(--pf-t--global--spacer--
|
13
|
-
padding-inline-end: var(--pf-t--global--spacer--
|
12
|
+
padding-inline-start: var(--pf-t--global--spacer--lg);
|
13
|
+
padding-inline-end: var(--pf-t--global--spacer--lg);
|
14
14
|
}
|
15
15
|
|
16
16
|
// Drawer menu
|
@@ -205,3 +205,29 @@
|
|
205
205
|
gap: var(--pf-t--global--spacer--sm);
|
206
206
|
align-self: stretch;
|
207
207
|
}
|
208
|
+
|
209
|
+
.pf-chatbot__history.pf-m-compact {
|
210
|
+
.pf-v6-c-drawer__main {
|
211
|
+
.pf-v6-c-drawer__panel {
|
212
|
+
--pf-v6-c-drawer__panel--PaddingBlockStart: var(--pf-t--global--spacer--sm);
|
213
|
+
--pf-v6-c-drawer__panel--PaddingBlockEnd: var(--pf-t--global--spacer--sm);
|
214
|
+
--pf-v6-c-drawer__head--PaddingInlineStart: var(--pf-t--global--spacer--md);
|
215
|
+
--pf-v6-c-drawer__head--PaddingInlineEnd: var(--pf-t--global--spacer--md);
|
216
|
+
--pf-v6-c-drawer__panel--RowGap: var(--pf-t--global--spacer--md);
|
217
|
+
}
|
218
|
+
|
219
|
+
.pf-v6-c-drawer__body {
|
220
|
+
--pf-v6-c-drawer__panel__body--PaddingInlineStart: var(--pf-t--global--spacer--md);
|
221
|
+
--pf-v6-c-drawer__panel__body--PaddingInlineEnd: var(--pf-t--global--spacer--md);
|
222
|
+
}
|
223
|
+
}
|
224
|
+
|
225
|
+
.pf-chatbot__menu-item {
|
226
|
+
font-size: var(--pf-t--global--font--size--body--md);
|
227
|
+
}
|
228
|
+
|
229
|
+
.pf-v6-c-drawer__head {
|
230
|
+
--pf-v6-c-drawer__head--PaddingInlineStart: var(--pf-t--global--spacer--lg);
|
231
|
+
--pf-v6-c-drawer__head--PaddingInlineEnd: var(--pf-t--global--spacer--lg);
|
232
|
+
}
|
233
|
+
}
|
@@ -415,4 +415,22 @@ describe('ChatbotConversationHistoryNav', () => {
|
|
415
415
|
})
|
416
416
|
).toBeTruthy();
|
417
417
|
});
|
418
|
+
|
419
|
+
it('should handle isCompact', () => {
|
420
|
+
render(
|
421
|
+
<ChatbotConversationHistoryNav
|
422
|
+
onDrawerToggle={onDrawerToggle}
|
423
|
+
isDrawerOpen={true}
|
424
|
+
displayMode={ChatbotDisplayMode.fullscreen}
|
425
|
+
setIsDrawerOpen={jest.fn()}
|
426
|
+
reverseButtonOrder={false}
|
427
|
+
handleTextInputChange={jest.fn()}
|
428
|
+
conversations={initialConversations}
|
429
|
+
noResultsState={NO_RESULTS}
|
430
|
+
isCompact
|
431
|
+
data-testid="drawer"
|
432
|
+
/>
|
433
|
+
);
|
434
|
+
expect(screen.getByTestId('drawer')).toHaveClass('pf-m-compact');
|
435
|
+
});
|
418
436
|
});
|
@@ -116,6 +116,8 @@ export interface ChatbotConversationHistoryNavProps extends DrawerProps {
|
|
116
116
|
emptyState?: HistoryEmptyStateProps;
|
117
117
|
/** Content to show in no results state. No results state will appear once content is passed in. */
|
118
118
|
noResultsState?: HistoryEmptyStateProps;
|
119
|
+
/** Sets drawer to compact styling. */
|
120
|
+
isCompact?: boolean;
|
119
121
|
}
|
120
122
|
|
121
123
|
export const ChatbotConversationHistoryNav: React.FunctionComponent<ChatbotConversationHistoryNavProps> = ({
|
@@ -147,6 +149,7 @@ export const ChatbotConversationHistoryNav: React.FunctionComponent<ChatbotConve
|
|
147
149
|
errorState,
|
148
150
|
emptyState,
|
149
151
|
noResultsState,
|
152
|
+
isCompact,
|
150
153
|
...props
|
151
154
|
}: ChatbotConversationHistoryNavProps) => {
|
152
155
|
const drawerRef = React.useRef<HTMLDivElement>(null);
|
@@ -287,7 +290,7 @@ export const ChatbotConversationHistoryNav: React.FunctionComponent<ChatbotConve
|
|
287
290
|
|
288
291
|
return (
|
289
292
|
<Drawer
|
290
|
-
className=
|
293
|
+
className={`pf-chatbot__history ${isCompact ? 'pf-m-compact' : ''}`}
|
291
294
|
isExpanded={isDrawerOpen}
|
292
295
|
onExpand={onExpand}
|
293
296
|
position="start"
|
@@ -14,10 +14,7 @@
|
|
14
14
|
.pf-v6-c-modal-box__title {
|
15
15
|
--pf-v6-c-modal-box__title--FontSize: var(--pf-t--global--font--size--heading--h3);
|
16
16
|
}
|
17
|
-
|
18
|
-
.pf-v6-c-button.pf-m-link.pf-m-block {
|
19
|
-
--pf-v6-c-button--FontWeight: var(--pf-t--global--font--weight--body--bold);
|
20
|
-
}
|
17
|
+
|
21
18
|
.pf-v6-c-modal-box__footer {
|
22
19
|
padding-block-start: var(--pf-t--global--spacer--xl);
|
23
20
|
padding-block-end: var(--pf-t--global--spacer--xl);
|
@@ -91,3 +88,17 @@
|
|
91
88
|
.pf-v6-c-backdrop.pf-chatbot__backdrop {
|
92
89
|
position: absolute;
|
93
90
|
}
|
91
|
+
|
92
|
+
// ============================================================================
|
93
|
+
// Compact
|
94
|
+
// ============================================================================
|
95
|
+
.pf-chatbot__chatbot-modal.pf-m-compact {
|
96
|
+
.pf-v6-c-modal-box__header {
|
97
|
+
padding-block-end: 0;
|
98
|
+
}
|
99
|
+
|
100
|
+
.pf-v6-c-modal-box__footer {
|
101
|
+
padding-block-start: var(--pf-t--global--spacer--lg);
|
102
|
+
padding-block-end: var(--pf-t--global--spacer--lg);
|
103
|
+
}
|
104
|
+
}
|
@@ -0,0 +1,59 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { render, screen } from '@testing-library/react';
|
3
|
+
import ChatbotModal from './ChatbotModal';
|
4
|
+
import '@testing-library/jest-dom';
|
5
|
+
import { ModalBody, ModalHeader } from '@patternfly/react-core';
|
6
|
+
|
7
|
+
describe('ChatbotModal', () => {
|
8
|
+
it('should render compact modal', () => {
|
9
|
+
render(
|
10
|
+
<ChatbotModal data-testid="modal" isCompact isOpen>
|
11
|
+
<ModalHeader
|
12
|
+
title="Modal with description"
|
13
|
+
labelId="modal-with-description-title"
|
14
|
+
description="A description is used when you want to provide more info about the modal than the title is able to describe. The content in the description is static and will not scroll with the rest of the modal body."
|
15
|
+
/>
|
16
|
+
<ModalBody tabIndex={0} id="modal-box-body-with-description">
|
17
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
|
18
|
+
magna aliqua. Quis eleifend quam adipiscing vitae proin sagittis nisl rhoncus. Semper auctor neque vitae
|
19
|
+
tempus. Diam donec adipiscing tristique risus. Augue eget arcu dictum varius duis. Ut enim blandit volutpat
|
20
|
+
maecenas volutpat blandit aliquam. Sit amet mauris commodo quis imperdiet massa tincidunt. Habitant morbi
|
21
|
+
tristique senectus et netus. Fames ac turpis egestas sed tempus urna. Neque laoreet suspendisse interdum
|
22
|
+
consectetur libero id. Volutpat lacus laoreet non curabitur gravida arcu ac tortor. Porta nibh venenatis cras
|
23
|
+
sed felis eget velit. Nullam non nisi est sit amet facilisis. Nunc mi ipsum faucibus vitae. Lorem sed risus
|
24
|
+
ultricies tristique nulla aliquet enim tortor at. Egestas sed tempus urna et pharetra pharetra massa massa
|
25
|
+
ultricies. Lacinia quis vel eros donec ac odio tempor orci. Malesuada fames ac turpis egestas integer eget
|
26
|
+
aliquet.
|
27
|
+
<br />
|
28
|
+
<br />
|
29
|
+
Neque aliquam vestibulum morbi blandit cursus risus at ultrices. Molestie at elementum eu facilisis sed odio
|
30
|
+
morbi. Elit pellentesque habitant morbi tristique. Consequat nisl vel pretium lectus quam id leo in vitae.
|
31
|
+
Quis varius quam quisque id diam vel quam elementum. Viverra nam libero justo laoreet sit amet cursus.
|
32
|
+
Sollicitudin tempor id eu nisl nunc. Orci nulla pellentesque dignissim enim sit amet venenatis. Dignissim enim
|
33
|
+
sit amet venenatis urna cursus eget. Iaculis at erat pellentesque adipiscing commodo elit. Faucibus pulvinar
|
34
|
+
elementum integer enim neque volutpat. Nullam vehicula ipsum a arcu cursus vitae congue mauris. Nunc mattis
|
35
|
+
enim ut tellus elementum sagittis vitae. Blandit cursus risus at ultrices. Tellus mauris a diam maecenas sed
|
36
|
+
enim. Non diam phasellus vestibulum lorem sed risus ultricies tristique nulla.
|
37
|
+
<br />
|
38
|
+
<br />
|
39
|
+
Nulla pharetra diam sit amet nisl suscipit adipiscing. Ac tortor vitae purus faucibus ornare suspendisse sed
|
40
|
+
nisi. Sed felis eget velit aliquet sagittis id consectetur purus. Tincidunt tortor aliquam nulla facilisi cras
|
41
|
+
fermentum. Volutpat est velit egestas dui id ornare arcu odio. Pharetra magna ac placerat vestibulum. Ultrices
|
42
|
+
sagittis orci a scelerisque purus semper eget duis at. Nisi est sit amet facilisis magna etiam tempor orci eu.
|
43
|
+
Convallis tellus id interdum velit. Facilisis sed odio morbi quis commodo odio aenean sed.
|
44
|
+
<br />
|
45
|
+
<br />
|
46
|
+
Eu scelerisque felis imperdiet proin fermentum leo vel orci porta. Facilisi etiam dignissim diam quis enim
|
47
|
+
lobortis scelerisque fermentum. Eleifend donec pretium vulputate sapien nec sagittis aliquam malesuada. Magna
|
48
|
+
etiam tempor orci eu lobortis elementum. Quis auctor elit sed vulputate mi sit. Eleifend quam adipiscing vitae
|
49
|
+
proin sagittis nisl rhoncus mattis rhoncus. Erat velit scelerisque in dictum non. Sit amet nulla facilisi
|
50
|
+
morbi tempus iaculis urna. Enim ut tellus elementum sagittis vitae et leo duis ut. Lectus arcu bibendum at
|
51
|
+
varius vel pharetra vel turpis. Morbi tristique senectus et netus et. Eget aliquet nibh praesent tristique
|
52
|
+
magna sit amet purus gravida. Nisl purus in mollis nunc sed id semper risus. Id neque aliquam vestibulum
|
53
|
+
morbi. Mauris a diam maecenas sed enim ut sem. Egestas tellus rutrum tellus pellentesque.
|
54
|
+
</ModalBody>
|
55
|
+
</ChatbotModal>
|
56
|
+
);
|
57
|
+
expect(screen.getByTestId('modal')).toHaveClass('pf-m-compact');
|
58
|
+
});
|
59
|
+
});
|
@@ -10,7 +10,10 @@ import { ChatbotDisplayMode } from '../Chatbot';
|
|
10
10
|
export interface ChatbotModalProps extends Omit<ModalProps, 'ref'> {
|
11
11
|
/** Display mode for the Chatbot parent; this influences the styles applied */
|
12
12
|
displayMode?: ChatbotDisplayMode;
|
13
|
+
/** Additional className applied to modal */
|
13
14
|
className?: string;
|
15
|
+
/** Sets modal to compact styling. */
|
16
|
+
isCompact?: boolean;
|
14
17
|
}
|
15
18
|
|
16
19
|
export const ChatbotModal: React.FunctionComponent<ChatbotModalProps> = ({
|
@@ -18,6 +21,7 @@ export const ChatbotModal: React.FunctionComponent<ChatbotModalProps> = ({
|
|
18
21
|
displayMode = ChatbotDisplayMode.default,
|
19
22
|
className,
|
20
23
|
isOpen,
|
24
|
+
isCompact,
|
21
25
|
...props
|
22
26
|
}: ChatbotModalProps) => {
|
23
27
|
const modal = (
|
@@ -26,7 +30,7 @@ export const ChatbotModal: React.FunctionComponent<ChatbotModalProps> = ({
|
|
26
30
|
ouiaId="ChatbotModal"
|
27
31
|
aria-labelledby="chatbot-modal-title"
|
28
32
|
aria-describedby="chatbot-modal"
|
29
|
-
className={`pf-chatbot__chatbot-modal pf-chatbot__chatbot-modal--${displayMode} ${className}`}
|
33
|
+
className={`pf-chatbot__chatbot-modal pf-chatbot__chatbot-modal--${displayMode} ${isCompact ? 'pf-m-compact' : ''} ${className}`}
|
30
34
|
backdropClassName="pf-chatbot__chatbot-modal-backdrop"
|
31
35
|
{...props}
|
32
36
|
>
|
@@ -61,8 +61,10 @@
|
|
61
61
|
.pf-v6-c-code-editor__header-main {
|
62
62
|
display: none;
|
63
63
|
}
|
64
|
-
.pf-
|
65
|
-
|
64
|
+
.pf-v6-c-modal-box__close {
|
65
|
+
.pf-v6-c-button.pf-m-plain {
|
66
|
+
--pf-v6-c-button__icon--Color: var(--pf-t--global--icon--color--subtle);
|
67
|
+
}
|
66
68
|
}
|
67
69
|
}
|
68
70
|
|
@@ -78,10 +80,16 @@
|
|
78
80
|
}
|
79
81
|
}
|
80
82
|
|
81
|
-
.pf-chatbot__code-modal-
|
83
|
+
.pf-chatbot__code-modal-editor {
|
82
84
|
flex: 1;
|
83
85
|
}
|
84
86
|
|
85
87
|
.pf-chatbot__code-modal--fullscreen {
|
86
88
|
height: inherit !important; // override shared modal so code editor works in full screen
|
87
89
|
}
|
90
|
+
|
91
|
+
.pf-chatbot__code-modal.pf-m-compact {
|
92
|
+
.pf-chatbot__code-modal-body {
|
93
|
+
gap: var(--pf-t--global--spacer--md);
|
94
|
+
}
|
95
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { render, screen } from '@testing-library/react';
|
3
|
+
import '@testing-library/jest-dom';
|
4
|
+
import CodeModal from './CodeModal';
|
5
|
+
|
6
|
+
describe('ChatbotModal', () => {
|
7
|
+
it('should render compact modal', () => {
|
8
|
+
render(
|
9
|
+
<CodeModal
|
10
|
+
isCompact
|
11
|
+
code="Hello world"
|
12
|
+
fileName="greetings.txt"
|
13
|
+
isModalOpen={true}
|
14
|
+
handleModalToggle={jest.fn()}
|
15
|
+
onPrimaryAction={jest.fn()}
|
16
|
+
onSecondaryAction={jest.fn()}
|
17
|
+
title="Preview attachment"
|
18
|
+
primaryActionBtn="Submit"
|
19
|
+
secondaryActionBtn="Cancel"
|
20
|
+
></CodeModal>
|
21
|
+
);
|
22
|
+
expect(screen.getByRole('dialog')).toHaveClass('pf-m-compact');
|
23
|
+
});
|
24
|
+
});
|
@@ -40,6 +40,8 @@ export interface CodeModalProps {
|
|
40
40
|
title: string;
|
41
41
|
/** Display mode for the Chatbot parent; this influences the styles applied */
|
42
42
|
displayMode?: ChatbotDisplayMode;
|
43
|
+
/** Sets modal to compact styling. */
|
44
|
+
isCompact?: boolean;
|
43
45
|
}
|
44
46
|
|
45
47
|
export const CodeModal: React.FunctionComponent<CodeModalProps> = ({
|
@@ -57,6 +59,7 @@ export const CodeModal: React.FunctionComponent<CodeModalProps> = ({
|
|
57
59
|
secondaryActionBtn,
|
58
60
|
title,
|
59
61
|
displayMode = ChatbotDisplayMode.default,
|
62
|
+
isCompact,
|
60
63
|
...props
|
61
64
|
}: CodeModalProps) => {
|
62
65
|
const [newCode, setNewCode] = React.useState(code);
|
@@ -94,8 +97,9 @@ export const CodeModal: React.FunctionComponent<CodeModalProps> = ({
|
|
94
97
|
ouiaId="CodeModal"
|
95
98
|
aria-labelledby="code-modal-title"
|
96
99
|
aria-describedby="code-modal"
|
97
|
-
className={`pf-chatbot__code-modal pf-chatbot__code-modal--${displayMode}`}
|
100
|
+
className={`pf-chatbot__code-modal ${isCompact ? 'pf-m-compact' : ''} pf-chatbot__code-modal--${displayMode}`}
|
98
101
|
displayMode={displayMode}
|
102
|
+
isCompact={isCompact}
|
99
103
|
>
|
100
104
|
<ModalHeader title={title} labelId="code-modal-title" />
|
101
105
|
<ModalBody id="code-modal-body">
|
@@ -103,7 +107,7 @@ export const CodeModal: React.FunctionComponent<CodeModalProps> = ({
|
|
103
107
|
<StackItem className="pf-chatbot__code-modal-file-details">
|
104
108
|
<FileDetails fileName={fileName} />
|
105
109
|
</StackItem>
|
106
|
-
<StackItem className="pf-chatbot__code-modal-
|
110
|
+
<StackItem className="pf-chatbot__code-modal-editor">
|
107
111
|
<CodeEditor
|
108
112
|
isDarkTheme
|
109
113
|
isLineNumbersVisible={isLineNumbersVisible}
|
@@ -946,7 +946,7 @@ export const FileDetails = ({
|
|
946
946
|
}: PropsWithChildren<FileDetailsProps>) => {
|
947
947
|
const language = extensionToLanguage[path.extname(fileName).slice(1)]?.toUpperCase();
|
948
948
|
return (
|
949
|
-
<Flex className={`pf-chatbot__file-details ${className}`} gap={{ default: 'gapSm' }}>
|
949
|
+
<Flex className={`pf-chatbot__file-details ${className ? className : ''}`} gap={{ default: 'gapSm' }}>
|
950
950
|
<Flex
|
951
951
|
className="pf-chatbot__code-icon"
|
952
952
|
justifyContent={{ default: 'justifyContentCenter' }}
|
@@ -3,7 +3,7 @@
|
|
3
3
|
exports[`FileDetails should render file details 1`] = `
|
4
4
|
<div>
|
5
5
|
<div
|
6
|
-
class="pf-v6-l-flex pf-m-gap-sm pf-chatbot__file-details
|
6
|
+
class="pf-v6-l-flex pf-m-gap-sm pf-chatbot__file-details "
|
7
7
|
>
|
8
8
|
<div
|
9
9
|
class="pf-v6-l-flex pf-m-align-items-center pf-m-align-self-center pf-m-justify-content-center pf-chatbot__code-icon"
|
@@ -15,7 +15,7 @@ exports[`FileDetailsLabel should render file details label 1`] = `
|
|
15
15
|
class="pf-chatbot__file-label-contents"
|
16
16
|
>
|
17
17
|
<div
|
18
|
-
class="pf-v6-l-flex pf-m-gap-sm pf-chatbot__file-details
|
18
|
+
class="pf-v6-l-flex pf-m-gap-sm pf-chatbot__file-details "
|
19
19
|
>
|
20
20
|
<div
|
21
21
|
class="pf-v6-l-flex pf-m-align-items-center pf-m-align-self-center pf-m-justify-content-center pf-chatbot__code-icon"
|
@@ -22,6 +22,8 @@ export interface PreviewAttachmentProps {
|
|
22
22
|
title?: string;
|
23
23
|
/** Display mode for the Chatbot parent; this influences the styles applied */
|
24
24
|
displayMode?: ChatbotDisplayMode;
|
25
|
+
/** Sets modal to compact styling. */
|
26
|
+
isCompact?: boolean;
|
25
27
|
}
|
26
28
|
|
27
29
|
export const PreviewAttachment: React.FunctionComponent<PreviewAttachmentProps> = ({
|
@@ -32,7 +34,8 @@ export const PreviewAttachment: React.FunctionComponent<PreviewAttachmentProps>
|
|
32
34
|
onDismiss = undefined,
|
33
35
|
onEdit,
|
34
36
|
title = 'Preview attachment',
|
35
|
-
displayMode = ChatbotDisplayMode.default
|
37
|
+
displayMode = ChatbotDisplayMode.default,
|
38
|
+
isCompact
|
36
39
|
}: PreviewAttachmentProps) => {
|
37
40
|
const handleEdit = (_event: React.MouseEvent | MouseEvent | KeyboardEvent) => {
|
38
41
|
handleModalToggle(_event);
|
@@ -60,6 +63,7 @@ export const PreviewAttachment: React.FunctionComponent<PreviewAttachmentProps>
|
|
60
63
|
title={title}
|
61
64
|
isReadOnly
|
62
65
|
displayMode={displayMode}
|
66
|
+
isCompact={isCompact}
|
63
67
|
/>
|
64
68
|
);
|
65
69
|
};
|