stream-chat-react 14.0.0-beta.5 → 14.0.0-beta.6

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.
Files changed (33) hide show
  1. package/dist/cjs/{WithAudioPlayback.0c10cb67.js → WithAudioPlayback.f9abf707.js} +43 -33
  2. package/dist/cjs/WithAudioPlayback.f9abf707.js.map +1 -0
  3. package/dist/cjs/emojis.js +1 -1
  4. package/dist/cjs/index.js +54 -52
  5. package/dist/cjs/index.js.map +1 -1
  6. package/dist/css/index.css +149 -544
  7. package/dist/css/index.css.map +1 -1
  8. package/dist/es/{WithAudioPlayback.e7821fd4.mjs → WithAudioPlayback.d90f1a99.mjs} +43 -33
  9. package/dist/es/WithAudioPlayback.d90f1a99.mjs.map +1 -0
  10. package/dist/es/emojis.mjs +1 -1
  11. package/dist/es/index.mjs +55 -53
  12. package/dist/es/index.mjs.map +1 -1
  13. package/dist/types/components/Avatar/Avatar.d.ts +1 -1
  14. package/dist/types/components/Avatar/Avatar.d.ts.map +1 -1
  15. package/dist/types/components/Avatar/AvatarStack.d.ts +2 -2
  16. package/dist/types/components/Avatar/AvatarStack.d.ts.map +1 -1
  17. package/dist/types/components/Avatar/ChannelAvatar.d.ts +2 -6
  18. package/dist/types/components/Avatar/ChannelAvatar.d.ts.map +1 -1
  19. package/dist/types/components/Avatar/GroupAvatar.d.ts +6 -7
  20. package/dist/types/components/Avatar/GroupAvatar.d.ts.map +1 -1
  21. package/dist/types/components/ChannelHeader/ChannelHeader.d.ts.map +1 -1
  22. package/dist/types/components/ChannelListItem/ChannelListItemUI.d.ts.map +1 -1
  23. package/dist/types/components/ChannelListItem/utils.d.ts.map +1 -1
  24. package/dist/types/components/Icons/createIcon.d.ts +1 -1
  25. package/dist/types/components/Icons/createIcon.d.ts.map +1 -1
  26. package/dist/types/components/Icons/icons.d.ts +3 -3
  27. package/dist/types/components/Icons/icons.d.ts.map +1 -1
  28. package/dist/types/components/TypingIndicator/TypingIndicator.d.ts.map +1 -1
  29. package/dist/types/context/ComponentContext.d.ts +2 -2
  30. package/dist/types/context/ComponentContext.d.ts.map +1 -1
  31. package/package.json +1 -1
  32. package/dist/cjs/WithAudioPlayback.0c10cb67.js.map +0 -1
  33. package/dist/es/WithAudioPlayback.e7821fd4.mjs.map +0 -1
@@ -25,7 +25,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
25
25
  const jsxRuntime = require("react/jsx-runtime");
26
26
  const React = require("react");
27
27
  const Picker = require("@emoji-mart/react");
28
- const WithAudioPlayback = require("./WithAudioPlayback.0c10cb67.js");
28
+ const WithAudioPlayback = require("./WithAudioPlayback.f9abf707.js");
29
29
  const mergeWith = require("lodash.mergewith");
30
30
  const streamChat = require("stream-chat");
31
31
  const isShadowRoot = (node) => !!node.host;
package/dist/cjs/index.js CHANGED
@@ -5,7 +5,7 @@ const clsx = require("clsx");
5
5
  const nanoid = require("nanoid");
6
6
  const React = require("react");
7
7
  const audioProcessing = require("./audioProcessing.56e5db9d.js");
8
- const WithAudioPlayback = require("./WithAudioPlayback.0c10cb67.js");
8
+ const WithAudioPlayback = require("./WithAudioPlayback.f9abf707.js");
9
9
  const streamChat = require("stream-chat");
10
10
  const throttle = require("lodash.throttle");
11
11
  const linkify = require("linkifyjs");
@@ -9309,12 +9309,17 @@ const ErrorBadge = ({
9309
9309
  }) => /* @__PURE__ */ jsxRuntime.jsx(Badge, { ...rest, className, size, variant: "error", children: /* @__PURE__ */ jsxRuntime.jsx(WithAudioPlayback.IconExclamationMarkFill, {}) });
