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

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 (50) hide show
  1. package/dist/index.cjs +2780 -1852
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.css +364 -8
  4. package/dist/index.css.map +1 -1
  5. package/dist/index.d.mts +160 -1
  6. package/dist/index.d.ts +160 -1
  7. package/dist/index.mjs +2780 -1884
  8. package/dist/index.mjs.map +1 -1
  9. package/package.json +2 -2
  10. package/src/channelRoleUtils.ts +73 -0
  11. package/src/channelTypeUtils.ts +46 -0
  12. package/src/components/Avatar.tsx +57 -31
  13. package/src/components/ChannelActions.tsx +13 -11
  14. package/src/components/ChannelHeader.tsx +89 -4
  15. package/src/components/ChannelInfo/ChannelInfo.tsx +23 -17
  16. package/src/components/ChannelInfo/ChannelInfoTabs.tsx +57 -26
  17. package/src/components/ChannelInfo/ChannelSettingsPanel.tsx +4 -2
  18. package/src/components/ChannelInfo/EditChannelModal.tsx +2 -1
  19. package/src/components/ChannelInfo/MemberListItem.tsx +2 -1
  20. package/src/components/ChannelList.tsx +59 -14
  21. package/src/components/CreateChannelModal.tsx +53 -16
  22. package/src/components/EditPreview.tsx +2 -1
  23. package/src/components/ForwardMessageModal.tsx +2 -1
  24. package/src/components/MediaLightbox.tsx +314 -0
  25. package/src/components/MessageInput.tsx +3 -2
  26. package/src/components/MessageItem.tsx +2 -1
  27. package/src/components/MessageRenderers.tsx +168 -46
  28. package/src/components/PendingOverlay.tsx +11 -1
  29. package/src/components/PinnedMessages.tsx +2 -1
  30. package/src/components/ReplyPreview.tsx +2 -1
  31. package/src/components/SkippedOverlay.tsx +36 -0
  32. package/src/components/UserPicker.tsx +1 -1
  33. package/src/components/VirtualMessageList.tsx +91 -7
  34. package/src/hooks/useBlockedState.ts +3 -2
  35. package/src/hooks/useChannelCapabilities.ts +10 -12
  36. package/src/hooks/useChannelListUpdates.ts +6 -4
  37. package/src/hooks/useChannelMessages.ts +2 -3
  38. package/src/hooks/useChannelRowUpdates.ts +3 -2
  39. package/src/hooks/useMessageActions.ts +23 -9
  40. package/src/hooks/useOnlineStatus.ts +71 -0
  41. package/src/hooks/useOnlineUsers.ts +115 -0
  42. package/src/hooks/usePendingState.ts +8 -3
  43. package/src/index.ts +61 -9
  44. package/src/messageTypeUtils.ts +64 -0
  45. package/src/styles/_channel-list.css +59 -0
  46. package/src/styles/_media-lightbox.css +263 -0
  47. package/src/styles/_message-bubble.css +99 -8
  48. package/src/styles/_message-list.css +25 -0
  49. package/src/styles/index.css +1 -0
  50. package/src/types.ts +46 -0
package/dist/index.css CHANGED
@@ -403,6 +403,33 @@
403
403
  overflow: hidden;
404
404
  text-overflow: ellipsis;
405
405
  }
406
+ .ermis-channel-header__online-status {
407
+ display: flex;
408
+ align-items: center;
409
+ gap: 5px;
410
+ margin-top: 1px;
411
+ }
412
+ .ermis-channel-header__online-dot {
413
+ width: 8px;
414
+ height: 8px;
415
+ border-radius: var(--ermis-radius-full);
416
+ flex-shrink: 0;
417
+ transition: background-color var(--ermis-transition);
418
+ }
419
+ .ermis-channel-header__online-dot--online {
420
+ background-color: var(--ermis-color-success);
421
+ }
422
+ .ermis-channel-header__online-dot--offline {
423
+ background-color: var(--ermis-text-muted);
424
+ }
425
+ .ermis-channel-header__online-label {
426
+ font-size: var(--ermis-font-size-xs);
427
+ color: var(--ermis-text-muted);
428
+ line-height: 1;
429
+ }
430
+ .ermis-channel-header__online-status--online .ermis-channel-header__online-label {
431
+ color: var(--ermis-color-success);
432
+ }
406
433
  .ermis-channel-header__info {
407
434
  flex: 1;
408
435
  }
