@bothub-chat/ui 2.51.5-develop-4075c45f-ab0d-4f44-a458-a65269346796 → 2.51.5-develop-128a7131-b055-4ba0-aeb2-c65583137dd8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/adaptive-button/styled.d.ts +1 -0
- package/dist/components/sidebar/chat/styled.d.ts +2 -0
- package/dist/components/sidebar/group/styled.d.ts +1 -0
- package/dist/components/tooltip/index.d.ts +1 -0
- package/dist/components/tooltip/index.js +1 -1
- package/dist/components/tooltip/styled.d.ts +1 -0
- package/dist/components/tooltip/styled.js +1 -1
- package/package.json +1 -1
|
@@ -30,6 +30,7 @@ export declare const AdaptiveButtonTooltip: import("styled-components").IStyledC
|
|
|
30
30
|
align?: import("@/ui/components/tooltip").TooltipAlign | undefined;
|
|
31
31
|
inverted?: boolean | undefined;
|
|
32
32
|
label?: import("react").ReactNode;
|
|
33
|
+
contentWidth?: number | undefined;
|
|
33
34
|
disabled?: boolean | undefined;
|
|
34
35
|
disableHiddenAnimation?: boolean | undefined;
|
|
35
36
|
markdown?: boolean | undefined;
|
|
@@ -4024,6 +4024,7 @@ export declare const SidebarChatTooltip: import("styled-components").IStyledComp
|
|
|
4024
4024
|
align?: import("@/ui/components/tooltip").TooltipAlign | undefined;
|
|
4025
4025
|
inverted?: boolean | undefined;
|
|
4026
4026
|
label?: import("react").ReactNode;
|
|
4027
|
+
contentWidth?: number | undefined;
|
|
4027
4028
|
disabled?: boolean | undefined;
|
|
4028
4029
|
disableHiddenAnimation?: boolean | undefined;
|
|
4029
4030
|
markdown?: boolean | undefined;
|
|
@@ -4525,6 +4526,7 @@ export declare const SidebarChatNameTooltip: import("styled-components").IStyled
|
|
|
4525
4526
|
align?: import("@/ui/components/tooltip").TooltipAlign | undefined;
|
|
4526
4527
|
inverted?: boolean | undefined;
|
|
4527
4528
|
label?: import("react").ReactNode;
|
|
4529
|
+
contentWidth?: number | undefined;
|
|
4528
4530
|
disabled?: boolean | undefined;
|
|
4529
4531
|
disableHiddenAnimation?: boolean | undefined;
|
|
4530
4532
|
markdown?: boolean | undefined;
|
|
@@ -2946,6 +2946,7 @@ export declare const SidebarGroupTooltip: import("styled-components").IStyledCom
|
|
|
2946
2946
|
align?: import("@/ui/components/tooltip").TooltipAlign | undefined;
|
|
2947
2947
|
inverted?: boolean | undefined;
|
|
2948
2948
|
label?: import("react").ReactNode;
|
|
2949
|
+
contentWidth?: number | undefined;
|
|
2949
2950
|
disabled?: boolean | undefined;
|
|
2950
2951
|
disableHiddenAnimation?: boolean | undefined;
|
|
2951
2952
|
markdown?: boolean | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useRef as r,useState as n,useCallback as c,useEffect as o}from"react";import{useTransition as a}from"@react-spring/web";import i from"react-markdown";import{Portal as s}from"../portal/index.js";import{TooltipStyled as l,TooltipBlock as p,TooltipLabel as d,TooltipMarkdown as h,TooltipLabelBold as m,TooltipCode as u}from"./styled.js";export{TooltipColumn,TooltipImage}from"./styled.js";import{TooltipArrow as f}from"./arrow/index.js";import{TooltipProvider as g}from"./context.js";export{TooltipConsumer,TooltipContext,useTooltip}from"./context.js";const b={enter:150,exit:150,leaveDisabledHiddenAnimation:0},w=({className:w,variant:v="primary",placement:x="top",placementX:k=0,placementY:y=-5,align:T="auto",inverted:j=!1,label:$,disabled:
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useRef as r,useState as n,useCallback as c,useEffect as o}from"react";import{useTransition as a}from"@react-spring/web";import i from"react-markdown";import{Portal as s}from"../portal/index.js";import{TooltipStyled as l,TooltipBlock as p,TooltipLabel as d,TooltipMarkdown as h,TooltipLabelBold as m,TooltipCode as u}from"./styled.js";export{TooltipColumn,TooltipImage}from"./styled.js";import{TooltipArrow as f}from"./arrow/index.js";import{TooltipProvider as g}from"./context.js";export{TooltipConsumer,TooltipContext,useTooltip}from"./context.js";const b={enter:150,exit:150,leaveDisabledHiddenAnimation:0},w=({className:w,variant:v="primary",placement:x="top",placementX:k=0,placementY:y=-5,align:T="auto",inverted:j=!1,label:$,contentWidth:E,disabled:C=!1,disableHiddenAnimation:L=!1,markdown:M=!1,children:O,hideOnScroll:Y=!0})=>{const A=r(null),[B,H]=n(),[N,R]=n([0,0]),W=!$||C,X=c(()=>{const e=A.current;if(null===e)return[0,0];const t=B;if(!(t instanceof Element))return[0,0];const{width:r,height:n}=e.getBoundingClientRect(),c=t.getBoundingClientRect(),{width:o}=c,a=c.left+window.scrollX,i=c.top+window.scrollY,s=c.bottom+window.scrollY;let l=0;switch(x){case"top-left":switch(T){case"left":case"auto":l=a;break;case"center":l=a-r/2;break;case"right":l=a-r}break;case"top":switch(T){case"left":l=a+o/2;break;case"center":case"auto":l=a+o/2-r/2;break;case"right":l=a+o/2-r}break;case"top-right":switch(T){case"left":l=a+o;break;case"center":l=a+o-r/2;break;case"right":case"auto":l=a+o-r}break;case"center-right":l=a+o-18;break;case"center-left":l=a-r+18}let p=0;switch(x){case"top-left":case"top":case"top-right":p=j?s+6:i-n-6;break;case"center-right":case"center-left":p=(i+s-n+10)/2;break;default:p=s+6}return[l,p]},[x,T,B]),D=c(()=>{B&&R(X())},[B,X]),I=c(()=>{H(null)},[]),P=[`${N[1]}px`];0!==y&&P.push(`calc(var(--bothub-scale, 1) * ${y}px)`);const S=[`${N[0]}px`];switch(x){case"top-left":switch(T){case"center":S.push("14.5px");break;case"right":S.push("29px")}break;case"top":switch(T){case"left":S.push("-14.5px");break;case"right":S.push("14.5px")}break;case"top-right":switch(T){case"left":S.push("-29px");break;case"center":S.push("-14.5px")}}0!==k&&S.push(`calc(var(--bothub-scale, 1) * ${k}px)`);const q=a(!!B,{from:{opacity:0,y:-6},enter:{opacity:1,y:0},leave:{opacity:0,y:-6,transition:{duration:L?0:.3}},config:{duration:b.enter}})((r,n)=>n&&e(l,{$placement:x,$align:T,$inverted:j,ref:A,className:w,style:Object.assign(Object.assign({},r),{top:P.length<=1?P[0]:`calc(${P.join(" + ")})`,left:S.length<=1?S[0]:`calc(${S.join(" + ")})`}),children:[j&&t(f,{placement:x,variant:v,inverted:j}),e(p,{$contentWidth:E,$variant:v,children:["string"==typeof $&&!M&&e(d,{children:[$.slice(0,272),$.length>272&&"..."]}),"string"==typeof $&&M&&t(h,{children:t(i,{components:{p:({children:e})=>t(d,{component:"p",children:e}),b:({children:e})=>t(m,{children:e}),strong:({children:e})=>t(m,{component:"strong",children:e}),code:({children:e})=>t(u,{children:e})},children:$})}),"string"!=typeof $&&$]}),!j&&t(f,{placement:x,variant:v,inverted:j})]}));o(()=>{D()},[B,D]);const z=c(e=>{!W&&e.currentTarget instanceof Element&&(H(e.currentTarget),D())},[W,D]);return o(()=>{const e=()=>{I()},t=()=>{I()};return window.addEventListener("mouseleave",e),window.addEventListener("scroll",t,Y),()=>{window.removeEventListener("mouseleave",e),window.removeEventListener("scroll",t,Y)}},[I]),e(g,{handleTooltipMouseEnter:e=>{!W&&e.currentTarget instanceof Element&&H(e.currentTarget)},handleTooltipMouseLeave:()=>{H(null)},handleTooltipPointerMove:z,children:[t(s,{children:q}),O]})};export{w as Tooltip,b as TooltipAnimationDuration,p as TooltipBlock,u as TooltipCode,d as TooltipLabel,m as TooltipLabelBold,h as TooltipMarkdown,g as TooltipProvider,l as TooltipStyled};
|
|
@@ -1142,6 +1142,7 @@ export declare const TooltipStyled: import("styled-components").IStyledComponent
|
|
|
1142
1142
|
}, TooltipStyledProps>>;
|
|
1143
1143
|
export interface TooltipBlockProps {
|
|
1144
1144
|
$variant: TooltipVariant;
|
|
1145
|
+
$contentWidth?: number;
|
|
1145
1146
|
}
|
|
1146
1147
|
export declare const TooltipBlock: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, TooltipBlockProps>>;
|
|
1147
1148
|
export declare const TooltipLabel: import("styled-components").IStyledComponent<"web", {
|
|
@@ -28,4 +28,4 @@ import{styled as e,css as t}from"styled-components";import{animated as i}from"@r
|
|
|
28
28
|
align-items: center;
|
|
29
29
|
`;case"top-right":return t`
|
|
30
30
|
align-items: flex-end;
|
|
31
|
-
`}}),a=e.span.withConfig({displayName:"styled__TooltipBlock",componentId:"sc-1kd2o9y-1"})(["display:inline-flex;width:max-content;max-width:
|
|
31
|
+
`}}),a=e.span.withConfig({displayName:"styled__TooltipBlock",componentId:"sc-1kd2o9y-1"})(["display:inline-flex;width:max-content;max-width:","px;padding:8px;background:",";overflow:hidden;border-radius:6px;box-sizing:border-box;"],({$contentWidth:e})=>null!=e?e:260,({theme:e,$variant:t})=>{switch(t){case"primary":return e.colors.grayScale.gray2;case"secondary":return e.colors.grayScale.gray3}}),l=e(o).attrs({variant:"body-s-medium"}).withConfig({displayName:"styled__TooltipLabel",componentId:"sc-1kd2o9y-2"})(["white-space:pre-wrap;"]),s=e.div.withConfig({displayName:"styled__TooltipMarkdown",componentId:"sc-1kd2o9y-3"})(["display:flex;flex-direction:column;align-items:flex-start;"]),d=e(o).attrs({variant:"body-s-semibold"}).withConfig({displayName:"styled__TooltipLabelBold",componentId:"sc-1kd2o9y-4"})([""]),c=e(o).attrs({component:"code",variant:"body-s-medium"}).withConfig({displayName:"styled__TooltipCode",componentId:"sc-1kd2o9y-5"})(["display:inline-flex;border-radius:4px;background:",";"],({theme:e})=>e.colors.grayScale.gray3),p=e.div.withConfig({displayName:"styled__TooltipColumn",componentId:"sc-1kd2o9y-6"})(["display:inline-flex;flex-direction:column;align-items:center;gap:8px;"]),m=e(n).withConfig({displayName:"styled__TooltipImage",componentId:"sc-1kd2o9y-7"})(["border-radius:4px;"]);export{a as TooltipBlock,c as TooltipCode,p as TooltipColumn,m as TooltipImage,l as TooltipLabel,d as TooltipLabelBold,s as TooltipMarkdown,r as TooltipStyled};
|