UNPKG

@bothub-chat/ui

Version:

Bothub UI Components

2 lines (1 loc) 1.67 kB
import{__rest as t}from"tslib";import{jsx as o,jsxs as i}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-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 l}from"../../../icons/word-big/index.js";import{XlsBigIcon as a}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,$=t(j,["icon","name","size"]);const b=x(),{variant:v,color:w}=d();let u;return u="string"!=typeof g||h?h:g.match(/.txt$/i)?o(p,{}):g.match(/.doc$/i)||g.match(/.docx$/i)?o(l,{}):g.match(/.xls$/i)||g.match(/.xlsx$/i)?o(a,{}):g.match(/.pdf$/i)?o(c,{}):o(f,{}),i(r,Object.assign({},$,{children:[o(n,{fill:b.default.colors.base.white,size:46,children:u}),i(e,{children:["string"==typeof g&&i(s,{$variant:v,$color:w,children:[g.length>32&&"...",g.slice(-32)]}),"string"!=typeof g&&g,"string"==typeof y&&o(m,{$variant:v,$color:w,children:y}),"string"!=typeof y&&y]})]}))};export{j as MessageFile,e as MessageFileInfo,s as MessageFileName,m as MessageFileSize,r as MessageFileStyled};