@brainfish-ai/components 0.30.10 → 0.31.1

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.
Files changed (31) hide show
  1. package/dist/conversation.d.ts +46 -2
  2. package/dist/esm/ChatSearch.css +1 -1
  3. package/dist/esm/chunks/{ChatSearch.DvJtrQld.js → ChatSearch.EEO6qq9U.js} +84 -87
  4. package/dist/esm/chunks/ChatSearch.EEO6qq9U.js.map +1 -0
  5. package/dist/esm/chunks/Conversation.DpHoC6se.js +29 -0
  6. package/dist/esm/chunks/Conversation.DpHoC6se.js.map +1 -0
  7. package/dist/esm/chunks/{font-picker.YAE99idL.js → font-picker.B9GPXyK4.js} +6 -6
  8. package/dist/esm/chunks/{font-picker.YAE99idL.js.map → font-picker.B9GPXyK4.js.map} +1 -1
  9. package/dist/esm/chunks/ripple-status.C20jzXjF.js +6 -0
  10. package/dist/esm/chunks/ripple-status.C20jzXjF.js.map +1 -0
  11. package/dist/esm/chunks/{two-level-combobox.DJYP--W9.js → two-level-combobox.BVZfsNSN.js} +3 -3
  12. package/dist/esm/chunks/{two-level-combobox.DJYP--W9.js.map → two-level-combobox.BVZfsNSN.js.map} +1 -1
  13. package/dist/esm/components/chart-radial-stacked.js +2 -2
  14. package/dist/esm/components/chat-search.js +1 -1
  15. package/dist/esm/components/conversation.js +1 -1
  16. package/dist/esm/components/font-picker.js +1 -1
  17. package/dist/esm/components/metric-card.js +2 -2
  18. package/dist/esm/components/two-level-combobox.js +1 -1
  19. package/dist/esm/global.css +1 -1
  20. package/dist/esm/index.js +5 -1
  21. package/dist/esm/index.js.map +1 -1
  22. package/dist/esm/ripple-status.css +1 -0
  23. package/dist/esm/scenes/knowledge-review.js +8 -8
  24. package/dist/index.d.ts +98 -2
  25. package/dist/stats.html +1 -1
  26. package/package.json +1 -1
  27. package/dist/esm/chunks/ChatSearch.DvJtrQld.js.map +0 -1
  28. package/dist/esm/chunks/Conversation.CCfPtVz8.js +0 -29
  29. package/dist/esm/chunks/Conversation.CCfPtVz8.js.map +0 -1
  30. package/dist/esm/chunks/ConversationStatus.BhdnM1uS.js +0 -2
  31. package/dist/esm/chunks/ConversationStatus.BhdnM1uS.js.map +0 -1
