@patternfly/chatbot 6.4.0-prerelease.2 → 6.4.0-prerelease.20
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/Chatbot/Chatbot.js +1 -7
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.d.ts +2 -0
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.js +2 -2
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.d.ts +22 -2
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +15 -9
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +40 -2
- package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.js +1 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.test.js +1 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderNewChatButton.d.ts +18 -0
- package/dist/cjs/ChatbotHeader/ChatbotHeaderNewChatButton.js +25 -0
- package/dist/cjs/ChatbotHeader/ChatbotHeaderNewChatButton.test.d.ts +1 -0
- package/dist/cjs/ChatbotHeader/ChatbotHeaderNewChatButton.test.js +22 -0
- package/dist/cjs/ChatbotHeader/index.d.ts +1 -0
- package/dist/cjs/ChatbotHeader/index.js +1 -0
- package/dist/cjs/DeepThinking/DeepThinking.d.ts +18 -0
- package/dist/cjs/DeepThinking/DeepThinking.js +18 -0
- package/dist/cjs/DeepThinking/DeepThinking.test.d.ts +1 -0
- package/dist/cjs/DeepThinking/DeepThinking.test.js +48 -0
- package/dist/cjs/DeepThinking/index.d.ts +2 -0
- package/dist/cjs/DeepThinking/index.js +23 -0
- package/dist/cjs/FilePreview/FilePreview.d.ts +26 -0
- package/dist/cjs/FilePreview/FilePreview.js +26 -0
- package/dist/cjs/FilePreview/FilePreview.test.d.ts +1 -0
- package/dist/cjs/FilePreview/FilePreview.test.js +97 -0
- package/dist/cjs/FilePreview/index.d.ts +2 -0
- package/dist/cjs/FilePreview/index.js +23 -0
- package/dist/cjs/Message/CodeBlockMessage/CodeBlockMessage.js +3 -3
- package/dist/cjs/Message/LinkMessage/LinkMessage.d.ts +2 -1
- package/dist/cjs/Message/LinkMessage/LinkMessage.js +7 -3
- package/dist/cjs/Message/ListMessage/ListItemMessage.d.ts +1 -1
- package/dist/cjs/Message/ListMessage/ListItemMessage.js +16 -1
- package/dist/cjs/Message/Message.d.ts +15 -0
- package/dist/cjs/Message/Message.js +129 -32
- package/dist/cjs/Message/Message.test.js +71 -0
- package/dist/cjs/Message/SuperscriptMessage/SuperscriptMessage.d.ts +3 -0
- package/dist/cjs/Message/SuperscriptMessage/SuperscriptMessage.js +5 -0
- package/dist/cjs/Message/UserFeedback/UserFeedback.d.ts +15 -1
- package/dist/cjs/Message/UserFeedback/UserFeedback.js +4 -4
- package/dist/cjs/Message/UserFeedback/UserFeedback.test.js +44 -0
- package/dist/cjs/MessageBar/MessageBar.js +19 -4
- package/dist/cjs/MessageBox/JumpButton.d.ts +5 -0
- package/dist/cjs/MessageBox/JumpButton.js +1 -1
- package/dist/cjs/MessageBox/JumpButton.test.js +4 -4
- package/dist/cjs/MessageBox/MessageBox.d.ts +9 -0
- package/dist/cjs/MessageBox/MessageBox.js +2 -2
- package/dist/cjs/MessageBox/MessageBox.test.js +2 -2
- package/dist/cjs/SourcesCard/SourcesCard.d.ts +13 -1
- package/dist/cjs/SourcesCard/SourcesCard.js +6 -6
- package/dist/cjs/SourcesCard/SourcesCard.test.js +49 -0
- package/dist/cjs/ToolResponse/ToolResponse.d.ts +30 -0
- package/dist/cjs/ToolResponse/ToolResponse.js +18 -0
- package/dist/cjs/ToolResponse/ToolResponse.test.d.ts +1 -0
- package/dist/cjs/ToolResponse/ToolResponse.test.js +60 -0
- package/dist/cjs/ToolResponse/index.d.ts +2 -0
- package/dist/cjs/ToolResponse/index.js +23 -0
- package/dist/cjs/index.d.ts +6 -0
- package/dist/cjs/index.js +10 -1
- package/dist/css/main.css +273 -17
- package/dist/css/main.css.map +1 -1
- package/dist/dynamic/DeepThinking/package.json +1 -0
- package/dist/dynamic/FilePreview/package.json +1 -0
- package/dist/dynamic/ToolResponse/package.json +1 -0
- package/dist/esm/Chatbot/Chatbot.js +1 -7
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.d.ts +2 -0
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.js +2 -2
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.d.ts +22 -2
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +17 -11
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +41 -3
- package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.js +1 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.test.js +1 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderNewChatButton.d.ts +18 -0
- package/dist/esm/ChatbotHeader/ChatbotHeaderNewChatButton.js +22 -0
- package/dist/esm/ChatbotHeader/ChatbotHeaderNewChatButton.test.d.ts +1 -0
- package/dist/esm/ChatbotHeader/ChatbotHeaderNewChatButton.test.js +20 -0
- package/dist/esm/ChatbotHeader/index.d.ts +1 -0
- package/dist/esm/ChatbotHeader/index.js +1 -0
- package/dist/esm/DeepThinking/DeepThinking.d.ts +18 -0
- package/dist/esm/DeepThinking/DeepThinking.js +14 -0
- package/dist/esm/DeepThinking/DeepThinking.test.d.ts +1 -0
- package/dist/esm/DeepThinking/DeepThinking.test.js +43 -0
- package/dist/esm/DeepThinking/index.d.ts +2 -0
- package/dist/esm/DeepThinking/index.js +2 -0
- package/dist/esm/FilePreview/FilePreview.d.ts +26 -0
- package/dist/esm/FilePreview/FilePreview.js +21 -0
- package/dist/esm/FilePreview/FilePreview.test.d.ts +1 -0
- package/dist/esm/FilePreview/FilePreview.test.js +92 -0
- package/dist/esm/FilePreview/index.d.ts +2 -0
- package/dist/esm/FilePreview/index.js +2 -0
- package/dist/esm/Message/CodeBlockMessage/CodeBlockMessage.js +5 -5
- package/dist/esm/Message/LinkMessage/LinkMessage.d.ts +2 -1
- package/dist/esm/Message/LinkMessage/LinkMessage.js +7 -3
- package/dist/esm/Message/ListMessage/ListItemMessage.d.ts +1 -1
- package/dist/esm/Message/ListMessage/ListItemMessage.js +16 -1
- package/dist/esm/Message/Message.d.ts +15 -0
- package/dist/esm/Message/Message.js +129 -32
- package/dist/esm/Message/Message.test.js +71 -0
- package/dist/esm/Message/SuperscriptMessage/SuperscriptMessage.d.ts +3 -0
- package/dist/esm/Message/SuperscriptMessage/SuperscriptMessage.js +3 -0
- package/dist/esm/Message/UserFeedback/UserFeedback.d.ts +15 -1
- package/dist/esm/Message/UserFeedback/UserFeedback.js +4 -4
- package/dist/esm/Message/UserFeedback/UserFeedback.test.js +45 -1
- package/dist/esm/MessageBar/MessageBar.js +19 -4
- package/dist/esm/MessageBox/JumpButton.d.ts +5 -0
- package/dist/esm/MessageBox/JumpButton.js +1 -1
- package/dist/esm/MessageBox/JumpButton.test.js +4 -4
- package/dist/esm/MessageBox/MessageBox.d.ts +9 -0
- package/dist/esm/MessageBox/MessageBox.js +2 -2
- package/dist/esm/MessageBox/MessageBox.test.js +2 -2
- package/dist/esm/SourcesCard/SourcesCard.d.ts +13 -1
- package/dist/esm/SourcesCard/SourcesCard.js +6 -6
- package/dist/esm/SourcesCard/SourcesCard.test.js +50 -1
- package/dist/esm/ToolResponse/ToolResponse.d.ts +30 -0
- package/dist/esm/ToolResponse/ToolResponse.js +14 -0
- package/dist/esm/ToolResponse/ToolResponse.test.d.ts +1 -0
- package/dist/esm/ToolResponse/ToolResponse.test.js +55 -0
- package/dist/esm/ToolResponse/index.d.ts +2 -0
- package/dist/esm/ToolResponse/index.js +2 -0
- package/dist/esm/index.d.ts +6 -0
- package/dist/esm/index.js +6 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -6
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/BotMessage.tsx +101 -3
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/FilePreview.tsx +33 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithDeepThinking.tsx +17 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithFeedback.tsx +111 -85
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithSources.tsx +70 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithToolResponse.tsx +135 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/Messages.md +28 -4
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/UserMessage.tsx +107 -2
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/UserMessageWithExtraContent.tsx +616 -3
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotConversationEditing.tsx +202 -0
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderBasic.tsx +17 -3
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawer.tsx +36 -5
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerWithPin.tsx +12 -2
- package/patternfly-docs/content/extensions/chatbot/examples/UI/UI.md +22 -3
- package/patternfly-docs/content/extensions/chatbot/examples/demos/Chatbot.md +1 -1
- package/patternfly-docs/patternfly-docs.config.js +1 -1
- package/src/Chatbot/Chatbot.scss +9 -2
- package/src/Chatbot/Chatbot.tsx +18 -31
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.tsx +5 -1
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.scss +28 -10
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.tsx +132 -3
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.tsx +80 -33
- package/src/ChatbotHeader/ChatbotHeaderMenu.test.tsx +1 -1
- package/src/ChatbotHeader/ChatbotHeaderMenu.tsx +2 -2
- package/src/ChatbotHeader/ChatbotHeaderNewChatButton.test.tsx +25 -0
- package/src/ChatbotHeader/ChatbotHeaderNewChatButton.tsx +64 -0
- package/src/ChatbotHeader/index.ts +1 -0
- package/src/ChatbotModal/ChatbotModal.scss +1 -1
- package/src/DeepThinking/DeepThinking.scss +24 -0
- package/src/DeepThinking/DeepThinking.test.tsx +61 -0
- package/src/DeepThinking/DeepThinking.tsx +68 -0
- package/src/DeepThinking/index.ts +3 -0
- package/src/FileDetails/__snapshots__/FileDetails.test.tsx.snap +6 -9
- package/src/FileDetailsLabel/__snapshots__/FileDetailsLabel.test.tsx.snap +6 -9
- package/src/FilePreview/FilePreview.scss +22 -0
- package/src/FilePreview/FilePreview.test.tsx +112 -0
- package/src/FilePreview/FilePreview.tsx +58 -0
- package/src/FilePreview/index.ts +3 -0
- package/src/Message/CodeBlockMessage/CodeBlockMessage.scss +2 -1
- package/src/Message/CodeBlockMessage/CodeBlockMessage.tsx +6 -5
- package/src/Message/LinkMessage/LinkMessage.tsx +6 -2
- package/src/Message/ListMessage/ListItemMessage.tsx +5 -1
- package/src/Message/ListMessage/ListMessage.scss +17 -0
- package/src/Message/Message.scss +44 -0
- package/src/Message/Message.test.tsx +90 -0
- package/src/Message/Message.tsx +171 -46
- package/src/Message/SuperscriptMessage/SuperscriptMessage.scss +8 -0
- package/src/Message/SuperscriptMessage/SuperscriptMessage.tsx +13 -0
- package/src/Message/TextMessage/TextMessage.scss +46 -5
- package/src/Message/UserFeedback/UserFeedback.test.tsx +107 -0
- package/src/Message/UserFeedback/UserFeedback.tsx +41 -6
- package/src/MessageBar/MessageBar.tsx +23 -3
- package/src/MessageBox/JumpButton.test.tsx +4 -4
- package/src/MessageBox/JumpButton.tsx +20 -4
- package/src/MessageBox/MessageBox.test.tsx +2 -2
- package/src/MessageBox/MessageBox.tsx +22 -1
- package/src/SourcesCard/SourcesCard.scss +17 -0
- package/src/SourcesCard/SourcesCard.test.tsx +93 -0
- package/src/SourcesCard/SourcesCard.tsx +116 -80
- package/src/ToolResponse/ToolResponse.scss +36 -0
- package/src/ToolResponse/ToolResponse.test.tsx +78 -0
- package/src/ToolResponse/ToolResponse.tsx +95 -0
- package/src/ToolResponse/index.ts +3 -0
- package/src/index.ts +9 -0
- package/src/main.scss +3 -0
|
@@ -134,4 +134,48 @@ describe('UserFeedback', () => {
|
|
|
134
134
|
(0, react_1.render)((0, jsx_runtime_1.jsx)(UserFeedback_1.default, { timestamp: "12/12/12", onClose: jest.fn, onSubmit: jest.fn, quickResponses: MOCK_RESPONSES, "data-testid": "card", isCompact: true }));
|
|
135
135
|
expect(react_1.screen.getByTestId('card')).toHaveClass('pf-m-compact');
|
|
136
136
|
});
|
|
137
|
+
it('should pass buttonProps to submit button', () => {
|
|
138
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(UserFeedback_1.default, { timestamp: "12/12/12", onClose: jest.fn, onSubmit: jest.fn, quickResponses: MOCK_RESPONSES, submitButtonProps: { variant: 'secondary', isDisabled: true } }));
|
|
139
|
+
const submitButton = react_1.screen.getByRole('button', { name: /Submit/i });
|
|
140
|
+
expect(submitButton).toHaveClass('pf-v6-c-button pf-m-secondary');
|
|
141
|
+
expect(submitButton).toBeDisabled();
|
|
142
|
+
});
|
|
143
|
+
it('should pass cardHeaderProps to card header', () => {
|
|
144
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(UserFeedback_1.default, { timestamp: "12/12/12", onClose: jest.fn, onSubmit: jest.fn, quickResponses: MOCK_RESPONSES, cardHeaderProps: { 'data-testid': 'card-header', className: 'custom-header' } }));
|
|
145
|
+
const cardHeader = react_1.screen.getByTestId('card-header');
|
|
146
|
+
expect(cardHeader).toHaveClass('custom-header');
|
|
147
|
+
});
|
|
148
|
+
it('should pass cardBodyProps to card body', () => {
|
|
149
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(UserFeedback_1.default, { timestamp: "12/12/12", onClose: jest.fn, onSubmit: jest.fn, quickResponses: MOCK_RESPONSES, cardBodyProps: { 'data-testid': 'card-body', className: 'custom-body' } }));
|
|
150
|
+
const cardBody = react_1.screen.getByTestId('card-body');
|
|
151
|
+
expect(cardBody).toHaveClass('custom-body');
|
|
152
|
+
});
|
|
153
|
+
it('should pass headingLevelProps to title heading', () => {
|
|
154
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(UserFeedback_1.default, { timestamp: "12/12/12", onClose: jest.fn, onSubmit: jest.fn, quickResponses: MOCK_RESPONSES, headingLevelProps: { className: 'custom-heading', id: 'feedback-title' } }));
|
|
155
|
+
const heading = react_1.screen.getByRole('heading', { level: 1, name: /Why did you choose this rating?/i });
|
|
156
|
+
expect(heading).toHaveClass('custom-heading');
|
|
157
|
+
expect(heading).toHaveAttribute('id', 'feedback-title');
|
|
158
|
+
});
|
|
159
|
+
it('should pass formProps to form', () => {
|
|
160
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(UserFeedback_1.default, { timestamp: "12/12/12", onClose: jest.fn, onSubmit: jest.fn, quickResponses: MOCK_RESPONSES, formProps: { 'data-testid': 'feedback-form', className: 'custom-form' } }));
|
|
161
|
+
const form = react_1.screen.getByTestId('feedback-form');
|
|
162
|
+
expect(form).toHaveClass('custom-form');
|
|
163
|
+
});
|
|
164
|
+
it('should pass textAreaProps to text area when hasTextArea is true', () => {
|
|
165
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(UserFeedback_1.default, { timestamp: "12/12/12", onClose: jest.fn, onSubmit: jest.fn, quickResponses: MOCK_RESPONSES, hasTextArea: true, textAreaProps: { 'data-testid': 'custom-textarea', rows: 5 } }));
|
|
166
|
+
const textArea = react_1.screen.getByTestId('custom-textarea');
|
|
167
|
+
expect(textArea).toHaveAttribute('rows', '5');
|
|
168
|
+
expect(textArea).toHaveAttribute('data-testid', 'custom-textarea');
|
|
169
|
+
});
|
|
170
|
+
it('should pass actionGroupProps to action group', () => {
|
|
171
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(UserFeedback_1.default, { timestamp: "12/12/12", onClose: jest.fn, onSubmit: jest.fn, quickResponses: MOCK_RESPONSES, actionGroupProps: { 'data-testid': 'action-group', className: 'custom-actions' } }));
|
|
172
|
+
const actionGroup = react_1.screen.getByTestId('action-group');
|
|
173
|
+
expect(actionGroup).toHaveClass('custom-actions');
|
|
174
|
+
});
|
|
175
|
+
it('should render children', () => {
|
|
176
|
+
(0, react_1.render)((0, jsx_runtime_1.jsxs)(UserFeedback_1.default, { timestamp: "12/12/12", onClose: jest.fn, onSubmit: jest.fn, quickResponses: MOCK_RESPONSES, children: [(0, jsx_runtime_1.jsx)("div", { "data-testid": "custom-content", children: "Custom feedback content" }), (0, jsx_runtime_1.jsx)("p", { children: "Additional paragraph" })] }));
|
|
177
|
+
expect(react_1.screen.getByTestId('custom-content')).toBeInTheDocument();
|
|
178
|
+
expect(react_1.screen.getByText('Custom feedback content')).toBeInTheDocument();
|
|
179
|
+
expect(react_1.screen.getByText('Additional paragraph')).toBeInTheDocument();
|
|
180
|
+
});
|
|
137
181
|
});
|
|
@@ -32,6 +32,7 @@ const MessageBarBase = (_a) => {
|
|
|
32
32
|
const [message, setMessage] = (0, react_1.useState)(value !== null && value !== void 0 ? value : '');
|
|
33
33
|
const [isListeningMessage, setIsListeningMessage] = (0, react_1.useState)(false);
|
|
34
34
|
const [hasSentMessage, setHasSentMessage] = (0, react_1.useState)(false);
|
|
35
|
+
const [isComposing, setIsComposing] = (0, react_1.useState)(false);
|
|
35
36
|
const inputRef = (0, react_1.useRef)(null);
|
|
36
37
|
const textareaRef = (_b = innerRef) !== null && _b !== void 0 ? _b : inputRef;
|
|
37
38
|
const attachButtonRef = (0, react_1.useRef)(null);
|
|
@@ -157,18 +158,32 @@ const MessageBarBase = (_a) => {
|
|
|
157
158
|
setMessage('');
|
|
158
159
|
}, [onSendMessage]);
|
|
159
160
|
const handleKeyDown = (0, react_1.useCallback)((event) => {
|
|
160
|
-
|
|
161
|
+
// Japanese and other languages may use IME for character input.
|
|
162
|
+
// In these cases, enter is used to select the final input, so we need to check for composition end instead.
|
|
163
|
+
// See more info at https://www.stum.de/2016/06/24/handling-ime-events-in-javascript/
|
|
164
|
+
// Chrome, Edge, and Firefox seem to work well with just the compose event.
|
|
165
|
+
// Safari is a little bit special. We need to handle 229 as well in this case.
|
|
166
|
+
const nativeEvent = event.nativeEvent;
|
|
167
|
+
const isCompositionKey = nativeEvent.which === 229;
|
|
168
|
+
const isCurrentlyComposing = isComposing || isCompositionKey;
|
|
169
|
+
if (event.key === 'Enter' && !isCurrentlyComposing && !event.shiftKey) {
|
|
161
170
|
event.preventDefault();
|
|
162
171
|
if (!isSendButtonDisabled && !hasStopButton) {
|
|
163
172
|
handleSend(message);
|
|
164
173
|
}
|
|
165
174
|
}
|
|
166
|
-
if (event.key === 'Enter' && event.shiftKey) {
|
|
175
|
+
if (event.key === 'Enter' && !isCurrentlyComposing && event.shiftKey) {
|
|
167
176
|
if (textareaRef.current) {
|
|
168
177
|
handleNewLine(textareaRef.current);
|
|
169
178
|
}
|
|
170
179
|
}
|
|
171
|
-
}, [isSendButtonDisabled, hasStopButton, handleSend, message]);
|
|
180
|
+
}, [isSendButtonDisabled, hasStopButton, handleSend, message, isComposing]);
|
|
181
|
+
const handleCompositionStart = (0, react_1.useCallback)(() => {
|
|
182
|
+
setIsComposing(true);
|
|
183
|
+
}, []);
|
|
184
|
+
const handleCompositionEnd = (0, react_1.useCallback)(() => {
|
|
185
|
+
setIsComposing(false);
|
|
186
|
+
}, []);
|
|
172
187
|
const handleAttachMenuToggle = () => {
|
|
173
188
|
(attachMenuProps === null || attachMenuProps === void 0 ? void 0 : attachMenuProps.setIsAttachMenuOpen) && (attachMenuProps === null || attachMenuProps === void 0 ? void 0 : attachMenuProps.setIsAttachMenuOpen(!(attachMenuProps === null || attachMenuProps === void 0 ? void 0 : attachMenuProps.isAttachMenuOpen)));
|
|
174
189
|
attachMenuProps === null || attachMenuProps === void 0 ? void 0 : attachMenuProps.onAttachMenuToggleClick();
|
|
@@ -184,7 +199,7 @@ const MessageBarBase = (_a) => {
|
|
|
184
199
|
}
|
|
185
200
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [attachMenuProps && ((0, jsx_runtime_1.jsx)(AttachButton_1.AttachButton, Object.assign({ ref: attachButtonRef, onClick: handleAttachMenuToggle, isDisabled: isListeningMessage, tooltipContent: (_d = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _d === void 0 ? void 0 : _d.tooltipContent, isCompact: isCompact, tooltipProps: (_e = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _e === void 0 ? void 0 : _e.tooltipProps, allowedFileTypes: allowedFileTypes, minSize: minSize, maxSize: maxSize, maxFiles: maxFiles, isAttachmentDisabled: isAttachmentDisabled, onAttach: onAttach, onAttachRejected: onAttachRejected, validator: validator, dropzoneProps: dropzoneProps }, (_f = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _f === void 0 ? void 0 : _f.props))), !attachMenuProps && hasAttachButton && ((0, jsx_runtime_1.jsx)(AttachButton_1.AttachButton, Object.assign({ onAttachAccepted: handleAttach, isDisabled: isListeningMessage, tooltipContent: (_g = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _g === void 0 ? void 0 : _g.tooltipContent, inputTestId: (_h = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _h === void 0 ? void 0 : _h.inputTestId, isCompact: isCompact, tooltipProps: (_j = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _j === void 0 ? void 0 : _j.tooltipProps, allowedFileTypes: allowedFileTypes, minSize: minSize, maxSize: maxSize, maxFiles: maxFiles, isAttachmentDisabled: isAttachmentDisabled, onAttach: onAttach, onAttachRejected: onAttachRejected, validator: validator, dropzoneProps: dropzoneProps }, (_k = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _k === void 0 ? void 0 : _k.props))), hasMicrophoneButton && ((0, jsx_runtime_1.jsx)(MicrophoneButton_1.default, Object.assign({ isListening: isListeningMessage, onIsListeningChange: setIsListeningMessage, onSpeechRecognition: handleSpeechRecognition, tooltipContent: (_l = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.microphone) === null || _l === void 0 ? void 0 : _l.tooltipContent, language: (_m = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.microphone) === null || _m === void 0 ? void 0 : _m.language, isCompact: isCompact, tooltipProps: (_o = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.microphone) === null || _o === void 0 ? void 0 : _o.tooltipProps }, (_p = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.microphone) === null || _p === void 0 ? void 0 : _p.props))), (alwayShowSendButton || message) && ((0, jsx_runtime_1.jsx)(SendButton_1.default, Object.assign({ value: message, onClick: () => handleSend(message), isDisabled: isSendButtonDisabled, tooltipContent: (_q = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.send) === null || _q === void 0 ? void 0 : _q.tooltipContent, isCompact: isCompact, tooltipProps: (_r = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.send) === null || _r === void 0 ? void 0 : _r.tooltipProps }, (_s = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.send) === null || _s === void 0 ? void 0 : _s.props)))] }));
|
|
186
201
|
};
|
|
187
|
-
const messageBarContents = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: `pf-chatbot__message-bar-input ${isCompact ? 'pf-m-compact' : ''}`, children: (0, jsx_runtime_1.jsx)(react_core_1.TextArea, Object.assign({ className: "pf-chatbot__message-textarea", value: message, onChange: handleChange, "aria-label": isListeningMessage ? listeningText : placeholder, placeholder: isListeningMessage ? listeningText : placeholder, ref: textareaRef, onKeyDown: handleKeyDown }, props)) }), (0, jsx_runtime_1.jsx)("div", { className: "pf-chatbot__message-bar-actions", children: renderButtons() })] }));
|
|
202
|
+
const messageBarContents = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: `pf-chatbot__message-bar-input ${isCompact ? 'pf-m-compact' : ''}`, children: (0, jsx_runtime_1.jsx)(react_core_1.TextArea, Object.assign({ className: "pf-chatbot__message-textarea", value: message, onChange: handleChange, "aria-label": isListeningMessage ? listeningText : placeholder, placeholder: isListeningMessage ? listeningText : placeholder, ref: textareaRef, onKeyDown: handleKeyDown, onCompositionStart: handleCompositionStart, onCompositionEnd: handleCompositionEnd }, props)) }), (0, jsx_runtime_1.jsx)("div", { className: "pf-chatbot__message-bar-actions", children: renderButtons() })] }));
|
|
188
203
|
if (attachMenuProps) {
|
|
189
204
|
return ((0, jsx_runtime_1.jsx)(AttachMenu_1.default, Object.assign({ toggle: (toggleRef) => ((0, jsx_runtime_1.jsx)("div", { ref: toggleRef, className: `pf-chatbot__message-bar ${className !== null && className !== void 0 ? className : ''}`, children: messageBarContents })), filteredItems: attachMenuProps === null || attachMenuProps === void 0 ? void 0 : attachMenuProps.attachMenuItems }, (attachMenuProps && { isOpen: attachMenuProps.isAttachMenuOpen }), { onOpenChange: (isAttachMenuOpen) => {
|
|
190
205
|
var _a;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { FunctionComponent } from 'react';
|
|
2
|
+
import { TooltipProps, ButtonProps } from '@patternfly/react-core';
|
|
2
3
|
export interface JumpButtonProps {
|
|
3
4
|
/** Position of the Jump Button(top/bottom) */
|
|
4
5
|
position: 'top' | 'bottom';
|
|
@@ -6,6 +7,10 @@ export interface JumpButtonProps {
|
|
|
6
7
|
onClick: () => void;
|
|
7
8
|
/** Flag to change the visibilty of the button */
|
|
8
9
|
isHidden?: boolean;
|
|
10
|
+
/** Additional props passed to jump buttons */
|
|
11
|
+
jumpButtonProps?: ButtonProps;
|
|
12
|
+
/** Additional props passed to tooltip */
|
|
13
|
+
jumpButtonTooltipProps?: TooltipProps;
|
|
9
14
|
}
|
|
10
15
|
declare const JumpButton: FunctionComponent<JumpButtonProps>;
|
|
11
16
|
export default JumpButton;
|
|
@@ -5,5 +5,5 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const react_core_1 = require("@patternfly/react-core");
|
|
6
6
|
const arrow_up_icon_1 = require("@patternfly/react-icons/dist/esm/icons/arrow-up-icon");
|
|
7
7
|
const arrow_down_icon_1 = require("@patternfly/react-icons/dist/esm/icons/arrow-down-icon");
|
|
8
|
-
const JumpButton = ({ position, isHidden, onClick }) => isHidden ? null : ((0, jsx_runtime_1.jsx)(react_core_1.Tooltip, { id: `pf-chatbot__tooltip--jump-${position}`, content: `Back to ${position}`, position: "top", children: (0, jsx_runtime_1.jsx)(react_core_1.Button, { variant: "plain", className: `pf-chatbot__jump pf-chatbot__jump--${position}`, "aria-label": `
|
|
8
|
+
const JumpButton = ({ position, isHidden, onClick, jumpButtonProps, jumpButtonTooltipProps }) => isHidden ? null : ((0, jsx_runtime_1.jsx)(react_core_1.Tooltip, Object.assign({ id: `pf-chatbot__tooltip--jump-${position}`, content: `Back to ${position}`, position: "top" }, jumpButtonTooltipProps, { children: (0, jsx_runtime_1.jsx)(react_core_1.Button, Object.assign({ variant: "plain", className: `pf-chatbot__jump pf-chatbot__jump--${position}`, "aria-label": `Back to ${position}`, onClick: onClick }, jumpButtonProps, { children: (0, jsx_runtime_1.jsx)(react_core_1.Icon, { iconSize: "lg", isInline: true, children: position === 'top' ? (0, jsx_runtime_1.jsx)(arrow_up_icon_1.ArrowUpIcon, {}) : (0, jsx_runtime_1.jsx)(arrow_down_icon_1.ArrowDownIcon, {}) }) })) })));
|
|
9
9
|
exports.default = JumpButton;
|
|
@@ -20,20 +20,20 @@ const user_event_1 = __importDefault(require("@testing-library/user-event"));
|
|
|
20
20
|
describe('JumpButton', () => {
|
|
21
21
|
it('should render top button correctly', () => {
|
|
22
22
|
(0, react_1.render)((0, jsx_runtime_1.jsx)(JumpButton_1.default, { position: "top", onClick: jest.fn() }));
|
|
23
|
-
expect(react_1.screen.getByRole('button', { name: /
|
|
23
|
+
expect(react_1.screen.getByRole('button', { name: /Back to top/i })).toBeTruthy();
|
|
24
24
|
});
|
|
25
25
|
it('should render bottom button correctly', () => {
|
|
26
26
|
(0, react_1.render)((0, jsx_runtime_1.jsx)(JumpButton_1.default, { position: "bottom", onClick: jest.fn() }));
|
|
27
|
-
expect(react_1.screen.getByRole('button', { name: /
|
|
27
|
+
expect(react_1.screen.getByRole('button', { name: /Back to bottom/i })).toBeTruthy();
|
|
28
28
|
});
|
|
29
29
|
it('should call onClick appropriately', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
30
30
|
const spy = jest.fn();
|
|
31
31
|
(0, react_1.render)((0, jsx_runtime_1.jsx)(JumpButton_1.default, { position: "bottom", onClick: spy }));
|
|
32
|
-
yield user_event_1.default.click(react_1.screen.getByRole('button', { name: /
|
|
32
|
+
yield user_event_1.default.click(react_1.screen.getByRole('button', { name: /Back to bottom/i }));
|
|
33
33
|
expect(spy).toHaveBeenCalledTimes(1);
|
|
34
34
|
}));
|
|
35
35
|
it('should be hidden if isHidden prop is used', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
36
36
|
(0, react_1.render)((0, jsx_runtime_1.jsx)(JumpButton_1.default, { position: "bottom", onClick: jest.fn(), isHidden: true }));
|
|
37
|
-
expect(react_1.screen.queryByRole('button', { name: /
|
|
37
|
+
expect(react_1.screen.queryByRole('button', { name: /Back to bottom/i })).toBeFalsy();
|
|
38
38
|
}));
|
|
39
39
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { HTMLProps, ReactNode } from 'react';
|
|
2
|
+
import { ButtonProps, TooltipProps } from '@patternfly/react-core';
|
|
2
3
|
export interface MessageBoxProps extends HTMLProps<HTMLDivElement> {
|
|
3
4
|
/** Content that can be announced, such as a new message, for screen readers */
|
|
4
5
|
announcement?: string;
|
|
@@ -18,6 +19,14 @@ export interface MessageBoxProps extends HTMLProps<HTMLDivElement> {
|
|
|
18
19
|
onScrollToBottomClick?: () => void;
|
|
19
20
|
/** Flag to enable automatic scrolling when new messages are added */
|
|
20
21
|
enableSmartScroll?: boolean;
|
|
22
|
+
/** Props passed to top jump button */
|
|
23
|
+
jumpButtonTopProps?: ButtonProps;
|
|
24
|
+
/** Props passed to bottom jump button */
|
|
25
|
+
jumpButtonBottomProps?: ButtonProps;
|
|
26
|
+
/** Props passed to top jump button tooltip */
|
|
27
|
+
jumpButtonTopTooltipProps?: TooltipProps;
|
|
28
|
+
/** Props passed to top jump button tooltip */
|
|
29
|
+
jumpButtonBottomTooltipProps?: TooltipProps;
|
|
21
30
|
}
|
|
22
31
|
export interface MessageBoxHandle extends HTMLDivElement {
|
|
23
32
|
/** Scrolls to the top of the message box */
|
|
@@ -22,7 +22,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
22
22
|
const react_1 = require("react");
|
|
23
23
|
const JumpButton_1 = __importDefault(require("./JumpButton"));
|
|
24
24
|
exports.MessageBox = (0, react_1.forwardRef)((_a, ref) => {
|
|
25
|
-
var { announcement, ariaLabel = 'Scrollable message log', children, className, position = 'top', onScrollToTopClick, onScrollToBottomClick, enableSmartScroll = false } = _a, props = __rest(_a, ["announcement", "ariaLabel", "children", "className", "position", "onScrollToTopClick", "onScrollToBottomClick", "enableSmartScroll"]);
|
|
25
|
+
var { announcement, ariaLabel = 'Scrollable message log', children, className, position = 'top', onScrollToTopClick, onScrollToBottomClick, enableSmartScroll = false, jumpButtonTopProps, jumpButtonBottomProps, jumpButtonBottomTooltipProps, jumpButtonTopTooltipProps } = _a, props = __rest(_a, ["announcement", "ariaLabel", "children", "className", "position", "onScrollToTopClick", "onScrollToBottomClick", "enableSmartScroll", "jumpButtonTopProps", "jumpButtonBottomProps", "jumpButtonBottomTooltipProps", "jumpButtonTopTooltipProps"]);
|
|
26
26
|
const [atTop, setAtTop] = (0, react_1.useState)(false);
|
|
27
27
|
const [atBottom, setAtBottom] = (0, react_1.useState)(true);
|
|
28
28
|
const [isOverflowing, setIsOverflowing] = (0, react_1.useState)(false);
|
|
@@ -206,6 +206,6 @@ exports.MessageBox = (0, react_1.forwardRef)((_a, ref) => {
|
|
|
206
206
|
onTouchMove,
|
|
207
207
|
onTouchEnd
|
|
208
208
|
};
|
|
209
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(JumpButton_1.default, { position: "top", isHidden: isOverflowing && atTop, onClick: scrollToTop }), (0, jsx_runtime_1.jsxs)("div", Object.assign({ role: "region", tabIndex: 0, "aria-label": ariaLabel, className: `pf-chatbot__messagebox ${position === 'bottom' ? 'pf-chatbot__messagebox--bottom' : ''} ${className !== null && className !== void 0 ? className : ''}`, ref: messageBoxRef }, props, (enableSmartScroll ? Object.assign({}, smartScrollHandlers) : {}), { children: [children, (0, jsx_runtime_1.jsx)("div", { className: "pf-chatbot__messagebox-announcement", "aria-live": "polite", children: announcement })] })), (0, jsx_runtime_1.jsx)(JumpButton_1.default, { position: "bottom", isHidden: isOverflowing && atBottom, onClick: () => scrollToBottom({ resumeSmartScroll: true }) })] }));
|
|
209
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(JumpButton_1.default, { position: "top", isHidden: isOverflowing && atTop, onClick: scrollToTop, jumpButtonProps: jumpButtonTopProps, jumpButtonTooltipProps: jumpButtonTopTooltipProps }), (0, jsx_runtime_1.jsxs)("div", Object.assign({ role: "region", tabIndex: 0, "aria-label": ariaLabel, className: `pf-chatbot__messagebox ${position === 'bottom' ? 'pf-chatbot__messagebox--bottom' : ''} ${className !== null && className !== void 0 ? className : ''}`, ref: messageBoxRef }, props, (enableSmartScroll ? Object.assign({}, smartScrollHandlers) : {}), { children: [children, (0, jsx_runtime_1.jsx)("div", { className: "pf-chatbot__messagebox-announcement", "aria-live": "polite", children: announcement })] })), (0, jsx_runtime_1.jsx)(JumpButton_1.default, { position: "bottom", isHidden: isOverflowing && atBottom, onClick: () => scrollToBottom({ resumeSmartScroll: true }), jumpButtonProps: jumpButtonBottomProps, jumpButtonTooltipProps: jumpButtonBottomTooltipProps })] }));
|
|
210
210
|
});
|
|
211
211
|
exports.default = exports.MessageBox;
|
|
@@ -56,7 +56,7 @@ describe('MessageBox', () => {
|
|
|
56
56
|
region.dispatchEvent(new Event('scroll'));
|
|
57
57
|
});
|
|
58
58
|
yield (0, react_2.waitFor)(() => {
|
|
59
|
-
user_event_1.default.click(react_2.screen.getByRole('button', { name: /
|
|
59
|
+
user_event_1.default.click(react_2.screen.getByRole('button', { name: /Back to bottom/i }));
|
|
60
60
|
expect(spy).toHaveBeenCalled();
|
|
61
61
|
});
|
|
62
62
|
}));
|
|
@@ -75,7 +75,7 @@ describe('MessageBox', () => {
|
|
|
75
75
|
region.dispatchEvent(new Event('scroll'));
|
|
76
76
|
});
|
|
77
77
|
yield (0, react_2.waitFor)(() => {
|
|
78
|
-
user_event_1.default.click(react_2.screen.getByRole('button', { name: /
|
|
78
|
+
user_event_1.default.click(react_2.screen.getByRole('button', { name: /Back to top/i }));
|
|
79
79
|
expect(spy).toHaveBeenCalled();
|
|
80
80
|
});
|
|
81
81
|
}));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { FunctionComponent } from 'react';
|
|
2
|
-
import { ButtonProps, CardProps } from '@patternfly/react-core';
|
|
2
|
+
import { ButtonProps, CardBodyProps, CardFooterProps, CardProps, CardTitleProps, TruncateProps } from '@patternfly/react-core';
|
|
3
3
|
export interface SourcesCardProps extends CardProps {
|
|
4
4
|
/** Additional classes for the pagination navigation container. */
|
|
5
5
|
className?: string;
|
|
@@ -13,6 +13,8 @@ export interface SourcesCardProps extends CardProps {
|
|
|
13
13
|
sources: {
|
|
14
14
|
/** Title of sources card */
|
|
15
15
|
title?: string;
|
|
16
|
+
/** Subtitle of sources card */
|
|
17
|
+
subtitle?: string;
|
|
16
18
|
/** Link to source */
|
|
17
19
|
link: string;
|
|
18
20
|
/** Body of sources card */
|
|
@@ -25,6 +27,10 @@ export interface SourcesCardProps extends CardProps {
|
|
|
25
27
|
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
26
28
|
/** Any additional props applied to the title of the Sources card */
|
|
27
29
|
titleProps?: ButtonProps;
|
|
30
|
+
/** Custom footer applied to the Sources card */
|
|
31
|
+
footer?: React.ReactNode;
|
|
32
|
+
/** Additional props passed to Truncate component */
|
|
33
|
+
truncateProps?: TruncateProps;
|
|
28
34
|
}[];
|
|
29
35
|
/** Label for the English word "source" */
|
|
30
36
|
sourceWord?: string;
|
|
@@ -44,6 +50,12 @@ export interface SourcesCardProps extends CardProps {
|
|
|
44
50
|
showMoreWords?: string;
|
|
45
51
|
/** Label for English words "show less" */
|
|
46
52
|
showLessWords?: string;
|
|
53
|
+
/** Additional props passed to card title */
|
|
54
|
+
cardTitleProps?: CardTitleProps;
|
|
55
|
+
/** Additional props passed to card body */
|
|
56
|
+
cardBodyProps?: CardBodyProps;
|
|
57
|
+
/** Additional props passed to card footer */
|
|
58
|
+
cardFooterProps?: CardFooterProps;
|
|
47
59
|
}
|
|
48
60
|
declare const SourcesCard: FunctionComponent<SourcesCardProps>;
|
|
49
61
|
export default SourcesCard;
|
|
@@ -18,7 +18,7 @@ const react_core_1 = require("@patternfly/react-core");
|
|
|
18
18
|
const react_icons_1 = require("@patternfly/react-icons");
|
|
19
19
|
const SourcesCard = (_a) => {
|
|
20
20
|
var _b;
|
|
21
|
-
var { className, isDisabled, paginationAriaLabel = 'Pagination', sources, sourceWord = 'source', sourceWordPlural = 'sources', toNextPageAriaLabel = 'Go to next page', toPreviousPageAriaLabel = 'Go to previous page', onNextClick, onPreviousClick, onSetPage, showMoreWords = 'show more', showLessWords = 'show less', isCompact } = _a, props = __rest(_a, ["className", "isDisabled", "paginationAriaLabel", "sources", "sourceWord", "sourceWordPlural", "toNextPageAriaLabel", "toPreviousPageAriaLabel", "onNextClick", "onPreviousClick", "onSetPage", "showMoreWords", "showLessWords", "isCompact"]);
|
|
21
|
+
var { className, isDisabled, paginationAriaLabel = 'Pagination', sources, sourceWord = 'source', sourceWordPlural = 'sources', toNextPageAriaLabel = 'Go to next page', toPreviousPageAriaLabel = 'Go to previous page', onNextClick, onPreviousClick, onSetPage, showMoreWords = 'show more', showLessWords = 'show less', isCompact, cardTitleProps, cardBodyProps, cardFooterProps } = _a, props = __rest(_a, ["className", "isDisabled", "paginationAriaLabel", "sources", "sourceWord", "sourceWordPlural", "toNextPageAriaLabel", "toPreviousPageAriaLabel", "onNextClick", "onPreviousClick", "onSetPage", "showMoreWords", "showLessWords", "isCompact", "cardTitleProps", "cardBodyProps", "cardFooterProps"]);
|
|
22
22
|
const [page, setPage] = (0, react_1.useState)(1);
|
|
23
23
|
const [isExpanded, setIsExpanded] = (0, react_1.useState)(false);
|
|
24
24
|
const onToggle = (_event, isExpanded) => {
|
|
@@ -28,15 +28,15 @@ const SourcesCard = (_a) => {
|
|
|
28
28
|
setPage(newPage);
|
|
29
29
|
onSetPage && onSetPage(_evt, newPage);
|
|
30
30
|
};
|
|
31
|
-
const renderTitle = (title) => {
|
|
31
|
+
const renderTitle = (title, truncateProps) => {
|
|
32
32
|
if (title) {
|
|
33
|
-
return (0, jsx_runtime_1.jsx)(react_core_1.Truncate, { content: title });
|
|
33
|
+
return (0, jsx_runtime_1.jsx)(react_core_1.Truncate, Object.assign({ content: title }, truncateProps));
|
|
34
34
|
}
|
|
35
35
|
return `Source ${page}`;
|
|
36
36
|
};
|
|
37
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: "pf-chatbot__source", children: [(0, jsx_runtime_1.jsx)("span", { children: (0, react_core_1.pluralize)(sources.length, sourceWord, sourceWordPlural) }), (0, jsx_runtime_1.jsxs)(react_core_1.Card, Object.assign({ isCompact: isCompact, className: "pf-chatbot__sources-card" }, props, { children: [(0, jsx_runtime_1.jsx)(react_core_1.CardTitle, { className: "pf-chatbot__sources-card-title", children: (0, jsx_runtime_1.jsx)(react_core_1.Button, Object.assign({ component: "a", variant: react_core_1.ButtonVariant.link, href: sources[page - 1].link, icon: sources[page - 1].isExternal ? (0, jsx_runtime_1.jsx)(react_icons_1.ExternalLinkSquareAltIcon, {}) : undefined, iconPosition: "end", isInline: true, rel: sources[page - 1].isExternal ? 'noreferrer' : undefined, target: sources[page - 1].isExternal ? '_blank' : undefined, onClick: (_b = sources[page - 1].onClick) !== null && _b !== void 0 ? _b : undefined }, sources[page - 1].titleProps, { children: renderTitle(sources[page - 1].title) })) }), sources[page - 1].body && ((0, jsx_runtime_1.jsx)(react_core_1.CardBody, { className: `pf-chatbot__sources-card-body
|
|
37
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "pf-chatbot__source", children: [(0, jsx_runtime_1.jsx)("span", { children: (0, react_core_1.pluralize)(sources.length, sourceWord, sourceWordPlural) }), (0, jsx_runtime_1.jsxs)(react_core_1.Card, Object.assign({ isCompact: isCompact, className: "pf-chatbot__sources-card" }, props, { children: [(0, jsx_runtime_1.jsx)(react_core_1.CardTitle, Object.assign({ className: "pf-chatbot__sources-card-title" }, cardTitleProps, { children: (0, jsx_runtime_1.jsxs)("div", { className: "pf-chatbot__sources-card-title-container", children: [(0, jsx_runtime_1.jsx)(react_core_1.Button, Object.assign({ component: "a", variant: react_core_1.ButtonVariant.link, href: sources[page - 1].link, icon: sources[page - 1].isExternal ? (0, jsx_runtime_1.jsx)(react_icons_1.ExternalLinkSquareAltIcon, {}) : undefined, iconPosition: "end", isInline: true, rel: sources[page - 1].isExternal ? 'noreferrer' : undefined, target: sources[page - 1].isExternal ? '_blank' : undefined, onClick: (_b = sources[page - 1].onClick) !== null && _b !== void 0 ? _b : undefined }, sources[page - 1].titleProps, { children: renderTitle(sources[page - 1].title, sources[page - 1].truncateProps) })), sources[page - 1].subtitle && ((0, jsx_runtime_1.jsx)("span", { className: "pf-chatbot__sources-card-subtitle", children: sources[page - 1].subtitle }))] }) })), sources[page - 1].body && ((0, jsx_runtime_1.jsx)(react_core_1.CardBody, Object.assign({ className: `pf-chatbot__sources-card-body ${sources[page - 1].footer ? 'pf-chatbot__compact-sources-card-body' : undefined}` }, cardBodyProps, { children: sources[page - 1].hasShowMore ? (
|
|
38
38
|
// prevents extra VO announcements of button text - parent Message has aria-live
|
|
39
|
-
(0, jsx_runtime_1.jsx)("div", { "aria-live": "off", children: (0, jsx_runtime_1.jsx)(react_core_1.ExpandableSection, { variant: react_core_1.ExpandableSectionVariant.truncate, toggleText: isExpanded ? showLessWords : showMoreWords, onToggle: onToggle, isExpanded: isExpanded, truncateMaxLines: 2, children: sources[page - 1].body }) })) : ((0, jsx_runtime_1.jsx)("div", { className: "pf-chatbot__sources-card-body-text", children: sources[page - 1].body })) })), sources.length > 1 && ((0, jsx_runtime_1.jsx)(react_core_1.CardFooter, { className: "pf-chatbot__sources-card-footer-container", children: (0, jsx_runtime_1.jsx)("div", { className: "pf-chatbot__sources-card-footer", children: (0, jsx_runtime_1.jsxs)("nav", { className: `pf-chatbot__sources-card-footer-buttons ${className}`, "aria-label": paginationAriaLabel, children: [(0, jsx_runtime_1.jsx)(react_core_1.Button, { variant: react_core_1.ButtonVariant.plain, isDisabled: isDisabled || page === 1, "data-action": "previous", onClick: (event) => {
|
|
39
|
+
(0, jsx_runtime_1.jsx)("div", { "aria-live": "off", children: (0, jsx_runtime_1.jsx)(react_core_1.ExpandableSection, { variant: react_core_1.ExpandableSectionVariant.truncate, toggleText: isExpanded ? showLessWords : showMoreWords, onToggle: onToggle, isExpanded: isExpanded, truncateMaxLines: 2, children: sources[page - 1].body }) })) : ((0, jsx_runtime_1.jsx)("div", { className: "pf-chatbot__sources-card-body-text", children: sources[page - 1].body })) }))), sources[page - 1].footer ? ((0, jsx_runtime_1.jsx)(react_core_1.CardFooter, Object.assign({ className: "pf-chatbot__sources-card-footer" }, cardFooterProps, { children: sources[page - 1].footer }))) : (sources.length > 1 && ((0, jsx_runtime_1.jsx)(react_core_1.CardFooter, Object.assign({ className: "pf-chatbot__sources-card-footer-container" }, cardFooterProps, { children: (0, jsx_runtime_1.jsx)("div", { className: "pf-chatbot__sources-card-footer", children: (0, jsx_runtime_1.jsxs)("nav", { className: `pf-chatbot__sources-card-footer-buttons ${className}`, "aria-label": paginationAriaLabel, children: [(0, jsx_runtime_1.jsx)(react_core_1.Button, { variant: react_core_1.ButtonVariant.plain, isDisabled: isDisabled || page === 1, "data-action": "previous", onClick: (event) => {
|
|
40
40
|
const newPage = page >= 1 ? page - 1 : 1;
|
|
41
41
|
onPreviousClick && onPreviousClick(event, newPage);
|
|
42
42
|
handleNewPage(event, newPage);
|
|
@@ -44,6 +44,6 @@ const SourcesCard = (_a) => {
|
|
|
44
44
|
const newPage = page + 1 <= sources.length ? page + 1 : sources.length;
|
|
45
45
|
onNextClick && onNextClick(event, newPage);
|
|
46
46
|
handleNewPage(event, newPage);
|
|
47
|
-
}, children: (0, jsx_runtime_1.jsx)(react_core_1.Icon, { isInline: true, iconSize: "lg", children: (0, jsx_runtime_1.jsx)("svg", { className: "pf-v6-svg", viewBox: "0 0 180 500", fill: "currentColor", "aria-hidden": "true", role: "img", width: "1em", height: "1em", children: (0, jsx_runtime_1.jsx)("path", { d: "M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34z" }) }) }) })] }) }) }))] }))] }));
|
|
47
|
+
}, children: (0, jsx_runtime_1.jsx)(react_core_1.Icon, { isInline: true, iconSize: "lg", children: (0, jsx_runtime_1.jsx)("svg", { className: "pf-v6-svg", viewBox: "0 0 180 500", fill: "currentColor", "aria-hidden": "true", role: "img", width: "1em", height: "1em", children: (0, jsx_runtime_1.jsx)("path", { d: "M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34z" }) }) }) })] }) }) }))))] }))] }));
|
|
48
48
|
};
|
|
49
49
|
exports.default = SourcesCard;
|
|
@@ -184,4 +184,53 @@ describe('SourcesCard', () => {
|
|
|
184
184
|
(0, react_1.render)((0, jsx_runtime_1.jsx)(SourcesCard_1.default, { sources: [{ title: 'How to make an apple pie', link: '', titleProps: { className: 'test' } }] }));
|
|
185
185
|
expect(react_1.screen.getByRole('link', { name: /How to make an apple pie/i })).toHaveClass('test');
|
|
186
186
|
});
|
|
187
|
+
it('should apply cardTitleProps appropriately', () => {
|
|
188
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(SourcesCard_1.default, { cardTitleProps: { 'data-testid': 'card-title', className: 'test' }, sources: [{ title: 'How to make an apple pie', link: '' }] }));
|
|
189
|
+
expect(react_1.screen.getByTestId('card-title')).toHaveClass('test');
|
|
190
|
+
});
|
|
191
|
+
it('should apply cardBodyProps appropriately', () => {
|
|
192
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(SourcesCard_1.default, { cardBodyProps: { 'data-testid': 'card-body', body: 'To make an apple pie, you must first...', className: 'test' }, sources: [{ title: 'How to make an apple pie', link: '', body: 'To make an apple pie, you must first...' }] }));
|
|
193
|
+
expect(react_1.screen.getByTestId('card-body')).toHaveClass('test');
|
|
194
|
+
});
|
|
195
|
+
it('should apply cardFooterProps appropriately', () => {
|
|
196
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(SourcesCard_1.default, { cardFooterProps: { 'data-testid': 'card-footer', className: 'test' }, sources: [
|
|
197
|
+
{ title: 'How to make an apple pie', link: '' },
|
|
198
|
+
{ title: 'How to make cookies', link: '' }
|
|
199
|
+
] }));
|
|
200
|
+
expect(react_1.screen.getByTestId('card-footer')).toHaveClass('test');
|
|
201
|
+
});
|
|
202
|
+
it('should apply truncateProps appropriately', () => {
|
|
203
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(SourcesCard_1.default, { sources: [
|
|
204
|
+
{
|
|
205
|
+
title: 'How to make an apple pie',
|
|
206
|
+
link: '',
|
|
207
|
+
truncateProps: { 'data-testid': 'card-truncate', className: 'test' }
|
|
208
|
+
}
|
|
209
|
+
] }));
|
|
210
|
+
expect(react_1.screen.getByTestId('card-truncate')).toHaveClass('test');
|
|
211
|
+
});
|
|
212
|
+
it('should apply custom footer appropriately when there is one source', () => {
|
|
213
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(SourcesCard_1.default, { sources: [{ title: 'How to make an apple pie', link: '', footer: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: "I am a custom footer" }) }] }));
|
|
214
|
+
expect(react_1.screen.getByText('I am a custom footer'));
|
|
215
|
+
expect(react_1.screen.queryByText('1/1')).toBeFalsy();
|
|
216
|
+
});
|
|
217
|
+
it('should apply custom footer appropriately when are multiple sources', () => {
|
|
218
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(SourcesCard_1.default, { sources: [
|
|
219
|
+
{ title: 'How to make an apple pie', link: '', footer: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: "I am a custom footer" }) },
|
|
220
|
+
{ title: 'How to bake bread', link: '' }
|
|
221
|
+
] }));
|
|
222
|
+
expect(react_1.screen.getByText('I am a custom footer'));
|
|
223
|
+
// does not show navigation bar
|
|
224
|
+
expect(react_1.screen.queryByText('1/2')).toBeFalsy();
|
|
225
|
+
});
|
|
226
|
+
it('should apply footer props to custom footer appropriately', () => {
|
|
227
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(SourcesCard_1.default, { cardFooterProps: { 'data-testid': 'card-footer', className: 'test' }, sources: [{ title: 'How to make an apple pie', link: '', footer: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: "I am a custom footer" }) }] }));
|
|
228
|
+
expect(react_1.screen.getByText('I am a custom footer'));
|
|
229
|
+
expect(react_1.screen.getByTestId('card-footer')).toHaveClass('test');
|
|
230
|
+
});
|
|
231
|
+
it('should apply subtitle appropriately', () => {
|
|
232
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(SourcesCard_1.default, { sources: [{ title: 'How to make an apple pie', link: '', subtitle: 'You must first create the universe' }] }));
|
|
233
|
+
expect(react_1.screen.getByText('How to make an apple pie'));
|
|
234
|
+
expect(react_1.screen.getByText('You must first create the universe'));
|
|
235
|
+
});
|
|
187
236
|
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { CardBodyProps, CardProps, CardTitleProps, DividerProps, ExpandableSectionProps } from '@patternfly/react-core';
|
|
2
|
+
import { type FunctionComponent } from 'react';
|
|
3
|
+
export interface ToolResponseProps {
|
|
4
|
+
/** Toggle content shown for expandable section */
|
|
5
|
+
toggleContent: React.ReactNode;
|
|
6
|
+
/** Additional props passed to expandable section */
|
|
7
|
+
expandableSectionProps?: Omit<ExpandableSectionProps, 'ref'>;
|
|
8
|
+
/** Subheading rendered inside expandable section */
|
|
9
|
+
subheading?: string;
|
|
10
|
+
/** Body text rendered inside expandable section */
|
|
11
|
+
body?: React.ReactNode | string;
|
|
12
|
+
/** Content passed into tool response card body */
|
|
13
|
+
cardBody: React.ReactNode;
|
|
14
|
+
/** Content passed into tool response card title */
|
|
15
|
+
cardTitle: React.ReactNode;
|
|
16
|
+
/** Additional props passed to main card */
|
|
17
|
+
cardProps?: CardProps;
|
|
18
|
+
/** Additional props passed to main card body */
|
|
19
|
+
cardBodyProps?: CardBodyProps;
|
|
20
|
+
/** Additional props passed to tool response card */
|
|
21
|
+
toolResponseCardProps?: CardProps;
|
|
22
|
+
/** Additional props passed to tool response card body */
|
|
23
|
+
toolResponseCardBodyProps?: CardBodyProps;
|
|
24
|
+
/** Additional props passed to tool response card divider */
|
|
25
|
+
toolResponseCardDividerProps?: DividerProps;
|
|
26
|
+
/** Additional props passed to tool response card title */
|
|
27
|
+
toolResponseCardTitleProps?: CardTitleProps;
|
|
28
|
+
}
|
|
29
|
+
export declare const ToolResponse: FunctionComponent<ToolResponseProps>;
|
|
30
|
+
export default ToolResponse;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ToolResponse = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
// ============================================================================
|
|
6
|
+
// Tool Response Card
|
|
7
|
+
// ============================================================================
|
|
8
|
+
const react_core_1 = require("@patternfly/react-core");
|
|
9
|
+
const react_1 = require("react");
|
|
10
|
+
const ToolResponse = ({ body, cardProps, expandableSectionProps, subheading, cardBody, cardTitle, cardBodyProps, toggleContent, toolResponseCardBodyProps, toolResponseCardDividerProps, toolResponseCardProps, toolResponseCardTitleProps }) => {
|
|
11
|
+
const [isExpanded, setIsExpanded] = (0, react_1.useState)(true);
|
|
12
|
+
const onToggle = (_event, isExpanded) => {
|
|
13
|
+
setIsExpanded(isExpanded);
|
|
14
|
+
};
|
|
15
|
+
return ((0, jsx_runtime_1.jsx)(react_core_1.Card, Object.assign({ isCompact: true, className: "pf-chatbot__tool-response" }, cardProps, { children: (0, jsx_runtime_1.jsx)(react_core_1.CardBody, Object.assign({}, cardBodyProps, { children: (0, jsx_runtime_1.jsx)(react_core_1.ExpandableSection, Object.assign({ toggleContent: toggleContent, onToggle: onToggle, isExpanded: isExpanded, isIndented: true, className: "pf-chatbot__tool-response-expandable-section" }, expandableSectionProps, { children: (0, jsx_runtime_1.jsxs)("div", { className: "pf-chatbot__tool-response-section", children: [subheading && ((0, jsx_runtime_1.jsx)("div", { className: "pf-chatbot__tool-response-subheading", children: (0, jsx_runtime_1.jsx)("span", { children: subheading }) })), body && (0, jsx_runtime_1.jsx)("div", { className: "pf-chatbot__tool-response-body", children: body }), (0, jsx_runtime_1.jsxs)(react_core_1.Card, Object.assign({ isCompact: true, className: "pf-chatbot__tool-response-card" }, toolResponseCardProps, { children: [(0, jsx_runtime_1.jsx)(react_core_1.CardTitle, Object.assign({}, toolResponseCardTitleProps, { children: cardTitle })), (0, jsx_runtime_1.jsx)(react_core_1.Divider, Object.assign({}, toolResponseCardDividerProps)), (0, jsx_runtime_1.jsx)(react_core_1.CardBody, Object.assign({}, toolResponseCardBodyProps, { children: cardBody }))] }))] }) })) })) })));
|
|
16
|
+
};
|
|
17
|
+
exports.ToolResponse = ToolResponse;
|
|
18
|
+
exports.default = exports.ToolResponse;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const react_1 = require("@testing-library/react");
|
|
8
|
+
require("@testing-library/jest-dom");
|
|
9
|
+
const ToolResponse_1 = __importDefault(require("./ToolResponse"));
|
|
10
|
+
describe('ToolResponse', () => {
|
|
11
|
+
const defaultProps = {
|
|
12
|
+
toggleContent: 'Tool response: toolName',
|
|
13
|
+
cardTitle: 'Title',
|
|
14
|
+
cardBody: 'Body'
|
|
15
|
+
};
|
|
16
|
+
it('should render with required props only', () => {
|
|
17
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(ToolResponse_1.default, Object.assign({}, defaultProps)));
|
|
18
|
+
expect(react_1.screen.getByText('Title')).toBeTruthy();
|
|
19
|
+
expect(react_1.screen.getByText('Body')).toBeTruthy();
|
|
20
|
+
expect(react_1.screen.getByText('Tool response: toolName')).toBeTruthy();
|
|
21
|
+
});
|
|
22
|
+
it('should render subheading when provided', () => {
|
|
23
|
+
const subheading = 'Tool execution result';
|
|
24
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(ToolResponse_1.default, Object.assign({}, defaultProps, { subheading: subheading })));
|
|
25
|
+
expect(react_1.screen.getByText(subheading)).toBeTruthy();
|
|
26
|
+
});
|
|
27
|
+
it('should render body content when provided', () => {
|
|
28
|
+
const body = 'This is the tool response body content';
|
|
29
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(ToolResponse_1.default, Object.assign({}, defaultProps, { body: body })));
|
|
30
|
+
expect(react_1.screen.getByText(body)).toBeTruthy();
|
|
31
|
+
});
|
|
32
|
+
it('should render with complex content including React elements', () => {
|
|
33
|
+
const body = ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("p", { children: "Complex body content" }), (0, jsx_runtime_1.jsxs)("ul", { children: [(0, jsx_runtime_1.jsx)("li", { children: "Item 1" }), (0, jsx_runtime_1.jsx)("li", { children: "Item 2" })] })] }));
|
|
34
|
+
const cardTitle = (0, jsx_runtime_1.jsx)("strong", { children: "API Response" });
|
|
35
|
+
const cardBody = ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)("code", { children: "{ status: 'success' }" }) }));
|
|
36
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(ToolResponse_1.default, Object.assign({}, defaultProps, { body: body, cardTitle: cardTitle, cardBody: cardBody })));
|
|
37
|
+
expect(react_1.screen.getByText('Complex body content')).toBeTruthy();
|
|
38
|
+
expect(react_1.screen.getByText('Item 1')).toBeTruthy();
|
|
39
|
+
expect(react_1.screen.getByText('Item 2')).toBeTruthy();
|
|
40
|
+
expect(react_1.screen.getByText('API Response')).toBeTruthy();
|
|
41
|
+
expect(react_1.screen.getByText("{ status: 'success' }")).toBeTruthy();
|
|
42
|
+
});
|
|
43
|
+
it('should apply custom className from cardProps', () => {
|
|
44
|
+
const { container } = (0, react_1.render)((0, jsx_runtime_1.jsx)(ToolResponse_1.default, Object.assign({}, defaultProps, { cardProps: { className: 'custom-tool-response-class' } })));
|
|
45
|
+
expect(container.querySelector('.custom-tool-response-class')).toBeTruthy();
|
|
46
|
+
});
|
|
47
|
+
it('should pass through expandableSectionProps', () => {
|
|
48
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(ToolResponse_1.default, Object.assign({}, defaultProps, { expandableSectionProps: { className: 'custom-expandable-class' } })));
|
|
49
|
+
expect(document.querySelector('.custom-expandable-class')).toBeTruthy();
|
|
50
|
+
});
|
|
51
|
+
it('should pass through toolResponseCardProps', () => {
|
|
52
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(ToolResponse_1.default, Object.assign({}, defaultProps, { toolResponseCardProps: { className: 'custom-card-class' } })));
|
|
53
|
+
expect(document.querySelector('.custom-card-class')).toBeTruthy();
|
|
54
|
+
});
|
|
55
|
+
it('should not render subheading span when subheading is not provided', () => {
|
|
56
|
+
const { container } = (0, react_1.render)((0, jsx_runtime_1.jsx)(ToolResponse_1.default, Object.assign({}, defaultProps)));
|
|
57
|
+
const subheadingContainer = container.querySelector('.pf-chatbot__tool-response-subheading');
|
|
58
|
+
expect(subheadingContainer).toBeFalsy();
|
|
59
|
+
});
|
|
60
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.default = void 0;
|
|
21
|
+
var ToolResponse_1 = require("./ToolResponse");
|
|
22
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(ToolResponse_1).default; } });
|
|
23
|
+
__exportStar(require("./ToolResponse"), exports);
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -26,12 +26,16 @@ export { default as CodeModal } from './CodeModal';
|
|
|
26
26
|
export * from './CodeModal';
|
|
27
27
|
export { default as Compare } from './Compare';
|
|
28
28
|
export * from './Compare';
|
|
29
|
+
export { default as DeepThinking } from './DeepThinking';
|
|
30
|
+
export * from './DeepThinking';
|
|
29
31
|
export { default as FileDetails } from './FileDetails';
|
|
30
32
|
export * from './FileDetails';
|
|
31
33
|
export { default as FileDetailsLabel } from './FileDetailsLabel';
|
|
32
34
|
export * from './FileDetailsLabel';
|
|
33
35
|
export { default as FileDropZone } from './FileDropZone';
|
|
34
36
|
export * from './FileDropZone';
|
|
37
|
+
export { default as FilePreview } from './FilePreview';
|
|
38
|
+
export * from './FilePreview';
|
|
35
39
|
export { default as LoadingMessage } from './LoadingMessage';
|
|
36
40
|
export * from './LoadingMessage';
|
|
37
41
|
export { default as Message } from './Message';
|
|
@@ -54,5 +58,7 @@ export { default as SourcesCard } from './SourcesCard';
|
|
|
54
58
|
export * from './SourcesCard';
|
|
55
59
|
export { default as TermsOfUse } from './TermsOfUse';
|
|
56
60
|
export * from './TermsOfUse';
|
|
61
|
+
export { default as ToolResponse } from './ToolResponse';
|
|
62
|
+
export * from './ToolResponse';
|
|
57
63
|
export { default as tracking } from './tracking';
|
|
58
64
|
export * from './tracking';
|
package/dist/cjs/index.js
CHANGED
|
@@ -18,7 +18,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
18
18
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
19
|
};
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.tracking = exports.TermsOfUse = exports.SourcesCard = exports.SourceDetailsMenuItem = exports.Settings = exports.ResponseActions = exports.PreviewAttachment = exports.MessageDivider = exports.MessageBox = exports.MessageBar = exports.Message = exports.LoadingMessage = exports.FileDropZone = exports.FileDetailsLabel = exports.FileDetails = exports.Compare = exports.CodeModal = exports.ChatbotWelcomePrompt = exports.ChatbotToggle = exports.ChatbotPopover = exports.ChatbotModal = exports.ChatbotHeader = exports.ChatbotFooter = exports.ChatbotConversationHistoryNav = exports.ChatbotContent = exports.ChatbotAlert = exports.Chatbot = exports.AttachMenu = exports.AttachmentEdit = void 0;
|
|
21
|
+
exports.tracking = exports.ToolResponse = exports.TermsOfUse = exports.SourcesCard = exports.SourceDetailsMenuItem = exports.Settings = exports.ResponseActions = exports.PreviewAttachment = exports.MessageDivider = exports.MessageBox = exports.MessageBar = exports.Message = exports.LoadingMessage = exports.FilePreview = exports.FileDropZone = exports.FileDetailsLabel = exports.FileDetails = exports.DeepThinking = exports.Compare = exports.CodeModal = exports.ChatbotWelcomePrompt = exports.ChatbotToggle = exports.ChatbotPopover = exports.ChatbotModal = exports.ChatbotHeader = exports.ChatbotFooter = exports.ChatbotConversationHistoryNav = exports.ChatbotContent = exports.ChatbotAlert = exports.Chatbot = exports.AttachMenu = exports.AttachmentEdit = void 0;
|
|
22
22
|
var AttachmentEdit_1 = require("./AttachmentEdit");
|
|
23
23
|
Object.defineProperty(exports, "AttachmentEdit", { enumerable: true, get: function () { return __importDefault(AttachmentEdit_1).default; } });
|
|
24
24
|
__exportStar(require("./AttachmentEdit"), exports);
|
|
@@ -61,6 +61,9 @@ __exportStar(require("./CodeModal"), exports);
|
|
|
61
61
|
var Compare_1 = require("./Compare");
|
|
62
62
|
Object.defineProperty(exports, "Compare", { enumerable: true, get: function () { return __importDefault(Compare_1).default; } });
|
|
63
63
|
__exportStar(require("./Compare"), exports);
|
|
64
|
+
var DeepThinking_1 = require("./DeepThinking");
|
|
65
|
+
Object.defineProperty(exports, "DeepThinking", { enumerable: true, get: function () { return __importDefault(DeepThinking_1).default; } });
|
|
66
|
+
__exportStar(require("./DeepThinking"), exports);
|
|
64
67
|
var FileDetails_1 = require("./FileDetails");
|
|
65
68
|
Object.defineProperty(exports, "FileDetails", { enumerable: true, get: function () { return __importDefault(FileDetails_1).default; } });
|
|
66
69
|
__exportStar(require("./FileDetails"), exports);
|
|
@@ -70,6 +73,9 @@ __exportStar(require("./FileDetailsLabel"), exports);
|
|
|
70
73
|
var FileDropZone_1 = require("./FileDropZone");
|
|
71
74
|
Object.defineProperty(exports, "FileDropZone", { enumerable: true, get: function () { return __importDefault(FileDropZone_1).default; } });
|
|
72
75
|
__exportStar(require("./FileDropZone"), exports);
|
|
76
|
+
var FilePreview_1 = require("./FilePreview");
|
|
77
|
+
Object.defineProperty(exports, "FilePreview", { enumerable: true, get: function () { return __importDefault(FilePreview_1).default; } });
|
|
78
|
+
__exportStar(require("./FilePreview"), exports);
|
|
73
79
|
var LoadingMessage_1 = require("./LoadingMessage");
|
|
74
80
|
Object.defineProperty(exports, "LoadingMessage", { enumerable: true, get: function () { return __importDefault(LoadingMessage_1).default; } });
|
|
75
81
|
__exportStar(require("./LoadingMessage"), exports);
|
|
@@ -103,6 +109,9 @@ __exportStar(require("./SourcesCard"), exports);
|
|
|
103
109
|
var TermsOfUse_1 = require("./TermsOfUse");
|
|
104
110
|
Object.defineProperty(exports, "TermsOfUse", { enumerable: true, get: function () { return __importDefault(TermsOfUse_1).default; } });
|
|
105
111
|
__exportStar(require("./TermsOfUse"), exports);
|
|
112
|
+
var ToolResponse_1 = require("./ToolResponse");
|
|
113
|
+
Object.defineProperty(exports, "ToolResponse", { enumerable: true, get: function () { return __importDefault(ToolResponse_1).default; } });
|
|
114
|
+
__exportStar(require("./ToolResponse"), exports);
|
|
106
115
|
var tracking_1 = require("./tracking");
|
|
107
116
|
Object.defineProperty(exports, "tracking", { enumerable: true, get: function () { return __importDefault(tracking_1).default; } });
|
|
108
117
|
__exportStar(require("./tracking"), exports);
|