@bothub-chat/ui 2.56.0-feat-prompt-queue-6270b68c-11d2-44c2-ada8-cee8162c9ffa → 2.56.0-fix-samples-13eaf587-1366-4c59-86bd-527f85445d94

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{__rest as r}from"tslib";import{jsxs as t,jsx as e}from"react/jsx-runtime";import{useId as o,useRef as i,useState as l,useCallback as c}from"react";import{MessageVoiceStyled as a,MessageVoiceAudio as n,MessageVoiceMain as s,MessageVoiceToggleButton as d,MessageVoicePauseIcon as m,MessageVoicePlayIcon as h,MessageVoiceWaves as p,StyledRect as u,MessageVoiceDurationText as g,MessageVoiceToggleTextButton as f,MessageVoiceHideTextIcon as y,MessageVoiceShowTextIcon as b,MessageVoiceText as w}from"./styled.js";import{IconProvider as j}from"../../icon/context.js";import"../../icon/styled.js";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"unified";import"remark-parse";import"remark-gfm";import"mdast-util-to-markdown";import{isBright as k}from"../../../utils/colors/isBright.js";import"../../../utils/colors/calculateGrayScale.js";import"../../../utils/colors/calculateAccentColors.js";import{formatSeconds as x}from"../../../utils/formatSeconds.js";import{useMessage as C}from"../context.js";import{useTheme as v}from"../../../theme/hook.js";const P=P=>{var{height:T=36,src:$,waveData:A,duration:D,tabIndex:L=0,disableTranscription:S,variant:B="message",children:I}=P,F=r(P,["height","src","waveData","duration","tabIndex","disableTranscription","variant","children"]);const O=v(),_=o(),{color:z}=C(),E=i(null),G=i(null),[M,R]=l(!0),[U,X]=l(!1),[q,H]=l(!1),[J,K]=l(null),N=c(()=>{const r=E.current;r&&(U?r.pause():r.play())},[U,E.current]),Q=c(()=>{const r=E.current;r&&K(r.currentTime)},[E.current]),V=c(r=>{r.stopPropagation();const t=E.current,e=G.current;if(!t||!e)return;const o=e.getBoundingClientRect(),{width:i}=o,l=(r.clientX-o.left)/i*D;t.play(),t.currentTime=l},[E.current,D]),W=c(()=>{K(null)},[]),Y=c(r=>{r.stopPropagation(),H(!q)},[q]);return t(a,Object.assign({},F,{children:[e(n,{ref:E,src:$,onPlay:X.bind(null,!0),onPause:X.bind(null,!1),onCanPlayThrough:R.bind(null,!1),onTimeUpdate:Q,onEnded:W}),t(s,{$loading:M,tabIndex:L,children:[e(d,{onClick:N,children:e(j,Object.assign({},"message"===B&&("standard"!==O.scheme?{fill:O.colors.grayScale.gray4}:{fill:"dark"===O.mode?O.default.colors.base.white:O.default.colors.accent.primary}),"input"===B&&"default"===z&&{fill:"standard"===O.scheme?"#A4C1FA":k(O.colors.grayScale.gray4)?O.colors.accent.strongDown:O.colors.accent.primary},"input"===B&&{size:22},{children:e(U?m:h,{})}))}),t(p,{ref:G,width:"145",height:T,viewBox:`0 0 145 ${T}`,fill:"none",onClick:V,children:[t("g",{clipPath:`url(#${_}_clip)`,children:[e("rect",{width:"145",height:T,fill:"default"===z?"standard"===O.scheme?"#A4C1FA":O.bright||"custom"===O.scheme&&k(O.colors.custom.message.user.background)?O.colors.accent.strongDown:O.colors.accent.primaryLight:O.default.colors.base.white}),null!==J&&e(u,{height:T,fill:"dark"===O.mode?O.default.colors.base.white:O.colors.accent.primaryLight,style:{width:J/D*145}})]}),e("defs",{children:e("clipPath",{id:`${_}_clip`,children:A.map((r,t)=>{const o=Math.max(r/100*36,2);return e("rect",{x:5*t,y:(T-o)/2,width:"3",height:o,rx:"1.5"},t)})})})]}),t(g,{$variant:B,children:[null!==J&&x(J),null===J&&x(D)]}),!S&&e(f,{onClick:Y,children:e(j,{fill:"standard"===O.scheme?"dark"===O.mode?O.colors.accent.primary:O.colors.accent.primaryLight:O.bright?O.colors.accent.strongDown:O.colors.accent.primaryLight,stroke:"standard"===O.scheme?O.default.colors.base.white:O.default.colors.base.black,children:e(q?y:b,{})})})]}),!S&&q&&I&&e(w,{$messageColor:z,children:I})]}))};export{P as MessageVoice};
1
+ import{__rest as t}from"tslib";import{jsxs as r,jsx as e}from"react/jsx-runtime";import{useId as o,useRef as i,useState as n,useEffect as c,useCallback as a}from"react";import{MessageVoiceStyled as l,MessageVoiceAudio as s,MessageVoiceMain as d,MessageVoiceToggleButton as m,MessageVoicePauseIcon as u,MessageVoicePlayIcon as p,MessageVoiceWaves as h,StyledRect as g,MessageVoiceDurationText as f,MessageVoiceToggleTextButton as w,MessageVoiceHideTextIcon as y,MessageVoiceShowTextIcon as b,MessageVoiceText as j}from"./styled.js";import{IconProvider as k}from"../../icon/context.js";import"../../icon/styled.js";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"unified";import"remark-parse";import"remark-gfm";import"mdast-util-to-markdown";import{isBright as x}from"../../../utils/colors/isBright.js";import"../../../utils/colors/calculateGrayScale.js";import"../../../utils/colors/calculateAccentColors.js";import{formatSeconds as v}from"../../../utils/formatSeconds.js";import{useMessage as C}from"../context.js";import{useTheme as P}from"../../../theme/hook.js";const L="messageVoicePlay",T=T=>{var{height:$=36,src:A,waveData:D,duration:E,tabIndex:S=0,disableTranscription:B,variant:I="message",children:F}=T,O=t(T,["height","src","waveData","duration","tabIndex","disableTranscription","variant","children"]);const _=P(),z=o(),{color:G}=C(),M=i(null),R=i(null),[U,V]=n(!0),[X,q]=n(!1),[H,J]=n(!1),[K,N]=n(null);c(()=>{const t=t=>{const r=M.current,e=t.detail.audio;r&&e!==r&&!r.paused&&r.pause()};return window.addEventListener(L,t),()=>{window.removeEventListener(L,t)}},[]);const Q=a(()=>{const t=new CustomEvent(L,{detail:{audio:M.current}});window.dispatchEvent(t),q(!0)},[]),W=a(()=>{const t=M.current;t&&(X?t.pause():t.play())},[X,M.current]),Y=a(()=>{const t=M.current;t&&N(t.currentTime)},[M.current]),Z=a(t=>{t.stopPropagation();const r=M.current,e=R.current;if(!r||!e)return;const o=e.getBoundingClientRect(),{width:i}=o,n=(t.clientX-o.left)/i*E;r.play(),r.currentTime=n},[M.current,E]),tt=a(()=>{N(null)},[]),rt=a(t=>{t.stopPropagation(),J(!H)},[H]);return r(l,Object.assign({},O,{children:[e(s,{ref:M,src:A,onPlay:Q,onPause:q.bind(null,!1),onCanPlayThrough:V.bind(null,!1),onTimeUpdate:Y,onEnded:tt}),r(d,{$loading:U,tabIndex:S,children:[e(m,{onClick:W,children:e(k,Object.assign({},"message"===I&&("standard"!==_.scheme?{fill:_.colors.grayScale.gray4}:{fill:"dark"===_.mode?_.default.colors.base.white:_.default.colors.accent.primary}),"input"===I&&"default"===G&&{fill:"standard"===_.scheme?"#A4C1FA":x(_.colors.grayScale.gray4)?_.colors.accent.strongDown:_.colors.accent.primary},"input"===I&&{size:22},{children:e(X?u:p,{})}))}),r(h,{ref:R,width:"145",height:$,viewBox:`0 0 145 ${$}`,fill:"none",onClick:Z,children:[r("g",{clipPath:`url(#${z}_clip)`,children:[e("rect",{width:"145",height:$,fill:"default"===G?"standard"===_.scheme?"#A4C1FA":_.bright||"custom"===_.scheme&&x(_.colors.custom.message.user.background)?_.colors.accent.strongDown:_.colors.accent.primaryLight:_.default.colors.base.white}),null!==K&&e(g,{height:$,fill:"dark"===_.mode?_.default.colors.base.white:_.colors.accent.primaryLight,style:{width:K/E*145}})]}),e("defs",{children:e("clipPath",{id:`${z}_clip`,children:D.map((t,r)=>{const o=Math.max(t/100*36,2);return e("rect",{x:5*r,y:($-o)/2,width:"3",height:o,rx:"1.5"},r)})})})]}),r(f,{$variant:I,children:[null!==K&&v(K),null===K&&v(E)]}),!B&&e(w,{onClick:rt,children:e(k,{fill:"standard"===_.scheme?"dark"===_.mode?_.colors.accent.primary:_.colors.accent.primaryLight:_.bright?_.colors.accent.strongDown:_.colors.accent.primaryLight,stroke:"standard"===_.scheme?_.default.colors.base.white:_.default.colors.base.black,children:e(H?y:b,{})})})]}),!B&&H&&F&&e(j,{$messageColor:G,children:F})]}))};export{T as MessageVoice};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bothub-chat/ui",
3
- "version": "2.56.0-feat-prompt-queue-6270b68c-11d2-44c2-ada8-cee8162c9ffa",
3
+ "version": "2.56.0-fix-samples-13eaf587-1366-4c59-86bd-527f85445d94",
4
4
  "description": "Bothub UI Components",
5
5
  "keywords": [
6
6
  "bot",