@patternfly/chatbot 6.5.0-prerelease.26 → 6.5.0-prerelease.28
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/MarkdownContent/MarkdownContent.d.ts +7 -2
- 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/Message.d.ts +2 -0
- package/dist/cjs/Message/Message.js +5 -5
- 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/UserFeedback/UserFeedback.d.ts +1 -1
- package/dist/cjs/Message/UserFeedback/UserFeedback.js +3 -1
- 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/ResponseActions/ResponseActions.d.ts +4 -0
- 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/css/main.css +2 -0
- package/dist/css/main.css.map +1 -1
- package/dist/esm/MarkdownContent/MarkdownContent.d.ts +7 -2
- 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/Message.d.ts +2 -0
- package/dist/esm/Message/Message.js +5 -5
- 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/UserFeedback/UserFeedback.d.ts +1 -1
- package/dist/esm/Message/UserFeedback/UserFeedback.js +1 -1
- 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/ResponseActions/ResponseActions.d.ts +4 -0
- 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/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithCustomStructure.tsx +102 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/Messages.md +55 -10
- package/src/MarkdownContent/MarkdownContent.tsx +7 -2
- package/src/Message/CodeBlockMessage/CodeBlockMessage.scss +1 -0
- package/src/Message/ErrorMessage/ErrorMessage.test.tsx +38 -0
- package/src/Message/ErrorMessage/ErrorMessage.tsx +17 -2
- package/src/Message/Message.tsx +75 -64
- 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.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/UserFeedback/UserFeedback.tsx +1 -1
- 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/ResponseActions/ResponseActions.tsx +6 -0
- package/src/ResponseActions/ResponseActionsGroups.test.tsx +23 -0
- package/src/ResponseActions/ResponseActionsGroups.tsx +28 -0
- package/src/ResponseActions/index.ts +1 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FunctionComponent, HTMLProps, ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* The container that wraps the primary message content and inline actions, such as ToolCall, ToolResponse, DeepThinking, ResponseActions, etc.
|
|
4
|
+
* Attachments should not be rendered inside this container.
|
|
5
|
+
* Use this component when passing children to Message to customize its structure.
|
|
6
|
+
*/
|
|
7
|
+
export interface MessageAndActionsProps extends HTMLProps<HTMLDivElement> {
|
|
8
|
+
/** Content to render inside the message and actions container. */
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
/** Additional classes applied to the message and actions container. */
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const MessageAndActions: FunctionComponent<MessageAndActionsProps>;
|
|
14
|
+
export default MessageAndActions;
|
|
@@ -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 MessageAndActions = (_a) => {
|
|
15
|
+
var { children, className } = _a, props = __rest(_a, ["children", "className"]);
|
|
16
|
+
return (_jsx("div", Object.assign({ className: css('pf-chatbot__message-and-actions', className) }, props, { children: children })));
|
|
17
|
+
};
|
|
18
|
+
export default MessageAndActions;
|
|
@@ -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 MessageAndActions from './MessageAndActions';
|
|
5
|
+
test('Renders with children', () => {
|
|
6
|
+
render(_jsx(MessageAndActions, { children: "Test content" }));
|
|
7
|
+
expect(screen.getByText('Test content')).toBeInTheDocument();
|
|
8
|
+
});
|
|
9
|
+
test('Renders with pf-chatbot__message-and-actions class by default', () => {
|
|
10
|
+
render(_jsx(MessageAndActions, { children: "Test content" }));
|
|
11
|
+
expect(screen.getByText('Test content')).toHaveClass('pf-chatbot__message-and-actions', { exact: true });
|
|
12
|
+
});
|
|
13
|
+
test('Renders with custom className', () => {
|
|
14
|
+
render(_jsx(MessageAndActions, { className: "custom-class", children: "Test content" }));
|
|
15
|
+
expect(screen.getByText('Test content')).toHaveClass('custom-class');
|
|
16
|
+
});
|
|
17
|
+
test('Spreads additional props', () => {
|
|
18
|
+
render(_jsx(MessageAndActions, { id: "test-id", children: "Test content" }));
|
|
19
|
+
expect(screen.getByText('Test content')).toHaveAttribute('id', 'test-id');
|
|
20
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './MessageAndActions';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './MessageAndActions';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FunctionComponent, HTMLProps, ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* The container for a single message attachment item, typically the FileDetailsLabel component. You must wrap any attachment components in this container.
|
|
4
|
+
* Use this component within MessageAttachmentsContainer when passing children to Message to customize its structure.
|
|
5
|
+
*/
|
|
6
|
+
export interface MessageAttachmentItemProps extends HTMLProps<HTMLDivElement> {
|
|
7
|
+
/** Content to render inside a single attachment container */
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
/** Additional classes applied to the attachment container. */
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const MessageAttachmentItem: FunctionComponent<MessageAttachmentItemProps>;
|
|
13
|
+
export default MessageAttachmentItem;
|
|
@@ -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 MessageAttachmentItem = (_a) => {
|
|
15
|
+
var { children, className } = _a, props = __rest(_a, ["children", "className"]);
|
|
16
|
+
return (_jsx("div", Object.assign({ className: css('pf-chatbot__message-attachment', className) }, props, { children: children })));
|
|
17
|
+
};
|
|
18
|
+
export default MessageAttachmentItem;
|
|
@@ -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 MessageAttachmentItem from './MessageAttachmentItem';
|
|
5
|
+
test('Renders with children', () => {
|
|
6
|
+
render(_jsx(MessageAttachmentItem, { children: "Test content" }));
|
|
7
|
+
expect(screen.getByText('Test content')).toBeInTheDocument();
|
|
8
|
+
});
|
|
9
|
+
test('Renders with pf-chatbot__message-attachment class by default', () => {
|
|
10
|
+
render(_jsx(MessageAttachmentItem, { children: "Test content" }));
|
|
11
|
+
expect(screen.getByText('Test content')).toHaveClass('pf-chatbot__message-attachment', { exact: true });
|
|
12
|
+
});
|
|
13
|
+
test('Renders with custom className', () => {
|
|
14
|
+
render(_jsx(MessageAttachmentItem, { className: "custom-class", children: "Test content" }));
|
|
15
|
+
expect(screen.getByText('Test content')).toHaveClass('custom-class');
|
|
16
|
+
});
|
|
17
|
+
test('Spreads additional props', () => {
|
|
18
|
+
render(_jsx(MessageAttachmentItem, { id: "test-id", children: "Test content" }));
|
|
19
|
+
expect(screen.getByText('Test content')).toHaveAttribute('id', 'test-id');
|
|
20
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FunctionComponent, HTMLProps, ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* The container to wrap MessageAttachment components. You must wrap any MessageAttachment components in this container.
|
|
4
|
+
* Use this component when passing children to Message to customize its structure.
|
|
5
|
+
*/
|
|
6
|
+
export interface MessageAttachmentsContainerProps extends HTMLProps<HTMLDivElement> {
|
|
7
|
+
/** Content to render inside the attachments container */
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
/** Additional classes applied to the attachments container. */
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const MessageAttachmentsContainer: FunctionComponent<MessageAttachmentsContainerProps>;
|
|
13
|
+
export default MessageAttachmentsContainer;
|
|
@@ -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 MessageAttachmentsContainer = (_a) => {
|
|
15
|
+
var { children, className } = _a, props = __rest(_a, ["children", "className"]);
|
|
16
|
+
return (_jsx("div", Object.assign({ className: css('pf-chatbot__message-attachments-container', className) }, props, { children: children })));
|
|
17
|
+
};
|
|
18
|
+
export default MessageAttachmentsContainer;
|
|
@@ -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 MessageAttachmentsContainer from './MessageAttachmentsContainer';
|
|
5
|
+
test('Renders with children', () => {
|
|
6
|
+
render(_jsx(MessageAttachmentsContainer, { children: "Test content" }));
|
|
7
|
+
expect(screen.getByText('Test content')).toBeInTheDocument();
|
|
8
|
+
});
|
|
9
|
+
test('Renders with pf-chatbot__message-attachments-container class by default', () => {
|
|
10
|
+
render(_jsx(MessageAttachmentsContainer, { children: "Test content" }));
|
|
11
|
+
expect(screen.getByText('Test content')).toHaveClass('pf-chatbot__message-attachments-container', { exact: true });
|
|
12
|
+
});
|
|
13
|
+
test('Renders with custom className', () => {
|
|
14
|
+
render(_jsx(MessageAttachmentsContainer, { className: "custom-class", children: "Test content" }));
|
|
15
|
+
expect(screen.getByText('Test content')).toHaveClass('custom-class');
|
|
16
|
+
});
|
|
17
|
+
test('Spreads additional props', () => {
|
|
18
|
+
render(_jsx(MessageAttachmentsContainer, { id: "test-id", children: "Test content" }));
|
|
19
|
+
expect(screen.getByText('Test content')).toHaveAttribute('id', 'test-id');
|
|
20
|
+
});
|
|
@@ -16,5 +16,5 @@ export interface MessageInputProps extends FormProps {
|
|
|
16
16
|
/** Message text */
|
|
17
17
|
content?: string;
|
|
18
18
|
}
|
|
19
|
-
declare const MessageInput: FunctionComponent<MessageInputProps>;
|
|
19
|
+
export declare const MessageInput: FunctionComponent<MessageInputProps>;
|
|
20
20
|
export default MessageInput;
|
|
@@ -12,7 +12,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { useState } from 'react';
|
|
14
14
|
import { ActionGroup, Button, Form, TextArea } from '@patternfly/react-core';
|
|
15
|
-
const MessageInput = (_a) => {
|
|
15
|
+
export const MessageInput = (_a) => {
|
|
16
16
|
var { editPlaceholder = 'Edit prompt message...', updateWord = 'Update', cancelWord = 'Cancel', onEditUpdate, onEditCancel, inputRef, content } = _a, props = __rest(_a, ["editPlaceholder", "updateWord", "cancelWord", "onEditUpdate", "onEditCancel", "inputRef", "content"]);
|
|
17
17
|
const [messageText, setMessageText] = useState(content !== null && content !== void 0 ? content : '');
|
|
18
18
|
const onChange = (_event, value) => {
|
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { FunctionComponent } from 'react';
|
|
2
|
+
import type { HTMLProps } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* MessageLoading displays a loading animation for messages.
|
|
5
|
+
* Use this component when passing children to Message to show a loading state.
|
|
6
|
+
*/
|
|
7
|
+
export interface MessageLoadingProps extends HTMLProps<HTMLDivElement> {
|
|
8
|
+
/** Text announced to screen readers during loading. */
|
|
9
|
+
loadingWord?: string;
|
|
10
|
+
/** Flag indicating whether primary styling is applied */
|
|
11
|
+
isPrimary?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare const MessageLoading: FunctionComponent<MessageLoadingProps>;
|
|
5
14
|
export default MessageLoading;
|
|
@@ -1,6 +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
|
+
};
|
|
1
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
13
|
+
import { css } from '@patternfly/react-styles';
|
|
14
|
+
export const MessageLoading = (_a) => {
|
|
15
|
+
var { loadingWord, isPrimary } = _a, props = __rest(_a, ["loadingWord", "isPrimary"]);
|
|
16
|
+
return (_jsx("div", Object.assign({ className: css('pf-chatbot__message-loading', isPrimary && 'pf-m-primary') }, props, { children: _jsx("span", { className: "pf-chatbot__message-loading-dots", children: _jsx("span", { className: "pf-v6-screen-reader", children: loadingWord }) }) })));
|
|
17
|
+
};
|
|
6
18
|
export default MessageLoading;
|
|
@@ -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 MessageLoading from './MessageLoading';
|
|
5
|
+
test('Renders with pf-chatbot__message-loading class by default', () => {
|
|
6
|
+
render(_jsx(MessageLoading, { "data-testid": "test-id" }));
|
|
7
|
+
expect(screen.getByTestId('test-id')).toHaveClass('pf-chatbot__message-loading', { exact: true });
|
|
8
|
+
});
|
|
9
|
+
test('Renders with pf-m-primary class when isPrimary is true', () => {
|
|
10
|
+
render(_jsx(MessageLoading, { "data-testid": "test-id", isPrimary: true }));
|
|
11
|
+
expect(screen.getByTestId('test-id')).toHaveClass('pf-chatbot__message-loading pf-m-primary');
|
|
12
|
+
});
|
|
13
|
+
test('Renders loading word when loadingWord is passed', () => {
|
|
14
|
+
render(_jsx(MessageLoading, { loadingWord: "Loading message" }));
|
|
15
|
+
expect(screen.getByText('Loading message')).toBeInTheDocument();
|
|
16
|
+
});
|
|
17
|
+
test('Spreads additional props', () => {
|
|
18
|
+
render(_jsx(MessageLoading, { "data-testid": "test-id", id: "custom-id" }));
|
|
19
|
+
expect(screen.getByTestId('test-id')).toHaveAttribute('id', 'custom-id');
|
|
20
|
+
});
|
|
@@ -13,6 +13,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
13
13
|
import { useState } from 'react';
|
|
14
14
|
import { Label, LabelGroup } from '@patternfly/react-core';
|
|
15
15
|
import { CheckIcon } from '@patternfly/react-icons';
|
|
16
|
+
import { css } from '@patternfly/react-styles';
|
|
16
17
|
export const QuickResponse = ({ quickResponses, quickResponseContainerProps = { numLabels: 5 }, onSelect, isCompact }) => {
|
|
17
18
|
const [selectedQuickResponse, setSelectedQuickResponse] = useState();
|
|
18
19
|
const handleQuickResponseClick = (id, onClick) => {
|
|
@@ -20,9 +21,9 @@ export const QuickResponse = ({ quickResponses, quickResponseContainerProps = {
|
|
|
20
21
|
onClick && onClick();
|
|
21
22
|
onSelect && onSelect(id);
|
|
22
23
|
};
|
|
23
|
-
return (_jsx(LabelGroup, Object.assign({ className:
|
|
24
|
+
return (_jsx(LabelGroup, Object.assign({ className: css('pf-chatbot__message-quick-response', quickResponseContainerProps === null || quickResponseContainerProps === void 0 ? void 0 : quickResponseContainerProps.className) }, quickResponseContainerProps, { children: quickResponses.map((_a) => {
|
|
24
25
|
var { id, onClick, content, className } = _a, props = __rest(_a, ["id", "onClick", "content", "className"]);
|
|
25
|
-
return (_jsx(Label, Object.assign({ variant: id === selectedQuickResponse ? undefined : 'outline', icon: id === selectedQuickResponse ? _jsx(CheckIcon, {}) : undefined, color: "blue", onClick: () => handleQuickResponseClick(id, onClick), className:
|
|
26
|
+
return (_jsx(Label, Object.assign({ variant: id === selectedQuickResponse ? undefined : 'outline', icon: id === selectedQuickResponse ? _jsx(CheckIcon, {}) : undefined, color: "blue", onClick: () => handleQuickResponseClick(id, onClick), className: css(id === selectedQuickResponse && 'pf-chatbot__message-quick-response--selected', className), isCompact: isCompact }, props, { children: content }), id));
|
|
26
27
|
}) })));
|
|
27
28
|
};
|
|
28
29
|
export default QuickResponse;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1,104 @@
|
|
|
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 userEvent from '@testing-library/user-event';
|
|
13
|
+
import '@testing-library/jest-dom';
|
|
14
|
+
import QuickResponse from './QuickResponse';
|
|
15
|
+
test('Renders with quick responses', () => {
|
|
16
|
+
const quickResponses = [
|
|
17
|
+
{ id: '1', content: 'Response 1' },
|
|
18
|
+
{ id: '2', content: 'Response 2' },
|
|
19
|
+
{ id: '3', content: 'Response 3' }
|
|
20
|
+
];
|
|
21
|
+
render(_jsx(QuickResponse, { quickResponses: quickResponses }));
|
|
22
|
+
expect(screen.getByText('Response 1')).toBeVisible();
|
|
23
|
+
expect(screen.getByText('Response 2')).toBeVisible();
|
|
24
|
+
expect(screen.getByText('Response 3')).toBeVisible();
|
|
25
|
+
});
|
|
26
|
+
test('Renders with compact styling', () => {
|
|
27
|
+
const quickResponses = [{ id: '1', content: 'Compact response' }];
|
|
28
|
+
render(_jsx(QuickResponse, { quickResponses: quickResponses, isCompact: true }));
|
|
29
|
+
expect(screen.getByText('Compact response').closest('.pf-v6-c-label')).toHaveClass('pf-m-compact');
|
|
30
|
+
});
|
|
31
|
+
test('Renders with custom className on response', () => {
|
|
32
|
+
const quickResponses = [{ id: '1', content: 'Custom class response', className: 'custom-response-class' }];
|
|
33
|
+
render(_jsx(QuickResponse, { quickResponses: quickResponses }));
|
|
34
|
+
expect(screen.getByText('Custom class response').closest('.pf-v6-c-label')).toHaveClass('custom-response-class');
|
|
35
|
+
});
|
|
36
|
+
test('Renders with custom container className', () => {
|
|
37
|
+
const quickResponses = [
|
|
38
|
+
{ id: '1', content: 'Response 1' },
|
|
39
|
+
{ id: '2', content: 'Response 2' }
|
|
40
|
+
];
|
|
41
|
+
render(_jsx(QuickResponse, { quickResponses: quickResponses, quickResponseContainerProps: { className: 'custom-container-class' } }));
|
|
42
|
+
expect(screen.getByText('Response 1').closest('.pf-v6-c-label-group')).toHaveClass('custom-container-class');
|
|
43
|
+
});
|
|
44
|
+
test('Spreads additional custom container props', () => {
|
|
45
|
+
const quickResponses = [
|
|
46
|
+
{ id: '1', content: 'Response 1' },
|
|
47
|
+
{ id: '2', content: 'Response 2' }
|
|
48
|
+
];
|
|
49
|
+
render(_jsx(QuickResponse, { quickResponses: quickResponses, quickResponseContainerProps: { id: 'custom-container-id' } }));
|
|
50
|
+
expect(screen.getByText('Response 1').closest('.pf-v6-c-label-group__list')).toHaveAttribute('id', 'custom-container-id');
|
|
51
|
+
});
|
|
52
|
+
test('Renders with pf-chatbot__message-quick-response--selected class after click', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
53
|
+
const user = userEvent.setup();
|
|
54
|
+
const quickResponses = [
|
|
55
|
+
{ id: '1', content: 'Response 1' },
|
|
56
|
+
{ id: '2', content: 'Response 2' }
|
|
57
|
+
];
|
|
58
|
+
render(_jsx(QuickResponse, { quickResponses: quickResponses }));
|
|
59
|
+
yield user.click(screen.getByText('Response 1'));
|
|
60
|
+
expect(screen.getByText('Response 1').closest('.pf-v6-c-label')).toHaveClass('pf-chatbot__message-quick-response--selected');
|
|
61
|
+
}));
|
|
62
|
+
test('Does not calls onClick handler when not passed', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
63
|
+
const user = userEvent.setup();
|
|
64
|
+
const handleClick = jest.fn();
|
|
65
|
+
const quickResponses = [{ id: '1', content: 'Clickable response' }];
|
|
66
|
+
render(_jsx(QuickResponse, { quickResponses: quickResponses }));
|
|
67
|
+
yield user.click(screen.getByText('Clickable response'));
|
|
68
|
+
expect(handleClick).not.toHaveBeenCalled();
|
|
69
|
+
}));
|
|
70
|
+
test('Calls onClick handler when passed', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
71
|
+
const user = userEvent.setup();
|
|
72
|
+
const handleClick = jest.fn();
|
|
73
|
+
const quickResponses = [{ id: '1', content: 'Clickable response', onClick: handleClick }];
|
|
74
|
+
render(_jsx(QuickResponse, { quickResponses: quickResponses }));
|
|
75
|
+
yield user.click(screen.getByText('Clickable response'));
|
|
76
|
+
expect(handleClick).toHaveBeenCalled();
|
|
77
|
+
}));
|
|
78
|
+
test('Does not call onSelect when not passed', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
79
|
+
const user = userEvent.setup();
|
|
80
|
+
const handleSelect = jest.fn();
|
|
81
|
+
const quickResponses = [
|
|
82
|
+
{ id: '1', content: 'Response 1' },
|
|
83
|
+
{ id: '2', content: 'Response 2' }
|
|
84
|
+
];
|
|
85
|
+
render(_jsx(QuickResponse, { quickResponses: quickResponses }));
|
|
86
|
+
yield user.click(screen.getByText('Response 2'));
|
|
87
|
+
expect(handleSelect).not.toHaveBeenCalled();
|
|
88
|
+
}));
|
|
89
|
+
test('Calls onSelect when passed', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
90
|
+
const user = userEvent.setup();
|
|
91
|
+
const handleSelect = jest.fn();
|
|
92
|
+
const quickResponses = [
|
|
93
|
+
{ id: '1', content: 'Response 1' },
|
|
94
|
+
{ id: '2', content: 'Response 2' }
|
|
95
|
+
];
|
|
96
|
+
render(_jsx(QuickResponse, { quickResponses: quickResponses, onSelect: handleSelect }));
|
|
97
|
+
yield user.click(screen.getByText('Response 2'));
|
|
98
|
+
expect(handleSelect).toHaveBeenCalledWith('2');
|
|
99
|
+
}));
|
|
100
|
+
test('Spreads additional response props', () => {
|
|
101
|
+
const quickResponses = [{ id: '1', content: 'Response with props', isCompact: true, 'aria-label': 'Test label' }];
|
|
102
|
+
render(_jsx(QuickResponse, { quickResponses: quickResponses }));
|
|
103
|
+
expect(screen.getByText('Response with props').closest('.pf-v6-c-label')).toHaveAttribute('aria-label', 'Test label');
|
|
104
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './QuickResponse';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './QuickResponse';
|
|
@@ -25,5 +25,5 @@ export interface QuickStartTileProps {
|
|
|
25
25
|
/** Sets the tile to compact styling */
|
|
26
26
|
isCompact?: boolean;
|
|
27
27
|
}
|
|
28
|
-
declare const QuickStartTile: FC<QuickStartTileProps>;
|
|
28
|
+
export declare const QuickStartTile: FC<QuickStartTileProps>;
|
|
29
29
|
export default QuickStartTile;
|
|
@@ -12,7 +12,7 @@ export const camelize = (str) => str.replace(/(?:^\w|[A-Z]|\b\w|\s+)/g, function
|
|
|
12
12
|
} // or if (/\s+/.test(match)) for white spaces
|
|
13
13
|
return index === 0 ? match.toLowerCase() : match.toUpperCase();
|
|
14
14
|
});
|
|
15
|
-
const QuickStartTile = ({ className, quickStart, onClick, onSelectQuickStart, minuteWord = 'minute', minuteWordPlural = 'minutes', prerequisiteWord, prerequisiteWordPlural, quickStartButtonAriaLabel, action, isCompact }) => {
|
|
15
|
+
export const QuickStartTile = ({ className, quickStart, onClick, onSelectQuickStart, minuteWord = 'minute', minuteWordPlural = 'minutes', prerequisiteWord, prerequisiteWordPlural, quickStartButtonAriaLabel, action, isCompact }) => {
|
|
16
16
|
const { metadata: { name: id }, spec: { icon, displayName, description, durationMinutes, prerequisites, link, type } } = quickStart;
|
|
17
17
|
let quickStartIcon;
|
|
18
18
|
if (typeof icon === 'object') {
|
|
@@ -51,5 +51,5 @@ export interface UserFeedbackProps extends Omit<CardProps, 'onSubmit'>, OUIAProp
|
|
|
51
51
|
/** Optional privacy statement text displayed under text area */
|
|
52
52
|
privacyStatement?: string;
|
|
53
53
|
}
|
|
54
|
-
declare const UserFeedback: FunctionComponent<UserFeedbackProps>;
|
|
54
|
+
export declare const UserFeedback: FunctionComponent<UserFeedbackProps>;
|
|
55
55
|
export default UserFeedback;
|
|
@@ -15,7 +15,7 @@ import { useState, useRef, useEffect } from 'react';
|
|
|
15
15
|
import { ActionGroup, Button, Card, CardBody, CardHeader, Form, TextArea } from '@patternfly/react-core';
|
|
16
16
|
import QuickResponse from '../QuickResponse/QuickResponse';
|
|
17
17
|
import CloseButton from './CloseButton';
|
|
18
|
-
const UserFeedback = (_a) => {
|
|
18
|
+
export const UserFeedback = (_a) => {
|
|
19
19
|
var { className, timestamp, title = 'Why did you choose this rating?', hasTextArea, textAreaAriaLabel = `Provide optional additional feedback for message received at ${timestamp}`, textAreaPlaceholder = 'Provide optional additional feedback', onTextAreaChange, submitWord = 'Submit', quickResponses, quickResponseContainerProps = { 'aria-label': `Quick feedback for message received at ${timestamp}` }, onSubmit, onClose, closeButtonAriaLabel = `Close feedback for message received at ${timestamp}`, id, headingLevel: HeadingLevel = 'h1', focusOnLoad = true, isCompact, children, cardHeaderProps, cardBodyProps, headingLevelProps, formProps, textAreaProps, actionGroupProps, submitButtonProps, privacyStatement } = _a, props = __rest(_a, ["className", "timestamp", "title", "hasTextArea", "textAreaAriaLabel", "textAreaPlaceholder", "onTextAreaChange", "submitWord", "quickResponses", "quickResponseContainerProps", "onSubmit", "onClose", "closeButtonAriaLabel", "id", "headingLevel", "focusOnLoad", "isCompact", "children", "cardHeaderProps", "cardBodyProps", "headingLevelProps", "formProps", "textAreaProps", "actionGroupProps", "submitButtonProps", "privacyStatement"]);
|
|
20
20
|
const [selectedResponse, setSelectedResponse] = useState();
|
|
21
21
|
const [value, setValue] = useState('');
|
|
@@ -38,5 +38,5 @@ export interface UserFeedbackCompleteProps extends Omit<CardProps, 'ref'>, OUIAP
|
|
|
38
38
|
/** Timestamp passed in by Message for more context in aria announcements */
|
|
39
39
|
timestamp?: string;
|
|
40
40
|
}
|
|
41
|
-
declare const UserFeedbackComplete: FunctionComponent<UserFeedbackCompleteProps>;
|
|
41
|
+
export declare const UserFeedbackComplete: FunctionComponent<UserFeedbackCompleteProps>;
|
|
42
42
|
export default UserFeedbackComplete;
|
|
@@ -11,10 +11,9 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { useState, useRef, useEffect } from 'react';
|
|
14
|
-
// Import PatternFly components
|
|
15
14
|
import { Card, CardBody, CardHeader, CardTitle, useOUIAProps } from '@patternfly/react-core';
|
|
16
15
|
import CloseButton from './CloseButton';
|
|
17
|
-
const UserFeedbackComplete = (_a) => {
|
|
16
|
+
export const UserFeedbackComplete = (_a) => {
|
|
18
17
|
var { className, title = 'Feedback submitted', body = "We've received your response. Thank you for sharing your feedback!", timestamp, timeout = false, timeoutAnimation = 3000, onTimeout, onClose, closeButtonAriaLabel = `Close feedback for message received at ${timestamp}`, onMouseEnter, onMouseLeave, ouiaId, ouiaSafe, isLiveRegion, id, focusOnLoad = true, isCompact } = _a, props = __rest(_a, ["className", "title", "body", "timestamp", "timeout", "timeoutAnimation", "onTimeout", "onClose", "closeButtonAriaLabel", "onMouseEnter", "onMouseLeave", "ouiaId", "ouiaSafe", "isLiveRegion", "id", "focusOnLoad", "isCompact"]);
|
|
19
18
|
const [timedOut, setTimedOut] = useState(false);
|
|
20
19
|
const [timedOutAnimation, setTimedOutAnimation] = useState(true);
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
export { default } from './Message';
|
|
2
2
|
export { rehypeCodeBlockToggle } from './Plugins/rehypeCodeBlockToggle';
|
|
3
|
+
export * from './ErrorMessage/ErrorMessage';
|
|
4
|
+
export * from './MessageAndActions';
|
|
5
|
+
export * from './MessageAttachments';
|
|
3
6
|
export * from './Message';
|
|
7
|
+
export * from './MessageLoading';
|
|
8
|
+
export * from './MessageInput';
|
|
9
|
+
export * from './QuickResponse';
|
|
10
|
+
export * from './QuickStarts';
|
|
11
|
+
export * from './UserFeedback';
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
export { default } from './Message';
|
|
2
2
|
export { rehypeCodeBlockToggle } from './Plugins/rehypeCodeBlockToggle';
|
|
3
|
+
export * from './ErrorMessage/ErrorMessage';
|
|
4
|
+
export * from './MessageAndActions';
|
|
5
|
+
export * from './MessageAttachments';
|
|
3
6
|
export * from './Message';
|
|
7
|
+
export * from './MessageLoading';
|
|
8
|
+
export * from './MessageInput';
|
|
9
|
+
export * from './QuickResponse';
|
|
10
|
+
export * from './QuickStarts';
|
|
11
|
+
export * from './UserFeedback';
|
|
@@ -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> & {
|
|
@@ -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
|
+
});
|