@bothub-chat/ui
Version:
Bothub UI Components
2 lines (1 loc) • 2.01 kB
JavaScript
import{jsx as e,jsxs as t,Fragment as o}from"react/jsx-runtime";import{PresetCardStyled as n,PresetCardContent as l,PresetCardLine as i,PresetCardMain as r,PresetCardTop as s,PresetCardNameActions as d,PresetCardName as c,PresetCardLoader as a,PresetCardDescription as h,PresetCardCategories as p,PresetCardCategory as m}from"./styled.js";export{PresetCardAction,PresetCardActions,PresetCardDeleteAction,PresetCardEditAction,PresetCardFavoriteAction}from"./styled.js";import{Skeleton as f}from"../../skeleton/index.js";import{Tooltip as g}from"../../tooltip/index.js";import{TooltipConsumer as k}from"../../tooltip/context.js";const u=({className:u,name:M,color:C,actions:j,description:v,categories:x,skeleton:y=!1,loading:$=!1,onClick:A})=>e(n,{$skeleton:y,$loading:$,className:u,onClick:A,children:t(l,{children:[!y&&e(i,{$skeleton:!1,$color:C}),y&&e(i,{$skeleton:!0,as:f,variant:"rectangular"}),t(r,{children:[t(s,{children:[t(d,{children:[y&&e(c,{children:e(f,{width:220})}),!y&&t(o,{children:["string"==typeof M&&e(g,{label:M,placement:"top-left",disabled:M.length<=84,children:e(k,{children:({handleTooltipMouseEnter:e,handleTooltipMouseLeave:o})=>t(c,{onMouseEnter:e,onMouseLeave:o,children:[M.slice(0,84),M.length>84&&"..."]})})}),"string"!=typeof M&&M]}),$&&e(a,{}),!$&&j]}),y&&t(h,{$skeleton:!0,children:[e(f,{width:260}),e(f,{width:180})]}),!y&&t(o,{children:["string"==typeof v&&e(g,{label:v,placement:"top-left",disabled:v.length<=128,children:e(k,{children:({handleTooltipMouseEnter:e,handleTooltipMouseLeave:o})=>t(h,{onMouseEnter:e,onMouseLeave:o,children:[v.slice(0,128),v.length>128&&"..."]})})}),"string"!=typeof v&&v]})]}),y&&x&&t(p,{children:[e(m,{skeleton:!0}),e(m,{skeleton:!0}),e(m,{skeleton:!0})]}),!y&&x]})]})});export{u as PresetCard,p as PresetCardCategories,m as PresetCardCategory,l as PresetCardContent,h as PresetCardDescription,i as PresetCardLine,a as PresetCardLoader,r as PresetCardMain,c as PresetCardName,d as PresetCardNameActions,n as PresetCardStyled,s as PresetCardTop};