@patternfly/chatbot 6.5.0-prerelease.9 → 6.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.d.ts +9 -1
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +9 -2
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +38 -0
- package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.js +29 -2
- package/dist/cjs/CodeModal/CodeModal.d.ts +2 -0
- package/dist/cjs/CodeModal/CodeModal.js +53 -12
- package/dist/cjs/DeepThinking/DeepThinking.d.ts +13 -0
- package/dist/cjs/DeepThinking/DeepThinking.js +31 -3
- package/dist/cjs/DeepThinking/DeepThinking.test.js +80 -0
- package/dist/cjs/MarkdownContent/MarkdownContent.d.ts +44 -0
- package/dist/cjs/MarkdownContent/MarkdownContent.js +181 -0
- package/dist/cjs/MarkdownContent/MarkdownContent.test.d.ts +1 -0
- package/dist/cjs/MarkdownContent/MarkdownContent.test.js +192 -0
- package/dist/cjs/MarkdownContent/index.d.ts +2 -0
- package/dist/cjs/MarkdownContent/index.js +23 -0
- package/dist/cjs/Message/CodeBlockMessage/CodeBlockMessage.d.ts +3 -1
- package/dist/cjs/Message/CodeBlockMessage/CodeBlockMessage.js +15 -4
- package/dist/cjs/Message/CodeBlockMessage/CodeBlockMessage.test.d.ts +1 -0
- package/dist/cjs/Message/CodeBlockMessage/CodeBlockMessage.test.js +131 -0
- package/dist/cjs/Message/ErrorMessage/ErrorMessage.d.ts +15 -1
- package/dist/cjs/Message/ErrorMessage/ErrorMessage.js +5 -3
- package/dist/cjs/Message/ErrorMessage/ErrorMessage.test.d.ts +1 -0
- package/dist/cjs/Message/ErrorMessage/ErrorMessage.test.js +30 -0
- package/dist/cjs/Message/LinkMessage/LinkMessage.d.ts +5 -1
- package/dist/cjs/Message/LinkMessage/LinkMessage.js +4 -3
- package/dist/cjs/Message/ListMessage/OrderedListMessage.d.ts +9 -1
- package/dist/cjs/Message/ListMessage/OrderedListMessage.js +2 -1
- package/dist/cjs/Message/ListMessage/UnorderedListMessage.d.ts +7 -1
- package/dist/cjs/Message/ListMessage/UnorderedListMessage.js +2 -1
- package/dist/cjs/Message/Message.d.ts +20 -3
- package/dist/cjs/Message/Message.js +7 -160
- package/dist/cjs/Message/Message.test.js +129 -2
- package/dist/cjs/Message/MessageAndActions/MessageAndActions.d.ts +14 -0
- package/dist/cjs/Message/MessageAndActions/MessageAndActions.js +22 -0
- package/dist/cjs/Message/MessageAndActions/MessageAndActions.test.d.ts +1 -0
- package/dist/cjs/Message/MessageAndActions/MessageAndActions.test.js +25 -0
- package/dist/cjs/Message/MessageAndActions/index.d.ts +1 -0
- package/dist/cjs/Message/MessageAndActions/index.js +17 -0
- package/dist/cjs/Message/MessageAttachments/MessageAttachmentItem.d.ts +13 -0
- package/dist/cjs/Message/MessageAttachments/MessageAttachmentItem.js +22 -0
- package/dist/cjs/Message/MessageAttachments/MessageAttachmentItem.test.d.ts +1 -0
- package/dist/cjs/Message/MessageAttachments/MessageAttachmentItem.test.js +25 -0
- package/dist/cjs/Message/MessageAttachments/MessageAttachmentsContainer.d.ts +13 -0
- package/dist/cjs/Message/MessageAttachments/MessageAttachmentsContainer.js +22 -0
- package/dist/cjs/Message/MessageAttachments/MessageAttachmentsContainer.test.d.ts +1 -0
- package/dist/cjs/Message/MessageAttachments/MessageAttachmentsContainer.test.js +25 -0
- package/dist/cjs/Message/MessageAttachments/index.d.ts +2 -0
- package/dist/cjs/Message/MessageAttachments/index.js +18 -0
- package/dist/cjs/Message/MessageInput.d.ts +1 -1
- package/dist/cjs/Message/MessageInput.js +3 -1
- package/dist/cjs/Message/MessageLoading.d.ts +13 -4
- package/dist/cjs/Message/MessageLoading.js +19 -5
- package/dist/cjs/Message/MessageLoading.test.d.ts +1 -0
- package/dist/cjs/Message/MessageLoading.test.js +25 -0
- package/dist/cjs/Message/QuickResponse/QuickResponse.js +3 -2
- package/dist/cjs/Message/QuickResponse/QuickResponse.test.d.ts +1 -0
- package/dist/cjs/Message/QuickResponse/QuickResponse.test.js +109 -0
- package/dist/cjs/Message/QuickResponse/index.d.ts +1 -0
- package/dist/cjs/Message/QuickResponse/index.js +17 -0
- package/dist/cjs/Message/QuickStarts/QuickStartTile.d.ts +1 -1
- package/dist/cjs/Message/QuickStarts/QuickStartTile.js +3 -2
- package/dist/cjs/Message/QuickStarts/index.d.ts +2 -0
- package/dist/cjs/Message/QuickStarts/index.js +18 -0
- package/dist/cjs/Message/TableMessage/TableMessage.d.ts +6 -1
- package/dist/cjs/Message/TableMessage/TableMessage.js +3 -2
- package/dist/cjs/Message/TextMessage/TextMessage.d.ts +8 -1
- package/dist/cjs/Message/TextMessage/TextMessage.js +3 -2
- package/dist/cjs/Message/UserFeedback/UserFeedback.d.ts +3 -1
- package/dist/cjs/Message/UserFeedback/UserFeedback.js +8 -6
- package/dist/cjs/Message/UserFeedback/UserFeedbackComplete.d.ts +1 -1
- package/dist/cjs/Message/UserFeedback/UserFeedbackComplete.js +3 -2
- package/dist/cjs/Message/UserFeedback/index.d.ts +2 -0
- package/dist/cjs/Message/UserFeedback/index.js +18 -0
- package/dist/cjs/Message/index.d.ts +8 -0
- package/dist/cjs/Message/index.js +8 -0
- package/dist/cjs/MessageBar/MessageBar.d.ts +4 -0
- package/dist/cjs/MessageBar/MessageBar.js +20 -5
- package/dist/cjs/MessageBar/MessageBar.test.js +8 -0
- package/dist/cjs/Onboarding/Onboarding.d.ts +36 -0
- package/dist/cjs/Onboarding/Onboarding.js +37 -0
- package/dist/cjs/Onboarding/Onboarding.test.d.ts +1 -0
- package/dist/cjs/Onboarding/Onboarding.test.js +80 -0
- package/dist/cjs/Onboarding/index.d.ts +2 -0
- package/dist/cjs/Onboarding/index.js +23 -0
- package/dist/cjs/ResponseActions/ResponseActions.d.ts +7 -0
- package/dist/cjs/ResponseActions/ResponseActions.js +28 -7
- package/dist/cjs/ResponseActions/ResponseActions.test.js +67 -12
- package/dist/cjs/ResponseActions/ResponseActionsGroups.d.ts +13 -0
- package/dist/cjs/ResponseActions/ResponseActionsGroups.js +22 -0
- package/dist/cjs/ResponseActions/ResponseActionsGroups.test.d.ts +1 -0
- package/dist/cjs/ResponseActions/ResponseActionsGroups.test.js +25 -0
- package/dist/cjs/ResponseActions/index.d.ts +1 -0
- package/dist/cjs/ResponseActions/index.js +1 -0
- package/dist/cjs/ToolCall/ToolCall.d.ts +11 -0
- package/dist/cjs/ToolCall/ToolCall.js +24 -3
- package/dist/cjs/ToolCall/ToolCall.test.js +57 -0
- package/dist/cjs/ToolResponse/ToolResponse.d.ts +17 -0
- package/dist/cjs/ToolResponse/ToolResponse.js +49 -3
- package/dist/cjs/ToolResponse/ToolResponse.test.js +100 -0
- package/dist/cjs/index.d.ts +4 -0
- package/dist/cjs/index.js +7 -1
- package/dist/css/main.css +264 -30
- package/dist/css/main.css.map +1 -1
- package/dist/dynamic/MarkdownContent/package.json +1 -0
- package/dist/dynamic/Onboarding/package.json +1 -0
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.d.ts +9 -1
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +10 -3
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +38 -0
- package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.js +30 -3
- package/dist/esm/CodeModal/CodeModal.d.ts +2 -0
- package/dist/esm/CodeModal/CodeModal.js +54 -13
- package/dist/esm/DeepThinking/DeepThinking.d.ts +13 -0
- package/dist/esm/DeepThinking/DeepThinking.js +28 -3
- package/dist/esm/DeepThinking/DeepThinking.test.js +80 -0
- package/dist/esm/MarkdownContent/MarkdownContent.d.ts +44 -0
- package/dist/esm/MarkdownContent/MarkdownContent.js +174 -0
- package/dist/esm/MarkdownContent/MarkdownContent.test.d.ts +1 -0
- package/dist/esm/MarkdownContent/MarkdownContent.test.js +187 -0
- package/dist/esm/MarkdownContent/index.d.ts +2 -0
- package/dist/esm/MarkdownContent/index.js +2 -0
- package/dist/esm/Message/CodeBlockMessage/CodeBlockMessage.d.ts +3 -1
- package/dist/esm/Message/CodeBlockMessage/CodeBlockMessage.js +15 -4
- package/dist/esm/Message/CodeBlockMessage/CodeBlockMessage.test.d.ts +1 -0
- package/dist/esm/Message/CodeBlockMessage/CodeBlockMessage.test.js +126 -0
- package/dist/esm/Message/ErrorMessage/ErrorMessage.d.ts +15 -1
- package/dist/esm/Message/ErrorMessage/ErrorMessage.js +3 -3
- package/dist/esm/Message/ErrorMessage/ErrorMessage.test.d.ts +1 -0
- package/dist/esm/Message/ErrorMessage/ErrorMessage.test.js +25 -0
- package/dist/esm/Message/LinkMessage/LinkMessage.d.ts +5 -1
- package/dist/esm/Message/LinkMessage/LinkMessage.js +4 -3
- package/dist/esm/Message/ListMessage/OrderedListMessage.d.ts +9 -1
- package/dist/esm/Message/ListMessage/OrderedListMessage.js +2 -1
- package/dist/esm/Message/ListMessage/UnorderedListMessage.d.ts +7 -1
- package/dist/esm/Message/ListMessage/UnorderedListMessage.js +2 -1
- package/dist/esm/Message/Message.d.ts +20 -3
- package/dist/esm/Message/Message.js +8 -161
- package/dist/esm/Message/Message.test.js +129 -2
- package/dist/esm/Message/MessageAndActions/MessageAndActions.d.ts +14 -0
- package/dist/esm/Message/MessageAndActions/MessageAndActions.js +18 -0
- package/dist/esm/Message/MessageAndActions/MessageAndActions.test.d.ts +1 -0
- package/dist/esm/Message/MessageAndActions/MessageAndActions.test.js +20 -0
- package/dist/esm/Message/MessageAndActions/index.d.ts +1 -0
- package/dist/esm/Message/MessageAndActions/index.js +1 -0
- package/dist/esm/Message/MessageAttachments/MessageAttachmentItem.d.ts +13 -0
- package/dist/esm/Message/MessageAttachments/MessageAttachmentItem.js +18 -0
- package/dist/esm/Message/MessageAttachments/MessageAttachmentItem.test.d.ts +1 -0
- package/dist/esm/Message/MessageAttachments/MessageAttachmentItem.test.js +20 -0
- package/dist/esm/Message/MessageAttachments/MessageAttachmentsContainer.d.ts +13 -0
- package/dist/esm/Message/MessageAttachments/MessageAttachmentsContainer.js +18 -0
- package/dist/esm/Message/MessageAttachments/MessageAttachmentsContainer.test.d.ts +1 -0
- package/dist/esm/Message/MessageAttachments/MessageAttachmentsContainer.test.js +20 -0
- package/dist/esm/Message/MessageAttachments/index.d.ts +2 -0
- package/dist/esm/Message/MessageAttachments/index.js +2 -0
- package/dist/esm/Message/MessageInput.d.ts +1 -1
- package/dist/esm/Message/MessageInput.js +1 -1
- package/dist/esm/Message/MessageLoading.d.ts +13 -4
- package/dist/esm/Message/MessageLoading.js +16 -4
- package/dist/esm/Message/MessageLoading.test.d.ts +1 -0
- package/dist/esm/Message/MessageLoading.test.js +20 -0
- package/dist/esm/Message/QuickResponse/QuickResponse.js +3 -2
- package/dist/esm/Message/QuickResponse/QuickResponse.test.d.ts +1 -0
- package/dist/esm/Message/QuickResponse/QuickResponse.test.js +104 -0
- package/dist/esm/Message/QuickResponse/index.d.ts +1 -0
- package/dist/esm/Message/QuickResponse/index.js +1 -0
- package/dist/esm/Message/QuickStarts/QuickStartTile.d.ts +1 -1
- package/dist/esm/Message/QuickStarts/QuickStartTile.js +1 -1
- package/dist/esm/Message/QuickStarts/index.d.ts +2 -0
- package/dist/esm/Message/QuickStarts/index.js +2 -0
- package/dist/esm/Message/TableMessage/TableMessage.d.ts +6 -1
- package/dist/esm/Message/TableMessage/TableMessage.js +3 -2
- package/dist/esm/Message/TextMessage/TextMessage.d.ts +8 -1
- package/dist/esm/Message/TextMessage/TextMessage.js +3 -2
- package/dist/esm/Message/UserFeedback/UserFeedback.d.ts +3 -1
- package/dist/esm/Message/UserFeedback/UserFeedback.js +7 -7
- package/dist/esm/Message/UserFeedback/UserFeedbackComplete.d.ts +1 -1
- package/dist/esm/Message/UserFeedback/UserFeedbackComplete.js +1 -2
- package/dist/esm/Message/UserFeedback/index.d.ts +2 -0
- package/dist/esm/Message/UserFeedback/index.js +2 -0
- package/dist/esm/Message/index.d.ts +8 -0
- package/dist/esm/Message/index.js +8 -0
- package/dist/esm/MessageBar/MessageBar.d.ts +4 -0
- package/dist/esm/MessageBar/MessageBar.js +20 -5
- package/dist/esm/MessageBar/MessageBar.test.js +8 -0
- package/dist/esm/Onboarding/Onboarding.d.ts +36 -0
- package/dist/esm/Onboarding/Onboarding.js +30 -0
- package/dist/esm/Onboarding/Onboarding.test.d.ts +1 -0
- package/dist/esm/Onboarding/Onboarding.test.js +75 -0
- package/dist/esm/Onboarding/index.d.ts +2 -0
- package/dist/esm/Onboarding/index.js +2 -0
- package/dist/esm/ResponseActions/ResponseActions.d.ts +7 -0
- package/dist/esm/ResponseActions/ResponseActions.js +28 -7
- package/dist/esm/ResponseActions/ResponseActions.test.js +67 -12
- package/dist/esm/ResponseActions/ResponseActionsGroups.d.ts +13 -0
- package/dist/esm/ResponseActions/ResponseActionsGroups.js +18 -0
- package/dist/esm/ResponseActions/ResponseActionsGroups.test.d.ts +1 -0
- package/dist/esm/ResponseActions/ResponseActionsGroups.test.js +20 -0
- package/dist/esm/ResponseActions/index.d.ts +1 -0
- package/dist/esm/ResponseActions/index.js +1 -0
- package/dist/esm/ToolCall/ToolCall.d.ts +11 -0
- package/dist/esm/ToolCall/ToolCall.js +21 -3
- package/dist/esm/ToolCall/ToolCall.test.js +57 -0
- package/dist/esm/ToolResponse/ToolResponse.d.ts +17 -0
- package/dist/esm/ToolResponse/ToolResponse.js +46 -3
- package/dist/esm/ToolResponse/ToolResponse.test.js +100 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +4 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +13 -3
- package/patternfly-docs/content/extensions/chatbot/chatbot.md +57 -0
- package/patternfly-docs/content/extensions/chatbot/design-guidelines.md +12 -12
- package/patternfly-docs/content/extensions/chatbot/examples/Analytics/Analytics.md +1 -1
- package/patternfly-docs/content/extensions/chatbot/examples/Customizing Messages/Customizing Messages.md +1 -1
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/BotMessage.tsx +1 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithCustomStructure.tsx +102 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithDeepThinking.tsx +25 -11
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithFeedback.tsx +14 -1
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithMarkdownDeepThinking.tsx +26 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithMarkdownToolCall.tsx +29 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithMarkdownToolResponse.tsx +200 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithMultipleActionGroups.tsx +61 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithPersistedActions.tsx +22 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithQuickResponses.tsx +11 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithToolCall.tsx +14 -1
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithToolResponse.tsx +222 -105
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/Messages.md +123 -14
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/UserMessage.tsx +1 -0
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerWithSearchActions.tsx +198 -0
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotMessageBarIndicatorThinking.tsx +15 -0
- package/patternfly-docs/content/extensions/chatbot/examples/UI/CompactOnboarding.tsx +141 -0
- package/patternfly-docs/content/extensions/chatbot/examples/UI/Onboarding.tsx +151 -0
- package/patternfly-docs/content/extensions/chatbot/examples/UI/RH-Hat-Image.svg +9 -0
- package/patternfly-docs/content/extensions/chatbot/examples/UI/UI.md +67 -29
- package/patternfly-docs/content/extensions/chatbot/examples/demos/AttachmentDemos.md +18 -18
- package/patternfly-docs/content/extensions/chatbot/examples/demos/Chatbot.md +33 -19
- package/patternfly-docs/patternfly-docs.config.js +1 -1
- package/patternfly-docs/patternfly-docs.source.js +1 -1
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.scss +43 -0
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.tsx +95 -0
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.tsx +51 -15
- package/src/ChatbotHeader/ChatbotHeaderMenu.tsx +56 -14
- package/src/ChatbotModal/ChatbotModal.scss +3 -0
- package/src/CodeModal/CodeModal.tsx +71 -26
- package/src/DeepThinking/DeepThinking.scss +1 -1
- package/src/DeepThinking/DeepThinking.test.tsx +109 -0
- package/src/DeepThinking/DeepThinking.tsx +54 -5
- package/src/MarkdownContent/MarkdownContent.test.tsx +207 -0
- package/src/MarkdownContent/MarkdownContent.tsx +269 -0
- package/src/MarkdownContent/index.ts +2 -0
- package/src/Message/CodeBlockMessage/CodeBlockMessage.scss +13 -0
- package/src/Message/CodeBlockMessage/CodeBlockMessage.test.tsx +171 -0
- package/src/Message/CodeBlockMessage/CodeBlockMessage.tsx +17 -4
- package/src/Message/ErrorMessage/ErrorMessage.test.tsx +38 -0
- package/src/Message/ErrorMessage/ErrorMessage.tsx +17 -2
- package/src/Message/LinkMessage/LinkMessage.scss +5 -0
- package/src/Message/LinkMessage/LinkMessage.tsx +24 -2
- package/src/Message/ListMessage/ListMessage.scss +8 -0
- package/src/Message/ListMessage/OrderedListMessage.tsx +16 -2
- package/src/Message/ListMessage/UnorderedListMessage.tsx +12 -2
- package/src/Message/Message.scss +11 -7
- package/src/Message/Message.test.tsx +202 -2
- package/src/Message/Message.tsx +129 -241
- package/src/Message/MessageAndActions/MessageAndActions.test.tsx +23 -0
- package/src/Message/MessageAndActions/MessageAndActions.tsx +22 -0
- package/src/Message/MessageAndActions/index.ts +1 -0
- package/src/Message/MessageAttachments/MessageAttachmentItem.test.tsx +23 -0
- package/src/Message/MessageAttachments/MessageAttachmentItem.tsx +25 -0
- package/src/Message/MessageAttachments/MessageAttachmentsContainer.test.tsx +23 -0
- package/src/Message/MessageAttachments/MessageAttachmentsContainer.tsx +25 -0
- package/src/Message/MessageAttachments/index.ts +2 -0
- package/src/Message/MessageInput.tsx +1 -1
- package/src/Message/MessageLoading.test.tsx +23 -0
- package/src/Message/MessageLoading.tsx +17 -2
- package/src/Message/QuickResponse/QuickResponse.scss +3 -1
- package/src/Message/QuickResponse/QuickResponse.test.tsx +131 -0
- package/src/Message/QuickResponse/QuickResponse.tsx +3 -2
- package/src/Message/QuickResponse/index.ts +1 -0
- package/src/Message/QuickStarts/QuickStartTile.tsx +1 -1
- package/src/Message/QuickStarts/index.ts +2 -0
- package/src/Message/TableMessage/TableMessage.scss +13 -1
- package/src/Message/TableMessage/TableMessage.tsx +18 -2
- package/src/Message/TextMessage/TextMessage.scss +12 -0
- package/src/Message/TextMessage/TextMessage.tsx +29 -2
- package/src/Message/UserFeedback/UserFeedback.scss +28 -1
- package/src/Message/UserFeedback/UserFeedback.tsx +23 -13
- package/src/Message/UserFeedback/UserFeedbackComplete.tsx +1 -4
- package/src/Message/UserFeedback/index.ts +2 -0
- package/src/Message/index.ts +8 -0
- package/src/MessageBar/AttachButton.scss +0 -1
- package/src/MessageBar/MessageBar.scss +48 -6
- package/src/MessageBar/MessageBar.test.tsx +12 -0
- package/src/MessageBar/MessageBar.tsx +38 -4
- package/src/MessageBar/MicrophoneButton.scss +0 -1
- package/src/MessageBar/SendButton.scss +0 -1
- package/src/MessageBar/StopButton.scss +0 -1
- package/src/Onboarding/Onboarding.scss +101 -0
- package/src/Onboarding/Onboarding.test.tsx +148 -0
- package/src/Onboarding/Onboarding.tsx +126 -0
- package/src/Onboarding/index.ts +3 -0
- package/src/ResponseActions/ResponseActions.scss +12 -1
- package/src/ResponseActions/ResponseActions.test.tsx +111 -12
- package/src/ResponseActions/ResponseActions.tsx +44 -10
- package/src/ResponseActions/ResponseActionsGroups.test.tsx +23 -0
- package/src/ResponseActions/ResponseActionsGroups.tsx +28 -0
- package/src/ResponseActions/index.ts +1 -0
- package/src/ToolCall/ToolCall.scss +1 -1
- package/src/ToolCall/ToolCall.test.tsx +91 -0
- package/src/ToolCall/ToolCall.tsx +49 -4
- package/src/ToolResponse/ToolResponse.scss +13 -3
- package/src/ToolResponse/ToolResponse.test.tsx +119 -0
- package/src/ToolResponse/ToolResponse.tsx +82 -7
- package/src/index.ts +6 -0
- package/src/main.scss +2 -0
- package/tsconfig.json +1 -1
- package/patternfly-docs/content/extensions/chatbot/about-chatbot.md +0 -44
|
@@ -318,4 +318,12 @@ describe('Message bar', () => {
|
|
|
318
318
|
const { container } = render(_jsx(MessageBar, { isPrimary: true, onSendMessage: jest.fn }));
|
|
319
319
|
expect(container.querySelector('.pf-m-primary')).toBeTruthy();
|
|
320
320
|
});
|
|
321
|
+
it('Renders with class pf-v6-m-ai-indicator when hasAiIndicator is true', () => {
|
|
322
|
+
render(_jsx(MessageBar, { onSendMessage: jest.fn, hasAiIndicator: true }));
|
|
323
|
+
expect(screen.getByRole('textbox').closest('.pf-chatbot__message-bar')).toHaveClass('pf-v6-m-ai-indicator');
|
|
324
|
+
});
|
|
325
|
+
it('Renders with class pf-v6-m-thinking when isThinking is true', () => {
|
|
326
|
+
render(_jsx(MessageBar, { onSendMessage: jest.fn, isThinking: true }));
|
|
327
|
+
expect(screen.getByRole('textbox').closest('.pf-chatbot__message-bar')).toHaveClass('pf-v6-m-thinking');
|
|
328
|
+
});
|
|
321
329
|
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { FunctionComponent } from 'react';
|
|
2
|
+
import { ModalProps } from '@patternfly/react-core';
|
|
3
|
+
import { ChatbotDisplayMode } from '../Chatbot';
|
|
4
|
+
export interface OnboardingProps extends ModalProps {
|
|
5
|
+
/** Class applied to modal */
|
|
6
|
+
className?: string;
|
|
7
|
+
/** Action assigned to primary modal button */
|
|
8
|
+
onPrimaryAction?: (event: React.MouseEvent | MouseEvent | KeyboardEvent) => void;
|
|
9
|
+
/** Action assigned to secondary modal button */
|
|
10
|
+
onSecondaryAction: (event: React.MouseEvent | MouseEvent | KeyboardEvent) => void;
|
|
11
|
+
/** Name of primary modal button */
|
|
12
|
+
primaryActionBtn?: string;
|
|
13
|
+
/** Name of secondary modal button */
|
|
14
|
+
secondaryActionBtn?: string;
|
|
15
|
+
/** Function that handles modal toggle */
|
|
16
|
+
handleModalToggle: (event: React.MouseEvent | MouseEvent | KeyboardEvent) => void;
|
|
17
|
+
/** Whether modal is open */
|
|
18
|
+
isModalOpen: boolean;
|
|
19
|
+
/** Title of modal */
|
|
20
|
+
title?: string;
|
|
21
|
+
/** Display mode for the Chatbot parent; this influences the styles applied */
|
|
22
|
+
displayMode?: ChatbotDisplayMode;
|
|
23
|
+
/** Optional image displayed in header */
|
|
24
|
+
headerImage?: string;
|
|
25
|
+
/** Alt text for optional image displayed in header */
|
|
26
|
+
headerImageAltText?: string;
|
|
27
|
+
/** Ref applied to modal */
|
|
28
|
+
innerRef?: React.Ref<HTMLDivElement>;
|
|
29
|
+
/** OuiaID applied to modal */
|
|
30
|
+
ouiaId?: string;
|
|
31
|
+
/** Sets modal to compact styling. */
|
|
32
|
+
isCompact?: boolean;
|
|
33
|
+
}
|
|
34
|
+
export declare const OnboardingBase: FunctionComponent<OnboardingProps>;
|
|
35
|
+
declare const Onboarding: import("react").ForwardRefExoticComponent<Omit<OnboardingProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
36
|
+
export default Onboarding;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
|
+
import { forwardRef } from 'react';
|
|
14
|
+
import { Button, Content, ModalBody, ModalFooter } from '@patternfly/react-core';
|
|
15
|
+
import { ChatbotDisplayMode } from '../Chatbot';
|
|
16
|
+
import ChatbotModal from '../ChatbotModal/ChatbotModal';
|
|
17
|
+
export const OnboardingBase = (_a) => {
|
|
18
|
+
var { handleModalToggle, isModalOpen, onPrimaryAction, onSecondaryAction, primaryActionBtn = 'Continue', secondaryActionBtn = 'Skip', title = 'Onboarding', headerImage, headerImageAltText = '', displayMode = ChatbotDisplayMode.default, className, children, innerRef, ouiaId = 'Onboarding', isCompact } = _a, props = __rest(_a, ["handleModalToggle", "isModalOpen", "onPrimaryAction", "onSecondaryAction", "primaryActionBtn", "secondaryActionBtn", "title", "headerImage", "headerImageAltText", "displayMode", "className", "children", "innerRef", "ouiaId", "isCompact"]);
|
|
19
|
+
const handlePrimaryAction = (_event) => {
|
|
20
|
+
handleModalToggle(_event);
|
|
21
|
+
onPrimaryAction && onPrimaryAction(_event);
|
|
22
|
+
};
|
|
23
|
+
const handleSecondaryAction = (_event) => {
|
|
24
|
+
onSecondaryAction(_event);
|
|
25
|
+
};
|
|
26
|
+
const modal = (_jsx(ChatbotModal, Object.assign({ isOpen: isModalOpen, ouiaId: ouiaId, "aria-labelledby": "onboarding-title", "aria-describedby": "onboarding-modal", className: `pf-chatbot__onboarding-modal pf-chatbot__onboarding-modal--${displayMode} ${isCompact ? 'pf-m-compact' : ''} ${className ? className : ''}`, displayMode: displayMode, onClose: handleModalToggle }, props, { children: _jsx("section", { className: `pf-chatbot__onboarding--section`, "aria-label": title, tabIndex: -1, ref: innerRef, children: _jsxs(_Fragment, { children: [_jsxs(ModalBody, { className: "pf-chatbot__onboarding--modal-body", children: [!isCompact && headerImage && (_jsx("div", { className: "pf-chatbot__onboarding--header", children: _jsx("img", { src: headerImage, className: "pf-chatbot__onboarding--image", alt: headerImageAltText }) })), _jsxs("div", { className: "pf-chatbot__onboarding--modal-text", children: [_jsx("h1", { className: "pf-chatbot__onboarding--title", children: title }), _jsx(Content, { children: children })] })] }), _jsxs(ModalFooter, { className: "pf-chatbot__onboarding--footer", children: [_jsx(Button, { isBlock: true, variant: "primary", onClick: handlePrimaryAction, form: "onboarding-form", size: "lg", children: primaryActionBtn }, "onboarding-modal-primary"), _jsx(Button, { isBlock: true, variant: "secondary", onClick: handleSecondaryAction, size: "lg", children: secondaryActionBtn }, "onboarding-modal-secondary")] })] }) }) })));
|
|
27
|
+
return modal;
|
|
28
|
+
};
|
|
29
|
+
const Onboarding = forwardRef((props, ref) => (_jsx(OnboardingBase, Object.assign({ innerRef: ref }, props))));
|
|
30
|
+
export default Onboarding;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
import { render, screen } from '@testing-library/react';
|
|
12
|
+
import '@testing-library/jest-dom';
|
|
13
|
+
import userEvent from '@testing-library/user-event';
|
|
14
|
+
import Onboarding from './Onboarding';
|
|
15
|
+
const handleModalToggle = jest.fn();
|
|
16
|
+
const onPrimaryAction = jest.fn();
|
|
17
|
+
const onSecondaryAction = jest.fn();
|
|
18
|
+
const body = 'Experience personalized assistance and seamless problem-solving, simplifying your journey with Red Hat every step of the way.';
|
|
19
|
+
describe('Onboarding', () => {
|
|
20
|
+
afterEach(() => {
|
|
21
|
+
jest.clearAllMocks();
|
|
22
|
+
});
|
|
23
|
+
it('should render modal correctly', () => {
|
|
24
|
+
render(_jsx(Onboarding, { isModalOpen: true, onSecondaryAction: onSecondaryAction, handleModalToggle: handleModalToggle, ouiaId: "Terms", children: body }));
|
|
25
|
+
expect(screen.getByRole('heading', { name: /Onboarding/i })).toBeTruthy();
|
|
26
|
+
expect(screen.getByRole('button', { name: /Continue/i })).toBeTruthy();
|
|
27
|
+
expect(screen.getByRole('button', { name: /Skip/i })).toBeTruthy();
|
|
28
|
+
expect(screen.getByText(body)).toBeTruthy();
|
|
29
|
+
expect(screen.getByRole('dialog')).toHaveClass('pf-chatbot__onboarding-modal');
|
|
30
|
+
expect(screen.getByRole('dialog')).toHaveClass('pf-chatbot__onboarding-modal--default');
|
|
31
|
+
});
|
|
32
|
+
it('should handle image and altText props', () => {
|
|
33
|
+
render(_jsx(Onboarding, { isModalOpen: true, onSecondaryAction: onSecondaryAction, handleModalToggle: handleModalToggle, headerImage: "./image.png", headerImageAltText: "Test image", children: body }));
|
|
34
|
+
expect(screen.getByRole('img')).toBeTruthy();
|
|
35
|
+
expect(screen.getByRole('img')).toHaveAttribute('alt', 'Test image');
|
|
36
|
+
});
|
|
37
|
+
it('should handle className prop', () => {
|
|
38
|
+
render(_jsx(Onboarding, { isModalOpen: true, onSecondaryAction: onSecondaryAction, handleModalToggle: handleModalToggle, className: "test", children: body }));
|
|
39
|
+
expect(screen.getByRole('dialog')).toHaveClass('pf-chatbot__onboarding-modal');
|
|
40
|
+
expect(screen.getByRole('dialog')).toHaveClass('pf-chatbot__onboarding-modal--default');
|
|
41
|
+
expect(screen.getByRole('dialog')).toHaveClass('test');
|
|
42
|
+
});
|
|
43
|
+
it('should handle title prop', () => {
|
|
44
|
+
render(_jsx(Onboarding, { isModalOpen: true, onSecondaryAction: onSecondaryAction, handleModalToggle: handleModalToggle, title: "Updated title", children: body }));
|
|
45
|
+
expect(screen.getByRole('heading', { name: /Updated title/i })).toBeTruthy();
|
|
46
|
+
expect(screen.queryByRole('heading', { name: /Onboarding/i })).toBeFalsy();
|
|
47
|
+
});
|
|
48
|
+
it('should handle primary button prop', () => {
|
|
49
|
+
render(_jsx(Onboarding, { isModalOpen: true, onSecondaryAction: onSecondaryAction, handleModalToggle: handleModalToggle, primaryActionBtn: "First", children: body }));
|
|
50
|
+
expect(screen.getByRole('button', { name: /First/i })).toBeTruthy();
|
|
51
|
+
expect(screen.queryByRole('button', { name: /Continue/i })).toBeFalsy();
|
|
52
|
+
});
|
|
53
|
+
it('should handle secondary button prop', () => {
|
|
54
|
+
render(_jsx(Onboarding, { isModalOpen: true, onSecondaryAction: onSecondaryAction, handleModalToggle: handleModalToggle, secondaryActionBtn: "Second", children: body }));
|
|
55
|
+
expect(screen.getByRole('button', { name: /Second/i })).toBeTruthy();
|
|
56
|
+
expect(screen.queryByRole('button', { name: /Skip/i })).toBeFalsy();
|
|
57
|
+
});
|
|
58
|
+
it('should handle primary button click', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
59
|
+
render(_jsx(Onboarding, { isModalOpen: true, onPrimaryAction: onPrimaryAction, onSecondaryAction: onSecondaryAction, handleModalToggle: handleModalToggle, children: body }));
|
|
60
|
+
yield userEvent.click(screen.getByRole('button', { name: /Continue/i }));
|
|
61
|
+
expect(onPrimaryAction).toHaveBeenCalledTimes(1);
|
|
62
|
+
expect(handleModalToggle).toHaveBeenCalledTimes(1);
|
|
63
|
+
}));
|
|
64
|
+
it('should handle secondary button click', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
65
|
+
render(_jsx(Onboarding, { isModalOpen: true, onSecondaryAction: onSecondaryAction, handleModalToggle: handleModalToggle, children: body }));
|
|
66
|
+
yield userEvent.click(screen.getByRole('button', { name: /Skip/i }));
|
|
67
|
+
expect(onSecondaryAction).toHaveBeenCalledTimes(1);
|
|
68
|
+
expect(handleModalToggle).not.toHaveBeenCalled();
|
|
69
|
+
}));
|
|
70
|
+
it('should handle isCompact prop', () => {
|
|
71
|
+
render(_jsx(Onboarding, { isModalOpen: true, onSecondaryAction: onSecondaryAction, handleModalToggle: handleModalToggle, isCompact: true, headerImage: "./image.png", headerImageAltText: "Test image", children: body }));
|
|
72
|
+
expect(screen.getByRole('dialog')).toHaveClass('pf-m-compact');
|
|
73
|
+
expect(screen.queryByRole('img')).toBeFalsy();
|
|
74
|
+
});
|
|
75
|
+
});
|
|
@@ -29,6 +29,10 @@ export interface ActionProps extends Omit<ButtonProps, 'ref'> {
|
|
|
29
29
|
type ExtendedActionProps = ActionProps & {
|
|
30
30
|
[key: string]: any;
|
|
31
31
|
};
|
|
32
|
+
/**
|
|
33
|
+
* The various actions that can be attached to a bot message for users to interact with.
|
|
34
|
+
* Use this component when passing children to Message to customize its structure.
|
|
35
|
+
*/
|
|
32
36
|
export interface ResponseActionProps {
|
|
33
37
|
/** Props for message actions, such as feedback (positive or negative), copy button, share, and listen */
|
|
34
38
|
actions: Record<string, ExtendedActionProps | undefined> & {
|
|
@@ -40,6 +44,9 @@ export interface ResponseActionProps {
|
|
|
40
44
|
listen?: ActionProps;
|
|
41
45
|
edit?: ActionProps;
|
|
42
46
|
};
|
|
47
|
+
/** When true, the selected action will persist even when clicking outside the component.
|
|
48
|
+
* When false (default), clicking outside or clicking another action will deselect the current selection. */
|
|
49
|
+
persistActionSelection?: boolean;
|
|
43
50
|
}
|
|
44
51
|
export declare const ResponseActions: FunctionComponent<ResponseActionProps>;
|
|
45
52
|
export default ResponseActions;
|
|
@@ -14,10 +14,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
14
14
|
import { useEffect, useRef, useState } from 'react';
|
|
15
15
|
import { ExternalLinkAltIcon, VolumeUpIcon, OutlinedThumbsUpIcon, OutlinedThumbsDownIcon, OutlinedCopyIcon, DownloadIcon, PencilAltIcon } from '@patternfly/react-icons';
|
|
16
16
|
import ResponseActionButton from './ResponseActionButton';
|
|
17
|
-
export const ResponseActions = ({ actions }) => {
|
|
17
|
+
export const ResponseActions = ({ actions, persistActionSelection = false }) => {
|
|
18
18
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3;
|
|
19
19
|
const [activeButton, setActiveButton] = useState();
|
|
20
20
|
const [clickStatePersisted, setClickStatePersisted] = useState(false);
|
|
21
|
+
const { positive, negative, copy, edit, share, download, listen } = actions, additionalActions = __rest(actions, ["positive", "negative", "copy", "edit", "share", "download", "listen"]);
|
|
21
22
|
useEffect(() => {
|
|
22
23
|
// Define the order of precedence for checking initial `isClicked`
|
|
23
24
|
const actionPrecedence = ['positive', 'negative', 'copy', 'edit', 'share', 'download', 'listen'];
|
|
@@ -39,11 +40,18 @@ export const ResponseActions = ({ actions }) => {
|
|
|
39
40
|
// Click state is explicitly controlled by consumer.
|
|
40
41
|
setClickStatePersisted(true);
|
|
41
42
|
}
|
|
43
|
+
// If persistActionSelection is true, all selections are persisted
|
|
44
|
+
if (persistActionSelection) {
|
|
45
|
+
setClickStatePersisted(true);
|
|
46
|
+
}
|
|
42
47
|
setActiveButton(initialActive);
|
|
43
|
-
}, [actions]);
|
|
44
|
-
const { positive, negative, copy, edit, share, download, listen } = actions, additionalActions = __rest(actions, ["positive", "negative", "copy", "edit", "share", "download", "listen"]);
|
|
48
|
+
}, [actions, persistActionSelection]);
|
|
45
49
|
const responseActions = useRef(null);
|
|
46
50
|
useEffect(() => {
|
|
51
|
+
// Only add click outside listener if not persisting selection
|
|
52
|
+
if (persistActionSelection) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
47
55
|
const handleClickOutside = (e) => {
|
|
48
56
|
if (responseActions.current && !responseActions.current.contains(e.target) && !clickStatePersisted) {
|
|
49
57
|
setActiveButton(undefined);
|
|
@@ -53,13 +61,26 @@ export const ResponseActions = ({ actions }) => {
|
|
|
53
61
|
return () => {
|
|
54
62
|
window.removeEventListener('click', handleClickOutside);
|
|
55
63
|
};
|
|
56
|
-
}, [clickStatePersisted]);
|
|
64
|
+
}, [clickStatePersisted, persistActionSelection]);
|
|
57
65
|
const handleClick = (e, id, onClick) => {
|
|
58
|
-
|
|
59
|
-
|
|
66
|
+
if (persistActionSelection) {
|
|
67
|
+
if (activeButton === id) {
|
|
68
|
+
// Toggle off if clicking the same button
|
|
69
|
+
setActiveButton(undefined);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
// Set new active button
|
|
73
|
+
setActiveButton(id);
|
|
74
|
+
}
|
|
75
|
+
setClickStatePersisted(true);
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
setClickStatePersisted(false);
|
|
79
|
+
setActiveButton(id);
|
|
80
|
+
}
|
|
60
81
|
onClick && onClick(e);
|
|
61
82
|
};
|
|
62
|
-
return (_jsxs("div", { ref: responseActions, className: "pf-chatbot__response-actions", children: [positive && (_jsx(ResponseActionButton, Object.assign({}, positive, { ariaLabel: (_a = positive.ariaLabel) !== null && _a !== void 0 ? _a : 'Good response', clickedAriaLabel: (_b = positive.ariaLabel) !== null && _b !== void 0 ? _b : '
|
|
83
|
+
return (_jsxs("div", { ref: responseActions, className: "pf-chatbot__response-actions", children: [positive && (_jsx(ResponseActionButton, Object.assign({}, positive, { ariaLabel: (_a = positive.ariaLabel) !== null && _a !== void 0 ? _a : 'Good response', clickedAriaLabel: (_b = positive.ariaLabel) !== null && _b !== void 0 ? _b : 'Good response recorded', onClick: (e) => handleClick(e, 'positive', positive.onClick), className: positive.className, isDisabled: positive.isDisabled, tooltipContent: (_c = positive.tooltipContent) !== null && _c !== void 0 ? _c : 'Good response', clickedTooltipContent: (_d = positive.clickedTooltipContent) !== null && _d !== void 0 ? _d : 'Good response recorded', tooltipProps: positive.tooltipProps, icon: _jsx(OutlinedThumbsUpIcon, {}), isClicked: activeButton === 'positive', ref: positive.ref, "aria-expanded": positive['aria-expanded'], "aria-controls": positive['aria-controls'] }))), negative && (_jsx(ResponseActionButton, Object.assign({}, negative, { ariaLabel: (_e = negative.ariaLabel) !== null && _e !== void 0 ? _e : 'Bad response', clickedAriaLabel: (_f = negative.ariaLabel) !== null && _f !== void 0 ? _f : 'Bad response recorded', onClick: (e) => handleClick(e, 'negative', negative.onClick), className: negative.className, isDisabled: negative.isDisabled, tooltipContent: (_g = negative.tooltipContent) !== null && _g !== void 0 ? _g : 'Bad response', clickedTooltipContent: (_h = negative.clickedTooltipContent) !== null && _h !== void 0 ? _h : 'Bad response recorded', tooltipProps: negative.tooltipProps, icon: _jsx(OutlinedThumbsDownIcon, {}), isClicked: activeButton === 'negative', ref: negative.ref, "aria-expanded": negative['aria-expanded'], "aria-controls": negative['aria-controls'] }))), copy && (_jsx(ResponseActionButton, Object.assign({}, copy, { ariaLabel: (_j = copy.ariaLabel) !== null && _j !== void 0 ? _j : 'Copy', clickedAriaLabel: (_k = copy.ariaLabel) !== null && _k !== void 0 ? _k : 'Copied', onClick: (e) => handleClick(e, 'copy', copy.onClick), className: copy.className, isDisabled: copy.isDisabled, tooltipContent: (_l = copy.tooltipContent) !== null && _l !== void 0 ? _l : 'Copy', clickedTooltipContent: (_m = copy.clickedTooltipContent) !== null && _m !== void 0 ? _m : 'Copied', tooltipProps: copy.tooltipProps, icon: _jsx(OutlinedCopyIcon, {}), isClicked: activeButton === 'copy', ref: copy.ref, "aria-expanded": copy['aria-expanded'], "aria-controls": copy['aria-controls'] }))), edit && (_jsx(ResponseActionButton, Object.assign({}, edit, { ariaLabel: (_o = edit.ariaLabel) !== null && _o !== void 0 ? _o : 'Edit', clickedAriaLabel: (_p = edit.ariaLabel) !== null && _p !== void 0 ? _p : 'Editing', onClick: (e) => handleClick(e, 'edit', edit.onClick), className: edit.className, isDisabled: edit.isDisabled, tooltipContent: (_q = edit.tooltipContent) !== null && _q !== void 0 ? _q : 'Edit ', clickedTooltipContent: (_r = edit.clickedTooltipContent) !== null && _r !== void 0 ? _r : 'Editing', tooltipProps: edit.tooltipProps, icon: _jsx(PencilAltIcon, {}), isClicked: activeButton === 'edit', ref: edit.ref, "aria-expanded": edit['aria-expanded'], "aria-controls": edit['aria-controls'] }))), share && (_jsx(ResponseActionButton, Object.assign({}, share, { ariaLabel: (_s = share.ariaLabel) !== null && _s !== void 0 ? _s : 'Share', clickedAriaLabel: (_t = share.ariaLabel) !== null && _t !== void 0 ? _t : 'Shared', onClick: (e) => handleClick(e, 'share', share.onClick), className: share.className, isDisabled: share.isDisabled, tooltipContent: (_u = share.tooltipContent) !== null && _u !== void 0 ? _u : 'Share', clickedTooltipContent: (_v = share.clickedTooltipContent) !== null && _v !== void 0 ? _v : 'Shared', tooltipProps: share.tooltipProps, icon: _jsx(ExternalLinkAltIcon, {}), isClicked: activeButton === 'share', ref: share.ref, "aria-expanded": share['aria-expanded'], "aria-controls": share['aria-controls'] }))), download && (_jsx(ResponseActionButton, Object.assign({}, download, { ariaLabel: (_w = download.ariaLabel) !== null && _w !== void 0 ? _w : 'Download', clickedAriaLabel: (_x = download.ariaLabel) !== null && _x !== void 0 ? _x : 'Downloaded', onClick: (e) => handleClick(e, 'download', download.onClick), className: download.className, isDisabled: download.isDisabled, tooltipContent: (_y = download.tooltipContent) !== null && _y !== void 0 ? _y : 'Download', clickedTooltipContent: (_z = download.clickedTooltipContent) !== null && _z !== void 0 ? _z : 'Downloaded', tooltipProps: download.tooltipProps, icon: _jsx(DownloadIcon, {}), isClicked: activeButton === 'download', ref: download.ref, "aria-expanded": download['aria-expanded'], "aria-controls": download['aria-controls'] }))), listen && (_jsx(ResponseActionButton, Object.assign({}, listen, { ariaLabel: (_0 = listen.ariaLabel) !== null && _0 !== void 0 ? _0 : 'Listen', clickedAriaLabel: (_1 = listen.ariaLabel) !== null && _1 !== void 0 ? _1 : 'Listening', onClick: (e) => handleClick(e, 'listen', listen.onClick), className: listen.className, isDisabled: listen.isDisabled, tooltipContent: (_2 = listen.tooltipContent) !== null && _2 !== void 0 ? _2 : 'Listen', clickedTooltipContent: (_3 = listen.clickedTooltipContent) !== null && _3 !== void 0 ? _3 : 'Listening', tooltipProps: listen.tooltipProps, icon: _jsx(VolumeUpIcon, {}), isClicked: activeButton === 'listen', ref: listen.ref, "aria-expanded": listen['aria-expanded'], "aria-controls": listen['aria-controls'] }))), Object.keys(additionalActions).map((action) => {
|
|
63
84
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
64
85
|
return (_createElement(ResponseActionButton, Object.assign({}, additionalActions[action], { key: action, ariaLabel: (_a = additionalActions[action]) === null || _a === void 0 ? void 0 : _a.ariaLabel, clickedAriaLabel: (_b = additionalActions[action]) === null || _b === void 0 ? void 0 : _b.clickedAriaLabel, onClick: (e) => { var _a; return handleClick(e, action, (_a = additionalActions[action]) === null || _a === void 0 ? void 0 : _a.onClick); }, className: (_c = additionalActions[action]) === null || _c === void 0 ? void 0 : _c.className, isDisabled: (_d = additionalActions[action]) === null || _d === void 0 ? void 0 : _d.isDisabled, tooltipContent: (_e = additionalActions[action]) === null || _e === void 0 ? void 0 : _e.tooltipContent, tooltipProps: (_f = additionalActions[action]) === null || _f === void 0 ? void 0 : _f.tooltipProps, clickedTooltipContent: (_g = additionalActions[action]) === null || _g === void 0 ? void 0 : _g.clickedTooltipContent, icon: (_h = additionalActions[action]) === null || _h === void 0 ? void 0 : _h.icon, isClicked: activeButton === action, ref: (_j = additionalActions[action]) === null || _j === void 0 ? void 0 : _j.ref, "aria-expanded": (_k = additionalActions[action]) === null || _k === void 0 ? void 0 : _k['aria-expanded'], "aria-controls": (_l = additionalActions[action]) === null || _l === void 0 ? void 0 : _l['aria-controls'] })));
|
|
65
86
|
})] }));
|
|
@@ -15,8 +15,8 @@ import userEvent from '@testing-library/user-event';
|
|
|
15
15
|
import { DownloadIcon, InfoCircleIcon, RedoIcon } from '@patternfly/react-icons';
|
|
16
16
|
import Message from '../Message';
|
|
17
17
|
const ALL_ACTIONS = [
|
|
18
|
-
{ type: 'positive', label: 'Good response', clickedLabel: '
|
|
19
|
-
{ type: 'negative', label: 'Bad response', clickedLabel: '
|
|
18
|
+
{ type: 'positive', label: 'Good response', clickedLabel: 'Good response recorded' },
|
|
19
|
+
{ type: 'negative', label: 'Bad response', clickedLabel: 'Bad response recorded' },
|
|
20
20
|
{ type: 'copy', label: 'Copy', clickedLabel: 'Copied' },
|
|
21
21
|
{ type: 'edit', label: 'Edit', clickedLabel: 'Editing' },
|
|
22
22
|
{ type: 'share', label: 'Share', clickedLabel: 'Shared' },
|
|
@@ -83,13 +83,13 @@ describe('ResponseActions', () => {
|
|
|
83
83
|
expect(button).toBeTruthy();
|
|
84
84
|
});
|
|
85
85
|
yield userEvent.click(goodBtn);
|
|
86
|
-
expect(screen.getByRole('button', { name: '
|
|
86
|
+
expect(screen.getByRole('button', { name: 'Good response recorded' })).toHaveClass('pf-chatbot__button--response-action-clicked');
|
|
87
87
|
let unclickedButtons = buttons.filter((button) => button !== goodBtn);
|
|
88
88
|
unclickedButtons.forEach((button) => {
|
|
89
89
|
expect(button).not.toHaveClass('pf-chatbot__button--response-action-clicked');
|
|
90
90
|
});
|
|
91
91
|
yield userEvent.click(badBtn);
|
|
92
|
-
expect(screen.getByRole('button', { name: '
|
|
92
|
+
expect(screen.getByRole('button', { name: 'Bad response recorded' })).toHaveClass('pf-chatbot__button--response-action-clicked');
|
|
93
93
|
unclickedButtons = buttons.filter((button) => button !== badBtn);
|
|
94
94
|
unclickedButtons.forEach((button) => {
|
|
95
95
|
expect(button).not.toHaveClass('pf-chatbot__button--response-action-clicked');
|
|
@@ -106,10 +106,10 @@ describe('ResponseActions', () => {
|
|
|
106
106
|
expect(goodBtn).toBeTruthy();
|
|
107
107
|
expect(badBtn).toBeTruthy();
|
|
108
108
|
yield userEvent.click(goodBtn);
|
|
109
|
-
expect(screen.getByRole('button', { name: '
|
|
109
|
+
expect(screen.getByRole('button', { name: 'Good response recorded' })).toHaveClass('pf-chatbot__button--response-action-clicked');
|
|
110
110
|
expect(badBtn).not.toHaveClass('pf-chatbot__button--response-action-clicked');
|
|
111
111
|
yield userEvent.click(badBtn);
|
|
112
|
-
expect(screen.getByRole('button', { name: '
|
|
112
|
+
expect(screen.getByRole('button', { name: 'Bad response recorded' })).toHaveClass('pf-chatbot__button--response-action-clicked');
|
|
113
113
|
expect(goodBtn).not.toHaveClass('pf-chatbot__button--response-action-clicked');
|
|
114
114
|
yield userEvent.click(screen.getByText("I updated your account with those settings. You're ready to set up your first dashboard!"));
|
|
115
115
|
expect(goodBtn).not.toHaveClass('pf-chatbot__button--response-action-clicked');
|
|
@@ -182,28 +182,28 @@ describe('ResponseActions', () => {
|
|
|
182
182
|
});
|
|
183
183
|
});
|
|
184
184
|
it('should be able to call onClick correctly', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
185
|
-
|
|
185
|
+
for (const { type, label } of ALL_ACTIONS) {
|
|
186
186
|
const spy = jest.fn();
|
|
187
187
|
render(_jsx(ResponseActions, { actions: { [type]: { onClick: spy } } }));
|
|
188
188
|
yield userEvent.click(screen.getByRole('button', { name: label }));
|
|
189
189
|
expect(spy).toHaveBeenCalledTimes(1);
|
|
190
|
-
}
|
|
190
|
+
}
|
|
191
191
|
}));
|
|
192
192
|
it('should swap clicked and non-clicked aria labels on click', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
193
|
-
|
|
193
|
+
for (const { type, label, clickedLabel } of ALL_ACTIONS) {
|
|
194
194
|
render(_jsx(ResponseActions, { actions: { [type]: { onClick: jest.fn() } } }));
|
|
195
195
|
expect(screen.getByRole('button', { name: label })).toBeTruthy();
|
|
196
196
|
yield userEvent.click(screen.getByRole('button', { name: label }));
|
|
197
197
|
expect(screen.getByRole('button', { name: clickedLabel })).toBeTruthy();
|
|
198
|
-
}
|
|
198
|
+
}
|
|
199
199
|
}));
|
|
200
200
|
it('should swap clicked and non-clicked tooltips on click', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
201
|
-
|
|
201
|
+
for (const { type, label, clickedLabel } of ALL_ACTIONS) {
|
|
202
202
|
render(_jsx(ResponseActions, { actions: { [type]: { onClick: jest.fn() } } }));
|
|
203
203
|
expect(screen.getByRole('button', { name: label })).toBeTruthy();
|
|
204
204
|
yield userEvent.click(screen.getByRole('button', { name: label }));
|
|
205
205
|
expect(screen.getByRole('tooltip', { name: clickedLabel })).toBeTruthy();
|
|
206
|
-
}
|
|
206
|
+
}
|
|
207
207
|
}));
|
|
208
208
|
it('should be able to change aria labels', () => {
|
|
209
209
|
const actions = [
|
|
@@ -255,4 +255,59 @@ describe('ResponseActions', () => {
|
|
|
255
255
|
expect(screen.getByTestId(action[key])).toBeTruthy();
|
|
256
256
|
});
|
|
257
257
|
});
|
|
258
|
+
// we are testing for the reverse case already above
|
|
259
|
+
it('should not deselect when clicking outside when persistActionSelection is true', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
260
|
+
render(_jsx(Message, { name: "Bot", role: "bot", avatar: "", content: "Test content", actions: {
|
|
261
|
+
positive: {},
|
|
262
|
+
negative: {}
|
|
263
|
+
}, persistActionSelection: true }));
|
|
264
|
+
const goodBtn = screen.getByRole('button', { name: 'Good response' });
|
|
265
|
+
yield userEvent.click(goodBtn);
|
|
266
|
+
expect(screen.getByRole('button', { name: 'Good response recorded' })).toHaveClass('pf-chatbot__button--response-action-clicked');
|
|
267
|
+
yield userEvent.click(screen.getByText('Test content'));
|
|
268
|
+
expect(screen.getByRole('button', { name: 'Good response recorded' })).toHaveClass('pf-chatbot__button--response-action-clicked');
|
|
269
|
+
}));
|
|
270
|
+
it('should switch selection to another button when persistActionSelection is true', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
271
|
+
render(_jsx(Message, { name: "Bot", role: "bot", avatar: "", content: "Test content", actions: {
|
|
272
|
+
positive: {},
|
|
273
|
+
negative: {}
|
|
274
|
+
}, persistActionSelection: true }));
|
|
275
|
+
const goodBtn = screen.getByRole('button', { name: 'Good response' });
|
|
276
|
+
const badBtn = screen.getByRole('button', { name: 'Bad response' });
|
|
277
|
+
yield userEvent.click(goodBtn);
|
|
278
|
+
expect(goodBtn).toHaveClass('pf-chatbot__button--response-action-clicked');
|
|
279
|
+
yield userEvent.click(badBtn);
|
|
280
|
+
expect(badBtn).toHaveClass('pf-chatbot__button--response-action-clicked');
|
|
281
|
+
expect(goodBtn).not.toHaveClass('pf-chatbot__button--response-action-clicked');
|
|
282
|
+
}));
|
|
283
|
+
it('should toggle off when clicking the same button when persistActionSelection is true', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
284
|
+
render(_jsx(Message, { name: "Bot", role: "bot", avatar: "", content: "Test content", actions: {
|
|
285
|
+
positive: {},
|
|
286
|
+
negative: {}
|
|
287
|
+
}, persistActionSelection: true }));
|
|
288
|
+
const goodBtn = screen.getByRole('button', { name: 'Good response' });
|
|
289
|
+
yield userEvent.click(goodBtn);
|
|
290
|
+
expect(goodBtn).toHaveClass('pf-chatbot__button--response-action-clicked');
|
|
291
|
+
yield userEvent.click(goodBtn);
|
|
292
|
+
expect(goodBtn).not.toHaveClass('pf-chatbot__button--response-action-clicked');
|
|
293
|
+
}));
|
|
294
|
+
it('should work with custom actions when persistActionSelection is true', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
295
|
+
const actions = {
|
|
296
|
+
positive: { 'data-testid': 'positive', onClick: jest.fn() },
|
|
297
|
+
negative: { 'data-testid': 'negative', onClick: jest.fn() },
|
|
298
|
+
custom: {
|
|
299
|
+
'data-testid': 'custom',
|
|
300
|
+
onClick: jest.fn(),
|
|
301
|
+
ariaLabel: 'Custom',
|
|
302
|
+
tooltipContent: 'Custom action',
|
|
303
|
+
icon: _jsx(DownloadIcon, {})
|
|
304
|
+
}
|
|
305
|
+
};
|
|
306
|
+
render(_jsx(ResponseActions, { actions: actions, persistActionSelection: true }));
|
|
307
|
+
const customBtn = screen.getByTestId('custom');
|
|
308
|
+
yield userEvent.click(customBtn);
|
|
309
|
+
expect(customBtn).toHaveClass('pf-chatbot__button--response-action-clicked');
|
|
310
|
+
yield userEvent.click(customBtn);
|
|
311
|
+
expect(customBtn).not.toHaveClass('pf-chatbot__button--response-action-clicked');
|
|
312
|
+
}));
|
|
258
313
|
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FunctionComponent, HTMLProps, ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* The container for grouping multiple related ResponseActions components, typically used for having different persistence states amongst groups.
|
|
4
|
+
* Use this component when passing children to Message to customize its structure.
|
|
5
|
+
*/
|
|
6
|
+
export interface ResponseActionsGroupsProps extends HTMLProps<HTMLDivElement> {
|
|
7
|
+
/** Content to render inside the response actions groups container */
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
/** Additional classes applied to the response actions groups container. */
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const ResponseActionsGroups: FunctionComponent<ResponseActionsGroupsProps>;
|
|
13
|
+
export default ResponseActionsGroups;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { css } from '@patternfly/react-styles';
|
|
14
|
+
export const ResponseActionsGroups = (_a) => {
|
|
15
|
+
var { children, className } = _a, props = __rest(_a, ["children", "className"]);
|
|
16
|
+
return (_jsx("div", Object.assign({ className: css('pf-chatbot__response-actions-groups', className) }, props, { children: children })));
|
|
17
|
+
};
|
|
18
|
+
export default ResponseActionsGroups;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import '@testing-library/jest-dom';
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
4
|
+
import ResponseActionsGroups from './ResponseActionsGroups';
|
|
5
|
+
test('Renders with children', () => {
|
|
6
|
+
render(_jsx(ResponseActionsGroups, { children: "Test content" }));
|
|
7
|
+
expect(screen.getByText('Test content')).toBeInTheDocument();
|
|
8
|
+
});
|
|
9
|
+
test('Renders with pf-chatbot__response-actions-groups class by default', () => {
|
|
10
|
+
render(_jsx(ResponseActionsGroups, { children: "Test content" }));
|
|
11
|
+
expect(screen.getByText('Test content')).toHaveClass('pf-chatbot__response-actions-groups', { exact: true });
|
|
12
|
+
});
|
|
13
|
+
test('Renders with custom className', () => {
|
|
14
|
+
render(_jsx(ResponseActionsGroups, { className: "custom-class", children: "Test content" }));
|
|
15
|
+
expect(screen.getByText('Test content')).toHaveClass('custom-class');
|
|
16
|
+
});
|
|
17
|
+
test('Spreads additional props', () => {
|
|
18
|
+
render(_jsx(ResponseActionsGroups, { id: "test-id", children: "Test content" }));
|
|
19
|
+
expect(screen.getByText('Test content')).toHaveAttribute('id', 'test-id');
|
|
20
|
+
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type FunctionComponent } from 'react';
|
|
2
2
|
import { ActionListProps, ActionListGroupProps, ActionListItemProps, ButtonProps, CardProps, CardBodyProps, CardFooterProps, ExpandableSectionProps, SpinnerProps } from '@patternfly/react-core';
|
|
3
|
+
import type { MarkdownContentProps } from '../MarkdownContent';
|
|
3
4
|
export interface ToolCallProps {
|
|
4
5
|
/** Title text for the tool call. */
|
|
5
6
|
titleText: string;
|
|
@@ -11,6 +12,8 @@ export interface ToolCallProps {
|
|
|
11
12
|
spinnerProps?: SpinnerProps;
|
|
12
13
|
/** Content to render within an expandable section. */
|
|
13
14
|
expandableContent?: React.ReactNode;
|
|
15
|
+
/** Flag indicating whether the expandable content is expanded by default. */
|
|
16
|
+
isDefaultExpanded?: boolean;
|
|
14
17
|
/** Text content for the "run" action button. */
|
|
15
18
|
runButtonText?: string;
|
|
16
19
|
/** Additional props for the "run" action button. */
|
|
@@ -39,6 +42,14 @@ export interface ToolCallProps {
|
|
|
39
42
|
cardFooterProps?: CardFooterProps;
|
|
40
43
|
/** Additional props for the expandable section when expandableContent is passed. */
|
|
41
44
|
expandableSectionProps?: Omit<ExpandableSectionProps, 'ref'>;
|
|
45
|
+
/** Whether to enable markdown rendering for titleText. When true, titleText will be parsed as markdown. */
|
|
46
|
+
isTitleMarkdown?: boolean;
|
|
47
|
+
/** Whether to enable markdown rendering for expandableContent. When true and expandableContent is a string, it will be parsed as markdown. */
|
|
48
|
+
isExpandableContentMarkdown?: boolean;
|
|
49
|
+
/** Props passed to MarkdownContent component when markdown is enabled */
|
|
50
|
+
markdownContentProps?: Omit<MarkdownContentProps, 'content'>;
|
|
51
|
+
/** Whether to retain styles in the MarkdownContent component. Defaults to false. */
|
|
52
|
+
shouldRetainStyles?: boolean;
|
|
42
53
|
}
|
|
43
54
|
export declare const ToolCall: FunctionComponent<ToolCallProps>;
|
|
44
55
|
export default ToolCall;
|
|
@@ -1,10 +1,28 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
2
3
|
import { ActionList, ActionListGroup, ActionListItem, Button, Card, CardBody, CardFooter, ExpandableSection, Spinner } from '@patternfly/react-core';
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
import MarkdownContent from '../MarkdownContent';
|
|
5
|
+
export const ToolCall = ({ titleText, loadingText, isLoading, expandableContent, isDefaultExpanded = false, runButtonText = 'Run tool', runButtonProps, runActionItemProps, cancelButtonText = 'Cancel', cancelButtonProps, cancelActionItemProps, actions, actionListProps, actionListGroupProps, actionListItemProps, cardProps, cardBodyProps, cardFooterProps, expandableSectionProps, spinnerProps, isTitleMarkdown, isExpandableContentMarkdown, markdownContentProps, shouldRetainStyles = false }) => {
|
|
6
|
+
const [isExpanded, setIsExpanded] = useState(isDefaultExpanded);
|
|
7
|
+
const onToggle = (_event, isExpanded) => {
|
|
8
|
+
setIsExpanded(isExpanded);
|
|
9
|
+
};
|
|
10
|
+
const renderTitle = () => {
|
|
11
|
+
if (isTitleMarkdown) {
|
|
12
|
+
return _jsx(MarkdownContent, Object.assign({ shouldRetainStyles: shouldRetainStyles, content: titleText }, markdownContentProps));
|
|
13
|
+
}
|
|
14
|
+
return titleText;
|
|
15
|
+
};
|
|
16
|
+
const titleContent = (_jsx("span", { className: `pf-chatbot__tool-call-title-content`, children: isLoading ? (_jsxs(_Fragment, { children: [_jsx(Spinner, Object.assign({ diameter: "1em" }, spinnerProps)), ' ', _jsx("span", { className: "pf-chatbot__tool-call-title-text", children: loadingText })] })) : (_jsx("span", { className: "pf-chatbot__tool-call-title-text", children: renderTitle() })) }));
|
|
17
|
+
const renderExpandableContent = () => {
|
|
18
|
+
if (isExpandableContentMarkdown && typeof expandableContent === 'string') {
|
|
19
|
+
return (_jsx(MarkdownContent, Object.assign({ shouldRetainStyles: shouldRetainStyles, content: expandableContent }, markdownContentProps)));
|
|
20
|
+
}
|
|
21
|
+
return expandableContent;
|
|
22
|
+
};
|
|
5
23
|
const defaultActions = (_jsxs(_Fragment, { children: [_jsx(ActionListItem, Object.assign({}, actionListItemProps, cancelActionItemProps, { children: _jsx(Button, Object.assign({ variant: "link" }, cancelButtonProps, { children: cancelButtonText })) })), _jsx(ActionListItem, Object.assign({}, actionListItemProps, runActionItemProps, { children: _jsx(Button, Object.assign({ variant: "secondary" }, runButtonProps, { children: runButtonText })) }))] }));
|
|
6
24
|
const customActions = actions &&
|
|
7
25
|
actions.map((action, index) => (_jsx(ActionListItem, Object.assign({}, actionListItemProps, { children: action }), index)));
|
|
8
|
-
return (_jsxs(Card, Object.assign({ isCompact: true, className: "pf-chatbot__tool-call" }, cardProps, { children: [_jsx(CardBody, Object.assign({ className: "pf-chatbot__tool-call-title" }, cardBodyProps, { children: expandableContent && !isLoading ? (_jsx(ExpandableSection, Object.assign({ className: "pf-chatbot__tool-call-expandable-section", toggleContent: titleContent, isIndented: true }, expandableSectionProps, { children:
|
|
26
|
+
return (_jsxs(Card, Object.assign({ isCompact: true, className: "pf-chatbot__tool-call" }, cardProps, { children: [_jsx(CardBody, Object.assign({ className: "pf-chatbot__tool-call-title" }, cardBodyProps, { children: expandableContent && !isLoading ? (_jsx(ExpandableSection, Object.assign({ className: "pf-chatbot__tool-call-expandable-section", toggleContent: titleContent, onToggle: onToggle, isExpanded: isExpanded, isIndented: true }, expandableSectionProps, { children: renderExpandableContent() }))) : (titleContent) })), !isLoading && (_jsx(CardFooter, Object.assign({}, cardFooterProps, { children: _jsx(ActionList, Object.assign({ className: "pf-chatbot__tool-call-action-list" }, actionListProps, { children: _jsx(ActionListGroup, Object.assign({}, actionListGroupProps, { children: customActions || defaultActions })) })) })))] })));
|
|
9
27
|
};
|
|
10
28
|
export default ToolCall;
|