{"version":3,"file":"MessageComposerPreviews.mjs","names":[],"sources":["../../../../src/components/MessageComposer/MessageComposerPreviews.tsx"],"sourcesContent":["import React from 'react';\n\nimport { useMessageComposerPreviewSetFilter } from './hooks/useMessageComposerPreviewSetFilter';\nimport type { MessageComposerPreviewVisibilityFilterParams } from './hooks/useMessageComposerPreviewState';\nimport { defaultMessageComposerPreviewSet } from './MessageComposerPreviews.defaults';\n\n/**\n * The preview types {@link defaultMessageComposerPreviewSet} ships, listed for autocomplete. Any\n * string is accepted, so custom previews name themselves.\n */\nexport type DefaultMessageComposerPreviewType =\n  | 'attachments'\n  | 'editedMessage'\n  | 'linkPreviews'\n  | 'location'\n  | 'quotedMessage'\n  | 'voiceRecording';\n\nexport type MessageComposerPreviewSetItem = {\n  /** Rendered without props while `isVisible` holds. Read the composer with `useMessageComposerController()`. */\n  Component: React.ComponentType;\n  /** Whether the preview shows for the current composer state. */\n  isVisible: (state: MessageComposerPreviewVisibilityFilterParams) => boolean;\n  /** Names the preview; unique within a set. */\n  type: DefaultMessageComposerPreviewType | (string & {});\n};\n\nexport type MessageComposerPreviewsProps = {\n  /** Previews in render order. Defaults to {@link defaultMessageComposerPreviewSet}. */\n  messageComposerPreviewSet?: MessageComposerPreviewSetItem[];\n};\n\n/**\n * Renders the composer's visible previews (edited or quoted message, voice recording,\n * attachments, link previews, location) above the textarea, or nothing when none is visible.\n */\nexport const MessageComposerPreviews = ({\n  messageComposerPreviewSet = defaultMessageComposerPreviewSet,\n}: MessageComposerPreviewsProps) => {\n  const visiblePreviewSet = useMessageComposerPreviewSetFilter(messageComposerPreviewSet);\n\n  if (!visiblePreviewSet.length) return null;\n\n  return (\n    <div className='str-chat__message-composer-previews'>\n      {visiblePreviewSet.map(({ Component, type }) => (\n        <Component key={type} />\n      ))}\n    </div>\n  );\n};\n"],"mappings":";;;;;;;;;AAoCA,IAAa,2BAA2B,EACtC,4BAA4B,uCACM;CAClC,MAAM,oBAAoB,mCAAmC,yBAAyB;CAEtF,IAAI,CAAC,kBAAkB,QAAQ,OAAO;CAEtC,OACE,oBAAC,OAAD;EAAK,WAAU;YACZ,kBAAkB,KAAK,EAAE,WAAW,WACnC,oBAAC,WAAD,CAAuB,GAAP,IAAO,CACxB;CACE,CAAA;AAET"}