UNPKG

@bothub-chat/ui

Version:

Bothub UI Components

2 lines (1 loc) 1.67 kB
import{__rest as t}from"tslib";import{jsx as i,jsxs as o}from"react/jsx-runtime";import{MessageFileStyled as r,MessageFileInfo as e,MessageFileName as s,MessageFileSize as m}from"./styled.js";export{MessageFiles}from"./styled.js";import{IconProvider as n}from"../../icon/context.js";import"../../icon/styled.js";import"react";import"@react-spring/web";import"react-markdown";import"react-dom";import"../../portal/styled.js";import"../../tooltip/styled.js";import"../../tooltip/arrow/styled.js";import"../../../theme/index.js";import"../../tooltip/context.js";import{PdfBigIcon as c}from"../../../icons/pdf-big/index.js";import{TxtBigIcon as p}from"../../../icons/txt-big/index.js";import{WordBigIcon as a}from"../../../icons/word-big/index.js";import{XlsBigIcon as l}from"../../../icons/xls-big/index.js";import{useMessage as d}from"../context.js";import{AttachFileBigIcon as f}from"../../../icons/attach-file-big/index.js";import{useTheme as x}from"../../../theme/hook.js";const j=j=>{var{icon:h,name:g,size:y}=j,b=t(j,["icon","name","size"]);const $=x(),{variant:w}=d();let v;return v="string"!=typeof g||h?h:g.match(/.txt$/i)?i(p,{}):g.match(/.doc$/i)||g.match(/.docx$/i)?i(a,{}):g.match(/.xls$/i)||g.match(/.xlsx$/i)?i(l,{}):g.match(/.pdf$/i)?i(c,{}):i(f,{}),o(r,Object.assign({},b,{children:[i(n,{fill:$.default.colors.base.white,size:46,children:v}),o(e,{children:["string"==typeof g&&o(s,{$variant:w,children:[g.length>32&&"...",g.slice(-32)]}),"string"!=typeof g&&g,"string"==typeof y&&i(m,{$variant:w,children:y}),"string"!=typeof y&&y]})]}))};export{j as MessageFile,e as MessageFileInfo,s as MessageFileName,m as MessageFileSize,r as MessageFileStyled};