@patternfly/chatbot 6.3.0-prerelease.7 → 6.3.0-prerelease.9

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.
Files changed (113) hide show
  1. package/dist/cjs/Chatbot/Chatbot.test.js +4 -0
  2. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +1 -1
  3. package/dist/cjs/ChatbotFooter/ChatbotFooter.d.ts +1 -0
  4. package/dist/cjs/ChatbotFooter/ChatbotFooter.js +2 -2
  5. package/dist/cjs/ChatbotFooter/ChatbotFooter.test.d.ts +1 -1
  6. package/dist/cjs/ChatbotFooter/ChatbotFooter.test.js +5 -0
  7. package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.d.ts +3 -2
  8. package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.js +20 -6
  9. package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.test.d.ts +1 -1
  10. package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.test.js +5 -0
  11. package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.d.ts +1 -0
  12. package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.js +3 -3
  13. package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.d.ts +1 -1
  14. package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.js +5 -0
  15. package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.d.ts +1 -0
  16. package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.js +2 -2
  17. package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.d.ts +1 -1
  18. package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.js +5 -0
  19. package/dist/cjs/ChatbotPopover/ChatbotPopover.js +1 -1
  20. package/dist/cjs/ChatbotWelcomePrompt/ChatbotWelcomePrompt.d.ts +1 -0
  21. package/dist/cjs/ChatbotWelcomePrompt/ChatbotWelcomePrompt.js +3 -3
  22. package/dist/cjs/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.js +4 -0
  23. package/dist/cjs/MessageBar/AttachButton.d.ts +1 -0
  24. package/dist/cjs/MessageBar/AttachButton.js +3 -3
  25. package/dist/cjs/MessageBar/AttachButton.test.js +4 -0
  26. package/dist/cjs/MessageBar/MessageBar.d.ts +1 -0
  27. package/dist/cjs/MessageBar/MessageBar.js +13 -12
  28. package/dist/cjs/MessageBar/MicrophoneButton.d.ts +1 -0
  29. package/dist/cjs/MessageBar/MicrophoneButton.js +3 -3
  30. package/dist/cjs/MessageBar/SendButton.d.ts +1 -0
  31. package/dist/cjs/MessageBar/SendButton.js +3 -3
  32. package/dist/cjs/MessageBar/SendButton.test.js +4 -0
  33. package/dist/cjs/MessageBar/StopButton.d.ts +1 -0
  34. package/dist/cjs/MessageBar/StopButton.js +3 -3
  35. package/dist/cjs/MessageBar/StopButton.test.js +4 -0
  36. package/dist/cjs/MessageBox/MessageBox.js +14 -2
  37. package/dist/css/main.css +128 -2
  38. package/dist/css/main.css.map +1 -1
  39. package/dist/esm/Chatbot/Chatbot.test.js +4 -0
  40. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +1 -1
  41. package/dist/esm/ChatbotFooter/ChatbotFooter.d.ts +1 -0
  42. package/dist/esm/ChatbotFooter/ChatbotFooter.js +2 -2
  43. package/dist/esm/ChatbotFooter/ChatbotFooter.test.d.ts +1 -1
  44. package/dist/esm/ChatbotFooter/ChatbotFooter.test.js +5 -0
  45. package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.d.ts +3 -2
  46. package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.js +20 -6
  47. package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.test.d.ts +1 -1
  48. package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.test.js +5 -0
  49. package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.d.ts +1 -0
  50. package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.js +3 -3
  51. package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.d.ts +1 -1
  52. package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.js +5 -0
  53. package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.d.ts +1 -0
  54. package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.js +2 -2
  55. package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.d.ts +1 -1
  56. package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.js +5 -0
  57. package/dist/esm/ChatbotPopover/ChatbotPopover.js +1 -1
  58. package/dist/esm/ChatbotWelcomePrompt/ChatbotWelcomePrompt.d.ts +1 -0
  59. package/dist/esm/ChatbotWelcomePrompt/ChatbotWelcomePrompt.js +3 -3
  60. package/dist/esm/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.js +4 -0
  61. package/dist/esm/MessageBar/AttachButton.d.ts +1 -0
  62. package/dist/esm/MessageBar/AttachButton.js +3 -3
  63. package/dist/esm/MessageBar/AttachButton.test.js +4 -0
  64. package/dist/esm/MessageBar/MessageBar.d.ts +1 -0
  65. package/dist/esm/MessageBar/MessageBar.js +13 -12
  66. package/dist/esm/MessageBar/MicrophoneButton.d.ts +1 -0
  67. package/dist/esm/MessageBar/MicrophoneButton.js +3 -3
  68. package/dist/esm/MessageBar/SendButton.d.ts +1 -0
  69. package/dist/esm/MessageBar/SendButton.js +3 -3
  70. package/dist/esm/MessageBar/SendButton.test.js +4 -0
  71. package/dist/esm/MessageBar/StopButton.d.ts +1 -0
  72. package/dist/esm/MessageBar/StopButton.js +3 -3
  73. package/dist/esm/MessageBar/StopButton.test.js +4 -0
  74. package/dist/esm/MessageBox/MessageBox.js +14 -2
  75. package/package.json +1 -1
  76. package/patternfly-docs/content/extensions/chatbot/examples/demos/Chatbot.md +8 -1
  77. package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotCompact.tsx +481 -0
  78. package/src/Chatbot/Chatbot.test.tsx +9 -0
  79. package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.scss +10 -1
  80. package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.tsx +5 -1
  81. package/src/ChatbotFooter/ChatbotFooter.scss +5 -0
  82. package/src/ChatbotFooter/ChatbotFooter.test.tsx +10 -0
  83. package/src/ChatbotFooter/ChatbotFooter.tsx +3 -1
  84. package/src/ChatbotHeader/ChatbotHeader.scss +17 -0
  85. package/src/ChatbotHeader/ChatbotHeaderMenu.test.tsx +8 -0
  86. package/src/ChatbotHeader/ChatbotHeaderMenu.tsx +10 -5
  87. package/src/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.tsx +6 -0
  88. package/src/ChatbotHeader/ChatbotHeaderOptionsDropdown.tsx +5 -2
  89. package/src/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.tsx +10 -0
  90. package/src/ChatbotHeader/ChatbotHeaderSelectorDropdown.tsx +4 -0
  91. package/src/ChatbotPopover/ChatbotPopover.scss +9 -5
  92. package/src/ChatbotPopover/ChatbotPopover.tsx +1 -1
  93. package/src/ChatbotWelcomePrompt/ChatbotWelcomePrompt.scss +9 -1
  94. package/src/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.tsx +13 -0
  95. package/src/ChatbotWelcomePrompt/ChatbotWelcomePrompt.tsx +13 -2
  96. package/src/ChatbotWelcomePrompt/__snapshots__/ChatbotWelcomePrompt.test.tsx.snap +1 -1
  97. package/src/Message/Message.scss +27 -0
  98. package/src/Message/TextMessage/TextMessage.scss +25 -0
  99. package/src/MessageBar/AttachButton.scss +10 -0
  100. package/src/MessageBar/AttachButton.test.tsx +4 -0
  101. package/src/MessageBar/AttachButton.tsx +5 -2
  102. package/src/MessageBar/MessageBar.scss +17 -0
  103. package/src/MessageBar/MessageBar.tsx +15 -6
  104. package/src/MessageBar/MicrophoneButton.scss +10 -0
  105. package/src/MessageBar/MicrophoneButton.tsx +5 -2
  106. package/src/MessageBar/SendButton.scss +10 -0
  107. package/src/MessageBar/SendButton.test.tsx +5 -1
  108. package/src/MessageBar/SendButton.tsx +5 -2
  109. package/src/MessageBar/StopButton.scss +10 -0
  110. package/src/MessageBar/StopButton.test.tsx +5 -1
  111. package/src/MessageBar/StopButton.tsx +5 -2
  112. package/src/MessageBox/MessageBox.scss +6 -0
  113. package/src/MessageBox/MessageBox.tsx +3 -1
