stream-chat-react 9.4.1 → 10.0.0-theming-v2.1
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/dist/browser.full-bundle.js +16392 -10717
- package/dist/browser.full-bundle.js.map +1 -1
- package/dist/browser.full-bundle.min.js +20 -5
- package/dist/browser.full-bundle.min.js.map +1 -1
- package/dist/components/Attachment/Attachment.d.ts +1 -0
- package/dist/components/Attachment/Attachment.d.ts.map +1 -1
- package/dist/components/Attachment/Attachment.js +80 -35
- package/dist/components/Attachment/AttachmentActions.d.ts.map +1 -1
- package/dist/components/Attachment/AttachmentActions.js +2 -6
- package/dist/components/Attachment/AttachmentContainer.d.ts +12 -0
- package/dist/components/Attachment/AttachmentContainer.d.ts.map +1 -0
- package/dist/components/Attachment/AttachmentContainer.js +106 -0
- package/dist/components/Attachment/Audio.d.ts +11 -0
- package/dist/components/Attachment/Audio.d.ts.map +1 -1
- package/dist/components/Attachment/Audio.js +59 -32
- package/dist/components/Attachment/Card.d.ts +5 -20
- package/dist/components/Attachment/Card.d.ts.map +1 -1
- package/dist/components/Attachment/Card.js +93 -15
- package/dist/components/Attachment/DownloadButton.d.ts +6 -0
- package/dist/components/Attachment/DownloadButton.d.ts.map +1 -0
- package/dist/components/Attachment/DownloadButton.js +8 -0
- package/dist/components/Attachment/FileAttachment.d.ts +1 -1
- package/dist/components/Attachment/FileAttachment.d.ts.map +1 -1
- package/dist/components/Attachment/FileAttachment.js +23 -6
- package/dist/components/Attachment/FileSizeIndicator.d.ts +6 -0
- package/dist/components/Attachment/FileSizeIndicator.d.ts.map +1 -0
- package/dist/components/Attachment/FileSizeIndicator.js +8 -0
- package/dist/components/Attachment/hooks/useAudioController.d.ts +9 -0
- package/dist/components/Attachment/hooks/useAudioController.d.ts.map +1 -0
- package/dist/components/Attachment/hooks/useAudioController.js +45 -0
- package/dist/components/Attachment/icons.d.ts +5 -0
- package/dist/components/Attachment/icons.d.ts.map +1 -0
- package/dist/components/Attachment/icons.js +10 -0
- package/dist/components/Attachment/index.d.ts +1 -0
- package/dist/components/Attachment/index.d.ts.map +1 -1
- package/dist/components/Attachment/index.js +1 -0
- package/dist/components/Attachment/utils.d.ts +40 -4
- package/dist/components/Attachment/utils.d.ts.map +1 -1
- package/dist/components/Attachment/utils.js +58 -18
- package/dist/components/AutoCompleteTextarea/Item.d.ts.map +1 -1
- package/dist/components/AutoCompleteTextarea/Item.js +11 -4
- package/dist/components/AutoCompleteTextarea/List.d.ts +17 -1
- package/dist/components/AutoCompleteTextarea/List.d.ts.map +1 -1
- package/dist/components/AutoCompleteTextarea/List.js +19 -17
- package/dist/components/AutoCompleteTextarea/Textarea.d.ts +16 -2
- package/dist/components/AutoCompleteTextarea/Textarea.d.ts.map +1 -1
- package/dist/components/AutoCompleteTextarea/Textarea.js +19 -16
- package/dist/components/AutoCompleteTextarea/utils.js +1 -1
- package/dist/components/Avatar/Avatar.js +10 -10
- package/dist/components/Channel/Channel.d.ts +7 -2
- package/dist/components/Channel/Channel.d.ts.map +1 -1
- package/dist/components/Channel/Channel.js +78 -69
- package/dist/components/Channel/LoadingChannel.d.ts +2 -0
- package/dist/components/Channel/LoadingChannel.d.ts.map +1 -0
- package/dist/components/Channel/LoadingChannel.js +20 -0
- package/dist/components/Channel/channelState.d.ts +1 -0
- package/dist/components/Channel/channelState.d.ts.map +1 -1
- package/dist/components/Channel/channelState.js +14 -9
- package/dist/components/Channel/hooks/useChannelContainerClasses.d.ts +9 -0
- package/dist/components/Channel/hooks/useChannelContainerClasses.d.ts.map +1 -0
- package/dist/components/Channel/hooks/useChannelContainerClasses.js +14 -0
- package/dist/components/Channel/hooks/useCreateChannelStateContext.js +6 -6
- package/dist/components/Channel/utils.d.ts +3 -0
- package/dist/components/Channel/utils.d.ts.map +1 -1
- package/dist/components/Channel/utils.js +9 -5
- package/dist/components/ChannelHeader/ChannelHeader.d.ts.map +1 -1
- package/dist/components/ChannelHeader/ChannelHeader.js +14 -9
- package/dist/components/ChannelList/ChannelList.d.ts +10 -4
- package/dist/components/ChannelList/ChannelList.d.ts.map +1 -1
- package/dist/components/ChannelList/ChannelList.js +32 -14
- package/dist/components/ChannelList/hooks/useChannelDeletedListener.js +10 -6
- package/dist/components/ChannelList/hooks/useChannelHiddenListener.js +10 -6
- package/dist/components/ChannelList/hooks/useChannelTruncatedListener.d.ts +1 -1
- package/dist/components/ChannelList/hooks/useChannelTruncatedListener.d.ts.map +1 -1
- package/dist/components/ChannelList/hooks/useChannelTruncatedListener.js +9 -5
- package/dist/components/ChannelList/hooks/useChannelUpdatedListener.d.ts +1 -1
- package/dist/components/ChannelList/hooks/useChannelUpdatedListener.d.ts.map +1 -1
- package/dist/components/ChannelList/hooks/useChannelUpdatedListener.js +9 -5
- package/dist/components/ChannelList/hooks/useChannelVisibleListener.js +9 -5
- package/dist/components/ChannelList/hooks/useConnectionRecoveredListener.d.ts +1 -1
- package/dist/components/ChannelList/hooks/useConnectionRecoveredListener.d.ts.map +1 -1
- package/dist/components/ChannelList/hooks/useMessageNewListener.js +9 -5
- package/dist/components/ChannelList/hooks/useMobileNavigation.d.ts +1 -1
- package/dist/components/ChannelList/hooks/useMobileNavigation.d.ts.map +1 -1
- package/dist/components/ChannelList/hooks/useNotificationAddedToChannelListener.js +9 -5
- package/dist/components/ChannelList/hooks/useNotificationMessageNewListener.js +9 -5
- package/dist/components/ChannelList/hooks/usePaginatedChannels.js +9 -5
- package/dist/components/ChannelList/hooks/useUserPresenceChangedListener.js +9 -5
- package/dist/components/ChannelList/utils.js +9 -5
- package/dist/components/ChannelPreview/ChannelPreview.d.ts +6 -0
- package/dist/components/ChannelPreview/ChannelPreview.d.ts.map +1 -1
- package/dist/components/ChannelPreview/ChannelPreview.js +5 -21
- package/dist/components/ChannelPreview/ChannelPreviewMessenger.d.ts.map +1 -1
- package/dist/components/ChannelPreview/ChannelPreviewMessenger.js +13 -9
- package/dist/components/ChannelPreview/hooks/useChannelPreviewInfo.d.ts +14 -0
- package/dist/components/ChannelPreview/hooks/useChannelPreviewInfo.d.ts.map +1 -0
- package/dist/components/ChannelPreview/hooks/useChannelPreviewInfo.js +29 -0
- package/dist/components/ChannelPreview/utils.js +2 -2
- package/dist/components/ChannelSearch/ChannelSearch.d.ts +6 -42
- package/dist/components/ChannelSearch/ChannelSearch.d.ts.map +1 -1
- package/dist/components/ChannelSearch/ChannelSearch.js +4 -160
- package/dist/components/ChannelSearch/SearchBar.d.ts +29 -0
- package/dist/components/ChannelSearch/SearchBar.d.ts.map +1 -0
- package/dist/components/ChannelSearch/SearchBar.js +93 -0
- package/dist/components/ChannelSearch/SearchInput.d.ts +9 -17
- package/dist/components/ChannelSearch/SearchInput.d.ts.map +1 -1
- package/dist/components/ChannelSearch/SearchInput.js +2 -4
- package/dist/components/ChannelSearch/SearchResults.d.ts +14 -8
- package/dist/components/ChannelSearch/SearchResults.d.ts.map +1 -1
- package/dist/components/ChannelSearch/SearchResults.js +44 -27
- package/dist/components/ChannelSearch/hooks/useChannelSearch.d.ts +50 -0
- package/dist/components/ChannelSearch/hooks/useChannelSearch.d.ts.map +1 -0
- package/dist/components/ChannelSearch/hooks/useChannelSearch.js +232 -0
- package/dist/components/ChannelSearch/icons.d.ts +6 -0
- package/dist/components/ChannelSearch/icons.d.ts.map +1 -0
- package/dist/components/ChannelSearch/icons.js +12 -0
- package/dist/components/Chat/Chat.d.ts.map +1 -1
- package/dist/components/Chat/Chat.js +4 -0
- package/dist/components/Chat/hooks/useChat.d.ts +1 -1
- package/dist/components/Chat/hooks/useChat.d.ts.map +1 -1
- package/dist/components/Chat/hooks/useChat.js +1 -1
- package/dist/components/Chat/hooks/useCreateChatContext.d.ts.map +1 -1
- package/dist/components/Chat/hooks/useCreateChatContext.js +3 -2
- package/dist/components/Chat/hooks/useCustomStyles.d.ts +1 -1
- package/dist/components/Chat/hooks/useCustomStyles.d.ts.map +1 -1
- package/dist/components/ChatAutoComplete/ChatAutoComplete.js +1 -1
- package/dist/components/DateSeparator/DateSeparator.js +1 -1
- package/dist/components/EmoticonItem/EmoticonItem.js +1 -1
- package/dist/components/EmptyStateIndicator/EmptyStateIndicator.d.ts +1 -1
- package/dist/components/EmptyStateIndicator/EmptyStateIndicator.d.ts.map +1 -1
- package/dist/components/EmptyStateIndicator/EmptyStateIndicator.js +16 -3
- package/dist/components/EmptyStateIndicator/icons.d.ts +2 -0
- package/dist/components/EmptyStateIndicator/icons.d.ts.map +1 -0
- package/dist/components/EmptyStateIndicator/icons.js +3 -0
- package/dist/components/EventComponent/EventComponent.js +1 -1
- package/dist/components/Gallery/Gallery.d.ts.map +1 -1
- package/dist/components/Gallery/Gallery.js +16 -14
- package/dist/components/Gallery/Image.d.ts +7 -3
- package/dist/components/Gallery/Image.d.ts.map +1 -1
- package/dist/components/Gallery/Image.js +21 -9
- package/dist/components/Gallery/ModalGallery.d.ts +10 -0
- package/dist/components/Gallery/ModalGallery.d.ts.map +1 -0
- package/dist/components/Gallery/ModalGallery.js +16 -0
- package/dist/components/Gallery/index.d.ts +1 -1
- package/dist/components/Gallery/index.js +1 -1
- package/dist/components/InfiniteScrollPaginator/InfiniteScroll.d.ts +2 -0
- package/dist/components/InfiniteScrollPaginator/InfiniteScroll.d.ts.map +1 -1
- package/dist/components/InfiniteScrollPaginator/InfiniteScroll.js +4 -1
- package/dist/components/LoadMore/LoadMoreButton.js +2 -2
- package/dist/components/Loading/LoadingChannels.js +2 -2
- package/dist/components/Loading/LoadingIndicator.js +1 -1
- package/dist/components/MML/MML.js +1 -1
- package/dist/components/Message/FixedHeightMessage.js +3 -3
- package/dist/components/Message/MessageDeleted.js +2 -2
- package/dist/components/Message/MessageOptions.d.ts +1 -0
- package/dist/components/Message/MessageOptions.d.ts.map +1 -1
- package/dist/components/Message/MessageOptions.js +9 -16
- package/dist/components/Message/MessageRepliesCountButton.d.ts.map +1 -1
- package/dist/components/Message/MessageRepliesCountButton.js +8 -5
- package/dist/components/Message/MessageSimple.d.ts.map +1 -1
- package/dist/components/Message/MessageSimple.js +41 -21
- package/dist/components/Message/MessageStatus.d.ts.map +1 -1
- package/dist/components/Message/MessageStatus.js +17 -8
- package/dist/components/Message/MessageText.d.ts +1 -1
- package/dist/components/Message/MessageText.d.ts.map +1 -1
- package/dist/components/Message/MessageText.js +10 -14
- package/dist/components/Message/QuotedMessage.d.ts.map +1 -1
- package/dist/components/Message/QuotedMessage.js +8 -3
- package/dist/components/Message/hooks/index.d.ts +0 -2
- package/dist/components/Message/hooks/index.d.ts.map +1 -1
- package/dist/components/Message/hooks/index.js +0 -2
- package/dist/components/Message/hooks/useEditHandler.d.ts +1 -1
- package/dist/components/Message/hooks/useEditHandler.d.ts.map +1 -1
- package/dist/components/Message/hooks/useReactionHandler.d.ts +3 -3
- package/dist/components/Message/hooks/useReactionHandler.d.ts.map +1 -1
- package/dist/components/Message/hooks/useReactionHandler.js +11 -7
- package/dist/components/Message/hooks/useUserRole.d.ts +1 -1
- package/dist/components/Message/hooks/useUserRole.d.ts.map +1 -1
- package/dist/components/Message/icons.d.ts +6 -4
- package/dist/components/Message/icons.d.ts.map +1 -1
- package/dist/components/Message/icons.js +25 -10
- package/dist/components/Message/index.d.ts +0 -3
- package/dist/components/Message/index.d.ts.map +1 -1
- package/dist/components/Message/index.js +0 -3
- package/dist/components/Message/utils.js +10 -6
- package/dist/components/MessageActions/MessageActions.d.ts.map +1 -1
- package/dist/components/MessageActions/MessageActions.js +3 -3
- package/dist/components/MessageActions/MessageActionsBox.d.ts.map +1 -1
- package/dist/components/MessageActions/MessageActionsBox.js +14 -7
- package/dist/components/MessageInput/AttachmentPreviewList.d.ts +2 -0
- package/dist/components/MessageInput/AttachmentPreviewList.d.ts.map +1 -0
- package/dist/components/MessageInput/AttachmentPreviewList.js +60 -0
- package/dist/components/MessageInput/EditMessageForm.d.ts.map +1 -1
- package/dist/components/MessageInput/EditMessageForm.js +11 -6
- package/dist/components/MessageInput/EmojiPicker.d.ts +1 -1
- package/dist/components/MessageInput/EmojiPicker.d.ts.map +1 -1
- package/dist/components/MessageInput/EmojiPicker.js +14 -17
- package/dist/components/MessageInput/MessageInput.d.ts +1 -1
- package/dist/components/MessageInput/MessageInput.d.ts.map +1 -1
- package/dist/components/MessageInput/MessageInputFlat.d.ts.map +1 -1
- package/dist/components/MessageInput/MessageInputFlat.js +84 -10
- package/dist/components/MessageInput/MessageInputSmall.d.ts +9 -0
- package/dist/components/MessageInput/MessageInputSmall.d.ts.map +1 -1
- package/dist/components/MessageInput/MessageInputSmall.js +10 -1
- package/dist/components/MessageInput/QuotedMessagePreview.d.ts +2 -1
- package/dist/components/MessageInput/QuotedMessagePreview.d.ts.map +1 -1
- package/dist/components/MessageInput/QuotedMessagePreview.js +29 -22
- package/dist/components/MessageInput/UploadsPreview.d.ts +7 -0
- package/dist/components/MessageInput/UploadsPreview.d.ts.map +1 -1
- package/dist/components/MessageInput/UploadsPreview.js +17 -6
- package/dist/components/MessageInput/hooks/useAttachments.d.ts.map +1 -1
- package/dist/components/MessageInput/hooks/useAttachments.js +8 -1
- package/dist/components/MessageInput/hooks/useCommandTrigger.d.ts.map +1 -1
- package/dist/components/MessageInput/hooks/useCommandTrigger.js +6 -4
- package/dist/components/MessageInput/hooks/useCooldownTimer.d.ts +1 -1
- package/dist/components/MessageInput/hooks/useCooldownTimer.d.ts.map +1 -1
- package/dist/components/MessageInput/hooks/useCooldownTimer.js +4 -4
- package/dist/components/MessageInput/hooks/useEmojiPicker.d.ts +1 -1
- package/dist/components/MessageInput/hooks/useEmojiPicker.d.ts.map +1 -1
- package/dist/components/MessageInput/hooks/useEmojiTrigger.d.ts +1 -1
- package/dist/components/MessageInput/hooks/useEmojiTrigger.d.ts.map +1 -1
- package/dist/components/MessageInput/hooks/useEmojiTrigger.js +23 -19
- package/dist/components/MessageInput/hooks/useFileState.d.ts +7 -0
- package/dist/components/MessageInput/hooks/useFileState.d.ts.map +1 -0
- package/dist/components/MessageInput/hooks/useFileState.js +8 -0
- package/dist/components/MessageInput/hooks/useImageUploads.d.ts.map +1 -1
- package/dist/components/MessageInput/hooks/useImageUploads.js +17 -36
- package/dist/components/MessageInput/hooks/useMessageInputState.d.ts +2 -6
- package/dist/components/MessageInput/hooks/useMessageInputState.d.ts.map +1 -1
- package/dist/components/MessageInput/hooks/useSubmitHandler.js +10 -6
- package/dist/components/MessageInput/hooks/useUserTrigger.d.ts +1 -1
- package/dist/components/MessageInput/hooks/useUserTrigger.d.ts.map +1 -1
- package/dist/components/MessageInput/hooks/useUserTrigger.js +13 -9
- package/dist/components/MessageInput/hooks/utils.d.ts +1 -1
- package/dist/components/MessageInput/hooks/utils.d.ts.map +1 -1
- package/dist/components/MessageInput/icons.d.ts +12 -2
- package/dist/components/MessageInput/icons.d.ts.map +1 -1
- package/dist/components/MessageInput/icons.js +67 -7
- package/dist/components/MessageList/CustomNotification.js +1 -1
- package/dist/components/MessageList/MessageList.d.ts +3 -0
- package/dist/components/MessageList/MessageList.d.ts.map +1 -1
- package/dist/components/MessageList/MessageList.js +17 -14
- package/dist/components/MessageList/MessageListMainPanel.d.ts +3 -0
- package/dist/components/MessageList/MessageListMainPanel.d.ts.map +1 -0
- package/dist/components/MessageList/MessageListMainPanel.js +9 -0
- package/dist/components/MessageList/MessageListNotifications.d.ts +2 -0
- package/dist/components/MessageList/MessageListNotifications.d.ts.map +1 -1
- package/dist/components/MessageList/MessageListNotifications.js +2 -2
- package/dist/components/MessageList/MessageNotification.d.ts +9 -6
- package/dist/components/MessageList/MessageNotification.d.ts.map +1 -1
- package/dist/components/MessageList/MessageNotification.js +1 -1
- package/dist/components/MessageList/ScrollToBottomButton.d.ts +3 -0
- package/dist/components/MessageList/ScrollToBottomButton.d.ts.map +1 -0
- package/dist/components/MessageList/ScrollToBottomButton.js +53 -0
- package/dist/components/MessageList/VirtualizedMessageList.d.ts +5 -0
- package/dist/components/MessageList/VirtualizedMessageList.d.ts.map +1 -1
- package/dist/components/MessageList/VirtualizedMessageList.js +41 -14
- package/dist/components/MessageList/hooks/useMessageListElements.d.ts +1 -1
- package/dist/components/MessageList/hooks/useMessageListElements.d.ts.map +1 -1
- package/dist/components/MessageList/hooks/useMessageListElements.js +4 -3
- package/dist/components/MessageList/hooks/useMessageListScrollManager.d.ts.map +1 -1
- package/dist/components/MessageList/hooks/useMessageListScrollManager.js +3 -1
- package/dist/components/MessageList/hooks/useNewMessageNotification.d.ts +2 -0
- package/dist/components/MessageList/hooks/useNewMessageNotification.d.ts.map +1 -1
- package/dist/components/MessageList/hooks/useNewMessageNotification.js +8 -1
- package/dist/components/MessageList/hooks/useScrollLocationLogic.d.ts +1 -2
- package/dist/components/MessageList/hooks/useScrollLocationLogic.d.ts.map +1 -1
- package/dist/components/MessageList/hooks/useScrollLocationLogic.js +12 -30
- package/dist/components/MessageList/icons.d.ts +8 -0
- package/dist/components/MessageList/icons.d.ts.map +1 -0
- package/dist/components/MessageList/icons.js +11 -0
- package/dist/components/MessageList/index.d.ts +1 -0
- package/dist/components/MessageList/index.d.ts.map +1 -1
- package/dist/components/MessageList/index.js +1 -0
- package/dist/components/MessageList/utils.d.ts +4 -2
- package/dist/components/MessageList/utils.d.ts.map +1 -1
- package/dist/components/MessageList/utils.js +16 -3
- package/dist/components/Modal/Modal.d.ts +2 -2
- package/dist/components/Modal/Modal.d.ts.map +1 -1
- package/dist/components/Modal/Modal.js +18 -15
- package/dist/components/Modal/icons.d.ts +2 -0
- package/dist/components/Modal/icons.d.ts.map +1 -0
- package/dist/components/Modal/icons.js +5 -0
- package/dist/components/Reactions/ReactionSelector.d.ts +2 -0
- package/dist/components/Reactions/ReactionSelector.d.ts.map +1 -1
- package/dist/components/Reactions/ReactionSelector.js +18 -9
- package/dist/components/Reactions/ReactionsList.d.ts +3 -1
- package/dist/components/Reactions/ReactionsList.d.ts.map +1 -1
- package/dist/components/Reactions/ReactionsList.js +33 -47
- package/dist/components/Reactions/SimpleReactionsList.d.ts +3 -1
- package/dist/components/Reactions/SimpleReactionsList.d.ts.map +1 -1
- package/dist/components/Reactions/SimpleReactionsList.js +41 -58
- package/dist/components/Reactions/hooks/useProcessReactions.d.ts +21 -0
- package/dist/components/Reactions/hooks/useProcessReactions.d.ts.map +1 -0
- package/dist/components/Reactions/hooks/useProcessReactions.js +51 -0
- package/dist/components/Thread/Thread.d.ts +2 -6
- package/dist/components/Thread/Thread.d.ts.map +1 -1
- package/dist/components/Thread/Thread.js +21 -89
- package/dist/components/Thread/ThreadHead.d.ts +4 -0
- package/dist/components/Thread/ThreadHead.d.ts.map +1 -0
- package/dist/components/Thread/ThreadHead.js +21 -0
- package/dist/components/Thread/ThreadHeader.d.ts +12 -0
- package/dist/components/Thread/ThreadHeader.d.ts.map +1 -0
- package/dist/components/Thread/ThreadHeader.js +21 -0
- package/dist/components/Thread/ThreadStart.d.ts +2 -0
- package/dist/components/Thread/ThreadStart.d.ts.map +1 -0
- package/dist/components/Thread/ThreadStart.js +10 -0
- package/dist/components/Thread/icons.d.ts +4 -0
- package/dist/components/Thread/icons.d.ts.map +1 -0
- package/dist/components/Thread/icons.js +9 -0
- package/dist/components/Thread/index.d.ts +2 -0
- package/dist/components/Thread/index.d.ts.map +1 -1
- package/dist/components/Thread/index.js +2 -0
- package/dist/components/TypingIndicator/TypingIndicator.d.ts.map +1 -1
- package/dist/components/TypingIndicator/TypingIndicator.js +52 -9
- package/dist/components/UserItem/UserItem.d.ts +1 -1
- package/dist/components/UserItem/UserItem.d.ts.map +1 -1
- package/dist/components/UserItem/UserItem.js +15 -8
- package/dist/components/Window/Window.js +1 -1
- package/dist/constants/limits.d.ts +4 -0
- package/dist/constants/limits.d.ts.map +1 -0
- package/dist/constants/limits.js +3 -0
- package/dist/context/ChannelActionContext.d.ts +1 -1
- package/dist/context/ChannelActionContext.d.ts.map +1 -1
- package/dist/context/ChannelActionContext.js +1 -1
- package/dist/context/ChannelStateContext.d.ts +3 -2
- package/dist/context/ChannelStateContext.d.ts.map +1 -1
- package/dist/context/ChannelStateContext.js +1 -1
- package/dist/context/ChatContext.d.ts +5 -4
- package/dist/context/ChatContext.d.ts.map +1 -1
- package/dist/context/ChatContext.js +2 -2
- package/dist/context/ComponentContext.d.ts +6 -2
- package/dist/context/ComponentContext.d.ts.map +1 -1
- package/dist/context/ComponentContext.js +1 -1
- package/dist/context/EmojiContext.d.ts +1 -1
- package/dist/context/EmojiContext.d.ts.map +1 -1
- package/dist/context/EmojiContext.js +1 -1
- package/dist/context/MessageContext.d.ts +1 -1
- package/dist/context/MessageContext.d.ts.map +1 -1
- package/dist/context/MessageContext.js +1 -1
- package/dist/context/MessageInputContext.d.ts +1 -1
- package/dist/context/MessageInputContext.d.ts.map +1 -1
- package/dist/context/MessageInputContext.js +1 -1
- package/dist/context/TranslationContext.d.ts +2 -2
- package/dist/context/TranslationContext.d.ts.map +1 -1
- package/dist/context/TranslationContext.js +8 -4
- package/dist/context/TypingContext.d.ts +1 -1
- package/dist/context/TypingContext.d.ts.map +1 -1
- package/dist/context/TypingContext.js +1 -1
- package/dist/css/index.css +1 -1
- package/dist/css/index.css.map +1 -0
- package/dist/css/v2/index.css +1 -0
- package/dist/css/v2/index.css.map +1 -0
- package/dist/css/v2/index.layout.css +1 -0
- package/dist/css/v2/index.layout.css.map +1 -0
- package/dist/i18n/Streami18n.d.ts +8 -2
- package/dist/i18n/Streami18n.d.ts.map +1 -1
- package/dist/i18n/Streami18n.js +12 -12
- package/dist/i18n/de.json +8 -2
- package/dist/i18n/en.json +8 -2
- package/dist/i18n/es.json +9 -2
- package/dist/i18n/fr.json +9 -2
- package/dist/i18n/hi.json +8 -2
- package/dist/i18n/it.json +9 -2
- package/dist/i18n/ja.json +8 -2
- package/dist/i18n/ko.json +8 -2
- package/dist/i18n/nl.json +8 -2
- package/dist/i18n/pt.json +9 -2
- package/dist/i18n/ru.json +10 -2
- package/dist/i18n/tr.json +8 -2
- package/dist/index.cjs.js +8773 -3961
- package/dist/index.cjs.js.map +1 -1
- package/dist/scss/Attachment.scss +52 -22
- package/dist/scss/Audio.scss +1 -1
- package/dist/scss/Avatar.scss +1 -1
- package/dist/scss/ChannelList.scss +5 -1
- package/dist/scss/ChannelPreview.scss +25 -0
- package/dist/scss/ChannelSearch.scss +5 -3
- package/dist/scss/Gallery.scss +0 -20
- package/dist/scss/ImageCarousel.scss +39 -0
- package/dist/scss/LoadingChannels.scss +1 -1
- package/dist/scss/Message.scss +84 -86
- package/dist/scss/MessageActions.scss +15 -0
- package/dist/scss/MessageCommerce.scss +57 -13
- package/dist/scss/MessageInputFlat.scss +21 -9
- package/dist/scss/MessageList.scss +35 -3
- package/dist/scss/MessageLivestream.scss +23 -10
- package/dist/scss/MessageNotification.scss +7 -1
- package/dist/scss/MessageTeam.scss +37 -10
- package/dist/scss/Modal.scss +2 -0
- package/dist/scss/ReactionList.scss +14 -0
- package/dist/scss/ReactionSelector.scss +6 -0
- package/dist/scss/SendButton.scss +6 -0
- package/dist/scss/SmallMessageInput.scss +0 -1
- package/dist/scss/Thread.scss +21 -2
- package/dist/scss/Tooltip.scss +6 -3
- package/dist/scss/TypingIndicator.scss +5 -0
- package/dist/scss/_base.scss +26 -0
- package/dist/scss/_variables.scss +2 -1
- package/dist/scss/index.scss +5 -4
- package/dist/scss/v2/AttachmentList/AttachmentList-layout.scss +392 -0
- package/dist/scss/v2/AttachmentList/AttachmentList-theme.scss +400 -0
- package/dist/scss/v2/AttachmentPreviewList/AttachmentPreviewList-layout.scss +118 -0
- package/dist/scss/v2/AttachmentPreviewList/AttachmentPreviewList-theme.scss +150 -0
- package/dist/scss/v2/Autocomplete/Autocomplete-layout.scss +62 -0
- package/dist/scss/v2/Autocomplete/Autocomplete-theme.scss +207 -0
- package/dist/scss/v2/Avatar/Avatar-layout.scss +13 -0
- package/dist/scss/v2/Avatar/Avatar-theme.scss +42 -0
- package/dist/scss/v2/Channel/Channel-layout.scss +139 -0
- package/dist/scss/v2/Channel/Channel-theme.scss +99 -0
- package/dist/scss/v2/ChannelHeader/ChannelHeader-layout.scss +23 -0
- package/dist/scss/v2/ChannelHeader/ChannelHeader-theme.scss +43 -0
- package/dist/scss/v2/ChannelList/ChannelList-layout.scss +41 -0
- package/dist/scss/v2/ChannelList/ChannelList-theme.scss +87 -0
- package/dist/scss/v2/ChannelPreview/ChannelPreview-layout.scss +82 -0
- package/dist/scss/v2/ChannelPreview/ChannelPreview-theme.scss +108 -0
- package/dist/scss/v2/ChannelSearch/ChannelSearch-layout.scss +71 -0
- package/dist/scss/v2/ChannelSearch/ChannelSearch-theme.scss +190 -0
- package/dist/scss/v2/EditMessageForm/EditMessageForm-layout.scss +53 -0
- package/dist/scss/v2/EditMessageForm/EditMessageForm-theme.scss +50 -0
- package/dist/scss/v2/ImageCarousel/ImageCarousel-layout.scss +41 -0
- package/dist/scss/v2/ImageCarousel/ImageCarousel-theme.scss +15 -0
- package/dist/scss/v2/LoadingIndicator/LoadingIndicator-layout.scss +39 -0
- package/dist/scss/v2/LoadingIndicator/LoadingIndicator-theme.scss +12 -0
- package/dist/scss/v2/Message/Message-layout.scss +373 -0
- package/dist/scss/v2/Message/Message-theme.scss +353 -0
- package/dist/scss/v2/MessageActionsBox/MessageActionsBox-layout.scss +48 -0
- package/dist/scss/v2/MessageActionsBox/MessageActionsBox-theme.scss +69 -0
- package/dist/scss/v2/MessageInput/MessageInput-layout.scss +186 -0
- package/dist/scss/v2/MessageInput/MessageInput-theme.scss +221 -0
- package/dist/scss/v2/MessageList/MessageList-layout.scss +61 -0
- package/dist/scss/v2/MessageList/MessageList-theme.scss +105 -0
- package/dist/scss/v2/MessageList/VirtualizedMessageList-layout.scss +44 -0
- package/dist/scss/v2/MessageList/VirtualizedMessageList-theme.scss +32 -0
- package/dist/scss/v2/MessageReactions/MessageReactions-layout.scss +64 -0
- package/dist/scss/v2/MessageReactions/MessageReactions-theme.scss +75 -0
- package/dist/scss/v2/MessageReactions/MessageReactionsSelector-layout.scss +52 -0
- package/dist/scss/v2/MessageReactions/MessageReactionsSelector-theme.scss +83 -0
- package/dist/scss/v2/Modal/Modal-layout.scss +40 -0
- package/dist/scss/v2/Modal/Modal-theme.scss +82 -0
- package/dist/scss/v2/Notification/MessageNotification-layout.scss +12 -0
- package/dist/scss/v2/Notification/MessageNotification-theme.scss +34 -0
- package/dist/scss/v2/Notification/Notification-layout.scss +3 -0
- package/dist/scss/v2/Notification/Notification-theme.scss +32 -0
- package/dist/scss/v2/Notification/NotificationList-layout.scss +11 -0
- package/dist/scss/v2/Notification/NotificationList-theme.scss +31 -0
- package/dist/scss/v2/Thread/Thread-layout.scss +47 -0
- package/dist/scss/v2/Thread/Thread-theme.scss +82 -0
- package/dist/scss/v2/Tooltip/Tooltip-layout.scss +30 -0
- package/dist/scss/v2/Tooltip/Tooltip-theme.scss +36 -0
- package/dist/scss/v2/TypingIndicator/TypingIndicator-layout.scss +27 -0
- package/dist/scss/v2/TypingIndicator/TypingIndicator-theme.scss +68 -0
- package/dist/scss/v2/_base.scss +29 -0
- package/dist/scss/v2/_global-layout-variables.scss +65 -0
- package/dist/scss/v2/_global-theme-variables.scss +166 -0
- package/dist/scss/v2/_palette-variables.scss +55 -0
- package/dist/scss/v2/_utils.scss +188 -0
- package/dist/scss/v2/common/CTAButton/CTAButton-layout.scss +4 -0
- package/dist/scss/v2/common/CTAButton/CTAButton-theme.scss +42 -0
- package/dist/scss/v2/common/CircleFAButton/CircleFAButton-layout.scss +14 -0
- package/dist/scss/v2/common/CircleFAButton/CircleFAButton-theme.scss +35 -0
- package/dist/scss/v2/index.layout.scss +31 -0
- package/dist/scss/v2/index.scss +36 -0
- package/dist/scss/{vendor → v2/vendor}/emoji-mart.scss +27 -8
- package/dist/stories/add-message.stories.d.ts +0 -1
- package/dist/stories/add-message.stories.d.ts.map +1 -1
- package/dist/stories/add-message.stories.js +0 -1
- package/dist/stories/edit-message.stories.d.ts +0 -1
- package/dist/stories/edit-message.stories.d.ts.map +1 -1
- package/dist/stories/edit-message.stories.js +0 -1
- package/dist/stories/hello.stories.d.ts +0 -1
- package/dist/stories/hello.stories.d.ts.map +1 -1
- package/dist/stories/hello.stories.js +0 -1
- package/dist/stories/jump-to-message.stories.d.ts +0 -1
- package/dist/stories/jump-to-message.stories.d.ts.map +1 -1
- package/dist/stories/jump-to-message.stories.js +0 -1
- package/dist/stories/mark-read.stories.d.ts +0 -1
- package/dist/stories/mark-read.stories.d.ts.map +1 -1
- package/dist/stories/mark-read.stories.js +0 -1
- package/dist/stories/message-status-readby-tooltip.stories.d.ts +0 -1
- package/dist/stories/message-status-readby-tooltip.stories.d.ts.map +1 -1
- package/dist/stories/message-status-readby-tooltip.stories.js +0 -1
- package/dist/stories/navigate-long-message-lists.stories.d.ts +0 -2
- package/dist/stories/navigate-long-message-lists.stories.d.ts.map +1 -1
- package/dist/stories/navigate-long-message-lists.stories.js +1 -11
- package/dist/stories/toggle-message-actions.stories.d.ts +0 -1
- package/dist/stories/toggle-message-actions.stories.d.ts.map +1 -1
- package/dist/stories/toggle-message-actions.stories.js +0 -1
- package/dist/stories/utils.d.ts.map +1 -1
- package/dist/stories/utils.js +2 -1
- package/dist/types/types.d.ts +7 -0
- package/dist/types/types.d.ts.map +1 -1
- package/dist/utils.d.ts +2 -2
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +4 -4
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/package.json +11 -7
- package/dist/components/Gallery/ModalWrapper.d.ts +0 -14
- package/dist/components/Gallery/ModalWrapper.d.ts.map +0 -1
- package/dist/components/Gallery/ModalWrapper.js +0 -8
- package/dist/components/Message/MessageCommerce.d.ts +0 -10
- package/dist/components/Message/MessageCommerce.d.ts.map +0 -1
- package/dist/components/Message/MessageCommerce.js +0 -64
- package/dist/components/Message/MessageLivestream.d.ts +0 -16
- package/dist/components/Message/MessageLivestream.d.ts.map +0 -1
- package/dist/components/Message/MessageLivestream.js +0 -164
- package/dist/components/Message/MessageTeam.d.ts +0 -11
- package/dist/components/Message/MessageTeam.d.ts.map +0 -1
- package/dist/components/Message/MessageTeam.js +0 -110
- package/dist/components/Message/hooks/useBreakpoint.d.ts +0 -6
- package/dist/components/Message/hooks/useBreakpoint.d.ts.map +0 -1
- package/dist/components/Message/hooks/useBreakpoint.js +0 -18
- package/dist/components/Message/hooks/useMobilePress.d.ts +0 -5
- package/dist/components/Message/hooks/useMobilePress.d.ts.map +0 -1
- package/dist/components/Message/hooks/useMobilePress.js +0 -33
- package/dist/scss/vendor/mml-react.scss +0 -1749
- package/dist/scss/vendor/react-file-utils.scss +0 -378
- package/dist/scss/vendor/react-image-gallery.scss +0 -224
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DownloadButton.d.ts","sourceRoot":"","sources":["../../../src/components/Attachment/DownloadButton.tsx"],"names":[],"mappings":"AAKA,aAAK,mBAAmB,GAAG;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,cAAc,iBAAkB,mBAAmB,gBAS/D,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DownloadIcon } from './icons';
|
|
3
|
+
import { SafeAnchor } from '../SafeAnchor';
|
|
4
|
+
export var DownloadButton = function (_a) {
|
|
5
|
+
var assetUrl = _a.assetUrl;
|
|
6
|
+
return (React.createElement(SafeAnchor, { className: 'str-chat__message-attachment-file--item-download', download: true, href: assetUrl, target: '_blank' },
|
|
7
|
+
React.createElement(DownloadIcon, { className: 'str-chat__message-attachment-download-icon' })));
|
|
8
|
+
};
|
|
@@ -3,5 +3,5 @@ import type { DefaultStreamChatGenerics } from '../../types/types';
|
|
|
3
3
|
export declare type FileAttachmentProps<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = {
|
|
4
4
|
attachment: Attachment<StreamChatGenerics>;
|
|
5
5
|
};
|
|
6
|
-
export declare const FileAttachment: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(
|
|
6
|
+
export declare const FileAttachment: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>({ attachment, }: FileAttachmentProps<StreamChatGenerics>) => JSX.Element;
|
|
7
7
|
//# sourceMappingURL=FileAttachment.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileAttachment.d.ts","sourceRoot":"","sources":["../../../src/components/Attachment/FileAttachment.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FileAttachment.d.ts","sourceRoot":"","sources":["../../../src/components/Attachment/FileAttachment.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAQ9C,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAEnE,oBAAY,mBAAmB,CAC7B,kBAAkB,SAAS,yBAAyB,GAAG,yBAAyB,IAC9E;IACF,UAAU,EAAE,UAAU,CAAC,kBAAkB,CAAC,CAAC;CAC5C,CAAC;AAmDF,eAAO,MAAM,cAAc,6JAES,CAAC"}
|
|
@@ -1,13 +1,30 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import prettybytes from 'pretty-bytes';
|
|
3
2
|
import { FileIcon } from 'react-file-utils';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import { DownloadButton } from './DownloadButton';
|
|
4
|
+
import { FileSizeIndicator } from './FileSizeIndicator';
|
|
5
|
+
import { SafeAnchor } from '../SafeAnchor/SafeAnchor';
|
|
6
|
+
import { useChatContext } from '../../context/ChatContext';
|
|
7
|
+
var UnMemoizedFileAttachmentV1 = function (_a) {
|
|
8
|
+
var attachment = _a.attachment;
|
|
7
9
|
return (React.createElement("div", { className: 'str-chat__message-attachment-file--item', "data-testid": 'attachment-file' },
|
|
8
|
-
React.createElement(FileIcon, { big: true,
|
|
10
|
+
React.createElement(FileIcon, { big: true, mimeType: attachment.mime_type, size: 30 }),
|
|
9
11
|
React.createElement("div", { className: 'str-chat__message-attachment-file--item-text' },
|
|
10
12
|
React.createElement(SafeAnchor, { download: true, href: attachment.asset_url, target: '_blank' }, attachment.title),
|
|
11
|
-
|
|
13
|
+
React.createElement(FileSizeIndicator, { fileSize: attachment.file_size }))));
|
|
14
|
+
};
|
|
15
|
+
var UnMemoizedFileAttachmentV2 = function (_a) {
|
|
16
|
+
var attachment = _a.attachment;
|
|
17
|
+
return (React.createElement("div", { className: 'str-chat__message-attachment-file--item', "data-testid": 'attachment-file' },
|
|
18
|
+
React.createElement(FileIcon, { className: 'str-chat__file-icon', mimeType: attachment.mime_type, version: '2' }),
|
|
19
|
+
React.createElement("div", { className: 'str-chat__message-attachment-file--item-text' },
|
|
20
|
+
React.createElement("div", { className: 'str-chat__message-attachment-file--item-first-row' },
|
|
21
|
+
React.createElement("div", { className: 'str-chat__message-attachment-file--item-name', "data-testid": 'file-title' }, attachment.title),
|
|
22
|
+
React.createElement(DownloadButton, { assetUrl: attachment.asset_url })),
|
|
23
|
+
React.createElement(FileSizeIndicator, { fileSize: attachment.file_size }))));
|
|
24
|
+
};
|
|
25
|
+
var UnMemoizedFileAttachment = function (_a) {
|
|
26
|
+
var attachment = _a.attachment;
|
|
27
|
+
var themeVersion = useChatContext('FileAttachment').themeVersion;
|
|
28
|
+
return themeVersion === '2' ? (React.createElement(UnMemoizedFileAttachmentV2, { attachment: attachment })) : (React.createElement(UnMemoizedFileAttachmentV1, { attachment: attachment }));
|
|
12
29
|
};
|
|
13
30
|
export var FileAttachment = React.memo(UnMemoizedFileAttachment);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileSizeIndicator.d.ts","sourceRoot":"","sources":["../../../src/components/Attachment/FileSizeIndicator.tsx"],"names":[],"mappings":"AAGA,aAAK,sBAAsB,GAAG;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,iBAAiB,iBAAkB,sBAAsB,uBAMrE,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import prettybytes from 'pretty-bytes';
|
|
3
|
+
export var FileSizeIndicator = function (_a) {
|
|
4
|
+
var fileSize = _a.fileSize;
|
|
5
|
+
if (!(fileSize && Number.isFinite(Number(fileSize))))
|
|
6
|
+
return null;
|
|
7
|
+
return (React.createElement("span", { className: 'str-chat__message-attachment-file--item-size' }, prettybytes(fileSize)));
|
|
8
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const PROGRESS_UPDATE_INTERVAL = 100;
|
|
2
|
+
export declare const useAudioController: () => {
|
|
3
|
+
audioRef: import("react").MutableRefObject<HTMLAudioElement | null>;
|
|
4
|
+
isPlaying: boolean;
|
|
5
|
+
progress: number;
|
|
6
|
+
seek: import("react").MouseEventHandler<HTMLDivElement>;
|
|
7
|
+
togglePlay: () => void;
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=useAudioController.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAudioController.d.ts","sourceRoot":"","sources":["../../../../src/components/Attachment/hooks/useAudioController.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAE5C,eAAO,MAAM,kBAAkB;;;;;;CAsD9B,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
+
export var PROGRESS_UPDATE_INTERVAL = 100;
|
|
3
|
+
export var useAudioController = function () {
|
|
4
|
+
var _a = useState(false), isPlaying = _a[0], setIsPlaying = _a[1];
|
|
5
|
+
var _b = useState(0), progress = _b[0], setProgress = _b[1];
|
|
6
|
+
var audioRef = useRef(null);
|
|
7
|
+
var togglePlay = useCallback(function () {
|
|
8
|
+
setIsPlaying(function (playing) { return !playing; });
|
|
9
|
+
}, []);
|
|
10
|
+
var seek = useCallback(function (_a) {
|
|
11
|
+
var clientX = _a.clientX, currentTarget = _a.currentTarget;
|
|
12
|
+
if (!audioRef.current)
|
|
13
|
+
return;
|
|
14
|
+
var _b = currentTarget.getBoundingClientRect(), width = _b.width, x = _b.x;
|
|
15
|
+
var ratio = (clientX - x) / width;
|
|
16
|
+
if (!isPlaying)
|
|
17
|
+
setProgress(ratio * 100);
|
|
18
|
+
audioRef.current.currentTime = ratio * audioRef.current.duration;
|
|
19
|
+
}, [isPlaying]);
|
|
20
|
+
useEffect(function () {
|
|
21
|
+
if (!audioRef.current || !isPlaying)
|
|
22
|
+
return;
|
|
23
|
+
var interval = window.setInterval(function () {
|
|
24
|
+
if (!audioRef.current)
|
|
25
|
+
return;
|
|
26
|
+
var _a = audioRef.current, currentTime = _a.currentTime, duration = _a.duration;
|
|
27
|
+
setProgress((currentTime / duration) * 100);
|
|
28
|
+
if (currentTime === duration)
|
|
29
|
+
setIsPlaying(false);
|
|
30
|
+
}, PROGRESS_UPDATE_INTERVAL);
|
|
31
|
+
audioRef.current.play();
|
|
32
|
+
return function () {
|
|
33
|
+
var _a;
|
|
34
|
+
(_a = audioRef.current) === null || _a === void 0 ? void 0 : _a.pause();
|
|
35
|
+
window.clearInterval(interval);
|
|
36
|
+
};
|
|
37
|
+
}, [isPlaying]);
|
|
38
|
+
return {
|
|
39
|
+
audioRef: audioRef,
|
|
40
|
+
isPlaying: isPlaying,
|
|
41
|
+
progress: progress,
|
|
42
|
+
seek: seek,
|
|
43
|
+
togglePlay: togglePlay,
|
|
44
|
+
};
|
|
45
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { IconProps } from '../../types/types';
|
|
2
|
+
export declare const DownloadIcon: ({ className }: IconProps) => JSX.Element;
|
|
3
|
+
export declare const PlayTriangleIcon: () => JSX.Element;
|
|
4
|
+
export declare const PauseIcon: () => JSX.Element;
|
|
5
|
+
//# sourceMappingURL=icons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../../src/components/Attachment/icons.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,eAAO,MAAM,YAAY,kBAAmB,SAAS,gBAepD,CAAC;AAEF,eAAO,MAAM,gBAAgB,mBAI5B,CAAC;AAEF,eAAO,MAAM,SAAS,mBAIrB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export var DownloadIcon = function (_a) {
|
|
3
|
+
var className = _a.className;
|
|
4
|
+
return (React.createElement("svg", { className: className, "data-testid": 'download', fill: 'none', height: '24', viewBox: '0 0 24 24', width: '24', xmlns: 'http://www.w3.org/2000/svg' },
|
|
5
|
+
React.createElement("path", { d: 'M19.35 10.04C18.67 6.59 15.64 4 12 4C9.11 4 6.6 5.64 5.35 8.04C2.34 8.36 0 10.91 0 14C0 17.31 2.69 20 6 20H19C21.76 20 24 17.76 24 15C24 12.36 21.95 10.22 19.35 10.04ZM19 18H6C3.79 18 2 16.21 2 14C2 11.95 3.53 10.24 5.56 10.03L6.63 9.92L7.13 8.97C8.08 7.14 9.94 6 12 6C14.62 6 16.88 7.86 17.39 10.43L17.69 11.93L19.22 12.04C20.78 12.14 22 13.45 22 15C22 16.65 20.65 18 19 18ZM13.45 10H10.55V13H8L12 17L16 13H13.45V10Z', fill: 'black' })));
|
|
6
|
+
};
|
|
7
|
+
export var PlayTriangleIcon = function () { return (React.createElement("svg", { fill: 'none', viewBox: '0 0 12 14', xmlns: 'http://www.w3.org/2000/svg' },
|
|
8
|
+
React.createElement("path", { d: 'M0.5 0V14L11.5 7L0.5 0Z', fill: '#080707' }))); };
|
|
9
|
+
export var PauseIcon = function () { return (React.createElement("svg", { fill: 'none', viewBox: '0 0 12 14', xmlns: 'http://www.w3.org/2000/svg' },
|
|
10
|
+
React.createElement("path", { d: 'M0 14H4V0H0V14ZM8 0V14H12V0H8Z', fill: '#080707' }))); };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Attachment/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Attachment/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC"}
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import React, { PropsWithChildren } from 'react';
|
|
1
|
+
import React, { PropsWithChildren, ReactNode } from 'react';
|
|
2
|
+
import type { ATTACHMENT_GROUPS_ORDER } from './Attachment';
|
|
2
3
|
import type { Attachment } from 'stream-chat';
|
|
3
4
|
import type { AttachmentProps } from './Attachment';
|
|
4
5
|
import type { DefaultStreamChatGenerics } from '../../types/types';
|
|
5
6
|
export declare const SUPPORTED_VIDEO_FORMATS: string[];
|
|
7
|
+
export declare type AttachmentComponentType = typeof ATTACHMENT_GROUPS_ORDER[number];
|
|
8
|
+
export declare type GroupedRenderedAttachment = Record<AttachmentComponentType, ReactNode[]>;
|
|
6
9
|
export declare type GalleryAttachment<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = {
|
|
7
10
|
images: Attachment<StreamChatGenerics>[];
|
|
8
|
-
type:
|
|
11
|
+
type: 'gallery';
|
|
9
12
|
};
|
|
10
13
|
export declare type AttachmentContainerProps<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = {
|
|
11
14
|
attachment: Attachment<StreamChatGenerics> | GalleryAttachment<StreamChatGenerics>;
|
|
12
|
-
componentType:
|
|
15
|
+
componentType: AttachmentComponentType;
|
|
13
16
|
};
|
|
14
17
|
export declare type RenderAttachmentProps<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = Omit<AttachmentProps<StreamChatGenerics>, 'attachments'> & {
|
|
15
18
|
attachment: Attachment<StreamChatGenerics>;
|
|
@@ -17,17 +20,50 @@ export declare type RenderAttachmentProps<StreamChatGenerics extends DefaultStre
|
|
|
17
20
|
export declare type RenderGalleryProps<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = Omit<AttachmentProps<StreamChatGenerics>, 'attachments'> & {
|
|
18
21
|
attachment: GalleryAttachment<StreamChatGenerics>;
|
|
19
22
|
};
|
|
23
|
+
export declare const isScrapedContent: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(attachment: Attachment<StreamChatGenerics>) => string | undefined;
|
|
24
|
+
export declare const isUploadedImage: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(attachment: Attachment<StreamChatGenerics>) => boolean;
|
|
20
25
|
export declare const isGalleryAttachmentType: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(output: Attachment<StreamChatGenerics> | GalleryAttachment<StreamChatGenerics>) => output is GalleryAttachment<StreamChatGenerics>;
|
|
21
26
|
export declare const isAudioAttachment: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(attachment: Attachment<StreamChatGenerics>) => boolean;
|
|
22
27
|
export declare const isFileAttachment: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(attachment: Attachment<StreamChatGenerics>) => boolean | "" | undefined;
|
|
23
|
-
export declare const isImageAttachment: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(attachment: Attachment<StreamChatGenerics>) => boolean;
|
|
24
28
|
export declare const isMediaAttachment: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(attachment: Attachment<StreamChatGenerics>) => boolean;
|
|
29
|
+
/**
|
|
30
|
+
* @deprecated will be removed in the next major release,
|
|
31
|
+
* replaced with the proper component equivalent `AttachmentContainer/AttachmentWithinContainer`
|
|
32
|
+
*/
|
|
25
33
|
export declare const renderAttachmentWithinContainer: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(props: React.PropsWithChildren<AttachmentContainerProps<StreamChatGenerics>>) => JSX.Element;
|
|
34
|
+
/**
|
|
35
|
+
* @deprecated will be removed in the next major release,
|
|
36
|
+
* replaced with the proper component equivalent `AttachmentContainer/AttachmentActionsContainer`
|
|
37
|
+
*/
|
|
26
38
|
export declare const renderAttachmentActions: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(props: RenderAttachmentProps<StreamChatGenerics>) => JSX.Element | null;
|
|
39
|
+
/**
|
|
40
|
+
* @deprecated will be removed in the next major release,
|
|
41
|
+
* replaced with the proper component equivalent `AttachmentContainer/GalleryContainer`
|
|
42
|
+
*/
|
|
27
43
|
export declare const renderGallery: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(props: RenderGalleryProps<StreamChatGenerics>) => JSX.Element;
|
|
44
|
+
/**
|
|
45
|
+
* @deprecated will be removed in the next major release,
|
|
46
|
+
* replaced with the proper component equivalent `AttachmentContainer/ImageContainer`
|
|
47
|
+
*/
|
|
28
48
|
export declare const renderImage: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(props: RenderAttachmentProps<StreamChatGenerics>) => JSX.Element;
|
|
49
|
+
/**
|
|
50
|
+
* @deprecated will be removed in the next major release,
|
|
51
|
+
* replaced with the proper component equivalent `AttachmentContainer/CardContainer`
|
|
52
|
+
*/
|
|
29
53
|
export declare const renderCard: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(props: RenderAttachmentProps<StreamChatGenerics>) => JSX.Element;
|
|
54
|
+
/**
|
|
55
|
+
* @deprecated will be removed in the next major release,
|
|
56
|
+
* replaced with the proper component equivalent `AttachmentContainer/FileContainer`
|
|
57
|
+
*/
|
|
30
58
|
export declare const renderFile: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(props: RenderAttachmentProps<StreamChatGenerics>) => JSX.Element | null;
|
|
59
|
+
/**
|
|
60
|
+
* @deprecated will be removed in the next major release,
|
|
61
|
+
* replaced with the proper component equivalent `AttachmentContainer/AudioContainer`
|
|
62
|
+
*/
|
|
31
63
|
export declare const renderAudio: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(props: RenderAttachmentProps<StreamChatGenerics>) => JSX.Element;
|
|
64
|
+
/**
|
|
65
|
+
* @deprecated will be removed in the next major release,
|
|
66
|
+
* replaced with the proper component equivalent `AttachmentContainer/MediaContainer`
|
|
67
|
+
*/
|
|
32
68
|
export declare const renderMedia: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(props: RenderAttachmentProps<StreamChatGenerics>) => JSX.Element;
|
|
33
69
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/Attachment/utils.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/Attachment/utils.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAI5D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAO5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAEnE,eAAO,MAAM,uBAAuB,UAA8D,CAAC;AAEnG,oBAAY,uBAAuB,GAAG,OAAO,uBAAuB,CAAC,MAAM,CAAC,CAAC;AAE7E,oBAAY,yBAAyB,GAAG,MAAM,CAAC,uBAAuB,EAAE,SAAS,EAAE,CAAC,CAAC;AAErF,oBAAY,iBAAiB,CAC3B,kBAAkB,SAAS,yBAAyB,GAAG,yBAAyB,IAC9E;IACF,MAAM,EAAE,UAAU,CAAC,kBAAkB,CAAC,EAAE,CAAC;IACzC,IAAI,EAAE,SAAS,CAAC;CACjB,CAAC;AAEF,oBAAY,wBAAwB,CAClC,kBAAkB,SAAS,yBAAyB,GAAG,yBAAyB,IAC9E;IACF,UAAU,EAAE,UAAU,CAAC,kBAAkB,CAAC,GAAG,iBAAiB,CAAC,kBAAkB,CAAC,CAAC;IACnF,aAAa,EAAE,uBAAuB,CAAC;CACxC,CAAC;AAEF,oBAAY,qBAAqB,CAC/B,kBAAkB,SAAS,yBAAyB,GAAG,yBAAyB,IAC9E,IAAI,CAAC,eAAe,CAAC,kBAAkB,CAAC,EAAE,aAAa,CAAC,GAAG;IAC7D,UAAU,EAAE,UAAU,CAAC,kBAAkB,CAAC,CAAC;CAC5C,CAAC;AAEF,oBAAY,kBAAkB,CAC5B,kBAAkB,SAAS,yBAAyB,GAAG,yBAAyB,IAC9E,IAAI,CAAC,eAAe,CAAC,kBAAkB,CAAC,EAAE,aAAa,CAAC,GAAG;IAC7D,UAAU,EAAE,iBAAiB,CAAC,kBAAkB,CAAC,CAAC;CACnD,CAAC;AAEF,eAAO,MAAM,gBAAgB,sJAIyB,CAAC;AAEvD,eAAO,MAAM,eAAe,2IAIqC,CAAC;AAElE,eAAO,MAAM,uBAAuB,uNAI8C,CAAC;AAEnF,eAAO,MAAM,iBAAiB,2IAIE,CAAC;AAEjC,eAAO,MAAM,gBAAgB,4JAQG,CAAC;AAEjC,eAAO,MAAM,iBAAiB,2IAMD,CAAC;AAE9B;;;GAGG;AACH,eAAO,MAAM,+BAA+B,iLA0B3C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,uBAAuB,4JAmBnC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,kJAYzB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,WAAW,qJAyBvB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,UAAU,qJAyBtB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,UAAU,4JActB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,WAAW,qJAgBvB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,WAAW,qJA8CvB,CAAC"}
|
|
@@ -11,16 +11,16 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
};
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import ReactPlayer from 'react-player';
|
|
14
|
-
import
|
|
14
|
+
import clsx from 'clsx';
|
|
15
15
|
import { AttachmentActions as DefaultAttachmentActions } from './AttachmentActions';
|
|
16
16
|
import { Audio as DefaultAudio } from './Audio';
|
|
17
17
|
import { Card as DefaultCard } from './Card';
|
|
18
18
|
import { FileAttachment as DefaultFile } from './FileAttachment';
|
|
19
19
|
import { Gallery as DefaultGallery, ImageComponent as DefaultImage } from '../Gallery';
|
|
20
20
|
export var SUPPORTED_VIDEO_FORMATS = ['video/mp4', 'video/ogg', 'video/webm', 'video/quicktime'];
|
|
21
|
-
export var
|
|
22
|
-
|
|
23
|
-
};
|
|
21
|
+
export var isScrapedContent = function (attachment) { return attachment.og_scrape_url || attachment.title_link; };
|
|
22
|
+
export var isUploadedImage = function (attachment) { return attachment.type === 'image' && !isScrapedContent(attachment); };
|
|
23
|
+
export var isGalleryAttachmentType = function (output) { return Array.isArray(output.images); };
|
|
24
24
|
export var isAudioAttachment = function (attachment) { return attachment.type === 'audio'; };
|
|
25
25
|
export var isFileAttachment = function (attachment) {
|
|
26
26
|
return attachment.type === 'file' ||
|
|
@@ -28,31 +28,51 @@ export var isFileAttachment = function (attachment) {
|
|
|
28
28
|
SUPPORTED_VIDEO_FORMATS.indexOf(attachment.mime_type) === -1 &&
|
|
29
29
|
attachment.type !== 'video');
|
|
30
30
|
};
|
|
31
|
-
export var isImageAttachment = function (attachment) { return attachment.type === 'image' && !attachment.title_link && !attachment.og_scrape_url; };
|
|
32
31
|
export var isMediaAttachment = function (attachment) {
|
|
33
32
|
return (attachment.mime_type && SUPPORTED_VIDEO_FORMATS.indexOf(attachment.mime_type) !== -1) ||
|
|
34
33
|
attachment.type === 'video';
|
|
35
34
|
};
|
|
35
|
+
/**
|
|
36
|
+
* @deprecated will be removed in the next major release,
|
|
37
|
+
* replaced with the proper component equivalent `AttachmentContainer/AttachmentWithinContainer`
|
|
38
|
+
*/
|
|
36
39
|
export var renderAttachmentWithinContainer = function (props) {
|
|
40
|
+
var _a;
|
|
41
|
+
var _b;
|
|
37
42
|
var attachment = props.attachment, children = props.children, componentType = props.componentType;
|
|
43
|
+
var isGAT = isGalleryAttachmentType(attachment);
|
|
38
44
|
var extra = '';
|
|
39
|
-
if (!
|
|
45
|
+
if (!isGAT) {
|
|
40
46
|
extra =
|
|
41
47
|
componentType === 'card' && !(attachment === null || attachment === void 0 ? void 0 : attachment.image_url) && !(attachment === null || attachment === void 0 ? void 0 : attachment.thumb_url)
|
|
42
48
|
? 'no-image'
|
|
43
|
-
: attachment
|
|
49
|
+
: ((_b = attachment === null || attachment === void 0 ? void 0 : attachment.actions) === null || _b === void 0 ? void 0 : _b.length)
|
|
44
50
|
? 'actions'
|
|
45
51
|
: '';
|
|
46
52
|
}
|
|
47
|
-
|
|
53
|
+
var classNames = clsx('str-chat__message-attachment', (_a = {},
|
|
54
|
+
_a["str-chat__message-attachment--".concat(componentType)] = componentType,
|
|
55
|
+
_a["str-chat__message-attachment--".concat(attachment === null || attachment === void 0 ? void 0 : attachment.type)] = attachment === null || attachment === void 0 ? void 0 : attachment.type,
|
|
56
|
+
_a["str-chat__message-attachment--".concat(componentType, "--").concat(extra)] = componentType && extra,
|
|
57
|
+
_a['str-chat__message-attachment-with-actions'] = extra === 'actions',
|
|
58
|
+
_a));
|
|
59
|
+
return React.createElement("div", { className: classNames }, children);
|
|
48
60
|
};
|
|
61
|
+
/**
|
|
62
|
+
* @deprecated will be removed in the next major release,
|
|
63
|
+
* replaced with the proper component equivalent `AttachmentContainer/AttachmentActionsContainer`
|
|
64
|
+
*/
|
|
49
65
|
export var renderAttachmentActions = function (props) {
|
|
50
66
|
var _a;
|
|
51
67
|
var actionHandler = props.actionHandler, attachment = props.attachment, _b = props.AttachmentActions, AttachmentActions = _b === void 0 ? DefaultAttachmentActions : _b;
|
|
52
68
|
if (!((_a = attachment.actions) === null || _a === void 0 ? void 0 : _a.length))
|
|
53
69
|
return null;
|
|
54
|
-
return (React.createElement(AttachmentActions, __assign({}, attachment, { actionHandler: function (event, name, value) { return actionHandler === null || actionHandler === void 0 ? void 0 : actionHandler(event, name, value); }, actions: attachment.actions, id: attachment.id || '', key: "key-actions-"
|
|
70
|
+
return (React.createElement(AttachmentActions, __assign({}, attachment, { actionHandler: function (event, name, value) { return actionHandler === null || actionHandler === void 0 ? void 0 : actionHandler(event, name, value); }, actions: attachment.actions, id: attachment.id || '', key: "key-actions-".concat(attachment.id), text: attachment.text || '' })));
|
|
55
71
|
};
|
|
72
|
+
/**
|
|
73
|
+
* @deprecated will be removed in the next major release,
|
|
74
|
+
* replaced with the proper component equivalent `AttachmentContainer/GalleryContainer`
|
|
75
|
+
*/
|
|
56
76
|
export var renderGallery = function (props) {
|
|
57
77
|
var attachment = props.attachment, _a = props.Gallery, Gallery = _a === void 0 ? DefaultGallery : _a;
|
|
58
78
|
return renderAttachmentWithinContainer({
|
|
@@ -61,12 +81,16 @@ export var renderGallery = function (props) {
|
|
|
61
81
|
componentType: 'gallery',
|
|
62
82
|
});
|
|
63
83
|
};
|
|
84
|
+
/**
|
|
85
|
+
* @deprecated will be removed in the next major release,
|
|
86
|
+
* replaced with the proper component equivalent `AttachmentContainer/ImageContainer`
|
|
87
|
+
*/
|
|
64
88
|
export var renderImage = function (props) {
|
|
65
89
|
var attachment = props.attachment, _a = props.Image, Image = _a === void 0 ? DefaultImage : _a;
|
|
66
90
|
if (attachment.actions && attachment.actions.length) {
|
|
67
91
|
return renderAttachmentWithinContainer({
|
|
68
92
|
attachment: attachment,
|
|
69
|
-
children: (React.createElement("div", { className: 'str-chat__attachment', key: "key-image-"
|
|
93
|
+
children: (React.createElement("div", { className: 'str-chat__attachment', key: "key-image-".concat(attachment.id) },
|
|
70
94
|
React.createElement(Image, __assign({}, attachment)),
|
|
71
95
|
renderAttachmentActions(props))),
|
|
72
96
|
componentType: 'image',
|
|
@@ -74,53 +98,69 @@ export var renderImage = function (props) {
|
|
|
74
98
|
}
|
|
75
99
|
return renderAttachmentWithinContainer({
|
|
76
100
|
attachment: attachment,
|
|
77
|
-
children: React.createElement(Image, __assign({}, attachment, { key: "key-image-"
|
|
101
|
+
children: React.createElement(Image, __assign({}, attachment, { key: "key-image-".concat(attachment.id) })),
|
|
78
102
|
componentType: 'image',
|
|
79
103
|
});
|
|
80
104
|
};
|
|
105
|
+
/**
|
|
106
|
+
* @deprecated will be removed in the next major release,
|
|
107
|
+
* replaced with the proper component equivalent `AttachmentContainer/CardContainer`
|
|
108
|
+
*/
|
|
81
109
|
export var renderCard = function (props) {
|
|
82
110
|
var attachment = props.attachment, _a = props.Card, Card = _a === void 0 ? DefaultCard : _a;
|
|
83
111
|
if (attachment.actions && attachment.actions.length) {
|
|
84
112
|
return renderAttachmentWithinContainer({
|
|
85
113
|
attachment: attachment,
|
|
86
|
-
children: (React.createElement("div", { className: 'str-chat__attachment', key: "key-image-"
|
|
87
|
-
React.createElement(Card, __assign({}, attachment, { key: "key-card-"
|
|
114
|
+
children: (React.createElement("div", { className: 'str-chat__attachment', key: "key-image-".concat(attachment.id) },
|
|
115
|
+
React.createElement(Card, __assign({}, attachment, { key: "key-card-".concat(attachment.id) })),
|
|
88
116
|
renderAttachmentActions(props))),
|
|
89
117
|
componentType: 'card',
|
|
90
118
|
});
|
|
91
119
|
}
|
|
92
120
|
return renderAttachmentWithinContainer({
|
|
93
121
|
attachment: attachment,
|
|
94
|
-
children: React.createElement(Card, __assign({}, attachment, { key: "key-card-"
|
|
122
|
+
children: React.createElement(Card, __assign({}, attachment, { key: "key-card-".concat(attachment.id) })),
|
|
95
123
|
componentType: 'card',
|
|
96
124
|
});
|
|
97
125
|
};
|
|
126
|
+
/**
|
|
127
|
+
* @deprecated will be removed in the next major release,
|
|
128
|
+
* replaced with the proper component equivalent `AttachmentContainer/FileContainer`
|
|
129
|
+
*/
|
|
98
130
|
export var renderFile = function (props) {
|
|
99
131
|
var attachment = props.attachment, _a = props.File, File = _a === void 0 ? DefaultFile : _a;
|
|
100
132
|
if (!attachment.asset_url)
|
|
101
133
|
return null;
|
|
102
134
|
return renderAttachmentWithinContainer({
|
|
103
135
|
attachment: attachment,
|
|
104
|
-
children: React.createElement(File, { attachment: attachment, key: "key-file-"
|
|
136
|
+
children: React.createElement(File, { attachment: attachment, key: "key-file-".concat(attachment.id) }),
|
|
105
137
|
componentType: 'file',
|
|
106
138
|
});
|
|
107
139
|
};
|
|
140
|
+
/**
|
|
141
|
+
* @deprecated will be removed in the next major release,
|
|
142
|
+
* replaced with the proper component equivalent `AttachmentContainer/AudioContainer`
|
|
143
|
+
*/
|
|
108
144
|
export var renderAudio = function (props) {
|
|
109
145
|
var attachment = props.attachment, _a = props.Audio, Audio = _a === void 0 ? DefaultAudio : _a;
|
|
110
146
|
return renderAttachmentWithinContainer({
|
|
111
147
|
attachment: attachment,
|
|
112
|
-
children: (React.createElement("div", { className: 'str-chat__attachment', key: "key-video-"
|
|
148
|
+
children: (React.createElement("div", { className: 'str-chat__attachment', key: "key-video-".concat(attachment.id) },
|
|
113
149
|
React.createElement(Audio, { og: attachment }))),
|
|
114
150
|
componentType: 'audio',
|
|
115
151
|
});
|
|
116
152
|
};
|
|
153
|
+
/**
|
|
154
|
+
* @deprecated will be removed in the next major release,
|
|
155
|
+
* replaced with the proper component equivalent `AttachmentContainer/MediaContainer`
|
|
156
|
+
*/
|
|
117
157
|
export var renderMedia = function (props) {
|
|
118
158
|
var _a;
|
|
119
159
|
var attachment = props.attachment, _b = props.Media, Media = _b === void 0 ? ReactPlayer : _b;
|
|
120
160
|
if ((_a = attachment.actions) === null || _a === void 0 ? void 0 : _a.length) {
|
|
121
161
|
return renderAttachmentWithinContainer({
|
|
122
162
|
attachment: attachment,
|
|
123
|
-
children: (React.createElement("div", { className: 'str-chat__attachment str-chat__attachment-media', key: "key-video-"
|
|
163
|
+
children: (React.createElement("div", { className: 'str-chat__attachment str-chat__attachment-media', key: "key-video-".concat(attachment.id) },
|
|
124
164
|
React.createElement("div", { className: 'str-chat__player-wrapper' },
|
|
125
165
|
React.createElement(Media, { className: 'react-player', controls: true, height: '100%', url: attachment.asset_url, width: '100%' })),
|
|
126
166
|
renderAttachmentActions(props))),
|
|
@@ -129,7 +169,7 @@ export var renderMedia = function (props) {
|
|
|
129
169
|
}
|
|
130
170
|
return renderAttachmentWithinContainer({
|
|
131
171
|
attachment: attachment,
|
|
132
|
-
children: (React.createElement("div", { className: 'str-chat__player-wrapper', key: "key-video-"
|
|
172
|
+
children: (React.createElement("div", { className: 'str-chat__player-wrapper', key: "key-video-".concat(attachment.id) },
|
|
133
173
|
React.createElement(Media, { className: 'react-player', controls: true, height: '100%', url: attachment.asset_url, width: '100%' }))),
|
|
134
174
|
componentType: 'media',
|
|
135
175
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Item.d.ts","sourceRoot":"","sources":["../../../src/components/AutoCompleteTextarea/Item.jsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Item.d.ts","sourceRoot":"","sources":["../../../src/components/AutoCompleteTextarea/Item.jsx"],"names":[],"mappings":"AAKA,6EAgDG"}
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { useChatContext } from '../../context/ChatContext';
|
|
2
4
|
export var Item = React.forwardRef(function Item(props, innerRef) {
|
|
3
5
|
var className = props.className, Component = props.component, item = props.item, onClickHandler = props.onClickHandler, onSelectHandler = props.onSelectHandler, selected = props.selected, style = props.style;
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
var themeVersion = useChatContext('SuggestionItem').themeVersion;
|
|
7
|
+
var selectItem = useCallback(function () { return onSelectHandler(item); }, [item, onClickHandler]);
|
|
8
|
+
if (themeVersion === '2')
|
|
9
|
+
return (React.createElement("li", { className: clsx(className, { 'str-chat__suggestion-item--selected': selected }), style: style },
|
|
10
|
+
React.createElement("a", { href: '', onClick: onClickHandler, onFocus: selectItem, onMouseEnter: selectItem, ref: innerRef },
|
|
11
|
+
React.createElement(Component, { entity: item, selected: selected }))));
|
|
12
|
+
return (React.createElement("li", { className: clsx('rta__item', className), style: style },
|
|
13
|
+
React.createElement("button", { className: clsx('rta__entity', { 'rta__entity--selected': selected }), onClick: onClickHandler, onFocus: selectItem, onMouseEnter: selectItem, ref: innerRef },
|
|
7
14
|
React.createElement("div", { tabIndex: -1 },
|
|
8
15
|
React.createElement(Component, { entity: item, selected: selected })))));
|
|
9
16
|
});
|
|
@@ -1,2 +1,18 @@
|
|
|
1
|
-
export function List(
|
|
1
|
+
export function List({ className, component, currentTrigger, dropdownScroll, getSelectedItem, getTextToReplace, Header: PropHeader, itemClassName, itemStyle, onSelect, selectionEnd, style, SuggestionItem: PropSuggestionItem, value: propValue, values, }: {
|
|
2
|
+
className: any;
|
|
3
|
+
component: any;
|
|
4
|
+
currentTrigger: any;
|
|
5
|
+
dropdownScroll: any;
|
|
6
|
+
getSelectedItem: any;
|
|
7
|
+
getTextToReplace: any;
|
|
8
|
+
Header: any;
|
|
9
|
+
itemClassName: any;
|
|
10
|
+
itemStyle: any;
|
|
11
|
+
onSelect: any;
|
|
12
|
+
selectionEnd: any;
|
|
13
|
+
style: any;
|
|
14
|
+
SuggestionItem: any;
|
|
15
|
+
value: any;
|
|
16
|
+
values: any;
|
|
17
|
+
}): JSX.Element;
|
|
2
18
|
//# sourceMappingURL=List.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List.d.ts","sourceRoot":"","sources":["../../../src/components/AutoCompleteTextarea/List.jsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"List.d.ts","sourceRoot":"","sources":["../../../src/components/AutoCompleteTextarea/List.jsx"],"names":[],"mappings":"AAUO;;;;;;;;;;;;;;;;gBAqJN"}
|
|
@@ -9,17 +9,20 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
-
import React, { useCallback, useEffect, useState } from 'react';
|
|
12
|
+
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
13
|
+
import clsx from 'clsx';
|
|
13
14
|
import { useComponentContext } from '../../context/ComponentContext';
|
|
15
|
+
import { useChatContext } from '../../context/ChatContext';
|
|
14
16
|
import { escapeRegExp } from '../../utils';
|
|
15
17
|
import { Item } from './Item';
|
|
16
18
|
import { DefaultSuggestionListHeader } from './Header';
|
|
17
|
-
export var List = function (
|
|
18
|
-
var className =
|
|
19
|
-
var
|
|
19
|
+
export var List = function (_a) {
|
|
20
|
+
var className = _a.className, component = _a.component, currentTrigger = _a.currentTrigger, dropdownScroll = _a.dropdownScroll, getSelectedItem = _a.getSelectedItem, getTextToReplace = _a.getTextToReplace, PropHeader = _a.Header, itemClassName = _a.itemClassName, itemStyle = _a.itemStyle, onSelect = _a.onSelect, selectionEnd = _a.selectionEnd, style = _a.style, PropSuggestionItem = _a.SuggestionItem, propValue = _a.value, values = _a.values;
|
|
21
|
+
var _b = useComponentContext('SuggestionList'), AutocompleteSuggestionHeader = _b.AutocompleteSuggestionHeader, AutocompleteSuggestionItem = _b.AutocompleteSuggestionItem;
|
|
22
|
+
var themeVersion = useChatContext('SuggestionList').themeVersion;
|
|
20
23
|
var SuggestionItem = PropSuggestionItem || AutocompleteSuggestionItem || Item;
|
|
21
24
|
var SuggestionHeader = PropHeader || AutocompleteSuggestionHeader || DefaultSuggestionListHeader;
|
|
22
|
-
var
|
|
25
|
+
var _c = useState(undefined), selectedItem = _c[0], setSelectedItem = _c[1];
|
|
23
26
|
var itemsRef = [];
|
|
24
27
|
var isSelected = function (item) {
|
|
25
28
|
return selectedItem === values.findIndex(function (value) { return getId(value) === getId(item); });
|
|
@@ -42,17 +45,15 @@ export var List = function (props) {
|
|
|
42
45
|
getSelectedItem(value);
|
|
43
46
|
};
|
|
44
47
|
var handleClick = function (e) {
|
|
45
|
-
|
|
46
|
-
if (e)
|
|
47
|
-
(_a = e.preventDefault) === null || _a === void 0 ? void 0 : _a.call(e);
|
|
48
|
+
e === null || e === void 0 ? void 0 : e.preventDefault();
|
|
48
49
|
modifyText(values[selectedItem]);
|
|
49
50
|
};
|
|
50
|
-
var selectItem = function (item) {
|
|
51
|
+
var selectItem = useCallback(function (item) {
|
|
51
52
|
var index = values.findIndex(function (value) {
|
|
52
53
|
return value.id ? value.id === item.id : value.name === item.name;
|
|
53
54
|
});
|
|
54
55
|
setSelectedItem(index);
|
|
55
|
-
};
|
|
56
|
+
}, [values]);
|
|
56
57
|
var handleKeyDown = useCallback(function (event) {
|
|
57
58
|
if (event.key === 'ArrowUp') {
|
|
58
59
|
setSelectedItem(function (prevSelected) {
|
|
@@ -85,19 +86,20 @@ export var List = function (props) {
|
|
|
85
86
|
if (values === null || values === void 0 ? void 0 : values.length)
|
|
86
87
|
selectItem(values[0]);
|
|
87
88
|
}, [values]); // eslint-disable-line
|
|
88
|
-
var restructureItem = function (item) {
|
|
89
|
+
var restructureItem = useCallback(function (item) {
|
|
89
90
|
var matched = item.name || item.id;
|
|
90
91
|
var textBeforeCursor = propValue.slice(0, selectionEnd);
|
|
91
92
|
var triggerIndex = textBeforeCursor.lastIndexOf(currentTrigger);
|
|
92
93
|
var editedPropValue = escapeRegExp(textBeforeCursor.slice(triggerIndex + 1));
|
|
93
|
-
var parts = matched.split(new RegExp("("
|
|
94
|
+
var parts = matched.split(new RegExp("(".concat(editedPropValue, ")"), 'gi'));
|
|
94
95
|
var itemNameParts = { match: editedPropValue, parts: parts };
|
|
95
96
|
return __assign(__assign({}, item), { itemNameParts: itemNameParts });
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
97
|
+
}, [propValue, selectionEnd, currentTrigger]);
|
|
98
|
+
var restructuredValues = useMemo(function () { return values.map(restructureItem); }, [values, restructureItem]);
|
|
99
|
+
return (React.createElement("ul", { className: clsx('rta__list', className), style: style },
|
|
100
|
+
themeVersion === '1' && (React.createElement("li", { className: 'rta__list-header' },
|
|
101
|
+
React.createElement(SuggestionHeader, { currentTrigger: currentTrigger, value: propValue }))),
|
|
102
|
+
restructuredValues.map(function (item, i) { return (React.createElement(SuggestionItem, { className: itemClassName, component: component, item: item, key: getId(item), onClickHandler: handleClick, onSelectHandler: selectItem, ref: function (ref) {
|
|
101
103
|
itemsRef[i] = ref;
|
|
102
104
|
}, selected: isSelected(item), style: itemStyle, value: propValue })); })));
|
|
103
105
|
};
|