@linktr.ee/messaging-react 2.3.0-rc-1779427772 → 2.3.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 (49) hide show
  1. package/dist/{Card-DKp7ijLV.js → Card-4takoN_-.js} +6 -6
  2. package/dist/{Card-DKp7ijLV.js.map → Card-4takoN_-.js.map} +1 -1
  3. package/dist/{Card-Djm6JjNo.js → Card-BuROm0u7.js} +19 -19
  4. package/dist/{Card-Djm6JjNo.js.map → Card-BuROm0u7.js.map} +1 -1
  5. package/dist/{Card-BlzGsGam.cjs → Card-CexShqpK.cjs} +2 -2
  6. package/dist/{Card-BlzGsGam.cjs.map → Card-CexShqpK.cjs.map} +1 -1
  7. package/dist/{Card-BkWwtS0b.cjs → Card-CgpHBx-W.cjs} +2 -2
  8. package/dist/{Card-BkWwtS0b.cjs.map → Card-CgpHBx-W.cjs.map} +1 -1
  9. package/dist/{Card-B7yHs01-.js → Card-DdpdnSh_.js} +16 -16
  10. package/dist/{Card-B7yHs01-.js.map → Card-DdpdnSh_.js.map} +1 -1
  11. package/dist/{Card-DApWNv5V.cjs → Card-ot16XqS2.cjs} +2 -2
  12. package/dist/{Card-DApWNv5V.cjs.map → Card-ot16XqS2.cjs.map} +1 -1
  13. package/dist/{LockedThumbnail-BjF6khtg.cjs → LockedThumbnail-CydtYOSA.cjs} +2 -2
  14. package/dist/{LockedThumbnail-BjF6khtg.cjs.map → LockedThumbnail-CydtYOSA.cjs.map} +1 -1
  15. package/dist/{LockedThumbnail-pm6jo2B4.js → LockedThumbnail-Drsh4B5o.js} +8 -8
  16. package/dist/{LockedThumbnail-pm6jo2B4.js.map → LockedThumbnail-Drsh4B5o.js.map} +1 -1
  17. package/dist/assets/index.css +1 -1
  18. package/dist/index-BCbVXFHI.js +4698 -0
  19. package/dist/index-BCbVXFHI.js.map +1 -0
  20. package/dist/index-CQ913euH.cjs +2 -0
  21. package/dist/index-CQ913euH.cjs.map +1 -0
  22. package/dist/index.cjs +1 -1
  23. package/dist/index.d.ts +22 -13
  24. package/dist/index.js +1 -1
  25. package/package.json +1 -1
  26. package/src/components/ChannelView.tsx +2 -8
  27. package/src/components/CustomMessage/CustomMessage.stories.tsx +0 -140
  28. package/src/components/CustomMessage/index.tsx +15 -20
  29. package/src/components/MessageAttachment/Image/ImageAttachment.stories.tsx +8 -5
  30. package/src/components/MessageAttachment/Image/index.tsx +7 -1
  31. package/src/components/MessageAttachment/MessageAttachment.test.tsx +200 -19
  32. package/src/components/MessageAttachment/Pdf/index.tsx +14 -15
  33. package/src/components/MessageAttachment/Video/VideoAttachment.stories.tsx +2 -2
  34. package/src/components/MessageAttachment/Video/index.tsx +11 -2
  35. package/src/components/MessageAttachment/_shared/CarouselNav.tsx +47 -0
  36. package/src/components/MessageAttachment/_shared/DownloadAction.tsx +27 -27
  37. package/src/components/MessageAttachment/_shared/ImageViewer.tsx +59 -261
  38. package/src/components/MessageAttachment/_shared/PdfViewer.tsx +56 -30
  39. package/src/components/MessageAttachment/_shared/VideoViewer.tsx +53 -109
  40. package/src/components/MessageAttachment/_shared/ViewerShell.tsx +127 -107
  41. package/src/components/MessageAttachment/_shared/useCarousel.ts +103 -0
  42. package/src/components/MessageAttachment/index.tsx +18 -9
  43. package/src/components/MessageAttachment/types.ts +1 -1
  44. package/src/styles.css +177 -85
  45. package/dist/index-7sLuX6s4.cjs +0 -18
  46. package/dist/index-7sLuX6s4.cjs.map +0 -1
  47. package/dist/index-Co-LV7yc.js +0 -8220
  48. package/dist/index-Co-LV7yc.js.map +0 -1
  49. package/src/components/CustomMessage/CustomMessageActions.tsx +0 -35
