@patternfly/chatbot 2.1.0-prerelease.22 → 2.1.0-prerelease.24

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 (40) hide show
  1. package/dist/cjs/MessageBar/MessageBar.d.ts +1 -0
  2. package/dist/cjs/MessageBar/MessageBar.js +3 -3
  3. package/dist/cjs/MessageBar/MicrophoneButton.d.ts +2 -0
  4. package/dist/cjs/MessageBar/MicrophoneButton.js +4 -2
  5. package/dist/css/main.css +68 -1
  6. package/dist/css/main.css.map +1 -1
  7. package/dist/esm/MessageBar/MessageBar.d.ts +1 -0
  8. package/dist/esm/MessageBar/MessageBar.js +3 -3
  9. package/dist/esm/MessageBar/MicrophoneButton.d.ts +2 -0
  10. package/dist/esm/MessageBar/MicrophoneButton.js +4 -2
  11. package/package.json +1 -1
  12. package/patternfly-docs/content/extensions/chatbot/design-guidelines.md +216 -0
  13. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotMessageBarLanguage.tsx +17 -0
  14. package/patternfly-docs/content/extensions/chatbot/examples/UI/UI.md +10 -0
  15. package/patternfly-docs/content/extensions/chatbot/images.css +6 -0
  16. package/patternfly-docs/content/extensions/chatbot/img/attached-file.svg +46 -0
  17. package/patternfly-docs/content/extensions/chatbot/img/attachment-error.svg +12 -0
  18. package/patternfly-docs/content/extensions/chatbot/img/attachment-menu.svg +150 -0
  19. package/patternfly-docs/content/extensions/chatbot/img/attachment-unsent.svg +88 -0
  20. package/patternfly-docs/content/extensions/chatbot/img/chatbot-elements.svg +136 -0
  21. package/patternfly-docs/content/extensions/chatbot/img/chatbot-toggle-notification.svg +8 -0
  22. package/patternfly-docs/content/extensions/chatbot/img/chatbot-toggle.svg +10 -0
  23. package/patternfly-docs/content/extensions/chatbot/img/conversation-history.svg +154 -0
  24. package/patternfly-docs/content/extensions/chatbot/img/display-menu.svg +82 -0
  25. package/patternfly-docs/content/extensions/chatbot/img/docked.svg +350 -0
  26. package/patternfly-docs/content/extensions/chatbot/img/embedded.svg +156 -0
  27. package/patternfly-docs/content/extensions/chatbot/img/footnote.svg +75 -0
  28. package/patternfly-docs/content/extensions/chatbot/img/fullscreen.svg +109 -0
  29. package/patternfly-docs/content/extensions/chatbot/img/listening.svg +65 -0
  30. package/patternfly-docs/content/extensions/chatbot/img/message-bar-elements.svg +23 -0
  31. package/patternfly-docs/content/extensions/chatbot/img/message-elements.svg +162 -0
  32. package/patternfly-docs/content/extensions/chatbot/img/overlay.svg +276 -0
  33. package/patternfly-docs/content/extensions/chatbot/img/stop-button.svg +64 -0
  34. package/src/Chatbot/Chatbot.scss +30 -1
  35. package/src/ChatbotContent/ChatbotContent.scss +5 -0
  36. package/src/FileDropZone/FileDropZone.scss +20 -0
  37. package/src/MessageBar/MessageBar.tsx +2 -0
  38. package/src/MessageBar/MicrophoneButton.tsx +6 -1
  39. package/src/MessageBox/JumpButton.scss +5 -0
  40. package/src/MessageBox/MessageBox.scss +10 -0
@@ -21,6 +21,18 @@
21
21
  &--hidden {
22
22
  pointer-events: none;
23
23
  }
24
+
25
+ // 32 rem is the width of the overlay chatbot plus the insets
26
+ // if the screen is smaller, we want to be 100%
27
+ @media screen and (max-width: 32rem) {
28
+ width: 100vw;
29
+ inset-inline-end: 0;
30
+ }
31
+
32
+ // allows for zoom conditions; try zooming to 200% to see
33
+ @media screen and (max-height: 518px) {
34
+ overflow: auto;
35
+ }
24
36
  }
25
37
 
26
38
  // ============================================================================
@@ -34,10 +46,22 @@
34
46
  border-radius: 0;
35
47
  box-shadow: var(--pf-t--global--box-shadow--lg--left);
36
48
  overflow: inherit;
49
+
50
+ // 30rem is the width of the docked chatbot
51
+ // if the screen is smaller, we want to be 100%
52
+ @media screen and (max-width: 30rem) {
53
+ width: 100%;
54
+ }
37
55
  }
38
56
 
39
57
  html.pf-chatbot-allow--docked {
40
- padding-right: 480px;
58
+ padding-inline-start: 480px;
59
+
60
+ // 30rem is the width of the docked chatbot
61
+ // if the screen is smaller, we want to be 100%
62
+ @media screen and (max-width: 30rem) {
63
+ padding-inline-start: 0px;
64
+ }
41
65
  }
42
66
 
43
67
  // ============================================================================
@@ -76,6 +100,11 @@ html.pf-chatbot-allow--docked {
76
100
  &--hidden {
77
101
  pointer-events: none;
78
102
  }
103
+
104
+ // allows for zoom conditions; try zooming to 200% to see
105
+ @media screen and (max-height: 518px) {
106
+ overflow: auto;
107
+ }
79
108
  }