@@ -18,7 +18,7 @@ import { AttachButton } from './AttachButton';
18
18
  import AttachMenu from '../AttachMenu';
19
19
  import StopButton from './StopButton';
20
20
  export const MessageBar = (_a) => {
21
- var { onSendMessage, className, alwayShowSendButton, placeholder = 'Send a message...', hasAttachButton = true, hasMicrophoneButton, listeningText = 'Listening', handleAttach, attachMenuProps, isSendButtonDisabled, handleStopButton, hasStopButton, buttonProps, onChange, displayMode, value } = _a, props = __rest(_a, ["onSendMessage", "className", "alwayShowSendButton", "placeholder", "hasAttachButton", "hasMicrophoneButton", "listeningText", "handleAttach", "attachMenuProps", "isSendButtonDisabled", "handleStopButton", "hasStopButton", "buttonProps", "onChange", "displayMode", "value"]);
21
+ var { onSendMessage, className, alwayShowSendButton, placeholder = 'Send a message...', hasAttachButton = true, hasMicrophoneButton, listeningText = 'Listening', handleAttach, attachMenuProps, isSendButtonDisabled, handleStopButton, hasStopButton, buttonProps, onChange, displayMode, value, isCompact = false } = _a, props = __rest(_a, ["onSendMessage", "className", "alwayShowSendButton", "placeholder", "hasAttachButton", "hasMicrophoneButton", "listeningText", "handleAttach", "attachMenuProps", "isSendButtonDisabled", "handleStopButton", "hasStopButton", "buttonProps", "onChange", "displayMode", "value", "isCompact"]);
22
22
  // Text Input
23
23
  // --------------------------------------------------------------------------
24
24
  const [message, setMessage] = React.useState(value !== null && value !== void 0 ? value : '');
@@ -26,11 +26,12 @@ export const MessageBar = (_a) => {
26
26
  const [hasSentMessage, setHasSentMessage] = React.useState(false);
27
27
  const textareaRef = React.useRef(null);
28
28
  const attachButtonRef = React.useRef(null);
29
+ const topMargin = '1rem';
29
30
  const setInitialLineHeight = (field) => {
30
31
  field.style.setProperty('line-height', '1rem');
31
32
  const parent = field.parentElement;
32
33
  if (parent) {
33
- parent.style.setProperty('margin-top', `1rem`);
34
+ parent.style.setProperty('margin-top', topMargin);
34
35
  parent.style.setProperty('margin-bottom', `0rem`);
35
36
  parent.style.setProperty('height', 'inherit');
36
37
  const grandparent = parent.parentElement;
@@ -52,8 +53,8 @@ export const MessageBar = (_a) => {
52
53
  parseInt(computed.getPropertyValue('border-bottom-width'));
53
54
  parent.style.setProperty('height', `${height}px`);
54
55
  if (height > 32 || window.innerWidth <= 507) {
55
- parent.style.setProperty('margin-bottom', `1rem`);
56
- parent.style.setProperty('margin-top', `1rem`);
56
+ parent.style.setProperty('margin-bottom', topMargin);
57
+ parent.style.setProperty('margin-top', topMargin);
57
58
  }
58
59
  }
59
60
  };
@@ -74,8 +75,8 @@ export const MessageBar = (_a) => {
74
75
  const handleNewLine = (field) => {
75
76
  const parent = field.parentElement;
76
77
  if (parent) {
77
- parent.style.setProperty('margin-bottom', `1rem`);
78
- parent.style.setProperty('margin-top', `1rem`);
78
+ parent.style.setProperty('margin-bottom', topMargin);
79
+ parent.style.setProperty('margin-top', topMargin);
79
80
  }
80
81
  };
81
82
  React.useEffect(() => {
@@ -170,16 +171,16 @@ export const MessageBar = (_a) => {
170
171
  const renderButtons = () => {
171
172
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
172
173
  if (hasStopButton && handleStopButton) {
173
- return (React.createElement(StopButton, Object.assign({ onClick: handleStopButton, tooltipContent: (_a = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.stop) === null || _a === void 0 ? void 0 : _a.tooltipContent }, (_b = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.stop) === null || _b === void 0 ? void 0 : _b.props)));
174
+ return (React.createElement(StopButton, Object.assign({ onClick: handleStopButton, tooltipContent: (_a = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.stop) === null || _a === void 0 ? void 0 : _a.tooltipContent, isCompact: isCompact }, (_b = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.stop) === null || _b === void 0 ? void 0 : _b.props)));
174
175
  }
175
176
  return (React.createElement(React.Fragment, null,
176
- attachMenuProps && (React.createElement(AttachButton, Object.assign({ ref: attachButtonRef, onClick: handleAttachMenuToggle, isDisabled: isListeningMessage, tooltipContent: (_c = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _c === void 0 ? void 0 : _c.tooltipContent }, (_d = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _d === void 0 ? void 0 : _d.props))),
177
- !attachMenuProps && hasAttachButton && (React.createElement(AttachButton, Object.assign({ onAttachAccepted: handleAttach, isDisabled: isListeningMessage, tooltipContent: (_e = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _e === void 0 ? void 0 : _e.tooltipContent, inputTestId: (_f = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _f === void 0 ? void 0 : _f.inputTestId }, (_g = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _g === void 0 ? void 0 : _g.props))),
178
- hasMicrophoneButton && (React.createElement(MicrophoneButton, Object.assign({ isListening: isListeningMessage, onIsListeningChange: setIsListeningMessage, onSpeechRecognition: handleSpeechRecognition, tooltipContent: (_h = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.microphone) === null || _h === void 0 ? void 0 : _h.tooltipContent, language: (_j = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.microphone) === null || _j === void 0 ? void 0 : _j.language }, (_k = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.microphone) === null || _k === void 0 ? void 0 : _k.props))),
179
- (alwayShowSendButton || message) && (React.createElement(SendButton, Object.assign({ value: message, onClick: () => handleSend(message), isDisabled: isSendButtonDisabled, tooltipContent: (_l = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.send) === null || _l === void 0 ? void 0 : _l.tooltipContent }, (_m = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.send) === null || _m === void 0 ? void 0 : _m.props)))));
177
+ attachMenuProps && (React.createElement(AttachButton, Object.assign({ ref: attachButtonRef, onClick: handleAttachMenuToggle, isDisabled: isListeningMessage, tooltipContent: (_c = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _c === void 0 ? void 0 : _c.tooltipContent, isCompact: isCompact }, (_d = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _d === void 0 ? void 0 : _d.props))),
178
+ !attachMenuProps && hasAttachButton && (React.createElement(AttachButton, Object.assign({ onAttachAccepted: handleAttach, isDisabled: isListeningMessage, tooltipContent: (_e = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _e === void 0 ? void 0 : _e.tooltipContent, inputTestId: (_f = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _f === void 0 ? void 0 : _f.inputTestId, isCompact: isCompact }, (_g = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _g === void 0 ? void 0 : _g.props))),
179
+ hasMicrophoneButton && (React.createElement(MicrophoneButton, Object.assign({ isListening: isListeningMessage, onIsListeningChange: setIsListeningMessage, onSpeechRecognition: handleSpeechRecognition, tooltipContent: (_h = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.microphone) === null || _h === void 0 ? void 0 : _h.tooltipContent, language: (_j = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.microphone) === null || _j === void 0 ? void 0 : _j.language, isCompact: isCompact }, (_k = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.microphone) === null || _k === void 0 ? void 0 : _k.props))),
180
+ (alwayShowSendButton || message) && (React.createElement(SendButton, Object.assign({ value: message, onClick: () => handleSend(message), isDisabled: isSendButtonDisabled, tooltipContent: (_l = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.send) === null || _l === void 0 ? void 0 : _l.tooltipContent, isCompact: isCompact }, (_m = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.send) === null || _m === void 0 ? void 0 : _m.props)))));
180
181
  };
181
182
  const messageBarContents = (React.createElement(React.Fragment, null,
182
- React.createElement("div", { className: "pf-chatbot__message-bar-input" },
183
+ React.createElement("div", { className: `pf-chatbot__message-bar-input ${isCompact ? 'pf-m-compact' : ''}` },
183
184
  React.createElement(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))),
184
185
  React.createElement("div", { className: "pf-chatbot__message-bar-actions" }, renderButtons())));
185
186
  if (attachMenuProps) {
@@ -18,6 +18,7 @@ export interface MicrophoneButtonProps extends ButtonProps {
18
18
  };
19
19
  /** Locale code for language speech recognition is conducted in. This should be in the format 'en-US', a.k.a. the ISO 639-1 code, a dash, and the ISO_3166-1 code. */
20
20
  language?: string;
21
+ isCompact?: boolean;
21
22
  }
22
23
  export declare const MicrophoneButton: React.FunctionComponent<MicrophoneButtonProps>;
23
24
  export default MicrophoneButton;
@@ -18,7 +18,7 @@ import { Button, Tooltip, Icon } from '@patternfly/react-core';
18
18
  // Import FontAwesome icons
19
19
  import { MicrophoneIcon } from '@patternfly/react-icons/dist/esm/icons/microphone-icon';
20
20
  export const MicrophoneButton = (_a) => {
21
- var { isListening, onIsListeningChange, onSpeechRecognition, className, tooltipProps, tooltipContent = { active: 'Stop listening', inactive: 'Use microphone' }, language = 'en-US' } = _a, props = __rest(_a, ["isListening", "onIsListeningChange", "onSpeechRecognition", "className", "tooltipProps", "tooltipContent", "language"]);
21
+ var { isListening, onIsListeningChange, onSpeechRecognition, className, tooltipProps, tooltipContent = { active: 'Stop listening', inactive: 'Use microphone' }, language = 'en-US', isCompact } = _a, props = __rest(_a, ["isListening", "onIsListeningChange", "onSpeechRecognition", "className", "tooltipProps", "tooltipContent", "language", "isCompact"]);
22
22
  // Microphone
23
23
  // --------------------------------------------------------------------------
24
24
  const [speechRecognition, setSpeechRecognition] = React.useState();
@@ -63,7 +63,7 @@ export const MicrophoneButton = (_a) => {
63
63
  return null;
64
64
  }
65
65
  return (React.createElement(Tooltip, Object.assign({ aria: "none", "aria-live": "polite", id: "pf-chatbot__tooltip--use-microphone", content: isListening ? tooltipContent.active : tooltipContent.inactive, position: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.position) || 'top', entryDelay: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.entryDelay) || 0, exitDelay: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.exitDelay) || 0, distance: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.distance) || 8, animationDuration: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.animationDuration) || 0 }, tooltipProps),
66
- React.createElement(Button, Object.assign({ variant: "plain", className: `pf-chatbot__button--microphone ${isListening ? 'pf-chatbot__button--microphone--active' : ''} ${className !== null && className !== void 0 ? className : ''}`, "aria-label": props['aria-label'] || 'Microphone button', onClick: isListening ? stopListening : startListening, icon: React.createElement(Icon, { iconSize: "xl", isInline: true },
67
- React.createElement(MicrophoneIcon, null)) }, props))));
66
+ React.createElement(Button, Object.assign({ variant: "plain", className: `pf-chatbot__button--microphone ${isListening ? 'pf-chatbot__button--microphone--active' : ''} ${isCompact ? 'pf-m-compact' : ''} ${className !== null && className !== void 0 ? className : ''}`, "aria-label": props['aria-label'] || 'Microphone button', onClick: isListening ? stopListening : startListening, icon: React.createElement(Icon, { iconSize: isCompact ? 'lg' : 'xl', isInline: true },
67
+ React.createElement(MicrophoneIcon, null)), size: isCompact ? 'sm' : undefined }, props))));
68
68
  };
69
69
  export default MicrophoneButton;
@@ -9,6 +9,7 @@ export interface SendButtonProps extends ButtonProps {
9
9
  tooltipProps?: Omit<TooltipProps, 'content'>;
10
10
  /** English text "Send" used in the tooltip */
11
11
  tooltipContent?: string;
12
+ isCompact?: boolean;
12
13
  }
13
14
  export declare const SendButton: React.FunctionComponent<SendButtonProps>;
14
15
  export default SendButton;
@@ -17,11 +17,11 @@ import React from 'react';
17
17
  import { Button, Tooltip, Icon } from '@patternfly/react-core';
18
18
  import { PaperPlaneIcon } from '@patternfly/react-icons/dist/esm/icons/paper-plane-icon';
19
19
  export const SendButton = (_a) => {
20
- var { className, onClick, tooltipProps, tooltipContent = 'Send' } = _a, props = __rest(_a, ["className", "onClick", "tooltipProps", "tooltipContent"]);
20
+ var { className, onClick, tooltipProps, tooltipContent = 'Send', isCompact } = _a, props = __rest(_a, ["className", "onClick", "tooltipProps", "tooltipContent", "isCompact"]);
21
21
  return (React.createElement(Tooltip, Object.assign({ id: "pf-chatbot__tooltip--send", content: tooltipContent, position: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.position) || 'top', entryDelay: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.entryDelay) || 0, exitDelay: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.exitDelay) || 0, distance: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.distance) || 8, animationDuration: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.animationDuration) || 0,
22
22
  // prevents VO announcements of both aria label and tooltip
23
23
  aria: "none" }, tooltipProps),
24
- React.createElement(Button, Object.assign({ variant: "plain", className: `pf-chatbot__button--send ${className !== null && className !== void 0 ? className : ''}`, "aria-label": props['aria-label'] || 'Send button', onClick: onClick, icon: React.createElement(Icon, { iconSize: "xl", isInline: true },
25
- React.createElement(PaperPlaneIcon, null)) }, props))));
24
+ React.createElement(Button, Object.assign({ variant: "plain", className: `pf-chatbot__button--send ${isCompact ? 'pf-m-compact' : ''} ${className !== null && className !== void 0 ? className : ''}`, "aria-label": props['aria-label'] || 'Send button', onClick: onClick, icon: React.createElement(Icon, { iconSize: isCompact ? 'lg' : 'xl', isInline: true },
25
+ React.createElement(PaperPlaneIcon, null)), size: isCompact ? 'sm' : undefined }, props))));
26
26
  };
27
27
  export default SendButton;
@@ -46,4 +46,8 @@ describe('Send button', () => {
46
46
  yield userEvent.click(screen.getByRole('button', { name: 'Send button' }));
47
47
  expect(screen.getByRole('tooltip', { name: 'Send' })).toHaveAttribute('id', 'test');
48
48
  }));