package/src/styles.css CHANGED
@@ -71,20 +71,27 @@
71
71
  }
72
72
  }
73
73
 
74
- /* Full-screen media viewer dialog */
74
+ /* Full-screen media viewer dialog. Drives ImageViewer / VideoViewer /
75
+ PdfViewer chrome with plain CSS so the package ships self-contained
76
+ styles — consumers don't need to wire our dist into their Tailwind
77
+ `content` glob for the lightbox to render correctly. */
75
78
  .mes-media-viewer {
76
79
  --transition-duration: 0.15s;
80
+ --mes-media-viewer-padding: 64px 24px;
81
+ --mes-media-viewer-max-w: min(96vw, 1400px);
77
82
 
78
83
  border: none;
79
84
  padding: 0;
80
85
  margin: 0;
81
86
  background: transparent;
87
+ color: white;
82
88
  width: 100vw;
83
89
  height: 100dvh;
84
90
  max-width: 100vw;
85
91
  max-height: 100dvh;
86
92
  position: fixed;
87
93
  inset: 0;
94
+ overflow: hidden;
88
95
 
89
96
  transition:
90
97
  opacity var(--transition-duration) ease,
@@ -120,6 +127,156 @@
120
127
  }
121
128
  }
122
129
 
130
+ /* Top chrome bar — splits the counter (left) from the close + actions
131
+ (right). Sits absolutely positioned over the body so it doesn't push
132
+ the centered media down.
133
+ `pointer-events: none` on the row lets clicks fall through the
134
+ negative space; the counter / actions re-enable `pointer-events`
135
+ on themselves so the buttons stay interactive. */
136
+ .mes-media-viewer__chrome {
137
+ position: absolute;
138
+ inset: 12px 12px auto 12px;
139
+ display: flex;
140
+ align-items: center;
141
+ justify-content: space-between;
142
+ gap: 12px;
143
+ pointer-events: none;
144
+ z-index: 1;
145
+ }
146
+
147
+ .mes-media-viewer__counter {
148
+ pointer-events: auto;
149
+ display: inline-flex;
150
+ align-items: center;
151
+ padding: 6px 12px;
152
+ border-radius: 9999px;
153
+ background-color: rgba(255, 255, 255, 0.12);
154
+ color: white;
155
+ font-size: 13px;
156
+ line-height: 1;
157
+ font-weight: 500;
158
+ font-variant-numeric: tabular-nums;
159
+ }
160
+
161
+ .mes-media-viewer__actions {
162
+ pointer-events: auto;
163
+ display: inline-flex;
164
+ align-items: center;
165
+ gap: 8px;
166
+ margin-left: auto;
167
+ }
168
+
169
+ /* Shared circular icon button used by the close action, the download
170
+ action, and any consumer that drops a button into the chrome.
171
+ Defined once so every viewer-chrome button stays visually
172
+ consistent and so consumers can rely on a stable selector. */
173
+ .mes-media-viewer__action {
174
+ width: 40px;
175
+ height: 40px;
176
+ display: inline-flex;
177
+ align-items: center;
178
+ justify-content: center;
179
+ padding: 0;
180
+ border: 0;
181
+ border-radius: 9999px;
182
+ background-color: rgba(255, 255, 255, 0.12);
183
+ color: white;
184
+ cursor: pointer;
185
+ transition: background-color 0.15s ease;
186
+ }
187
+
188
+ .mes-media-viewer__action:hover,
189
+ .mes-media-viewer__action:focus-visible {
190
+ background-color: rgba(255, 255, 255, 0.22);
191
+ outline: none;
192
+ }
193
+
194
+ .mes-media-viewer__action[disabled] {
195
+ opacity: 0.4;
196
+ cursor: default;
197
+ }
198
+
199
+ /* Carousel prev/next chrome — only rendered when a viewer carries
200
+ more than one item. Positioned absolutely against the dialog so the
201
+ buttons hug the viewport edges, mid-height. */
202
+ .mes-media-viewer__nav {
203
+ position: absolute;
204
+ top: 50%;
205
+ transform: translateY(-50%);
206
+ width: 48px;
207
+ height: 48px;
208
+ display: inline-flex;
209
+ align-items: center;
210
+ justify-content: center;
211
+ padding: 0;
212
+ border: 0;
213
+ border-radius: 9999px;
214
+ background-color: rgba(255, 255, 255, 0.12);
215
+ color: white;
216
+ cursor: pointer;
217
+ z-index: 1;
218
+ transition: background-color 0.15s ease;
219
+ }
220
+
221
+ .mes-media-viewer__nav:hover,
222
+ .mes-media-viewer__nav:focus-visible {
223
+ background-color: rgba(255, 255, 255, 0.22);
224
+ outline: none;
225
+ }
226
+
227
+ .mes-media-viewer__nav--prev {
228
+ left: 16px;
229
+ }
230
+
231
+ .mes-media-viewer__nav--next {
232
+ right: 16px;
233
+ }
234
+
235
+ /* Flex-centered body. */
236
+ .mes-media-viewer__body {
237
+ display: flex;
238
+ align-items: center;
239
+ justify-content: center;
240
+ width: 100%;
241
+ height: 100%;
242
+ padding: var(--mes-media-viewer-padding);
243
+ box-sizing: border-box;
244
+ }
245
+
246
+ /* Image: contained at reasonable max dimensions, never bigger than the
247
+ available body. `object-fit: contain` keeps aspect ratio. */
248
+ .mes-media-viewer__image {
249
+ display: block;
250
+ max-width: var(--mes-media-viewer-max-w);
251
+ max-height: calc(100dvh - 128px);
252
+ width: auto;
253
+ height: auto;
254
+ object-fit: contain;
255
+ -webkit-user-select: none;
256
+ user-select: none;
257
+ }
258
+
259
+ /* Video: keeps native controls; let the height grow up to the bounded
260
+ box and width track the intrinsic aspect ratio. */
261
+ .mes-media-viewer__video {
262
+ display: block;
263
+ max-width: var(--mes-media-viewer-max-w);
264
+ max-height: calc(100dvh - 128px);
265
+ width: auto;
266
+ height: auto;
267
+ background: black;
268
+ }
269
+
270
+ /* PDF iframe: native browser PDF rendering owns the inside, so we just
271
+ bound the frame and give it an opaque background. */
272
+ .mes-media-viewer__iframe {
273
+ display: block;
274
+ width: var(--mes-media-viewer-max-w);
275
+ height: calc(100dvh - 128px);
276
+ background: white;
277
+ border: 0;
278
+ }
279
+
123
280
  /* Textarea composer focus styles */
