stream-chat-react 13.0.0-rc.1 → 13.0.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/components/Channel/Channel.d.ts +1 -1
- package/dist/components/Channel/Channel.js +2 -0
- package/dist/components/Chat/hooks/useChat.js +1 -1
- package/dist/components/MessageInput/EditMessageForm.js +1 -1
- package/dist/components/MessageInput/MessageInput.d.ts +1 -3
- package/dist/components/MessageInput/MessageInputFlat.js +2 -2
- package/dist/components/MessageInput/hooks/useCreateMessageInputContext.js +1 -3
- package/dist/components/MessageInput/hooks/useMessageInputControls.d.ts +0 -1
- package/dist/components/MessageInput/hooks/useMessageInputControls.js +3 -4
- package/dist/components/MessageInput/hooks/usePasteHandler.d.ts +1 -1
- package/dist/components/MessageInput/hooks/usePasteHandler.js +4 -4
- package/dist/components/MessageInput/hooks/{useMessageInputText.d.ts → useTextareaRef.d.ts} +1 -2
- package/dist/components/MessageInput/hooks/useTextareaRef.js +14 -0
- package/dist/components/TextareaComposer/SuggestionList/CommandItem.d.ts +2 -8
- package/dist/components/TextareaComposer/SuggestionList/SuggestionList.d.ts +6 -8
- package/dist/components/TextareaComposer/SuggestionList/SuggestionList.js +7 -6
- package/dist/components/TextareaComposer/SuggestionList/SuggestionListItem.d.ts +10 -10
- package/dist/components/TextareaComposer/SuggestionList/SuggestionListItem.js +1 -2
- package/dist/components/TextareaComposer/TextareaComposer.d.ts +3 -5
- package/dist/components/TextareaComposer/TextareaComposer.js +13 -8
- package/dist/context/ComponentContext.d.ts +3 -3
- package/dist/experimental/index.browser.cjs.map +2 -2
- package/dist/experimental/index.node.cjs.map +2 -2
- package/dist/index.browser.cjs +75 -93
- package/dist/index.browser.cjs.map +4 -4
- package/dist/index.node.cjs +75 -93
- package/dist/index.node.cjs.map +4 -4
- package/dist/plugins/Emojis/EmojiPicker.js +9 -4
- package/dist/plugins/Emojis/index.browser.cjs +208 -96
- package/dist/plugins/Emojis/index.browser.cjs.map +4 -4
- package/dist/plugins/Emojis/index.node.cjs +208 -96
- package/dist/plugins/Emojis/index.node.cjs.map +4 -4
- package/dist/plugins/Emojis/middleware/textComposerEmojiMiddleware.d.ts +4 -48
- package/dist/plugins/Emojis/middleware/textComposerEmojiMiddleware.js +52 -58
- package/package.json +3 -3
- package/dist/components/MessageInput/hooks/useMessageInputText.js +0 -44
package/dist/index.node.cjs
CHANGED
|
@@ -52473,49 +52473,17 @@ var useCooldownTimer = () => {
|
|
|
52473
52473
|
};
|
|
52474
52474
|
};
|
|
52475
52475
|
|
|
52476
|
-
// src/components/MessageInput/hooks/
|
|
52476
|
+
// src/components/MessageInput/hooks/useTextareaRef.ts
|
|
52477
52477
|
var import_react223 = require("react");
|
|
52478
|
-
var
|
|
52479
|
-
text: state.text
|
|
52480
|
-
});
|
|
52481
|
-
var useMessageInputText = (props) => {
|
|
52478
|
+
var useTextareaRef = (props) => {
|
|
52482
52479
|
const { focus } = props;
|
|
52483
|
-
const messageComposer = useMessageComposer();
|
|
52484
52480
|
const textareaRef = (0, import_react223.useRef)(void 0);
|
|
52485
|
-
const { text: text7 } = useStateStore(
|
|
52486
|
-
messageComposer.textComposer.state,
|
|
52487
|
-
messageComposerStateSelector
|
|
52488
|
-
);
|
|
52489
52481
|
(0, import_react223.useEffect)(() => {
|
|
52490
52482
|
if (focus && textareaRef.current) {
|
|
52491
52483
|
textareaRef.current.focus();
|
|
52492
52484
|
}
|
|
52493
52485
|
}, [focus]);
|
|
52494
|
-
const newCursorPosition = (0, import_react223.useRef)(void 0);
|
|
52495
|
-
const insertText = (0, import_react223.useCallback)(
|
|
52496
|
-
(textToInsert) => {
|
|
52497
|
-
const selection = textareaRef?.current && {
|
|
52498
|
-
end: textareaRef.current.selectionEnd,
|
|
52499
|
-
start: textareaRef.current.selectionStart
|
|
52500
|
-
};
|
|
52501
|
-
messageComposer.textComposer.insertText({
|
|
52502
|
-
selection,
|
|
52503
|
-
text: textToInsert
|
|
52504
|
-
});
|
|
52505
|
-
if (selection) newCursorPosition.current = selection.start + textToInsert.length;
|
|
52506
|
-
},
|
|
52507
|
-
[messageComposer, newCursorPosition, textareaRef]
|
|
52508
|
-
);
|
|
52509
|
-
(0, import_react223.useEffect)(() => {
|
|
52510
|
-
const textareaElement = textareaRef.current;
|
|
52511
|
-
if (textareaElement && newCursorPosition.current !== void 0) {
|
|
52512
|
-
textareaElement.selectionStart = newCursorPosition.current;
|
|
52513
|
-
textareaElement.selectionEnd = newCursorPosition.current;
|
|
52514
|
-
newCursorPosition.current = void 0;
|
|
52515
|
-
}
|
|
52516
|
-
}, [text7, newCursorPosition]);
|
|
52517
52486
|
return {
|
|
52518
|
-
insertText,
|
|
52519
52487
|
textareaRef
|
|
52520
52488
|
};
|
|
52521
52489
|
};
|
|
@@ -52575,8 +52543,8 @@ var useSubmitHandler = (props) => {
|
|
|
52575
52543
|
|
|
52576
52544
|
// src/components/MessageInput/hooks/usePasteHandler.ts
|
|
52577
52545
|
var import_react225 = require("react");
|
|
52578
|
-
var usePasteHandler = (
|
|
52579
|
-
const { attachmentManager } = useMessageComposer();
|
|
52546
|
+
var usePasteHandler = () => {
|
|
52547
|
+
const { attachmentManager, textComposer } = useMessageComposer();
|
|
52580
52548
|
const onPaste = (0, import_react225.useCallback)(
|
|
52581
52549
|
(clipboardEvent) => {
|
|
52582
52550
|
(async (event) => {
|
|
@@ -52597,13 +52565,13 @@ var usePasteHandler = (insertText) => {
|
|
|
52597
52565
|
const fileLikes = await dataTransferItemsToFiles(Array.from(items));
|
|
52598
52566
|
if (plainTextPromise) {
|
|
52599
52567
|
const pastedText = await plainTextPromise;
|
|
52600
|
-
insertText(pastedText);
|
|
52568
|
+
textComposer.insertText({ text: pastedText });
|
|
52601
52569
|
} else {
|
|
52602
52570
|
attachmentManager.uploadFiles(fileLikes);
|
|
52603
52571
|
}
|
|
52604
52572
|
})(clipboardEvent);
|
|
52605
52573
|
},
|
|
52606
|
-
[attachmentManager,
|
|
52574
|
+
[attachmentManager, textComposer]
|
|
52607
52575
|
);
|
|
52608
52576
|
return { onPaste };
|
|
52609
52577
|
};
|
|
@@ -52672,7 +52640,7 @@ var useMediaRecorder = ({
|
|
|
52672
52640
|
// src/components/MessageInput/hooks/useMessageInputControls.ts
|
|
52673
52641
|
var useMessageInputControls = (props) => {
|
|
52674
52642
|
const { asyncMessagesMultiSendEnabled, audioRecordingConfig, audioRecordingEnabled } = props;
|
|
52675
|
-
const {
|
|
52643
|
+
const { textareaRef } = useTextareaRef(props);
|
|
52676
52644
|
const { handleSubmit } = useSubmitHandler(props);
|
|
52677
52645
|
const recordingController = useMediaRecorder({
|
|
52678
52646
|
asyncMessagesMultiSendEnabled,
|
|
@@ -52680,10 +52648,9 @@ var useMessageInputControls = (props) => {
|
|
|
52680
52648
|
handleSubmit,
|
|
52681
52649
|
recordingConfig: audioRecordingConfig
|
|
52682
52650
|
});
|
|
52683
|
-
const { onPaste } = usePasteHandler(
|
|
52651
|
+
const { onPaste } = usePasteHandler();
|
|
52684
52652
|
return {
|
|
52685
52653
|
handleSubmit,
|
|
52686
|
-
insertText,
|
|
52687
52654
|
onPaste,
|
|
52688
52655
|
recordingController,
|
|
52689
52656
|
textareaRef
|
|
@@ -52944,7 +52911,7 @@ var linkPreviewsManagerStateSelector = (state) => ({
|
|
|
52944
52911
|
(preview) => import_stream_chat9.LinkPreviewsManager.previewIsLoaded(preview) || import_stream_chat9.LinkPreviewsManager.previewIsLoading(preview)
|
|
52945
52912
|
)
|
|
52946
52913
|
});
|
|
52947
|
-
var
|
|
52914
|
+
var messageComposerStateSelector = (state) => ({
|
|
52948
52915
|
quotedMessage: state.quotedMessage
|
|
52949
52916
|
});
|
|
52950
52917
|
var LinkPreviewList = () => {
|
|
@@ -52952,7 +52919,7 @@ var LinkPreviewList = () => {
|
|
|
52952
52919
|
const { linkPreviewsManager } = messageComposer;
|
|
52953
52920
|
const { quotedMessage } = useStateStore(
|
|
52954
52921
|
messageComposer.state,
|
|
52955
|
-
|
|
52922
|
+
messageComposerStateSelector
|
|
52956
52923
|
);
|
|
52957
52924
|
const { linkPreviews } = useStateStore(
|
|
52958
52925
|
linkPreviewsManager.state,
|
|
@@ -53031,23 +52998,22 @@ var EmoticonItem = (props) => {
|
|
|
53031
52998
|
|
|
53032
52999
|
// src/components/TextareaComposer/SuggestionList/SuggestionList.tsx
|
|
53033
53000
|
var import_clsx60 = __toESM(require("clsx"));
|
|
53034
|
-
var
|
|
53001
|
+
var import_react238 = __toESM(require("react"));
|
|
53035
53002
|
|
|
53036
53003
|
// src/components/TextareaComposer/SuggestionList/SuggestionListItem.tsx
|
|
53037
53004
|
var import_clsx58 = __toESM(require("clsx"));
|
|
53038
|
-
var import_react236 = require("react");
|
|
53039
|
-
var
|
|
53040
|
-
var SuggestionListItem = import_react237.default.forwardRef(function SuggestionListItem2({ className, component: Component2, focused, item, onMouseEnter }, innerRef) {
|
|
53005
|
+
var import_react236 = __toESM(require("react"));
|
|
53006
|
+
var SuggestionListItem = import_react236.default.forwardRef(function SuggestionListItem2({ className, component: Component2, focused, item, onMouseEnter }, innerRef) {
|
|
53041
53007
|
const { textComposer } = useMessageComposer();
|
|
53042
|
-
const containerRef = (0,
|
|
53043
|
-
const handleSelect = (0,
|
|
53008
|
+
const containerRef = (0, import_react236.useRef)(null);
|
|
53009
|
+
const handleSelect = (0, import_react236.useCallback)(() => {
|
|
53044
53010
|
textComposer.handleSelect(item);
|
|
53045
53011
|
}, [item, textComposer]);
|
|
53046
53012
|
(0, import_react236.useLayoutEffect)(() => {
|
|
53047
53013
|
if (!focused) return;
|
|
53048
53014
|
containerRef.current?.scrollIntoView({ behavior: "instant", block: "nearest" });
|
|
53049
53015
|
}, [focused, containerRef]);
|
|
53050
|
-
return /* @__PURE__ */
|
|
53016
|
+
return /* @__PURE__ */ import_react236.default.createElement(
|
|
53051
53017
|
"li",
|
|
53052
53018
|
{
|
|
53053
53019
|
className: (0, import_clsx58.default)("str-chat__suggestion-list-item", className, {
|
|
@@ -53056,7 +53022,7 @@ var SuggestionListItem = import_react237.default.forwardRef(function SuggestionL
|
|
|
53056
53022
|
onMouseEnter,
|
|
53057
53023
|
ref: containerRef
|
|
53058
53024
|
},
|
|
53059
|
-
/* @__PURE__ */
|
|
53025
|
+
/* @__PURE__ */ import_react236.default.createElement(
|
|
53060
53026
|
"button",
|
|
53061
53027
|
{
|
|
53062
53028
|
onClick: handleSelect,
|
|
@@ -53067,13 +53033,13 @@ var SuggestionListItem = import_react237.default.forwardRef(function SuggestionL
|
|
|
53067
53033
|
},
|
|
53068
53034
|
ref: innerRef
|
|
53069
53035
|
},
|
|
53070
|
-
/* @__PURE__ */
|
|
53036
|
+
/* @__PURE__ */ import_react236.default.createElement(Component2, { entity: item, focused })
|
|
53071
53037
|
)
|
|
53072
53038
|
);
|
|
53073
53039
|
});
|
|
53074
53040
|
|
|
53075
53041
|
// src/components/TextareaComposer/SuggestionList/UserItem.tsx
|
|
53076
|
-
var
|
|
53042
|
+
var import_react237 = __toESM(require("react"));
|
|
53077
53043
|
var import_clsx59 = __toESM(require("clsx"));
|
|
53078
53044
|
var UserItem = ({ Avatar: Avatar2 = Avatar, entity }) => {
|
|
53079
53045
|
const hasEntity = !!Object.keys(entity).length;
|
|
@@ -53082,7 +53048,7 @@ var UserItem = ({ Avatar: Avatar2 = Avatar, entity }) => {
|
|
|
53082
53048
|
const renderName = () => parts.map((part, i) => {
|
|
53083
53049
|
const matches = part.toLowerCase() === token;
|
|
53084
53050
|
const partWithHTMLSpacesAround = part.replace(/^\s+|\s+$/g, "\xA0");
|
|
53085
|
-
return /* @__PURE__ */
|
|
53051
|
+
return /* @__PURE__ */ import_react237.default.createElement(
|
|
53086
53052
|
"span",
|
|
53087
53053
|
{
|
|
53088
53054
|
className: (0, import_clsx59.default)({
|
|
@@ -53094,14 +53060,14 @@ var UserItem = ({ Avatar: Avatar2 = Avatar, entity }) => {
|
|
|
53094
53060
|
partWithHTMLSpacesAround
|
|
53095
53061
|
);
|
|
53096
53062
|
});
|
|
53097
|
-
return /* @__PURE__ */
|
|
53063
|
+
return /* @__PURE__ */ import_react237.default.createElement("div", { className: "str-chat__user-item" }, /* @__PURE__ */ import_react237.default.createElement(
|
|
53098
53064
|
Avatar2,
|
|
53099
53065
|
{
|
|
53100
53066
|
className: "str-chat__avatar--autocomplete-item",
|
|
53101
53067
|
image: entity.image,
|
|
53102
53068
|
name: entity.name || entity.id
|
|
53103
53069
|
}
|
|
53104
|
-
), /* @__PURE__ */
|
|
53070
|
+
), /* @__PURE__ */ import_react237.default.createElement("span", { className: "str-chat__user-item--name", "data-testid": "user-item-name" }, renderName()), /* @__PURE__ */ import_react237.default.createElement("div", { className: "str-chat__user-item-at" }, "@"));
|
|
53105
53071
|
};
|
|
53106
53072
|
|
|
53107
53073
|
// src/components/TextareaComposer/SuggestionList/SuggestionList.tsx
|
|
@@ -53112,25 +53078,26 @@ var searchSourceStateSelector = (nextValue) => ({
|
|
|
53112
53078
|
items: nextValue.items ?? []
|
|
53113
53079
|
});
|
|
53114
53080
|
var defaultComponents = {
|
|
53115
|
-
"/": CommandItem,
|
|
53116
|
-
":": EmoticonItem,
|
|
53117
|
-
"@": UserItem
|
|
53081
|
+
"/": (props) => /* @__PURE__ */ import_react238.default.createElement(CommandItem, { entity: props.entity }),
|
|
53082
|
+
":": (props) => /* @__PURE__ */ import_react238.default.createElement(EmoticonItem, { entity: props.entity }),
|
|
53083
|
+
"@": (props) => /* @__PURE__ */ import_react238.default.createElement(UserItem, { entity: props.entity })
|
|
53118
53084
|
};
|
|
53119
53085
|
var SuggestionList = ({
|
|
53120
53086
|
className,
|
|
53121
53087
|
closeOnClickOutside = true,
|
|
53122
53088
|
containerClassName,
|
|
53123
53089
|
focusedItemIndex,
|
|
53124
|
-
setFocusedItemIndex
|
|
53090
|
+
setFocusedItemIndex,
|
|
53091
|
+
suggestionItemComponents = defaultComponents
|
|
53125
53092
|
}) => {
|
|
53126
53093
|
const { AutocompleteSuggestionItem = SuggestionListItem } = useComponentContext();
|
|
53127
53094
|
const messageComposer = useMessageComposer();
|
|
53128
53095
|
const { textComposer } = messageComposer;
|
|
53129
53096
|
const { suggestions } = useStateStore(textComposer.state, textComposerStateSelector);
|
|
53130
53097
|
const { items } = useStateStore(suggestions?.searchSource.state, searchSourceStateSelector) ?? {};
|
|
53131
|
-
const [container, setContainer] = (0,
|
|
53132
|
-
const component = suggestions?.trigger
|
|
53133
|
-
(0,
|
|
53098
|
+
const [container, setContainer] = (0, import_react238.useState)(null);
|
|
53099
|
+
const component = suggestions?.trigger ? suggestionItemComponents[suggestions?.trigger] : void 0;
|
|
53100
|
+
(0, import_react238.useEffect)(() => {
|
|
53134
53101
|
if (!closeOnClickOutside || !suggestions || !container) return;
|
|
53135
53102
|
const handleClick = (event) => {
|
|
53136
53103
|
if (container.contains(event.target)) return;
|
|
@@ -53142,19 +53109,19 @@ var SuggestionList = ({
|
|
|
53142
53109
|
};
|
|
53143
53110
|
}, [closeOnClickOutside, suggestions, container, textComposer]);
|
|
53144
53111
|
if (!suggestions || !items?.length || !component) return null;
|
|
53145
|
-
return /* @__PURE__ */
|
|
53112
|
+
return /* @__PURE__ */ import_react238.default.createElement(
|
|
53146
53113
|
"div",
|
|
53147
53114
|
{
|
|
53148
53115
|
className: (0, import_clsx60.default)("str-chat__suggestion-list-container", containerClassName),
|
|
53149
53116
|
ref: setContainer
|
|
53150
53117
|
},
|
|
53151
|
-
/* @__PURE__ */
|
|
53118
|
+
/* @__PURE__ */ import_react238.default.createElement(
|
|
53152
53119
|
InfiniteScrollPaginator,
|
|
53153
53120
|
{
|
|
53154
53121
|
loadNextOnScrollToBottom: suggestions.searchSource.search,
|
|
53155
53122
|
threshold: 100
|
|
53156
53123
|
},
|
|
53157
|
-
/* @__PURE__ */
|
|
53124
|
+
/* @__PURE__ */ import_react238.default.createElement(
|
|
53158
53125
|
"ul",
|
|
53159
53126
|
{
|
|
53160
53127
|
className: (0, import_clsx60.default)(
|
|
@@ -53162,7 +53129,7 @@ var SuggestionList = ({
|
|
|
53162
53129
|
className
|
|
53163
53130
|
)
|
|
53164
53131
|
},
|
|
53165
|
-
items.map((item, i) => /* @__PURE__ */
|
|
53132
|
+
items.map((item, i) => /* @__PURE__ */ import_react238.default.createElement(
|
|
53166
53133
|
AutocompleteSuggestionItem,
|
|
53167
53134
|
{
|
|
53168
53135
|
component,
|
|
@@ -53178,7 +53145,9 @@ var SuggestionList = ({
|
|
|
53178
53145
|
};
|
|
53179
53146
|
|
|
53180
53147
|
// src/components/TextareaComposer/TextareaComposer.tsx
|
|
53148
|
+
var import_lodash19 = __toESM(require("lodash.debounce"));
|
|
53181
53149
|
var import_clsx61 = __toESM(require("clsx"));
|
|
53150
|
+
var import_react239 = require("react");
|
|
53182
53151
|
var import_react240 = __toESM(require("react"));
|
|
53183
53152
|
var import_react_textarea_autosize = __toESM(require("react-textarea-autosize"));
|
|
53184
53153
|
var textComposerStateSelector2 = (state) => ({
|
|
@@ -53198,33 +53167,32 @@ var TextareaComposer = ({
|
|
|
53198
53167
|
className,
|
|
53199
53168
|
closeSuggestionsOnClickOutside,
|
|
53200
53169
|
containerClassName,
|
|
53201
|
-
// dropdownClassName, // todo: X find a different way to prevent prop drilling
|
|
53202
|
-
grow: growProp,
|
|
53203
|
-
// itemClassName, // todo: X find a different way to prevent prop drilling
|
|
53204
53170
|
listClassName,
|
|
53205
53171
|
maxRows: maxRowsProp = 1,
|
|
53172
|
+
minRows: minRowsProp,
|
|
53206
53173
|
onBlur,
|
|
53207
53174
|
onChange,
|
|
53208
53175
|
onKeyDown,
|
|
53209
53176
|
onScroll,
|
|
53177
|
+
onSelect,
|
|
53210
53178
|
placeholder: placeholderProp,
|
|
53211
53179
|
shouldSubmit: shouldSubmitProp,
|
|
53212
|
-
...
|
|
53180
|
+
...restTextareaProps
|
|
53213
53181
|
}) => {
|
|
53214
53182
|
const { t } = useTranslationContext();
|
|
53215
53183
|
const { AutocompleteSuggestionList = SuggestionList } = useComponentContext();
|
|
53216
53184
|
const {
|
|
53217
53185
|
additionalTextareaProps,
|
|
53218
53186
|
cooldownRemaining,
|
|
53219
|
-
grow: growContext,
|
|
53220
53187
|
handleSubmit,
|
|
53221
53188
|
maxRows: maxRowsContext,
|
|
53189
|
+
minRows: minRowsContext,
|
|
53222
53190
|
onPaste,
|
|
53223
53191
|
shouldSubmit: shouldSubmitContext,
|
|
53224
53192
|
textareaRef
|
|
53225
53193
|
} = useMessageInputContext();
|
|
53226
|
-
const grow = growProp ?? growContext;
|
|
53227
53194
|
const maxRows = maxRowsProp ?? maxRowsContext;
|
|
53195
|
+
const minRows = minRowsProp ?? minRowsContext;
|
|
53228
53196
|
const placeholder = placeholderProp ?? additionalTextareaProps?.placeholder;
|
|
53229
53197
|
const shouldSubmit = shouldSubmitProp ?? shouldSubmitContext ?? defaultShouldSubmit;
|
|
53230
53198
|
const messageComposer = useMessageComposer();
|
|
@@ -53325,6 +53293,20 @@ var TextareaComposer = ({
|
|
|
53325
53293
|
},
|
|
53326
53294
|
[onScroll, textComposer]
|
|
53327
53295
|
);
|
|
53296
|
+
const setSelectionDebounced = (0, import_react239.useMemo)(
|
|
53297
|
+
() => (0, import_lodash19.default)(
|
|
53298
|
+
(e) => {
|
|
53299
|
+
onSelect?.(e);
|
|
53300
|
+
textComposer.setSelection({
|
|
53301
|
+
end: e.target.selectionEnd,
|
|
53302
|
+
start: e.target.selectionStart
|
|
53303
|
+
});
|
|
53304
|
+
},
|
|
53305
|
+
100,
|
|
53306
|
+
{ leading: false, trailing: true }
|
|
53307
|
+
),
|
|
53308
|
+
[onSelect, textComposer]
|
|
53309
|
+
);
|
|
53328
53310
|
(0, import_react240.useEffect)(() => {
|
|
53329
53311
|
if (textareaRef.current && !isComposing) {
|
|
53330
53312
|
textareaRef.current.selectionStart = selection.start;
|
|
@@ -53352,7 +53334,7 @@ var TextareaComposer = ({
|
|
|
53352
53334
|
/* @__PURE__ */ import_react240.default.createElement(
|
|
53353
53335
|
import_react_textarea_autosize.default,
|
|
53354
53336
|
{
|
|
53355
|
-
...
|
|
53337
|
+
...{ ...additionalTextareaProps, ...restTextareaProps },
|
|
53356
53338
|
"aria-label": cooldownRemaining ? t("Slow Mode ON") : placeholder,
|
|
53357
53339
|
className: (0, import_clsx61.default)(
|
|
53358
53340
|
"rta__textarea",
|
|
@@ -53361,7 +53343,8 @@ var TextareaComposer = ({
|
|
|
53361
53343
|
),
|
|
53362
53344
|
"data-testid": "message-input",
|
|
53363
53345
|
disabled: !enabled || !!cooldownRemaining,
|
|
53364
|
-
maxRows
|
|
53346
|
+
maxRows,
|
|
53347
|
+
minRows,
|
|
53365
53348
|
onBlur,
|
|
53366
53349
|
onChange: changeHandler,
|
|
53367
53350
|
onCompositionEnd,
|
|
@@ -53369,6 +53352,7 @@ var TextareaComposer = ({
|
|
|
53369
53352
|
onKeyDown: keyDownHandler,
|
|
53370
53353
|
onPaste,
|
|
53371
53354
|
onScroll: scrollHandler,
|
|
53355
|
+
onSelect: setSelectionDebounced,
|
|
53372
53356
|
placeholder: placeholder || t("Type your message"),
|
|
53373
53357
|
ref: (ref) => {
|
|
53374
53358
|
textareaRef.current = ref;
|
|
@@ -53549,8 +53533,9 @@ var MessageInputFlat = () => {
|
|
|
53549
53533
|
RecordingPermissionDeniedNotification: RecordingPermissionDeniedNotification2 = RecordingPermissionDeniedNotification,
|
|
53550
53534
|
SendButton: SendButton2 = SendButton,
|
|
53551
53535
|
StartRecordingAudioButton: StartRecordingAudioButton2 = StartRecordingAudioButton,
|
|
53552
|
-
StopAIGenerationButton: StopAIGenerationButtonOverride
|
|
53553
|
-
|
|
53536
|
+
StopAIGenerationButton: StopAIGenerationButtonOverride,
|
|
53537
|
+
TextareaComposer: TextareaComposer2 = TextareaComposer
|
|
53538
|
+
} = useComponentContext();
|
|
53554
53539
|
const { channel } = useChatContext("MessageInputFlat");
|
|
53555
53540
|
const { aiState } = useAIState(channel);
|
|
53556
53541
|
const stopGenerating = (0, import_react244.useCallback)(() => channel?.stopAIResponse(), [channel]);
|
|
@@ -53573,7 +53558,7 @@ var MessageInputFlat = () => {
|
|
|
53573
53558
|
onClose: closePermissionDeniedNotification,
|
|
53574
53559
|
permissionName: "microphone" /* MIC */
|
|
53575
53560
|
}
|
|
53576
|
-
), /* @__PURE__ */ import_react244.default.createElement(LinkPreviewList2, null), /* @__PURE__ */ import_react244.default.createElement(QuotedMessagePreviewHeader, null), /* @__PURE__ */ import_react244.default.createElement("div", { className: "str-chat__message-input-inner" }, /* @__PURE__ */ import_react244.default.createElement(AttachmentSelector2, null), /* @__PURE__ */ import_react244.default.createElement("div", { className: "str-chat__message-textarea-container" }, /* @__PURE__ */ import_react244.default.createElement(QuotedMessagePreview2, null), /* @__PURE__ */ import_react244.default.createElement(AttachmentPreviewList2, null), /* @__PURE__ */ import_react244.default.createElement("div", { className: "str-chat__message-textarea-with-emoji-picker" }, /* @__PURE__ */ import_react244.default.createElement(
|
|
53561
|
+
), /* @__PURE__ */ import_react244.default.createElement(LinkPreviewList2, null), /* @__PURE__ */ import_react244.default.createElement(QuotedMessagePreviewHeader, null), /* @__PURE__ */ import_react244.default.createElement("div", { className: "str-chat__message-input-inner" }, /* @__PURE__ */ import_react244.default.createElement(AttachmentSelector2, null), /* @__PURE__ */ import_react244.default.createElement("div", { className: "str-chat__message-textarea-container" }, /* @__PURE__ */ import_react244.default.createElement(QuotedMessagePreview2, null), /* @__PURE__ */ import_react244.default.createElement(AttachmentPreviewList2, null), /* @__PURE__ */ import_react244.default.createElement("div", { className: "str-chat__message-textarea-with-emoji-picker" }, /* @__PURE__ */ import_react244.default.createElement(TextareaComposer2, null), EmojiPicker && /* @__PURE__ */ import_react244.default.createElement(EmojiPicker, null))), shouldDisplayStopAIGeneration ? /* @__PURE__ */ import_react244.default.createElement(StopAIGenerationButton2, { onClick: stopGenerating }) : !hideSendButton && /* @__PURE__ */ import_react244.default.createElement(import_react244.default.Fragment, null, cooldownRemaining ? /* @__PURE__ */ import_react244.default.createElement(
|
|
53577
53562
|
CooldownTimer2,
|
|
53578
53563
|
{
|
|
53579
53564
|
cooldownInterval: cooldownRemaining,
|
|
@@ -53605,10 +53590,8 @@ var useCreateMessageInputContext = (value) => {
|
|
|
53605
53590
|
cooldownRemaining,
|
|
53606
53591
|
emojiSearchIndex,
|
|
53607
53592
|
focus,
|
|
53608
|
-
grow,
|
|
53609
53593
|
handleSubmit,
|
|
53610
53594
|
hideSendButton,
|
|
53611
|
-
insertText,
|
|
53612
53595
|
isThreadInput,
|
|
53613
53596
|
maxRows,
|
|
53614
53597
|
minRows,
|
|
@@ -53630,10 +53613,8 @@ var useCreateMessageInputContext = (value) => {
|
|
|
53630
53613
|
cooldownRemaining,
|
|
53631
53614
|
emojiSearchIndex,
|
|
53632
53615
|
focus,
|
|
53633
|
-
grow,
|
|
53634
53616
|
handleSubmit,
|
|
53635
53617
|
hideSendButton,
|
|
53636
|
-
insertText,
|
|
53637
53618
|
isThreadInput,
|
|
53638
53619
|
maxRows,
|
|
53639
53620
|
minRows,
|
|
@@ -53774,7 +53755,6 @@ var EditMessageModal = ({
|
|
|
53774
53755
|
MessageInput,
|
|
53775
53756
|
{
|
|
53776
53757
|
clearEditingState,
|
|
53777
|
-
grow: true,
|
|
53778
53758
|
hideSendButton: true,
|
|
53779
53759
|
Input: EditMessageInput,
|
|
53780
53760
|
...additionalMessageInputProps
|
|
@@ -54338,9 +54318,9 @@ var getAttachmentType = (attachment) => {
|
|
|
54338
54318
|
// src/components/Channel/Channel.tsx
|
|
54339
54319
|
var import_react260 = __toESM(require("react"));
|
|
54340
54320
|
var import_clsx66 = __toESM(require("clsx"));
|
|
54341
|
-
var
|
|
54342
|
-
var
|
|
54343
|
-
var
|
|
54321
|
+
var import_lodash20 = __toESM(require("lodash.debounce"));
|
|
54322
|
+
var import_lodash21 = __toESM(require("lodash.defaultsdeep"));
|
|
54323
|
+
var import_lodash22 = __toESM(require("lodash.throttle"));
|
|
54344
54324
|
var import_stream_chat11 = require("stream-chat");
|
|
54345
54325
|
|
|
54346
54326
|
// src/components/Channel/channelState.ts
|
|
@@ -54938,7 +54918,7 @@ var ChannelInner = (props) => {
|
|
|
54938
54918
|
skipMessageDataMemoization
|
|
54939
54919
|
} = props;
|
|
54940
54920
|
const channelQueryOptions = (0, import_react260.useMemo)(
|
|
54941
|
-
() => (0,
|
|
54921
|
+
() => (0, import_lodash21.default)(propChannelQueryOptions, {
|
|
54942
54922
|
messages: { limit: DEFAULT_INITIAL_CHANNEL_PAGE_SIZE }
|
|
54943
54923
|
}),
|
|
54944
54924
|
[propChannelQueryOptions]
|
|
@@ -54972,7 +54952,7 @@ var ChannelInner = (props) => {
|
|
|
54972
54952
|
null
|
|
54973
54953
|
);
|
|
54974
54954
|
const channelCapabilitiesArray = channel.data?.own_capabilities;
|
|
54975
|
-
const throttledCopyStateFromChannel = (0,
|
|
54955
|
+
const throttledCopyStateFromChannel = (0, import_lodash22.default)(
|
|
54976
54956
|
() => dispatch({ channel, type: "copyStateFromChannelOnEvent" }),
|
|
54977
54957
|
500,
|
|
54978
54958
|
{
|
|
@@ -54981,14 +54961,14 @@ var ChannelInner = (props) => {
|
|
|
54981
54961
|
}
|
|
54982
54962
|
);
|
|
54983
54963
|
const setChannelUnreadUiState = (0, import_react260.useMemo)(
|
|
54984
|
-
() => (0,
|
|
54964
|
+
() => (0, import_lodash22.default)(_setChannelUnreadUiState, 200, {
|
|
54985
54965
|
leading: true,
|
|
54986
54966
|
trailing: false
|
|
54987
54967
|
}),
|
|
54988
54968
|
[]
|
|
54989
54969
|
);
|
|
54990
54970
|
const markRead = (0, import_react260.useMemo)(
|
|
54991
|
-
() => (0,
|
|
54971
|
+
() => (0, import_lodash22.default)(
|
|
54992
54972
|
async (options) => {
|
|
54993
54973
|
const { updateChannelUiUnreadState = true } = options ?? {};
|
|
54994
54974
|
if (channel.disconnected || !channelConfig?.read_events) {
|
|
@@ -55193,7 +55173,7 @@ var ChannelInner = (props) => {
|
|
|
55193
55173
|
[]
|
|
55194
55174
|
);
|
|
55195
55175
|
const loadMoreFinished = (0, import_react260.useCallback)(
|
|
55196
|
-
(0,
|
|
55176
|
+
(0, import_lodash20.default)(
|
|
55197
55177
|
(hasMore, messages) => {
|
|
55198
55178
|
if (!isMounted.current) return;
|
|
55199
55179
|
dispatch({ hasMore, messages, type: "loadMoreFinished" });
|
|
@@ -55514,7 +55494,7 @@ var ChannelInner = (props) => {
|
|
|
55514
55494
|
dispatch({ type: "closeThread" });
|
|
55515
55495
|
};
|
|
55516
55496
|
const loadMoreThreadFinished = (0, import_react260.useCallback)(
|
|
55517
|
-
(0,
|
|
55497
|
+
(0, import_lodash20.default)(
|
|
55518
55498
|
(threadHasMore, threadMessages) => {
|
|
55519
55499
|
dispatch({
|
|
55520
55500
|
threadHasMore,
|
|
@@ -55659,6 +55639,7 @@ var ChannelInner = (props) => {
|
|
|
55659
55639
|
StartRecordingAudioButton: props.StartRecordingAudioButton,
|
|
55660
55640
|
StopAIGenerationButton: props.StopAIGenerationButton,
|
|
55661
55641
|
StreamedMessageText: props.StreamedMessageText,
|
|
55642
|
+
TextareaComposer: props.TextareaComposer,
|
|
55662
55643
|
ThreadHead: props.ThreadHead,
|
|
55663
55644
|
ThreadHeader: props.ThreadHeader,
|
|
55664
55645
|
ThreadStart: props.ThreadStart,
|
|
@@ -55721,6 +55702,7 @@ var ChannelInner = (props) => {
|
|
|
55721
55702
|
props.StartRecordingAudioButton,
|
|
55722
55703
|
props.StopAIGenerationButton,
|
|
55723
55704
|
props.StreamedMessageText,
|
|
55705
|
+
props.TextareaComposer,
|
|
55724
55706
|
props.ThreadHead,
|
|
55725
55707
|
props.ThreadHeader,
|
|
55726
55708
|
props.ThreadStart,
|
|
@@ -55836,7 +55818,7 @@ var useChat = ({
|
|
|
55836
55818
|
};
|
|
55837
55819
|
(0, import_react263.useEffect)(() => {
|
|
55838
55820
|
if (!client) return;
|
|
55839
|
-
const version = "13.0.0
|
|
55821
|
+
const version = "13.0.0";
|
|
55840
55822
|
const userAgent = client.getUserAgent();
|
|
55841
55823
|
if (!userAgent.includes("stream-chat-react")) {
|
|
55842
55824
|
client.setUserAgent(`stream-chat-react-${version}-${userAgent}`);
|