49
+ it('should handle isCompact', () => {
50
+ renderSend({ 'data-testid': 'button', isCompact: true });
51
+ expect(screen.getByTestId('button')).toHaveClass('pf-m-compact');
52
+ });
49
53
  });
@@ -9,6 +9,7 @@ export interface StopButtonProps extends ButtonProps {
9
9
  tooltipProps?: Omit<TooltipProps, 'content'>;
10
10
  /** English text "Stop" used in the tooltip */
11
11
  tooltipContent?: string;
12
+ isCompact?: boolean;
12
13
  }
13
14
  export declare const StopButton: React.FunctionComponent<StopButtonProps>;
14
15
  export default StopButton;
@@ -16,12 +16,12 @@ import React from 'react';
16
16
  // Import PatternFly components
17
17
  import { Button, Tooltip, Icon } from '@patternfly/react-core';
18
18
  export const StopButton = (_a) => {
19
- var { className, onClick, tooltipProps, tooltipContent = 'Stop' } = _a, props = __rest(_a, ["className", "onClick", "tooltipProps", "tooltipContent"]);
19
+ var { className, onClick, tooltipProps, tooltipContent = 'Stop', isCompact } = _a, props = __rest(_a, ["className", "onClick", "tooltipProps", "tooltipContent", "isCompact"]);
20
20
  return (React.createElement(Tooltip, Object.assign({ id: "pf-chatbot__tooltip--stop", content: tooltipContent, position: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.position) || 'top', entryDelay: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.entryDelay) || 0, exitDelay: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.exitDelay) || 0, distance: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.distance) || 8, animationDuration: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.animationDuration) || 0,