@@ -455,6 +482,26 @@
455
482
  min-width: 0;
456
483
  flex: 1;
457
484
  }
485
+ .ermis-channel-list__item-avatar-wrapper {
486
+ position: relative;
487
+ flex-shrink: 0;
488
+ }
489
+ .ermis-channel-list__online-dot {
490
+ position: absolute;
491
+ bottom: 0;
492
+ right: 0;
493
+ width: 10px;
494
+ height: 10px;
495
+ border-radius: var(--ermis-radius-full);
496
+ border: 2px solid var(--ermis-bg-secondary);
497
+ transition: background-color var(--ermis-transition);
498
+ }
499
+ .ermis-channel-list__online-dot--online {
500
+ background-color: var(--ermis-color-success);
501
+ }
502
+ .ermis-channel-list__online-dot--offline {
503
+ background-color: var(--ermis-text-muted);
504
+ }
458
505
  .ermis-channel-list__item-top-row {
459
506
  display: flex;
460
507
  align-items: baseline;
@@ -1092,6 +1139,27 @@
1092
1139
  .ermis-message-list__reject-btn:active {
1093
1140
  transform: translateY(0);
1094
1141
  }
1142
+ .ermis-message-list__pending-invitee {
1143
+ background-color: var(--ermis-bg-secondary);
1144
+ border: 1px solid var(--ermis-border);
1145
+ border-radius: var(--ermis-radius-md, 8px);
1146
+ padding: var(--ermis-spacing-sm, 12px) var(--ermis-spacing-md, 16px);
1147
+ margin: var(--ermis-spacing-sm) var(--ermis-spacing-lg);
1148
+ display: flex;
1149
+ align-items: center;
1150
+ justify-content: center;
1151
+ }
1152
+ .ermis-message-list__pending-invitee-content {
1153
+ display: flex;
1154
+ align-items: center;
1155
+ gap: var(--ermis-spacing-md, 12px);
1156
+ color: var(--ermis-text-secondary);
1157
+ font-size: var(--ermis-font-size-sm, 14px);
1158
+ font-family: var(--ermis-font-family, sans-serif);
1159
+ }
1160
+ .ermis-message-list__pending-invitee-content svg {
1161
+ color: var(--ermis-accent);
1162
+ }
1095
1163
 
1096
1164
  /* src/styles/_message-bubble.css */
1097
1165
  .ermis-quoted-message {
@@ -1241,6 +1309,9 @@
1241
1309
  .ermis-message-bubble--own .ermis-text-link {
1242
1310
  color: rgba(255, 255, 255, 0.9);
1243
1311
  }
1312
+ .ermis-message-bubble--own .ermis-attachment__link-title {
1313
+ color: rgba(255, 255, 255, 0.9);
1314
+ }
1244
1315
  .ermis-message-bubble {
1245
1316
  position: relative;
1246
1317
  display: flex;
@@ -1255,6 +1326,20 @@
1255
1326
  color: var(--ermis-bubble-own-text);
1256
1327
  border-bottom-right-radius: var(--ermis-radius-sm);
1257
1328
  }
1329
+ .ermis-message-bubble--own .ermis-attachment__file-size,
1330
+ .ermis-message-bubble--own .ermis-attachment__link-url,
1331
+ .ermis-message-bubble--own .ermis-attachment__link-description,
1332
+ .ermis-message-bubble--own .ermis-attachment__voice-duration,
1333
+ .ermis-message-bubble--own .ermis-message-list__forwarded-indicator,
1334
+ .ermis-message-bubble--own .ermis-attachment--file {
1335
+ color: rgba(255, 255, 255, 0.6);
1336
+ }
1337
+ .ermis-message-bubble--own .ermis-attachment--link-preview {
1338
+ border-color: rgba(255, 255, 255, 0.2);
1339
+ }
1340
+ .ermis-message-bubble--own .ermis-attachment--file {
1341
+ background-color: rgba(255, 255, 255, 0.1);
1342
+ }
1258
1343
  .ermis-message-bubble--other {
1259
1344
  background-color: var(--ermis-bubble-other-bg);
1260
1345
  color: var(--ermis-bubble-other-text);
@@ -1383,7 +1468,8 @@
1383
1468
  grid-template-columns: 1fr 1fr;
1384
1469
  }
1385
1470
  .ermis-attachment-grid .ermis-attachment--image,
1386
- .ermis-attachment-grid .ermis-attachment--video {
1471
+ .ermis-attachment-grid .ermis-attachment--video,
1472
+ .ermis-attachment-grid .ermis-attachment--video-poster {
1387
1473
  width: 100%;
1388
1474
  height: 100%;
1389
1475
  max-width: none;
@@ -1391,7 +1477,8 @@
1391
1477
  border-radius: 0;
1392
1478
  display: block;
1393
1479
  }
1394
- .ermis-attachment-grid .ermis-attachment--image {
1480
+ .ermis-attachment-grid .ermis-attachment--image,
1481
+ .ermis-attachment-grid .ermis-attachment--video-poster {
1395
1482
  object-fit: cover;
1396
1483
  }
1397
1484
  .ermis-attachment-grid .ermis-attachment--video {
@@ -1399,7 +1486,8 @@
1399
1486
  background-color: var(--ermis-bg-hover);
1400
1487
  }
1401
1488
  .ermis-attachment-grid--single .ermis-attachment--image,
1402
- .ermis-attachment-grid--single .ermis-attachment--video {
1489
+ .ermis-attachment-grid--single .ermis-attachment--video,
1490
+ .ermis-attachment-grid--single .ermis-attachment--video-poster {
1403
1491
  max-height: 300px;
1404
1492
  }
1405
1493
  .ermis-attachment-grid--multi > :last-child:nth-child(odd) {
@@ -1456,7 +1544,8 @@
1456
1544
  display: none;
1457
1545
  }
1458
1546
  .ermis-attachment-aspect-box .ermis-attachment--image,
1459
- .ermis-attachment-aspect-box .ermis-attachment--video {
1547
+ .ermis-attachment-aspect-box .ermis-attachment--video,
1548
+ .ermis-attachment-aspect-box .ermis-attachment--video-poster {
1460
1549
  position: absolute;
1461
1550
  top: 0;
1462
1551
  left: 0;
@@ -1469,7 +1558,8 @@
1469
1558
  max-height: none;
1470
1559
  border-radius: 0;
1471
1560
  }
1472
- .ermis-attachment-aspect-box .ermis-attachment--image {
1561
+ .ermis-attachment-aspect-box .ermis-attachment--image,
1562
+ .ermis-attachment-aspect-box .ermis-attachment--video-poster {
1473
1563
  object-fit: cover;
1474
1564
  }
1475
1565
  .ermis-attachment-aspect-box .ermis-attachment--video {
@@ -1477,7 +1567,8 @@
1477
1567
  background-color: var(--ermis-bg-hover);
1478
1568
  }
1479
1569
  .ermis-attachment-aspect-box .ermis-attachment--image.ermis-attachment--loaded,
1480
- .ermis-attachment-aspect-box .ermis-attachment--video.ermis-attachment--loaded {
1570
+ .ermis-attachment-aspect-box .ermis-attachment--video.ermis-attachment--loaded,
1571
+ .ermis-attachment-aspect-box .ermis-attachment--video-poster.ermis-attachment--loaded {
1481
1572
  opacity: 1;
1482
1573
  }
1483
1574
  .ermis-attachment-grid .ermis-attachment-aspect-box {
@@ -1485,7 +1576,8 @@
1485
1576
  border-radius: 0;
1486
1577
  min-height: 100px;
1487
1578
  }
1488
- .ermis-attachment--image {
1579
+ .ermis-attachment--image,
1580
+ .ermis-attachment--video-poster {
1489
1581
  max-width: 300px;
1490
1582
  max-height: 200px;
1491
1583
  border-radius: var(--ermis-radius-md);
@@ -1513,13 +1605,32 @@
1513
1605
  background-color: var(--ermis-bg-active);
1514
1606
  }
1515
1607
  .ermis-attachment__file-icon {
1516
- font-size: 1.25rem;
1608
+ width: 40px;
1609
+ height: 40px;
1610
+ min-width: 40px;
1611
+ border-radius: var(--ermis-radius-md);
1612
+ background: var(--ermis-bg-secondary);
1613
+ display: flex;
1614
+ flex-direction: column;
1615
+ align-items: center;
1616
+ justify-content: center;
1617
+ color: var(--ermis-text-muted);
1618
+ gap: 1px;
1517
1619
  flex-shrink: 0;
1518
1620
  }
1621
+ .ermis-attachment__file-ext {
1622
+ font-size: 8px;
1623
+ font-weight: 700;
1624
+ text-transform: uppercase;
1625
+ letter-spacing: 0.3px;
1626
+ color: var(--ermis-text-muted);
1627
+ line-height: 1;
1628
+ }
1519
1629
  .ermis-attachment__file-info {
1520
1630
  display: flex;
1521
1631
  flex-direction: column;
1522
1632
  min-width: 0;
1633
+ flex: 1;
1523
1634
  }
1524
1635
  .ermis-attachment__file-name {
1525
1636
  font-size: var(--ermis-font-size-sm);
@@ -1532,6 +1643,41 @@
1532
1643
  font-size: var(--ermis-font-size-xs);
1533
1644
  color: var(--ermis-text-muted);
1534
1645
  }
1646
+ .ermis-attachment__file-download {
1647
+ display: flex;
1648
+ align-items: center;
1649
+ justify-content: center;
1650
+ flex-shrink: 0;
1651
+ width: 32px;
1652
+ height: 32px;
1653
+ border: none;
1654
+ border-radius: var(--ermis-radius-full);
1655
+ background: transparent;
1656
+ color: var(--ermis-text-muted);
1657
+ cursor: pointer;
1658
+ transition: background-color var(--ermis-transition), color var(--ermis-transition);
1659
+ }
1660
+ .ermis-attachment__file-download:hover {
1661
+ background-color: var(--ermis-bg-active);
1662
+ color: var(--ermis-accent);
1663
+ }
1664
+ .ermis-message-bubble--own .ermis-attachment__file-name {
1665
+ color: rgba(255, 255, 255, 0.9);
1666
+ }
1667
+ .ermis-message-bubble--own .ermis-attachment__file-icon {
1668
+ background: rgba(255, 255, 255, 0.2);
1669
+ color: #fff;
1670
+ }
1671
+ .ermis-message-bubble--own .ermis-attachment__file-ext {
1672
+ color: rgba(255, 255, 255, 0.8);
1673
+ }
1674
+ .ermis-message-bubble--own .ermis-attachment__file-download {
1675
+ color: rgba(255, 255, 255, 0.7);
1676
+ }
1677
+ .ermis-message-bubble--own .ermis-attachment__file-download:hover {
1678
+ background-color: rgba(255, 255, 255, 0.15);
1679
+ color: #fff;
1680
+ }
1535
1681
  .ermis-attachment--voice {
1536
1682
  display: flex;
1537
1683
  align-items: center;
@@ -4923,5 +5069,215 @@
4923
5069
  background-color: var(--ermis-accent-hover);
4924
5070
  }
4925
5071
 
5072
+ /* src/styles/_media-lightbox.css */
5073
+ .ermis-lightbox {
5074
+ position: fixed;
5075
+ inset: 0;
5076
+ z-index: 1100;
5077
+ display: flex;
5078
+ flex-direction: column;
5079
+ animation: ermis-lightbox-fade-in 0.2s ease-out;
5080
+ }
5081
+ .ermis-lightbox__backdrop {
5082
+ position: absolute;
5083
+ inset: 0;
5084
+ background-color: rgba(0, 0, 0, 0.92);
5085
+ backdrop-filter: blur(8px);
5086
+ }
5087
+ @keyframes ermis-lightbox-fade-in {
5088
+ from {
5089
+ opacity: 0;
5090
+ }
5091
+ to {
5092
+ opacity: 1;
5093
+ }
5094
+ }
5095
+ .ermis-lightbox__header {
5096
+ position: relative;
5097
+ z-index: 2;
5098
+ display: flex;
5099
+ align-items: center;
5100
+ justify-content: space-between;
5101
+ padding: 12px 16px;
5102
+ min-height: 48px;
5103
+ }
5104
+ .ermis-lightbox__counter {
5105
+ color: rgba(255, 255, 255, 0.8);
5106
+ font-size: 14px;
5107
+ font-weight: 500;
5108
+ letter-spacing: 0.5px;
5109
+ user-select: none;
5110
+ }
5111
+ .ermis-lightbox__actions {
5112
+ display: flex;
5113
+ align-items: center;
5114
+ gap: 8px;
5115
+ margin-left: auto;
5116
+ }
5117
+ .ermis-lightbox__action-btn {
5118
+ background: rgba(255, 255, 255, 0.1);
5119
+ border: none;
5120
+ border-radius: 50%;
5121
+ width: 36px;
5122
+ height: 36px;
5123
+ display: flex;
5124
+ align-items: center;
5125
+ justify-content: center;
5126
+ color: rgba(255, 255, 255, 0.85);
5127
+ cursor: pointer;
5128
+ transition: background-color 0.15s ease, color 0.15s ease;
5129
+ }
5130
+ .ermis-lightbox__action-btn:hover {
5131
+ background: rgba(255, 255, 255, 0.2);
5132
+ color: #fff;
5133
+ }
5134
+ .ermis-lightbox__content {
5135
+ position: relative;
5136
+ z-index: 1;
5137
+ flex: 1;
5138
+ display: flex;
5139
+ align-items: center;
5140
+ justify-content: center;
5141
+ padding: 0 60px;
5142
+ overflow: hidden;
5143
+ cursor: default;
5144
+ }
5145
+ .ermis-lightbox__image {
5146
+ max-width: 90vw;
5147
+ max-height: 80vh;
5148
+ object-fit: contain;
5149
+ border-radius: 4px;
5150
+ user-select: none;
5151
+ transition: transform 0.15s ease;
5152
+ animation: ermis-lightbox-zoom-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
5153
+ }
5154
+ .ermis-lightbox__image--zoomed {
5155
+ transition: none;
5156
+ }
5157
+ @keyframes ermis-lightbox-zoom-in {
5158
+ from {
5159
+ opacity: 0;
5160
+ transform: scale(0.92);
5161
+ }
5162
+ to {
5163
+ opacity: 1;
5164
+ transform: scale(1);
5165
+ }
5166
+ }
5167
+ .ermis-lightbox__video {
5168
+ max-width: 90vw;
5169
+ max-height: 80vh;
5170
+ border-radius: 4px;
5171
+ background: #000;
5172
+ outline: none;
5173
+ animation: ermis-lightbox-zoom-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
5174
+ }
5175
+ .ermis-lightbox__nav {
5176
+ position: absolute;
5177
+ top: 50%;
5178
+ transform: translateY(-50%);
5179
+ z-index: 3;
5180
+ background: rgba(255, 255, 255, 0.08);
5181
+ border: none;
5182
+ border-radius: 50%;
5183
+ width: 44px;
5184
+ height: 44px;
5185
+ display: flex;
5186
+ align-items: center;
5187
+ justify-content: center;
5188
+ color: rgba(255, 255, 255, 0.75);
5189
+ cursor: pointer;
5190
+ transition:
5191
+ background-color 0.15s ease,
5192
+ color 0.15s ease,
5193
+ transform 0.15s ease;
5194
+ }
5195
+ .ermis-lightbox__nav:hover {
5196
+ background: rgba(255, 255, 255, 0.18);
5197
+ color: #fff;
5198
+ }
5199
+ .ermis-lightbox__nav--prev {
5200
+ left: 12px;
5201
+ }
5202
+ .ermis-lightbox__nav--prev:hover {
5203
+ transform: translateY(-50%) translateX(-2px);
5204
+ }
5205
+ .ermis-lightbox__nav--next {
5206
+ right: 12px;
5207
+ }
5208
+ .ermis-lightbox__nav--next:hover {
5209
+ transform: translateY(-50%) translateX(2px);
5210
+ }
5211
+ .ermis-lightbox__filename {
5212
+ position: relative;
5213
+ z-index: 2;
5214
+ text-align: center;
5215
+ padding: 8px 16px 16px;
5216
+ color: rgba(255, 255, 255, 0.6);
5217
+ font-size: 13px;
5218
+ white-space: nowrap;
5219
+ overflow: hidden;
5220
+ text-overflow: ellipsis;
5221
+ user-select: none;
5222
+ }
5223
+ .ermis-attachment--clickable {
5224
+ cursor: pointer;
5225
+ position: relative;
5226
+ }
5227
+ .ermis-attachment--clickable::after {
5228
+ content: "";
5229
+ position: absolute;
5230
+ inset: 0;
5231
+ background: rgba(0, 0, 0, 0);
5232
+ border-radius: inherit;
5233
+ transition: background-color 0.2s ease;
5234
+ pointer-events: none;
5235
+ }
5236
+ .ermis-attachment--clickable:hover::after {
5237
+ background: rgba(0, 0, 0, 0.12);
5238
+ }
5239
+ .ermis-attachment__overlay {
5240
+ position: absolute;
5241
+ top: 50%;
5242
+ left: 50%;
5243
+ transform: translate(-50%, -50%) scale(0.8);
5244
+ z-index: 2;
5245
+ opacity: 0;
5246
+ transition: opacity 0.2s ease, transform 0.2s ease;
5247
+ color: #fff;
5248
+ background: rgba(0, 0, 0, 0.5);
5249
+ border-radius: 50%;
5250
+ width: 36px;
5251
+ height: 36px;
5252
+ display: flex;
5253
+ align-items: center;
5254
+ justify-content: center;
5255
+ pointer-events: none;
5256
+ }
5257
+ .ermis-attachment--clickable:hover .ermis-attachment__overlay {
5258
+ opacity: 1;
5259
+ transform: translate(-50%, -50%) scale(1);
5260
+ }
5261
+ @media (max-width: 768px) {
5262
+ .ermis-lightbox__content {
5263
+ padding: 0 12px;
5264
+ }
5265
+ .ermis-lightbox__image,
5266
+ .ermis-lightbox__video {
5267
+ max-width: 100vw;
5268
+ max-height: 75vh;
5269
+ }
5270
+ .ermis-lightbox__nav {
5271
+ width: 36px;
5272
+ height: 36px;
5273
+ }
5274
+ .ermis-lightbox__nav--prev {
5275
+ left: 4px;
5276
+ }
5277
+ .ermis-lightbox__nav--next {
5278
+ right: 4px;
5279
+ }
5280
+ }
5281
+
4926
5282
  /* src/styles/index.css */
4927
5283
  /*# sourceMappingURL=index.css.map */