@factorialco/f0-react 1.385.0 → 1.387.0

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/f0.d.ts CHANGED
@@ -331,6 +331,19 @@ export declare type AiChatProviderProps = {
331
331
  * Optional footer content rendered below the textarea
332
332
  */
333
333
  footer?: React.ReactNode;
334
+ /**
335
+ * Async resolver functions for entity references in markdown.
336
+ * Used to fetch profile data for inline entity mentions (hover cards).
337
+ * The consuming app provides these so the chat can resolve entity IDs
338
+ * (e.g. employee IDs) into rich profile data without knowing the API.
339
+ */
340
+ entityResolvers?: EntityResolvers;
341
+ /**
342
+ * Available tool hints that the user can activate to provide intent context
343
+ * to the AI. Renders a selector button next to the send button.
344
+ * Only one tool hint can be active at a time.
345
+ */
346
+ toolHints?: AiChatToolHint[];
334
347
  onThumbsUp?: (message: AIMessage, { threadId, feedback }: {
335
348
  threadId: string;
336
349
  feedback: string;
@@ -411,7 +424,12 @@ declare type AiChatProviderReturnValue = {
411
424
  * Set the footer content. Use this to update the footer from outside the provider (e.g. per page/route).
412
425
  */
413
426
  setFooter: React.Dispatch<React.SetStateAction<React.ReactNode | undefined>>;
414
- } & Pick<AiChatState, "greeting" | "agent" | "disclaimer" | "resizable">;
427
+ } & Pick<AiChatState, "greeting" | "agent" | "disclaimer" | "resizable" | "entityResolvers" | "toolHints"> & {
428
+ /** The currently active tool hint, or null if none is selected */
429
+ activeToolHint: AiChatToolHint | null;
430
+ /** Set the active tool hint (pass null to clear) */
431
+ setActiveToolHint: React.Dispatch<React.SetStateAction<AiChatToolHint | null>>;
432
+ };
415
433
 
416
434
  /**
417
435
  * Internal state for the AiChat provider
@@ -427,6 +445,8 @@ declare interface AiChatState {
427
445
  defaultVisualizationMode?: VisualizationMode;
428
446
  lockVisualizationMode?: boolean;
429
447
  footer?: React.ReactNode;
448
+ entityResolvers?: EntityResolvers;
449
+ toolHints?: AiChatToolHint[];
430
450
  placeholders?: string[];
431
451
  setPlaceholders?: React.Dispatch<React.SetStateAction<string[]>>;
432
452
  onThumbsUp?: (message: AIMessage, { threadId, feedback }: {
@@ -440,6 +460,28 @@ declare interface AiChatState {
440
460
  tracking?: AiChatTrackingOptions;
441
461
  }
442
462
 
463
+ /**
464
+ * A tool hint that can be activated to prepend invisible context to the user's
465
+ * message, telling the AI about the user's intent (e.g. "generate tables",
466
+ * "data analysis"). Similar to Gemini's tool selector UI.
467
+ *
468
+ * Only one tool hint can be active at a time. It persists across messages
469
+ * until the user explicitly removes it.
470
+ */
471
+ export declare type AiChatToolHint = {
472
+ /** Unique identifier for this tool hint */
473
+ id: string;
474
+ /** Display label shown in the selector and chip */
475
+ label: string;
476
+ /** Optional icon shown in the selector and chip */
477
+ icon?: IconType;
478
+ /**
479
+ * Prompt text injected as invisible context before the user's message.
480
+ * The AI receives this but the user never sees it in the chat.
481
+ */
482
+ prompt: string;
483
+ };
484
+
443
485
  /**
444
486
  * Tracking options for the AI chat
445
487
  */
@@ -484,8 +526,6 @@ export declare const aiTranslations: {
484
526
  thoughtsGroupTitle: string;
485
527
  resourcesGroupTitle: string;
486
528
  thinking: string;
487
- exportTable: string;
488
- generatedTableFilename: string;
489
529
  feedbackModal: {
490
530
  positive: {
491
531
  title: string;
@@ -498,9 +538,12 @@ export declare const aiTranslations: {
498
538
  placeholder: string;
499
539
  };
500
540
  };
541
+ dataDownloadPreview: string;
501
542
  expandChat: string;
502
543
  collapseChat: string;
503
544
  ask: string;
545
+ viewProfile: string;
546
+ tools: string;
504
547
  };
505
548
  };
506
549
 
@@ -2465,9 +2508,12 @@ export declare const defaultTranslations: {
2465
2508
  readonly placeholder: "Share what didn’t work";
2466
2509
  };
2467
2510
  };
2511
+ readonly dataDownloadPreview: "Preview {{shown}} of {{total}} rows — download the Excel to see all data.";
2468
2512
  readonly expandChat: "Expand chat";
2469
2513
  readonly collapseChat: "Collapse chat";
2470
2514
  readonly ask: "Ask One";
2515
+ readonly viewProfile: "View profile";
2516
+ readonly tools: "Tools";
2471
2517
  readonly growth: {
2472
2518
  readonly demoCard: {
2473
2519
  readonly title: "See {{moduleName}} in action";
@@ -2719,8 +2765,6 @@ export declare function DndProvider({ driver, children, }: {
2719
2765
  children: ReactNode;
2720
2766
  }): JSX_2.Element;
2721
2767
 
2722
- export declare function downloadTableAsExcel(table: HTMLTableElement, filename?: string): void;
2723
-
2724
2768
  export declare type DragPayload<T = unknown> = {
2725
2769
  kind: string;
2726
2770
  id: string;
@@ -2784,6 +2828,38 @@ declare const emojiVariants: (props?: ({
2784
2828
  className?: ClassValue;
2785
2829
  })) | undefined) => string;
2786
2830
 
2831
+ /**
2832
+ * Generic entity reference renderer for custom `<entity-ref>` HTML tags
2833
+ * embedded in AI chat markdown output.
2834
+ *
2835
+ * Dispatches to type-specific renderers based on the `type` attribute.
2836
+ * Falls back to rendering children as plain text for unknown types.
2837
+ *
2838
+ * Usage in markdown (via rehype-raw):
2839
+ * <entity-ref type="person" id="123">Ana García</entity-ref>
2840
+ */
2841
+ export declare function EntityRef({ type, id, children, }: {
2842
+ type?: string;
2843
+ id?: string;
2844
+ children?: ReactNode;
2845
+ }): JSX_2.Element;
2846
+
2847
+ /**
2848
+ * Map of async resolver functions keyed by entity type.
2849
+ * Each resolver takes an entity ID and returns the profile data
2850
+ * needed to render the entity reference hover card.
2851
+ *
2852
+ * Extensible: add new entity types here as needed (e.g. `team`, `department`).
2853
+ */
2854
+ export declare type EntityResolvers = {
2855
+ person?: (id: string) => Promise<PersonProfile>;
2856
+ /**
2857
+ * Search for persons by name query. Used by the @mention autocomplete
2858
+ * in the chat input to let users reference specific employees.
2859
+ */
2860
+ searchPersons?: (query: string) => Promise<PersonProfile[]>;
2861
+ };
2862
+
2787
2863
  declare type Enumerate<N extends number, Acc extends number[] = []> = Acc["length"] extends N ? [...Acc, N][number] : Enumerate<N, [...Acc, Acc["length"]]>;
2788
2864
 
2789
2865
  export declare interface ErrorMessageProps {
@@ -2847,9 +2923,9 @@ export declare const F0AiChat: () => JSX_2.Element | null;
2847
2923
  /**
2848
2924
  * @experimental This is an experimental component use it at your own risk
2849
2925
  */
2850
- export declare const F0AiChatProvider: ({ enabled, greeting, initialMessage, welcomeScreenSuggestions, disclaimer, resizable, defaultVisualizationMode, lockVisualizationMode, footer, onThumbsUp, onThumbsDown, children, agent, tracking, ...copilotKitProps }: AiChatProviderProps) => JSX_2.Element;
2926
+ export declare const F0AiChatProvider: ({ enabled, greeting, initialMessage, welcomeScreenSuggestions, disclaimer, resizable, defaultVisualizationMode, lockVisualizationMode, footer, entityResolvers, toolHints, onThumbsUp, onThumbsDown, children, agent, tracking, ...copilotKitProps }: AiChatProviderProps) => JSX_2.Element;
2851
2927
 
2852
- export declare const F0AiChatTextArea: ({ submitLabel, inProgress, onSend, onStop, placeholders, defaultPlaceholder, autoFocus, }: F0AiChatTextAreaProps) => JSX_2.Element;
2928
+ export declare const F0AiChatTextArea: ({ submitLabel, inProgress, onSend, onStop, placeholders, defaultPlaceholder, autoFocus, entityResolvers, toolHints, activeToolHint, onActiveToolHintChange, }: F0AiChatTextAreaProps) => JSX_2.Element;
2853
2929
 
2854
2930
  /**
2855
2931
  * Props for the F0AiChatTextArea component
@@ -2886,6 +2962,25 @@ export declare interface F0AiChatTextAreaProps {
2886
2962
  * @default true
2887
2963
  */
2888
2964
  autoFocus?: boolean;
2965
+ /**
2966
+ * Entity resolvers for @mention autocomplete and entity reference rendering.
2967
+ * When `searchPersons` is provided, typing @ in the textarea opens an
2968
+ * autocomplete popover to mention employees.
2969
+ */
2970
+ entityResolvers?: EntityResolvers;
2971
+ /**
2972
+ * Available tool hints that the user can activate.
2973
+ * Renders a selector button to the left of the send button.
2974
+ */
2975
+ toolHints?: AiChatToolHint[];
2976
+ /**
2977
+ * The currently active tool hint, or null if none is selected.
2978
+ */
2979
+ activeToolHint?: AiChatToolHint | null;
2980
+ /**
2981
+ * Callback when the active tool hint changes (selection or removal).
2982
+ */
2983
+ onActiveToolHintChange?: (toolHint: AiChatToolHint | null) => void;
2889
2984
  }
2890
2985
 
2891
2986
  export declare const F0AiCollapsibleMessage: ({ icon, title, children, }: F0AiCollapsibleMessageProps) => JSX_2.Element;
@@ -3543,6 +3638,68 @@ declare type F0CustomFieldConfigWithConfig<TValue = unknown, TConfig = unknown>
3543
3638
  fieldType: "custom";
3544
3639
  };
3545
3640
 
3641
+ /**
3642
+ * Component that renders an optional markdown preview followed by
3643
+ * a dropdown button with "Download Excel" as the primary action and
3644
+ * "Download CSV" as a secondary option. Files are generated client-side
3645
+ * from the raw dataset provided by the agent.
3646
+ */
3647
+ export declare const F0DataDownload: ({ markdown, filename, dataset, }: F0DataDownloadProps) => JSX_2.Element;
3648
+
3649
+ /**
3650
+ * Inline dataset for client-side file generation (Excel / CSV).
3651
+ * Sent by the agent with the raw query results.
3652
+ */
3653
+ export declare type F0DataDownloadDataset = {
3654
+ /**
3655
+ * Column headers in display order.
3656
+ */
3657
+ columns: string[];
3658
+ /**
3659
+ * Array of row objects keyed by column name.
3660
+ */
3661
+ rows: Record<string, unknown>[];
3662
+ /**
3663
+ * Total number of rows returned by the query (before truncation).
3664
+ * Used together with previewCount to render the preview note.
3665
+ */
3666
+ totalCount?: number;
3667
+ /**
3668
+ * Number of rows shown in the markdown preview table.
3669
+ * Used together with totalCount to render the preview note.
3670
+ */
3671
+ previewCount?: number;
3672
+ /**
3673
+ * Map of raw column names to human-readable labels in the user's language.
3674
+ * Used for Excel/CSV headers. Falls back to the raw column name when absent.
3675
+ */
3676
+ columnLabels?: Record<string, string>;
3677
+ };
3678
+
3679
+ /**
3680
+ * Props for the F0DataDownload component.
3681
+ *
3682
+ * Renders an optional markdown preview/description followed by
3683
+ * "Download Excel" and "Download CSV" buttons. The component generates
3684
+ * the files client-side from the provided dataset.
3685
+ */
3686
+ export declare type F0DataDownloadProps = {
3687
+ /**
3688
+ * Optional markdown content to display above the download buttons.
3689
+ * Typically a 5-row preview table generated by the agent.
3690
+ */
3691
+ markdown?: string;
3692
+ /**
3693
+ * Descriptive filename (without extension) for the downloaded files.
3694
+ * Generated by the AI to reflect the query content in the user's language.
3695
+ */
3696
+ filename?: string;
3697
+ /**
3698
+ * Raw dataset for client-side Excel and CSV generation.
3699
+ */
3700
+ dataset: F0DataDownloadDataset;
3701
+ };
3702
+
3546
3703
  /**
3547
3704
  * F0 config options specific to date fields
3548
3705
  *
@@ -4356,6 +4513,12 @@ export declare type F0LinkProps = Omit<ActionLinkProps, "variant" | "href"> & {
4356
4513
 
4357
4514
  export declare const f0MarkdownRenderers: NonNullable<AssistantMessageProps["markdownTagRenderers"]>;
4358
4515
 
4516
+ /**
4517
+ * Markdown renderers without the table download button.
4518
+ * Use this when the parent component already provides its own download controls.
4519
+ */
4520
+ export declare const f0MarkdownRenderersSimple: NonNullable<AssistantMessageProps["markdownTagRenderers"]>;
4521
+
4359
4522
  export declare const F0MessageSources: ({ sources }: F0MessageSourcesProps) => JSX_2.Element | null;
4360
4523
 
4361
4524
  /**
@@ -4764,6 +4927,10 @@ export declare type F0SelectTagProp = string | {
4764
4927
  type: "dot";
4765
4928
  text: string;
4766
4929
  color: NewColor;
4930
+ } | {
4931
+ type: "person";
4932
+ name: string;
4933
+ src?: string;
4767
4934
  };
4768
4935
 
4769
4936
  /**
@@ -6530,6 +6697,18 @@ export declare type PersonAvatarVariant = Extract<AvatarVariant, {
6530
6697
  type: "person";
6531
6698
  }>;
6532
6699
 
6700
+ /**
6701
+ * Profile data for a person entity (employee), resolved asynchronously
6702
+ * and displayed in the entity reference hover card.
6703
+ */
6704
+ export declare type PersonProfile = {
6705
+ id: string | number;
6706
+ firstName: string;
6707
+ lastName: string;
6708
+ avatarUrl?: string;
6709
+ jobTitle?: string;
6710
+ };
6711
+
6533
6712
  declare type PersonTagProps = ComponentProps<typeof F0TagPerson>;
6534
6713
 
6535
6714
  export declare const PieChart: WithDataTestIdReturnType_5<ForwardRefExoticComponent<Omit<PieChartProps & RefAttributes<HTMLDivElement>, "ref"> & RefAttributes<HTMLElement | SVGElement>>>;
@@ -7246,6 +7425,12 @@ declare interface TableHeadProps {
7246
7425
 
7247
7426
  declare type TableOfContentPopoverVariant = "dark" | "light";
7248
7427
 
7428
+ /**
7429
+ * Table variant without the built-in download button.
7430
+ * Used inside components that already provide their own download controls.
7431
+ */
7432
+ export declare function TableSimple({ children, ...props }: React.HTMLAttributes<HTMLTableElement>): JSX_2.Element;
7433
+
7249
7434
  declare type TableVisualizationOptions<R extends RecordType, _Filters extends FiltersDefinition, Sortings extends SortingsDefinition, Summaries extends SummariesDefinition> = {
7250
7435
  /**
7251
7436
  * The columns to display
@@ -8378,8 +8563,10 @@ declare module "@tiptap/core" {
8378
8563
 
8379
8564
  declare module "@tiptap/core" {
8380
8565
  interface Commands<ReturnType> {
8381
- transcript: {
8382
- insertTranscript: (data: TranscriptData) => ReturnType;
8566
+ videoEmbed: {
8567
+ setVideoEmbed: (options: {
8568
+ src: string;
8569
+ }) => ReturnType;
8383
8570
  };
8384
8571
  }
8385
8572
  }
@@ -8387,10 +8574,8 @@ declare module "@tiptap/core" {
8387
8574
 
8388
8575
  declare module "@tiptap/core" {
8389
8576
  interface Commands<ReturnType> {
8390
- videoEmbed: {
8391
- setVideoEmbed: (options: {
8392
- src: string;
8393
- }) => ReturnType;
8577
+ transcript: {
8578
+ insertTranscript: (data: TranscriptData) => ReturnType;
8394
8579
  };
8395
8580
  }
8396
8581
  }