@ermis-network/ermis-chat-react 1.0.9 → 2.0.1

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/README.md +144 -0
  2. package/dist/index.cjs +8320 -3427
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.css +1277 -291
  5. package/dist/index.css.map +1 -1
  6. package/dist/index.d.mts +1131 -99
  7. package/dist/index.d.ts +1131 -99
  8. package/dist/index.mjs +8168 -3319
  9. package/dist/index.mjs.map +1 -1
  10. package/package.json +9 -4
  11. package/src/channelTypeUtils.ts +1 -1
  12. package/src/components/Avatar.tsx +2 -1
  13. package/src/components/Channel.tsx +6 -5
  14. package/src/components/ChannelActions.tsx +67 -3
  15. package/src/components/ChannelHeader.tsx +27 -37
  16. package/src/components/ChannelInfo/AddMemberModal.tsx +12 -2
  17. package/src/components/ChannelInfo/ChannelInfo.tsx +410 -187
  18. package/src/components/ChannelInfo/ChannelInfoTabs.tsx +59 -297
  19. package/src/components/ChannelInfo/ChannelSettingsPanel.tsx +30 -174
  20. package/src/components/ChannelInfo/EditChannelModal.tsx +6 -3
  21. package/src/components/ChannelInfo/MediaGridItem.tsx +215 -68
  22. package/src/components/ChannelInfo/MemberListItem.tsx +2 -3
  23. package/src/components/ChannelInfo/MessageSearchPanel.tsx +27 -126
  24. package/src/components/ChannelInfo/States.tsx +1 -1
  25. package/src/components/ChannelInfo/index.ts +3 -0
  26. package/src/components/ChannelInfo/useChannelInfoTabs.tsx +427 -0
  27. package/src/components/ChannelInfo/useChannelSettings.ts +212 -0
  28. package/src/components/ChannelInfo/useMessageSearch.tsx +141 -0
  29. package/src/components/ChannelList.tsx +247 -301
  30. package/src/components/CreateChannelModal.tsx +290 -93
  31. package/src/components/Dropdown.tsx +1 -16
  32. package/src/components/EditPreview.tsx +1 -0
  33. package/src/components/ErmisCallProvider.tsx +72 -17
  34. package/src/components/ErmisCallUI.tsx +43 -20
  35. package/src/components/FilesPreview.tsx +8 -12
  36. package/src/components/FlatTopicGroupItem.tsx +243 -0
  37. package/src/components/ForwardMessageModal.tsx +43 -81
  38. package/src/components/MediaLightbox.tsx +454 -292
  39. package/src/components/MentionSuggestions.tsx +47 -35
  40. package/src/components/MessageActionsBox.tsx +6 -1
  41. package/src/components/MessageInput.tsx +165 -17
  42. package/src/components/MessageInputDefaults.tsx +127 -1
  43. package/src/components/MessageItem.tsx +155 -43
  44. package/src/components/MessageQuickReactions.tsx +153 -23
  45. package/src/components/MessageReactions.tsx +49 -3
  46. package/src/components/MessageRenderers.tsx +1114 -445
  47. package/src/components/Panel.tsx +1 -14
  48. package/src/components/PinnedMessages.tsx +55 -15
  49. package/src/components/PreviewOverlay.tsx +24 -0
  50. package/src/components/QuotedMessagePreview.tsx +99 -8
  51. package/src/components/ReadReceipts.tsx +2 -1
  52. package/src/components/RecoveryPin/RecoveryPin.tsx +279 -0
  53. package/src/components/RecoveryPin/index.ts +19 -0
  54. package/src/components/TopicList.tsx +236 -0
  55. package/src/components/TopicModal.tsx +4 -1
  56. package/src/components/TypingIndicator.tsx +17 -8
  57. package/src/components/UserPicker.tsx +94 -16
  58. package/src/components/VirtualMessageList.tsx +419 -113
  59. package/src/context/ChatComponentsContext.tsx +14 -0
  60. package/src/context/ChatProvider.tsx +44 -14
  61. package/src/context/ErmisCallContext.tsx +4 -0
  62. package/src/hooks/useChannelCapabilities.ts +7 -4
  63. package/src/hooks/useChannelData.ts +10 -3
  64. package/src/hooks/useChannelListUpdates.ts +94 -21
  65. package/src/hooks/useChannelMessages.ts +391 -42
  66. package/src/hooks/useChannelRowUpdates.ts +36 -5
  67. package/src/hooks/useChatUser.ts +39 -0
  68. package/src/hooks/useContactChannels.ts +45 -0
  69. package/src/hooks/useContactCount.ts +50 -0
  70. package/src/hooks/useDownloadHandler.ts +36 -0
  71. package/src/hooks/useDragAndDrop.ts +79 -0
  72. package/src/hooks/useE2eeAttachmentRenderer.ts +204 -0
  73. package/src/hooks/useE2eeFileUpload.ts +38 -0
  74. package/src/hooks/useFileUpload.ts +25 -5
  75. package/src/hooks/useForwardMessage.ts +309 -0
  76. package/src/hooks/useInviteChannels.ts +88 -0
  77. package/src/hooks/useInviteCount.ts +104 -0
  78. package/src/hooks/useLoadMessages.ts +16 -4
  79. package/src/hooks/useMentions.ts +60 -7
  80. package/src/hooks/useMessageActions.ts +19 -10
  81. package/src/hooks/useMessageSend.ts +64 -12
  82. package/src/hooks/usePendingE2eeSends.ts +29 -0
  83. package/src/hooks/usePendingState.ts +21 -4
  84. package/src/hooks/usePreviewState.ts +69 -0
  85. package/src/hooks/useRecoveryPin.ts +287 -0
  86. package/src/hooks/useScrollToMessage.ts +29 -4
  87. package/src/hooks/useStickerPicker.ts +62 -0
  88. package/src/hooks/useTopicGroupUpdates.ts +235 -0
  89. package/src/index.ts +79 -6
  90. package/src/messageTypeUtils.ts +27 -1
  91. package/src/styles/_base.css +0 -1
  92. package/src/styles/_call-ui.css +59 -2
  93. package/src/styles/_channel-info.css +50 -4
  94. package/src/styles/_channel-list.css +131 -68
  95. package/src/styles/_create-channel-modal.css +10 -0
  96. package/src/styles/_forward-modal.css +16 -1
  97. package/src/styles/_media-lightbox.css +67 -2
  98. package/src/styles/_mentions.css +1 -1
  99. package/src/styles/_message-actions.css +3 -4
  100. package/src/styles/_message-bubble.css +631 -112
  101. package/src/styles/_message-input.css +139 -0
  102. package/src/styles/_message-list.css +91 -18
  103. package/src/styles/_message-quick-reactions.css +105 -32
  104. package/src/styles/_message-reactions.css +22 -32
  105. package/src/styles/_modal.css +2 -1
  106. package/src/styles/_preview-overlay.css +38 -0
  107. package/src/styles/_recovery-pin.css +97 -0
  108. package/src/styles/_tokens.css +22 -20
  109. package/src/styles/_typing-indicator.css +26 -10
  110. package/src/styles/index.css +2 -0
  111. package/src/types.ts +477 -15
  112. package/src/utils/avatarColors.ts +48 -0
  113. package/src/utils.ts +219 -16