80
109
 
81
110
  .pf-chatbot-container--embedded {
@@ -7,6 +7,11 @@
7
7
  overflow-y: auto;
8
8
  overflow: hidden; // needed in Red Hat Developer Hub workspace
9
9
  flex: 1; // needed in Composer AI
10
+
11
+ // allows for zoom conditions; try zooming to 200% to see
12
+ @media screen and (max-height: 518px) {
13
+ overflow: unset;
14
+ }
10
15
  }
11
16
 
12
17
  // ============================================================================
@@ -7,6 +7,11 @@
7
7
  overflow: hidden;
8
8
  display: grid;
9
9
  grid-template-rows: 1fr auto;
10
+
11
+ // allows for zoom conditions; try zooming to 200% to see
12
+ @media screen and (max-height: 518px) {
13
+ overflow-y: auto;
14
+ }
10
15
  }
11
16
 
12
17
  .pf-chatbot__dropzone--visible.pf-chatbot__dropzone {
@@ -34,3 +39,18 @@
34
39
  width: 100%;
35
40
  padding: var(--pf-t--global--spacer--md);
36
41
  }
42
+
43
+ .pf-chatbot--default {
44
+ // allows for zoom conditions; try zooming to 200% to see
45
+ .pf-chatbot__dropzone--visible.pf-chatbot__dropzone {
46
+ @media screen and (max-height: 518px) {
47
+ display: flex;
48
+ height: 100%;
49
+ overflow: hidden;
50
+
51
+ .pf-v6-c-multiple-file-upload__main {
52
+ width: 100%;
53
+ }
54
+ }
55
+ }
56
+ }
@@ -58,6 +58,7 @@ export interface MessageBarProps {
58
58
  send?: { tooltipContent?: string; props?: ButtonProps };
59
59
  microphone?: {
60
60
  tooltipContent?: { active?: string; inactive?: string };
61
+ language?: string;
61
62
  props?: ButtonProps;
62
63
  };
63
64
  };
@@ -184,6 +185,7 @@ export const MessageBar: React.FunctionComponent<MessageBarProps> = ({
184
185
  onIsListeningChange={setIsListeningMessage}
185
186
  onSpeechRecognition={handleSpeechRecognition}
186
187
  tooltipContent={buttonProps?.microphone?.tooltipContent}
188
+ language={buttonProps?.microphone?.language}
187
189
  {...buttonProps?.microphone?.props}
188
190
  />
189
191
  )}
@@ -22,6 +22,8 @@ export interface MicrophoneButtonProps extends ButtonProps {
22
22
  tooltipProps?: TooltipProps;
23
23
  /** English text "Use microphone" and "Stop listening" used in the tooltip */
24
24
  tooltipContent?: { active?: string; inactive?: string };
25
+ /** 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. */
26
+ language?: string;
25
27
  }
26
28
 
27
29
  export const MicrophoneButton: React.FunctionComponent<MicrophoneButtonProps> = ({
@@ -31,6 +33,7 @@ export const MicrophoneButton: React.FunctionComponent<MicrophoneButtonProps> =
31
33
  className,
32
34
  tooltipProps,
33
35
  tooltipContent = { active: 'Stop listening', inactive: 'Use microphone' },
36
+ language = 'en-US',
34
37
  ...props
35
38
  }: MicrophoneButtonProps) => {
36
39
  // Microphone
@@ -60,12 +63,14 @@ export const MicrophoneButton: React.FunctionComponent<MicrophoneButtonProps> =
60
63
  const recognition: SpeechRecognition = new (window.SpeechRecognition || window.webkitSpeechRecognition)();
61
64
  recognition.continuous = false;
62
65
  recognition.interimResults = false;
63
- recognition.lang = 'en-US';
66
+ recognition.lang = language;
64
67
 
65
68
  recognition.onresult = (event) => {
66
69
  const result = event.results[0][0].transcript;
67
70
  onSpeechRecognition(result);
68
71
  recognition.stop();
72
+ // turn button off
73
+ onIsListeningChange(false);
69
74
  };
70
75
 
71
76
  recognition.onerror = (event) => {
@@ -43,4 +43,9 @@
43
43
  &--bottom {
44
44
  inset-block-end: var(--pf-t--global--spacer--md) !important;
45
45
  }
46
+
47
+ // allows for zoom conditions; try zooming to 200% to see
48
+ @media screen and (max-height: 518px) {
49
+ display: none;
50
+ }
46
51
  }
@@ -7,6 +7,16 @@
7
7
  flex-direction: column;
8
8
  row-gap: var(--pf-t--global--spacer--sm);
9
9
  padding: var(--pf-t--global--spacer--lg);
10
+
11
+ // 32 rem is the width of the overlay chatbot plus the insets
12
+ // if the screen is smaller, we want to be 100%
13
+ @media screen and (max-width: 32rem) {
14
+ width: 100%;
15
+ }
16
+ // allows for zoom conditions; try zooming to 200% to see
17
+ @media screen and (max-height: 518px) {
18
+ overflow-y: visible;
19
+ }
10
20
  }
11
21
 
12
22
  .pf-chatbot__messagebox--bottom > :first-child {