@brainfish-ai/components 0.23.10 → 0.23.13

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/dist/index.d.ts CHANGED
@@ -5,6 +5,11 @@ import { ClassProp } from 'class-variance-authority/types';
5
5
  import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
6
6
  import { ColumnDef } from '@tanstack/react-table';
7
7
  import { ComponentProps } from 'react';
8
+ import { ConversationActionsProps } from './ConversationActions';
9
+ import { ConversationInputProps } from './ConversationInput';
10
+ import { ConversationLoadingProps } from './ConversationLoading';
11
+ import { ConversationMessagesProps } from './ConversationMessages';
12
+ import { ConversationSuggestionsProps } from './ConversationSuggestions';
8
13
  import { DayPicker } from 'react-day-picker';
9
14
  import { default as default_2 } from 'react';
10
15
  import * as DialogPrimitive from '@radix-ui/react-dialog';
@@ -129,6 +134,11 @@ declare type ActionButtonsBlock = {
129
134
  type: 'action-buttons';
130
135
  };
131
136
 
137
+ export declare type ActionButtonsPart = {
138
+ type: 'action-buttons';
139
+ actions: ConversationAction[];
140
+ };
141
+
132
142
  declare type ActionInput = {
133
143
  name: string;
134
144
  required: boolean;
@@ -347,9 +357,31 @@ declare type AppendNewAnswer = {
347
357
  export declare interface ArticleNavItem extends Omit<SidebarNavItem, 'Icon' | 'items'> {
348
358
  status?: 'discovery' | 'unpublished' | 'draft';
349
359
  hasChildren?: boolean;
360
+ isLoadingChildren?: boolean;
350
361
  items?: ArticleNavItem[];
351
362
  }
352
363
 
364
+ export declare type Attachment = {
365
+ id: string;
366
+ type: 'image' | 'file';
367
+ name: string;
368
+ url: string;
369
+ file?: File;
370
+ };
371
+
372
+ export declare type AttachmentAction = {
373
+ type: 'select-collection';
374
+ collection: Collection_2;
375
+ } | {
376
+ type: 'attach-tab';
377
+ } | {
378
+ type: 'screenshot';
379
+ } | {
380
+ type: 'record-video';
381
+ } | {
382
+ type: 'add-file';
383
+ };
384
+
353
385
  declare type AttachmentType = 'image' | 'file';
354
386
 
355
387
  export declare function Avatar({ className, size, ...props }: React_2.ComponentProps<typeof AvatarPrimitive.Root> & {
@@ -626,7 +658,7 @@ export declare interface ChatSearchHandle {
626
658
  }
627
659
 
628
660
  export declare interface ChatSearchProps {
629
- suggestions?: Suggestion[];
661
+ suggestions?: Suggestion_2[];
630
662
  collections?: Array<Collection>;
631
663
  selectedCollectionId?: string;
632
664
  onCollectionChange?: (collectionId: string) => void;
@@ -695,6 +727,18 @@ export declare interface ChatSearchState {
695
727
  error?: string;
696
728
  }
697
729
 
730
+ export declare type Citation = {
731
+ id: string;
732
+ index: number;
733
+ title: string;
734
+ url: string;
735
+ };
736
+
737
+ export declare type CitationPart = {
738
+ type: 'citation';
739
+ citations: Citation[];
740
+ };
741
+
698
742
  declare type ClearAll = {
699
743
  type: typeof AnswersActions.CLEAR_ALL;
700
744
  };
@@ -726,6 +770,11 @@ export declare interface Collection {
726
770
  siteEnabled?: boolean;
727
771
  }
728
772
 
773
+ declare type Collection_2 = {
774
+ id: string;
775
+ label: string;
776
+ };
777
+
729
778
  export declare function Combobox<T extends ComboboxItem = ComboboxItem>({ options, defaultValueLabel, placeholder, noResultsLabel, className, onOpenChange, onChange, dropdownWidth, value: controlledValue, disabled, renderItem, renderValue, renderTrigger, }: ComboboxProps<T>): React_2.JSX.Element;
730
779
 
731
780
  export declare interface ComboboxItem {
@@ -871,16 +920,139 @@ declare namespace Compounds {
871
920
  }
872
921
  }
873
922
 
923
+ export declare type ContextPill = {
924
+ id: string;
925
+ label: string;
926
+ icon?: string;
927
+ };
928
+
929
+ export declare const ContextPillBadge: ({ pill, onRemove }: ContextPillBadgeProps) => default_2.JSX.Element;
930
+
931
+ declare interface ContextPillBadgeProps {
932
+ pill: ContextPill;
933
+ onRemove?: (pill: ContextPill) => void;
934
+ }
935
+
936
+ export declare const Conversation: (({ messages, callbacks, children, suggestions, actions, placeholder, attachments, collections, contextPills, showBranding, className, }: ConversationProps) => default_2.JSX.Element) & {
937
+ Messages: ({ className, bottomPadding, onContentBehind }: ConversationMessagesProps) => default_2.JSX.Element;
938
+ Input: ({ placeholder, attachments, collections, contextPills, disabled, isElevated, className, }: ConversationInputProps) => default_2.JSX.Element;
939
+ Suggestions: ({ items, className }: ConversationSuggestionsProps) => default_2.JSX.Element | null;
940
+ Actions: ({ actions, onActionClick, className }: ConversationActionsProps) => default_2.JSX.Element | null;
941
+ Loading: ({ className }: ConversationLoadingProps) => default_2.JSX.Element;
942
+ };
943
+
944
+ export declare type ConversationAction = {
945
+ id: string;
946
+ label: string;
947
+ icon?: string;
948
+ description?: string;
949
+ };
950
+
951
+ export declare const ConversationActions: ({ actions, onActionClick, className }: ConversationActionsProps_2) => default_2.JSX.Element | null;
952
+
953
+ declare interface ConversationActionsProps_2 {
954
+ actions: ConversationAction[];
955
+ onActionClick?: (action: ConversationAction) => void;
956
+ className?: string;
957
+ }
958
+
959
+ export declare type ConversationCallbacks = {
960
+ onSend?: (text: string, attachments?: Attachment[]) => void;
961
+ onStop?: () => void;
962
+ onSuggestionClick?: (suggestion: Suggestion) => void;
963
+ onActionClick?: (action: ConversationAction, messageId: string) => void;
964
+ onFeedback?: (messageId: string, feedback: 'positive' | 'negative') => void;
965
+ onCitationClick?: (citation: Citation) => void;
966
+ onAttachmentAction?: (action: AttachmentAction) => void;
967
+ onContextPillRemove?: (pill: ContextPill) => void;
968
+ onCopy?: (messageId: string, content: string) => void;
969
+ };
970
+
874
971
  export declare type ConversationContext = {
875
972
  conversationId?: string;
876
973
  messages: ConversationMessage[];
877
974
  };
878
975
 
976
+ export declare interface ConversationContextValue {
977
+ messages: Message[];
978
+ callbacks: ConversationCallbacks;
979
+ isStreaming: boolean;
980
+ }
981
+
982
+ export declare const ConversationInput: ({ placeholder, attachments, collections, contextPills, disabled, isElevated, className, }: ConversationInputProps_2) => default_2.JSX.Element;
983
+
984
+ declare interface ConversationInputProps_2 {
985
+ placeholder?: string;
986
+ attachments?: Attachment[];
987
+ collections?: Collection_2[];
988
+ contextPills?: ContextPill[];
989
+ disabled?: boolean;
990
+ isElevated?: boolean;
991
+ className?: string;
992
+ }
993
+
994
+ export declare const ConversationLoading: ({ className }: ConversationLoadingProps_2) => default_2.JSX.Element;
995
+
996
+ declare interface ConversationLoadingProps_2 {
997
+ className?: string;
998
+ }
999
+
879
1000
  export declare type ConversationMessage = {
880
1001
  question: string;
881
1002
  answer: string;
882
1003
  };
883
1004
 
1005
+ export declare const ConversationMessageAssistant: ({ message, className }: ConversationMessageAssistantProps) => default_2.JSX.Element;
1006
+
1007
+ declare interface ConversationMessageAssistantProps {
1008
+ message: Message;
1009
+ className?: string;
1010
+ }
1011
+
1012
+ export declare const ConversationMessages: ({ className, bottomPadding, onContentBehind }: ConversationMessagesProps_2) => default_2.JSX.Element;
1013
+
1014
+ declare interface ConversationMessagesProps_2 {
1015
+ className?: string;
1016
+ bottomPadding?: number;
1017
+ onContentBehind?: (isBehind: boolean) => void;
1018
+ }
1019
+
1020
+ export declare const ConversationMessageUser: ({ message, className }: ConversationMessageUserProps) => default_2.JSX.Element;
1021
+
1022
+ declare interface ConversationMessageUserProps {
1023
+ message: Message;
1024
+ className?: string;
1025
+ }
1026
+
1027
+ declare interface ConversationProps {
1028
+ messages: Message[];
1029
+ callbacks: ConversationCallbacks;
1030
+ children?: ReactNode;
1031
+ suggestions?: Suggestion[];
1032
+ actions?: ConversationAction[];
1033
+ placeholder?: string;
1034
+ attachments?: Attachment[];
1035
+ collections?: Collection_2[];
1036
+ contextPills?: ContextPill[];
1037
+ showBranding?: boolean;
1038
+ className?: string;
1039
+ }
1040
+
1041
+ export declare function ConversationProvider({ messages, callbacks, children }: ConversationProviderProps): default_2.JSX.Element;
1042
+
1043
+ declare interface ConversationProviderProps {
1044
+ messages: Message[];
1045
+ callbacks: ConversationCallbacks;
1046
+ children: default_2.ReactNode;
1047
+ }
1048
+
1049
+ export declare const ConversationSuggestions: ({ items, className }: ConversationSuggestionsProps_2) => default_2.JSX.Element | null;
1050
+
1051
+ declare interface ConversationSuggestionsProps_2 {
1052
+ items: Suggestion[];
1053
+ className?: string;
1054
+ }
1055
+
884
1056
  export declare function DataTable<TData extends Record<string, any> & {
885
1057
  id?: string | number;
886
1058
  }, TValue>({ columns, data, getRowCanExpand, className, expandeRowClassName, isLoading, skeletonRowCount, ...props }: DataTableProps<TData, TValue>): default_2.JSX.Element;
@@ -1155,7 +1327,9 @@ export declare const formatFileSize: (bytes: number) => string;
1155
1327
 
1156
1328
  export declare const FormattedMessage: FC<Props>;
1157
1329
 
1158
- export declare const FullLayout: typeof FullLayoutWithFlags & {
1330
+ export declare const FullLayout: FullLayoutCompound;
1331
+
1332
+ declare type FullLayoutCompound = typeof FullLayoutWithFlags & {
1159
1333
  MainArea: typeof Compounds.MainArea;
1160
1334
  Body: typeof Compounds.Body;
1161
1335
  Header: typeof Compounds.Header;
@@ -1183,6 +1357,8 @@ export declare interface FullLayoutContextValue {
1183
1357
  ariaValuenow: number;
1184
1358
  ariaValuemin: number;
1185
1359
  ariaValuemax: number;
1360
+ /** Mirrors `FullLayout` prop; `FullLayout.Main` uses it for viewport height when Radix ScrollArea is off. */
1361
+ disableMainScrollArea: boolean;
1186
1362
  }
1187
1363
 
1188
1364
  export declare const FullLayoutHeader: default_2.ForwardRefExoticComponent<FullLayoutHeaderProps & default_2.RefAttributes<HTMLElement>>;
@@ -1236,6 +1412,8 @@ export declare interface FullLayoutRightSidebarProps extends Omit<default_2.Comp
1236
1412
  export declare interface FullLayoutRootProps {
1237
1413
  children?: default_2.ReactNode;
1238
1414
  disableLeftSideNav?: boolean;
1415
+ /** When true, main column uses a plain div (no Radix ScrollArea); viewport height is applied on `FullLayout.Main`. */
1416
+ disableMainScrollArea?: boolean;
1239
1417
  className?: string;
1240
1418
  }
1241
1419
 
@@ -1287,6 +1465,12 @@ declare interface HeaderNavProps extends React_2.ComponentPropsWithoutRef<'heade
1287
1465
 
1288
1466
  export declare const Icon: default_2.ForwardRefExoticComponent<Omit<PhosphorIconProps, "ref"> & default_2.RefAttributes<SVGSVGElement>>;
1289
1467
 
1468
+ export declare type ImagePart = {
1469
+ type: 'image';
1470
+ url: string;
1471
+ alt?: string;
1472
+ };
1473
+
1290
1474
  export declare const Input: default_2.ForwardRefExoticComponent<InputProps & default_2.RefAttributes<HTMLInputElement>>;
1291
1475
 
1292
1476
  export declare interface InputProps extends default_2.InputHTMLAttributes<HTMLInputElement> {
@@ -1394,8 +1578,9 @@ export declare interface LogoProps extends React_2.SVGProps<SVGSVGElement> {
1394
1578
 
1395
1579
  export declare type LogoVariant = 'mark' | 'text' | 'full';
1396
1580
 
1397
- declare function Main({ children }: {
1581
+ declare function Main({ children, className }: {
1398
1582
  children?: default_2.ReactNode;
1583
+ className?: string;
1399
1584
  }): default_2.JSX.Element;
1400
1585
 
1401
1586
  declare namespace Main {
@@ -1438,11 +1623,26 @@ declare interface MermaidDiagramProps {
1438
1623
  content: string;
1439
1624
  }
1440
1625
 
1441
- declare type Message = {
1626
+ export declare type Message = {
1627
+ id: string;
1628
+ role: MessageRole;
1629
+ parts: MessagePart[];
1630
+ status: MessageStatus;
1631
+ createdAt?: Date;
1632
+ feedback?: 'positive' | 'negative';
1633
+ };
1634
+
1635
+ declare type Message_2 = {
1442
1636
  content: string;
1443
1637
  uncertaintyFallbackText?: Record<string, string>;
1444
1638
  };
1445
1639
 
1640
+ export declare type MessagePart = TextPart | ImagePart | CitationPart | ToolCallPart | ThinkingPart | ActionButtonsPart;
1641
+
1642
+ export declare type MessageRole = 'user' | 'assistant';
1643
+
1644
+ export declare type MessageStatus = 'pending' | 'streaming' | 'completed' | 'error';
1645
+
1446
1646
  declare type NextBestAction = {
1447
1647
  id?: string;
1448
1648
  label: string;
@@ -1501,7 +1701,7 @@ export declare const Progress: React_2.ForwardRefExoticComponent<Omit<ProgressPr
1501
1701
  } & React_2.RefAttributes<HTMLDivElement>>;
1502
1702
 
1503
1703
  export declare interface Props {
1504
- message: Message;
1704
+ message: Message_2;
1505
1705
  isStreaming?: boolean;
1506
1706
  redirectRules?: RedirectRule[];
1507
1707
  contentTypeEndpoint?: string;
@@ -1747,6 +1947,7 @@ export declare interface SidebarProps extends React_2.ComponentPropsWithoutRef<'
1747
1947
  appNavItems?: SidebarNavItem[];
1748
1948
  appNavActiveId?: string;
1749
1949
  showArticles?: boolean;
1950
+ isLoadingArticles?: boolean;
1750
1951
  articles?: ArticleNavItem[];
1751
1952
  sectionNavItems?: SidebarNavItem[];
1752
1953
  sectionNavActiveId?: string;
@@ -1766,7 +1967,13 @@ export declare interface SimpleSelectProps {
1766
1967
 
1767
1968
  export declare function Spinner({ className, ...props }: default_2.ComponentProps<"svg">): default_2.JSX.Element;
1768
1969
 
1769
- declare interface Suggestion {
1970
+ export declare type Suggestion = {
1971
+ id: string;
1972
+ text: string;
1973
+ icon?: string;
1974
+ };
1975
+
1976
+ declare interface Suggestion_2 {
1770
1977
  id: string;
1771
1978
  question: string;
1772
1979
  conversationId?: string;
@@ -1817,6 +2024,24 @@ declare interface TextConfig {
1817
2024
  uncertaintyFallbackText?: Record<string, string>;
1818
2025
  }
1819
2026
 
2027
+ export declare type TextPart = {
2028
+ type: 'text';
2029
+ text: string;
2030
+ };
2031
+
2032
+ export declare type ThinkingPart = {
2033
+ type: 'thinking';
2034
+ text: string;
2035
+ };
2036
+
2037
+ export declare type ToolCallPart = {
2038
+ type: 'tool-call';
2039
+ toolName: string;
2040
+ status: 'pending' | 'running' | 'completed' | 'error';
2041
+ args?: Record<string, unknown>;
2042
+ result?: string;
2043
+ };
2044
+
1820
2045
  export declare const Tooltip: React_2.FC<TooltipPrimitive.TooltipProps>;
1821
2046
 
1822
2047
  export declare const TooltipContent: React_2.ForwardRefExoticComponent<TooltipContentProps & React_2.RefAttributes<HTMLDivElement>>;
@@ -1878,6 +2103,8 @@ declare type UrlString = string & {
1878
2103
 
1879
2104
  export declare const useChatSearch: () => ChatSearchContextProps;
1880
2105
 
2106
+ export declare function useConversation(): ConversationContextValue;
2107
+
1881
2108
  /**
1882
2109
  * Hook to fetch and manage Google Fonts options
1883
2110
  * Handles caching, loading state, and font stylesheet loading
package/dist/sidebar.d.ts CHANGED
@@ -4,6 +4,7 @@ import * as React_2 from 'react';
4
4
  export declare interface ArticleNavItem extends Omit<SidebarNavItem, 'Icon' | 'items'> {
5
5
  status?: 'discovery' | 'unpublished' | 'draft';
6
6
  hasChildren?: boolean;
7
+ isLoadingChildren?: boolean;
7
8
  items?: ArticleNavItem[];
8
9
  }
9
10
 
@@ -59,6 +60,7 @@ export declare interface SidebarProps extends React_2.ComponentPropsWithoutRef<'
59
60
  appNavItems?: SidebarNavItem[];
60
61
  appNavActiveId?: string;
61
62
  showArticles?: boolean;
63
+ isLoadingArticles?: boolean;
62
64
  articles?: ArticleNavItem[];
63
65
  sectionNavItems?: SidebarNavItem[];
64
66
  sectionNavActiveId?: string;