@patternfly/chatbot 2.2.0-prerelease.18 → 2.2.0-prerelease.19

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.
@@ -54,17 +54,14 @@ const MessageBar = (_a) => {
54
54
  };
55
55
  // Handle sending message
56
56
  const handleSend = react_1.default.useCallback(() => {
57
- setMessage((m) => {
58
- onSendMessage(m);
59
- setMessage('');
60
- if (textareaRef.current) {
61
- textareaRef.current.innerText = '';
62
- setShowPlaceholder(true);
63
- textareaRef.current.blur();
64
- }
65
- return '';
66
- });
67
- }, [onSendMessage]);
57
+ onSendMessage(message);
58
+ if (textareaRef.current) {
59
+ textareaRef.current.innerText = '';
60
+ setShowPlaceholder(true);
61
+ textareaRef.current.blur();
62
+ }
63
+ setMessage('');
64
+ }, [onSendMessage, message]);
68
65
  const handleKeyDown = react_1.default.useCallback((event) => {
69
66
  if (event.key === 'Enter' && !event.shiftKey) {
70
67
  event.preventDefault();
@@ -72,7 +69,7 @@ const MessageBar = (_a) => {
72
69
  handleSend();
73
70
  }
74
71
  }
75
- }, [handleSend]);
72
+ }, [handleSend, isSendButtonDisabled, handleStopButton]);
76
73
  const handleAttachMenuToggle = () => {
77
74
  (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)));
78
75
  attachMenuProps === null || attachMenuProps === void 0 ? void 0 : attachMenuProps.onAttachMenuToggleClick();
@@ -48,17 +48,14 @@ export const MessageBar = (_a) => {
48
48
  };
49
49
  // Handle sending message
50
50
  const handleSend = React.useCallback(() => {
51
- setMessage((m) => {
52
- onSendMessage(m);
53
- setMessage('');
54
- if (textareaRef.current) {
55
- textareaRef.current.innerText = '';
56
- setShowPlaceholder(true);
57
- textareaRef.current.blur();
58
- }
59
- return '';
60
- });
61
- }, [onSendMessage]);
51
+ onSendMessage(message);
52
+ if (textareaRef.current) {
53
+ textareaRef.current.innerText = '';
54
+ setShowPlaceholder(true);
55
+ textareaRef.current.blur();
56
+ }
57
+ setMessage('');
58
+ }, [onSendMessage, message]);
62
59
  const handleKeyDown = React.useCallback((event) => {
63
60
  if (event.key === 'Enter' && !event.shiftKey) {
64
61
  event.preventDefault();
@@ -66,7 +63,7 @@ export const MessageBar = (_a) => {
66
63
  handleSend();
67
64
  }
68
65
  }
69
- }, [handleSend]);
66
+ }, [handleSend, isSendButtonDisabled, handleStopButton]);
70
67
  const handleAttachMenuToggle = () => {
71
68
  (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)));
72
69
  attachMenuProps === null || attachMenuProps === void 0 ? void 0 : attachMenuProps.onAttachMenuToggleClick();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/chatbot",
3
- "version": "2.2.0-prerelease.18",
3
+ "version": "2.2.0-prerelease.19",
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",
@@ -111,17 +111,14 @@ export const MessageBar: React.FunctionComponent<MessageBarProps> = ({
111
111
 
112
112
  // Handle sending message
113
113
  const handleSend = React.useCallback(() => {
114
- setMessage((m) => {
115
- onSendMessage(m);
116
- setMessage('');
117
- if (textareaRef.current) {
118
- textareaRef.current.innerText = '';
119
- setShowPlaceholder(true);
120
- textareaRef.current.blur();
121
- }
122
- return '';
123
- });
124
- }, [onSendMessage]);
114
+ onSendMessage(message);
115
+ if (textareaRef.current) {
116
+ textareaRef.current.innerText = '';
117
+ setShowPlaceholder(true);
118
+ textareaRef.current.blur();
119
+ }
120
+ setMessage('');
121
+ }, [onSendMessage, message]);
125
122
 
126
123
  const handleKeyDown = React.useCallback(
127
124
  (event: React.KeyboardEvent) => {
@@ -132,7 +129,7 @@ export const MessageBar: React.FunctionComponent<MessageBarProps> = ({
132
129
  }
133
130
  }
134
131
  },
135
- [handleSend]
132
+ [handleSend, isSendButtonDisabled, handleStopButton]
136
133
  );
137
134
 
138
135
  const handleAttachMenuToggle = () => {