21
21
  // prevents VO announcements of both aria label and tooltip
22
22
  aria: "none" }, tooltipProps),
23
- React.createElement(Button, Object.assign({ className: `pf-chatbot__button--stop ${className !== null && className !== void 0 ? className : ''}`, variant: "link", "aria-label": props['aria-label'] || 'Stop button', onClick: onClick, icon: React.createElement(Icon, { iconSize: "xl", isInline: true },
23
+ React.createElement(Button, Object.assign({ className: `pf-chatbot__button--stop ${isCompact ? 'pf-m-compact' : ''} ${className !== null && className !== void 0 ? className : ''}`, variant: "link", "aria-label": props['aria-label'] || 'Stop button', onClick: onClick, icon: React.createElement(Icon, { iconSize: isCompact ? 'lg' : 'xl', isInline: true },
24
24
  React.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
25
- React.createElement("path", { d: "M0.5 3C0.5 1.62109 1.62109 0.5 3 0.5H13C14.3789 0.5 15.5 1.62109 15.5 3V13C15.5 14.3789 14.3789 15.5 13 15.5H3C1.62109 15.5 0.5 14.3789 0.5 13V3Z", fill: "currentColor" }))) }, props))));
25
+ React.createElement("path", { d: "M0.5 3C0.5 1.62109 1.62109 0.5 3 0.5H13C14.3789 0.5 15.5 1.62109 15.5 3V13C15.5 14.3789 14.3789 15.5 13 15.5H3C1.62109 15.5 0.5 14.3789 0.5 13V3Z", fill: "currentColor" }))), size: isCompact ? 'sm' : undefined }, props))));
26
26
  };