124
281
  .mes-textarea-composer-container:has(.mes-textarea-composer:focus) {
125
282
  outline: 2px solid black;
@@ -160,82 +317,32 @@
160
317
  }
161
318
 
162
319
  .str-chat__li .str-chat__message-inner {
163
- grid-column-gap: 4px;
164
- }
165
-
166
- /* Outer grid for other (incoming) messages — add footer row after message */
167
- .str-chat__li .str-chat__message--other {
168
- grid-template-areas:
169
- '. message-reminder'
170
- 'avatar message'
171
- '. footer'
172
- '. replies'
173
- '. translation-notice'
174
- '. custom-metadata'
175
- '. metadata';
176
- grid-template-columns: 28px 1fr;
177
- justify-items: flex-start;
178
- }
179
-
180
- /* Outer grid for me (outgoing) messages — add footer row after message */
181
- .str-chat__li .str-chat__message--me {
182
- grid-template-areas:
183
- 'message-reminder'
184
- 'message'
185
- 'footer'
186
- 'replies'
187
- 'translation-notice'
188
- 'custom-metadata'
189
- 'metadata';
190
- justify-items: end;
191
- }
192
-
193
- /* Avatar: proper grid item aligned to bottom of its row */
194
- .str-chat__li .str-chat__message--other .str-chat__message-sender-avatar {
195
- grid-area: avatar;
196
- align-self: end;
197
- }
198
-
199
- /* message-inner sits in the message grid area */
200
- .str-chat__li .str-chat__message-inner {
201
- grid-area: message;
202
- }
203
-
204
- /* Inner grid: bubble beside options only (no footer row) */
205
- .str-chat__li .str-chat__message--other .str-chat__message-inner {
206
- grid-template-areas: 'message-bubble options';
207
- grid-template-columns: auto auto;
320
+ grid-column-gap: 0;
208
321
  }
