@memori.ai/memori-react 9.0.0-alpha.18 → 9.0.0-alpha.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.
Files changed (38) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/dist/components/ChatBubble/ChatBubble.css +34 -25
  3. package/dist/components/ChatBubble/ChatBubble.js +54 -44
  4. package/dist/components/ChatBubble/ChatBubble.js.map +1 -1
  5. package/dist/components/ChatHistoryDrawer/ChatResumeDrawer.css +6 -1
  6. package/dist/components/MobileSessionPanel/MobileSessionPanel.css +7 -0
  7. package/dist/components/layouts/FullPage.js +1 -1
  8. package/dist/components/layouts/FullPage.js.map +1 -1
  9. package/dist/components/layouts/ZoomedFullBody.js +1 -1
  10. package/dist/components/layouts/ZoomedFullBody.js.map +1 -1
  11. package/dist/components/layouts/hidden-chat.css +35 -13
  12. package/dist/styles.css +1 -1
  13. package/dist/version.d.ts +1 -1
  14. package/dist/version.js +1 -1
  15. package/esm/components/ChatBubble/ChatBubble.css +34 -25
  16. package/esm/components/ChatBubble/ChatBubble.js +54 -44
  17. package/esm/components/ChatBubble/ChatBubble.js.map +1 -1
  18. package/esm/components/ChatHistoryDrawer/ChatResumeDrawer.css +6 -1
  19. package/esm/components/MobileSessionPanel/MobileSessionPanel.css +7 -0
  20. package/esm/components/layouts/FullPage.js +1 -1
  21. package/esm/components/layouts/FullPage.js.map +1 -1
  22. package/esm/components/layouts/ZoomedFullBody.js +1 -1
  23. package/esm/components/layouts/ZoomedFullBody.js.map +1 -1
  24. package/esm/components/layouts/hidden-chat.css +35 -13
  25. package/esm/styles.css +1 -1
  26. package/esm/version.d.ts +1 -1
  27. package/esm/version.js +1 -1
  28. package/package.json +1 -1
  29. package/src/components/Chat/__snapshots__/Chat.test.tsx.snap +4733 -4449
  30. package/src/components/ChatBubble/ChatBubble.css +34 -25
  31. package/src/components/ChatBubble/ChatBubble.tsx +46 -26
  32. package/src/components/ChatBubble/__snapshots__/ChatBubble.test.tsx.snap +6491 -6387
  33. package/src/components/ChatHistoryDrawer/ChatResumeDrawer.css +6 -1
  34. package/src/components/MobileSessionPanel/MobileSessionPanel.css +7 -0
  35. package/src/components/layouts/FullPage.tsx +2 -1
  36. package/src/components/layouts/ZoomedFullBody.tsx +2 -1
  37. package/src/components/layouts/hidden-chat.css +35 -13
  38. package/src/version.ts +1 -1
@@ -287,9 +287,9 @@
287
287
  .memori-chat--bubble-addon {
288
288
  position: absolute;
289
289
  z-index: 2147483647;
290
- top: auto;
290
+ top: 100%;
291
291
  right: auto;
292
- bottom: 0;
292
+ bottom: auto;
293
293
  left: 0;
294
294
  display: flex;
295
295
  width: max-content;
@@ -307,7 +307,7 @@
307
307
  gap: calc(var(--memori-spacing-xs) * 0.5);
308
308
  opacity: 0;
309
309
  pointer-events: none;
310
- transform: translate3d(0, calc(100% - 2px), 0) scale(0.98);
310
+ transform: translate3d(0, -6px, 0) scale(0.98);
311
311
  transition:
312
312
  opacity 0.28s cubic-bezier(0.22, 1, 0.36, 1),
313
313
  transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
@@ -318,24 +318,28 @@
318
318
  padding-left: var(--memori-spacing-sm);
319
319
  }
320
320
 