27
27
  export default StopButton;
@@ -46,4 +46,8 @@ describe('Stop button', () => {
46
46
  yield userEvent.click(screen.getByRole('button', { name: 'Stop button' }));
47
47
  expect(screen.getByRole('tooltip', { name: 'Stop' })).toHaveAttribute('id', 'test');
48
48
  }));
49
+ it('should handle isCompact', () => {
50
+ renderStop({ 'data-testid': 'button', isCompact: true });
51
+ expect(screen.getByTestId('button')).toHaveClass('pf-m-compact');
52
+ });
49
53
  });
@@ -1,9 +1,21 @@
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
  // ============================================================================
2
13
  // Chatbot Main - Messages
3
14
  // ============================================================================
4
15
  import React from 'react';
5
16
  import JumpButton from './JumpButton';
6
- const MessageBoxBase = ({ announcement, ariaLabel = 'Scrollable message log', children, innerRef, className, position = 'top' }) => {
17
+ const MessageBoxBase = (_a) => {
18
+ var { announcement, ariaLabel = 'Scrollable message log', children, innerRef, className, position = 'top' } = _a, props = __rest(_a, ["announcement", "ariaLabel", "children", "innerRef", "className", "position"]);
7
19
  const [atTop, setAtTop] = React.useState(false);
8
20
  const [atBottom, setAtBottom] = React.useState(true);
9
21
  const [isOverflowing, setIsOverflowing] = React.useState(false);
@@ -59,7 +71,7 @@ const MessageBoxBase = ({ announcement, ariaLabel = 'Scrollable message log', ch
59
71
  }, [checkOverflow, handleScroll, messageBoxRef]);
60
72
  return (React.createElement(React.Fragment, null,
61
73
  React.createElement(JumpButton, { position: "top", isHidden: isOverflowing && atTop, onClick: scrollToTop }),
62
- React.createElement("div", { role: "region", tabIndex: 0, "aria-label": ariaLabel, className: `pf-chatbot__messagebox ${position === 'bottom' && 'pf-chatbot__messagebox--bottom'} ${className !== null && className !== void 0 ? className : ''}`, ref: innerRef !== null && innerRef !== void 0 ? innerRef : messageBoxRef },
74
+ React.createElement("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: innerRef !== null && innerRef !== void 0 ? innerRef : messageBoxRef }, props),
63
75
  children,
64
76
  React.createElement("div", { className: "pf-chatbot__messagebox-announcement", "aria-live": "polite" }, announcement)),
65
77
  React.createElement(JumpButton, { position: "bottom", isHidden: isOverflowing && atBottom, onClick: scrollToBottom })));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/chatbot",
3
- "version": "6.3.0-prerelease.7",
3
+ "version": "6.3.0-prerelease.9",
4
4
  "description": "This library provides React components based on PatternFly 6 that can be used to build chatbots.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -59,7 +59,6 @@ import userAvatar from '../Messages/user_avatar.svg';
59
59
  import patternflyAvatar from '../Messages/patternfly_avatar.jpg';
60
60
  import { getTrackingProviders } from "@patternfly/chatbot/dist/dynamic/tracking";
61
61
 
62
-
63
62
  ### Basic ChatBot
64
63
 
65
64
  This demo displays a basic ChatBot, which includes:
@@ -87,6 +86,14 @@ This demo displays a basic ChatBot, which includes:
87
86
 
88
87
  ```
89
88
 
89
+ ### Compact ChatBot
90
+
91
+ This demo displays a basic compact ChatBot
92
+
93
+ ```js file="./ChatbotCompact.tsx" isFullscreen
94
+
95
+ ```
96
+
90
97
  ### Embedded ChatBot
91
98
 
92
99
  This demo displays an embedded ChatBot. Embedded ChatBots are meant to be placed within a page in your product. This demo includes: