{"version":3,"file":"CommandChip.mjs","names":[],"sources":["../../../../src/components/MessageComposer/CommandChip.tsx"],"sourcesContent":["import { useMessageComposerController } from './hooks';\nimport type { TextComposerState } from 'stream-chat';\nimport {\n  useComponentContextIcons,\n  useMessageComposerContext,\n  useTranslationContext,\n} from '../../context';\n\nexport type CommandChipProps = {\n  command?: TextComposerState['command'];\n};\n\nexport const CommandChip = ({ command }: CommandChipProps) => {\n  const { IconBolt, IconXmark } = useComponentContextIcons();\n  const { textComposer } = useMessageComposerController();\n  const { textareaRef } = useMessageComposerContext();\n  const { t } = useTranslationContext();\n  if (!command) return null;\n\n  return (\n    <div className='str-chat__command-chip'>\n      <IconBolt />\n      <span aria-hidden='true' tabIndex={-1}>\n        {command.name}\n      </span>\n      <button\n        aria-label={t(\n          'messageComposer.commandChip.exitCommand.ariaLabel',\n          'Exit command {{ command }}',\n          { command: command.name },\n        )}\n        className={'str-chat__command-chip__close-button'}\n        onClick={() => {\n          textComposer.setCommand(null);\n          textareaRef.current?.focus();\n        }}\n      >\n        <IconXmark />\n      </button>\n    </div>\n  );\n};\n"],"mappings":";;;;;;AAYA,IAAa,eAAe,EAAE,cAAgC;CAC5D,MAAM,EAAE,UAAU,cAAc,yBAAyB;CACzD,MAAM,EAAE,iBAAiB,6BAA6B;CACtD,MAAM,EAAE,gBAAgB,0BAA0B;CAClD,MAAM,EAAE,MAAM,sBAAsB;CACpC,IAAI,CAAC,SAAS,OAAO;CAErB,OACE,qBAAC,OAAD;EAAK,WAAU;YAAf;GACE,oBAAC,UAAD,CAAW,CAAA;GACX,oBAAC,QAAD;IAAM,eAAY;IAAO,UAAU;cAChC,QAAQ;GACL,CAAA;GACN,oBAAC,UAAD;IACE,cAAY,EACV,qDACA,8BACA,EAAE,SAAS,QAAQ,KAAK,CAC1B;IACA,WAAW;IACX,eAAe;KACb,aAAa,WAAW,IAAI;KAC5B,YAAY,SAAS,MAAM;IAC7B;cAEA,oBAAC,WAAD,CAAY,CAAA;GACN,CAAA;EACL;;AAET"}