@pubuduth-aplicy/chat-ui 2.2.15 → 2.2.16

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pubuduth-aplicy/chat-ui",
3
- "version": "2.2.15",
3
+ "version": "2.2.16",
4
4
  "description": "This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.",
5
5
  "license": "ISC",
6
6
  "author": "",
@@ -159,6 +159,26 @@ const Message = ({ message }: MessageProps) => {
159
159
  setLocalStatus(message.status);
160
160
  }, [message.status]);
161
161
 
162
+ useEffect(() => {
163
+ const handleClickOutside = (e: MouseEvent) => {
164
+ if (
165
+ optionsRef.current &&
166
+ !optionsRef.current.contains(e.target as Node)
167
+ ) {
168
+ setShowOptions(false);
169
+ setShowDeleteOption(false);
170
+ }
171
+ };
172
+
173
+ if (showOptions || showDeleteOption) {
174
+ document.addEventListener("mousedown", handleClickOutside);
175
+ }
176
+
177
+ return () => {
178
+ document.removeEventListener("mousedown", handleClickOutside);
179
+ };
180
+ }, [showOptions, showDeleteOption]);
181
+
162
182
  // const handleDownload = (url: string, name: string) => {
163
183
  // saveAs(url, name);
164
184
  // };
@@ -597,6 +617,7 @@ const Message = ({ message }: MessageProps) => {
597
617
  <div className={`message-row ${alignItems}`}>
598
618
  <div
599
619
  className="bubble-container"
620
+ ref={optionsRef}
600
621
  onMouseEnter={() => fromMe && !hasMedia && setShowOptions(true)}
601
622
  onMouseLeave={() =>
602
623
  fromMe && !showDeleteOption && setShowOptions(false)
@@ -658,7 +679,7 @@ const Message = ({ message }: MessageProps) => {
658
679
  >
659
680
  <Pencil size={16} />
660
681
  </button>
661
- <div className="more-options-container" ref={optionsRef}>
682
+ <div className="more-options-container">
662
683
  <button
663
684
  className="message-option-btn more-btn"
664
685
  onClick={() => setShowDeleteOption(!showDeleteOption)}
@@ -359,7 +359,7 @@ const MessageInput = () => {
359
359
  const handleSubmit = useCallback(
360
360
  async (e: React.FormEvent) => {
361
361
  e.preventDefault();
362
- if ((!message && attachmentsRef.current.length === 0) || isSending)
362
+ if ((!message.trim() && attachmentsRef.current.length === 0) || isSending)
363
363
  return;
364
364
  setIsSending(true);
365
365
  setAttachments([]);
@@ -939,6 +939,7 @@
939
939
  padding: 10px;
940
940
  position: sticky;
941
941
  bottom: 0;
942
+ z-index: 2;
942
943
  background: #fff;
943
944
  border-top: 1px solid #eaeaea;
944
945
  }
@@ -1190,6 +1191,7 @@
1190
1191
  }
1191
1192
 
1192
1193
  .attachment-options {
1194
+ width: 150px;
1193
1195
  position: absolute;
1194
1196
  bottom: 100%;
1195
1197
  left: 0;
@@ -1492,7 +1494,7 @@
1492
1494
  border-radius: 18px;
1493
1495
  padding: 4px;
1494
1496
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
1495
- z-index: 10;
1497
+ z-index: 1;
1496
1498
  transition: opacity 0.2s ease;
1497
1499
  }
1498
1500