@@ -1,18 +1,18 @@
1
- import*as e from"react";import t,{useCallback as n,useEffect as l,useRef as r,useState as c,useImperativeHandle as a}from"react";import{u as i,c as s,b as o,R as d}from"../chunks/suggestion-card.D-AsG_yB.js";import '../knowledge-review.css';export{S as SuggestionCard}from"../chunks/suggestion-card.D-AsG_yB.js";import u from"html-react-parser";import{CaretDown as m,CaretUp as p,Lightbulb as f,Backspace as g,CheckCircle as A,Globe as h,LockKey as b,HandsClapping as E}from"@phosphor-icons/react";import{Card as N,CardHeader as v,CardTitle as x,CardContent as w}from"../components/ui/card.js";import{ScrollArea as y}from"../components/ui/scroll-area.js";import{Spinner as k}from"../components/ui/spinner.js";import{B as C,a as I}from"../chunks/button.D_2SonNs.js";import{Tooltip as P,TooltipTrigger as j,TooltipContent as R}from"../components/ui/tooltip.js";import{Popover as L,PopoverTrigger as z,PopoverContent as D}from"../components/ui/popover.js";import{DropdownMenu as B,DropdownMenuTrigger as O,DropdownMenuContent as T,DropdownMenuItem as F}from"../components/ui/dropdown-menu.js";import{ButtonGroup as $}from"../components/ui/button-group.js";import{c as q}from"../chunks/utils.C6Qu-kwd.js";function M({fetchDiffForItem:e}){const{selectedItem:t,setLoadedDiffDoc:r,setLoadingDiff:c}=i(),a=n(async(t,n)=>{c(!0),r(null);try{const l=await e(t);if(n.aborted)return;r(l)}catch(l){if(n.aborted)return;console.error("Failed to fetch diff:",l),r(null)}finally{n.aborted||c(!1)}},[e,r,c]),s=t?.id;return l(()=>{if(!s)return r(null),void c(!1);const e=new AbortController;return a(s,e.signal),()=>{e.abort()}},[s,a]),null}function W({title:t,breadcrumb:n,onOpenArticleLink:l,currentArticleIndex:r,totalArticles:c,displayTotalArticles:a,onNextArticle:i,onPreviousArticle:s}){const o=c>0&&r<c-1,d=r>0,u=0===c?0:r+1,f=a??c,g=f>0;/* @__PURE__ */
1
+ import*as e from"react";import t,{useCallback as n,useEffect as l,useRef as r,useState as c,useImperativeHandle as a}from"react";import{u as i,c as s,b as o,R as d}from"../chunks/suggestion-card.D-AsG_yB.js";import '../knowledge-review.css';export{S as SuggestionCard}from"../chunks/suggestion-card.D-AsG_yB.js";import u from"html-react-parser";import{CaretDown as m,CaretUp as p,Lightbulb as f,Backspace as g,CheckCircle as A,Globe as h,LockKey as b,HandsClapping as E}from"@phosphor-icons/react";import{Card as N,CardHeader as v,CardTitle as x,CardContent as w}from"../components/ui/card.js";import{ScrollArea as y}from"../components/ui/scroll-area.js";import{Spinner as k}from"../components/ui/spinner.js";import{B as C,a as I}from"../chunks/button.D_2SonNs.js";import{Tooltip as P,TooltipTrigger as j,TooltipContent as R}from"../components/ui/tooltip.js";import{Popover as L,PopoverTrigger as z,PopoverContent as D}from"../components/ui/popover.js";import{DropdownMenu as B,DropdownMenuTrigger as O,DropdownMenuContent as T,DropdownMenuItem as q}from"../components/ui/dropdown-menu.js";import{ButtonGroup as F}from"../components/ui/button-group.js";import{c as $}from"../chunks/utils.C6Qu-kwd.js";function M({fetchDiffForItem:e}){const{selectedItem:t,setLoadedDiffDoc:r,setLoadingDiff:c}=i(),a=n(async(t,n)=>{c(!0),r(null);try{const l=await e(t);if(n.aborted)return;r(l)}catch(l){if(n.aborted)return;console.error("Failed to fetch diff:",l),r(null)}finally{n.aborted||c(!1)}},[e,r,c]),s=t?.id;return l(()=>{if(!s)return r(null),void c(!1);const e=new AbortController;return a(s,e.signal),()=>{e.abort()}},[s,a]),null}function W({title:t,breadcrumb:n,onOpenArticleLink:l,currentArticleIndex:r,totalArticles:c,displayTotalArticles:a,onNextArticle:i,onPreviousArticle:s}){const o=c>0&&r<c-1,d=r>0,u=0===c?0:r+1,f=a??c,g=f>0;/* @__PURE__ */
2
2
  return e.createElement("div",{className:"flex justify-between items-center"},/* @__PURE__ */e.createElement("h1",{className:"heading-lg"},t,l&&n&&/* @__PURE__ */e.createElement(C,{variant:"link",size:"sm",onClick:l,"aria-label":"Open article",className:"block px-0 text-subtle text-xs"},n)),/* @__PURE__ */e.createElement("div",{className:"flex items-center"},/* @__PURE__ */e.createElement("p",{className:"text-xs text-foreground pr-2"},/* @__PURE__ */e.createElement("span",{"aria-hidden":"true"},g?`${u}/${f}`:"0"),/* @__PURE__ */e.createElement("span",{className:"sr-only","aria-live":"polite"},g?`Article ${u} of ${f}`:"No articles")),/* @__PURE__ */e.createElement(P,null,/* @__PURE__ */e.createElement(j,{asChild:!0},/* @__PURE__ */e.createElement(C,{variant:"ghost",size:"icon",disabled:!o,onClick:i,"aria-label":"Go to next article"},
3
3
  /* @__PURE__ */e.createElement(m,{"aria-hidden":"true"}))),/* @__PURE__ */e.createElement(R,{side:"bottom",bgColor:"--bfc-foreground",className:"text-background"},"Next Article")),/* @__PURE__ */e.createElement(P,null,/* @__PURE__ */e.createElement(j,{asChild:!0},/* @__PURE__ */e.createElement(C,{variant:"ghost",size:"icon",disabled:!d,onClick:s,"aria-label":"Go to previous article"},
4
4
  /* @__PURE__ */e.createElement(p,{"aria-hidden":"true"}))),/* @__PURE__ */e.createElement(R,{side:"top",bgColor:"--bfc-foreground",className:"text-background"},"Previous Article"))))}function _({isNew:t,isAccepted:n=!1,suggestionsCount:l,sourceIcon:r,sourceDescription:c,onSourceLinkClick:a,showActionButtons:i=!0,suggestionReasonBody:o,hideAcceptAndPublishPublic:d=!1,pendingAction:u=null,onAcceptAndPublish:p,onRejectAll:E,onAcceptAll:N,onAcceptAndPublishAction:v}){const[x,w]=e.useState(!1),y=null!=u,P="reject"===u,S="accept-draft"===u||"accept-publish-public"===u||"accept-publish-internal"===u;/* @__PURE__ */
5
- return e.createElement("div",{className:"flex-1 px-2 pb-2 flex justify-between items-center"},/* @__PURE__ */e.createElement(s,{isNew:t,isAccepted:n,editCount:l,sourceIcon:r,sourceDescription:c,onSourceLinkClick:a}),i&&/* @__PURE__ */e.createElement($,{orientation:"horizontal",rounded:!1,"aria-label":"Suggestion actions","aria-busy":y,className:"gap-1"},o&&/* @__PURE__ */e.createElement(L,{open:x,onOpenChange:w},/* @__PURE__ */e.createElement(z,{asChild:!0},/* @__PURE__ */e.createElement(C,{variant:"ghost","aria-label":G,disabled:y},/* @__PURE__ */e.createElement(f,{"aria-hidden":"true"}),"Why")),/* @__PURE__ */e.createElement(D,{align:"start",side:"bottom",className:"z-above-modal shadow-md dark:shadow-md-invert border-dark-300"},
5
+ return e.createElement("div",{className:"flex-1 px-2 pb-2 flex justify-between items-center"},/* @__PURE__ */e.createElement(s,{isNew:t,isAccepted:n,editCount:l,sourceIcon:r,sourceDescription:c,onSourceLinkClick:a}),i&&/* @__PURE__ */e.createElement(F,{orientation:"horizontal",rounded:!1,"aria-label":"Suggestion actions","aria-busy":y,className:"gap-1"},o&&/* @__PURE__ */e.createElement(L,{open:x,onOpenChange:w},/* @__PURE__ */e.createElement(z,{asChild:!0},/* @__PURE__ */e.createElement(C,{variant:"ghost","aria-label":G,disabled:y},/* @__PURE__ */e.createElement(f,{"aria-hidden":"true"}),"Why")),/* @__PURE__ */e.createElement(D,{align:"start",side:"bottom",className:"z-above-modal shadow-md dark:shadow-md-invert border-dark-300"},
6
6
  /* @__PURE__ */e.createElement("div",{className:"font-bold text-sm"},G),
7
7
  /* @__PURE__ */e.createElement("div",{className:"text-sm text-subtle mt-1"},o))),
8
- /* @__PURE__ */e.createElement(C,{variant:"ghost",disabled:y,onClick:()=>{E()}},P?/* @__PURE__ */e.createElement(k,{className:"size-5"}):/* @__PURE__ */e.createElement(g,{"aria-hidden":"true"}),t?"Reject":"Reject all"),p?/* @__PURE__ */e.createElement(B,null,/* @__PURE__ */e.createElement("div",{className:q("flex items-center rounded border border-border bg-primary",I)},/* @__PURE__ */e.createElement(C,{variant:"default",elevation:"shadow",className:"gap-1 rounded-none border-0 bg-transparent shadow-none",disabled:y,onClick:()=>{N()}},S?/* @__PURE__ */e.createElement(k,{className:"size-5"}):/* @__PURE__ */e.createElement(A,{"aria-hidden":"true"}),t?"Accept as draft":"Accept all as draft"),/* @__PURE__ */e.createElement("span",{className:"h-full w-px self-stretch bg-foreground","aria-hidden":"true"}),/* @__PURE__ */e.createElement(O,{asChild:!0},/* @__PURE__ */e.createElement(C,{variant:"default",size:"icon",className:"size-9 rounded-none border-0 bg-transparent shadow-none","aria-label":"More accept options",disabled:y},
9
- /* @__PURE__ */e.createElement(m,{className:"size-4","aria-hidden":"true"})))),/* @__PURE__ */e.createElement(T,{align:"end",className:"z-above-modal border-none shadow-md dark:shadow-md-invert mt-1 "},!d&&/* @__PURE__ */e.createElement(F,{className:"p-3",disabled:y,onClick:()=>{v("public")}},
8
+ /* @__PURE__ */e.createElement(C,{variant:"ghost",disabled:y,onClick:()=>{E()}},P?/* @__PURE__ */e.createElement(k,{className:"size-5"}):/* @__PURE__ */e.createElement(g,{"aria-hidden":"true"}),t?"Reject":"Reject all"),p?/* @__PURE__ */e.createElement(B,null,/* @__PURE__ */e.createElement("div",{className:$("flex items-center rounded border border-border bg-primary",I)},/* @__PURE__ */e.createElement(C,{variant:"default",elevation:"shadow",className:"gap-1 rounded-none border-0 bg-transparent shadow-none",disabled:y,onClick:()=>{N()}},S?/* @__PURE__ */e.createElement(k,{className:"size-5"}):/* @__PURE__ */e.createElement(A,{"aria-hidden":"true"}),t?"Accept as draft":"Accept all as draft"),/* @__PURE__ */e.createElement("span",{className:"h-full w-px self-stretch bg-foreground","aria-hidden":"true"}),/* @__PURE__ */e.createElement(O,{asChild:!0},/* @__PURE__ */e.createElement(C,{variant:"default",size:"icon",className:"size-9 rounded-none border-0 bg-transparent shadow-none","aria-label":"More accept options",disabled:y},
9
+ /* @__PURE__ */e.createElement(m,{className:"size-4","aria-hidden":"true"})))),/* @__PURE__ */e.createElement(T,{align:"end",className:"z-above-modal border-none shadow-md dark:shadow-md-invert mt-1 "},!d&&/* @__PURE__ */e.createElement(q,{className:"p-3",disabled:y,onClick:()=>{v("public")}},
10
10
  /* @__PURE__ */e.createElement(h,{"aria-hidden":"true"}),t?"Accept & publish publicly":"Accept all & publish publicly"),
11
- /* @__PURE__ */e.createElement(F,{className:"p-3",disabled:y,onClick:()=>{v("internal")}},
11
+ /* @__PURE__ */e.createElement(q,{className:"p-3",disabled:y,onClick:()=>{v("internal")}},
12
12
  /* @__PURE__ */e.createElement(b,{"aria-hidden":"true"}),t?"Accept & publish internally":"Accept all & publish internally"))):/* @__PURE__ */e.createElement(C,{variant:"default",elevation:"shadow",disabled:y,onClick:()=>{N()}},S?/* @__PURE__ */e.createElement(k,{className:"size-5"}):/* @__PURE__ */e.createElement(A,{"aria-hidden":"true"}),t?"Accept as draft":"Accept all as draft")))}const G="Why is Brainfish suggesting this?",K=e.forwardRef(function({title:t,isNew:n,isAccepted:l=!1,suggestionsCount:r,sourceIcon:c,sourceDescription:a,currentArticleIndex:s,totalArticles:o,displayTotalArticles:d,showActionButtons:u=!0,onNextArticle:m,onPreviousArticle:p,className:f,...g},A){const{onApproveAllSuggestions:h,onRejectAllSuggestions:b,onAcceptAndPublish:E,onApplyAllInEditor:N,onRejectAllInEditor:v,onOpenArticleLink:x,onSourceLinkClick:w,breadcrumb:y,suggestionReasonBody:k,hideAcceptAndPublishPublic:C=!1}=i(),[I,P]=e.useState(null),S=e.useRef(null),j=e.useCallback(async(e,t)=>{if(!S.current){S.current=e,P(e);try{await t()}finally{S.current=null,P(null)}}},[]),R=e.useCallback(async()=>{await j("reject",async()=>{v&&await v(),await Promise.resolve(b())})},[v,b,j]),L=e.useCallback(async()=>{await j("accept-draft",async()=>{N&&await N(),await Promise.resolve(h())})},[N,h,j]),z=e.useCallback(async e=>{if(!E)return;const t="public"===e?"accept-publish-public":"accept-publish-internal";await j(t,async()=>{N&&await N(),await Promise.resolve(E(e))})},[N,E,j]);/* @__PURE__ */
13
- return e.createElement("div",{ref:A,className:q("flex flex-col gap-4",f),...g},/* @__PURE__ */e.createElement(W,{title:t,breadcrumb:y,onOpenArticleLink:x,currentArticleIndex:s,totalArticles:o,displayTotalArticles:d,onNextArticle:m,onPreviousArticle:p}),/* @__PURE__ */e.createElement(_,{isNew:n,isAccepted:l,suggestionsCount:r,sourceIcon:c,sourceDescription:a,onSourceLinkClick:w,showActionButtons:u,suggestionReasonBody:k,hideAcceptAndPublishPublic:C,pendingAction:I,onAcceptAndPublish:E,onRejectAll:R,onAcceptAll:L,onAcceptAndPublishAction:z}))});function H(e){const t=e.querySelectorAll("del + ins"),n=e.querySelectorAll("ins:not(del + ins)"),l=e.querySelectorAll("del"),r=Array.from(l).filter(e=>"INS"!==e.nextElementSibling?.tagName);return t.length+n.length+r.length}function J({diffTitle:e,items:a,isLoading:s,totalItemsCount:o,showActionButtons:d=!0,children:m,sourceIcon:p,sourceDescription:f}){const{selectedItem:g,setSelectedItem:A,loadedDiffDoc:h,loadingDiff:b}=i(),C=a.length>0,I=s??!C,P=I&&!C,S=!I&&!C,j=b?"":u(h?.diffTitle??e??""),R=b?/* @__PURE__ */t.createElement("div",{className:"text-muted-foreground"},"Loading diff…"):h?.diffContent,L=b?0:(z=h?.diffTitle??e)&&"undefined"!=typeof DOMParser?H((new DOMParser).parseFromString(z,"text/html")):0;var z;const D=r(null),[B,O]=c(0);l(()=>{if(b||!h)return void O(0);const e=D.current;if(!e)return;const t=requestAnimationFrame(()=>{var t;O((t=e)?H(t):0)});return()=>cancelAnimationFrame(t)},[b,h]);const T=L+B,F=a.length,$=o??F,q=g?Math.max(0,a.findIndex(e=>e.id===g.id)):0,M=n(()=>{q<F-1&&A(a[q+1]??null)},[q,a,A,F]),W=n(()=>{q>0&&A(a[q-1]??null)},[q,a,A]),_=g?a.find(e=>e.id===g.id)??g:null,G=_?.icon??p,J=_?.description??f,Q=_?.isAccepted??!1;/* @__PURE__ */
14
- return t.createElement(N,{className:"py-6 pl-4","data-name":"knowledge-reviews"},/* @__PURE__ */t.createElement(y,{className:"h-[calc(var(--knowledge-review-scroll-height)-50px)] pr-8"},/* @__PURE__ */t.createElement(v,{className:"p-0"},C&&/* @__PURE__ */t.createElement(x,{className:"border-b border-dark-300 mb-6 pb-2 font-normal"},/* @__PURE__ */t.createElement(K,{title:j,isNew:h?.isNew??!1,isAccepted:Q,suggestionsCount:T,sourceIcon:G,sourceDescription:J,currentArticleIndex:q,totalArticles:F,displayTotalArticles:$,showActionButtons:d,onNextArticle:M,onPreviousArticle:W}))),/* @__PURE__ */t.createElement(w,{className:"p-0 [&_ol]:!pl-16 [&_ul]:!pl-16"},/* @__PURE__ */t.createElement("div",{"aria-hidden":"true",className:"sr-only",hidden:!0},m),P?/* @__PURE__ */t.createElement("div",{className:"flex flex-col items-center justify-center gap-4 text-center h-[50dvh] text-muted-foreground"},/* @__PURE__ */t.createElement(k,{className:"size-8"}),/* @__PURE__ */t.createElement("p",{className:"text-base font-medium"},"Loading suggestions...")):S?/* @__PURE__ */t.createElement("div",{className:"flex flex-col items-center justify-center gap-4 text-center h-[50dvh]"},/* @__PURE__ */t.createElement(E,{className:"text-muted-foreground",size:32,weight:"fill"}),/* @__PURE__ */t.createElement("p",{className:"text-base font-medium text-foreground"},"All up to date. Well done, mate.")):/* @__PURE__ */t.createElement("div",{ref:D,className:"pl-12"},R))))}const Q="--knowledge-review-scroll-height",U=t.forwardRef(function({diffTitle:e="Knowledge Review",children:n,items:c,isLoading:s,totalItemsCount:o,showActionButtons:u=!0,className:m,onApproveAllSuggestions:p,onRejectAllSuggestions:f,onOpenArticleLink:g,onAcceptAndPublish:A,onApplyAllInEditor:h,onRejectAllInEditor:b,onSourceLinkClick:E,breadcrumb:v,sourceIcon:x,sourceDescription:C,suggestionReasonBody:I,hideAcceptAndPublishPublic:P,...S},j){const R=r(null),{selectedItem:L,setSelectedItem:z}=i();a(j,()=>({selectedItem:L,setSelectedItem:z}),[L,z]),l(()=>{const e=R.current;if(!e)return;const t=()=>{const{height:t}=e.getBoundingClientRect();e.style.setProperty(Q,`${t}px`)};if(t(),"function"!=typeof ResizeObserver)return;const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);const D=s??0===c.length,B=D&&0===c.length;/* @__PURE__ */
15
- return t.createElement(N,{className:q("h-full",m)},/* @__PURE__ */t.createElement(w,{className:"p-4 lg:p-8 h-full"},/* @__PURE__ */t.createElement("div",{ref:R,className:"grid xs:max-lg:grid-cols-1 lg:grid-cols-[1fr_4fr] gap-6 min-h-96 h-full",style:{[Q]:"100px"},...S},
13
+ return e.createElement("div",{ref:A,className:$("flex flex-col gap-4",f),...g},/* @__PURE__ */e.createElement(W,{title:t,breadcrumb:y,onOpenArticleLink:x,currentArticleIndex:s,totalArticles:o,displayTotalArticles:d,onNextArticle:m,onPreviousArticle:p}),/* @__PURE__ */e.createElement(_,{isNew:n,isAccepted:l,suggestionsCount:r,sourceIcon:c,sourceDescription:a,onSourceLinkClick:w,showActionButtons:u,suggestionReasonBody:k,hideAcceptAndPublishPublic:C,pendingAction:I,onAcceptAndPublish:E,onRejectAll:R,onAcceptAll:L,onAcceptAndPublishAction:z}))});function H(e){const t=e.querySelectorAll("del + ins"),n=e.querySelectorAll("ins:not(del + ins)"),l=e.querySelectorAll("del"),r=Array.from(l).filter(e=>"INS"!==e.nextElementSibling?.tagName);return t.length+n.length+r.length}function J({diffTitle:e,items:a,isLoading:s,totalItemsCount:o,showActionButtons:d=!0,children:m,sourceIcon:p,sourceDescription:f}){const{selectedItem:g,setSelectedItem:A,loadedDiffDoc:h,loadingDiff:b}=i(),C=a.length>0,I=s??!C,P=I&&!C,S=!I&&!C,j=b?"":u(h?.diffTitle??e??""),R=b?/* @__PURE__ */t.createElement("div",{className:"text-muted-foreground"},"Loading diff…"):h?.diffContent,L=b?0:(z=h?.diffTitle??e)&&"undefined"!=typeof DOMParser?H((new DOMParser).parseFromString(z,"text/html")):0;var z;const D=r(null),[B,O]=c(0);l(()=>{if(b||!h)return void O(0);const e=D.current;if(!e)return;const t=requestAnimationFrame(()=>{var t;O((t=e)?H(t):0)});return()=>cancelAnimationFrame(t)},[b,h]);const T=L+B,q=a.length,F=o??q,$=g?Math.max(0,a.findIndex(e=>e.id===g.id)):0,M=n(()=>{$<q-1&&A(a[$+1]??null)},[$,a,A,q]),W=n(()=>{$>0&&A(a[$-1]??null)},[$,a,A]),_=g?a.find(e=>e.id===g.id)??g:null,G=_?.icon??p,J=_?.description??f,Q=_?.isAccepted??!1;/* @__PURE__ */
14
+ return t.createElement(N,{className:"py-6 pl-4","data-name":"knowledge-reviews"},/* @__PURE__ */t.createElement(y,{className:"h-[calc(var(--knowledge-review-scroll-height)-50px)] pr-8"},/* @__PURE__ */t.createElement(v,{className:"p-0"},C&&/* @__PURE__ */t.createElement(x,{className:"border-b border-dark-300 mb-6 pb-2 font-normal"},/* @__PURE__ */t.createElement(K,{title:j,isNew:h?.isNew??!1,isAccepted:Q,suggestionsCount:T,sourceIcon:G,sourceDescription:J,currentArticleIndex:$,totalArticles:q,displayTotalArticles:F,showActionButtons:d,onNextArticle:M,onPreviousArticle:W}))),/* @__PURE__ */t.createElement(w,{className:"p-0 [&_ol]:!pl-16 [&_ul]:!pl-16"},/* @__PURE__ */t.createElement("div",{"aria-hidden":"true",className:"sr-only",hidden:!0},m),P?/* @__PURE__ */t.createElement("div",{className:"flex flex-col items-center justify-center gap-4 text-center h-[50dvh] text-muted-foreground"},/* @__PURE__ */t.createElement(k,{className:"size-8"}),/* @__PURE__ */t.createElement("p",{className:"text-base font-medium"},"Loading suggestions...")):S?/* @__PURE__ */t.createElement("div",{className:"flex flex-col items-center justify-center gap-4 text-center h-[50dvh]"},/* @__PURE__ */t.createElement(E,{className:"text-muted-foreground",size:32,weight:"fill"}),/* @__PURE__ */t.createElement("p",{className:"text-base font-medium text-foreground"},"All up to date. Well done, mate.")):/* @__PURE__ */t.createElement("div",{ref:D,className:"pl-12"},R))))}const Q="--knowledge-review-scroll-height",U=t.forwardRef(function({diffTitle:e="Knowledge Review",children:n,items:c,isLoading:s,totalItemsCount:o,showActionButtons:u=!0,className:m,onApproveAllSuggestions:p,onRejectAllSuggestions:f,onOpenArticleLink:g,onAcceptAndPublish:A,onApplyAllInEditor:h,onRejectAllInEditor:b,onSourceLinkClick:E,breadcrumb:v,sourceIcon:x,sourceDescription:C,suggestionReasonBody:I,hideAcceptAndPublishPublic:P,...S},j){const R=r(null),{selectedItem:L,setSelectedItem:z}=i();a(j,()=>({selectedItem:L,setSelectedItem:z}),[L,z]),l(()=>{const e=R.current;if(!e)return;const t=()=>{const{height:t}=e.getBoundingClientRect();e.style.setProperty(Q,`${t}px`)};if(t(),"function"!=typeof ResizeObserver)return;const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);const D=s??0===c.length,B=D&&0===c.length;/* @__PURE__ */
15
+ return t.createElement(N,{className:$("h-full",m)},/* @__PURE__ */t.createElement(w,{className:"p-4 lg:p-8 h-full"},/* @__PURE__ */t.createElement("div",{ref:R,className:"grid xs:max-lg:grid-cols-1 lg:grid-cols-[1fr_4fr] gap-6 min-h-96 h-full",style:{[Q]:"100px"},...S},
16
16
  /* @__PURE__ */t.createElement(y,{className:"h-[calc(var(--knowledge-review-scroll-height))] min-w-80 lg:block hidden"},B?/* @__PURE__ */t.createElement("div",{className:"flex h-full min-h-96 items-center justify-center text-muted-foreground"},/* @__PURE__ */t.createElement(k,{className:"size-6"})):/* @__PURE__ */t.createElement(d,{items:c})),
17
17
  /* @__PURE__ */t.createElement(J,{diffTitle:e,items:c,isLoading:D,totalItemsCount:o,showActionButtons:u,sourceIcon:x,sourceDescription:C},n))))}),V=t.forwardRef(function(e,n){const{items:l,onApproveAllSuggestions:r,onRejectAllSuggestions:c,onAcceptAndPublish:a,onApplyAllInEditor:i,onRejectAllInEditor:s,onOpenArticleLink:d,onSourceLinkClick:u,breadcrumb:m,suggestionReasonBody:p,hideAcceptAndPublishPublic:f}=e;/* @__PURE__ */
18
18
  return t.createElement(o,{defaultSelectedItem:l.find(e=>e.isSelected)??null,onApproveAllSuggestions:r,onRejectAllSuggestions:c,onAcceptAndPublish:a,onApplyAllInEditor:i,onRejectAllInEditor:s,onOpenArticleLink:d,onSourceLinkClick:u,breadcrumb:m,suggestionReasonBody:p,hideAcceptAndPublishPublic:f},
package/dist/index.d.ts CHANGED
@@ -186,6 +186,8 @@ declare enum ActionType {
186
186
  LaunchZendeskSunshineChat = "launch_zendesk_sunshine_chat"
187
187
  }
188
188
 
189
+ export declare type ActivityBlock = ThinkingBlock | ToolUseBlock | ToolResultBlock;
190
+
189
191
  declare type AddActionButtons = {
190
192
  type: typeof AnswersActions.ADD_ACTION_BUTTONS;
191
193
  payload: {
@@ -975,7 +977,7 @@ declare namespace Compounds {
975
977
  }
976
978
  }
977
979
 
978
- export declare type ContentBlock = TextBlock | AttachmentBlock;
980
+ export declare type ContentBlock = TextBlock | AttachmentBlock | ActivityBlock;
979
981
 
980
982
  declare type ContextPill = {
981
983
  id: string;
@@ -1107,7 +1109,7 @@ export declare const ConversationStatus: ({ className, children, variant, }: Con
1107
1109
  declare interface ConversationStatusProps_2 {
1108
1110
  className?: string;
1109
1111
  children?: default_2.ReactNode;
1110
- variant?: 'yellowfin' | 'dark' | 'dark-subtle';
1112
+ variant?: SweepTextVariant;
1111
1113
  }
1112
1114
 
1113
1115
  export declare const ConversationSuggestions: ({ items, className }: ConversationSuggestionsProps_2) => default_2.JSX.Element | null;
@@ -1537,6 +1539,21 @@ declare type GetActionInputs = {
1537
1539
  */
1538
1540
  export declare const getCachedFonts: () => FontOption[] | null;
1539
1541
 
1542
+ /**
1543
+ * Derive the live status label from a message's latest content block, or `null`
1544
+ * when no status should be shown.
1545
+ *
1546
+ * The status reflects only the most recent activity ("latest only"): a tool
1547
+ * call shows its mapped label, thinking shows "Thinking", and a tool result
1548
+ * keeps the originating tool's label so it doesn't flicker to generic between
1549
+ * the result arriving and the next block.
1550
+ *
1551
+ * It is shown before the first answer text and while tools/thinking are in
1552
+ * flight, but hidden once answer text is actively streaming — returning `null`
1553
+ * when the latest block is a text block that already has content.
1554
+ */
1555
+ export declare function getConversationStatusLabel(message: Message): string | null;
1556
+
1540
1557
  declare function Header(props: ComponentProps<typeof HeaderNav>): default_2.JSX.Element | null;
1541
1558
 
1542
1559
  declare namespace Header {
@@ -1950,6 +1967,26 @@ declare namespace RightSidebar {
1950
1967
  var displayName: string;
1951
1968
  }
1952
1969
 
1970
+ export declare function Ripple({ className, colored, ...props }: RippleProps): default_2.JSX.Element;
1971
+
1972
+ export declare interface RippleProps extends default_2.SVGAttributes<SVGSVGElement> {
1973
+ colored?: boolean;
1974
+ }
1975
+
1976
+ /**
1977
+ * Presentational loading status: an animated ripple glyph alongside shimmer
1978
+ * status text that cross-fades whenever the text changes. Purely presentational
1979
+ * — callers populate `text` with their own logic.
1980
+ */
1981
+ export declare function RippleStatus({ text, className, variant }: RippleStatusProps): default_2.JSX.Element;
1982
+
1983
+ export declare interface RippleStatusProps {
1984
+ /** The status text to display. Each caller supplies its own. */
1985
+ text: string;
1986
+ className?: string;
1987
+ variant?: SweepTextVariant;
1988
+ }
1989
+
1953
1990
  export declare const ScrollArea: React_2.ForwardRefExoticComponent<Omit<ScrollAreaPrimitive.ScrollAreaProps & React_2.RefAttributes<HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;
1954
1991
 
1955
1992
  export declare const ScrollBar: React_2.ForwardRefExoticComponent<Omit<ScrollAreaPrimitive.ScrollAreaScrollbarProps & React_2.RefAttributes<HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;
@@ -2266,6 +2303,21 @@ export declare interface SuggestionCardSource {
2266
2303
  icon?: React_2.ReactNode;
2267
2304
  }
2268
2305
 
2306
+ /** Shimmer/sweep status text. The animated gradient sweeps across the text. */
2307
+ export declare const SweepText: ({ className, children, variant }: SweepTextProps) => default_2.JSX.Element;
2308
+
2309
+ export declare interface SweepTextProps {
2310
+ className?: string;
2311
+ children?: default_2.ReactNode;
2312
+ variant?: SweepTextVariant;
2313
+ }
2314
+
2315
+ export declare type SweepTextVariant = NonNullable<VariantProps<typeof sweepTextVariants>['variant']>;
2316
+
2317
+ declare const sweepTextVariants: (props?: ({
2318
+ variant?: "dark" | "yellowfin" | "dark-subtle" | null | undefined;
2319
+ } & ClassProp) | undefined) => string;
2320
+
2269
2321
  export declare const Switch: React_2.ForwardRefExoticComponent<Omit<SwitchPrimitives.SwitchProps & React_2.RefAttributes<HTMLButtonElement>, "ref"> & React_2.RefAttributes<HTMLButtonElement>>;
2270
2322
 
2271
2323
  export declare const Table: React_2.ForwardRefExoticComponent<React_2.HTMLAttributes<HTMLTableElement> & React_2.RefAttributes<HTMLTableElement>>;
@@ -2316,6 +2368,17 @@ declare interface TextConfig {
2316
2368
  uncertaintyFallbackText?: Record<string, string>;
2317
2369
  }
2318
2370
 
2371
+ export declare type ThinkingBlock = {
2372
+ type: 'thinking';
2373
+ thinking: string;
2374
+ };
2375
+
2376
+ export declare type ToolResultBlock = {
2377
+ type: 'tool_result';
2378
+ toolUseId: string;
2379
+ content: string;
2380
+ };
2381
+
2319
2382
  export declare const Tooltip: React_2.FC<TooltipPrimitive.TooltipProps>;
2320
2383
 
2321
2384
  export declare const TooltipContent: React_2.ForwardRefExoticComponent<TooltipContentProps & React_2.RefAttributes<HTMLDivElement>>;
@@ -2328,6 +2391,14 @@ export declare const TooltipProvider: ({ delayDuration, ...props }: TooltipPrimi
2328
2391
 
2329
2392
  export declare const TooltipTrigger: React_2.ForwardRefExoticComponent<TooltipPrimitive.TooltipTriggerProps & React_2.RefAttributes<HTMLButtonElement>>;
2330
2393
 
2394
+ /** A tool invocation. `input` holds the raw (possibly partial) JSON arguments string. */
2395
+ export declare type ToolUseBlock = {
2396
+ type: 'tool_use';
2397
+ id: string;
2398
+ name: string;
2399
+ input: string;
2400
+ };
2401
+
2331
2402
  export declare enum Trend {
2332
2403
  UP = "up",
2333
2404
  DOWN = "down",
@@ -2373,6 +2444,31 @@ declare type UrlString = string & {
2373
2444
  __url: never;
2374
2445
  };
2375
2446
 
2447
+ /**
2448
+ * Gives an indication of query usage in the platform.
2449
+ *
2450
+ * A pill button for the top navigation bar that shows the team's monthly usage
2451
+ * usage percentage. At ≥80% it renders in warning (yellow) state; at 100% in
2452
+ * reached (red) state. Clicking it opens a dropdown with links to the plan and
2453
+ * billing settings pages.
2454
+ */
2455
+ export declare function UsageIndicatorPill({ percentage, label, status, onViewPlan, onViewBilling, }: UsageIndicatorPillProps): React_2.JSX.Element;
2456
+
2457
+ export declare interface UsageIndicatorPillProps {
2458
+ /** Current usage as a percentage 0–100 */
2459
+ percentage: number;
2460
+ /** Name of the usage metric being displayed */
2461
+ label?: string;
2462
+ /** Visual state of the pill */
2463
+ status: UsageIndicatorStatus;
2464
+ /** Called when the user selects "View plan" */
2465
+ onViewPlan?: () => void;
2466
+ /** Called when the user selects "View billing settings" */
2467
+ onViewBilling?: () => void;
2468
+ }
2469
+
2470
+ export declare type UsageIndicatorStatus = 'warning' | 'reached';
2471
+
2376
2472
  export declare const useChatSearch: () => ChatSearchContextProps;
2377
2473
 
2378
2474
  export declare function useConversation(): ConversationContextValue;