@zenpatient-org/healthspan-marketing-ui 1.0.21 → 1.0.22

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
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),l=require("react"),r=require("../../components/ChatMessage/chatMessage.module.css"),C=require("../Typography/Typography.cjs.js"),Q="(prefers-reduced-motion: reduce)",z=[900,1150],le=180,ce=130,de=140,ue=36,he=220,me=new Set("th he in er an re on at en nd ou ea ha to it is or ti as te ng of al ar st se le ve me yo wh ch ll".split(" ")),fe=o=>{const n=window.matchMedia(Q);return n.addEventListener("change",o),()=>n.removeEventListener("change",o)},pe=()=>window.matchMedia(Q).matches,ge=o=>{let n=Array.from(o).reduce((e,s)=>Math.imul(e^s.charCodeAt(0),16777619),2166136261);return()=>{n=n+1831565813|0;let e=Math.imul(n^n>>>15,1|n);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}},Se=(o,n)=>{const e=ge(n),s=(u,m)=>u+e()*(m-u);let T=0,d=0;return o.split("").map((u,m)=>{var c;const f=(c=o[m-1])!=null?c:"";let a;return m===0?a=0:/[.?!…]/.test(f)?a=s(180,260):/[,;:—]/.test(f)?a=s(120,180):u===" "?a=s(20,35):d>0?(d--,a=s(22,32)):me.has((f+u).toLowerCase())?a=s(24,36):e()<.15?(d=2+Math.floor(e()*3),a=s(22,32)):a=s(35,60),f===" "&&e()<.08&&(a+=s(60,110)),T+=a})},ve=o=>{const n=o.querySelector("p"),e=n.firstChild,s=e.textContent,T=n.getBoundingClientRect().left,d=getComputedStyle(o),u=parseFloat(d.paddingLeft)+parseFloat(d.paddingRight),m=document.createRange(),f=[0],a=[];let c,x=0;for(let h=0;h<s.length;h++){if(!/\s/.test(s[h])){m.setStart(e,h),m.setEnd(e,h+1);const y=m.getBoundingClientRect();c!==void 0&&y.top>c+1&&f.push(h),c=y.top,x=Math.max(x,y.right-T)}a.push(x)}return a[a.length-1]=o.getBoundingClientRect().width-u,{lineStarts:f,widths:a,lineHeight:parseFloat(getComputedStyle(n).lineHeight),padX:u,padY:parseFloat(d.paddingTop)+parseFloat(d.paddingBottom)}},J=(o,n)=>o.filter((e,s)=>s===0||e<n),xe=({sender:o,avatar:n,children:e,typing:s=!1,attachment:T,thinking:d,typeOut:u=!1,seed:m,onTyped:f})=>{var O,V;const a=l.useSyncExternalStore(fe,pe,()=>!1),[c,x]=l.useState(),[h,y]=l.useState(!1),[j,W]=l.useState(0),[L,Z]=l.useState(!1),[w,k]=l.useState(!u),[ee,H]=l.useState(!u),[p,te]=l.useState(),[$,se]=l.useState(0),[ae,ne]=l.useState(!1),R=l.useRef(null),P=l.useRef(null);d!=null&&d.length?(d!==c&&x(d),h&&y(!1)):c&&!h&&(a?x(void 0):(y(!0),Z(!0)));const S=typeof e=="string"?e:"",B=!c||h,A=u&&!ee&&!s&&!!S&&B,M=A&&!a,F=(O=c==null?void 0:c.length)!=null?O:0;l.useEffect(()=>{if(h||j>=F-1)return;const i=z[Math.min(j,z.length-1)],g=setTimeout(()=>W(j+1),i);return()=>clearTimeout(g)},[h,j,F]);const X=l.useEffectEvent(()=>{k(!0),f==null||f()});l.useLayoutEffect(()=>{if(!M)return;const i=ve(P.current);R.current.style.width=`${i.padX}px`,R.current.style.height=`${i.padY+i.lineHeight}px`,te(i)},[M,S]),l.useEffect(()=>{if(!A)return;if(a){X(),H(!0);return}if(!p)return;const i=R.current,g=Se(S,m!=null?m:S),b=performance.now()+(L?le:0)+ce;let I=p.padX,_,E,q=0;const D=N=>{var U;const v=g.filter(oe=>oe<=N-b).length,K=g[v]-((U=g[v-1])!=null?U:0),ie=p.padX+(v?p.widths[v-1]:0),re=K<ue?30:45;if(I+=(ie-I)*(1-Math.exp(-(N-(_!=null?_:N))/re)),_=N,i.style.width=`${I}px`,i.style.height=`${p.padY+p.lineHeight*J(p.lineStarts,v).length}px`,se(v),ne(v>0&&K>=de),v===g.length&&(E!=null||(E=N),E===N&&X(),N-E>=he)){i.style.width="",i.style.height="",H(!0);return}q=requestAnimationFrame(D)};return q=requestAnimationFrame(D),()=>cancelAnimationFrame(q)},[A,a,p,S,m,L]);const Y=(V=p==null?void 0:p.lineStarts)!=null?V:[0],G=J(Y,$);return t.jsxs("div",{className:r.root,children:[t.jsx("span",{className:r.avatar,children:t.jsx("img",{src:n,alt:"",className:r.avatarImage})}),t.jsxs("div",{className:r.content,children:[t.jsxs("div",{className:r.message,children:[t.jsx(C.Typography,{as:"p",defaultVariant:"bodySm",weight:"medium",className:r.sender,children:o}),t.jsxs("div",{className:r.slot,children:[c&&t.jsx("div",{className:r.status,"data-leaving":h||void 0,onAnimationEnd:()=>{h&&(y(!1),x(void 0))},children:c.map((i,g)=>t.jsx("span",{className:r.statusLine,"data-active":g===Math.min(j,F-1)||void 0,children:t.jsx(C.Typography,{defaultVariant:"headingXxs",children:i})},i))}),B&&t.jsx("div",{ref:R,className:r.bubble,"aria-live":s?"polite":void 0,"aria-hidden":u&&!s||void 0,"data-enter":M?L?"after-thinking":"direct":void 0,"data-typing":M||void 0,children:t.jsx(C.Typography,{as:"p",defaultVariant:"bodySm",className:r.text,children:s?t.jsxs("span",{role:"img","aria-label":`${o} is typing`,className:r.typing,children:[t.jsx("span",{children:"."}),t.jsx("span",{children:"."}),t.jsx("span",{children:"."})]}):M?G.map((i,g)=>{var b;return t.jsxs("span",{className:r.line,children:[S.slice(i,Math.min((b=Y[g+1])!=null?b:S.length,$)).trimEnd(),g===G.length-1&&t.jsx("span",{className:r.caret,"data-paused":ae&&!w||void 0,"data-ending":w||void 0})]},i)}):e})})]}),M&&t.jsx("div",{ref:P,className:`${r.bubble} ${r.measure}`,"aria-hidden":!0,children:t.jsx(C.Typography,{as:"p",defaultVariant:"bodySm",children:S})}),u&&t.jsx("span",{className:r.srOnly,"aria-live":"polite",children:w?S:""})]}),T]})]})};exports.ChatMessage=xe;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),o=require("react"),l=require("../../components/ChatMessage/chatMessage.module.css"),L=require("../Typography/Typography.cjs.js"),Q="(prefers-reduced-motion: reduce)",z=[900,1150],le=180,ce=130,de=140,ue=36,he=220,fe=new Set("th he in er an re on at en nd ou ea ha to it is or ti as te ng of al ar st se le ve me yo wh ch ll".split(" ")),me=c=>{const n=window.matchMedia(Q);return n.addEventListener("change",c),()=>n.removeEventListener("change",c)},pe=()=>window.matchMedia(Q).matches,ge=c=>{let n=Array.from(c).reduce((e,t)=>Math.imul(e^t.charCodeAt(0),16777619),2166136261);return()=>{n=n+1831565813|0;let e=Math.imul(n^n>>>15,1|n);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}},Se=(c,n)=>{const e=ge(n),t=(d,f)=>d+e()*(f-d);let E=0,u=0;return c.split("").map((d,f)=>{var i;const m=(i=c[f-1])!=null?i:"";let a;return f===0?a=0:/[.?!…]/.test(m)?a=t(180,260):/[,;:—]/.test(m)?a=t(120,180):d===" "?a=t(20,35):u>0?(u--,a=t(22,32)):fe.has((m+d).toLowerCase())?a=t(24,36):e()<.15?(u=2+Math.floor(e()*3),a=t(22,32)):a=t(35,60),m===" "&&e()<.08&&(a+=t(60,110)),E+=a})},ve=c=>{const n=c.querySelector("p"),e=n.firstChild,t=e.textContent,E=n.getBoundingClientRect().left,u=getComputedStyle(c),d=parseFloat(u.paddingLeft)+parseFloat(u.paddingRight),f=document.createRange(),m=[0],a=[];let i,x=0;for(let h=0;h<t.length;h++){if(!/\s/.test(t[h])){f.setStart(e,h),f.setEnd(e,h+1);const y=f.getBoundingClientRect();i!==void 0&&y.top>i+1&&m.push(h),i=y.top,x=Math.max(x,y.right-E)}a.push(x)}return a[a.length-1]=c.getBoundingClientRect().width-d,{lineStarts:m,widths:a,lineHeight:parseFloat(getComputedStyle(n).lineHeight),padX:d,padY:parseFloat(u.paddingTop)+parseFloat(u.paddingBottom)}},J=(c,n)=>c.filter((e,t)=>t===0||e<n),xe=({sender:c,avatar:n,children:e,typing:t=!1,attachment:E,thinking:u,typeOut:d=!1,seed:f,onTyped:m})=>{var V,D;const a=o.useSyncExternalStore(me,pe,()=>!1),[i,x]=o.useState(),[h,y]=o.useState(!1),[T,W]=o.useState(0),[w,Z]=o.useState(!1),[j,k]=o.useState(!d),[ee,$]=o.useState(!d),[p,te]=o.useState(),[B,se]=o.useState(0),[ae,ne]=o.useState(!1),b=o.useRef(null),P=o.useRef(null);u!=null&&u.length?(u!==i&&x(u),h&&y(!1)):i&&!h&&(a?x(void 0):(y(!0),Z(!0)));const g=typeof e=="string"?e:"",X=(t||!!e)&&(!i||h),A=d&&!ee&&!t&&!!g&&X,M=A&&!a,F=(V=i==null?void 0:i.length)!=null?V:0;o.useEffect(()=>{if(h||T>=F-1)return;const r=z[Math.min(T,z.length-1)],S=setTimeout(()=>W(T+1),r);return()=>clearTimeout(S)},[h,T,F]);const I=o.useEffectEvent(()=>{k(!0),m==null||m()});o.useEffect(()=>{d&&!g&&!i&&!j&&I()},[d,g,i,j]),o.useLayoutEffect(()=>{if(!M)return;const r=ve(P.current);b.current.style.width=`${r.padX}px`,b.current.style.height=`${r.padY+r.lineHeight}px`,te(r)},[M,g]),o.useEffect(()=>{if(!A)return;if(a){I(),$(!0);return}if(!p)return;const r=b.current,S=Se(g,f!=null?f:g),_=performance.now()+(w?le:0)+ce;let q=p.padX,C,R,H=0;const K=N=>{var U;const v=S.filter(oe=>oe<=N-_).length,O=S[v]-((U=S[v-1])!=null?U:0),ie=p.padX+(v?p.widths[v-1]:0),re=O<ue?30:45;if(q+=(ie-q)*(1-Math.exp(-(N-(C!=null?C:N))/re)),C=N,r.style.width=`${q}px`,r.style.height=`${p.padY+p.lineHeight*J(p.lineStarts,v).length}px`,se(v),ne(v>0&&O>=de),v===S.length&&(R!=null||(R=N),R===N&&I(),N-R>=he)){r.style.width="",r.style.height="",$(!0);return}H=requestAnimationFrame(K)};return H=requestAnimationFrame(K),()=>cancelAnimationFrame(H)},[A,a,p,g,f,w]);const Y=(D=p==null?void 0:p.lineStarts)!=null?D:[0],G=J(Y,B);return s.jsxs("div",{className:l.root,children:[s.jsx("span",{className:l.avatar,children:s.jsx("img",{src:n,alt:"",className:l.avatarImage})}),s.jsxs("div",{className:l.content,children:[s.jsxs("div",{className:l.message,children:[s.jsx(L.Typography,{as:"p",defaultVariant:"bodySm",weight:"medium",className:l.sender,children:c}),s.jsxs("div",{className:l.slot,children:[i&&s.jsx("div",{className:l.status,"data-leaving":h||void 0,onAnimationEnd:()=>{h&&(y(!1),x(void 0))},children:i.map((r,S)=>s.jsx("span",{className:l.statusLine,"data-active":S===Math.min(T,F-1)||void 0,children:s.jsx(L.Typography,{defaultVariant:"headingXxs",children:r})},r))}),X&&s.jsx("div",{ref:b,className:l.bubble,"aria-live":t?"polite":void 0,"aria-hidden":d&&!t||void 0,"data-enter":M?w?"after-thinking":"direct":void 0,"data-typing":M||void 0,children:s.jsx(L.Typography,{as:"p",defaultVariant:"bodySm",className:l.text,children:t?s.jsxs("span",{role:"img","aria-label":`${c} is typing`,className:l.typing,children:[s.jsx("span",{children:"."}),s.jsx("span",{children:"."}),s.jsx("span",{children:"."})]}):M?G.map((r,S)=>{var _;return s.jsxs("span",{className:l.line,children:[g.slice(r,Math.min((_=Y[S+1])!=null?_:g.length,B)).trimEnd(),S===G.length-1&&s.jsx("span",{className:l.caret,"data-paused":ae&&!j||void 0,"data-ending":j||void 0})]},r)}):e})})]}),M&&s.jsx("div",{ref:P,className:`${l.bubble} ${l.measure}`,"aria-hidden":!0,children:s.jsx(L.Typography,{as:"p",defaultVariant:"bodySm",children:g})}),d&&s.jsx("span",{className:l.srOnly,"aria-live":"polite",children:j?g:""})]}),E]})]})};exports.ChatMessage=xe;
@@ -1,152 +1,154 @@
1
1
  "use client";
