@brainfish-ai/components 0.23.11 → 0.23.14

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;
@@ -351,6 +361,27 @@ export declare interface ArticleNavItem extends Omit<SidebarNavItem, 'Icon' | 'i
351
361
  items?: ArticleNavItem[];
352
362
  }
353
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
+
354
385
  declare type AttachmentType = 'image' | 'file';
355
386
 
356
387
  export declare function Avatar({ className, size, ...props }: React_2.ComponentProps<typeof AvatarPrimitive.Root> & {
@@ -627,7 +658,7 @@ export declare interface ChatSearchHandle {
627
658
  }
628
659
 
629
660
  export declare interface ChatSearchProps {
630
- suggestions?: Suggestion[];
661
+ suggestions?: Suggestion_2[];
631
662
  collections?: Array<Collection>;
632
663
  selectedCollectionId?: string;
633
664
  onCollectionChange?: (collectionId: string) => void;
@@ -696,6 +727,18 @@ export declare interface ChatSearchState {
696
727
  error?: string;
697
728
  }
698
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
+
699
742
  declare type ClearAll = {
700
743
  type: typeof AnswersActions.CLEAR_ALL;
701
744
  };
@@ -727,6 +770,11 @@ export declare interface Collection {
727
770
  siteEnabled?: boolean;
728
771
  }
729
772
 
773
+ declare type Collection_2 = {
774
+ id: string;
775
+ label: string;
776
+ };
777
+
730
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;
731
779
 
732
780
  export declare interface ComboboxItem {
@@ -872,16 +920,139 @@ declare namespace Compounds {
872
920
  }
873
921
  }
874
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
+
875
971
  export declare type ConversationContext = {
876
972
  conversationId?: string;
877
973
  messages: ConversationMessage[];
878
974
  };
879
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
+
880
1000
  export declare type ConversationMessage = {
881
1001
  question: string;
882
1002
  answer: string;
883
1003
  };
884
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
+
885
1056
  export declare function DataTable<TData extends Record<string, any> & {
886
1057
  id?: string | number;
887
1058
  }, TValue>({ columns, data, getRowCanExpand, className, expandeRowClassName, isLoading, skeletonRowCount, ...props }: DataTableProps<TData, TValue>): default_2.JSX.Element;
@@ -1186,6 +1357,8 @@ export declare interface FullLayoutContextValue {
1186
1357
  ariaValuenow: number;
1187
1358
  ariaValuemin: number;
1188
1359
  ariaValuemax: number;
1360
+ /** Mirrors `FullLayout` prop; `FullLayout.Main` uses it for viewport height when Radix ScrollArea is off. */
1361
+ disableMainScrollArea: boolean;
1189
1362
  }
1190
1363
 
1191
1364
  export declare const FullLayoutHeader: default_2.ForwardRefExoticComponent<FullLayoutHeaderProps & default_2.RefAttributes<HTMLElement>>;
@@ -1239,6 +1412,8 @@ export declare interface FullLayoutRightSidebarProps extends Omit<default_2.Comp
1239
1412
  export declare interface FullLayoutRootProps {
1240
1413
  children?: default_2.ReactNode;
1241
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;
1242
1417
  className?: string;
1243
1418
  }
1244
1419
 
@@ -1290,6 +1465,12 @@ declare interface HeaderNavProps extends React_2.ComponentPropsWithoutRef<'heade
1290
1465
 
1291
1466
  export declare const Icon: default_2.ForwardRefExoticComponent<Omit<PhosphorIconProps, "ref"> & default_2.RefAttributes<SVGSVGElement>>;
1292
1467
 
1468
+ export declare type ImagePart = {
1469
+ type: 'image';
1470
+ url: string;
1471
+ alt?: string;
1472
+ };
1473
+
1293
1474
  export declare const Input: default_2.ForwardRefExoticComponent<InputProps & default_2.RefAttributes<HTMLInputElement>>;
1294
1475
 
1295
1476
  export declare interface InputProps extends default_2.InputHTMLAttributes<HTMLInputElement> {
@@ -1397,8 +1578,9 @@ export declare interface LogoProps extends React_2.SVGProps<SVGSVGElement> {
1397
1578
 
1398
1579
  export declare type LogoVariant = 'mark' | 'text' | 'full';
1399
1580
 
1400
- declare function Main({ children }: {
1581
+ declare function Main({ children, className }: {
1401
1582
  children?: default_2.ReactNode;
1583
+ className?: string;
1402
1584
  }): default_2.JSX.Element;
1403
1585
 
1404
1586
  declare namespace Main {
@@ -1441,11 +1623,26 @@ declare interface MermaidDiagramProps {
1441
1623
  content: string;
1442
1624
  }
1443
1625
 
1444
- 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 = {
1445
1636
  content: string;
1446
1637
  uncertaintyFallbackText?: Record<string, string>;
1447
1638
  };
1448
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
+
1449
1646
  declare type NextBestAction = {
1450
1647
  id?: string;
1451
1648
  label: string;
@@ -1504,7 +1701,7 @@ export declare const Progress: React_2.ForwardRefExoticComponent<Omit<ProgressPr
1504
1701
  } & React_2.RefAttributes<HTMLDivElement>>;
1505
1702
 
1506
1703
  export declare interface Props {
1507
- message: Message;
1704
+ message: Message_2;
1508
1705
  isStreaming?: boolean;
1509
1706
  redirectRules?: RedirectRule[];
1510
1707
  contentTypeEndpoint?: string;
@@ -1770,7 +1967,13 @@ export declare interface SimpleSelectProps {
1770
1967
 
1771
1968
  export declare function Spinner({ className, ...props }: default_2.ComponentProps<"svg">): default_2.JSX.Element;
1772
1969
 
1773
- declare interface Suggestion {
1970
+ export declare type Suggestion = {
1971
+ id: string;
1972
+ text: string;
1973
+ icon?: string;
1974
+ };
1975
+
1976
+ declare interface Suggestion_2 {
1774
1977
  id: string;
1775
1978
  question: string;
1776
1979
  conversationId?: string;
@@ -1821,6 +2024,24 @@ declare interface TextConfig {
1821
2024
  uncertaintyFallbackText?: Record<string, string>;
1822
2025
  }
1823
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
+
1824
2045
  export declare const Tooltip: React_2.FC<TooltipPrimitive.TooltipProps>;
1825
2046
 
1826
2047
  export declare const TooltipContent: React_2.ForwardRefExoticComponent<TooltipContentProps & React_2.RefAttributes<HTMLDivElement>>;
@@ -1882,6 +2103,8 @@ declare type UrlString = string & {
1882
2103
 
1883
2104
  export declare const useChatSearch: () => ChatSearchContextProps;
1884
2105
 
2106
+ export declare function useConversation(): ConversationContextValue;
2107
+
1885
2108
  /**
1886
2109
  * Hook to fetch and manage Google Fonts options
1887
2110
  * Handles caching, loading state, and font stylesheet loading