{"version":3,"file":"ComponentContext.mjs","names":[],"sources":["../../../src/context/ComponentContext.tsx"],"sourcesContent":["import type { ComponentProps, ComponentType, PropsWithChildren } from 'react';\nimport React, { useContext } from 'react';\nimport type { UserResponse } from 'stream-chat';\n\nimport {\n  type AttachmentProps,\n  type AvatarStackProps,\n  type BaseImageProps,\n  type CalloutDialogProps,\n  type ChannelAvatarProps,\n  type ChannelListItemUIProps,\n  type ContextMenuContentProps,\n  type ContextMenuProps,\n  type DateSeparatorProps,\n  type EmptyStateIndicatorProps,\n  type EventComponentProps,\n  type FileDragAndDropContentProps,\n  type GalleryProps,\n  type GiphyPreviewMessageProps,\n  type ImagePlaceholderProps,\n  type ListLoadErrorIndicatorProps,\n  type LoadingIndicatorProps,\n  type MessageBouncePromptProps,\n  type MessageDeletedProps,\n  type MessageListItemProps,\n  type MessageListWrapperProps,\n  type MessageProps,\n  type MessageReactionsDetailProps,\n  type MessageReactionsProps,\n  type MessageRepliesCountButtonProps,\n  type MessageTextProps,\n  type MessageTimestampProps,\n  type MessageUIComponentProps,\n  type ModalGalleryProps,\n  type ModalProps,\n  type NewMessageNotificationProps,\n  type NotificationListProps,\n  type NotificationProps,\n  type PinIndicatorProps,\n  type PollCreationDialogControlsProps,\n  type PollCreationDialogProps,\n  type PollOptionSelectorProps,\n  type ReactionOptions,\n  type ReactionSelector,\n  type ReactionSelectorProps,\n  type RecordingPermissionDeniedNotificationProps,\n  type ReminderNotificationProps,\n  type ScrollToLatestMessageButtonProps,\n  type SearchResultsPresearchProps,\n  type SearchSourceResultsProps,\n  type SendButtonProps,\n  type ShareLocationDialogProps,\n  type StartRecordingAudioButtonProps,\n  type StreamedMessageTextProps,\n  type ThreadListItemProps,\n  type ThreadListItemUIProps,\n  type TimestampProps,\n  type TranslationIndicatorProps,\n  type UnreadMessagesNotificationProps,\n  type UnreadMessagesSeparatorProps,\n} from '../components';\n\nimport type {\n  SuggestionItemProps,\n  SuggestionListProps,\n} from '../components/TextareaComposer';\n\nimport type { PropsWithChildrenOnly } from '../types/types';\nimport type { StopAIGenerationButtonProps } from '../components/MessageComposer/StopAIGenerationButton';\nimport type { VideoPlayerProps } from '../components/VideoPlayer';\nimport type { EditedMessagePreviewProps } from '../components/MessageComposer/EditedMessagePreview';\nimport type { FileIconProps } from '../components/FileIcon/FileIcon';\nimport type { FileSizeIndicatorProps } from '../components/Attachment/components/FileSizeIndicator';\nimport type { CommandChipProps } from '../components/MessageComposer/CommandChip';\nimport type { ProgressIndicatorProps } from '../components/Loading/progress-indicators';\nimport type { UploadedSizeIndicatorProps } from '../components/Loading/UploadedSizeIndicator';\nimport type { SummarizedMessagePreviewProps } from '../components/SummarizedMessagePreview';\nimport type { TypingIndicatorProps } from '../components/TypingIndicator';\nimport type { AttachmentUploadProgressIndicatorProps } from '../components/Attachment/components/AttachmentUploadProgressIndicator';\nimport type { IconSlots } from '../components/Icons/slots';\n\nexport type ComponentContextValue = {\n  /** Progress of an attachment whose upload is still in flight. */\n  AttachmentUploadProgressIndicator?: React.ComponentType<AttachmentUploadProgressIndicatorProps>;\n  /** Custom UI component rendered when a paginated list (e.g. the channel list) is empty. */\n  EmptyListIndicator?: React.ComponentType;\n  /** Custom UI component rendered at the top/bottom edge of a paginated list. */\n  EndReachedIndicator?: React.ComponentType<{\n    hasEnded: boolean;\n    reached: 'top' | 'bottom';\n  }>;\n  /** Custom UI component rendered while a paginated list loads its first page. */\n  FirstPageLoadingIndicator?: React.ComponentType;\n  /** Custom UI component rendered per item of a paginated list. */\n  ListItem?: ComponentType<{ item: unknown }>;\n  /** Custom UI component rendered in place of a paginated list whose first page failed to load. */\n  ListLoadErrorIndicator?: React.ComponentType<ListLoadErrorIndicatorProps>;\n  /** Custom UI component rendered while a paginated list loads its next page. */\n  LoadingNextPageIndicator?: React.ComponentType<{ isLoading?: boolean }>;\n  /** Actions between the textarea and the send actions. The default renders the `EmojiPicker`. */\n  AdditionalMessageComposerActions?: React.ComponentType;\n  /** Renders a message attachment. */\n  Attachment?: React.ComponentType<AttachmentProps>;\n  /**\n   * File type icon on file attachments (e.g. PDF, doc). Override it to change the dimensions or\n   * the icon.\n   */\n  AttachmentFileIcon?: React.ComponentType<FileIconProps>;\n  /**\n   * Attachment previews in the `MessageComposer`, rendered without props. To change its parts,\n   * render `AttachmentPreviewList` with your own `AttachmentPreviewListProps`.\n   */\n  AttachmentPreviewList?: React.ComponentType;\n  /** Control for adding attachments to the `MessageComposer`. */\n  AttachmentSelector?: React.ComponentType;\n  /**\n   * Voice recording preview above the composer attachments, rendered without props. To change the\n   * preview, render `VoiceRecordingPreviewSlot` with your own `VoiceRecordingPreview`.\n   */\n  VoiceRecordingPreviewSlot?: React.ComponentType;\n  /** Contents of the attachment selector's initiation button. */\n  AttachmentSelectorInitiationButtonContents?: React.ComponentType;\n  /** Audio recorder in the `MessageComposer`. */\n  AudioRecorder?: React.ComponentType;\n  /** Item in the composer's suggestion list. */\n  AutocompleteSuggestionItem?: React.ComponentType<SuggestionItemProps>;\n  /** List that displays the composer's suggestions. */\n  AutocompleteSuggestionList?: React.ComponentType<SuggestionListProps>;\n  extractDisplayInfo?: (_: {\n    user?: Partial<UserResponse>;\n  }) => NonNullable<AvatarStackProps['displayInfo']>[number];\n  /** A user's avatar. */\n  Avatar?: React.ComponentType<ChannelAvatarProps>;\n  /** Avatars stacked in a row. */\n  AvatarStack?: React.ComponentType<AvatarStackProps>;\n  /** An `<img/>` element that renders a fallback when the image fails to load. */\n  BaseImage?: React.ComponentType<BaseImageProps>;\n  /** Contents of the callout dialog. */\n  CalloutDialog?: React.ComponentType<CalloutDialogProps>;\n  /** Shown instead of an image that fails to load. */\n  ImagePlaceholder?: React.ComponentType<ImagePlaceholderProps>;\n  /**\n   * Header of the `ChannelList`, rendered without props. To add start or end content, register a\n   * component that renders `ChannelListHeader` with `StartContent` / `EndContent`.\n   */\n  ChannelListHeader?: React.ComponentType;\n  /** Action buttons within `ChannelListItemUI`. */\n  ChannelListItemActionButtons?: React.ComponentType;\n  /** Channel preview in the list. */\n  ChannelListItemUI?: React.ComponentType<ChannelListItemUIProps>;\n  /** A channel list item's previewed message. */\n  SummarizedMessagePreview?: React.ComponentType<SummarizedMessagePreviewProps>;\n  /** Chip showing the active command, with a button to exit it. */\n  CommandChip?: React.ComponentType<CommandChipProps>;\n  /**\n   * Context menu. The default also handles anchoring and placement against the reference element,\n   * submenu navigation, dismissal (Escape, overlay click, controlled close), focus management for\n   * anchored menus and transition reset between openings.\n   */\n  ContextMenu?: React.ComponentType<ContextMenuProps>;\n  /** Content of the `ContextMenu`. */\n  ContextMenuContent?: React.ComponentType<ContextMenuContentProps>;\n  /** Slow mode cooldown timer. */\n  CooldownTimer?: React.ComponentType;\n  DateSeparator?: React.ComponentType<DateSeparatorProps>;\n  /** Contents of the file drag-and-drop overlay. */\n  FileDragAndDropContent?: React.ComponentType<FileDragAndDropContentProps>;\n  /** Formatted file size, in message attachments and upload previews. */\n  FileSizeIndicator?: React.ComponentType<FileSizeIndicatorProps>;\n  /** Preview of the message being edited, shown in the composer. */\n  EditedMessagePreview?: React.ComponentType<EditedMessagePreviewProps>;\n  /** Emoji picker button in the composer. No default; `stream-chat-react/emojis` exports one. */\n  EmojiPicker?: React.ComponentType;\n  /** Shown when a message list is empty. */\n  EmptyStateIndicator?: React.ComponentType<EmptyStateIndicatorProps>;\n  /**\n   * Provides gallery state (current index, navigation) through `GalleryContext` and renders\n   * `GalleryUI`. Override it to change the data and navigation logic.\n   */\n  Gallery?: React.ComponentType<GalleryProps>;\n  /**\n   * The gallery's visual interface (slides, navigation buttons, header). Override it to change the\n   * appearance without changing the navigation logic.\n   */\n  GalleryUI?: React.ComponentType;\n  /** Giphy preview in the `VirtualizedMessageList`. */\n  GiphyPreviewMessage?: React.ComponentType<GiphyPreviewMessageProps>;\n  /** Rendered in the `MessageList` at its `headerPosition`, by default at the top. */\n  HeaderComponent?: React.ComponentType;\n  /**\n   * Overrides for the SDK's icons, keyed by icon name. Merged per slot with the defaults, so\n   * overriding one icon leaves the rest intact. Read with `useComponentContextIcons`.\n   */\n  icons?: IconSlots;\n  /**\n   * Previews above the composer's textarea. The default renders `defaultMessageComposerPreviewSet`;\n   * render `MessageComposerPreviews` with your own `messageComposerPreviewSet` to change it.\n   */\n  MessageComposerPreviews?: React.ComponentType;\n  /**\n   * How the message composer renders, without props. `MessageComposer` passes its own props\n   * through `MessageComposerContext`.\n   */\n  MessageComposerUI?: React.ComponentType;\n  /** Link previews in the message composer. */\n  LinkPreviewList?: React.ComponentType;\n  /** Loading indicator, e.g. while a message list loads older messages. */\n  LoadingIndicator?: React.ComponentType<LoadingIndicatorProps>;\n  /** Determinate progress from 0 to 100. */\n  ProgressIndicator?: React.ComponentType<ProgressIndicatorProps>;\n  /**\n   * What a message bubble holds. The default renders `defaultMessageBubbleContentSet`; render\n   * `MessageBubbleContent` with your own `messageBubbleContentSet` to change it.\n   */\n  MessageBubbleContent?: React.ComponentType;\n  /** Renders a message in the standard `MessageList`. */\n  MessageUI?: React.ComponentType<MessageUIComponentProps>;\n  /** Message actions popup, rendered without props. */\n  MessageActions?: React.ComponentType;\n  /**\n   * Contents of the bounced message modal, which usually lets the user retry, edit or delete the\n   * message.\n   */\n  MessageBouncePrompt?: React.ComponentType<MessageBouncePromptProps>;\n  /** A message blocked by moderation. */\n  MessageBlocked?: React.ComponentType;\n  /** A deleted message. No default component. */\n  MessageDeleted?: React.ComponentType<MessageDeletedProps>;\n  /** Bubble of a deleted message. */\n  MessageDeletedBubble?: React.ComponentType;\n  MessageListMainPanel?: React.ComponentType<PropsWithChildrenOnly>;\n  /** A single notification in `NotificationList`. */\n  Notification?: React.ForwardRefExoticComponent<\n    NotificationProps & React.RefAttributes<HTMLDivElement>\n  >;\n  /**\n   * Screen-reader announcements of notifications, rendered without props. To filter or reword the\n   * announcements, render `NotificationAnnouncer` with your own `NotificationAnnouncerProps`.\n   */\n  NotificationAnnouncer?: React.ComponentType;\n  /** Displays notifications. */\n  NotificationList?: React.ComponentType<NotificationListProps>;\n  /** Shown when new messages arrive while the list is scrolled up. */\n  NewMessageNotification?: React.ComponentType<NewMessageNotificationProps>;\n  /** Scroll-to-latest-message button in a `MessageList`. */\n  ScrollToLatestMessageButton?: React.ComponentType<ScrollToLatestMessageButtonProps>;\n  /** Button that opens a message's thread, showing its reply count and participants. */\n  MessageRepliesCountButton?: React.ComponentType<MessageRepliesCountButtonProps>;\n  /**\n   * Message delivery status, rendered without props. To change its parts, render `MessageStatus`\n   * with your own `MessageStatusProps`.\n   */\n  MessageStatus?: React.ComponentType;\n  /** System messages. */\n  MessageSystem?: React.ComponentType<EventComponentProps>;\n  /** Text of a message, also of an AI-generated one while `StreamedMessageText` streams it. */\n  MessageText?: React.ComponentType<MessageTextProps>;\n  /** Timestamp on a message. */\n  MessageTimestamp?: React.ComponentType<MessageTimestampProps>;\n  /** Modal for viewing content. */\n  Modal?: React.ComponentType<ModalProps>;\n  /** A message's image attachments, which expand into the `Gallery` in a `Modal`. */\n  ModalGallery?: React.ComponentType<ModalGalleryProps>;\n  /**\n   * Indicator for a message with `show_in_channel`: \"Also sent in channel\" in a thread, \"Replied\n   * to a thread\" in the channel.\n   */\n  MessageAlsoSentInChannelIndicator?: React.ComponentType;\n  PinIndicator?: React.ComponentType<PinIndicatorProps>;\n  /** Poll actions in a message. */\n  PollActions?: React.ComponentType;\n  /** Poll rendering in a message. */\n  PollContent?: React.ComponentType;\n  /** Contents of the poll creation dialog. */\n  PollCreationDialog?: React.ComponentType<PollCreationDialogProps>;\n  /**\n   * Footer of the poll creation dialog. The default cancels, or creates the poll and sends it at\n   * once. Calling `messageComposer.createPoll()` without `send()` instead leaves the poll in the\n   * composer (`state.pollId`) to go out with the next message.\n   */\n  PollCreationDialogControls?: React.ComponentType<PollCreationDialogControlsProps>;\n  /** Poll header in a message. */\n  PollHeader?: React.ComponentType;\n  /** Poll option selector. */\n  PollOptionSelector?: React.ComponentType<PollOptionSelectorProps>;\n  /** Quoted message UI on a sent message. */\n  QuotedMessage?: React.ComponentType;\n  /**\n   * Quoted message preview in the message composer, rendered without props. To change it, render\n   * `QuotedMessagePreview` with your own `QuotedMessagePreviewProps`.\n   */\n  QuotedMessagePreview?: React.ComponentType;\n  /**\n   * Reaction options read by `ReactionSelector`, `MessageReactions`, `MessageReactionsDetail` and\n   * the reaction handler. Defaults to `defaultReactionOptions`.\n   */\n  reactionOptions?: ReactionOptions;\n  /** Quick reaction picker of a message. */\n  ReactionSelector?: React.ComponentType<ReactionSelectorProps>;\n  ReactionSelectorExtendedList?: React.ComponentType<\n    ComponentProps<(typeof ReactionSelector)['ExtendedList']>\n  >;\n  /** List of reactions on a message. */\n  MessageReactions?: React.ComponentType<MessageReactionsProps>;\n  /** Dialog with the details of a message's reactions, anchored to `MessageReactions`. */\n  MessageReactionsDetail?: React.ComponentType<MessageReactionsDetailProps>;\n  RecordingPermissionDeniedNotification?: React.ComponentType<RecordingPermissionDeniedNotificationProps>;\n  /** Message reminder information in the message UI. */\n  ReminderNotification?: React.ComponentType<ReminderNotificationProps>;\n  /** Translation indicator, shown when the message has `i18n`. */\n  MessageTranslationIndicator?: React.ComponentType<TranslationIndicatorProps>;\n  /**\n   * Edited indicator and tooltip for an edited message, rendered without props. To change it,\n   * render `MessageEditedIndicator` with your own `MessageEditedIndicatorProps`.\n   */\n  MessageEditedIndicator?: React.ComponentType;\n  Search?: React.ComponentType;\n  /** The UI where the search string is entered. */\n  SearchBar?: React.ComponentType;\n  /** The results area of the search UI. */\n  SearchResults?: React.ComponentType;\n  /** Header of the search results pane. */\n  SearchResultsHeader?: React.ComponentType;\n  /** Search results pane shown before the first search query for a source. */\n  SearchResultsPresearch?: React.ComponentType<SearchResultsPresearchProps>;\n  /**\n   * The items found for a search source, rendered without props. To change its paging or items,\n   * render `SearchSourceResultList` with your own `SearchSourceResultListProps`.\n   */\n  SearchSourceResultList?: React.ComponentType;\n  /** Marks the end of the last page of results for a searched source. */\n  SearchSourceResultListFooter?: React.ComponentType;\n  /** Result items of a search source pane. */\n  SearchSourceResults?: React.ComponentType<SearchSourceResultsProps>;\n  /** Results UI of a search source with 0 items found. */\n  SearchSourceResultsEmpty?: React.ComponentType;\n  /** Header content of a search source's results. The default renders nothing. */\n  SearchSourceResultsHeader?: React.ComponentType;\n  /** Results UI of a search source while its query is running. */\n  SearchSourceResultsLoadingIndicator?: React.ComponentType;\n  SendButton?: React.ComponentType<SendButtonProps>;\n  /** Checkbox that sends a thread reply to the main channel too. */\n  SendToChannelCheckbox?: React.ComponentType;\n  /** Location sharing dialog. */\n  ShareLocationDialog?: React.ComponentType<ShareLocationDialogProps>;\n  /** Button that starts audio recording. */\n  StartRecordingAudioButton?: React.ComponentType<StartRecordingAudioButtonProps>;\n  StopAIGenerationButton?: React.ComponentType<StopAIGenerationButtonProps> | null;\n  StreamedMessageText?: React.ComponentType<StreamedMessageTextProps>;\n  /**\n   * Message text input, rendered without props. `MessageComposer` passes its textarea props\n   * through `MessageComposerContext`.\n   */\n  TextareaComposer?: React.ComponentType;\n  /** The thread's parent message, rendered above the replies in a thread's message list. */\n  ThreadHead?: React.ComponentType<MessageProps>;\n  ThreadListEmptyPlaceholder?: React.ComponentType;\n  /**\n   * Header of the `ThreadList`, rendered without props. To add start or end content, register a\n   * component that renders `ThreadListHeader` with `StartContent` / `EndContent`.\n   */\n  ThreadListHeader?: React.ComponentType;\n  ThreadListItem?: React.ComponentType<ThreadListItemProps>;\n  ThreadListItemUI?: React.ComponentType<ThreadListItemUIProps>;\n  ThreadListLoadingIndicator?: React.ComponentType;\n  ThreadListUnseenThreadsBanner?: React.ComponentType;\n  /** Reply count below the parent message in the default `ThreadHead`. */\n  ThreadStart?: React.ComponentType;\n  /**\n   * Date shown in timestamps. Used by the default `MessageTimestamp` and for the timestamp of\n   * edited messages.\n   */\n  Timestamp?: React.ComponentType<TimestampProps>;\n  TypingIndicator?: React.ComponentType<TypingIndicatorProps>;\n  /**\n   * Indicates the user is viewing unread messages. Disappears once the user scrolls to\n   * `UnreadMessagesSeparator`.\n   */\n  UnreadMessagesNotification?: React.ComponentType<UnreadMessagesNotificationProps>;\n  /** Separates read messages from unread ones. */\n  UnreadMessagesSeparator?: React.ComponentType<UnreadMessagesSeparatorProps>;\n  /** Uploaded vs total byte size during an attachment upload, in the composer previews. */\n  UploadedSizeIndicator?: React.ComponentType<UploadedSizeIndicatorProps>;\n  /** Plays video. Defaults to a `react-player` based player. */\n  VideoPlayer?: React.ComponentType<VideoPlayerProps>;\n  /** Replaces `MessageUI` inside the `VirtualizedMessageList`. No default. */\n  VirtualMessage?: React.ComponentType<MessageUIComponentProps>;\n  /** Wraps the `MessageList` children. Defaults to `ul`. */\n  MessageListWrapper?: React.ComponentType<MessageListWrapperProps>;\n  /** Wraps each element of the `MessageList`. Defaults to `li`. */\n  MessageListItem?: React.ComponentType<MessageListItemProps>;\n};\n\nexport const ComponentContext = React.createContext<ComponentContextValue>({});\n\nexport const ComponentProvider = ({\n  children,\n  value,\n}: PropsWithChildren<{\n  value: Partial<ComponentContextValue>;\n}>) => <ComponentContext.Provider value={value}>{children}</ComponentContext.Provider>;\n\nexport const useComponentContext = () => useContext(ComponentContext);\n"],"mappings":";;;AAyYA,IAAa,mBAAmB,MAAM,cAAqC,CAAC,CAAC;AAE7E,IAAa,qBAAqB,EAChC,UACA,YAGK,oBAAC,iBAAiB,UAAlB;CAAkC;CAAQ;AAAoC,CAAA;AAErF,IAAa,4BAA4B,WAAW,gBAAgB"}