stream-chat-react 14.9.0 → 14.10.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.
Files changed (40) hide show
  1. package/dist/cjs/channel-detail.js +30 -22
  2. package/dist/cjs/channel-detail.js.map +1 -1
  3. package/dist/cjs/index.js +51 -57
  4. package/dist/cjs/index.js.map +1 -1
  5. package/dist/cjs/{useChannelHeaderOnlineStatus.72753090.js → useChannelHeaderOnlineStatus.6ace991c.js} +42 -26
  6. package/dist/cjs/useChannelHeaderOnlineStatus.6ace991c.js.map +1 -0
  7. package/dist/cjs/useNotificationApi.bf76a16b.js.map +1 -1
  8. package/dist/es/channel-detail.mjs +30 -22
  9. package/dist/es/channel-detail.mjs.map +1 -1
  10. package/dist/es/index.mjs +51 -57
  11. package/dist/es/index.mjs.map +1 -1
  12. package/dist/es/{useChannelHeaderOnlineStatus.c86db868.mjs → useChannelHeaderOnlineStatus.d6065c22.mjs} +37 -27
  13. package/dist/es/useChannelHeaderOnlineStatus.d6065c22.mjs.map +1 -0
  14. package/dist/es/useNotificationApi.ed6bff88.mjs.map +1 -1
  15. package/dist/types/components/Avatar/Avatar.d.ts +7 -2
  16. package/dist/types/components/Avatar/Avatar.d.ts.map +1 -1
  17. package/dist/types/components/Avatar/utils.d.ts +3 -0
  18. package/dist/types/components/Avatar/utils.d.ts.map +1 -0
  19. package/dist/types/components/ChannelListItem/utils.d.ts.map +1 -1
  20. package/dist/types/components/Dialog/components/ContextMenu.d.ts.map +1 -1
  21. package/dist/types/components/Message/MessageRepliesCountButton.d.ts.map +1 -1
  22. package/dist/types/components/Message/MessageUI.d.ts.map +1 -1
  23. package/dist/types/components/Poll/PollOptionSelector.d.ts.map +1 -1
  24. package/dist/types/components/Poll/PollVote.d.ts.map +1 -1
  25. package/dist/types/components/Reactions/MessageReactionsDetail.d.ts.map +1 -1
  26. package/dist/types/components/Search/SearchResults/SearchResultItem.d.ts.map +1 -1
  27. package/dist/types/components/TextareaComposer/SuggestionList/MentionItem/UserItem.d.ts.map +1 -1
  28. package/dist/types/components/Threads/ThreadList/ThreadListItemUI.d.ts.map +1 -1
  29. package/dist/types/components/TypingIndicator/TypingIndicator.d.ts.map +1 -1
  30. package/dist/types/components/TypingIndicator/hooks/useDebouncedTypingActive.d.ts +2 -8
  31. package/dist/types/components/TypingIndicator/hooks/useDebouncedTypingActive.d.ts.map +1 -1
  32. package/dist/types/context/ComponentContext.d.ts +4 -0
  33. package/dist/types/context/ComponentContext.d.ts.map +1 -1
  34. package/dist/types/plugins/ChannelDetail/Views/ChannelMediaView/ChannelMediaView.d.ts.map +1 -1
  35. package/dist/types/plugins/ChannelDetail/Views/ChannelMembersView/ChannelMembersAddView.d.ts.map +1 -1
  36. package/dist/types/plugins/ChannelDetail/Views/ChannelMembersView/ChannelMembersBrowseView.d.ts.map +1 -1
  37. package/dist/types/plugins/ChannelDetail/Views/PinnedMessagesView/PinnedMessagesView.d.ts.map +1 -1
  38. package/package.json +1 -1
  39. package/dist/cjs/useChannelHeaderOnlineStatus.72753090.js.map +0 -1
  40. package/dist/es/useChannelHeaderOnlineStatus.c86db868.mjs.map +0 -1
