stream-chat-react 10.18.0 → 10.20.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.
- package/README.md +1 -1
- package/dist/browser.full-bundle.js +116 -43
- package/dist/browser.full-bundle.js.map +1 -1
- package/dist/browser.full-bundle.min.js +5 -5
- package/dist/browser.full-bundle.min.js.map +1 -1
- package/dist/components/Channel/Channel.d.ts +74 -62
- package/dist/components/Channel/Channel.d.ts.map +1 -1
- package/dist/components/Channel/Channel.js +9 -4
- package/dist/components/Message/renderText/index.d.ts +3 -1
- package/dist/components/Message/renderText/index.d.ts.map +1 -1
- package/dist/components/Message/renderText/index.js +2 -1
- package/dist/components/Message/renderText/rehypePlugins/emojiMarkdownPlugin.d.ts +3 -0
- package/dist/components/Message/renderText/rehypePlugins/emojiMarkdownPlugin.d.ts.map +1 -0
- package/dist/components/Message/renderText/rehypePlugins/emojiMarkdownPlugin.js +10 -0
- package/dist/components/Message/renderText/rehypePlugins/index.d.ts +3 -0
- package/dist/components/Message/renderText/rehypePlugins/index.d.ts.map +1 -0
- package/dist/components/Message/renderText/rehypePlugins/index.js +2 -0
- package/dist/components/Message/renderText/rehypePlugins/mentionsMarkdownPlugin.d.ts +5 -0
- package/dist/components/Message/renderText/rehypePlugins/mentionsMarkdownPlugin.d.ts.map +1 -0
- package/dist/components/Message/renderText/{rehypePlugins.js → rehypePlugins/mentionsMarkdownPlugin.js} +1 -9
- package/dist/components/Message/renderText/remarkPlugins/htmlToTextPlugin.d.ts +3 -0
- package/dist/components/Message/renderText/remarkPlugins/htmlToTextPlugin.d.ts.map +1 -0
- package/dist/components/Message/renderText/remarkPlugins/htmlToTextPlugin.js +10 -0
- package/dist/components/Message/renderText/remarkPlugins/index.d.ts +3 -0
- package/dist/components/Message/renderText/remarkPlugins/index.d.ts.map +1 -0
- package/dist/components/Message/renderText/remarkPlugins/index.js +2 -0
- package/dist/components/Message/renderText/remarkPlugins/keepLineBreaksPlugin.d.ts +3 -0
- package/dist/components/Message/renderText/remarkPlugins/keepLineBreaksPlugin.d.ts.map +1 -0
- package/dist/components/Message/renderText/remarkPlugins/keepLineBreaksPlugin.js +32 -0
- package/dist/components/Message/renderText/types.d.ts +3 -0
- package/dist/components/Message/renderText/types.d.ts.map +1 -0
- package/dist/components/Message/renderText/types.js +1 -0
- package/dist/components/MessageList/CustomNotification.d.ts.map +1 -1
- package/dist/components/MessageList/CustomNotification.js +1 -1
- package/dist/components/MessageList/MessageList.d.ts.map +1 -1
- package/dist/components/MessageList/MessageList.js +2 -1
- package/dist/context/MessageListContext.d.ts +16 -0
- package/dist/context/MessageListContext.d.ts.map +1 -0
- package/dist/context/MessageListContext.js +17 -0
- package/dist/context/index.d.ts +1 -0
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +1 -0
- package/dist/css/index.css +1 -1
- package/dist/css/v2/index.css +1 -1
- package/dist/css/v2/index.layout.css +1 -1
- package/dist/index.cjs.js +106 -37
- package/dist/index.cjs.js.map +1 -1
- package/dist/scss/MessageInput.scss +6 -0
- package/dist/scss/v2/Autocomplete/Autocomplete-layout.scss +7 -0
- package/dist/scss/v2/ChannelHeader/ChannelHeader-layout.scss +4 -0
- package/dist/scss/v2/ChannelPreview/ChannelPreview-layout.scss +1 -0
- package/dist/scss/v2/ChannelSearch/ChannelSearch-layout.scss +5 -0
- package/dist/scss/v2/Message/Message-layout.scss +8 -0
- package/dist/scss/v2/MessageList/MessageList-layout.scss +1 -0
- package/dist/scss/v2/MessageList/VirtualizedMessageList-layout.scss +4 -0
- package/dist/scss/v2/Notification/Notification-layout.scss +4 -0
- package/dist/scss/v2/Thread/Thread-layout.scss +4 -0
- package/dist/scss/v2/Tooltip/Tooltip-layout.scss +1 -0
- package/dist/scss/v2/_utils.scss +5 -0
- package/dist/utils/getChannel.d.ts +4 -2
- package/dist/utils/getChannel.d.ts.map +1 -1
- package/dist/utils/getChannel.js +3 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
- package/dist/components/Message/renderText/rehypePlugins.d.ts +0 -7
- package/dist/components/Message/renderText/rehypePlugins.d.ts.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { PropsWithChildren } from 'react';
|
|
2
|
-
import { Message, MessageResponse, Channel as StreamChannel, StreamChat, UpdatedMessage } from 'stream-chat';
|
|
2
|
+
import { ChannelQueryOptions, Message, MessageResponse, Channel as StreamChannel, StreamChat, UpdatedMessage } from 'stream-chat';
|
|
3
3
|
import { OnMentionAction } from './hooks/useMentionsHandlers';
|
|
4
4
|
import { LoadingErrorIndicatorProps } from '../Loading';
|
|
5
5
|
import { StreamMessage } from '../../context/ChannelStateContext';
|
|
@@ -10,11 +10,7 @@ import type { MessageProps } from '../Message/types';
|
|
|
10
10
|
import type { MessageInputProps } from '../MessageInput/MessageInput';
|
|
11
11
|
import type { CustomTrigger, DefaultStreamChatGenerics, GiphyVersions, ImageAttachmentSizeHandler, SendMessageOptions, UpdateMessageOptions, VideoAttachmentSizeHandler } from '../../types/types';
|
|
12
12
|
import type { URLEnrichmentConfig } from '../MessageInput/hooks/useLinkPreviews';
|
|
13
|
-
|
|
14
|
-
/** List of accepted file types */
|
|
15
|
-
acceptedFiles?: string[];
|
|
16
|
-
/** Custom handler function that runs when the active channel has unread messages (i.e., when chat is running on a separate browser tab) */
|
|
17
|
-
activeUnreadHandler?: (unread: number, documentTitle: string) => void;
|
|
13
|
+
declare type ChannelPropsForwardedToComponentContext<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = {
|
|
18
14
|
/** Custom UI component to display a message attachment, defaults to and accepts same props as: [Attachment](https://github.com/GetStream/stream-chat-react/blob/master/src/components/Attachment/Attachment.tsx) */
|
|
19
15
|
Attachment?: ComponentContextValue<StreamChatGenerics>['Attachment'];
|
|
20
16
|
/** Custom UI component to display a attachment previews in MessageInput, defaults to and accepts same props as: [Attachment](https://github.com/GetStream/stream-chat-react/blob/master/src/components/MessageInput/AttachmentPreviewList.tsx) */
|
|
@@ -27,62 +23,22 @@ export declare type ChannelProps<StreamChatGenerics extends DefaultStreamChatGen
|
|
|
27
23
|
AutocompleteSuggestionList?: ComponentContextValue<StreamChatGenerics>['AutocompleteSuggestionList'];
|
|
28
24
|
/** UI component to display a user's avatar, defaults to and accepts same props as: [Avatar](https://github.com/GetStream/stream-chat-react/blob/master/src/components/Avatar/Avatar.tsx) */
|
|
29
25
|
Avatar?: ComponentContextValue<StreamChatGenerics>['Avatar'];
|
|
30
|
-
/** The connected and active channel */
|
|
31
|
-
channel?: StreamChannel<StreamChatGenerics>;
|
|
32
26
|
/** Custom UI component to display the slow mode cooldown timer, defaults to and accepts same props as: [CooldownTimer](https://github.com/GetStream/stream-chat-react/blob/master/src/components/MessageInput/hooks/useCooldownTimer.tsx) */
|
|
33
27
|
CooldownTimer?: ComponentContextValue<StreamChatGenerics>['CooldownTimer'];
|
|
34
28
|
/** Custom UI component for date separators, defaults to and accepts same props as: [DateSeparator](https://github.com/GetStream/stream-chat-react/blob/master/src/components/DateSeparator.tsx) */
|
|
35
29
|
DateSeparator?: ComponentContextValue<StreamChatGenerics>['DateSeparator'];
|
|
36
|
-
/** Custom action handler to override the default `client.deleteMessage(message.id)` function */
|
|
37
|
-
doDeleteMessageRequest?: (message: StreamMessage<StreamChatGenerics>) => Promise<MessageResponse<StreamChatGenerics>>;
|
|
38
|
-
/** Custom action handler to override the default `channel.markRead` request function (advanced usage only) */
|
|
39
|
-
doMarkReadRequest?: (channel: StreamChannel<StreamChatGenerics>) => Promise<MessageResponse<StreamChatGenerics>> | void;
|
|
40
|
-
/** Custom action handler to override the default `channel.sendMessage` request function (advanced usage only) */
|
|
41
|
-
doSendMessageRequest?: (channelId: string, message: Message<StreamChatGenerics>, options?: SendMessageOptions) => ReturnType<StreamChannel<StreamChatGenerics>['sendMessage']> | void;
|
|
42
|
-
/** Custom action handler to override the default `client.updateMessage` request function (advanced usage only) */
|
|
43
|
-
doUpdateMessageRequest?: (cid: string, updatedMessage: UpdatedMessage<StreamChatGenerics>, options?: UpdateMessageOptions) => ReturnType<StreamChat<StreamChatGenerics>['updateMessage']>;
|
|
44
|
-
/** If true, chat users will be able to drag and drop file uploads to the entire channel window */
|
|
45
|
-
dragAndDropWindow?: boolean;
|
|
46
30
|
/** Custom UI component to override default edit message input, defaults to and accepts same props as: [EditMessageForm](https://github.com/GetStream/stream-chat-react/blob/master/src/components/MessageInput/EditMessageForm.tsx) */
|
|
47
31
|
EditMessageInput?: ComponentContextValue<StreamChatGenerics>['EditMessageInput'];
|
|
48
|
-
/** Custom UI component to override default `NimbleEmoji` from `emoji-mart` */
|
|
49
|
-
Emoji?: EmojiContextValue['Emoji'];
|
|
50
|
-
/** Custom prop to override default `facebook.json` emoji data set from `emoji-mart` */
|
|
51
|
-
emojiData?: EmojiMartData;
|
|
52
32
|
/** Custom UI component for emoji button in input, defaults to and accepts same props as: [EmojiIconSmall](https://github.com/GetStream/stream-chat-react/blob/master/src/components/MessageInput/icons.tsx) */
|
|
53
33
|
EmojiIcon?: ComponentContextValue<StreamChatGenerics>['EmojiIcon'];
|
|
54
|
-
/** Custom UI component to override default `NimbleEmojiIndex` from `emoji-mart` */
|
|
55
|
-
EmojiIndex?: EmojiContextValue['EmojiIndex'];
|
|
56
|
-
/** Custom UI component to override default `NimblePicker` from `emoji-mart` */
|
|
57
|
-
EmojiPicker?: EmojiContextValue['EmojiPicker'];
|
|
58
|
-
/** Custom UI component to be shown if no active channel is set, defaults to null and skips rendering the Channel component */
|
|
59
|
-
EmptyPlaceholder?: React.ReactElement;
|
|
60
34
|
/** Custom UI component to be displayed when the `MessageList` is empty, defaults to and accepts same props as: [EmptyStateIndicator](https://github.com/GetStream/stream-chat-react/blob/master/src/components/EmptyStateIndicator/EmptyStateIndicator.tsx) */
|
|
61
35
|
EmptyStateIndicator?: ComponentContextValue<StreamChatGenerics>['EmptyStateIndicator'];
|
|
62
|
-
/**
|
|
63
|
-
* A global flag to toggle the URL enrichment and link previews in `MessageInput` components.
|
|
64
|
-
* By default, the feature is disabled. Can be overridden on Thread, MessageList level through additionalMessageInputProps
|
|
65
|
-
* or directly on MessageInput level through urlEnrichmentConfig.
|
|
66
|
-
*/
|
|
67
|
-
enrichURLForPreview?: URLEnrichmentConfig['enrichURLForPreview'];
|
|
68
|
-
/** Global configuration for link preview generation in all the MessageInput components */
|
|
69
|
-
enrichURLForPreviewConfig?: Omit<URLEnrichmentConfig, 'enrichURLForPreview'>;
|
|
70
36
|
/** Custom UI component for file upload icon, defaults to and accepts same props as: [FileUploadIcon](https://github.com/GetStream/stream-chat-react/blob/master/src/components/MessageInput/icons.tsx) */
|
|
71
37
|
FileUploadIcon?: ComponentContextValue<StreamChatGenerics>['FileUploadIcon'];
|
|
72
38
|
/** Custom UI component to render a Giphy preview in the `VirtualizedMessageList` */
|
|
73
39
|
GiphyPreviewMessage?: ComponentContextValue<StreamChatGenerics>['GiphyPreviewMessage'];
|
|
74
|
-
/** The giphy version to render - check the keys of the [Image Object](https://developers.giphy.com/docs/api/schema#image-object) for possible values. Uses 'fixed_height' by default */
|
|
75
|
-
giphyVersion?: GiphyVersions;
|
|
76
40
|
/** Custom UI component to render at the top of the `MessageList` */
|
|
77
41
|
HeaderComponent?: ComponentContextValue<StreamChatGenerics>['HeaderComponent'];
|
|
78
|
-
/** A custom function to provide size configuration for image attachments */
|
|
79
|
-
imageAttachmentSizeHandler?: ImageAttachmentSizeHandler;
|
|
80
|
-
/**
|
|
81
|
-
* Allows to prevent triggering the channel.watch() call when mounting the component.
|
|
82
|
-
* That means that no channel data from the back-end will be received neither channel WS events will be delivered to the client.
|
|
83
|
-
* Preventing to initialize the channel on mount allows us to postpone the channel creation to a later point in time.
|
|
84
|
-
*/
|
|
85
|
-
initializeOnMount?: boolean;
|
|
86
42
|
/** Custom UI component handling how the message input is rendered, defaults to and accepts the same props as [MessageInputFlat](https://github.com/GetStream/stream-chat-react/blob/master/src/components/MessageInput/MessageInputFlat.tsx) */
|
|
87
43
|
Input?: ComponentContextValue<StreamChatGenerics>['Input'];
|
|
88
44
|
/** Custom component to render link previews in message input **/
|
|
@@ -91,8 +47,6 @@ export declare type ChannelProps<StreamChatGenerics extends DefaultStreamChatGen
|
|
|
91
47
|
LoadingErrorIndicator?: React.ComponentType<LoadingErrorIndicatorProps>;
|
|
92
48
|
/** Custom UI component to render while the `MessageList` is loading new messages, defaults to and accepts same props as: [LoadingIndicator](https://github.com/GetStream/stream-chat-react/blob/master/src/components/Loading/LoadingIndicator.tsx) */
|
|
93
49
|
LoadingIndicator?: ComponentContextValue<StreamChatGenerics>['LoadingIndicator'];
|
|
94
|
-
/** Maximum number of attachments allowed per message */
|
|
95
|
-
maxNumberOfFiles?: number;
|
|
96
50
|
/** Custom UI component to display a message in the standard `MessageList`, defaults to and accepts the same props as: [MessageSimple](https://github.com/GetStream/stream-chat-react/blob/master/src/components/Message/MessageSimple.tsx) */
|
|
97
51
|
Message?: ComponentContextValue<StreamChatGenerics>['Message'];
|
|
98
52
|
/** Custom UI component for a deleted message, defaults to and accepts same props as: [MessageDeleted](https://github.com/GetStream/stream-chat-react/blob/master/src/components/Message/MessageDeleted.tsx) */
|
|
@@ -113,14 +67,6 @@ export declare type ChannelProps<StreamChatGenerics extends DefaultStreamChatGen
|
|
|
113
67
|
MessageTimestamp?: ComponentContextValue<StreamChatGenerics>['MessageTimestamp'];
|
|
114
68
|
/** Custom UI component for viewing message's image attachments, defaults to and accepts the same props as [ModalGallery](https://github.com/GetStream/stream-chat-react/blob/master/src/components/Gallery/ModalGallery.tsx) */
|
|
115
69
|
ModalGallery?: ComponentContextValue<StreamChatGenerics>['ModalGallery'];
|
|
116
|
-
/** Whether to allow multiple attachment uploads */
|
|
117
|
-
multipleUploads?: boolean;
|
|
118
|
-
/** Custom action handler function to run on click of an @mention in a message */
|
|
119
|
-
onMentionsClick?: OnMentionAction<StreamChatGenerics>;
|
|
120
|
-
/** Custom action handler function to run on hover of an @mention in a message */
|
|
121
|
-
onMentionsHover?: OnMentionAction<StreamChatGenerics>;
|
|
122
|
-
/** If `dragAndDropWindow` prop is true, the props to pass to the MessageInput component (overrides props placed directly on MessageInput) */
|
|
123
|
-
optionalMessageInputProps?: MessageInputProps<StreamChatGenerics, V>;
|
|
124
70
|
/** Custom UI component to override default pinned message indicator, defaults to and accepts same props as: [PinIndicator](https://github.com/GetStream/stream-chat-react/blob/master/src/components/Message/icons.tsx) */
|
|
125
71
|
PinIndicator?: ComponentContextValue<StreamChatGenerics>['PinIndicator'];
|
|
126
72
|
/** Custom UI component to override quoted message UI on a sent message, defaults to and accepts same props as: [QuotedMessage](https://github.com/GetStream/stream-chat-react/blob/master/src/components/Message/QuotedMessage.tsx) */
|
|
@@ -133,10 +79,6 @@ export declare type ChannelProps<StreamChatGenerics extends DefaultStreamChatGen
|
|
|
133
79
|
ReactionsList?: ComponentContextValue<StreamChatGenerics>['ReactionsList'];
|
|
134
80
|
/** Custom UI component for send button, defaults to and accepts same props as: [SendButton](https://github.com/GetStream/stream-chat-react/blob/master/src/components/MessageInput/icons.tsx) */
|
|
135
81
|
SendButton?: ComponentContextValue<StreamChatGenerics>['SendButton'];
|
|
136
|
-
/** You can turn on/off thumbnail generation for video attachments */
|
|
137
|
-
shouldGenerateVideoThumbnail?: boolean;
|
|
138
|
-
/** If true, skips the message data string comparison used to memoize the current channel messages (helpful for channels with 1000s of messages) */
|
|
139
|
-
skipMessageDataMemoization?: boolean;
|
|
140
82
|
/** Custom UI component that displays thread's parent or other message at the top of the `MessageList`, defaults to and accepts same props as [MessageSimple](https://github.com/GetStream/stream-chat-react/blob/master/src/components/Message/MessageSimple.tsx) */
|
|
141
83
|
ThreadHead?: React.ComponentType<MessageProps<StreamChatGenerics>>;
|
|
142
84
|
/** Custom UI component to display the header of a `Thread`, defaults to and accepts same props as: [DefaultThreadHeader](https://github.com/GetStream/stream-chat-react/blob/master/src/components/Thread/Thread.tsx) */
|
|
@@ -147,11 +89,80 @@ export declare type ChannelProps<StreamChatGenerics extends DefaultStreamChatGen
|
|
|
147
89
|
TriggerProvider?: ComponentContextValue<StreamChatGenerics>['TriggerProvider'];
|
|
148
90
|
/** Custom UI component for the typing indicator, defaults to and accepts same props as: [TypingIndicator](https://github.com/GetStream/stream-chat-react/blob/master/src/components/TypingIndicator/TypingIndicator.tsx) */
|
|
149
91
|
TypingIndicator?: ComponentContextValue<StreamChatGenerics>['TypingIndicator'];
|
|
150
|
-
/** A custom function to provide size configuration for video attachments */
|
|
151
|
-
videoAttachmentSizeHandler?: VideoAttachmentSizeHandler;
|
|
152
92
|
/** Custom UI component to display a message in the `VirtualizedMessageList`, does not have a default implementation */
|
|
153
93
|
VirtualMessage?: ComponentContextValue<StreamChatGenerics>['VirtualMessage'];
|
|
154
94
|
};
|
|
95
|
+
declare type ChannelPropsForwardedToEmojiContext = {
|
|
96
|
+
/** Custom UI component to override default `NimbleEmoji` from `emoji-mart` */
|
|
97
|
+
Emoji?: EmojiContextValue['Emoji'];
|
|
98
|
+
/** Custom prop to override default `facebook.json` emoji data set from `emoji-mart` */
|
|
99
|
+
emojiData?: EmojiMartData;
|
|
100
|
+
/** Custom UI component to override default `NimbleEmojiIndex` from `emoji-mart` */
|
|
101
|
+
EmojiIndex?: EmojiContextValue['EmojiIndex'];
|
|
102
|
+
/** Custom UI component to override default `NimblePicker` from `emoji-mart` */
|
|
103
|
+
EmojiPicker?: EmojiContextValue['EmojiPicker'];
|
|
104
|
+
};
|
|
105
|
+
export declare type ChannelProps<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics, V extends CustomTrigger = CustomTrigger> = ChannelPropsForwardedToComponentContext<StreamChatGenerics> & ChannelPropsForwardedToEmojiContext & {
|
|
106
|
+
/** List of accepted file types */
|
|
107
|
+
acceptedFiles?: string[];
|
|
108
|
+
/** Custom handler function that runs when the active channel has unread messages (i.e., when chat is running on a separate browser tab) */
|
|
109
|
+
activeUnreadHandler?: (unread: number, documentTitle: string) => void;
|
|
110
|
+
/** The connected and active channel */
|
|
111
|
+
channel?: StreamChannel<StreamChatGenerics>;
|
|
112
|
+
/**
|
|
113
|
+
* Optional configuration parameters used for the initial channel query.
|
|
114
|
+
* Applied only if the value of channel.initialized is false.
|
|
115
|
+
* If the channel instance has already been initialized (channel has been queried),
|
|
116
|
+
* then the channel query will be skipped and channelQueryOptions will not be applied.
|
|
117
|
+
*/
|
|
118
|
+
channelQueryOptions?: ChannelQueryOptions<StreamChatGenerics>;
|
|
119
|
+
/** Custom action handler to override the default `client.deleteMessage(message.id)` function */
|
|
120
|
+
doDeleteMessageRequest?: (message: StreamMessage<StreamChatGenerics>) => Promise<MessageResponse<StreamChatGenerics>>;
|
|
121
|
+
/** Custom action handler to override the default `channel.markRead` request function (advanced usage only) */
|
|
122
|
+
doMarkReadRequest?: (channel: StreamChannel<StreamChatGenerics>) => Promise<MessageResponse<StreamChatGenerics>> | void;
|
|
123
|
+
/** Custom action handler to override the default `channel.sendMessage` request function (advanced usage only) */
|
|
124
|
+
doSendMessageRequest?: (channelId: string, message: Message<StreamChatGenerics>, options?: SendMessageOptions) => ReturnType<StreamChannel<StreamChatGenerics>['sendMessage']> | void;
|
|
125
|
+
/** Custom action handler to override the default `client.updateMessage` request function (advanced usage only) */
|
|
126
|
+
doUpdateMessageRequest?: (cid: string, updatedMessage: UpdatedMessage<StreamChatGenerics>, options?: UpdateMessageOptions) => ReturnType<StreamChat<StreamChatGenerics>['updateMessage']>;
|
|
127
|
+
/** If true, chat users will be able to drag and drop file uploads to the entire channel window */
|
|
128
|
+
dragAndDropWindow?: boolean;
|
|
129
|
+
/** Custom UI component to be shown if no active channel is set, defaults to null and skips rendering the Channel component */
|
|
130
|
+
EmptyPlaceholder?: React.ReactElement;
|
|
131
|
+
/**
|
|
132
|
+
* A global flag to toggle the URL enrichment and link previews in `MessageInput` components.
|
|
133
|
+
* By default, the feature is disabled. Can be overridden on Thread, MessageList level through additionalMessageInputProps
|
|
134
|
+
* or directly on MessageInput level through urlEnrichmentConfig.
|
|
135
|
+
*/
|
|
136
|
+
enrichURLForPreview?: URLEnrichmentConfig['enrichURLForPreview'];
|
|
137
|
+
/** Global configuration for link preview generation in all the MessageInput components */
|
|
138
|
+
enrichURLForPreviewConfig?: Omit<URLEnrichmentConfig, 'enrichURLForPreview'>;
|
|
139
|
+
/** The giphy version to render - check the keys of the [Image Object](https://developers.giphy.com/docs/api/schema#image-object) for possible values. Uses 'fixed_height' by default */
|
|
140
|
+
giphyVersion?: GiphyVersions;
|
|
141
|
+
/** A custom function to provide size configuration for image attachments */
|
|
142
|
+
imageAttachmentSizeHandler?: ImageAttachmentSizeHandler;
|
|
143
|
+
/**
|
|
144
|
+
* Allows to prevent triggering the channel.watch() call when mounting the component.
|
|
145
|
+
* That means that no channel data from the back-end will be received neither channel WS events will be delivered to the client.
|
|
146
|
+
* Preventing to initialize the channel on mount allows us to postpone the channel creation to a later point in time.
|
|
147
|
+
*/
|
|
148
|
+
initializeOnMount?: boolean;
|
|
149
|
+
/** Maximum number of attachments allowed per message */
|
|
150
|
+
maxNumberOfFiles?: number;
|
|
151
|
+
/** Whether to allow multiple attachment uploads */
|
|
152
|
+
multipleUploads?: boolean;
|
|
153
|
+
/** Custom action handler function to run on click of an @mention in a message */
|
|
154
|
+
onMentionsClick?: OnMentionAction<StreamChatGenerics>;
|
|
155
|
+
/** Custom action handler function to run on hover of an @mention in a message */
|
|
156
|
+
onMentionsHover?: OnMentionAction<StreamChatGenerics>;
|
|
157
|
+
/** If `dragAndDropWindow` prop is true, the props to pass to the MessageInput component (overrides props placed directly on MessageInput) */
|
|
158
|
+
optionalMessageInputProps?: MessageInputProps<StreamChatGenerics, V>;
|
|
159
|
+
/** You can turn on/off thumbnail generation for video attachments */
|
|
160
|
+
shouldGenerateVideoThumbnail?: boolean;
|
|
161
|
+
/** If true, skips the message data string comparison used to memoize the current channel messages (helpful for channels with 1000s of messages) */
|
|
162
|
+
skipMessageDataMemoization?: boolean;
|
|
163
|
+
/** A custom function to provide size configuration for video attachments */
|
|
164
|
+
videoAttachmentSizeHandler?: VideoAttachmentSizeHandler;
|
|
165
|
+
};
|
|
155
166
|
/**
|
|
156
167
|
* A wrapper component that provides channel data and renders children.
|
|
157
168
|
* The Channel component provides the following contexts:
|
|
@@ -162,4 +173,5 @@ export declare type ChannelProps<StreamChatGenerics extends DefaultStreamChatGen
|
|
|
162
173
|
* - [TypingContext](https://getstream.io/chat/docs/sdk/react/contexts/typing_context/)
|
|
163
174
|
*/
|
|
164
175
|
export declare const Channel: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics, V extends CustomTrigger = CustomTrigger>(props: React.PropsWithChildren<ChannelProps<StreamChatGenerics, V>>) => JSX.Element;
|
|
176
|
+
export {};
|
|
165
177
|
//# sourceMappingURL=Channel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Channel.d.ts","sourceRoot":"","sources":["../../../src/components/Channel/Channel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,iBAAiB,EAQlB,MAAM,OAAO,CAAC;AAIf,OAAO,
|
|
1
|
+
{"version":3,"file":"Channel.d.ts","sourceRoot":"","sources":["../../../src/components/Channel/Channel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,iBAAiB,EAQlB,MAAM,OAAO,CAAC;AAIf,OAAO,EAGL,mBAAmB,EAInB,OAAO,EACP,eAAe,EAEf,OAAO,IAAI,aAAa,EACxB,UAAU,EACV,cAAc,EAEf,MAAM,aAAa,CAAC;AAUrB,OAAO,EAAE,eAAe,EAAuB,MAAM,6BAA6B,CAAC;AAGnF,OAAO,EAEL,0BAA0B,EAC3B,MAAM,YAAY,CAAC;AAUpB,OAAO,EAGL,aAAa,EACd,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,qBAAqB,EAAqB,MAAM,gCAAgC,CAAC;AAE1F,OAAO,EAAe,iBAAiB,EAAiB,MAAM,4BAA4B,CAAC;AAe3F,OAAO,KAAK,EAAE,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OAIG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,wDAAwD;IACxD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,mDAAmD;IACnD,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,iFAAiF;IACjF,eAAe,CAAC,EAAE,eAAe,CAAC,kBAAkB,CAAC,CAAC;IACtD,iFAAiF;IACjF,eAAe,CAAC,EAAE,eAAe,CAAC,kBAAkB,CAAC,CAAC;IACtD,6IAA6I;IAC7I,yBAAyB,CAAC,EAAE,iBAAiB,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC;IACrE,qEAAqE;IACrE,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC,mJAAmJ;IACnJ,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,4EAA4E;IAC5E,0BAA0B,CAAC,EAAE,0BAA0B,CAAC;CACzD,CAAC;AA80BJ;;;;;;;;GAQG;AACH,eAAO,MAAM,OAAO,iNAA4D,CAAC"}
|
|
@@ -50,12 +50,11 @@ var UnMemoizedChannel = function (props) {
|
|
|
50
50
|
if (!(channel === null || channel === void 0 ? void 0 : channel.cid)) {
|
|
51
51
|
return React.createElement("div", { className: className }, EmptyPlaceholder);
|
|
52
52
|
}
|
|
53
|
-
// @ts-ignore
|
|
54
53
|
return React.createElement(ChannelInner, __assign({}, props, { channel: channel, key: channel.cid }));
|
|
55
54
|
};
|
|
56
55
|
var ChannelInner = function (props) {
|
|
57
56
|
var _a;
|
|
58
|
-
var acceptedFiles = props.acceptedFiles, activeUnreadHandler = props.activeUnreadHandler, channel = props.channel, children = props.children, doDeleteMessageRequest = props.doDeleteMessageRequest, doMarkReadRequest = props.doMarkReadRequest, doSendMessageRequest = props.doSendMessageRequest, doUpdateMessageRequest = props.doUpdateMessageRequest, _b = props.dragAndDropWindow, dragAndDropWindow = _b === void 0 ? false : _b, _c = props.emojiData, emojiData = _c === void 0 ? defaultEmojiData : _c, enrichURLForPreviewConfig = props.enrichURLForPreviewConfig, _d = props.initializeOnMount, initializeOnMount = _d === void 0 ? true : _d, _e = props.LoadingErrorIndicator, LoadingErrorIndicator = _e === void 0 ? DefaultLoadingErrorIndicator : _e, _f = props.LoadingIndicator, LoadingIndicator = _f === void 0 ? DefaultLoadingIndicator : _f, maxNumberOfFiles = props.maxNumberOfFiles, _g = props.multipleUploads, multipleUploads = _g === void 0 ? true : _g, onMentionsClick = props.onMentionsClick, onMentionsHover = props.onMentionsHover, _h = props.optionalMessageInputProps, optionalMessageInputProps = _h === void 0 ? {} : _h, skipMessageDataMemoization = props.skipMessageDataMemoization;
|
|
57
|
+
var acceptedFiles = props.acceptedFiles, activeUnreadHandler = props.activeUnreadHandler, channel = props.channel, channelQueryOptions = props.channelQueryOptions, children = props.children, doDeleteMessageRequest = props.doDeleteMessageRequest, doMarkReadRequest = props.doMarkReadRequest, doSendMessageRequest = props.doSendMessageRequest, doUpdateMessageRequest = props.doUpdateMessageRequest, _b = props.dragAndDropWindow, dragAndDropWindow = _b === void 0 ? false : _b, _c = props.emojiData, emojiData = _c === void 0 ? defaultEmojiData : _c, enrichURLForPreviewConfig = props.enrichURLForPreviewConfig, _d = props.initializeOnMount, initializeOnMount = _d === void 0 ? true : _d, _e = props.LoadingErrorIndicator, LoadingErrorIndicator = _e === void 0 ? DefaultLoadingErrorIndicator : _e, _f = props.LoadingIndicator, LoadingIndicator = _f === void 0 ? DefaultLoadingIndicator : _f, maxNumberOfFiles = props.maxNumberOfFiles, _g = props.multipleUploads, multipleUploads = _g === void 0 ? true : _g, onMentionsClick = props.onMentionsClick, onMentionsHover = props.onMentionsHover, _h = props.optionalMessageInputProps, optionalMessageInputProps = _h === void 0 ? {} : _h, skipMessageDataMemoization = props.skipMessageDataMemoization;
|
|
59
58
|
var _j = useChatContext('Channel'), client = _j.client, customClasses = _j.customClasses, latestMessageDatesByChannels = _j.latestMessageDatesByChannels, mutes = _j.mutes, theme = _j.theme;
|
|
60
59
|
var t = useTranslationContext('Channel').t;
|
|
61
60
|
var _k = useChannelContainerClasses({ customClasses: customClasses }), channelClass = _k.channelClass, chatClass = _k.chatClass, chatContainerClass = _k.chatContainerClass, windowsEmojiClass = _k.windowsEmojiClass;
|
|
@@ -205,7 +204,7 @@ var ChannelInner = function (props) {
|
|
|
205
204
|
}
|
|
206
205
|
}
|
|
207
206
|
}
|
|
208
|
-
return [4 /*yield*/, getChannel({ channel: channel, client: client, members: members })];
|
|
207
|
+
return [4 /*yield*/, getChannel({ channel: channel, client: client, members: members, options: channelQueryOptions })];
|
|
209
208
|
case 2:
|
|
210
209
|
_d.sent();
|
|
211
210
|
config = channel.getConfig();
|
|
@@ -246,7 +245,13 @@ var ChannelInner = function (props) {
|
|
|
246
245
|
client.off('user.deleted', handleEvent);
|
|
247
246
|
notificationTimeouts.forEach(clearTimeout);
|
|
248
247
|
};
|
|
249
|
-
}, [
|
|
248
|
+
}, [
|
|
249
|
+
channel.cid,
|
|
250
|
+
channelQueryOptions,
|
|
251
|
+
doMarkReadRequest,
|
|
252
|
+
channelConfig === null || channelConfig === void 0 ? void 0 : channelConfig.read_events,
|
|
253
|
+
initializeOnMount,
|
|
254
|
+
]);
|
|
250
255
|
useEffect(function () {
|
|
251
256
|
var _a;
|
|
252
257
|
if (!state.thread)
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { MentionProps } from './Mention';
|
|
2
|
-
export { emojiMarkdownPlugin, mentionsMarkdownPlugin } from './rehypePlugins';
|
|
3
2
|
export { escapeRegExp, matchMarkdownLinks, messageCodeBlocks } from './regex';
|
|
3
|
+
export * from './rehypePlugins';
|
|
4
|
+
export * from './remarkPlugins';
|
|
4
5
|
export * from './renderText';
|
|
6
|
+
export { HNode } from './types';
|
|
5
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Message/renderText/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Message/renderText/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC9E,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emojiMarkdownPlugin.d.ts","sourceRoot":"","sources":["../../../../../src/components/Message/renderText/rehypePlugins/emojiMarkdownPlugin.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEtC,eAAO,MAAM,mBAAmB,eAIL,KAAK,kDAG/B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { findAndReplace } from 'hast-util-find-and-replace';
|
|
2
|
+
import { u } from 'unist-builder';
|
|
3
|
+
import emojiRegex from 'emoji-regex';
|
|
4
|
+
export var emojiMarkdownPlugin = function () {
|
|
5
|
+
var replace = function (match) {
|
|
6
|
+
return u('element', { tagName: 'emoji' }, [u('text', match)]);
|
|
7
|
+
};
|
|
8
|
+
var transform = function (node) { return findAndReplace(node, emojiRegex(), replace); };
|
|
9
|
+
return transform;
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/Message/renderText/rehypePlugins/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { DefaultStreamChatGenerics } from '../../../../types/types';
|
|
2
|
+
import { UserResponse } from 'stream-chat';
|
|
3
|
+
import type { HNode } from '../types';
|
|
4
|
+
export declare const mentionsMarkdownPlugin: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(mentioned_users: UserResponse<StreamChatGenerics>[]) => () => (tree: HNode) => HNode;
|
|
5
|
+
//# sourceMappingURL=mentionsMarkdownPlugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mentionsMarkdownPlugin.d.ts","sourceRoot":"","sources":["../../../../../src/components/Message/renderText/rehypePlugins/mentionsMarkdownPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAO3C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEtC,eAAO,MAAM,sBAAsB,0JAuBR,KAAK,KAAG,KAoClC,CAAC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
+
import { escapeRegExp } from '../regex';
|
|
1
2
|
import { findAndReplace } from 'hast-util-find-and-replace';
|
|
2
3
|
import { u } from 'unist-builder';
|
|
3
4
|
import { visit } from 'unist-util-visit';
|
|
4
|
-
import emojiRegex from 'emoji-regex';
|
|
5
|
-
import { escapeRegExp } from './regex';
|
|
6
5
|
export var mentionsMarkdownPlugin = function (mentioned_users) { return function () {
|
|
7
6
|
var mentioned_usernames = mentioned_users
|
|
8
7
|
.map(function (user) { return user.name || user.id; })
|
|
@@ -51,10 +50,3 @@ export var mentionsMarkdownPlugin = function (mentioned_users) { return function
|
|
|
51
50
|
};
|
|
52
51
|
return transform;
|
|
53
52
|
}; };
|
|
54
|
-
export var emojiMarkdownPlugin = function () {
|
|
55
|
-
var replace = function (match) {
|
|
56
|
-
return u('element', { tagName: 'emoji' }, [u('text', match)]);
|
|
57
|
-
};
|
|
58
|
-
var transform = function (node) { return findAndReplace(node, emojiRegex(), replace); };
|
|
59
|
-
return transform;
|
|
60
|
-
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"htmlToTextPlugin.d.ts","sourceRoot":"","sources":["../../../../../src/components/Message/renderText/remarkPlugins/htmlToTextPlugin.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAWtC,eAAO,MAAM,gBAAgB,eAJJ,KAAK,SAIiB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { visit } from 'unist-util-visit';
|
|
2
|
+
var visitor = function (node) {
|
|
3
|
+
if (node.type !== 'html')
|
|
4
|
+
return;
|
|
5
|
+
node.type = 'text';
|
|
6
|
+
};
|
|
7
|
+
var transform = function (tree) {
|
|
8
|
+
visit(tree, visitor);
|
|
9
|
+
};
|
|
10
|
+
export var htmlToTextPlugin = function () { return transform; };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/Message/renderText/remarkPlugins/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keepLineBreaksPlugin.d.ts","sourceRoot":"","sources":["../../../../../src/components/Message/renderText/remarkPlugins/keepLineBreaksPlugin.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAmCtC,eAAO,MAAM,oBAAoB,eAJR,KAAK,SAIqB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { __spreadArray } from "tslib";
|
|
2
|
+
import { visit } from 'unist-util-visit';
|
|
3
|
+
import { u } from 'unist-builder';
|
|
4
|
+
var visitor = function (node, index, parent) {
|
|
5
|
+
if (index === null || index === 0)
|
|
6
|
+
return;
|
|
7
|
+
if (!parent)
|
|
8
|
+
return;
|
|
9
|
+
if (!node.position)
|
|
10
|
+
return;
|
|
11
|
+
var prevSibling = parent.children.at(index - 1);
|
|
12
|
+
if (!(prevSibling === null || prevSibling === void 0 ? void 0 : prevSibling.position))
|
|
13
|
+
return;
|
|
14
|
+
if (node.position.start.line === prevSibling.position.start.line)
|
|
15
|
+
return false;
|
|
16
|
+
var ownStartLine = node.position.start.line;
|
|
17
|
+
var prevEndLine = prevSibling.position.end.line;
|
|
18
|
+
// the -1 is adjustment for the single line break into which multiple line breaks are converted
|
|
19
|
+
var countTruncatedLineBreaks = ownStartLine - prevEndLine - 1;
|
|
20
|
+
if (countTruncatedLineBreaks < 1)
|
|
21
|
+
return;
|
|
22
|
+
var lineBreaks = Array.from({ length: countTruncatedLineBreaks }, function () {
|
|
23
|
+
return u('break', { tagName: 'br' });
|
|
24
|
+
});
|
|
25
|
+
// @ts-ignore
|
|
26
|
+
parent.children = __spreadArray(__spreadArray(__spreadArray([], parent.children.slice(0, index), true), lineBreaks, true), parent.children.slice(index), true);
|
|
27
|
+
return;
|
|
28
|
+
};
|
|
29
|
+
var transform = function (tree) {
|
|
30
|
+
visit(tree, visitor);
|
|
31
|
+
};
|
|
32
|
+
export var keepLineBreaksPlugin = function () { return transform; };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/Message/renderText/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAErC,oBAAY,KAAK,GAAG,OAAO,GAAG,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomNotification.d.ts","sourceRoot":"","sources":["../../../src/components/MessageList/CustomNotification.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAGjD,oBAAY,uBAAuB,GAAG;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;
|
|
1
|
+
{"version":3,"file":"CustomNotification.d.ts","sourceRoot":"","sources":["../../../src/components/MessageList/CustomNotification.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAGjD,oBAAY,uBAAuB,GAAG;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAuBF,eAAO,MAAM,kBAAkB,UArBc,kBAAkB,uBAAuB,CAAC,uBAuB/C,CAAC"}
|
|
@@ -4,6 +4,6 @@ var UnMemoizedCustomNotification = function (props) {
|
|
|
4
4
|
var active = props.active, children = props.children, className = props.className, type = props.type;
|
|
5
5
|
if (!active)
|
|
6
6
|
return null;
|
|
7
|
-
return (React.createElement("div", { "aria-live": 'polite', className: clsx("str-chat__custom-notification notification-".concat(type), "str-chat__notification", className), "data-testid": 'custom-notification' }, children));
|
|
7
|
+
return (React.createElement("div", { "aria-live": 'polite', className: clsx("str-chat__custom-notification notification-".concat(type), "str-chat__notification", "str-chat-react__notification", className), "data-testid": 'custom-notification' }, children));
|
|
8
8
|
};
|
|
9
9
|
export var CustomNotification = React.memo(UnMemoizedCustomNotification);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageList.d.ts","sourceRoot":"","sources":["../../../src/components/MessageList/MessageList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B,OAAO,EACL,yBAAyB,EAE1B,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"MessageList.d.ts","sourceRoot":"","sources":["../../../src/components/MessageList/MessageList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B,OAAO,EACL,yBAAyB,EAE1B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AAE,MAAM,CAAC;IACxB,6EAA6E;IAC7E,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,qIAAqI;IACrI,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,mLAAmL;IACnL,2BAA2B,CAAC,EAAE,mBAAmB,CAAC;IAClD,iHAAiH;IACjH,mBAAmB,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1C,8DAA8D;IAC9D,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,+DAA+D;IAC/D,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,4LAA4L;IAC5L,QAAQ,CAAC,EAAE,yBAAyB,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACzE,6LAA6L;IAC7L,aAAa,CAAC,EAAE,yBAAyB,CAAC,eAAe,CAAC,GAAG,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACnF,gDAAgD;IAChD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,yKAAyK;IACzK,QAAQ,CAAC,EAAE,aAAa,CAAC,kBAAkB,CAAC,EAAE,CAAC;IAC/C,qDAAqD;IACrD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,qHAAqH;IACrH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,uDAAuD;IACvD,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,gJA2BvB,CAAC"}
|
|
@@ -7,6 +7,7 @@ import { useChannelActionContext, } from '../../context/ChannelActionContext';
|
|
|
7
7
|
import { useChannelStateContext, } from '../../context/ChannelStateContext';
|
|
8
8
|
import { useChatContext } from '../../context/ChatContext';
|
|
9
9
|
import { useComponentContext } from '../../context/ComponentContext';
|
|
10
|
+
import { MessageListContextProvider } from '../../context/MessageListContext';
|
|
10
11
|
import { EmptyStateIndicator as DefaultEmptyStateIndicator } from '../EmptyStateIndicator';
|
|
11
12
|
import { InfiniteScroll } from '../InfiniteScrollPaginator/InfiniteScroll';
|
|
12
13
|
import { LoadingIndicator as DefaultLoadingIndicator } from '../Loading';
|
|
@@ -110,7 +111,7 @@ var MessageListWithContext = function (props) {
|
|
|
110
111
|
}
|
|
111
112
|
}, [highlightedMessageId]);
|
|
112
113
|
var showEmptyStateIndicator = elements.length === 0 && !threadList;
|
|
113
|
-
return (React.createElement(
|
|
114
|
+
return (React.createElement(MessageListContextProvider, { value: { listElement: listElement, scrollToBottom: scrollToBottom } },
|
|
114
115
|
React.createElement(MessageListMainPanel, null,
|
|
115
116
|
React.createElement("div", { className: "".concat(messageListClass, " ").concat(threadListClass), onScroll: onScroll, ref: setListElement, tabIndex: 0 }, showEmptyStateIndicator ? (React.createElement(EmptyStateIndicator, { key: 'empty-state-indicator', listType: threadList ? 'thread' : 'message' })) : (React.createElement(InfiniteScroll, __assign({ className: 'str-chat__reverse-infinite-scroll str-chat__message-list-scroll', "data-testid": 'reverse-infinite-scroll', hasNextPage: props.hasMoreNewer, hasPreviousPage: props.hasMore, head: props.head, isLoading: props.loadingMore, loader: React.createElement("div", { className: 'str-chat__list__loading', key: 'loading-indicator' }, props.loadingMore && React.createElement(LoadingIndicator, { size: 20 })), loadNextPage: loadMoreNewer, loadPreviousPage: loadMore }, props.internalInfiniteScrollProps, { threshold: loadMoreScrollThreshold }),
|
|
116
117
|
React.createElement("ul", { className: 'str-chat__ul', ref: setUlElement }, elements),
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React, { PropsWithChildren } from 'react';
|
|
2
|
+
export declare type MessageListContextValue = {
|
|
3
|
+
/** The scroll container within which the messages and typing indicator are rendered */
|
|
4
|
+
listElement: HTMLDivElement | null;
|
|
5
|
+
/** Function that scrolls the `listElement` to the bottom. */
|
|
6
|
+
scrollToBottom: () => void;
|
|
7
|
+
};
|
|
8
|
+
export declare const MessageListContext: React.Context<MessageListContextValue | undefined>;
|
|
9
|
+
/**
|
|
10
|
+
* Context provider for components rendered within the `MessageList`
|
|
11
|
+
*/
|
|
12
|
+
export declare const MessageListContextProvider: ({ children, value, }: React.PropsWithChildren<{
|
|
13
|
+
value: MessageListContextValue;
|
|
14
|
+
}>) => JSX.Element;
|
|
15
|
+
export declare const useMessageListContext: (componentName?: string) => MessageListContextValue;
|
|
16
|
+
//# sourceMappingURL=MessageListContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessageListContext.d.ts","sourceRoot":"","sources":["../../src/context/MessageListContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAiB,iBAAiB,EAAc,MAAM,OAAO,CAAC;AAE5E,oBAAY,uBAAuB,GAAG;IACpC,uFAAuF;IACvF,WAAW,EAAE,cAAc,GAAG,IAAI,CAAC;IACnC,6DAA6D;IAC7D,cAAc,EAAE,MAAM,IAAI,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,kBAAkB,oDAAgE,CAAC;AAEhG;;GAEG;AACH,eAAO,MAAM,0BAA0B;WAI9B,uBAAuB;kBAK/B,CAAC;AAEF,eAAO,MAAM,qBAAqB,mBAAoB,MAAM,4BAY3D,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React, { createContext, useContext } from 'react';
|
|
2
|
+
export var MessageListContext = createContext(undefined);
|
|
3
|
+
/**
|
|
4
|
+
* Context provider for components rendered within the `MessageList`
|
|
5
|
+
*/
|
|
6
|
+
export var MessageListContextProvider = function (_a) {
|
|
7
|
+
var children = _a.children, value = _a.value;
|
|
8
|
+
return (React.createElement(MessageListContext.Provider, { value: value }, children));
|
|
9
|
+
};
|
|
10
|
+
export var useMessageListContext = function (componentName) {
|
|
11
|
+
var contextValue = useContext(MessageListContext);
|
|
12
|
+
if (!contextValue) {
|
|
13
|
+
console.warn("The useMessageListContext hook was called outside of the MessageListContext provider. Make sure this hook is called within the MessageList component. The errored call is located in the ".concat(componentName, " component."));
|
|
14
|
+
return {};
|
|
15
|
+
}
|
|
16
|
+
return contextValue;
|
|
17
|
+
};
|
package/dist/context/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from './ComponentContext';
|
|
|
5
5
|
export * from './EmojiContext';
|
|
6
6
|
export * from './MessageContext';
|
|
7
7
|
export * from './MessageInputContext';
|
|
8
|
+
export * from './MessageListContext';
|
|
8
9
|
export * from './TranslationContext';
|
|
9
10
|
export * from './TypingContext';
|
|
10
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/context/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/context/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC"}
|
package/dist/context/index.js
CHANGED