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.browser.cjs
CHANGED
|
@@ -47796,49 +47796,17 @@ var useCooldownTimer = () => {
|
|
|
47796
47796
|
};
|
|
47797
47797
|
};
|
|
47798
47798
|
|
|
47799
|
-
// src/components/MessageInput/hooks/
|
|
47799
|
+
// src/components/MessageInput/hooks/useTextareaRef.ts
|
|
47800
47800
|
var import_react224 = require("react");
|
|
47801
|
-
var
|
|
47802
|
-
text: state.text
|
|
47803
|
-
});
|
|
47804
|
-
var useMessageInputText = (props) => {
|
|
47801
|
+
var useTextareaRef = (props) => {
|
|
47805
47802
|
const { focus } = props;
|
|
47806
|
-
const messageComposer = useMessageComposer();
|
|
47807
47803
|
const textareaRef = (0, import_react224.useRef)(void 0);
|
|
47808
|
-
const { text: text8 } = useStateStore(
|
|
47809
|
-
messageComposer.textComposer.state,
|
|
47810
|
-
messageComposerStateSelector
|
|
47811
|
-
);
|
|
47812
47804
|
(0, import_react224.useEffect)(() => {
|
|
47813
47805
|
if (focus && textareaRef.current) {
|
|
47814
47806
|
textareaRef.current.focus();
|
|
47815
47807
|
}
|
|
47816
47808
|
}, [focus]);
|
|
47817
|
-
const newCursorPosition = (0, import_react224.useRef)(void 0);
|
|
47818
|
-
const insertText = (0, import_react224.useCallback)(
|
|
47819
|
-
(textToInsert) => {
|
|
47820
|
-
const selection = textareaRef?.current && {
|
|
47821
|
-
end: textareaRef.current.selectionEnd,
|
|
47822
|
-
start: textareaRef.current.selectionStart
|
|
47823
|
-
};
|
|
47824
|
-
messageComposer.textComposer.insertText({
|
|
47825
|
-
selection,
|
|
47826
|
-
text: textToInsert
|
|
47827
|
-
});
|
|
47828
|
-
if (selection) newCursorPosition.current = selection.start + textToInsert.length;
|
|
47829
|
-
},
|
|
47830
|
-
[messageComposer, newCursorPosition, textareaRef]
|
|
47831
|
-
);
|
|
47832
|
-
(0, import_react224.useEffect)(() => {
|
|
47833
|
-
const textareaElement = textareaRef.current;
|
|
47834
|
-
if (textareaElement && newCursorPosition.current !== void 0) {
|
|
47835
|
-
textareaElement.selectionStart = newCursorPosition.current;
|
|
47836
|
-
textareaElement.selectionEnd = newCursorPosition.current;
|
|
47837
|
-
newCursorPosition.current = void 0;
|
|
47838
|
-
}
|
|
47839
|
-
}, [text8, newCursorPosition]);
|
|
47840
47809
|
return {
|
|
47841
|
-
insertText,
|
|
47842
47810
|
textareaRef
|
|
47843
47811
|
};
|
|
47844
47812
|
};
|
|
@@ -47898,8 +47866,8 @@ var useSubmitHandler = (props) => {
|
|
|
47898
47866
|
|
|
47899
47867
|
// src/components/MessageInput/hooks/usePasteHandler.ts
|
|
47900
47868
|
var import_react226 = require("react");
|
|
47901
|
-
var usePasteHandler = (
|
|
47902
|
-
const { attachmentManager } = useMessageComposer();
|
|
47869
|
+
var usePasteHandler = () => {
|
|
47870
|
+
const { attachmentManager, textComposer } = useMessageComposer();
|
|
47903
47871
|
const onPaste = (0, import_react226.useCallback)(
|
|
47904
47872
|
(clipboardEvent) => {
|
|
47905
47873
|
(async (event) => {
|
|
@@ -47920,13 +47888,13 @@ var usePasteHandler = (insertText) => {
|
|
|
47920
47888
|
const fileLikes = await dataTransferItemsToFiles(Array.from(items));
|
|
47921
47889
|
if (plainTextPromise) {
|
|
47922
47890
|
const pastedText = await plainTextPromise;
|
|
47923
|
-
insertText(pastedText);
|
|
47891
|
+
textComposer.insertText({ text: pastedText });
|
|
47924
47892
|
} else {
|
|
47925
47893
|
attachmentManager.uploadFiles(fileLikes);
|
|
47926
47894
|
}
|
|
47927
47895
|
})(clipboardEvent);
|
|
47928
47896
|
},
|
|
47929
|
-
[attachmentManager,
|
|
47897
|
+
[attachmentManager, textComposer]
|
|
47930
47898
|
);
|
|
47931
47899
|
return { onPaste };
|
|
47932
47900
|
};
|
|
@@ -47995,7 +47963,7 @@ var useMediaRecorder = ({
|
|
|
47995
47963
|
// src/components/MessageInput/hooks/useMessageInputControls.ts
|
|
47996
47964
|
var useMessageInputControls = (props) => {
|
|
47997
47965
|
const { asyncMessagesMultiSendEnabled, audioRecordingConfig, audioRecordingEnabled } = props;
|
|
47998
|
-
const {
|
|
47966
|
+
const { textareaRef } = useTextareaRef(props);
|
|
47999
47967
|
const { handleSubmit } = useSubmitHandler(props);
|
|
48000
47968
|
const recordingController = useMediaRecorder({
|
|
48001
47969
|
asyncMessagesMultiSendEnabled,
|
|
@@ -48003,10 +47971,9 @@ var useMessageInputControls = (props) => {
|
|
|
48003
47971
|
handleSubmit,
|
|
48004
47972
|
recordingConfig: audioRecordingConfig
|
|
48005
47973
|
});
|
|
48006
|
-
const { onPaste } = usePasteHandler(
|
|
47974
|
+
const { onPaste } = usePasteHandler();
|
|
48007
47975
|
return {
|
|
48008
47976
|
handleSubmit,
|
|
48009
|
-
insertText,
|
|
48010
47977
|
onPaste,
|
|
48011
47978
|
recordingController,
|
|
48012
47979
|
textareaRef
|
|
@@ -48267,7 +48234,7 @@ var linkPreviewsManagerStateSelector = (state) => ({
|
|
|
48267
48234
|
(preview) => import_stream_chat9.LinkPreviewsManager.previewIsLoaded(preview) || import_stream_chat9.LinkPreviewsManager.previewIsLoading(preview)
|
|
48268
48235
|
)
|
|
48269
48236
|
});
|
|
48270
|
-
var
|
|
48237
|
+
var messageComposerStateSelector = (state) => ({
|
|
48271
48238
|
quotedMessage: state.quotedMessage
|
|
48272
48239
|
});
|
|
48273
48240
|
var LinkPreviewList = () => {
|
|
@@ -48275,7 +48242,7 @@ var LinkPreviewList = () => {
|
|
|
48275
48242
|
const { linkPreviewsManager } = messageComposer;
|
|
48276
48243
|
const { quotedMessage } = useStateStore(
|
|
48277
48244
|
messageComposer.state,
|
|
48278
|
-
|
|
48245
|
+
messageComposerStateSelector
|
|
48279
48246
|
);
|
|
48280
48247
|
const { linkPreviews } = useStateStore(
|
|
48281
48248
|
linkPreviewsManager.state,
|
|
@@ -48354,23 +48321,22 @@ var EmoticonItem = (props) => {
|
|
|
48354
48321
|
|
|
48355
48322
|
// src/components/TextareaComposer/SuggestionList/SuggestionList.tsx
|
|
48356
48323
|
var import_clsx60 = __toESM(require("clsx"));
|
|
48357
|
-
var
|
|
48324
|
+
var import_react239 = __toESM(require("react"));
|
|
48358
48325
|
|
|
48359
48326
|
// src/components/TextareaComposer/SuggestionList/SuggestionListItem.tsx
|
|
48360
48327
|
var import_clsx58 = __toESM(require("clsx"));
|
|
48361
|
-
var import_react237 = require("react");
|
|
48362
|
-
var
|
|
48363
|
-
var SuggestionListItem = import_react238.default.forwardRef(function SuggestionListItem2({ className, component: Component2, focused, item: item2, onMouseEnter }, innerRef) {
|
|
48328
|
+
var import_react237 = __toESM(require("react"));
|
|
48329
|
+
var SuggestionListItem = import_react237.default.forwardRef(function SuggestionListItem2({ className, component: Component2, focused, item: item2, onMouseEnter }, innerRef) {
|
|
48364
48330
|
const { textComposer } = useMessageComposer();
|
|
48365
|
-
const containerRef = (0,
|
|
48366
|
-
const handleSelect = (0,
|
|
48331
|
+
const containerRef = (0, import_react237.useRef)(null);
|
|
48332
|
+
const handleSelect = (0, import_react237.useCallback)(() => {
|
|
48367
48333
|
textComposer.handleSelect(item2);
|
|
48368
48334
|
}, [item2, textComposer]);
|
|
48369
48335
|
(0, import_react237.useLayoutEffect)(() => {
|
|
48370
48336
|
if (!focused) return;
|
|
48371
48337
|
containerRef.current?.scrollIntoView({ behavior: "instant", block: "nearest" });
|
|
48372
48338
|
}, [focused, containerRef]);
|
|
48373
|
-
return /* @__PURE__ */
|
|
48339
|
+
return /* @__PURE__ */ import_react237.default.createElement(
|
|
48374
48340
|
"li",
|
|
48375
48341
|
{
|
|
48376
48342
|
className: (0, import_clsx58.default)("str-chat__suggestion-list-item", className, {
|
|
@@ -48379,7 +48345,7 @@ var SuggestionListItem = import_react238.default.forwardRef(function SuggestionL
|
|
|
48379
48345
|
onMouseEnter,
|
|
48380
48346
|
ref: containerRef
|
|
48381
48347
|
},
|
|
48382
|
-
/* @__PURE__ */
|
|
48348
|
+
/* @__PURE__ */ import_react237.default.createElement(
|
|
48383
48349
|
"button",
|
|
48384
48350
|
{
|
|
48385
48351
|
onClick: handleSelect,
|
|
@@ -48390,13 +48356,13 @@ var SuggestionListItem = import_react238.default.forwardRef(function SuggestionL
|
|
|
48390
48356
|
},
|
|
48391
48357
|
ref: innerRef
|
|
48392
48358
|
},
|
|
48393
|
-
/* @__PURE__ */
|
|
48359
|
+
/* @__PURE__ */ import_react237.default.createElement(Component2, { entity: item2, focused })
|
|
48394
48360
|
)
|
|
48395
48361
|
);
|
|
48396
48362
|
});
|
|
48397
48363
|
|
|
48398
48364
|
// src/components/TextareaComposer/SuggestionList/UserItem.tsx
|
|
48399
|
-
var
|
|
48365
|
+
var import_react238 = __toESM(require("react"));
|
|
48400
48366
|
var import_clsx59 = __toESM(require("clsx"));
|
|
48401
48367
|
var UserItem = ({ Avatar: Avatar2 = Avatar, entity }) => {
|
|
48402
48368
|
const hasEntity = !!Object.keys(entity).length;
|
|
@@ -48405,7 +48371,7 @@ var UserItem = ({ Avatar: Avatar2 = Avatar, entity }) => {
|
|
|
48405
48371
|
const renderName = () => parts.map((part, i) => {
|
|
48406
48372
|
const matches = part.toLowerCase() === token;
|
|
48407
48373
|
const partWithHTMLSpacesAround = part.replace(/^\s+|\s+$/g, "\xA0");
|
|
48408
|
-
return /* @__PURE__ */
|
|
48374
|
+
return /* @__PURE__ */ import_react238.default.createElement(
|
|
48409
48375
|
"span",
|
|
48410
48376
|
{
|
|
48411
48377
|
className: (0, import_clsx59.default)({
|
|
@@ -48417,14 +48383,14 @@ var UserItem = ({ Avatar: Avatar2 = Avatar, entity }) => {
|
|
|
48417
48383
|
partWithHTMLSpacesAround
|
|
48418
48384
|
);
|
|
48419
48385
|
});
|
|
48420
|
-
return /* @__PURE__ */
|
|
48386
|
+
return /* @__PURE__ */ import_react238.default.createElement("div", { className: "str-chat__user-item" }, /* @__PURE__ */ import_react238.default.createElement(
|
|
48421
48387
|
Avatar2,
|
|
48422
48388
|
{
|
|
48423
48389
|
className: "str-chat__avatar--autocomplete-item",
|
|
48424
48390
|
image: entity.image,
|
|
48425
48391
|
name: entity.name || entity.id
|
|
48426
48392
|
}
|
|
48427
|
-
), /* @__PURE__ */
|
|
48393
|
+
), /* @__PURE__ */ import_react238.default.createElement("span", { className: "str-chat__user-item--name", "data-testid": "user-item-name" }, renderName()), /* @__PURE__ */ import_react238.default.createElement("div", { className: "str-chat__user-item-at" }, "@"));
|
|
48428
48394
|
};
|
|
48429
48395
|
|
|
48430
48396
|
// src/components/TextareaComposer/SuggestionList/SuggestionList.tsx
|
|
@@ -48435,25 +48401,26 @@ var searchSourceStateSelector = (nextValue) => ({
|
|
|
48435
48401
|
items: nextValue.items ?? []
|
|
48436
48402
|
});
|
|
48437
48403
|
var defaultComponents = {
|
|
48438
|
-
"/": CommandItem,
|
|
48439
|
-
":": EmoticonItem,
|
|
48440
|
-
"@": UserItem
|
|
48404
|
+
"/": (props) => /* @__PURE__ */ import_react239.default.createElement(CommandItem, { entity: props.entity }),
|
|
48405
|
+
":": (props) => /* @__PURE__ */ import_react239.default.createElement(EmoticonItem, { entity: props.entity }),
|
|
48406
|
+
"@": (props) => /* @__PURE__ */ import_react239.default.createElement(UserItem, { entity: props.entity })
|
|
48441
48407
|
};
|
|
48442
48408
|
var SuggestionList = ({
|
|
48443
48409
|
className,
|
|
48444
48410
|
closeOnClickOutside = true,
|
|
48445
48411
|
containerClassName,
|
|
48446
48412
|
focusedItemIndex,
|
|
48447
|
-
setFocusedItemIndex
|
|
48413
|
+
setFocusedItemIndex,
|
|
48414
|
+
suggestionItemComponents = defaultComponents
|
|
48448
48415
|
}) => {
|
|
48449
48416
|
const { AutocompleteSuggestionItem = SuggestionListItem } = useComponentContext();
|
|
48450
48417
|
const messageComposer = useMessageComposer();
|
|
48451
48418
|
const { textComposer } = messageComposer;
|
|
48452
48419
|
const { suggestions } = useStateStore(textComposer.state, textComposerStateSelector);
|
|
48453
48420
|
const { items } = useStateStore(suggestions?.searchSource.state, searchSourceStateSelector) ?? {};
|
|
48454
|
-
const [container, setContainer] = (0,
|
|
48455
|
-
const component = suggestions?.trigger
|
|
48456
|
-
(0,
|
|
48421
|
+
const [container, setContainer] = (0, import_react239.useState)(null);
|
|
48422
|
+
const component = suggestions?.trigger ? suggestionItemComponents[suggestions?.trigger] : void 0;
|
|
48423
|
+
(0, import_react239.useEffect)(() => {
|
|
48457
48424
|
if (!closeOnClickOutside || !suggestions || !container) return;
|
|
48458
48425
|
const handleClick = (event) => {
|
|
48459
48426
|
if (container.contains(event.target)) return;
|
|
@@ -48465,19 +48432,19 @@ var SuggestionList = ({
|
|
|
48465
48432
|
};
|
|
48466
48433
|
}, [closeOnClickOutside, suggestions, container, textComposer]);
|
|
48467
48434
|
if (!suggestions || !items?.length || !component) return null;
|
|
48468
|
-
return /* @__PURE__ */
|
|
48435
|
+
return /* @__PURE__ */ import_react239.default.createElement(
|
|
48469
48436
|
"div",
|
|
48470
48437
|
{
|
|
48471
48438
|
className: (0, import_clsx60.default)("str-chat__suggestion-list-container", containerClassName),
|
|
48472
48439
|
ref: setContainer
|
|
48473
48440
|
},
|
|
48474
|
-
/* @__PURE__ */
|
|
48441
|
+
/* @__PURE__ */ import_react239.default.createElement(
|
|
48475
48442
|
InfiniteScrollPaginator,
|
|
48476
48443
|
{
|
|
48477
48444
|
loadNextOnScrollToBottom: suggestions.searchSource.search,
|
|
48478
48445
|
threshold: 100
|
|
48479
48446
|
},
|
|
48480
|
-
/* @__PURE__ */
|
|
48447
|
+
/* @__PURE__ */ import_react239.default.createElement(
|
|
48481
48448
|
"ul",
|
|
48482
48449
|
{
|
|
48483
48450
|
className: (0, import_clsx60.default)(
|
|
@@ -48485,7 +48452,7 @@ var SuggestionList = ({
|
|
|
48485
48452
|
className
|
|
48486
48453
|
)
|
|
48487
48454
|
},
|
|
48488
|
-
items.map((item2, i) => /* @__PURE__ */
|
|
48455
|
+
items.map((item2, i) => /* @__PURE__ */ import_react239.default.createElement(
|
|
48489
48456
|
AutocompleteSuggestionItem,
|
|
48490
48457
|
{
|
|
48491
48458
|
component,
|
|
@@ -48501,7 +48468,9 @@ var SuggestionList = ({
|
|
|
48501
48468
|
};
|
|
48502
48469
|
|
|
48503
48470
|
// src/components/TextareaComposer/TextareaComposer.tsx
|
|
48471
|
+
var import_lodash19 = __toESM(require("lodash.debounce"));
|
|
48504
48472
|
var import_clsx61 = __toESM(require("clsx"));
|
|
48473
|
+
var import_react240 = require("react");
|
|
48505
48474
|
var import_react241 = __toESM(require("react"));
|
|
48506
48475
|
var import_react_textarea_autosize = __toESM(require("react-textarea-autosize"));
|
|
48507
48476
|
var textComposerStateSelector2 = (state) => ({
|
|
@@ -48521,33 +48490,32 @@ var TextareaComposer = ({
|
|
|
48521
48490
|
className,
|
|
48522
48491
|
closeSuggestionsOnClickOutside,
|
|
48523
48492
|
containerClassName,
|
|
48524
|
-
// dropdownClassName, // todo: X find a different way to prevent prop drilling
|
|
48525
|
-
grow: growProp,
|
|
48526
|
-
// itemClassName, // todo: X find a different way to prevent prop drilling
|
|
48527
48493
|
listClassName,
|
|
48528
48494
|
maxRows: maxRowsProp = 1,
|
|
48495
|
+
minRows: minRowsProp,
|
|
48529
48496
|
onBlur,
|
|
48530
48497
|
onChange,
|
|
48531
48498
|
onKeyDown,
|
|
48532
48499
|
onScroll,
|
|
48500
|
+
onSelect,
|
|
48533
48501
|
placeholder: placeholderProp,
|
|
48534
48502
|
shouldSubmit: shouldSubmitProp,
|
|
48535
|
-
...
|
|
48503
|
+
...restTextareaProps
|
|
48536
48504
|
}) => {
|
|
48537
48505
|
const { t } = useTranslationContext();
|
|
48538
48506
|
const { AutocompleteSuggestionList = SuggestionList } = useComponentContext();
|
|
48539
48507
|
const {
|
|
48540
48508
|
additionalTextareaProps,
|
|
48541
48509
|
cooldownRemaining,
|
|
48542
|
-
grow: growContext,
|
|
48543
48510
|
handleSubmit,
|
|
48544
48511
|
maxRows: maxRowsContext,
|
|
48512
|
+
minRows: minRowsContext,
|
|
48545
48513
|
onPaste,
|
|
48546
48514
|
shouldSubmit: shouldSubmitContext,
|
|
48547
48515
|
textareaRef
|
|
48548
48516
|
} = useMessageInputContext();
|
|
48549
|
-
const grow = growProp ?? growContext;
|
|
48550
48517
|
const maxRows = maxRowsProp ?? maxRowsContext;
|
|
48518
|
+
const minRows = minRowsProp ?? minRowsContext;
|
|
48551
48519
|
const placeholder = placeholderProp ?? additionalTextareaProps?.placeholder;
|
|
48552
48520
|
const shouldSubmit = shouldSubmitProp ?? shouldSubmitContext ?? defaultShouldSubmit;
|
|
48553
48521
|
const messageComposer = useMessageComposer();
|
|
@@ -48648,6 +48616,20 @@ var TextareaComposer = ({
|
|
|
48648
48616
|
},
|
|
48649
48617
|
[onScroll, textComposer]
|
|
48650
48618
|
);
|
|
48619
|
+
const setSelectionDebounced = (0, import_react240.useMemo)(
|
|
48620
|
+
() => (0, import_lodash19.default)(
|
|
48621
|
+
(e) => {
|
|
48622
|
+
onSelect?.(e);
|
|
48623
|
+
textComposer.setSelection({
|
|
48624
|
+
end: e.target.selectionEnd,
|
|
48625
|
+
start: e.target.selectionStart
|
|
48626
|
+
});
|
|
48627
|
+
},
|
|
48628
|
+
100,
|
|
48629
|
+
{ leading: false, trailing: true }
|
|
48630
|
+
),
|
|
48631
|
+
[onSelect, textComposer]
|
|
48632
|
+
);
|
|
48651
48633
|
(0, import_react241.useEffect)(() => {
|
|
48652
48634
|
if (textareaRef.current && !isComposing) {
|
|
48653
48635
|
textareaRef.current.selectionStart = selection.start;
|
|
@@ -48675,7 +48657,7 @@ var TextareaComposer = ({
|
|
|
48675
48657
|
/* @__PURE__ */ import_react241.default.createElement(
|
|
48676
48658
|
import_react_textarea_autosize.default,
|
|
48677
48659
|
{
|
|
48678
|
-
...
|
|
48660
|
+
...{ ...additionalTextareaProps, ...restTextareaProps },
|
|
48679
48661
|
"aria-label": cooldownRemaining ? t("Slow Mode ON") : placeholder,
|
|
48680
48662
|
className: (0, import_clsx61.default)(
|
|
48681
48663
|
"rta__textarea",
|
|
@@ -48684,7 +48666,8 @@ var TextareaComposer = ({
|
|
|
48684
48666
|
),
|
|
48685
48667
|
"data-testid": "message-input",
|
|
48686
48668
|
disabled: !enabled || !!cooldownRemaining,
|
|
48687
|
-
maxRows
|
|
48669
|
+
maxRows,
|
|
48670
|
+
minRows,
|
|
48688
48671
|
onBlur,
|
|
48689
48672
|
onChange: changeHandler,
|
|
48690
48673
|
onCompositionEnd,
|
|
@@ -48692,6 +48675,7 @@ var TextareaComposer = ({
|
|
|
48692
48675
|
onKeyDown: keyDownHandler,
|
|
48693
48676
|
onPaste,
|
|
48694
48677
|
onScroll: scrollHandler,
|
|
48678
|
+
onSelect: setSelectionDebounced,
|
|
48695
48679
|
placeholder: placeholder || t("Type your message"),
|
|
48696
48680
|
ref: (ref) => {
|
|
48697
48681
|
textareaRef.current = ref;
|
|
@@ -48872,8 +48856,9 @@ var MessageInputFlat = () => {
|
|
|
48872
48856
|
RecordingPermissionDeniedNotification: RecordingPermissionDeniedNotification2 = RecordingPermissionDeniedNotification,
|
|
48873
48857
|
SendButton: SendButton2 = SendButton,
|
|
48874
48858
|
StartRecordingAudioButton: StartRecordingAudioButton2 = StartRecordingAudioButton,
|
|
48875
|
-
StopAIGenerationButton: StopAIGenerationButtonOverride
|
|
48876
|
-
|
|
48859
|
+
StopAIGenerationButton: StopAIGenerationButtonOverride,
|
|
48860
|
+
TextareaComposer: TextareaComposer2 = TextareaComposer
|
|
48861
|
+
} = useComponentContext();
|
|
48877
48862
|
const { channel } = useChatContext("MessageInputFlat");
|
|
48878
48863
|
const { aiState } = useAIState(channel);
|
|
48879
48864
|
const stopGenerating = (0, import_react245.useCallback)(() => channel?.stopAIResponse(), [channel]);
|
|
@@ -48896,7 +48881,7 @@ var MessageInputFlat = () => {
|
|
|
48896
48881
|
onClose: closePermissionDeniedNotification,
|
|
48897
48882
|
permissionName: "microphone" /* MIC */
|
|
48898
48883
|
}
|
|
48899
|
-
), /* @__PURE__ */ import_react245.default.createElement(LinkPreviewList2, null), /* @__PURE__ */ import_react245.default.createElement(QuotedMessagePreviewHeader, null), /* @__PURE__ */ import_react245.default.createElement("div", { className: "str-chat__message-input-inner" }, /* @__PURE__ */ import_react245.default.createElement(AttachmentSelector2, null), /* @__PURE__ */ import_react245.default.createElement("div", { className: "str-chat__message-textarea-container" }, /* @__PURE__ */ import_react245.default.createElement(QuotedMessagePreview2, null), /* @__PURE__ */ import_react245.default.createElement(AttachmentPreviewList2, null), /* @__PURE__ */ import_react245.default.createElement("div", { className: "str-chat__message-textarea-with-emoji-picker" }, /* @__PURE__ */ import_react245.default.createElement(
|
|
48884
|
+
), /* @__PURE__ */ import_react245.default.createElement(LinkPreviewList2, null), /* @__PURE__ */ import_react245.default.createElement(QuotedMessagePreviewHeader, null), /* @__PURE__ */ import_react245.default.createElement("div", { className: "str-chat__message-input-inner" }, /* @__PURE__ */ import_react245.default.createElement(AttachmentSelector2, null), /* @__PURE__ */ import_react245.default.createElement("div", { className: "str-chat__message-textarea-container" }, /* @__PURE__ */ import_react245.default.createElement(QuotedMessagePreview2, null), /* @__PURE__ */ import_react245.default.createElement(AttachmentPreviewList2, null), /* @__PURE__ */ import_react245.default.createElement("div", { className: "str-chat__message-textarea-with-emoji-picker" }, /* @__PURE__ */ import_react245.default.createElement(TextareaComposer2, null), EmojiPicker && /* @__PURE__ */ import_react245.default.createElement(EmojiPicker, null))), shouldDisplayStopAIGeneration ? /* @__PURE__ */ import_react245.default.createElement(StopAIGenerationButton2, { onClick: stopGenerating }) : !hideSendButton && /* @__PURE__ */ import_react245.default.createElement(import_react245.default.Fragment, null, cooldownRemaining ? /* @__PURE__ */ import_react245.default.createElement(
|
|
48900
48885
|
CooldownTimer2,
|
|
48901
48886
|
{
|
|
48902
48887
|
cooldownInterval: cooldownRemaining,
|
|
@@ -48928,10 +48913,8 @@ var useCreateMessageInputContext = (value) => {
|
|
|
48928
48913
|
cooldownRemaining,
|
|
48929
48914
|
emojiSearchIndex,
|
|
48930
48915
|
focus,
|
|
48931
|
-
grow,
|
|
48932
48916
|
handleSubmit,
|
|
48933
48917
|
hideSendButton,
|
|
48934
|
-
insertText,
|
|
48935
48918
|
isThreadInput,
|
|
48936
48919
|
maxRows,
|
|
48937
48920
|
minRows,
|
|
@@ -48953,10 +48936,8 @@ var useCreateMessageInputContext = (value) => {
|
|
|
48953
48936
|
cooldownRemaining,
|
|
48954
48937
|
emojiSearchIndex,
|
|
48955
48938
|
focus,
|
|
48956
|
-
grow,
|
|
48957
48939
|
handleSubmit,
|
|
48958
48940
|
hideSendButton,
|
|
48959
|
-
insertText,
|
|
48960
48941
|
isThreadInput,
|
|
48961
48942
|
maxRows,
|
|
48962
48943
|
minRows,
|
|
@@ -49097,7 +49078,6 @@ var EditMessageModal = ({
|
|
|
49097
49078
|
MessageInput,
|
|
49098
49079
|
{
|
|
49099
49080
|
clearEditingState,
|
|
49100
|
-
grow: true,
|
|
49101
49081
|
hideSendButton: true,
|
|
49102
49082
|
Input: EditMessageInput,
|
|
49103
49083
|
...additionalMessageInputProps
|
|
@@ -49661,9 +49641,9 @@ var getAttachmentType = (attachment) => {
|
|
|
49661
49641
|
// src/components/Channel/Channel.tsx
|
|
49662
49642
|
var import_react261 = __toESM(require("react"));
|
|
49663
49643
|
var import_clsx66 = __toESM(require("clsx"));
|
|
49664
|
-
var
|
|
49665
|
-
var
|
|
49666
|
-
var
|
|
49644
|
+
var import_lodash20 = __toESM(require("lodash.debounce"));
|
|
49645
|
+
var import_lodash21 = __toESM(require("lodash.defaultsdeep"));
|
|
49646
|
+
var import_lodash22 = __toESM(require("lodash.throttle"));
|
|
49667
49647
|
var import_stream_chat11 = require("stream-chat");
|
|
49668
49648
|
|
|
49669
49649
|
// src/components/Channel/channelState.ts
|
|
@@ -50261,7 +50241,7 @@ var ChannelInner = (props) => {
|
|
|
50261
50241
|
skipMessageDataMemoization
|
|
50262
50242
|
} = props;
|
|
50263
50243
|
const channelQueryOptions = (0, import_react261.useMemo)(
|
|
50264
|
-
() => (0,
|
|
50244
|
+
() => (0, import_lodash21.default)(propChannelQueryOptions, {
|
|
50265
50245
|
messages: { limit: DEFAULT_INITIAL_CHANNEL_PAGE_SIZE }
|
|
50266
50246
|
}),
|
|
50267
50247
|
[propChannelQueryOptions]
|
|
@@ -50295,7 +50275,7 @@ var ChannelInner = (props) => {
|
|
|
50295
50275
|
null
|
|
50296
50276
|
);
|
|
50297
50277
|
const channelCapabilitiesArray = channel.data?.own_capabilities;
|
|
50298
|
-
const throttledCopyStateFromChannel = (0,
|
|
50278
|
+
const throttledCopyStateFromChannel = (0, import_lodash22.default)(
|
|
50299
50279
|
() => dispatch({ channel, type: "copyStateFromChannelOnEvent" }),
|
|
50300
50280
|
500,
|
|
50301
50281
|
{
|
|
@@ -50304,14 +50284,14 @@ var ChannelInner = (props) => {
|
|
|
50304
50284
|
}
|
|
50305
50285
|
);
|
|
50306
50286
|
const setChannelUnreadUiState = (0, import_react261.useMemo)(
|
|
50307
|
-
() => (0,
|
|
50287
|
+
() => (0, import_lodash22.default)(_setChannelUnreadUiState, 200, {
|
|
50308
50288
|
leading: true,
|
|
50309
50289
|
trailing: false
|
|
50310
50290
|
}),
|
|
50311
50291
|
[]
|
|
50312
50292
|
);
|
|
50313
50293
|
const markRead = (0, import_react261.useMemo)(
|
|
50314
|
-
() => (0,
|
|
50294
|
+
() => (0, import_lodash22.default)(
|
|
50315
50295
|
async (options) => {
|
|
50316
50296
|
const { updateChannelUiUnreadState = true } = options ?? {};
|
|
50317
50297
|
if (channel.disconnected || !channelConfig?.read_events) {
|
|
@@ -50516,7 +50496,7 @@ var ChannelInner = (props) => {
|
|
|
50516
50496
|
[]
|
|
50517
50497
|
);
|
|
50518
50498
|
const loadMoreFinished = (0, import_react261.useCallback)(
|
|
50519
|
-
(0,
|
|
50499
|
+
(0, import_lodash20.default)(
|
|
50520
50500
|
(hasMore, messages) => {
|
|
50521
50501
|
if (!isMounted.current) return;
|
|
50522
50502
|
dispatch({ hasMore, messages, type: "loadMoreFinished" });
|
|
@@ -50837,7 +50817,7 @@ var ChannelInner = (props) => {
|
|
|
50837
50817
|
dispatch({ type: "closeThread" });
|
|
50838
50818
|
};
|
|
50839
50819
|
const loadMoreThreadFinished = (0, import_react261.useCallback)(
|
|
50840
|
-
(0,
|
|
50820
|
+
(0, import_lodash20.default)(
|
|
50841
50821
|
(threadHasMore, threadMessages) => {
|
|
50842
50822
|
dispatch({
|
|
50843
50823
|
threadHasMore,
|
|
@@ -50982,6 +50962,7 @@ var ChannelInner = (props) => {
|
|
|
50982
50962
|
StartRecordingAudioButton: props.StartRecordingAudioButton,
|
|
50983
50963
|
StopAIGenerationButton: props.StopAIGenerationButton,
|
|
50984
50964
|
StreamedMessageText: props.StreamedMessageText,
|
|
50965
|
+
TextareaComposer: props.TextareaComposer,
|
|
50985
50966
|
ThreadHead: props.ThreadHead,
|
|
50986
50967
|
ThreadHeader: props.ThreadHeader,
|
|
50987
50968
|
ThreadStart: props.ThreadStart,
|
|
@@ -51044,6 +51025,7 @@ var ChannelInner = (props) => {
|
|
|
51044
51025
|
props.StartRecordingAudioButton,
|
|
51045
51026
|
props.StopAIGenerationButton,
|
|
51046
51027
|
props.StreamedMessageText,
|
|
51028
|
+
props.TextareaComposer,
|
|
51047
51029
|
props.ThreadHead,
|
|
51048
51030
|
props.ThreadHeader,
|
|
51049
51031
|
props.ThreadStart,
|
|
@@ -51159,7 +51141,7 @@ var useChat = ({
|
|
|
51159
51141
|
};
|
|
51160
51142
|
(0, import_react264.useEffect)(() => {
|
|
51161
51143
|
if (!client) return;
|
|
51162
|
-
const version = "13.0.0
|
|
51144
|
+
const version = "13.0.0";
|
|
51163
51145
|
const userAgent = client.getUserAgent();
|
|
51164
51146
|
if (!userAgent.includes("stream-chat-react")) {
|
|
51165
51147
|
client.setUserAgent(`stream-chat-react-${version}-${userAgent}`);
|