@ermis-network/ermis-chat-react 1.0.8 → 2.0.0

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 (99) hide show
  1. package/dist/index.cjs +15295 -4209
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.css +701 -195
  4. package/dist/index.css.map +1 -1
  5. package/dist/index.d.mts +862 -94
  6. package/dist/index.d.ts +862 -94
  7. package/dist/index.mjs +15246 -4186
  8. package/dist/index.mjs.map +1 -1
  9. package/package.json +9 -4
  10. package/src/channelTypeUtils.ts +1 -1
  11. package/src/components/Avatar.tsx +2 -1
  12. package/src/components/Channel.tsx +6 -2
  13. package/src/components/ChannelActions.tsx +61 -2
  14. package/src/components/ChannelHeader.tsx +19 -5
  15. package/src/components/ChannelInfo/AddMemberModal.tsx +5 -1
  16. package/src/components/ChannelInfo/ChannelInfo.tsx +330 -187
  17. package/src/components/ChannelInfo/ChannelInfoTabs.tsx +59 -297
  18. package/src/components/ChannelInfo/ChannelSettingsPanel.tsx +30 -174
  19. package/src/components/ChannelInfo/EditChannelModal.tsx +4 -1
  20. package/src/components/ChannelInfo/MediaGridItem.tsx +12 -2
  21. package/src/components/ChannelInfo/MemberListItem.tsx +2 -3
  22. package/src/components/ChannelInfo/MessageSearchPanel.tsx +27 -126
  23. package/src/components/ChannelInfo/States.tsx +1 -1
  24. package/src/components/ChannelInfo/index.ts +3 -0
  25. package/src/components/ChannelInfo/useChannelInfoTabs.tsx +386 -0
  26. package/src/components/ChannelInfo/useChannelSettings.ts +212 -0
  27. package/src/components/ChannelInfo/useMessageSearch.tsx +141 -0
  28. package/src/components/ChannelList.tsx +177 -290
  29. package/src/components/CreateChannelModal.tsx +166 -88
  30. package/src/components/Dropdown.tsx +1 -16
  31. package/src/components/EditPreview.tsx +1 -0
  32. package/src/components/ErmisCallProvider.tsx +72 -17
  33. package/src/components/ErmisCallUI.tsx +43 -20
  34. package/src/components/FlatTopicGroupItem.tsx +232 -0
  35. package/src/components/ForwardMessageModal.tsx +31 -77
  36. package/src/components/MediaLightbox.tsx +62 -40
  37. package/src/components/MentionSuggestions.tsx +47 -35
  38. package/src/components/MessageActionsBox.tsx +4 -1
  39. package/src/components/MessageInput.tsx +137 -16
  40. package/src/components/MessageInputDefaults.tsx +127 -1
  41. package/src/components/MessageItem.tsx +93 -26
  42. package/src/components/MessageQuickReactions.tsx +153 -26
  43. package/src/components/MessageReactions.tsx +2 -1
  44. package/src/components/MessageRenderers.tsx +111 -39
  45. package/src/components/Panel.tsx +1 -14
  46. package/src/components/PinnedMessages.tsx +17 -5
  47. package/src/components/PreviewOverlay.tsx +24 -0
  48. package/src/components/ReadReceipts.tsx +2 -1
  49. package/src/components/TopicList.tsx +221 -0
  50. package/src/components/TopicModal.tsx +4 -1
  51. package/src/components/TypingIndicator.tsx +14 -5
  52. package/src/components/UserPicker.tsx +87 -10
  53. package/src/components/VirtualMessageList.tsx +106 -20
  54. package/src/context/ChatComponentsContext.tsx +14 -0
  55. package/src/context/ChatProvider.tsx +18 -14
  56. package/src/context/ErmisCallContext.tsx +4 -0
  57. package/src/hooks/useChannelCapabilities.ts +7 -4
  58. package/src/hooks/useChannelData.ts +10 -3
  59. package/src/hooks/useChannelListUpdates.ts +72 -20
  60. package/src/hooks/useChannelMessages.ts +72 -10
  61. package/src/hooks/useChannelRowUpdates.ts +24 -5
  62. package/src/hooks/useChatUser.ts +31 -0
  63. package/src/hooks/useContactChannels.ts +45 -0
  64. package/src/hooks/useContactCount.ts +50 -0
  65. package/src/hooks/useDownloadHandler.ts +36 -0
  66. package/src/hooks/useDragAndDrop.ts +79 -0
  67. package/src/hooks/useForwardMessage.ts +112 -0
  68. package/src/hooks/useInviteChannels.ts +88 -0
  69. package/src/hooks/useInviteCount.ts +104 -0
  70. package/src/hooks/useMentions.ts +0 -1
  71. package/src/hooks/useMessageActions.ts +13 -10
  72. package/src/hooks/usePendingState.ts +21 -4
  73. package/src/hooks/usePreviewState.ts +69 -0
  74. package/src/hooks/useStickerPicker.ts +62 -0
  75. package/src/hooks/useTopicGroupUpdates.ts +197 -0
  76. package/src/index.ts +56 -6
  77. package/src/messageTypeUtils.ts +13 -1
  78. package/src/styles/_base.css +0 -1
  79. package/src/styles/_call-ui.css +59 -2
  80. package/src/styles/_channel-info.css +41 -4
  81. package/src/styles/_channel-list.css +97 -57
  82. package/src/styles/_create-channel-modal.css +10 -0
  83. package/src/styles/_forward-modal.css +16 -1
  84. package/src/styles/_media-lightbox.css +32 -0
  85. package/src/styles/_mentions.css +1 -1
  86. package/src/styles/_message-actions.css +3 -4
  87. package/src/styles/_message-bubble.css +286 -107
  88. package/src/styles/_message-input.css +131 -0
  89. package/src/styles/_message-list.css +33 -17
  90. package/src/styles/_message-quick-reactions.css +40 -9
  91. package/src/styles/_message-reactions.css +4 -0
  92. package/src/styles/_modal.css +2 -1
  93. package/src/styles/_preview-overlay.css +38 -0
  94. package/src/styles/_tokens.css +17 -15
  95. package/src/styles/_typing-indicator.css +7 -1
  96. package/src/styles/index.css +1 -0
  97. package/src/types.ts +362 -14
  98. package/src/utils/avatarColors.ts +48 -0
  99. package/src/utils.ts +193 -10