2
- import { jsxs as R, jsx as o } from "react/jsx-runtime";
3
- import { useSyncExternalStore as ue, useState as v, useRef as J, useEffect as Q, useEffectEvent as he, useLayoutEffect as me } from "react";
4
- import i from "../../components/ChatMessage/chatMessage.module.css";
5
- import { Typography as A } from "../Typography/Typography.es.js";
2
+ import { jsxs as R, jsx as c } from "react/jsx-runtime";
3
+ import { useSyncExternalStore as ue, useState as v, useRef as Q, useEffect as X, useEffectEvent as he, useLayoutEffect as me } from "react";
4
+ import r from "../../components/ChatMessage/chatMessage.module.css";
5
+ import { Typography as C } from "../Typography/Typography.es.js";
6
6
  const k = "(prefers-reduced-motion: reduce)", W = [900, 1150], fe = 180, pe = 130, ge = 140, ve = 36, Se = 220, Ne = new Set(
7
7
  "th he in er an re on at en nd ou ea ha to it is or ti as te ng of al ar st se le ve me yo wh ch ll".split(" ")
8
- ), Me = (r) => {
8
+ ), Me = (l) => {
9
9
  const a = window.matchMedia(k);
10
- return a.addEventListener("change", r), () => a.removeEventListener("change", r);
11
- }, Ee = () => window.matchMedia(k).matches, ye = (r) => {
12
- let a = Array.from(r).reduce((e, t) => Math.imul(e ^ t.charCodeAt(0), 16777619), 2166136261);
10
+ return a.addEventListener("change", l), () => a.removeEventListener("change", l);
11
+ }, Ee = () => window.matchMedia(k).matches, ye = (l) => {
12
+ let a = Array.from(l).reduce((e, t) => Math.imul(e ^ t.charCodeAt(0), 16777619), 2166136261);
13
13
  return () => {
14
14
  a = a + 1831565813 | 0;
15
15
  let e = Math.imul(a ^ a >>> 15, 1 | a);
16
16
  return e = e + Math.imul(e ^ e >>> 7, 61 | e) ^ e, ((e ^ e >>> 14) >>> 0) / 4294967296;
17
17
  };
18
- }, Re = (r, a) => {
19
- const e = ye(a), t = (d, h) => d + e() * (h - d);
20
- let T = 0, c = 0;
21
- return r.split("").map((d, h) => {
22
- var l;
23
- const m = (l = r[h - 1]) != null ? l : "";
18
+ }, Re = (l, a) => {
19
+ const e = ye(a), t = (o, h) => o + e() * (h - o);
20
+ let T = 0, d = 0;
21
+ return l.split("").map((o, h) => {
22
+ var n;
23
+ const m = (n = l[h - 1]) != null ? n : "";
24
24
  let s;
25
- return h === 0 ? s = 0 : /[.?!…]/.test(m) ? s = t(180, 260) : /[,;:—]/.test(m) ? s = t(120, 180) : d === " " ? s = t(20, 35) : c > 0 ? (c--, s = t(22, 32)) : Ne.has((m + d).toLowerCase()) ? s = t(24, 36) : e() < 0.15 ? (c = 2 + Math.floor(e() * 3), s = t(22, 32)) : s = t(35, 60), m === " " && e() < 0.08 && (s += t(60, 110)), T += s;
25
+ return h === 0 ? s = 0 : /[.?!…]/.test(m) ? s = t(180, 260) : /[,;:—]/.test(m) ? s = t(120, 180) : o === " " ? s = t(20, 35) : d > 0 ? (d--, s = t(22, 32)) : Ne.has((m + o).toLowerCase()) ? s = t(24, 36) : e() < 0.15 ? (d = 2 + Math.floor(e() * 3), s = t(22, 32)) : s = t(35, 60), m === " " && e() < 0.08 && (s += t(60, 110)), T += s;
26
26
  });
27
- }, Te = (r) => {
28
- const a = r.querySelector("p"), e = a.firstChild, t = e.textContent, T = a.getBoundingClientRect().left, c = getComputedStyle(r), d = parseFloat(c.paddingLeft) + parseFloat(c.paddingRight), h = document.createRange(), m = [0], s = [];
29
- let l, N = 0;
27
+ }, Te = (l) => {
28
+ const a = l.querySelector("p"), e = a.firstChild, t = e.textContent, T = a.getBoundingClientRect().left, d = getComputedStyle(l), o = parseFloat(d.paddingLeft) + parseFloat(d.paddingRight), h = document.createRange(), m = [0], s = [];
29
+ let n, N = 0;
30
30
  for (let u = 0; u < t.length; u++) {
31
31
  if (!/\s/.test(t[u])) {
32
32
  h.setStart(e, u), h.setEnd(e, u + 1);
33
33
  const M = h.getBoundingClientRect();
34
- l !== void 0 && M.top > l + 1 && m.push(u), l = M.top, N = Math.max(N, M.right - T);
34
+ n !== void 0 && M.top > n + 1 && m.push(u), n = M.top, N = Math.max(N, M.right - T);
35
35
  }
36
36
  s.push(N);
37
37
  }
38
- return s[s.length - 1] = r.getBoundingClientRect().width - d, {
38
+ return s[s.length - 1] = l.getBoundingClientRect().width - o, {
39
39
  lineStarts: m,
40
40
  widths: s,
41
41
  lineHeight: parseFloat(getComputedStyle(a).lineHeight),
42
- padX: d,
43
- padY: parseFloat(c.paddingTop) + parseFloat(c.paddingBottom)
42
+ padX: o,
43
+ padY: parseFloat(d.paddingTop) + parseFloat(d.paddingBottom)
44
44
  };
45
- }, Z = (r, a) => r.filter((e, t) => t === 0 || e < a), we = ({
46
- sender: r,
45
+ }, Z = (l, a) => l.filter((e, t) => t === 0 || e < a), we = ({
46
+ sender: l,
47
47
  avatar: a,
48
48
  children: e,
49
49
  typing: t = !1,
50
50
  attachment: T,
51
- thinking: c,
52
- typeOut: d = !1,
51
+ thinking: d,
52
+ typeOut: o = !1,
53
53
  seed: h,
54
54
  onTyped: m
55
55
  }) => {
56
- var O, j;
57
- const s = ue(Me, Ee, () => !1), [l, N] = v(), [u, M] = v(!1), [b, ee] = v(0), [C, te] = v(!1), [F, se] = v(!d), [ae, P] = v(!d), [f, ne] = v(), [X, ie] = v(0), [re, le] = v(!1), L = J(null), Y = J(null);
58
- c != null && c.length ? (c !== l && N(c), u && M(!1)) : l && !u && (s ? N(void 0) : (M(!0), te(!0)));
59
- const g = typeof e == "string" ? e : "", q = !l || u, I = d && !ae && !t && !!g && q, y = I && !s, H = (O = l == null ? void 0 : l.length) != null ? O : 0;
60
- Q(() => {
56
+ var K, U;
57
+ const s = ue(Me, Ee, () => !1), [n, N] = v(), [u, M] = v(!1), [b, ee] = v(0), [F, te] = v(!1), [x, se] = v(!o), [ae, Y] = v(!o), [f, ne] = v(), [q, ie] = v(0), [re, le] = v(!1), _ = Q(null), G = Q(null);
58
+ d != null && d.length ? (d !== n && N(d), u && M(!1)) : n && !u && (s ? N(void 0) : (M(!0), te(!0)));
59
+ const p = typeof e == "string" ? e : "", V = (t || !!e) && (!n || u), I = o && !ae && !t && !!p && V, y = I && !s, H = (K = n == null ? void 0 : n.length) != null ? K : 0;
60
+ X(() => {
61
61
  if (u || b >= H - 1) return;
62
- const n = W[Math.min(b, W.length - 1)], p = setTimeout(() => ee(b + 1), n);
63
- return () => clearTimeout(p);
62
+ const i = W[Math.min(b, W.length - 1)], g = setTimeout(() => ee(b + 1), i);
63
+ return () => clearTimeout(g);
64
64
  }, [u, b, H]);
65
- const G = he(() => {
65
+ const $ = he(() => {
66
66
  se(!0), m == null || m();
67
67
  });
68
- me(() => {
68
+ X(() => {
69
+ o && !p && !n && !x && $();
70
+ }, [o, p, n, x]), me(() => {
69
71
  if (!y) return;
70
- const n = Te(Y.current);
71
- L.current.style.width = `${n.padX}px`, L.current.style.height = `${n.padY + n.lineHeight}px`, ne(n);
72
- }, [y, g]), Q(() => {
72
+ const i = Te(G.current);
73
+ _.current.style.width = `${i.padX}px`, _.current.style.height = `${i.padY + i.lineHeight}px`, ne(i);
74
+ }, [y, p]), X(() => {
73
75
  if (!I) return;
74
76
  if (s) {
75
- G(), P(!0);
77
+ $(), Y(!0);
76
78
  return;
77
79
  }
78
80
  if (!f) return;
79
- const n = L.current, p = Re(g, h != null ? h : g), _ = performance.now() + (C ? fe : 0) + pe;
80
- let $ = f.padX, w, x, B = 0;
81
- const K = (E) => {
82
- var z;
83
- const S = p.filter((de) => de <= E - _).length, U = p[S] - ((z = p[S - 1]) != null ? z : 0), oe = f.padX + (S ? f.widths[S - 1] : 0), ce = U < ve ? 30 : 45;
84
- if ($ += (oe - $) * (1 - Math.exp(-(E - (w != null ? w : E)) / ce)), w = E, n.style.width = `${$}px`, n.style.height = `${f.padY + f.lineHeight * Z(f.lineStarts, S).length}px`, ie(S), le(S > 0 && U >= ge), S === p.length && (x != null || (x = E), x === E && G(), E - x >= Se)) {
85
- n.style.width = "", n.style.height = "", P(!0);
81
+ const i = _.current, g = Re(p, h != null ? h : p), w = performance.now() + (F ? fe : 0) + pe;
82
+ let B = f.padX, A, L, P = 0;
83
+ const O = (E) => {
84
+ var J;
85
+ const S = g.filter((de) => de <= E - w).length, z = g[S] - ((J = g[S - 1]) != null ? J : 0), oe = f.padX + (S ? f.widths[S - 1] : 0), ce = z < ve ? 30 : 45;
86
+ if (B += (oe - B) * (1 - Math.exp(-(E - (A != null ? A : E)) / ce)), A = E, i.style.width = `${B}px`, i.style.height = `${f.padY + f.lineHeight * Z(f.lineStarts, S).length}px`, ie(S), le(S > 0 && z >= ge), S === g.length && (L != null || (L = E), L === E && $(), E - L >= Se)) {
87
+ i.style.width = "", i.style.height = "", Y(!0);
86
88
  return;
87
89
  }
88
- B = requestAnimationFrame(K);
90
+ P = requestAnimationFrame(O);
89
91
  };
90
- return B = requestAnimationFrame(K), () => cancelAnimationFrame(B);
91
- }, [I, s, f, g, h, C]);
92
- const V = (j = f == null ? void 0 : f.lineStarts) != null ? j : [0], D = Z(V, X);
93
- return /* @__PURE__ */ R("div", { className: i.root, children: [
94
- /* @__PURE__ */ o("span", { className: i.avatar, children: /* @__PURE__ */ o("img", { src: a, alt: "", className: i.avatarImage }) }),
95
- /* @__PURE__ */ R("div", { className: i.content, children: [
96
- /* @__PURE__ */ R("div", { className: i.message, children: [
97
- /* @__PURE__ */ o(A, { as: "p", defaultVariant: "bodySm", weight: "medium", className: i.sender, children: r }),
98
- /* @__PURE__ */ R("div", { className: i.slot, children: [
99
- l && /* @__PURE__ */ o(
92
+ return P = requestAnimationFrame(O), () => cancelAnimationFrame(P);
93
+ }, [I, s, f, p, h, F]);
94
+ const D = (U = f == null ? void 0 : f.lineStarts) != null ? U : [0], j = Z(D, q);
95
+ return /* @__PURE__ */ R("div", { className: r.root, children: [
96
+ /* @__PURE__ */ c("span", { className: r.avatar, children: /* @__PURE__ */ c("img", { src: a, alt: "", className: r.avatarImage }) }),
97
+ /* @__PURE__ */ R("div", { className: r.content, children: [
98
+ /* @__PURE__ */ R("div", { className: r.message, children: [
99
+ /* @__PURE__ */ c(C, { as: "p", defaultVariant: "bodySm", weight: "medium", className: r.sender, children: l }),
100
+ /* @__PURE__ */ R("div", { className: r.slot, children: [
101
+ n && /* @__PURE__ */ c(
100
102
  "div",
101
103
  {
102
- className: i.status,
104
+ className: r.status,
103
105
  "data-leaving": u || void 0,
104
106
  onAnimationEnd: () => {
105
107
  u && (M(!1), N(void 0));
106
108
  },
107
- children: l.map((n, p) => /* @__PURE__ */ o(
109
+ children: n.map((i, g) => /* @__PURE__ */ c(
108
110
  "span",
109
111
  {
110
- className: i.statusLine,
111
- "data-active": p === Math.min(b, H - 1) || void 0,
112
- children: /* @__PURE__ */ o(A, { defaultVariant: "headingXxs", children: n })
112
+ className: r.statusLine,
113
+ "data-active": g === Math.min(b, H - 1) || void 0,
114
+ children: /* @__PURE__ */ c(C, { defaultVariant: "headingXxs", children: i })
113
115
  },
114
- n
116
+ i
115
117
  ))
116
118
  }
117
119
  ),
118
- q && /* @__PURE__ */ o(
120
+ V && /* @__PURE__ */ c(
119
121
  "div",
120
122
  {
121
- ref: L,
122
- className: i.bubble,
123
+ ref: _,
124
+ className: r.bubble,
123
125
  "aria-live": t ? "polite" : void 0,
124
- "aria-hidden": d && !t || void 0,
125
- "data-enter": y ? C ? "after-thinking" : "direct" : void 0,
126
+ "aria-hidden": o && !t || void 0,
127
+ "data-enter": y ? F ? "after-thinking" : "direct" : void 0,
126
128
  "data-typing": y || void 0,
127
- children: /* @__PURE__ */ o(A, { as: "p", defaultVariant: "bodySm", className: i.text, children: t ? /* @__PURE__ */ R("span", { role: "img", "aria-label": `${r} is typing`, className: i.typing, children: [
128
- /* @__PURE__ */ o("span", { children: "." }),
129
- /* @__PURE__ */ o("span", { children: "." }),
130
- /* @__PURE__ */ o("span", { children: "." })
131
- ] }) : y ? D.map((n, p) => {
132
- var _;
133
- return /* @__PURE__ */ R("span", { className: i.line, children: [
134
- g.slice(n, Math.min((_ = V[p + 1]) != null ? _ : g.length, X)).trimEnd(),
135
- p === D.length - 1 && /* @__PURE__ */ o(
129
+ children: /* @__PURE__ */ c(C, { as: "p", defaultVariant: "bodySm", className: r.text, children: t ? /* @__PURE__ */ R("span", { role: "img", "aria-label": `${l} is typing`, className: r.typing, children: [
130
+ /* @__PURE__ */ c("span", { children: "." }),
131
+ /* @__PURE__ */ c("span", { children: "." }),
132
+ /* @__PURE__ */ c("span", { children: "." })
133
+ ] }) : y ? j.map((i, g) => {
134
+ var w;
135
+ return /* @__PURE__ */ R("span", { className: r.line, children: [
136
+ p.slice(i, Math.min((w = D[g + 1]) != null ? w : p.length, q)).trimEnd(),
137
+ g === j.length - 1 && /* @__PURE__ */ c(
136
138
  "span",
137
139
  {
138
- className: i.caret,
139
- "data-paused": re && !F || void 0,
140
- "data-ending": F || void 0
140
+ className: r.caret,
141
+ "data-paused": re && !x || void 0,
142
+ "data-ending": x || void 0
141
143
  }
142
144
  )
143
- ] }, n);
145
+ ] }, i);
144
146
  }) : e })
145
147
  }
146
148
  )
147
149
  ] }),
148
- y && /* @__PURE__ */ o("div", { ref: Y, className: `${i.bubble} ${i.measure}`, "aria-hidden": !0, children: /* @__PURE__ */ o(A, { as: "p", defaultVariant: "bodySm", children: g }) }),
149
- d && /* @__PURE__ */ o("span", { className: i.srOnly, "aria-live": "polite", children: F ? g : "" })
150
+ y && /* @__PURE__ */ c("div", { ref: G, className: `${r.bubble} ${r.measure}`, "aria-hidden": !0, children: /* @__PURE__ */ c(C, { as: "p", defaultVariant: "bodySm", children: p }) }),
151
+ o && /* @__PURE__ */ c("span", { className: r.srOnly, "aria-live": "polite", children: x ? p : "" })
150
152
  ] }),
151
153
  T
152
154
  ] })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zenpatient-org/healthspan-marketing-ui",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "description": "Design system",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.es.js",