@linktr.ee/messaging-react 3.3.6-rc-1780987607 → 3.3.6-rc-1781077089

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 (30) hide show
  1. package/dist/{Card-BlviN8Fb.cjs → Card-B-z03Jey.cjs} +2 -2
  2. package/dist/{Card-BlviN8Fb.cjs.map → Card-B-z03Jey.cjs.map} +1 -1
  3. package/dist/{Card-IjOI7UXs.js → Card-BSMnJuUn.js} +3 -3
  4. package/dist/{Card-IjOI7UXs.js.map → Card-BSMnJuUn.js.map} +1 -1
  5. package/dist/{Card-DE5bfj0l.js → Card-BgS405Np.js} +2 -2
  6. package/dist/{Card-DE5bfj0l.js.map → Card-BgS405Np.js.map} +1 -1
  7. package/dist/{Card-C4ncqjxJ.js → Card-C0w-vE4P.js} +2 -2
  8. package/dist/{Card-C4ncqjxJ.js.map → Card-C0w-vE4P.js.map} +1 -1
  9. package/dist/{Card-KgQxeR-B.cjs → Card-CMmWc_DV.cjs} +2 -2
  10. package/dist/{Card-KgQxeR-B.cjs.map → Card-CMmWc_DV.cjs.map} +1 -1
  11. package/dist/{Card-Cn7Zxc6U.cjs → Card-DlfG-u7M.cjs} +2 -2
  12. package/dist/{Card-Cn7Zxc6U.cjs.map → Card-DlfG-u7M.cjs.map} +1 -1
  13. package/dist/{LockedThumbnail-DL5NZzWJ.cjs → LockedThumbnail-Bpqw7YBv.cjs} +2 -2
  14. package/dist/{LockedThumbnail-DL5NZzWJ.cjs.map → LockedThumbnail-Bpqw7YBv.cjs.map} +1 -1
  15. package/dist/{LockedThumbnail-4-54cyJG.js → LockedThumbnail-jk9UL0Be.js} +2 -2
  16. package/dist/{LockedThumbnail-4-54cyJG.js.map → LockedThumbnail-jk9UL0Be.js.map} +1 -1
  17. package/dist/assets/index.css +1 -1
  18. package/dist/{index-C2wfgpUU.js → index-BpkIKkeQ.js} +663 -648
  19. package/dist/index-BpkIKkeQ.js.map +1 -0
  20. package/dist/index-CtuiVyk1.cjs +2 -0
  21. package/dist/index-CtuiVyk1.cjs.map +1 -0
  22. package/dist/index.cjs +1 -1
  23. package/dist/index.js +1 -1
  24. package/package.json +1 -1
  25. package/src/components/ChannelView.tsx +20 -29
  26. package/src/components/CustomMessageInput/index.tsx +47 -2
  27. package/src/styles.css +7 -0
  28. package/dist/index-C2wfgpUU.js.map +0 -1
  29. package/dist/index-nanry0Io.cjs +0 -2
  30. package/dist/index-nanry0Io.cjs.map +0 -1
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-nanry0Io.cjs");exports.ActionButton=e.ActionButton;exports.Avatar=e.Avatar;exports.ChannelEmptyState=e.ChannelEmptyState;exports.ChannelList=e.ChannelList;exports.ChannelView=e.ChannelView;exports.CustomMessageProvider=e.CustomMessageProvider;exports.FaqList=e.FaqList;exports.FaqListItem=e.FaqListItem;exports.LinkAttachment=e.LinkAttachment;exports.LockedAttachment=e.LockedAttachment;exports.MediaMessage=e.MediaMessage;exports.MessageAttachment=e.MessageAttachment;exports.MessageVoteButtons=e.MessageVoteButtons;exports.MessagingProvider=e.MessagingProvider;exports.MessagingShell=e.MessagingShell;exports.buildCompactMetaLabel=e.buildCompactMetaLabel;exports.formatFileSize=e.formatFileSize;exports.formatRelativeTime=e.formatRelativeTime;exports.getFileExtensionLabel=e.getFileExtensionLabel;exports.getMessageDisplayText=e.getMessageDisplayText;exports.isLinkAttachment=e.isLinkAttachment;exports.isUuidLike=e.isUuidLike;exports.messageAttachmentGroupPositionFromStream=e.bubbleGroupPositionFromStream;exports.normalizeLanguageCode=e.normalizeLanguageCode;exports.resolveLinkAttachment=e.resolveLinkAttachment;exports.resolveMediaFromMessage=e.resolveMediaFromMessage;exports.resolveParticipantDisplayName=e.resolveParticipantDisplayName;exports.useCustomMessage=e.useCustomMessage;exports.useMessageVote=e.useMessageVote;exports.useMessaging=e.useMessaging;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CtuiVyk1.cjs");exports.ActionButton=e.ActionButton;exports.Avatar=e.Avatar;exports.ChannelEmptyState=e.ChannelEmptyState;exports.ChannelList=e.ChannelList;exports.ChannelView=e.ChannelView;exports.CustomMessageProvider=e.CustomMessageProvider;exports.FaqList=e.FaqList;exports.FaqListItem=e.FaqListItem;exports.LinkAttachment=e.LinkAttachment;exports.LockedAttachment=e.LockedAttachment;exports.MediaMessage=e.MediaMessage;exports.MessageAttachment=e.MessageAttachment;exports.MessageVoteButtons=e.MessageVoteButtons;exports.MessagingProvider=e.MessagingProvider;exports.MessagingShell=e.MessagingShell;exports.buildCompactMetaLabel=e.buildCompactMetaLabel;exports.formatFileSize=e.formatFileSize;exports.formatRelativeTime=e.formatRelativeTime;exports.getFileExtensionLabel=e.getFileExtensionLabel;exports.getMessageDisplayText=e.getMessageDisplayText;exports.isLinkAttachment=e.isLinkAttachment;exports.isUuidLike=e.isUuidLike;exports.messageAttachmentGroupPositionFromStream=e.bubbleGroupPositionFromStream;exports.normalizeLanguageCode=e.normalizeLanguageCode;exports.resolveLinkAttachment=e.resolveLinkAttachment;exports.resolveMediaFromMessage=e.resolveMediaFromMessage;exports.resolveParticipantDisplayName=e.resolveParticipantDisplayName;exports.useCustomMessage=e.useCustomMessage;exports.useMessageVote=e.useMessageVote;exports.useMessaging=e.useMessaging;
2
2
  //# sourceMappingURL=index.cjs.map
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as e, b as t, C as i, c as n, d as o, e as m, F as g, f as l, L as r, h as M, M as u, i as L, j as c, k as h, l as d, m as p, n as v, o as A, p as C, q as F, s as k, t as b, u as f, v as x, w as y, x as P, y as S, z as q, B as z, D as B } from "./index-C2wfgpUU.js";
1
+ import { a as e, b as t, C as i, c as n, d as o, e as m, F as g, f as l, L as r, h as M, M as u, i as L, j as c, k as h, l as d, m as p, n as v, o as A, p as C, q as F, s as k, t as b, u as f, v as x, w as y, x as P, y as S, z as q, B as z, D as B } from "./index-BpkIKkeQ.js";
2
2
  export {
3
3
  e as ActionButton,
4
4
  t as Avatar,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@linktr.ee/messaging-react",
3
- "version": "3.3.6-rc-1780987607",
3
+ "version": "3.3.6-rc-1781077089",
4
4
  "description": "React messaging components built on messaging-core for web applications",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -10,7 +10,6 @@ import {
10
10
  useChannelStateContext,
11
11
  WithComponents,
12
12
  MessageUIComponentProps,
13
- defaultRenderMessages,
14
13
  } from 'stream-chat-react'
15
14
 
16
15
  import { useChannelStar } from '../hooks/useChannelStar'
@@ -337,6 +336,8 @@ const ChannelViewInner: React.FC<{
337
336
  currentUserIsAccount === false &&
338
337
  participantIsAccount === true
339
338
 
339
+ const messageListContainerRef = useRef<HTMLDivElement>(null)
340
+
340
341
  // Prevents all message instances from unmounting when ChannelViewInner re-renders
341
342
  const MessageOverride = useCallback(
342
343
  (props: MessageUIComponentProps) => {
@@ -398,41 +399,31 @@ const ChannelViewInner: React.FC<{
398
399
  {/* Message List */}
399
400
  <div
400
401
  key="lt-channel-message-list"
402
+ ref={messageListContainerRef}
401
403
  className="flex-1 overflow-hidden relative"
402
404
  >
403
405
  <MessageList
404
406
  hideDeletedMessages
405
407
  hideNewMessageSeparator={false}
406
- renderMessages={(options) => {
407
- const elements = defaultRenderMessages(options)
408
-
409
- if (renderConversationFooter) {
410
- elements.push(
411
- <li key="lt-channel-conversation-footer">
412
- {renderConversationFooter(channel)}
413
- </li>
414
- )
415
- }
408
+ />
409
+ </div>
416
410
 
417
- elements.push(
418
- // Message Input
419
- <li
420
- key="lt-channel-message-input"
421
- className="flex sticky bottom-0 p-4 pt-1 inset-x-0 mx-[calc(-1*var(--str-chat\_\_spacing-2))] md:mx-[calc(-1*min(var(--str-chat\_\_spacing-10),4%))]"
422
- >
423
- <div className="absolute bottom-0 inset-x-0 w-full h-4/5 backdrop-blur-[16px] [mask-image:linear-gradient(to_top,black_0%,transparent_100%)] [-webkit-mask-image:linear-gradient(to_top,black_0%,transparent_100%)]" />
424
- <CustomMessageInput
425
- className="isolate w-full"
426
- renderActions={() => renderMessageInputActions?.(channel)}
427
- renderFooter={() => renderMessageInputFooter?.(channel)}
428
- disabled={composerDisabled}
429
- disabledReason={composerDisabledReason}
430
- />
431
- </li>
432
- )
411
+ {renderConversationFooter ? (
412
+ <React.Fragment key="lt-channel-conversation-footer">
413
+ {renderConversationFooter(channel)}
414
+ </React.Fragment>
415
+ ) : null}
433
416
 
434
- return elements
435
- }}
417
+ <div className="absolute bottom-0 inset-x-0 flex w-full">
418
+ <div className="absolute bottom-0 inset-x-0 w-full h-4/5 backdrop-blur-[16px] [mask-image:linear-gradient(to_top,black_0%,transparent_100%)] [-webkit-mask-image:linear-gradient(to_top,black_0%,transparent_100%)]" />
419
+ <CustomMessageInput
420
+ key="lt-channel-message-input"
421
+ className="isolate w-full p-4 pt-1"
422
+ spacerTargetRef={messageListContainerRef}
423
+ renderActions={() => renderMessageInputActions?.(channel)}
424
+ renderFooter={() => renderMessageInputFooter?.(channel)}
425
+ disabled={composerDisabled}
426
+ disabledReason={composerDisabledReason}
436
427
  />
437
428
  </div>
438
429
  </Window>
@@ -1,6 +1,6 @@
1
1
  import { ArrowUpIcon } from '@phosphor-icons/react'
2
2
  import classNames from 'classnames'
3
- import React, { useContext } from 'react'
3
+ import React, { useContext, useEffect, useLayoutEffect, useRef } from 'react'
4
4
  import {
5
5
  AttachmentPreviewList as DefaultAttachmentPreviewList,
6
6
  MessageInput,
@@ -14,6 +14,10 @@ import {
14
14
 
15
15
  import { CustomLinkPreviewList } from '../CustomLinkPreviewList'
16
16
 
17
+ const INPUT_SPACER_HEIGHT_VAR = '--messaging-channel-input-spacer-height'
18
+ const useIsomorphicLayoutEffect =
19
+ typeof window === 'undefined' ? useEffect : useLayoutEffect
20
+
17
21
  /**
18
22
  * Carries the channel's `frozen` state down to CustomMessageInputInner, which
19
23
  * renders the composer as a read-only/disabled input. Using a context — rather
@@ -103,6 +107,7 @@ export interface CustomMessageInputProps {
103
107
  */
104
108
  disabledReason?: string
105
109
  className?: string
110
+ spacerTargetRef?: React.RefObject<HTMLElement>
106
111
  }
107
112
 
108
113
  export const CustomMessageInput: React.FC<CustomMessageInputProps> = ({
@@ -111,9 +116,46 @@ export const CustomMessageInput: React.FC<CustomMessageInputProps> = ({
111
116
  renderFooter,
112
117
  disabled = false,
113
118
  disabledReason,
119
+ spacerTargetRef,
114
120
  }) => {
115
121
  const { channel } = useChannelStateContext()
116
122
  const isFrozen = channel?.data?.frozen === true
123
+ const containerRef = useRef<HTMLDivElement>(null)
124
+
125
+ useIsomorphicLayoutEffect(() => {
126
+ if (disabled) {
127
+ return
128
+ }
129
+
130
+ const container = containerRef.current
131
+ const spacerTarget = spacerTargetRef?.current
132
+
133
+ if (!container || !spacerTarget) {
134
+ return
135
+ }
136
+
137
+ const updateSpacerHeight = () => {
138
+ spacerTarget.style.setProperty(
139
+ INPUT_SPACER_HEIGHT_VAR,
140
+ `${container.offsetHeight}px`
141
+ )
142
+ }
143
+
144
+ updateSpacerHeight()
145
+ window.addEventListener('resize', updateSpacerHeight)
146
+
147
+ if (typeof ResizeObserver === 'undefined') {
148
+ return () => window.removeEventListener('resize', updateSpacerHeight)
149
+ }
150
+
151
+ const resizeObserver = new ResizeObserver(updateSpacerHeight)
152
+ resizeObserver.observe(container)
153
+
154
+ return () => {
155
+ resizeObserver.disconnect()
156
+ window.removeEventListener('resize', updateSpacerHeight)
157
+ }
158
+ }, [disabled, spacerTargetRef])
117
159
 
118
160
  // Linktree official channel: the composer is replaced by an info panel
119
161
  // explaining the linker cannot send messages on this thread.
@@ -140,7 +182,10 @@ export const CustomMessageInput: React.FC<CustomMessageInputProps> = ({
140
182
  const actions = renderActions?.()
141
183
 
142
184
  return (
143
- <div className={classNames('flex flex-col gap-4', className)}>
185
+ <div
186
+ ref={containerRef}
187
+ className={classNames('flex flex-col gap-4', className)}
188
+ >
144
189
  <div
145
190
  // @ts-expect-error Only React 19 onwards has `inert` in its types.
146
191
  inert={isFrozen ? '' : undefined}
package/src/styles.css CHANGED
@@ -299,6 +299,13 @@
299
299
  background-color: transparent;
300
300
  }
301
301
 
302
+ .str-chat__ul::after {
303
+ content: '';
304
+ display: block;
305
+ width: 100%;
306
+ height: var(--messaging-channel-input-spacer-height, 80px);
307
+ }
308
+
302
309
  .str-chat__message.str-chat__message--me {
303
310
  .str-chat__attachment-list .str-chat__message-attachment--card {
304
311
  color: white;