@@ -245,7 +245,7 @@
245
245
 
246
246
  .ermis-channel-list__pinned-icon {
247
247
  position: absolute;
248
- top: -5px;
248
+ top: 0px;
249
249
  right: 0px;
250
250
  color: var(--ermis-color-danger, #ef4444);
251
251
  display: inline-flex;
@@ -265,6 +265,11 @@
265
265
  color: var(--ermis-text-secondary);
266
266
  }
267
267
 
268
+ .ermis-channel-list__item-last-message-source {
269
+ color: var(--ermis-accent);
270
+ font-weight: 500;
271
+ }
272
+
268
273
  .ermis-channel-list__item-actions-wrapper,
269
274
  .ermis-channel-list__topic-actions-wrapper {
270
275
  position: absolute;
@@ -397,91 +402,126 @@
397
402
  transform: rotate(0deg);
398
403
  }
399
404
 
400
- /* --- Topic Group --- */
401
- .ermis-channel-list__topic-group {
405
+ /* --- Topic Hashtag Avatar (used by TopicList) --- */
406
+ .ermis-channel-list__topic-hashtag {
402
407
  display: flex;
403
- flex-direction: column;
408
+ align-items: center;
409
+ justify-content: center;
410
+ width: 24px;
411
+ height: 24px;
412
+ background-color: transparent;
413
+ color: var(--ermis-text-muted);
414
+ border-radius: var(--ermis-radius-full);
415
+ font-size: 0.95rem;
416
+ font-weight: 600;
417
+ flex-shrink: 0;
404
418
  }
405
419
 
406
- .ermis-channel-list__topic-header {
420
+ /* --- Topic Pills (FlatTopicGroupItem) --- */
421
+ .ermis-channel-list__topic-pills {
407
422
  display: flex;
408
423
  align-items: center;
409
- gap: var(--ermis-spacing-md);
410
- padding: var(--ermis-spacing-md) var(--ermis-spacing-lg);
411
- cursor: pointer;
412
- border-left: 2px solid transparent;
413
- transition: background-color var(--ermis-transition);
414
- position: relative;
415
- }
416
-
417
- .ermis-channel-list__topic-header:hover {
418
- background-color: var(--ermis-bg-hover);
424
+ gap: var(--ermis-spacing-xs);
425
+ flex: 1;
426
+ min-width: 0;
427
+ overflow: hidden;
419
428
  }
420
429
 
421
- .ermis-channel-list__topic-header-name {
422
- font-size: var(--ermis-font-size-sm);
423
- font-weight: 600;
424
- color: var(--ermis-text-primary);
425
- white-space: nowrap;
426
- overflow: hidden;
427
- text-overflow: ellipsis;
428
- flex: 1;
430
+ .ermis-channel-list__topic-pill {
431
+ display: inline-flex;
432
+ align-items: center;
433
+ gap: 2px;
434
+ max-width: 80px;
435
+ flex-shrink: 0;
429
436
  }
430
437
 
431
- .ermis-channel-list__add-topic-btn {
438
+ .ermis-channel-list__topic-pill-avatar {
439
+ width: 16px;
440
+ height: 16px;
441
+ min-width: 16px;
432
442
  display: flex;
433
443
  align-items: center;
434
444
  justify-content: center;
435
- width: 24px;
436
- height: 24px;
437
- border-radius: var(--ermis-radius-sm);
445
+ font-size: 0.7rem;
446
+ border-radius: var(--ermis-radius-full);
438
447
  background-color: transparent;
439
- color: var(--ermis-text-muted);
440
- border: none;
441
- cursor: pointer;
442
- transition: all var(--ermis-transition);
443
448
  }
444
449
 
445
- .ermis-channel-list__add-topic-btn:hover {
446
- background-color: var(--ermis-bg-primary);
447
- color: var(--ermis-accent);
450
+ .ermis-channel-list__topic-pill-name {
451
+ font-size: var(--ermis-font-size-xs);
452
+ color: var(--ermis-text-muted);
453
+ white-space: nowrap;
454
+ overflow: hidden;
455
+ text-overflow: ellipsis;
456
+ max-width: 60px;
448
457
  }
449
458
 
450
- .ermis-channel-list__topic-header--expanded .ermis-channel-list__accordion-icon {
451
- transform: rotate(0deg);
459
+ .ermis-channel-list__topic-overflow {
460
+ font-size: var(--ermis-font-size-xs);
461
+ color: var(--ermis-text-muted);
462
+ flex-shrink: 0;
463
+ font-weight: 600;
452
464
  }
453
465
 
454
- .ermis-channel-list__topic-sublist {
466
+ /* --- Topics Row (third row in FlatTopicGroupItem) --- */
467
+ .ermis-channel-list__item-topics-row {
455
468
  display: flex;
456
- flex-direction: column;
457
- background-color: var(--ermis-bg-secondary);
469
+ align-items: center;
470
+ gap: var(--ermis-spacing-xs);
471
+ margin-top: 2px;
458
472
  }
459
473
 
460
- /* Indent nested items and provide hierarchical line */
461
- .ermis-channel-list__topic-sublist .ermis-channel-list__item {
462
- padding-left: var(--ermis-spacing-md);
463
- margin-left: 20px;
464
- border-left: 2px solid var(--ermis-border);
474
+ /* --- Error Indicator --- */
475
+ .ermis-channel-list__error {
476
+ display: flex;
477
+ flex-direction: column;
478
+ align-items: center;
479
+ justify-content: center;
480
+ padding: var(--ermis-spacing-xl, 32px) var(--ermis-spacing-lg);
481
+ text-align: center;
482
+ height: 100%;
465
483
  }
466
484
 
467
- .ermis-channel-list__topic-sublist .ermis-channel-list__item:hover {
468
- border-left-color: var(--ermis-border-hover);
485
+ .ermis-channel-list__error-icon {
486
+ color: var(--ermis-color-danger, #ef4444);
487
+ margin-bottom: var(--ermis-spacing-md);
488
+ opacity: 0.8;
469
489
  }
470
490
 
471
- .ermis-channel-list__topic-sublist .ermis-channel-list__item--active {
472
- border-left-color: var(--ermis-accent);
491
+ .ermis-channel-list__error-text {
492
+ font-size: var(--ermis-font-size-sm);
493
+ color: var(--ermis-text-primary);
494
+ font-weight: 500;
495
+ margin-bottom: var(--ermis-spacing-lg);
496
+ max-width: 220px;
497
+ line-height: 1.5;
473
498
  }
474
499
 
475
- .ermis-channel-list__topic-hashtag {
476
- display: flex;
500
+ .ermis-channel-list__error-retry {
501
+ display: inline-flex;
477
502
  align-items: center;
478
503
  justify-content: center;
479
- width: 24px;
480
- height: 24px;
481
- background-color: transparent;
482
- color: var(--ermis-text-muted);
483
- border-radius: var(--ermis-radius-full);
484
- font-size: 0.95rem;
504
+ padding: var(--ermis-spacing-sm, 8px) var(--ermis-spacing-lg, 16px);
505
+ background-color: var(--ermis-bg-primary, #fff);
506
+ color: var(--ermis-text-primary, #111);
507
+ border: 1px solid var(--ermis-border, #e5e7eb);
508
+ border-radius: var(--ermis-radius-md, 8px);
509
+ font-size: var(--ermis-font-size-sm);
485
510
  font-weight: 600;
486
- flex-shrink: 0;
511
+ cursor: pointer;
512
+ transition: all var(--ermis-transition, 0.2s ease);
513
+ }
514
+
515
+ .ermis-channel-list__error-retry:hover {
516
+ background-color: var(--ermis-bg-hover, #f3f4f6);
517
+ border-color: var(--ermis-accent);
518
+ color: var(--ermis-accent);
519
+ }
520
+
521
+ .ermis-channel-list__error-retry svg {
522
+ transition: transform 0.5s ease;
523
+ }
524
+
525
+ .ermis-channel-list__error-retry:hover svg {
526
+ transform: rotate(180deg);
487
527
  }
@@ -121,8 +121,18 @@
121
121
  /* User Picker Wrap */
122
122
  .ermis-create-channel__users {
123
123
  margin-top: var(--ermis-spacing-sm, 0.5rem);
124
+ display: flex;
125
+ flex-direction: column;
124
126
  }
125
127
 
128
+ /* .ermis-create-channel__users--team {
129
+ height: 280px;
130
+ }
131
+
132
+ .ermis-create-channel__users--messaging {
133
+ height: 400px;
134
+ } */
135
+
126
136
  .ermis-create-channel__users-title {
127
137
  font-size: var(--ermis-font-size-sm, 0.875rem);
128
138
  font-weight: 500;
@@ -89,8 +89,14 @@
89
89
  background: var(--ermis-bg-active);
90
90
  }
91
91
 
92
- .ermis-forward-modal__channel-name {
92
+ .ermis-forward-modal__channel-name-container {
93
93
  flex: 1;
94
+ display: flex;
95
+ flex-direction: column;
96
+ overflow: hidden;
97
+ }
98
+
99
+ .ermis-forward-modal__channel-name {
94
100
  font-size: var(--ermis-font-size-sm);
95
101
  color: var(--ermis-text-primary);
96
102
  overflow: hidden;
@@ -98,6 +104,15 @@
98
104
  white-space: nowrap;
99
105
  }
100
106
 
107
+ .ermis-forward-modal__channel-parent-name {
108
+ font-size: var(--ermis-font-size-xs);
109
+ color: var(--ermis-text-muted);
110
+ overflow: hidden;
111
+ text-overflow: ellipsis;
112
+ white-space: nowrap;
113
+ margin-bottom: 2px;
114
+ }
115
+
101
116
  /* Checkbox */
102
117
  .ermis-forward-modal__checkbox {
103
118
  width: 20px;
@@ -120,6 +120,13 @@
120
120
  /* ----------------------------------------------------------
121
121
  Video
122
122
  ---------------------------------------------------------- */
123
+ .ermis-lightbox__video-wrapper {
124
+ position: relative;
125
+ display: flex;
126
+ align-items: center;
127
+ justify-content: center;
128
+ }
129
+
123
130
  .ermis-lightbox__video {
124
131
  max-width: 90vw;
125
132
  max-height: 80vh;
@@ -129,6 +136,31 @@
129
136
  animation: ermis-lightbox-zoom-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
130
137
  }
131
138
 
139
+ /* Retry overlay + spinner shown when video fails to load (CDN not ready) */
140
+ .ermis-lightbox__video-retry {
141
+ position: absolute;
142
+ inset: 0;
143
+ display: flex;
144
+ align-items: center;
145
+ justify-content: center;
146
+ background: rgba(0, 0, 0, 0.5);
147
+ border-radius: 4px;
148
+ pointer-events: none;
149
+ }
150
+
151
+ .ermis-lightbox__video-spinner {
152
+ width: 36px;
153
+ height: 36px;
154
+ border: 3px solid rgba(255, 255, 255, 0.2);
155
+ border-top-color: #fff;
156
+ border-radius: 50%;
157
+ animation: ermis-lightbox-spin 0.8s linear infinite;
158
+ }
159
+
160
+ @keyframes ermis-lightbox-spin {
161
+ to { transform: rotate(360deg); }
162
+ }
163
+
132
164
  /* ----------------------------------------------------------
133
165
  Navigation buttons
134
166
  ---------------------------------------------------------- */
@@ -75,7 +75,7 @@
75
75
 
76
76
  .ermis-mention-suggestions__item:hover,
77
77
  .ermis-mention-suggestions__item--highlighted {
78
- background-color: var(--ermis-bg-secondary);
78
+ background-color: var(--ermis-bg-active);
79
79
  }
80
80
 
81
81
  .ermis-mention-suggestions__name {
@@ -27,12 +27,12 @@
27
27
 
28
28
  /* Position container for other (left) vs own (right) */
29
29
  .ermis-message-list__item--own .ermis-message-list__actions {
30
- right: 100%;
30
+ right: calc(100% + 12px);
31
31
  flex-direction: row-reverse;
32
32
  }
33
33
 
34
34
  .ermis-message-list__item--other .ermis-message-list__actions {
35
- left: 100%;
35
+ left: calc(100% + 12px);
36
36
  }
37
37
 
38
38
  /* Individual action buttons */
@@ -57,5 +57,4 @@
57
57
  .ermis-message-list__actions-trigger:hover:not(:disabled) {
58
58
  background-color: var(--ermis-bg-hover);
59
59
  color: var(--ermis-text-primary);
60
- }
61
-
60
+ }