@@ -0,0 +1,97 @@
1
+ .ermis-recovery-pin {
2
+ display: flex;
3
+ flex-direction: column;
4
+ gap: 10px;
5
+ width: 100%;
6
+ }
7
+
8
+ .ermis-recovery-pin__header {
9
+ align-items: center;
10
+ display: flex;
11
+ gap: 8px;
12
+ justify-content: space-between;
13
+ }
14
+
15
+ .ermis-recovery-pin__header h3 {
16
+ font-size: 16px;
17
+ font-weight: 600;
18
+ line-height: 1.3;
19
+ margin: 0;
20
+ }
21
+
22
+ .ermis-recovery-pin__badge,
23
+ .ermis-recovery-status {
24
+ border: 1px solid var(--ermis-border-color, #d7dde5);
25
+ border-radius: 999px;
26
+ color: var(--ermis-text-muted, #596579);
27
+ display: inline-flex;
28
+ font-size: 12px;
29
+ font-weight: 600;
30
+ line-height: 1;
31
+ padding: 5px 8px;
32
+ white-space: nowrap;
33
+ }
34
+
35
+ .ermis-recovery-pin__input {
36
+ background: var(--ermis-input-bg, #fff);
37
+ border: 1px solid var(--ermis-border-color, #d7dde5);
38
+ border-radius: 8px;
39
+ color: var(--ermis-text-color, #111827);
40
+ font-size: 14px;
41
+ min-height: 38px;
42
+ padding: 8px 10px;
43
+ }
44
+
45
+ .ermis-recovery-pin__button {
46
+ align-items: center;
47
+ background: var(--ermis-primary-color, #2563eb);
48
+ border: 0;
49
+ border-radius: 8px;
50
+ color: #fff;
51
+ cursor: pointer;
52
+ display: inline-flex;
53
+ font-size: 14px;
54
+ font-weight: 600;
55
+ justify-content: center;
56
+ min-height: 38px;
57
+ padding: 8px 12px;
58
+ }
59
+
60
+ .ermis-recovery-pin__button:disabled {
61
+ cursor: not-allowed;
62
+ opacity: 0.55;
63
+ }
64
+
65
+ .ermis-recovery-pin__error,
66
+ .ermis-recovery-gap {
67
+ background: var(--ermis-danger-bg, #fff1f2);
68
+ border: 1px solid var(--ermis-danger-border, #fecdd3);
69
+ border-radius: 8px;
70
+ color: var(--ermis-danger-color, #be123c);
71
+ font-size: 13px;
72
+ line-height: 1.4;
73
+ padding: 8px 10px;
74
+ }
75
+
76
+ .ermis-recovery-status--ready {
77
+ background: var(--ermis-success-bg, #ecfdf5);
78
+ border-color: var(--ermis-success-border, #bbf7d0);
79
+ color: var(--ermis-success-color, #047857);
80
+ }
81
+
82
+ .ermis-recovery-status--working {
83
+ background: var(--ermis-info-bg, #eff6ff);
84
+ border-color: var(--ermis-info-border, #bfdbfe);
85
+ color: var(--ermis-info-color, #1d4ed8);
86
+ }
87
+
88
+ .ermis-recovery-status--locked,
89
+ .ermis-recovery-status--idle {
90
+ background: var(--ermis-muted-bg, #f8fafc);
91
+ }
92
+
93
+ .ermis-recovery-status--error {
94
+ background: var(--ermis-danger-bg, #fff1f2);
95
+ border-color: var(--ermis-danger-border, #fecdd3);
96
+ color: var(--ermis-danger-color, #be123c);
97
+ }
@@ -12,12 +12,13 @@
12
12
  --ermis-bg-secondary: #111118;
13
13
  --ermis-bg-hover: rgba(255, 255, 255, 0.04);
14
14
  --ermis-bg-active: rgba(99, 102, 241, 0.12);
15
+ --ermis-bg-overlay: rgba(0, 0, 0, 0.4);
15
16
  --ermis-border: rgba(255, 255, 255, 0.08);
16
17
  --ermis-accent: #6366f1;
17
18
  --ermis-accent-hover: #818cf8;
18
19
  --ermis-text-primary: #e5e7eb;
19
- --ermis-text-secondary: #9ca3af;
20
- --ermis-text-muted: #6b7280;
20
+ --ermis-text-secondary: #abb4c6;
21
+ --ermis-text-muted: #abb4c6;
21
22
 
22
23
  /* Semantic Colors */
23
24
  --ermis-color-danger: #ef4444;
@@ -34,14 +35,14 @@
34
35
  /* Quote message */
35
36
  --ermis-quote-other-bg: rgba(99, 102, 241, 0.1);
36
37
  --ermis-quote-other-bg-hover: rgba(99, 102, 241, 0.18);
37
- --ermis-quote-own-bg: rgba(99, 102, 241, 0.2);
38
- --ermis-quote-own-bg-hover: rgba(99, 102, 241, 0.3);
39
- --ermis-quote-own-border: rgba(255, 255, 255, 0.4);
40
- --ermis-quote-own-author: rgba(255, 255, 255, 0.9);
41
- --ermis-quote-own-text: rgba(255, 255, 255, 0.65);
38
+ --ermis-quote-own-bg: rgba(255, 255, 255, 0.2);
39
+ --ermis-quote-own-bg-hover: rgba(255, 255, 255, 0.3);
40
+ --ermis-quote-own-border: rgba(255, 255, 255, 0.5);
41
+ --ermis-quote-own-author: #ffffff;
42
+ --ermis-quote-own-text: rgba(255, 255, 255, 0.75);
42
43
 
43
44
  /* Typography */
44
- --ermis-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,
45
+ --ermis-font-family: 'SF Pro Display', 'SF Pro Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,
45
46
  'Helvetica Neue', sans-serif;
46
47
  --ermis-font-size-xs: 0.75rem;
47
48
  --ermis-font-size-sm: 0.875rem;
@@ -89,12 +90,13 @@
89
90
  --ermis-bg-secondary: #f9fafb;
90
91
  --ermis-bg-hover: rgba(0, 0, 0, 0.04);
91
92
  --ermis-bg-active: rgba(99, 102, 241, 0.08);
93
+ --ermis-bg-overlay: rgba(255, 255, 255, 0.6);
92
94
  --ermis-border: rgba(0, 0, 0, 0.08);
93
- --ermis-accent: #6366f1;
94
- --ermis-accent-hover: #4f46e5;
95
+ --ermis-accent: #3436b6;
96
+ --ermis-accent-hover: #0d00ff;
95
97
  --ermis-text-primary: #111827;
96
98
  --ermis-text-secondary: #6b7280;
97
- --ermis-text-muted: #9ca3af;
99
+ --ermis-text-muted: #545f71;
98
100
 
99
101
  /* Semantic Colors */
100
102
  --ermis-color-danger: #ef4444;
@@ -105,17 +107,17 @@
105
107
  /* Message bubbles */
106
108
  --ermis-bubble-own-bg: var(--ermis-accent);
107
109
  --ermis-bubble-own-text: #ffffff;
108
- --ermis-bubble-other-bg: #f3f4f6;
110
+ --ermis-bubble-other-bg: #f0f2f5;
109
111
  --ermis-bubble-other-text: var(--ermis-text-primary);
110
112
 
111
113
  /* Quote message */
112
- --ermis-quote-other-bg: rgba(99, 102, 241, 0.08);
113
- --ermis-quote-other-bg-hover: rgba(99, 102, 241, 0.14);
114
- --ermis-quote-own-bg: rgba(0, 0, 0, 0.25);
115
- --ermis-quote-own-bg-hover: rgba(0, 0, 0, 0.4);
116
- --ermis-quote-own-border: rgba(255, 255, 255, 0.6);
117
- --ermis-quote-own-author: rgba(255, 255, 255, 0.95);
118
- --ermis-quote-own-text: rgba(255, 255, 255, 0.8);
114
+ --ermis-quote-other-bg: rgba(99, 102, 241, 0.06);
115
+ --ermis-quote-other-bg-hover: rgba(99, 102, 241, 0.12);
116
+ --ermis-quote-own-bg: rgba(255, 255, 255, 0.3);
117
+ --ermis-quote-own-bg-hover: rgba(255, 255, 255, 0.4);
118
+ --ermis-quote-own-border: rgba(255, 255, 255, 0.7);
119
+ --ermis-quote-own-author: #ffffff;
120
+ --ermis-quote-own-text: rgba(255, 255, 255, 0.85);
119
121
 
120
122
  /* Signal messages (call events) */
121
123
  --ermis-signal-success: #229A16;
@@ -131,4 +133,4 @@
131
133
  --ermis-call-glass: rgba(0, 0, 0, 0.04);
132
134
  --ermis-call-glass-border: rgba(0, 0, 0, 0.08);
133
135
  --ermis-call-pulse: rgba(99, 102, 241, 0.3);
134
- }
136
+ }
@@ -2,33 +2,47 @@
2
2
  Typing Indicator
3
3
  ============================================================ */
4
4
 
5
- /* Container always rendered with fixed height to prevent layout shifts */
5
+ /* Floats above the input area without taking layout space.
6
+ Height is 0 so messages/input don't jump; content overflows upward. */
7
+ .ermis-typing-indicator-wrapper {
8
+ height: 0;
9
+ overflow: visible;
10
+ padding-left: 16px;
11
+ position: relative;
12
+ z-index: 10;
13
+ }
14
+
6
15
  .ermis-typing-indicator {
7
- display: flex;
16
+ display: inline-flex;
8
17
  align-items: center;
9
18
  gap: 6px;
10
- padding: 0 16px;
11
- height: 24px;
12
19
  font-size: 12px;
13
20
  color: var(--ermis-text-secondary);
14
- overflow: hidden;
21
+ background-color: var(--ermis-bg-primary, #fff);
22
+ padding: 4px 12px;
23
+ border-radius: 999px;
24
+ border: 1px solid var(--ermis-border, rgba(0, 0, 0, 0.08));
25
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
26
+ transform: translateY(-100%);
27
+ margin-bottom: 8px;
28
+ animation: ermis-typing-appear 0.2s ease-out forwards;
15
29
  }
16
30
 
17
31
  .ermis-typing-indicator__dots {
18
32
  display: flex;
19
33
  align-items: center;
20
34
  gap: 3px;
21
- animation: ermis-typing-appear 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
22
35
  }
23
36
 
24
37
  @keyframes ermis-typing-appear {
25
38
  0% {
26
39
  opacity: 0;
27
- transform: translateY(8px);
40
+ transform: translateY(calc(-100% + 4px));
28
41
  }
42
+
29
43
  100% {
30
44
  opacity: 1;
31
- transform: translateY(0);
45
+ transform: translateY(-100%);
32
46
  }
33
47
  }
34
48
 
@@ -53,10 +67,13 @@
53
67
  }
54
68
 
55
69
  @keyframes ermis-typing-bounce {
56
- 0%, 80%, 100% {
70
+ 0%,
71
+ 80%,
72
+ 100% {
57
73
  transform: scale(0.6);
58
74
  opacity: 0.4;
59
75
  }
76
+
60
77
  40% {
61
78
  transform: scale(1);
62
79
  opacity: 1;
@@ -68,5 +85,4 @@
68
85
  white-space: nowrap;
69
86
  overflow: hidden;
70
87
  text-overflow: ellipsis;
71
- animation: ermis-typing-appear 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
72
88
  }
@@ -27,3 +27,5 @@
27
27
  @import './_call-ui.css';
28
28
  @import './_topic-modal.css';
29
29
  @import './_media-lightbox.css';
30
+ @import './_preview-overlay.css';
31
+ @import './_recovery-pin.css';