9310
9310
  function AvatarStack({
9311
9311
  badgeSize,
9312
+ capLimit = 3,
9312
9313
  component: Component = "div",
9313
9314
  displayInfo = [],
9314
- overflowCount,
9315
9315
  size
9316
9316
  }) {
9317
9317
  const { Avatar: Avatar$1 = Avatar } = WithAudioPlayback.useComponentContext(AvatarStack.name);
9318
+ const displayInfoToRender = React.useMemo(
9319
+ () => displayInfo.length > capLimit ? displayInfo.slice(0, capLimit) : displayInfo,
9320
+ [displayInfo, capLimit]
9321
+ );
9322
+ const overflowCount = displayInfo.length - displayInfoToRender.length;
9318
9323
  if (!displayInfo.length) {
9319
9324
  return null;
9320
9325
  }
@@ -9324,8 +9329,9 @@ function AvatarStack({
9324
9329
  className: clsx("str-chat__avatar-stack", {
9325
9330
  [`str-chat__avatar-stack--size-${size}`]: typeof size === "string"
9326
9331
  }),
9332
+ "data-testid": "avatar-stack",
9327
9333
  children: [
9328
- displayInfo.map((info, index) => /* @__PURE__ */ jsxRuntime.jsx(
9334
+ displayInfoToRender.map((info, index) => /* @__PURE__ */ jsxRuntime.jsx(
9329
9335
  Avatar$1,
9330
9336
  {
9331
9337
  imageUrl: info.imageUrl,
@@ -9338,6 +9344,7 @@ function AvatarStack({
9338
9344
  Badge,
9339
9345
  {
9340
9346
  className: "str-chat__avatar-stack__count-badge",
9347
+ "data-testid": "avatar-stack-count-badge",
9341
9348
  size: badgeSize ?? size,
9342
9349
  variant: "counter",
9343
9350
  children: [
@@ -9353,34 +9360,36 @@ function AvatarStack({
9353
9360
  const ChannelAvatar = ({
9354
9361
  displayMembers,
9355
9362
  imageUrl,
9356
- overflowCount,
9357
9363
  size,
9358
9364
  userName,
9359
9365
  ...sharedProps
9360
9366
  }) => {
9361
- if ((displayMembers?.length ?? 0) >= 2) {
9362
- return /* @__PURE__ */ jsxRuntime.jsx(
9363
- GroupAvatar,
9367
+ const displayInfo = React.useMemo(() => {
9368
+ if (displayMembers && displayMembers.length > 0) {
9369
+ return displayMembers;
9370
+ }
9371
+ return [
9364
9372
  {
9365
- displayMembers,
9366
- overflowCount,
9367
- size,
9368
- ...sharedProps
9373
+ imageUrl,
9374
+ userName
9369
9375
  }
9370
- );
9371
- }
9372
- return /* @__PURE__ */ jsxRuntime.jsx(Avatar, { imageUrl, size, userName, ...sharedProps });
9376
+ ];
9377
+ }, [displayMembers, imageUrl, userName]);
9378
+ return /* @__PURE__ */ jsxRuntime.jsx(GroupAvatar, { displayMembers: displayInfo, size, ...sharedProps });
9373
9379
  };
9374
9380
  const GroupAvatar = ({
9375
9381
  badgeSize,
9376
9382
  className,
9377
9383
  displayMembers = [],
9378
9384
  isOnline,
9379
- overflowCount,
9380
9385
  size,
9381
9386
  ...rest
9382
9387
  }) => {
9383
- const displayCountBadge = typeof overflowCount === "number" && overflowCount > 0;
9388
+ const displayMembersToRender = React.useMemo(
9389
+ () => displayMembers.length > 4 ? displayMembers.slice(0, 2) : displayMembers,
9390
+ [displayMembers]
9391
+ );
9392
+ const overflowCount = displayMembers.length - displayMembersToRender.length;
9384
9393
  if (displayMembers.length < 2) {
9385
9394
  const firstUser = displayMembers[0];
9386
9395
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -9418,19 +9427,20 @@ const GroupAvatar = ({
9418
9427
  role: "button",
9419
9428
  ...rest,
9420
9429
  children: [
9421
- displayMembers.slice(0, displayCountBadge ? 2 : 4).map(({ imageUrl, userName }, index) => /* @__PURE__ */ jsxRuntime.jsx(
9430
+ displayMembersToRender.map(({ id, imageUrl, userName }, index) => /* @__PURE__ */ jsxRuntime.jsx(
9422
9431
  Avatar,
9423
9432
  {
9424
9433
  imageUrl,
9425
9434
  size: avatarSize,
9426
9435
  userName
9427
9436
  },
9428
- `${userName}-${imageUrl}-${index}`
9437
+ id || `${userName}-${imageUrl}-${index}`
9429
9438
  )),
9430
- displayCountBadge && /* @__PURE__ */ jsxRuntime.jsxs(
9439
+ typeof overflowCount === "number" && overflowCount > 0 && /* @__PURE__ */ jsxRuntime.jsxs(
9431
9440
  Badge,
9432
9441
  {
9433
9442
  className: "str-chat__avatar-group__count-badge",
9443
+ "data-testid": "group-avatar-count-badge",
9434
9444
  size: badgeSize,
9435
9445
  variant: "counter",
9436
9446
  children: [
@@ -12028,7 +12038,7 @@ const RemoveAttachmentPreviewButton = ({
12028
12038
  "data-testid": "preview-item-delete-button",
12029
12039
  disabled: uploadState === "uploading",
12030
12040
  ...props,
12031
- children: /* @__PURE__ */ jsxRuntime.jsx(WithAudioPlayback.IconCrossSmall, {})
12041
+ children: /* @__PURE__ */ jsxRuntime.jsx(WithAudioPlayback.IconXmarkSmall, {})
12032
12042
  }
12033
12043
  );
12034
12044
  };
@@ -16244,7 +16254,7 @@ const FileAttachmentPreview = ({
16244
16254
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: hasSizeLimitError ? t("File too large") : uploadState === "blocked" ? t("Upload blocked") : t("Upload failed") })
16245
16255
  ] }),
16246
16256
  hasRetriableError && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "str-chat__attachment-preview-file__retriable-error", children: [
16247
- /* @__PURE__ */ jsxRuntime.jsx(WithAudioPlayback.IconExclamationTriangle, {}),
16257
+ /* @__PURE__ */ jsxRuntime.jsx(WithAudioPlayback.IconExclamationTriangleFill, {}),
16248
16258
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: t("Upload error") }),
16249
16259
  /* @__PURE__ */ jsxRuntime.jsx(
16250
16260
  "button",
@@ -16464,7 +16474,7 @@ const ProgressBar = ({ className, progress, seek }) => {
16464
16474
  {
16465
16475
  className: "str-chat__message-attachment-audio-widget--progress-indicator",
16466
16476
  ref: setProgressIndicator,
16467
- style: { left: `${indicatorLeft}px` }
16477
+ style: { insetInlineStart: `${indicatorLeft}px` }
16468
16478
  }
16469
16479
  )
16470
16480
  }
@@ -16700,7 +16710,7 @@ const WaveProgressBar = ({
16700
16710
  "data-testid": "wave-progress-bar-progress-indicator",
16701
16711
  ref: setProgressIndicator,
16702
16712
  style: {
16703
- left: `${indicatorLeft}px`
16713
+ insetInlineStart: `${indicatorLeft}px`
16704
16714
  }
16705
16715
  }
16706
16716
  )
@@ -16799,7 +16809,7 @@ const AudioAttachmentPreview = ({
16799
16809
  /* @__PURE__ */ jsxRuntime.jsx(WithAudioPlayback.IconExclamationMark, {}),
16800
16810
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: hasSizeLimitError ? t("File too large") : uploadState === "blocked" ? t("Upload blocked") : t("Upload failed") })
16801
16811
  ] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "str-chat__attachment-preview-file__retriable-error", children: [
16802
- /* @__PURE__ */ jsxRuntime.jsx(WithAudioPlayback.IconExclamationTriangle, {}),
16812
+ /* @__PURE__ */ jsxRuntime.jsx(WithAudioPlayback.IconExclamationTriangleFill, {}),
16803
16813
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: t("Upload error") }),
16804
16814
  /* @__PURE__ */ jsxRuntime.jsx(
16805
16815
  "button",
@@ -16842,7 +16852,7 @@ const MediaAttachmentPreview = ({
16842
16852
  removeAttachments
16843
16853
  }) => {
16844
16854
  const { t } = WithAudioPlayback.useTranslationContext();
16845
- const { BaseImage: BaseImage$1 = BaseImage, LoadingIndicator: LoadingIndicator2 = LoadingIndicatorIcon } = WithAudioPlayback.useComponentContext();
16855
+ const { BaseImage: BaseImage$1 = BaseImage, LoadingIndicator: LoadingIndicator$1 = LoadingIndicator } = WithAudioPlayback.useComponentContext();
16846
16856
  const [thumbnailPreviewError, setThumbnailPreviewError] = React.useState(false);
16847
16857
  const { id, uploadPermissionCheck, uploadState } = attachment.localMetadata ?? {};
16848
16858
  const isUploading = uploadState === "uploading";
@@ -16893,7 +16903,7 @@ const MediaAttachmentPreview = ({
16893
16903
  }
16894
16904
  ),
16895
16905
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: clsx("str-chat__attachment-preview-media__overlay"), children: [
16896
- isUploading && /* @__PURE__ */ jsxRuntime.jsx(LoadingIndicator2, {}),
16906
+ isUploading && /* @__PURE__ */ jsxRuntime.jsx(LoadingIndicator$1, { "data-testid": "loading-indicator" }),
16897
16907
  streamChat.isVideoAttachment(attachment) && !hasUploadError && uploadState !== "uploading" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "str-chat__attachment-preview-media__video-indicator", children: [
16898
16908
  /* @__PURE__ */ jsxRuntime.jsx(WithAudioPlayback.IconVideoFill, {}),
16899
16909
  attachment.duration && /* @__PURE__ */ jsxRuntime.jsx("div", { children: attachment.duration })
@@ -18985,8 +18995,7 @@ const getGroupChannelDisplayInfo = (channel) => {
18985
18995
  memberList.push({ imageUrl: user.image, userName: user.name });
18986
18996
  }
18987
18997
  return {
18988
- members: memberList,
18989
- overflowCount: memberList.length > 4 ? memberList.length - 2 : void 0
18998
+ members: memberList
18990
18999
  };
18991
19000
  };
18992
19001
  function computeChannelDisplayName(channel, directMessageLabel) {
@@ -19192,7 +19201,7 @@ const useChat = ({
19192
19201
  };
19193
19202
  React.useEffect(() => {
19194
19203
  if (!client) return;
19195
- const version = "14.0.0-beta.5";
19204
+ const version = "14.0.0-beta.6";
19196
19205
  const userAgent = client.getUserAgent();
19197
19206
  if (!userAgent.includes("stream-chat-react")) {
19198
19207
  client.setUserAgent(`stream-chat-react-${version}-${userAgent}`);
@@ -22335,7 +22344,6 @@ const InfiniteScroll = (props) => {
22335
22344
  children
22336
22345
  ] });
22337
22346
  };
22338
- const MAX_AVATARS = 3;
22339
22347
  const UnMemoizedTypingIndicator = (props) => {
22340
22348
  const { isMessageListScrolledToBottom = true, scrollToBottom, threadList } = props;
22341
22349
  const { channelConfig, thread } = WithAudioPlayback.useChannelStateContext("TypingIndicator");
@@ -22352,11 +22360,16 @@ const UnMemoizedTypingIndicator = (props) => {
22352
22360
  const typingUsers = threadList ? typingInThread : typingInChannel;
22353
22361
  const { displayUsers } = useDebouncedTypingActive(typingUsers);
22354
22362
  const showIndicator = displayUsers.length > 0;
22355
- const displayInfo = displayUsers.slice(0, MAX_AVATARS).map(({ user }) => ({
22356
- id: user?.id,
22357
- imageUrl: user?.image,
22358
- userName: user?.name ?? ""
22359
- }));
22363
+ const displayInfo = React.useMemo(
22364
+ () => displayUsers.map(
22365
+ ({ user }) => ({
22366
+ id: user?.id,
22367
+ imageUrl: user?.image,
22368
+ userName: user?.name
22369
+ })
22370
+ ),
22371
+ [displayUsers]
22372
+ );
22360
22373
  React.useEffect(() => {
22361
22374
  if (showIndicator && isMessageListScrolledToBottom) scrollToBottom();
22362
22375
  }, [scrollToBottom, isMessageListScrolledToBottom, showIndicator]);
@@ -22366,7 +22379,6 @@ const UnMemoizedTypingIndicator = (props) => {
22366
22379
  if (!showIndicator || !isMessageListScrolledToBottom) {
22367
22380
  return null;
22368
22381
  }
22369
- const overflowCount = displayUsers.length > MAX_AVATARS ? displayUsers.length - MAX_AVATARS : 0;
22370
22382
  return /* @__PURE__ */ jsxRuntime.jsxs(
22371
22383
  "div",
22372
22384
  {
@@ -22379,15 +22391,7 @@ const UnMemoizedTypingIndicator = (props) => {
22379
22391
  ),
22380
22392
  "data-testid": "typing-indicator",
22381
22393
  children: [
22382
- displayInfo.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
22383
- AvatarStack,
22384
- {
22385
- badgeSize: "md",
22386
- displayInfo,
22387
- overflowCount: overflowCount > 0 ? overflowCount : void 0,
22388
- size: "md"
22389
- }
22390
- ),
22394
+ displayInfo.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(AvatarStack, { badgeSize: "md", displayInfo, size: "md" }),
22391
22395
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "str-chat__typing-indicator__bubble", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "str-chat__typing-indicator__dots", children: /* @__PURE__ */ jsxRuntime.jsx(TypingIndicatorDots, {}) }) })
22392
22396
  ]
22393
22397
  }
@@ -26230,7 +26234,6 @@ const UnMemoizedChannelListItemUI = (props) => {
26230
26234
  {
26231
26235
  displayMembers: groupChannelDisplayInfo?.members,
26232
26236
  imageUrl: displayImage,
26233
- overflowCount: groupChannelDisplayInfo?.overflowCount,
26234
26237
  size: "xl",
26235
26238
  userName: avatarName
26236
26239
  }
@@ -26911,7 +26914,7 @@ const IconsBySeverity = {
26911
26914
  info: null,
26912
26915
  loading: WithAudioPlayback.IconRefresh,
26913
26916
  success: WithAudioPlayback.IconCheckmark,
26914
- warning: WithAudioPlayback.IconExclamationTriangle
26917
+ warning: WithAudioPlayback.IconExclamationTriangleFill
26915
26918
  };
26916
26919
  const DefaultNotificationIcon = ({ notification }) => {
26917
26920
  if (!notification.severity) return null;
@@ -27851,7 +27854,7 @@ const UnsupportedAttachment = ({ attachment }) => {
27851
27854
  const VisibilityDisclaimer = () => {
27852
27855
  const { t } = WithAudioPlayback.useTranslationContext();
27853
27856
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "str-chat__visibility-disclaimer", children: [
27854
- /* @__PURE__ */ jsxRuntime.jsx(WithAudioPlayback.IconEyeOpen, {}),
27857
+ /* @__PURE__ */ jsxRuntime.jsx(WithAudioPlayback.IconEyeFill, {}),
27855
27858
  t("Only visible to you")
27856
27859
  ] });
27857
27860
  };
@@ -28312,7 +28315,6 @@ const ChannelHeader = (props) => {
28312
28315
  className: "str-chat__avatar--channel-header",
28313
28316
  displayMembers: groupChannelDisplayInfo?.members,
28314
28317
  imageUrl: displayImage,
28315
- overflowCount: groupChannelDisplayInfo?.overflowCount,
28316
28318
  size: "lg",
28317
28319
  userName: displayTitle
28318
28320
  }
@@ -28376,15 +28378,14 @@ exports.IconChevronRight = WithAudioPlayback.IconChevronRight;
28376
28378
  exports.IconClock = WithAudioPlayback.IconClock;
28377
28379
  exports.IconCommand = WithAudioPlayback.IconCommand;
28378
28380
  exports.IconCopy = WithAudioPlayback.IconCopy;
28379
- exports.IconCrossSmall = WithAudioPlayback.IconCrossSmall;
28380
28381
  exports.IconDelete = WithAudioPlayback.IconDelete;
28381
28382
  exports.IconEdit = WithAudioPlayback.IconEdit;
28382
28383
  exports.IconEmoji = WithAudioPlayback.IconEmoji;
28383
28384
  exports.IconExclamationCircleFill = WithAudioPlayback.IconExclamationCircleFill;
28384
28385
  exports.IconExclamationMark = WithAudioPlayback.IconExclamationMark;
28385
28386
  exports.IconExclamationMarkFill = WithAudioPlayback.IconExclamationMarkFill;
28386
- exports.IconExclamationTriangle = WithAudioPlayback.IconExclamationTriangle;
28387
- exports.IconEyeOpen = WithAudioPlayback.IconEyeOpen;
28387
+ exports.IconExclamationTriangleFill = WithAudioPlayback.IconExclamationTriangleFill;
28388
+ exports.IconEyeFill = WithAudioPlayback.IconEyeFill;
28388
28389
  exports.IconFile = WithAudioPlayback.IconFile;
28389
28390
  exports.IconFlag = WithAudioPlayback.IconFlag;
28390
28391
  exports.IconGiphy = WithAudioPlayback.IconGiphy;
@@ -28432,6 +28433,7 @@ exports.IconVideoFill = WithAudioPlayback.IconVideoFill;
28432
28433
  exports.IconVoice = WithAudioPlayback.IconVoice;
28433
28434
  exports.IconXCircle = WithAudioPlayback.IconXCircle;
28434
28435
  exports.IconXmark = WithAudioPlayback.IconXmark;
28436
+ exports.IconXmarkSmall = WithAudioPlayback.IconXmarkSmall;
28435
28437
  exports.LoadingChannel = WithAudioPlayback.LoadingChannel;
28436
28438
  exports.LoadingErrorIndicator = WithAudioPlayback.LoadingErrorIndicator;
28437
28439
  exports.MESSAGE_ACTIONS = WithAudioPlayback.MESSAGE_ACTIONS;