321
- /* Stack the addon on the bubble cell so it sits just under the message
322
- (not under artifacts/media further down the shell). */
323
- .memori-chat--bubble-shell--has-addon {
324
- display: grid;
325
- align-items: start;
326
- grid-template-columns: minmax(0, 1fr);
321
+ /* Anchor bubble + addon so the action row sits directly under the message,
322
+ not under artifacts/media rendered below in the shell. */
323
+ .memori-chat--bubble-anchor {
324
+ position: relative;
325
+ display: inline-flex;
326
+ max-width: 100%;
327
+ flex-direction: column;
328
+ align-items: flex-start;
327
329
  }
328
330
 
329
- .memori-chat--bubble-shell--from-user .memori-chat--bubble-addon {
330
- right: 0;
331
- left: auto;
332
- justify-self: end;
331
+ .memori-chat--bubble-anchor--from-user {
332
+ align-items: flex-end;
333
333
  }
334
334
 
335
- .memori-chat--bubble-shell--has-addon > .memori-chat--bubble,
336
- .memori-chat--bubble-shell--has-addon > .memori-chat--bubble-addon {
337
- grid-column: 1;
338
- grid-row: 1;
335
+ .memori-chat--bubble-anchor--has-addon {
336
+ /* Keep the translated addon inside the hover hit area on desktop. */
337
+ padding-bottom: calc(var(--memori-spacing-md) + var(--memori-spacing-xs));
338
+ }
339
+
340
+ .memori-chat--bubble-anchor--from-user .memori-chat--bubble-addon {
341
+ right: 0;
342
+ left: auto;
339
343
  }
340
344
 
341
345
  .memori-chat--artifact-block {
@@ -347,18 +351,18 @@
347
351
  max-width: 100%;
348
352
  }
349
353
 
350
- .memori-chat--bubble-shell--has-addon:focus-within .memori-chat--bubble-addon,
354
+ .memori-chat--bubble-anchor--has-addon:focus-within .memori-chat--bubble-addon,
351
355
  .memori-chat--bubble-container.memori-chat--addon-open .memori-chat--bubble-addon {
352
356
  opacity: 1;
353
357
  pointer-events: auto;
354
- transform: translate3d(0, calc(100% + 4px), 0) scale(1);
358
+ transform: translate3d(0, -8px, 0) scale(1);
355
359
  }
356
360
 
357
361
  .memori-chat--bubble-container.memori-chat--with-addon .memori-chat--bubble {
358
362
  min-width: fit-content;
359
363
  }
360
364
 
361
- .memori-chat--bubble-shell--has-addon:focus-within .memori-chat--bubble,
365
+ .memori-chat--bubble-anchor--has-addon:focus-within .memori-chat--bubble,
362
366
  .memori-chat--bubble-container.memori-chat--addon-open .memori-chat--bubble {
363
367
  box-shadow: var(--memori-chat-addon-elevation);
364
368
  }
@@ -373,14 +377,14 @@
373
377
  .memori-chat--bubble-container.memori-chat--with-addon:focus-within .memori-chat--bubble-addon {
374
378
  opacity: 1;
375
379
  pointer-events: auto;
376
- transform: translate3d(0, calc(100% + 4px), 0) scale(1);
380
+ transform: translate3d(0, -8px, 0) scale(1);
377
381
  }
378
382
 
379
383
  @media (hover: hover) and (pointer: fine) {
380
- .memori-chat--bubble-container.memori-chat--with-addon:hover .memori-chat--bubble-addon {
384
+ .memori-chat--bubble-anchor--has-addon:hover .memori-chat--bubble-addon {
381
385
  opacity: 1;
382
386
  pointer-events: auto;
383
- transform: translate3d(0, calc(100% + 4px), 0) scale(1);
387
+ transform: translate3d(0, -8px, 0) scale(1);
384
388
  }
385
389
  }
386
390
 
@@ -397,11 +401,11 @@
397
401
  }
398
402
 
399
403
  @media (hover: hover) and (pointer: fine) {
400
- .memori-chat--bubble-container.memori-chat--with-addon:hover .memori-chat--bubble {
404
+ .memori-chat--bubble-anchor--has-addon:hover .memori-chat--bubble {
401
405
  box-shadow: var(--memori-chat-addon-elevation);
402
406
  }
403
407
 
404
- .memori-chat--bubble-container.memori-chat--with-addon:hover .memori-chat--bubble.memori-chat--user-bubble {
408
+ .memori-chat--bubble-anchor--has-addon:hover .memori-chat--bubble.memori-chat--user-bubble {
405
409
  box-shadow: var(--memori-chat-addon-elevation);
406
410
  }
407
411
  }
@@ -410,6 +414,11 @@
410
414
  display: inline-flex;
411
415
  }
412
416
 
417
+ /* Portal to widget surface so tooltip anchoring is not thrown off by the addon transform. */
418
+ .memori-chat--bubble-addon-tooltip-positioner {
419
+ z-index: 2147483647;
420
+ }
421
+
413
422
  .memori-chat--bubble-addon button {
414
423
  transition: all 0.3s ease-in-out;
415
424
  }
@@ -446,7 +446,15 @@ const ChatBubble: React.FC<Props> = ({
446
446
  }
447
447
 
448
448
  const shouldShowTimestampInAddon =
449
- !!formattedTimestamp && (!message.fromUser || isChatlogPanel);
449
+ !!formattedTimestamp && !message.fromUser && !isChatlogPanel;
450
+ const bubbleAddonTooltipProps = {
451
+ container: surfaceEl ?? undefined,
452
+ slotProps: {
453
+ positioner: {
454
+ className: 'memori-chat--bubble-addon-tooltip-positioner',
455
+ },
456
+ },
457
+ } as const;
450
458
  const shouldShowBubbleAddon =
451
459
  shouldShowTimestampInAddon ||
452
460
  shouldShowCopyButtons ||
@@ -558,7 +566,12 @@ const ChatBubble: React.FC<Props> = ({
558
566
  <div
559
567
  className={cx('memori-chat--bubble-shell', {
560
568
  'memori-chat--bubble-shell--from-user': !!message.fromUser,
561
- 'memori-chat--bubble-shell--has-addon': shouldShowBubbleAddon,
569
+ })}
570
+ >
571
+ <div
572
+ className={cx('memori-chat--bubble-anchor', {
573
+ 'memori-chat--bubble-anchor--from-user': !!message.fromUser,
574
+ 'memori-chat--bubble-anchor--has-addon': shouldShowBubbleAddon,
562
575
  })}
563
576
  >
564
577
  <div
@@ -597,30 +610,6 @@ const ChatBubble: React.FC<Props> = ({
597
610
  )}
598
611
  </div>
599
612
 
600
- {!message.fromUser && (
601
- <div
602
- className={cx('memori-chat--artifact-block', {
603
- 'memori-chat--artifact-block--chatlog': isChatlogPanel,
604
- })}
605
- >
606
- <ArtifactHandler
607
- isChatlogPanel={isChatlogPanel}
608
- message={message}
609
- />
610
- </div>
611
- )}
612
-
613
- <MediaWidget
614
- simulateUserPrompt={simulateUserPrompt}
615
- media={codeMediaWidgetMedia}
616
- sessionID={sessionID}
617
- baseUrl={baseUrl}
618
- apiUrl={apiUrl}
619
- translateTo={translateTo}
620
- customMediaRenderer={customMediaRenderer}
621
- fromUser={message.fromUser}
622
- />
623
-
624
613
  {shouldShowBubbleAddon && (
625
614
  <div className="memori-chat--bubble-addon">
626
615
  {shouldShowTimestampInAddon && (
@@ -637,6 +626,7 @@ const ChatBubble: React.FC<Props> = ({
637
626
  )}
638
627
  {shouldShowCopyButtons && (
639
628
  <Tooltip
629
+ {...bubbleAddonTooltipProps}
640
630
  placement="bottom"
641
631
  content={
642
632
  copyStatus.plain === 'success'
@@ -690,6 +680,7 @@ const ChatBubble: React.FC<Props> = ({
690
680
 
691
681
  {shouldShowCopyRawButton && (
692
682
  <Tooltip
683
+ {...bubbleAddonTooltipProps}
693
684
  placement="bottom"
694
685
  content={
695
686
  copyStatus.raw === 'success'
@@ -749,6 +740,7 @@ const ChatBubble: React.FC<Props> = ({
749
740
  m.properties?.functionCache === 'true'
750
741
  ) && (
751
742
  <Tooltip
743
+ {...bubbleAddonTooltipProps}
752
744
  placement="bottom"
753
745
  content={t('functionCache') || 'Function cache'}
754
746
  className="memori-chat--bubble-action-icon memori-chat--bubble-action-icon--debug"
@@ -782,6 +774,7 @@ const ChatBubble: React.FC<Props> = ({
782
774
 
783
775
  {message.generatedByAI && showAIicon && (
784
776
  <Tooltip
777
+ {...bubbleAddonTooltipProps}
785
778
  placement="bottom"
786
779
  content={t('generatedByAI')}
787
780
  className="memori-chat--bubble-action-icon memori-chat--bubble-action-icon--ai"
@@ -805,6 +798,7 @@ const ChatBubble: React.FC<Props> = ({
805
798
  message.translatedText &&
806
799
  message.translatedText !== message.text && (
807
800
  <Tooltip
801
+ {...bubbleAddonTooltipProps}
808
802
  placement="bottom"
809
803
  content={`${
810
804
  lang === 'it' ? 'Testo originale' : 'Original text'
@@ -831,6 +825,7 @@ const ChatBubble: React.FC<Props> = ({
831
825
  apiUrl &&
832
826
  showWhyThisAnswer && (
833
827
  <Tooltip
828
+ {...bubbleAddonTooltipProps}
834
829
  placement="bottom"
835
830
  content={t('whyThisAnswer') || 'Why this answer?'}
836
831
  >
@@ -851,6 +846,31 @@ const ChatBubble: React.FC<Props> = ({
851
846
  )}
852
847
  </div>
853
848
 
849
+ {!message.fromUser && (
850
+ <div
851
+ className={cx('memori-chat--artifact-block', {
852
+ 'memori-chat--artifact-block--chatlog': isChatlogPanel,
853
+ })}
854
+ >
855
+ <ArtifactHandler
856
+ isChatlogPanel={isChatlogPanel}
857
+ message={message}
858
+ />
859
+ </div>
860
+ )}
861
+
862
+ <MediaWidget
863
+ simulateUserPrompt={simulateUserPrompt}
864
+ media={codeMediaWidgetMedia}
865
+ sessionID={sessionID}
866
+ baseUrl={baseUrl}
867
+ apiUrl={apiUrl}
868
+ translateTo={translateTo}
869
+ customMediaRenderer={customMediaRenderer}
870
+ fromUser={message.fromUser}
871
+ />
872
+ </div>
873
+
854
874
  {message.fromUser && renderUserAvatar()}
855
875
  </div>
856
876
  </div>