209
322
 
210
- .str-chat__li .str-chat__message--me .str-chat__message-inner {
211
- grid-template-areas: 'options message-bubble';
212
- grid-template-columns: auto auto;
213
- }
214
-
215
- /* Bubble wrapper occupies the message-bubble grid area */
216
- .str-chat__li .str-chat__message-inner > .str-chat__message-bubble-wrapper {
217
- grid-area: message-bubble;
323
+ .str-chat__li .str-chat__message--me .str-chat__message-bubble-wrapper {
324
+ display: flex;
325
+ flex-direction: column;
326
+ align-items: flex-end;
327
+ gap: 2px;
218
328
  }
219
329
 
220
- /* Actions button centers vertically with the bubble */
221
- .str-chat__li .str-chat__message-inner .str-chat__message-options {
222
- align-self: center;
330
+ .str-chat__li .str-chat__message--other {
331
+ position: relative;
332
+ grid-template-columns: 28px 1fr;
223
333
  }
224
334
 
225
- /* Footer: tag then vote buttons stacked, in outer grid footer area */
226
- .str-chat__li .str-chat__message-footer {
227
- grid-area: footer;
335
+ .str-chat__li .str-chat__message--other .str-chat__message-bubble-wrapper {
228
336
  display: flex;
229
337
  flex-direction: column;
230
- gap: 2px;
231
- }
232
-
233
- .str-chat__li .str-chat__message--other .str-chat__message-footer {
234
338
  align-items: flex-start;
339
+ gap: 2px;
235
340
  }
236
341
 
237
- .str-chat__li .str-chat__message--me .str-chat__message-footer {
238
- align-items: flex-end;
342
+ .str-chat__li .str-chat__message--other .str-chat__avatar {
343
+ position: absolute;
344
+ left: 0;
345
+ bottom: 0;
239
346
  }
240
347
 
241
348
  /* Channel list load-more button overrides */
@@ -308,7 +415,9 @@
308
415
  }
309
416
 
310
417
  .message-chatbot-indicator--attachment {
418
+ width: 100%;
311
419
  gap: 8px;
420
+ margin-top: 4px;
312
421
  color: rgba(0, 0, 0, 0.3);
313
422
  }
314
423
 
@@ -327,6 +436,7 @@
327
436
  display: inline-flex;
328
437
  align-items: center;
329
438
  gap: 2px;
439
+ margin-top: 4px;
330
440
  }
331
441
 
332
442
  .message-vote-button {
@@ -436,24 +546,6 @@
436
546
  margin-bottom: 0;
437
547
  }
438
548
 
439
- /* Locked attachment wrapper: stack card + text bubble in the correct direction */
440
- .str-chat__li .str-chat__message--me .str-chat__message-bubble-wrapper {
441
- display: flex;
442
- flex-direction: column;
443
- align-items: flex-end;
444
- }
445
-
446
- .str-chat__li .str-chat__message--other .str-chat__message-bubble-wrapper {
447
- display: flex;
448
- flex-direction: column;
449
- align-items: flex-start;
450
- }
451
-
452
- /* Gap between locked attachment card and accompanying text bubble */
453
- .str-chat__message-bubble-wrapper > .str-chat__message-bubble:not(:first-child) {
454
- margin-top: 4px;
455
- }
456
-
457
549
  /* Standalone tip message (tip without text) */
458
550
  .message-tip-standalone {
459
551
  display: inline-flex;
@@ -465,4 +557,4 @@
465
557
  font-weight: 500;
466
558
  color: #016e1a;
467
559
  background-color: #dbf0e0;
468
- }
560
+ }