@bothub-chat/ui 2.54.3 → 2.55.0

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.
@@ -1 +1 @@
1
- import{jsx as r,jsxs as e}from"react/jsx-runtime";import{forwardRef as l,useRef as t,useCallback as o,useImperativeHandle as s}from"react";import{MessagesStyled as c,MessagesScrollbarWrapper as n,MessagesContent as i,MessagesContainer as d,MessagesStart as u,MessageList as m}from"./styled.js";import{MessagesProvider as a,MessagesScrollProvider as f}from"./context.js";export{MessagesContext,MessagesScrollContext,useMessages,useScrollbarRef}from"./context.js";import{ScrollButton as h}from"../scroll-button/index.js";const S=l(({scrollButton:l=!1,fullWidth:S=!1,className:x,startRef:p,scrollShadows:v,children:b},j)=>{const R=t(null),g=o(r=>{var e;return null===(e=R.current)||void 0===e?void 0:e.setScroll(null!=r?r:{side:"bottom"})},[R.current]);return s(j,()=>{var r,e;return{element:null!==(e=null===(r=R.current)||void 0===r?void 0:r.element)&&void 0!==e?e:null,setScroll:g}},[g,R.current]),r(a,{setScroll:g,children:e(c,{className:x,children:[r(n,{ref:R,scrollShadows:v,withStickyBottom:!0,defaultStickyBottom:!0,children:r(i,{children:e(d,{$fullWidth:S,children:[r(u,{ref:p}),r(f,{scrollbarRef:R,children:r(m,{children:b})})]})})}),l&&r(h,{scrollbarRef:R})]})})});export{S as Messages,a as MessagesProvider,f as MessagesScrollProvider};
1
+ import{jsx as r,jsxs as e}from"react/jsx-runtime";import{forwardRef as l,useRef as t,useCallback as o,useImperativeHandle as s}from"react";import{MessagesStyled as c,MessagesScrollbarWrapper as n,MessagesContent as i,MessagesContainer as d,MessageList as u,MessagesStart as m}from"./styled.js";import{MessagesProvider as a,MessagesScrollProvider as f}from"./context.js";export{MessagesContext,MessagesScrollContext,useMessages,useScrollbarRef}from"./context.js";import{ScrollButton as h}from"../scroll-button/index.js";const S=l(({scrollButton:l=!1,fullWidth:S=!1,className:x,startRef:p,scrollShadows:v,children:b},j)=>{const R=t(null),g=o(r=>{var e;return null===(e=R.current)||void 0===e?void 0:e.setScroll(null!=r?r:{side:"bottom"})},[R.current]);return s(j,()=>{var r,e;return{element:null!==(e=null===(r=R.current)||void 0===r?void 0:r.element)&&void 0!==e?e:null,setScroll:g}},[g,R.current]),r(a,{setScroll:g,children:e(c,{className:x,children:[r(n,{ref:R,scrollShadows:v,withStickyBottom:!0,defaultStickyBottom:!0,children:r(i,{children:e(d,{$fullWidth:S,children:[r(f,{scrollbarRef:R,children:r(u,{children:b})}),r(m,{ref:p})]})})}),l&&r(h,{scrollbarRef:R})]})})});export{S as Messages,a as MessagesProvider,f as MessagesScrollProvider};
@@ -1,10 +1,10 @@
1
- import{styled as t,css as e}from"styled-components";import{Scrollbar as i}from"../../scrollbar/index.js";import{adaptive as d}from"../../../adaptive/index.js";const o=t.div.withConfig({displayName:"styled__MessagesStyled",componentId:"sc-z7wbcu-0"})(["display:flex;position:relative;width:100%;"]),n=t(i).attrs({variant:"secondary"}).withConfig({displayName:"styled__MessagesScrollbarWrapper",componentId:"sc-z7wbcu-1"})(["overflow:auto;height:100%;",""],d({variant:"dashboard",desktop:e`
1
+ import{styled as e,css as t}from"styled-components";import{Scrollbar as i}from"../../scrollbar/index.js";import{adaptive as d}from"../../../adaptive/index.js";const o=e.div.withConfig({displayName:"styled__MessagesStyled",componentId:"sc-z7wbcu-0"})(["display:flex;position:relative;width:100%;"]),s=e(i).attrs({variant:"secondary"}).withConfig({displayName:"styled__MessagesScrollbarWrapper",componentId:"sc-z7wbcu-1"})(["overflow:auto;height:100%;",""],d({variant:"dashboard",desktop:t`
2
2
  padding: 43px 34px;
3
3
  padding-bottom: 106px;
4
- `,tablet:e`
4
+ `,tablet:t`
5
5
  padding: 43px 24px;
6
6
  padding-bottom: 106px;
7
- `,mobile:e`
7
+ `,mobile:t`
8
8
  padding: 24px 16px;
9
9
  padding-bottom: 78px;
10
- `})),s=t.div.withConfig({displayName:"styled__MessagesContent",componentId:"sc-z7wbcu-2"})(["display:flex;width:inherit;justify-content:center;"]),a=t.div.withConfig({displayName:"styled__MessagesContainer",componentId:"sc-z7wbcu-3"})(["display:flex;flex-direction:column;width:inherit;max-width:",";"],({theme:t,$fullWidth:e})=>e?"none":t.dashboard.chat.containerWidth),p=t.div.withConfig({displayName:"styled__MessagesStart",componentId:"sc-z7wbcu-4"})(["display:flex;width:100%;height:1px;pointer-events:none;"]),l=t.div.withConfig({displayName:"styled__MessageList",componentId:"sc-z7wbcu-5"})(["display:flex;flex-direction:column;width:inherit;row-gap:24px;"]);export{l as MessageList,a as MessagesContainer,s as MessagesContent,n as MessagesScrollbarWrapper,p as MessagesStart,o as MessagesStyled};
10
+ `})),n=e.div.withConfig({displayName:"styled__MessagesContent",componentId:"sc-z7wbcu-2"})(["display:flex;width:inherit;justify-content:center;"]),a=e.div.withConfig({displayName:"styled__MessagesContainer",componentId:"sc-z7wbcu-3"})(["display:flex;flex-direction:column-reverse;width:inherit;max-width:",";"],({theme:e,$fullWidth:t})=>t?"none":e.dashboard.chat.containerWidth),p=e.div.withConfig({displayName:"styled__MessagesStart",componentId:"sc-z7wbcu-4"})(["display:flex;width:100%;height:1px;pointer-events:none;"]),l=e.div.withConfig({displayName:"styled__MessageList",componentId:"sc-z7wbcu-5"})(["display:flex;flex-direction:column;width:inherit;row-gap:24px;"]);export{l as MessageList,a as MessagesContainer,n as MessagesContent,s as MessagesScrollbarWrapper,p as MessagesStart,o as MessagesStyled};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as t}from"react/jsx-runtime";import{forwardRef as r,useRef as o,useState as l,useCallback as s,useEffect as n,useImperativeHandle as i}from"react";import{ScrollbarContent as c,ScrollbarStyled as a,ScrollbarShadows as d}from"./styled.js";import{ScrollbarProvider as u}from"./context.js";export{ScrollbarContext,useScrollbar}from"./context.js";import"tslib";import"@react-spring/web";import"./shadow/styled.js";import"../../theme/index.js";export{ScrollbarStyle}from"./style/styled.js";const m=r(({className:r,scrollbarClassName:m,variant:h="primary",size:p=6,scrollShadows:v,scrollLocked:w,overflow:f="auto",disabled:b=!1,disableShadows:S=!1,children:T,onScroll:g,defaultStickyBottom:L=!1,withStickyBottom:x=!1,isHorizontalScrollbar:y=!1},z)=>{var j;const H=o(null),[E,M]=l(!1),[$,B]=l(!1),[N,k]=l(!1),[C,O]=l(!1),R=!!v,W=!!w,[D,Y]=l(L),[q,A]=l(0),F=null!==(j=null==v?void 0:v.size)&&void 0!==j?j:60,G=s(e=>{const{scrollTop:t,scrollHeight:r,clientHeight:o,scrollLeft:l,scrollWidth:s,clientWidth:n}=e,i=F>o,c=F>n,a=!i&&0!==t,d=!i&&Math.round(t)+1<r-o;k(a),O(d),M(!c&&0!==l),B(!c&&Math.round(l)+1<s-n);const u=q>e.scrollTop;if(A(e.scrollTop),x){const t=e.clientHeight-Math.ceil(e.scrollHeight-e.scrollTop);Math.abs(t)<20&&!u?Y(!0):u&&Y(!1)}b&&e.scrollTo(0,0),null==g||g({isTop:a,isBottom:d})},[H.current,b,q,x,F,g]);n(()=>{if(!y)return;const e=e=>{H.current&&(e.preventDefault(),H.current.scrollLeft+=e.deltaY)},t=H.current;return t&&t.addEventListener("wheel",e,{passive:!0}),()=>{t&&t.removeEventListener("wheel",e)}},[y,H.current]);const I=s(e=>{var t;const r=H.current;if(null!==r&&(W||void 0!==e)&&null!==r){const{side:o}=null!==(t=null!=e?e:w)&&void 0!==t?t:{side:"bottom"};if("bottom"===o)r.scrollTop=r.scrollHeight}},[W,w]);i(z,()=>({element:H.current,setScroll:I}),[H.current,I]),n(()=>{I()},[T,I]),n(()=>{const e=H.current;if(null===e)return;G(e);let t=window.setTimeout(()=>{G(e)},500),r=null;D&&(r=new MutationObserver(()=>{G(e),D&&!W&&(e.scrollTop=e.scrollHeight)}),r.observe(e,{childList:!0,subtree:!0}));const o=()=>{window.clearTimeout(t),G(e),t=window.setTimeout(()=>{G(e)},500)};window.addEventListener("resize",o);let l=null;return H.current&&(l=new ResizeObserver(e=>{e.forEach(e=>{G(e.target)})}),l.observe(H.current)),()=>{clearTimeout(t),null==r||r.disconnect(),window.removeEventListener("resize",o),null==l||l.disconnect()}},[H.current,G,D]);const J=e(c,{$variant:h,$size:p,$disabled:b,$overflow:f,ref:H,className:r,onScroll:()=>{H.current&&G(H.current)},children:T});return R?e(u,{scrollbarSize:p,scrollShadows:v,setScroll:I,disabled:b,isLeft:E,isRight:$,isTop:N,isBottom:C,children:t(a,{$overflow:f,className:m,children:[J,!S&&t(d,{children:[v.left,v.right,v.top,v.bottom]})]})}):J});export{m as Scrollbar,c as ScrollbarContent,u as ScrollbarProvider,d as ScrollbarShadows,a as ScrollbarStyled};
1
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import{forwardRef as r,useRef as o,useState as l,useCallback as s,useEffect as n,useImperativeHandle as i}from"react";import{ScrollbarContent as c,ScrollbarStyled as a,ScrollbarShadows as d}from"./styled.js";import{ScrollbarProvider as u}from"./context.js";export{ScrollbarContext,useScrollbar}from"./context.js";import"tslib";import"@react-spring/web";import"./shadow/styled.js";import"../../theme/index.js";export{ScrollbarStyle}from"./style/styled.js";const m=r(({className:r,scrollbarClassName:m,variant:h="primary",size:p=6,scrollShadows:v,scrollLocked:w,overflow:f="auto",disabled:b=!1,disableShadows:S=!1,children:T,onScroll:g,defaultStickyBottom:L=!1,withStickyBottom:x=!1,isHorizontalScrollbar:y=!1},z)=>{var j;const H=o(null),[E,M]=l(!1),[$,B]=l(!1),[N,k]=l(!1),[C,O]=l(!1),R=!!v,W=!!w,[D,Y]=l(L),[q,A]=l(0),F=null!==(j=null==v?void 0:v.size)&&void 0!==j?j:60,G=s(e=>{const{scrollTop:t,scrollHeight:r,clientHeight:o,scrollLeft:l,scrollWidth:s,clientWidth:n}=e,i=F>o,c=F>n,a=!i&&0!==t,d=!i&&Math.round(t)+1<r-o;k(a),O(d),M(!c&&0!==l),B(!c&&Math.round(l)+1<s-n);const u=q>e.scrollTop;if(A(e.scrollTop),x){const t=e.clientHeight-Math.ceil(e.scrollHeight-e.scrollTop);Math.abs(t)<20&&!u?Y(!0):u&&Y(!1)}b&&e.scrollTo(0,0),null==g||g({isTop:a,isBottom:d})},[H.current,b,q,x,F,g]);n(()=>{if(!y)return;const e=e=>{H.current&&(e.preventDefault(),H.current.scrollLeft+=e.deltaY)},t=H.current;return t&&t.addEventListener("wheel",e,{passive:!0}),()=>{t&&t.removeEventListener("wheel",e)}},[y,H.current]);const I=s(e=>{var t;const r=H.current;if(null!==r&&(W||void 0!==e)&&null!==r){const{side:o}=null!==(t=null!=e?e:w)&&void 0!==t?t:{side:"bottom"};if("bottom"===o)r.scrollTop=r.scrollHeight}},[W,w]);i(z,()=>({element:H.current,setScroll:I}),[H.current,I]),n(()=>{const e=H.current;if(null===e)return;G(e);let t=window.setTimeout(()=>{G(e)},500),r=null;D&&(r=new MutationObserver(()=>{G(e),D&&!W&&(e.scrollTop=e.scrollHeight)}),r.observe(e,{childList:!0,subtree:!0}));const o=()=>{window.clearTimeout(t),G(e),t=window.setTimeout(()=>{G(e)},500)};window.addEventListener("resize",o);let l=null;return H.current&&(l=new ResizeObserver(e=>{e.forEach(e=>{G(e.target)})}),l.observe(H.current)),()=>{clearTimeout(t),null==r||r.disconnect(),window.removeEventListener("resize",o),null==l||l.disconnect()}},[H.current,G,D]);const J=e(c,{$variant:h,$size:p,$disabled:b,$overflow:f,ref:H,className:r,onScroll:()=>{H.current&&G(H.current)},children:T});return R?e(u,{scrollbarSize:p,scrollShadows:v,setScroll:I,disabled:b,isLeft:E,isRight:$,isTop:N,isBottom:C,children:t(a,{$overflow:f,className:m,children:[J,!S&&t(d,{children:[v.left,v.right,v.top,v.bottom]})]})}):J});export{m as Scrollbar,c as ScrollbarContent,u as ScrollbarProvider,d as ScrollbarShadows,a as ScrollbarStyled};
package/package.json CHANGED
@@ -1,71 +1,71 @@
1
- {
2
- "name": "@bothub-chat/ui",
3
- "version": "2.54.3",
4
- "description": "Bothub UI Components",
5
- "keywords": [
6
- "bot",
7
- "chat",
8
- "chatgpt",
9
- "ai",
10
- "react"
11
- ],
12
- "repository": {
13
- "url": "https://github.com/bothubchat/bothub.git",
14
- "type": "git",
15
- "directory": "./packages/ui"
16
- },
17
- "publishConfig": {
18
- "access": "public",
19
- "registry": "https://registry.npmjs.org/"
20
- },
21
- "author": "dev2alert <atmpotn@yandex.ru>",
22
- "license": "MIT",
23
- "homepage": "https://bothub.chat",
24
- "files": [
25
- "./dist",
26
- "./fonts"
27
- ],
28
- "type": "module",
29
- "main": "./dist/index.js",
30
- "module": "./dist/index.js",
31
- "types": "./dist/index.d.ts",
32
- "exports": {
33
- ".": {
34
- "types": "./dist/index.d.ts",
35
- "import": "./dist/index.js",
36
- "default": "./dist/index.js"
37
- },
38
- "./components/*": "./dist/components/*",
39
- "./fonts/*": "./fonts/*",
40
- "./utils/*": "./dist/utils/*"
41
- },
42
- "sideEffects": false,
43
- "resolutions": {
44
- "react-helmet/react": "^19.0.0"
45
- },
46
- "peerDependencies": {
47
- "@uidotdev/usehooks": "^2.4.1",
48
- "react": "19.1.1",
49
- "react-dom": "19.1.1",
50
- "react-helmet": ">=2",
51
- "styled-components": "^6.0.7"
52
- },
53
- "dependencies": {
54
- "@dnd-kit/core": "^6.1.0",
55
- "@floating-ui/react": "^0.26.16",
56
- "@floating-ui/react-dom": "^2.1.0",
57
- "@react-spring/web": "^10",
58
- "date-fns": "^3.6.0",
59
- "highlight.js": "^11.11.0",
60
- "katex": "^0.16.10",
61
- "marked": "^16.2.1",
62
- "normalize.css": "^8.0.1",
63
- "rc-slider": "^11.1.8",
64
- "react-markdown": "^10.0.0",
65
- "rehype-katex": "^7.0.0",
66
- "remark-gfm": "^4.0.1",
67
- "remark-math": "^6.0.0",
68
- "tslib": "^2.6.2",
69
- "unist-util-visit": "^5.0.0"
70
- }
71
- }
1
+ {
2
+ "name": "@bothub-chat/ui",
3
+ "version": "2.55.0",
4
+ "description": "Bothub UI Components",
5
+ "keywords": [
6
+ "bot",
7
+ "chat",
8
+ "chatgpt",
9
+ "ai",
10
+ "react"
11
+ ],
12
+ "repository": {
13
+ "url": "https://github.com/bothubchat/bothub.git",
14
+ "type": "git",
15
+ "directory": "./packages/ui"
16
+ },
17
+ "publishConfig": {
18
+ "access": "public",
19
+ "registry": "https://registry.npmjs.org/"
20
+ },
21
+ "author": "dev2alert <atmpotn@yandex.ru>",
22
+ "license": "MIT",
23
+ "homepage": "https://bothub.chat",
24
+ "files": [
25
+ "./dist",
26
+ "./fonts"
27
+ ],
28
+ "type": "module",
29
+ "main": "./dist/index.js",
30
+ "module": "./dist/index.js",
31
+ "types": "./dist/index.d.ts",
32
+ "exports": {
33
+ ".": {
34
+ "types": "./dist/index.d.ts",
35
+ "import": "./dist/index.js",
36
+ "default": "./dist/index.js"
37
+ },
38
+ "./components/*": "./dist/components/*",
39
+ "./fonts/*": "./fonts/*",
40
+ "./utils/*": "./dist/utils/*"
41
+ },
42
+ "sideEffects": false,
43
+ "resolutions": {
44
+ "react-helmet/react": "^19.0.0"
45
+ },
46
+ "peerDependencies": {
47
+ "@uidotdev/usehooks": "^2.4.1",
48
+ "react": "19.1.1",
49
+ "react-dom": "19.1.1",
50
+ "react-helmet": ">=2",
51
+ "styled-components": "^6.0.7"
52
+ },
53
+ "dependencies": {
54
+ "@dnd-kit/core": "^6.1.0",
55
+ "@floating-ui/react": "^0.26.16",
56
+ "@floating-ui/react-dom": "^2.1.0",
57
+ "@react-spring/web": "^10",
58
+ "date-fns": "^3.6.0",
59
+ "highlight.js": "^11.11.0",
60
+ "katex": "^0.16.10",
61
+ "marked": "^16.2.1",
62
+ "normalize.css": "^8.0.1",
63
+ "rc-slider": "^11.1.8",
64
+ "react-markdown": "^10.0.0",
65
+ "rehype-katex": "^7.0.0",
66
+ "remark-gfm": "^4.0.1",
67
+ "remark-math": "^6.0.0",
68
+ "tslib": "^2.6.2",
69
+ "unist-util-visit": "^5.0.0"
70
+ }
71
+ }