@brainfish-ai/components 0.28.11 → 0.28.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brainfish-ai/components",
3
- "version": "0.28.11",
3
+ "version": "0.28.12",
4
4
  "description": "Brainfish Components",
5
5
  "license": "MIT",
6
6
  "main": "./dist/esm/index.js",
@@ -115,6 +115,7 @@ const preset: Partial<Config> = {
115
115
  surface: 'var(--bfc-white)',
116
116
  },
117
117
  borderColor: {
118
+ primary: 'var(--bfc-dark)',
118
119
  success: 'var(--bfc-success-border)',
119
120
  destructive: 'var(--bfc-destructive-border)',
120
121
  warning: 'var(--bfc-warning-border)',
@@ -1,16 +0,0 @@
1
- import*as e from"react";import t,{useState as a,useCallback as l,useMemo as s,useContext as n,createContext as r,forwardRef as i}from"react";import{Circle as c,CheckCircle as o,XCircle as m,CaretUp as d,CaretDown as u}from"@phosphor-icons/react";import{c as p}from"./utils.C6Qu-kwd.js";import{b as f}from"./formatDate.D2xEZm8f.js";import{S as x}from"./status-badge.BLB0pWDn.js";import{B as b,a as g}from"./button.D_2SonNs.js";import{ScrollArea as E}from"../components/ui/scroll-area.js";function h({count:e}){/* @__PURE__ */
2
- return t.createElement("span",{className:"inline-flex items-center gap-0.5"},/* @__PURE__ */t.createElement(c,{size:8,weight:"fill","aria-hidden":"true",className:"text-blue"}),/* @__PURE__ */t.createElement("span",{className:"text-xs leading-4 text-subtle"},e," ",1===e?"edit":"edits"))}const N=e.forwardRef(function({title:t,timestamp:a,icon:l,description:s,isNew:n,isAccepted:r,editCount:i,isSelected:c=!1,className:o,...m},d){let u;return r?u=/* @__PURE__ */e.createElement(x,{variant:"accepted"},"Accepted"):i&&(u=/* @__PURE__ */e.createElement(h,{count:i})),/* @__PURE__ */e.createElement("button",{...m,ref:d,type:"button","aria-pressed":c,className:p("relative flex w-full flex-col gap-1 bg-surface rounded p-4 cursor-pointer transition-colors text-left border border-transparent",c?["shadow-[0px_1px_3px_0px_rgba(95,95,95,0.26)]",'after:content-[""] after:block after:absolute after:right-[-2px] after:top-1/2 after:-translate-y-1/2 after:w-1 after:h-14 after:rounded-sm after:bg-primary']:"hover:bg-dark-100 hover:border-dark-300",o)},
3
- /* @__PURE__ */e.createElement("span",{className:"flex items-center justify-between w-full gap-2"},/* @__PURE__ */e.createElement("span",{className:p("text-sm text-default truncate min-w-0 flex-1",c?"font-bold":"font-normal")},t),a&&/* @__PURE__ */e.createElement("span",{className:"text-xs leading-4 text-subtlest shrink-0"},f(a))),(l||s||u)&&/* @__PURE__ */e.createElement("span",{className:"flex items-center gap-1 leading-4"},n&&/* @__PURE__ */e.createElement(x,{variant:"success",surface:"transparent"},"New"),l&&/* @__PURE__ */e.createElement("span",{className:"shrink-0 flex items-center"},l),s&&/* @__PURE__ */e.createElement("span",{className:"text-xs text-subtle truncate"},s),!n&&u&&/* @__PURE__ */e.createElement("span",{className:"shrink-0 ml-1 flex items-center"},u)))}),v=r(null);function w({children:e,defaultSelectedItem:n=null,onApproveAllSuggestions:r,onRejectAllSuggestions:i,onAcceptAndPublish:c,onApplyAllInEditor:o,onRejectAllInEditor:m,onOpenArticleLink:d,onSourceLinkClick:u,breadcrumb:p,suggestionReasonBody:f,hideAcceptAndPublishPublic:x=!1}){const[b,g]=a(null),E=b??n,[h,N]=a(null),[w,k]=a(!1),A=l(e=>g(e),[]),y=s(()=>({selectedItem:E,setSelectedItem:A,loadedDiffDoc:h,setLoadedDiffDoc:N,loadingDiff:w,setLoadingDiff:k,onApproveAllSuggestions:r,onRejectAllSuggestions:i,onAcceptAndPublish:c,onApplyAllInEditor:o,onRejectAllInEditor:m,onOpenArticleLink:d,onSourceLinkClick:u,breadcrumb:p,suggestionReasonBody:f,hideAcceptAndPublishPublic:x}),[E,A,h,w,r,i,c,o,m,d,u,p,f,x]);/* @__PURE__ */
4
- return t.createElement(v.Provider,{value:y},e)}function k(){const e=n(v);if(!e)throw new Error("useReviewsSelection must be used within ReviewsSelectionProvider");return e}const A=i(({items:e,className:a,...l},s)=>{const{selectedItem:n,setSelectedItem:r}=k();/* @__PURE__ */
5
- return t.createElement("ul",{ref:s,className:p("min-w-0 w-full overflow-hidden bg-muted border border-dark-300 rounded-lg p-2 space-y-2 list-none m-0",a),...l},e.map(e=>/* @__PURE__ */t.createElement("li",{key:e.id},/* @__PURE__ */t.createElement(N,{...e,isSelected:n?.id===e.id,onClick:()=>r(e)}))))});A.displayName="ReviewList";const y=e.forwardRef(function({source:t,diff:a,reason:l,onAccept:s,onReject:n,acceptDisabled:r,rejectDisabled:i,pagination:c,className:d,readOnly:u,...f},x){const h=r||!s,N=i||!n,v=Boolean(a&&a.oldText&&a.newText);/* @__PURE__ */
6
- return e.createElement("div",{ref:x,role:"group","aria-label":"Review suggestion",className:p("!grid max-h-[calc(var(--knowledge-review-scroll-height)-250px)] w-full grid-rows-[auto_minmax(0,1fr)_auto] items-stretch gap-4 rounded-lg bg-surface p-4 border shadow-md dark:shadow-brand-dark",d),...f},
7
- /* @__PURE__ */e.createElement("div",{className:"flex min-w-0 flex-col justify-start gap-1"},t&&/* @__PURE__ */e.createElement(e.Fragment,null,/* @__PURE__ */e.createElement("span",{className:"text-xs font-bold uppercase leading-4 text-default"},t.label),/* @__PURE__ */e.createElement("div",{className:"flex items-center gap-0.5 [&_svg]:size-4 [&_svg]:shrink-0"},/* @__PURE__ */e.createElement("span",{className:"flex items-center text-subtle","aria-hidden":"true"},t.icon),/* @__PURE__ */e.createElement("span",{className:"text-sm leading-4 text-subtle break-all"},t.name)))),
8
- /* @__PURE__ */e.createElement("div",{className:"flex min-w-0 min-h-0 items-stretch gap-2"},/* @__PURE__ */e.createElement(E,{className:"-mr-2 min-h-0 flex-1 pr-2"},/* @__PURE__ */e.createElement("div",{className:"flex w-full flex-col"},/* @__PURE__ */e.createElement("span",{className:"text-xs font-bold uppercase leading-4 text-default"},"Why"),l&&/* @__PURE__ */e.createElement("span",{className:"text-sm leading-4 text-default"},l),v&&/* @__PURE__ */e.createElement(R,{oldText:a?.oldText,newText:a?.newText}))),c&&c.totalCount>1&&/* @__PURE__ */e.createElement(S,{...c})),
9
- /* @__PURE__ */e.createElement("div",{className:"flex min-w-0 items-end"},!u&&/* @__PURE__ */e.createElement("div",{className:"flex shrink-0 items-center gap-2"},!h&&/* @__PURE__ */e.createElement(b,{type:"button",variant:"default",elevation:"shadow",size:"icon",onClick:s,"aria-label":"Accept suggestion",className:p("rounded-md border-border bg-green-400 text-default",g)},
10
- /* @__PURE__ */e.createElement(o,{weight:"regular","aria-hidden":"true"})),!N&&/* @__PURE__ */e.createElement(b,{type:"button",variant:"destructive",elevation:"shadow",size:"icon",onClick:n,"aria-label":"Reject suggestion",className:p("rounded-md border-border bg-red-400 text-default",g)},
11
- /* @__PURE__ */e.createElement(m,{weight:"regular","aria-hidden":"true"})))))});function R({oldText:t,newText:a}){/* @__PURE__ */
12
- return e.createElement("div",{className:"flex flex-col items-baseline gap-2 border-t border-dark-300 py-4 text-sm leading-4 mt-4"},t&&/* @__PURE__ */e.createElement("div",{className:"text-destructive"},/* @__PURE__ */e.createElement("span",{className:"font-bold"},"Replace: "),/* @__PURE__ */e.createElement("span",null,t)),a&&/* @__PURE__ */e.createElement("div",{className:"text-blue"},/* @__PURE__ */e.createElement("span",{className:"font-bold"},"With: "),/* @__PURE__ */e.createElement("span",null,a)))}function S({currentIndex:t,totalCount:a,onPrevious:l,onNext:s}){const n=t>1&&!!l,r=t<a&&!!s;/* @__PURE__ */
13
- return e.createElement("div",{className:"flex w-10 shrink-0 flex-col items-center justify-center self-stretch py-2 pl-3"},/* @__PURE__ */e.createElement("div",{className:"flex flex-col items-center gap-0.5"},/* @__PURE__ */e.createElement(b,{type:"button",variant:"ghost",size:"icon",onClick:l,disabled:!n,"aria-label":"Previous suggestion",className:"text-subtlest disabled:invisible"},
14
- /* @__PURE__ */e.createElement(d,{"aria-hidden":"true",className:"size-3.5"})),/* @__PURE__ */e.createElement("span",{className:"text-xs leading-4 text-subtlest tabular-nums","aria-hidden":"true"},t,"/",a),/* @__PURE__ */e.createElement("span",{className:"sr-only","aria-live":"polite"},"Suggestion ",t," of ",a),/* @__PURE__ */e.createElement(b,{type:"button",variant:"ghost",size:"icon",onClick:s,disabled:!r,"aria-label":"Next suggestion",className:"text-subtlest disabled:invisible"},
15
- /* @__PURE__ */e.createElement(u,{"aria-hidden":"true",className:"size-3.5"}))))}export{h as E,A as R,y as S,N as a,w as b,k as u};
16
- //# sourceMappingURL=suggestion-card.DAwWcW7V.js.map