stream-chat-react 11.16.1 → 11.18.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/dist/{Window-9d319da4.js → Window-5802024e.js} +289 -156
- package/dist/assets/icons/stream-chat-icons.eot +0 -0
- package/dist/assets/icons/stream-chat-icons.svg +46 -0
- package/dist/assets/icons/stream-chat-icons.ttf +0 -0
- package/dist/assets/icons/stream-chat-icons.woff +0 -0
- package/dist/assets/icons/stream-chat-icons.woff2 +0 -0
- package/dist/browser.full-bundle.js +299 -161
- package/dist/browser.full-bundle.js.map +1 -1
- package/dist/browser.full-bundle.min.js +4 -4
- package/dist/browser.full-bundle.min.js.map +1 -1
- package/dist/components/Attachment/AttachmentContainer.js +1 -1
- package/dist/components/Attachment/UnsupportedAttachment.d.ts.map +1 -1
- package/dist/components/Attachment/UnsupportedAttachment.js +7 -7
- package/dist/components/Attachment/utils.d.ts +9 -4
- package/dist/components/Attachment/utils.d.ts.map +1 -1
- package/dist/components/Attachment/utils.js +17 -2
- package/dist/components/Emojis/index.cjs.js +1 -1
- package/dist/components/MediaRecorder/AudioRecorder/AudioRecorder.js +1 -1
- package/dist/components/MediaRecorder/classes/MediaRecorderController.d.ts +9 -8
- package/dist/components/MediaRecorder/classes/MediaRecorderController.d.ts.map +1 -1
- package/dist/components/MediaRecorder/classes/MediaRecorderController.js +4 -4
- package/dist/components/MediaRecorder/hooks/useMediaRecorder.d.ts +3 -3
- package/dist/components/MediaRecorder/hooks/useMediaRecorder.d.ts.map +1 -1
- package/dist/components/Message/MessageSimple.d.ts.map +1 -1
- package/dist/components/Message/MessageSimple.js +2 -1
- package/dist/components/MessageInput/AttachmentPreviewList/AttachmentPreviewList.d.ts +16 -0
- package/dist/components/MessageInput/AttachmentPreviewList/AttachmentPreviewList.d.ts.map +1 -0
- package/dist/components/MessageInput/AttachmentPreviewList/AttachmentPreviewList.js +37 -0
- package/dist/components/MessageInput/AttachmentPreviewList/FileAttachmentPreview.d.ts +13 -0
- package/dist/components/MessageInput/AttachmentPreviewList/FileAttachmentPreview.d.ts.map +1 -0
- package/dist/components/MessageInput/AttachmentPreviewList/FileAttachmentPreview.js +19 -0
- package/dist/components/MessageInput/AttachmentPreviewList/ImageAttachmentPreview.d.ts +7 -0
- package/dist/components/MessageInput/AttachmentPreviewList/ImageAttachmentPreview.d.ts.map +1 -0
- package/dist/components/MessageInput/AttachmentPreviewList/ImageAttachmentPreview.js +23 -0
- package/dist/components/MessageInput/AttachmentPreviewList/UnsupportedAttachmentPreview.d.ts +7 -0
- package/dist/components/MessageInput/AttachmentPreviewList/UnsupportedAttachmentPreview.d.ts.map +1 -0
- package/dist/components/MessageInput/AttachmentPreviewList/UnsupportedAttachmentPreview.js +22 -0
- package/dist/components/MessageInput/AttachmentPreviewList/UploadPreviewItem.d.ts +12 -0
- package/dist/components/MessageInput/AttachmentPreviewList/UploadPreviewItem.d.ts.map +1 -0
- package/dist/components/MessageInput/AttachmentPreviewList/UploadPreviewItem.js +61 -0
- package/dist/components/MessageInput/AttachmentPreviewList/VoiceRecordingPreview.d.ts +7 -0
- package/dist/components/MessageInput/AttachmentPreviewList/VoiceRecordingPreview.d.ts.map +1 -0
- package/dist/components/MessageInput/AttachmentPreviewList/VoiceRecordingPreview.js +27 -0
- package/dist/components/MessageInput/AttachmentPreviewList/index.d.ts +7 -0
- package/dist/components/MessageInput/AttachmentPreviewList/index.d.ts.map +1 -0
- package/dist/components/MessageInput/AttachmentPreviewList/index.js +1 -0
- package/dist/components/MessageInput/AttachmentPreviewList/types.d.ts +8 -0
- package/dist/components/MessageInput/AttachmentPreviewList/types.d.ts.map +1 -0
- package/dist/components/MessageInput/AttachmentPreviewList/types.js +1 -0
- package/dist/components/MessageInput/hooks/useAttachments.d.ts +4 -2
- package/dist/components/MessageInput/hooks/useAttachments.d.ts.map +1 -1
- package/dist/components/MessageInput/hooks/useAttachments.js +73 -33
- package/dist/components/MessageInput/hooks/useCreateMessageInputContext.d.ts.map +1 -1
- package/dist/components/MessageInput/hooks/useCreateMessageInputContext.js +5 -3
- package/dist/components/MessageInput/hooks/useMessageInputState.d.ts +18 -16
- package/dist/components/MessageInput/hooks/useMessageInputState.d.ts.map +1 -1
- package/dist/components/MessageInput/hooks/useMessageInputState.js +19 -15
- package/dist/components/MessageInput/hooks/useSubmitHandler.js +3 -3
- package/dist/components/MessageInput/index.d.ts +1 -0
- package/dist/components/MessageInput/index.d.ts.map +1 -1
- package/dist/components/MessageInput/types.d.ts +33 -10
- package/dist/components/MessageInput/types.d.ts.map +1 -1
- package/dist/components/MessageList/MessageList.d.ts +6 -1
- package/dist/components/MessageList/MessageList.d.ts.map +1 -1
- package/dist/components/MessageList/MessageList.js +2 -1
- package/dist/components/MessageList/VirtualizedMessageList.d.ts +6 -1
- package/dist/components/MessageList/VirtualizedMessageList.d.ts.map +1 -1
- package/dist/components/MessageList/VirtualizedMessageList.js +3 -2
- package/dist/components/MessageList/hooks/MessageList/useEnrichedMessages.d.ts +14 -1
- package/dist/components/MessageList/hooks/MessageList/useEnrichedMessages.d.ts.map +1 -1
- package/dist/components/MessageList/hooks/MessageList/useEnrichedMessages.js +3 -2
- package/dist/components/MessageList/utils.d.ts +18 -3
- package/dist/components/MessageList/utils.d.ts.map +1 -1
- package/dist/components/MessageList/utils.js +15 -5
- package/dist/context/ChannelStateContext.d.ts +1 -1
- package/dist/context/ComponentContext.d.ts +2 -1
- package/dist/context/ComponentContext.d.ts.map +1 -1
- package/dist/context/MessageInputContext.d.ts +4 -3
- package/dist/context/MessageInputContext.d.ts.map +1 -1
- package/dist/css/v2/index.css +2 -2
- package/dist/css/v2/index.layout.css +2 -2
- package/dist/i18n/Streami18n.d.ts +1 -0
- package/dist/i18n/Streami18n.d.ts.map +1 -1
- package/dist/i18n/de.json +1 -0
- package/dist/i18n/en.json +1 -0
- package/dist/i18n/es.json +1 -0
- package/dist/i18n/fr.json +1 -0
- package/dist/i18n/hi.json +1 -0
- package/dist/i18n/it.json +1 -0
- package/dist/i18n/ja.json +1 -0
- package/dist/i18n/ko.json +1 -0
- package/dist/i18n/nl.json +1 -0
- package/dist/i18n/pt.json +1 -0
- package/dist/i18n/ru.json +1 -0
- package/dist/i18n/tr.json +1 -0
- package/dist/index.cjs.js +13 -5
- package/dist/scss/v2/AttachmentList/AttachmentList-layout.scss +38 -1
- package/dist/scss/v2/AttachmentList/AttachmentList-theme.scss +8 -0
- package/dist/scss/v2/AttachmentPreviewList/AttachmentPreviewList-layout.scss +9 -1
- package/dist/scss/v2/AttachmentPreviewList/AttachmentPreviewList-theme.scss +13 -0
- package/dist/scss/v2/Avatar/Avatar-layout.scss +46 -0
- package/dist/scss/v2/Channel/Channel-layout.scss +1 -0
- package/dist/scss/v2/Channel/Channel-theme.scss +1 -0
- package/dist/scss/v2/ChannelList/ChannelList-layout.scss +2 -2
- package/dist/scss/v2/ChannelList/ChannelList-theme.scss +4 -2
- package/dist/scss/v2/ChannelPreview/ChannelPreview-layout.scss +2 -0
- package/dist/scss/v2/ChannelPreview/ChannelPreview-theme.scss +1 -0
- package/dist/scss/v2/Icon/Icon-layout.scss +87 -0
- package/dist/scss/v2/Icon/Icon-theme.scss +13 -0
- package/dist/scss/v2/ImageCarousel/ImageCarousel-layout.scss +1 -0
- package/dist/scss/v2/ImageCarousel/ImageCarousel-theme.scss +1 -0
- package/dist/scss/v2/LoadingIndicator/LoadingIndicator-layout.scss +10 -1
- package/dist/scss/v2/LoadingIndicator/LoadingIndicator-theme.scss +6 -4
- package/dist/scss/v2/Message/Message-layout.scss +6 -0
- package/dist/scss/v2/Message/Message-theme.scss +6 -0
- package/dist/scss/v2/MessageInput/MessageInput-layout.scss +4 -1
- package/dist/scss/v2/MessageInput/MessageInput-theme.scss +3 -0
- package/dist/scss/v2/MessageList/MessageList-theme.scss +2 -0
- package/dist/scss/v2/Modal/Modal-layout.scss +1 -0
- package/dist/scss/v2/Modal/Modal-theme.scss +6 -0
- package/dist/scss/v2/_base.scss +3 -2
- package/dist/scss/v2/_icons.scss +22 -2
- package/dist/scss/v2/index.layout.scss +1 -0
- package/dist/scss/v2/index.scss +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
- package/dist/components/MessageInput/AttachmentPreviewList.d.ts +0 -9
- package/dist/components/MessageInput/AttachmentPreviewList.d.ts.map +0 -1
- package/dist/components/MessageInput/AttachmentPreviewList.js +0 -112
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
justify-content: center;
|
|
48
48
|
|
|
49
49
|
.str-chat__file-input-container {
|
|
50
|
+
--str-chat-icon-height: calc(var(--str-chat__spacing-px) * 24);
|
|
50
51
|
@include utils.flex-row-center;
|
|
51
52
|
width: calc(var(--str-chat__spacing-px) * 45);
|
|
52
53
|
height: calc(var(--str-chat__spacing-px) * 45);
|
|
@@ -133,6 +134,7 @@
|
|
|
133
134
|
}
|
|
134
135
|
|
|
135
136
|
.str-chat__send-button {
|
|
137
|
+
--str-chat-icon-height: calc(var(--str-chat__spacing-px) * 32);
|
|
136
138
|
@include utils.flex-row-center;
|
|
137
139
|
cursor: pointer;
|
|
138
140
|
padding: 0;
|
|
@@ -208,7 +210,8 @@
|
|
|
208
210
|
flex-grow: initial;
|
|
209
211
|
}
|
|
210
212
|
|
|
211
|
-
[dir='rtl'] .str-chat__send-button,
|
|
213
|
+
[dir='rtl'] .str-chat__send-button,
|
|
214
|
+
[dir='rtl'] .str-chat__start-recording-audio-button {
|
|
212
215
|
svg {
|
|
213
216
|
transform: scale(-1, 1);
|
|
214
217
|
}
|
|
@@ -181,6 +181,7 @@
|
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
.str-chat__file-input-container {
|
|
184
|
+
--str-chat-icon-color: var(--str-chat__message-input-tools-color);
|
|
184
185
|
@include utils.component-layer-overrides('message-input-tools');
|
|
185
186
|
|
|
186
187
|
svg path {
|
|
@@ -209,6 +210,7 @@
|
|
|
209
210
|
}
|
|
210
211
|
|
|
211
212
|
.str-chat__send-button {
|
|
213
|
+
--str-chat-icon-color: var(--str-chat__message-send-color);
|
|
212
214
|
@include utils.component-layer-overrides('message-send');
|
|
213
215
|
|
|
214
216
|
svg path {
|
|
@@ -216,6 +218,7 @@
|
|
|
216
218
|
}
|
|
217
219
|
|
|
218
220
|
&:disabled {
|
|
221
|
+
--str-chat-icon-color: var(--str-chat__message-send-disabled-color);
|
|
219
222
|
background-color: transparent;
|
|
220
223
|
|
|
221
224
|
svg path {
|
|
@@ -91,6 +91,8 @@
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
.str-chat__jump-to-latest-message {
|
|
94
|
+
--str-chat-icon-color: var(--str-chat__jump-to-latest-message-unread-count-background-color);
|
|
95
|
+
|
|
94
96
|
.str-chat__circle-fab {
|
|
95
97
|
@include utils.component-layer-overrides('jump-to-latest-message');
|
|
96
98
|
@include utils.circle-fab-overrides('jump-to-latest-message');
|
|
@@ -47,8 +47,14 @@
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
.str-chat__modal__close-button {
|
|
50
|
+
--str-chat-icon-color: var(--str-chat__modal-close-icon-color);
|
|
50
51
|
@include utils.button-reset;
|
|
51
52
|
|
|
53
|
+
.str-chat__icon {
|
|
54
|
+
background-color: var(--str-chat__modal-close-icon-background);
|
|
55
|
+
border-radius: 999px;
|
|
56
|
+
}
|
|
57
|
+
|
|
52
58
|
svg {
|
|
53
59
|
path {
|
|
54
60
|
fill: var(--str-chat__modal-close-icon-color);
|
package/dist/scss/v2/_base.scss
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
.str-chat {
|
|
2
2
|
box-sizing: border-box;
|
|
3
|
+
font-family: var(--str-chat__font-family);
|
|
3
4
|
|
|
4
5
|
* {
|
|
5
|
-
font-family: var(--str-chat__font-family);
|
|
6
6
|
box-sizing: border-box;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
// Overriding styles of ngx-popperjs/ngx-float-ui
|
|
10
|
-
.ngxp__container,
|
|
10
|
+
.ngxp__container,
|
|
11
|
+
.float-ui-container {
|
|
11
12
|
z-index: 1;
|
|
12
13
|
padding: 0 !important;
|
|
13
14
|
box-shadow: none !important;
|
package/dist/scss/v2/_icons.scss
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
1
|
.str-chat {
|
|
2
|
-
--str-chat__image-fallback-icon: url(
|
|
3
|
-
}
|
|
2
|
+
--str-chat__image-fallback-icon: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9ImN1cnJlbnRDb2xvciIgY2xhc3M9InN0ci1jaGF0X19pbWFnZS1mYWxsYmFja19faWNvbiIgdmlld0JveD0iMCAwIDE4IDE4Ij48cGF0aCBkPSJNMTYgMnYxNEgyVjJoMTRabTAtMkgyQy45IDAgMCAuOSAwIDJ2MTRjMCAxLjEuOSAyIDIgMmgxNGMxLjEgMCAyLS45IDItMlYyYzAtMS4xLS45LTItMi0yWm0tNC44NiA4Ljg2LTMgMy44N0w2IDEwLjE0IDMgMTRoMTJsLTMuODYtNS4xNFoiLz48L3N2Zz4=');
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
@font-face {
|
|
6
|
+
font-family: 'stream-chat-icons';
|
|
7
|
+
src: url('../assets/icons/stream-chat-icons.eot');
|
|
8
|
+
src: url('../assets/icons/stream-chat-icons.eot#iefix') format('embedded-opentype'),
|
|
9
|
+
url('../assets/icons/stream-chat-icons.woff') format('woff2'),
|
|
10
|
+
url('../assets/icons/stream-chat-icons.woff') format('woff'),
|
|
11
|
+
url('../assets/icons/stream-chat-icons.ttf') format('truetype'),
|
|
12
|
+
url('../assets/icons/stream-chat-icons.svg#stream-chat-icons') format('svg');
|
|
13
|
+
font-weight: normal;
|
|
14
|
+
font-style: normal;
|
|
15
|
+
}
|
|
16
|
+
/* Chrome hack: SVG is rendered more smooth in Windozze. 100% magic, uncomment if you need it. */
|
|
17
|
+
/* Note, that will break hinting! In other OS-es font will be not as sharp as it could be */
|
|
18
|
+
@media screen and (-webkit-min-device-pixel-ratio: 0) {
|
|
19
|
+
@font-face {
|
|
20
|
+
font-family: 'stream-chat-icons';
|
|
21
|
+
src: url('../assets/icons/stream-chat-icons.svg#stream-chat-icons') format('svg');
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
@use 'common/CircleFAButton/CircleFAButton-layout';
|
|
18
18
|
@use 'EditMessageForm/EditMessageForm-layout';
|
|
19
19
|
@use 'ImageCarousel/ImageCarousel-layout';
|
|
20
|
+
@use 'Icon/Icon-layout';
|
|
20
21
|
@use 'LinkPreview/LinkPreview-layout';
|
|
21
22
|
@use 'LoadingIndicator/LoadingIndicator-layout';
|
|
22
23
|
@use 'Message/Message-layout';
|
package/dist/scss/v2/index.scss
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
@use 'ChannelPreview/ChannelPreview-theme';
|
|
19
19
|
@use 'ChannelSearch/ChannelSearch-theme';
|
|
20
20
|
@use 'EditMessageForm/EditMessageForm-theme';
|
|
21
|
+
@use 'Icon/Icon-theme';
|
|
21
22
|
@use 'ImageCarousel/ImageCarousel-theme';
|
|
22
23
|
@use 'LinkPreview/LinkPreview-theme';
|
|
23
24
|
@use 'LoadingIndicator/LoadingIndicator-theme';
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "11.
|
|
1
|
+
export declare const version = "11.18.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export var version = '11.
|
|
1
|
+
export var version = '11.18.0';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stream-chat-react",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.18.0",
|
|
4
4
|
"description": "React components to create chat conversations or livestream style chat",
|
|
5
5
|
"author": "GetStream",
|
|
6
6
|
"homepage": "https://getstream.io/chat/",
|
|
@@ -148,7 +148,7 @@
|
|
|
148
148
|
"@semantic-release/changelog": "^6.0.2",
|
|
149
149
|
"@semantic-release/git": "^10.0.1",
|
|
150
150
|
"@stream-io/rollup-plugin-node-builtins": "^2.1.5",
|
|
151
|
-
"@stream-io/stream-chat-css": "^4.
|
|
151
|
+
"@stream-io/stream-chat-css": "^4.16.0",
|
|
152
152
|
"@testing-library/jest-dom": "^6.1.4",
|
|
153
153
|
"@testing-library/react": "^13.1.1",
|
|
154
154
|
"@testing-library/react-hooks": "^8.0.0",
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { DefaultStreamChatGenerics } from '../../types';
|
|
3
|
-
export declare const AttachmentPreviewList: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>() => React.JSX.Element;
|
|
4
|
-
type PreviewItemProps = {
|
|
5
|
-
id: string;
|
|
6
|
-
};
|
|
7
|
-
export declare const ImagePreviewItem: ({ id }: PreviewItemProps) => React.JSX.Element | null;
|
|
8
|
-
export {};
|
|
9
|
-
//# sourceMappingURL=AttachmentPreviewList.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AttachmentPreviewList.d.ts","sourceRoot":"","sources":["../../../src/components/MessageInput/AttachmentPreviewList.tsx"],"names":[],"mappings":"AACA,OAAO,KAAgC,MAAM,OAAO,CAAC;AAgBrD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAE7D,eAAO,MAAM,qBAAqB,2GAmDjC,CAAC;AA2GF,KAAK,gBAAgB,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvC,eAAO,MAAM,gBAAgB,WAAY,gBAAgB,6BA+DxD,CAAC"}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import clsx from 'clsx';
|
|
2
|
-
import React, { useCallback, useState } from 'react';
|
|
3
|
-
import { CloseIcon, DownloadIcon, LoadingIndicatorIcon, RetryIcon } from './icons';
|
|
4
|
-
import { isAudioAttachment, isMediaAttachment, isVoiceRecordingAttachment, PlayButton, } from '../Attachment';
|
|
5
|
-
import { BaseImage as DefaultBaseImage } from '../Gallery';
|
|
6
|
-
import { useAudioController } from '../Attachment/hooks/useAudioController';
|
|
7
|
-
import { RecordingTimer } from '../MediaRecorder';
|
|
8
|
-
import { FileIcon } from '../ReactFileUtilities';
|
|
9
|
-
import { useComponentContext, useMessageInputContext } from '../../context';
|
|
10
|
-
export var AttachmentPreviewList = function () {
|
|
11
|
-
var _a = useMessageInputContext('AttachmentPreviewList'), attachments = _a.attachments, fileOrder = _a.fileOrder, imageOrder = _a.imageOrder, removeAttachment = _a.removeAttachment, uploadAttachment = _a.uploadAttachment;
|
|
12
|
-
return (React.createElement("div", { className: 'str-chat__attachment-preview-list' },
|
|
13
|
-
React.createElement("div", { className: 'str-chat__attachment-list-scroll-container', "data-testid": 'attachment-list-scroll-container' },
|
|
14
|
-
attachments.map(function (attachment) {
|
|
15
|
-
var _a, _b;
|
|
16
|
-
if (isVoiceRecordingAttachment(attachment)) {
|
|
17
|
-
return (React.createElement(VoiceRecordingPreview, { attachment: attachment, handleRetry: uploadAttachment, key: ((_a = attachment.$internal) === null || _a === void 0 ? void 0 : _a.id) || attachment.asset_url, mimeType: attachment.mime_type, removeAttachment: removeAttachment }));
|
|
18
|
-
}
|
|
19
|
-
else if (isAudioAttachment(attachment) || isMediaAttachment(attachment)) {
|
|
20
|
-
// unnecessary to pass handleRetry as video and audio if among attachments is already uploaded
|
|
21
|
-
// - user looking at the edit message input
|
|
22
|
-
return (React.createElement(FilePreview, { attachment: attachment, handleRetry: uploadAttachment, key: ((_b = attachment.$internal) === null || _b === void 0 ? void 0 : _b.id) || attachment.asset_url, removeAttachment: removeAttachment }));
|
|
23
|
-
}
|
|
24
|
-
return null;
|
|
25
|
-
}),
|
|
26
|
-
imageOrder.map(function (id) { return (React.createElement(ImagePreviewItem, { id: id, key: id })); }),
|
|
27
|
-
fileOrder.map(function (id) { return (React.createElement(FilePreviewItem, { id: id, key: id })); }))));
|
|
28
|
-
};
|
|
29
|
-
var VoiceRecordingPreview = function (_a) {
|
|
30
|
-
var _b, _c, _d;
|
|
31
|
-
var attachment = _a.attachment, handleRetry = _a.handleRetry, mimeType = _a.mimeType, removeAttachment = _a.removeAttachment;
|
|
32
|
-
var _e = useAudioController({ mimeType: mimeType }), audioRef = _e.audioRef, isPlaying = _e.isPlaying, secondsElapsed = _e.secondsElapsed, togglePlay = _e.togglePlay;
|
|
33
|
-
return (React.createElement("div", { className: 'str-chat__attachment-preview-voice-recording', "data-testid": 'attachment-preview-voice-recording' },
|
|
34
|
-
React.createElement("audio", { ref: audioRef },
|
|
35
|
-
React.createElement("source", { "data-testid": 'audio-source', src: attachment.asset_url, type: attachment.mime_type })),
|
|
36
|
-
React.createElement(PlayButton, { isPlaying: isPlaying, onClick: togglePlay }),
|
|
37
|
-
React.createElement("button", { className: 'str-chat__attachment-preview-delete', "data-testid": 'file-preview-item-delete-button', disabled: ((_b = attachment.$internal) === null || _b === void 0 ? void 0 : _b.uploadState) === 'uploading', onClick: function () { var _a; return ((_a = attachment.$internal) === null || _a === void 0 ? void 0 : _a.id) && removeAttachment(attachment.$internal.id); } },
|
|
38
|
-
React.createElement(CloseIcon, null)),
|
|
39
|
-
((_c = attachment.$internal) === null || _c === void 0 ? void 0 : _c.uploadState) === 'failed' && !!handleRetry && (React.createElement("button", { className: 'str-chat__attachment-preview-error str-chat__attachment-preview-error-file', "data-testid": 'file-preview-item-retry-button', onClick: function () { return handleRetry(attachment); } },
|
|
40
|
-
React.createElement(RetryIcon, null))),
|
|
41
|
-
React.createElement("div", { className: 'str-chat__attachment-preview-metadata' },
|
|
42
|
-
React.createElement("div", { className: 'str-chat__attachment-preview-file-name', title: attachment.title }, attachment.title),
|
|
43
|
-
typeof attachment.duration !== 'undefined' && (React.createElement(RecordingTimer, { durationSeconds: secondsElapsed || attachment.duration })),
|
|
44
|
-
((_d = attachment.$internal) === null || _d === void 0 ? void 0 : _d.uploadState) === 'uploading' && React.createElement(LoadingIndicatorIcon, { size: 17 })),
|
|
45
|
-
React.createElement("div", { className: 'str-chat__attachment-preview-file-icon' },
|
|
46
|
-
React.createElement(FileIcon, { filename: attachment.title, mimeType: attachment.mime_type, version: '2' }))));
|
|
47
|
-
};
|
|
48
|
-
var FilePreview = function (_a) {
|
|
49
|
-
var _b, _c, _d, _e;
|
|
50
|
-
var attachment = _a.attachment, handleRetry = _a.handleRetry, removeAttachment = _a.removeAttachment;
|
|
51
|
-
return (React.createElement("div", { className: 'str-chat__attachment-preview-file', "data-testid": 'attachment-preview-file' },
|
|
52
|
-
React.createElement("div", { className: 'str-chat__attachment-preview-file-icon' },
|
|
53
|
-
React.createElement(FileIcon, { filename: attachment.title, mimeType: attachment.mime_type, version: '2' })),
|
|
54
|
-
React.createElement("button", { className: 'str-chat__attachment-preview-delete', "data-testid": 'file-preview-item-delete-button', disabled: ((_b = attachment.$internal) === null || _b === void 0 ? void 0 : _b.uploadState) === 'uploading', onClick: function () { var _a, _b; return ((_a = attachment.$internal) === null || _a === void 0 ? void 0 : _a.id) && removeAttachment((_b = attachment.$internal) === null || _b === void 0 ? void 0 : _b.id); } },
|
|
55
|
-
React.createElement(CloseIcon, null)),
|
|
56
|
-
((_c = attachment.$internal) === null || _c === void 0 ? void 0 : _c.uploadState) === 'failed' && !!handleRetry && (React.createElement("button", { className: 'str-chat__attachment-preview-error str-chat__attachment-preview-error-file', "data-testid": 'file-preview-item-retry-button', onClick: function () { return handleRetry(attachment); } },
|
|
57
|
-
React.createElement(RetryIcon, null))),
|
|
58
|
-
React.createElement("div", { className: 'str-chat__attachment-preview-file-end' },
|
|
59
|
-
React.createElement("div", { className: 'str-chat__attachment-preview-file-name', title: attachment.title }, attachment.title),
|
|
60
|
-
((_d = attachment.$internal) === null || _d === void 0 ? void 0 : _d.uploadState) === 'finished' && (React.createElement("a", { className: 'str-chat__attachment-preview-file-download', download: true, href: attachment.asset_url, rel: 'noreferrer', target: '_blank' },
|
|
61
|
-
React.createElement(DownloadIcon, null))),
|
|
62
|
-
((_e = attachment.$internal) === null || _e === void 0 ? void 0 : _e.uploadState) === 'uploading' && React.createElement(LoadingIndicatorIcon, { size: 17 }))));
|
|
63
|
-
};
|
|
64
|
-
export var ImagePreviewItem = function (_a) {
|
|
65
|
-
var _b;
|
|
66
|
-
var id = _a.id;
|
|
67
|
-
var _c = useComponentContext('ImagePreviewItem').BaseImage, BaseImage = _c === void 0 ? DefaultBaseImage : _c;
|
|
68
|
-
var _d = useMessageInputContext('ImagePreviewItem'), imageUploads = _d.imageUploads, removeImage = _d.removeImage, uploadImage = _d.uploadImage;
|
|
69
|
-
var _e = useState(false), previewError = _e[0], setPreviewError = _e[1];
|
|
70
|
-
var handleRemove = useCallback(function (e) {
|
|
71
|
-
e.stopPropagation();
|
|
72
|
-
removeImage(id);
|
|
73
|
-
}, [removeImage, id]);
|
|
74
|
-
var handleRetry = useCallback(function () { return uploadImage(id); }, [uploadImage, id]);
|
|
75
|
-
var handleLoadError = useCallback(function () { return setPreviewError(true); }, []);
|
|
76
|
-
var image = imageUploads[id];
|
|
77
|
-
// do not display scraped attachments
|
|
78
|
-
if (!image || image.og_scrape_url)
|
|
79
|
-
return null;
|
|
80
|
-
return (React.createElement("div", { className: clsx('str-chat__attachment-preview-image', {
|
|
81
|
-
'str-chat__attachment-preview-image--error': previewError,
|
|
82
|
-
}), "data-testid": 'attachment-preview-image' },
|
|
83
|
-
React.createElement("button", { className: 'str-chat__attachment-preview-delete', "data-testid": 'image-preview-item-delete-button', disabled: image.state === 'uploading', onClick: handleRemove },
|
|
84
|
-
React.createElement(CloseIcon, null)),
|
|
85
|
-
image.state === 'failed' && (React.createElement("button", { className: 'str-chat__attachment-preview-error str-chat__attachment-preview-error-image', "data-testid": 'image-preview-item-retry-button', onClick: handleRetry },
|
|
86
|
-
React.createElement(RetryIcon, null))),
|
|
87
|
-
image.state === 'uploading' && (React.createElement("div", { className: 'str-chat__attachment-preview-image-loading' },
|
|
88
|
-
React.createElement(LoadingIndicatorIcon, { size: 17 }))),
|
|
89
|
-
(image.previewUri || image.url) && (React.createElement(BaseImage, { alt: image.file.name, className: 'str-chat__attachment-preview-thumbnail', onError: handleLoadError, src: (_b = image.previewUri) !== null && _b !== void 0 ? _b : image.url, title: image.file.name }))));
|
|
90
|
-
};
|
|
91
|
-
var FilePreviewItem = function (_a) {
|
|
92
|
-
var id = _a.id;
|
|
93
|
-
var _b = useMessageInputContext('FilePreviewItem'), fileUploads = _b.fileUploads, removeFile = _b.removeFile, uploadFile = _b.uploadFile;
|
|
94
|
-
var handleRemove = useCallback(function (id) {
|
|
95
|
-
removeFile(id);
|
|
96
|
-
}, [removeFile]);
|
|
97
|
-
var handleRetry = useCallback(function (attachment) { return attachment.$internal && uploadFile(attachment.$internal.id); }, [uploadFile]);
|
|
98
|
-
var file = fileUploads[id];
|
|
99
|
-
if (!file)
|
|
100
|
-
return null;
|
|
101
|
-
var attachment = {
|
|
102
|
-
$internal: {
|
|
103
|
-
file: file.file,
|
|
104
|
-
id: id,
|
|
105
|
-
uploadState: file.state,
|
|
106
|
-
},
|
|
107
|
-
asset_url: file.url,
|
|
108
|
-
mime_type: file.file.type,
|
|
109
|
-
title: file.file.name,
|
|
110
|
-
};
|
|
111
|
-
return (React.createElement(FilePreview, { attachment: attachment, handleRetry: handleRetry, removeAttachment: handleRemove }));
|
|
112
|
-
};
|