@@ -530,16 +530,19 @@ var getInitials = (name) => {
530
530
  /**
531
531
  * A round avatar image with fallback to username's first letter
532
532
  */
533
- var Avatar = ({ className, FallbackIcon = IconUser, imageUrl, isOnline, size, userName, ...rest }) => {
533
+ var Avatar = ({ className, FallbackIcon = IconUser, imageUrl, initials: customInitials, isOnline, size, userName, ...rest }) => {
534
534
  const [error, setError] = useState(false);
535
535
  useEffect(() => () => setError(false), [imageUrl]);
536
- const nameString = userName?.toString() || "";
537
- const avatarImageAlt = nameString.trim();
536
+ const nameString = userName?.toString().trim() || "";
538
537
  const sizeAwareInitials = useMemo(() => {
539
- const initials = getInitials(nameString);
538
+ const initials = customInitials || getInitials(nameString);
540
539
  if (size === "sm" || size === "xs") return initials.charAt(0);
541
540
  return initials;
542
- }, [nameString, size]);
541
+ }, [
542
+ nameString,
543
+ size,
544
+ customInitials
545
+ ]);
543
546
  const showImage = typeof imageUrl === "string" && imageUrl && !error;
544
547
  return /* @__PURE__ */ jsxs("div", {
545
548
  className: clsx(`str-chat__avatar`, className, {
@@ -556,7 +559,7 @@ var Avatar = ({ className, FallbackIcon = IconUser, imageUrl, isOnline, size, us
556
559
  "str-chat__avatar-status-badge--offline": !isOnline,
557
560
  "str-chat__avatar-status-badge--online": isOnline
558
561
  }) }), showImage ? /* @__PURE__ */ jsx("img", {
559
- alt: avatarImageAlt,
562
+ alt: nameString,
560
563
  className: "str-chat__avatar-image",
561
564
  "data-testid": "avatar-img",
562
565
  onError: () => setError(true),
@@ -714,21 +717,24 @@ var BaseContextMenuButton = ({ children, className, details, hasSubMenu, Icon, l
714
717
  !!hasSubMenu && /* @__PURE__ */ jsx(SubmenuIcon, { className: "str-chat__context-menu__button__submenu-icon" })
715
718
  ]
716
719
  });
717
- var UserContextMenuButton = ({ children, className, imageUrl, role = "menuitem", userName, ...props }) => /* @__PURE__ */ jsxs("button", {
718
- ...props,
719
- className: clsx("str-chat__context-menu__button str-chat__user-context-menu__button", className),
720
- role,
721
- type: "button",
722
- children: [/* @__PURE__ */ jsx(Avatar, {
723
- "aria-hidden": true,
724
- imageUrl,
725
- size: "sm",
726
- userName
727
- }), /* @__PURE__ */ jsx("div", {
728
- className: "str-chat__context-menu__button__label",
729
- children: children ?? userName
730
- })]
731
- });
720
+ var UserContextMenuButton = ({ children, className, imageUrl, role = "menuitem", userName, ...props }) => {
721
+ const { Avatar: Avatar$1 = Avatar } = useComponentContext();
722
+ return /* @__PURE__ */ jsxs("button", {
723
+ ...props,
724
+ className: clsx("str-chat__context-menu__button str-chat__user-context-menu__button", className),
725
+ role,
726
+ type: "button",
727
+ children: [/* @__PURE__ */ jsx(Avatar$1, {
728
+ "aria-hidden": true,
729
+ imageUrl,
730
+ size: "sm",
731
+ userName
732
+ }), /* @__PURE__ */ jsx("div", {
733
+ className: "str-chat__context-menu__button__label",
734
+ children: children ?? userName
735
+ })]
736
+ });
737
+ };
732
738
  var EmojiContextMenuButton = ({ children, className, emoji, label, role = "menuitem", ...props }) => /* @__PURE__ */ jsxs("button", {
733
739
  ...props,
734
740
  className: clsx("str-chat__context-menu__button str-chat__emoji-context-menu__button", className),
@@ -1484,6 +1490,13 @@ var GlobalModal = ({ "aria-describedby": ariaDescribedby, "aria-label": ariaLabe
1484
1490
  });
1485
1491
  };
1486
1492
  //#endregion
1493
+ //#region src/components/Avatar/utils.ts
1494
+ var extractDisplayInfo = ({ user }) => ({
1495
+ id: user?.id,
1496
+ imageUrl: user?.image,
1497
+ userName: user?.name
1498
+ });
1499
+ //#endregion
1487
1500
  //#region src/components/Message/renderText/remarkPlugins/htmlToTextPlugin.ts
1488
1501
  var visitor = (node) => {
1489
1502
  if (node.type !== "html") return;
@@ -3260,10 +3273,7 @@ var getGroupChannelDisplayInfo = (channel) => {
3260
3273
  for (const member of members) {
3261
3274
  const { user } = member;
3262
3275
  if (!user?.name && !user?.image) continue;
3263
- memberList.push({
3264
- imageUrl: user.image,
3265
- userName: user.name
3266
- });
3276
+ memberList.push(extractDisplayInfo(member));
3267
3277
  }
3268
3278
  return { members: memberList };
3269
3279
  };
@@ -3884,6 +3894,6 @@ function useChannelHeaderOnlineStatus({ channel: channelOverride, watcherCount:
3884
3894
  return `${t("{{ memberCount }} members", { memberCount })} · ${t("{{ watcherCount }} online", { watcherCount })}`;
3885
3895
  }
3886
3896
  //#endregion
3887
- export { ContextMenu as $, Gallery as A, VisuallyHidden as At, formatTime as B, MessageContext as Bt, Checkbox as C, useStableCallback as Ct, SwitchFieldDescription as D, NotificationConfigurationProvider as Dt, SwitchField as E, useNotifications as Et, toGalleryItemDescriptors as F, useModalContext as Ft, MessageTimestamp as G, FILE_ICON_GRAPHIC_CLASSNAME as H, useMessageContext as Ht, useGalleryContext as I, MessageTranslationViewContext as It, imageToLink as J, Timestamp as K, toBaseImageDescriptors as L, MessageTranslationViewProvider as Lt, VideoThumbnail as M, useAriaLiveOutletContext as Mt, VideoPlayer as N, ModalContext as Nt, SwitchFieldLabel as O, useNotificationConfigurationContext as Ot, GalleryContext as P, ModalContextProvider as Pt, BaseContextMenuButton as Q, BaseImage as R, getTranslatedMessageText as Rt, TextInput as S, useAriaIdentifiers as St, Switch as T, LoadingIndicator as Tt, FILE_ICON_NO_LABEL_CLASSNAME as U, FileIcon as V, MessageProvider as Vt, DownloadButton as W, GlobalModal as X, htmlToTextPlugin as Y, Prompt as Z, getLatestMessagePreview as _, DialogAnchor as _t, pickNewest as a, ContextMenuRoot as at, ListItemLayout as b, Header as bt, useIsUserMuted as c, UserContextMenuButton as ct, useSelectedChannelState as d, getNextRovingFocusIndex as dt, ContextMenuBackButton as et, isDmChannel as f, GroupAvatar as ft, getGroupChannelDisplayInfo as g, Avatar as gt, getChannelDisplayImage as h, ErrorBadge as ht, createDefaultPickNext as i, ContextMenuHeader as it, GalleryUI as j, AriaLiveOutletContext as jt, SwitchFieldTitle as k, AriaLiveOutlet as kt, useIsChannelMuted as l, useContextMenuContext as lt, useChannelDisplayName as m, Badge as mt, useChannelHasMembersOnline as n, ContextMenuButton as nt, pickOldest as o, DEFAULT_CONTEXT_MENU_KEYBOARD_NAVIGATION_ITEM_SELECTOR as ot, useChannelPreviewInfo as p, ChannelAvatar as pt, plusPlusToEmphasis as q, NotificationList as r, ContextMenuContent as rt, Notification as s, EmojiContextMenuButton as st, useChannelHeaderOnlineStatus as t, ContextMenuBody as tt, useChannelMembershipState as u, createRovingFocusKeyDownHandler as ut, getLatestMessagePreviewText as v, useDialogAnchor as vt, Checkmark as w, FileSizeIndicator as wt, ListItemLayoutContent as x, Root as xt, renderPreviewText as y, Alert as yt, ImagePlaceholder as z, useMessageTranslationViewContext as zt };
3897
+ export { BaseContextMenuButton as $, Gallery as A, AriaLiveOutlet as At, formatTime as B, useMessageTranslationViewContext as Bt, Checkbox as C, useAriaIdentifiers as Ct, SwitchFieldDescription as D, useNotifications as Dt, SwitchField as E, LoadingIndicator as Et, toGalleryItemDescriptors as F, ModalContextProvider as Ft, MessageTimestamp as G, FILE_ICON_GRAPHIC_CLASSNAME as H, MessageProvider as Ht, useGalleryContext as I, useModalContext as It, imageToLink as J, Timestamp as K, toBaseImageDescriptors as L, MessageTranslationViewContext as Lt, VideoThumbnail as M, AriaLiveOutletContext as Mt, VideoPlayer as N, useAriaLiveOutletContext as Nt, SwitchFieldLabel as O, NotificationConfigurationProvider as Ot, GalleryContext as P, ModalContext as Pt, Prompt as Q, BaseImage as R, MessageTranslationViewProvider as Rt, TextInput as S, Root as St, Switch as T, FileSizeIndicator as Tt, FILE_ICON_NO_LABEL_CLASSNAME as U, useMessageContext as Ut, FileIcon as V, MessageContext as Vt, DownloadButton as W, extractDisplayInfo as X, htmlToTextPlugin as Y, GlobalModal as Z, getLatestMessagePreview as _, Avatar as _t, pickNewest as a, ContextMenuHeader as at, ListItemLayout as b, Alert as bt, useIsUserMuted as c, EmojiContextMenuButton as ct, useSelectedChannelState as d, createRovingFocusKeyDownHandler as dt, ContextMenu as et, isDmChannel as f, getNextRovingFocusIndex as ft, getGroupChannelDisplayInfo as g, ErrorBadge as gt, getChannelDisplayImage as h, Badge as ht, createDefaultPickNext as i, ContextMenuContent as it, GalleryUI as j, VisuallyHidden as jt, SwitchFieldTitle as k, useNotificationConfigurationContext as kt, useIsChannelMuted as l, UserContextMenuButton as lt, useChannelDisplayName as m, ChannelAvatar as mt, useChannelHasMembersOnline as n, ContextMenuBody as nt, pickOldest as o, ContextMenuRoot as ot, useChannelPreviewInfo as p, GroupAvatar as pt, plusPlusToEmphasis as q, NotificationList as r, ContextMenuButton as rt, Notification as s, DEFAULT_CONTEXT_MENU_KEYBOARD_NAVIGATION_ITEM_SELECTOR as st, useChannelHeaderOnlineStatus as t, ContextMenuBackButton as tt, useChannelMembershipState as u, useContextMenuContext as ut, getLatestMessagePreviewText as v, DialogAnchor as vt, Checkmark as w, useStableCallback as wt, ListItemLayoutContent as x, Header as xt, renderPreviewText as y, useDialogAnchor as yt, ImagePlaceholder as z, getTranslatedMessageText as zt };
3888
3898
 
3889
- //# sourceMappingURL=useChannelHeaderOnlineStatus.c86db868.mjs.map
3899
+ //# sourceMappingURL=useChannelHeaderOnlineStatus.d6065c22.mjs.map