@factorialco/f0-react 1.384.0 → 1.386.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;
@@ -339,6 +352,7 @@ export declare type AiChatProviderProps = {
339
352
  threadId: string;
340
353
  feedback: string;
341
354
  }) => void;
355
+ tracking?: AiChatTrackingOptions;
342
356
  } & Pick<CopilotKitProps, "agent" | "credentials" | "children" | "runtimeUrl" | "showDevConsole" | "threadId" | "headers">;
343
357
 
344
358
  /**
@@ -369,6 +383,7 @@ declare type AiChatProviderReturnValue = {
369
383
  threadId: string;
370
384
  feedback: string;
371
385
  }) => void;
386
+ tracking?: AiChatTrackingOptions;
372
387
  /**
373
388
  * Clear/reset the chat conversation
374
389
  */
@@ -409,7 +424,12 @@ declare type AiChatProviderReturnValue = {
409
424
  * Set the footer content. Use this to update the footer from outside the provider (e.g. per page/route).
410
425
  */
411
426
  setFooter: React.Dispatch<React.SetStateAction<React.ReactNode | undefined>>;
412
- } & 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
+ };
413
433
 
414
434
  /**
415
435
  * Internal state for the AiChat provider
@@ -425,6 +445,8 @@ declare interface AiChatState {
425
445
  defaultVisualizationMode?: VisualizationMode;
426
446
  lockVisualizationMode?: boolean;
427
447
  footer?: React.ReactNode;
448
+ entityResolvers?: EntityResolvers;
449
+ toolHints?: AiChatToolHint[];
428
450
  placeholders?: string[];
429
451
  setPlaceholders?: React.Dispatch<React.SetStateAction<string[]>>;
430
452
  onThumbsUp?: (message: AIMessage, { threadId, feedback }: {
@@ -435,8 +457,42 @@ declare interface AiChatState {
435
457
  threadId: string;
436
458
  feedback: string;
437
459
  }) => void;
460
+ tracking?: AiChatTrackingOptions;
438
461
  }
439
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
+
485
+ /**
486
+ * Tracking options for the AI chat
487
+ */
488
+ declare type AiChatTrackingOptions = {
489
+ onVisibility?: () => void;
490
+ onClose?: () => void;
491
+ onWelcomeSuggestionClick?: (suggestion: WelcomeScreenSuggestion) => void;
492
+ onNewChat?: () => void;
493
+ onMessage?: (message: Message) => void;
494
+ };
495
+
440
496
  /**
441
497
  * AI Chat translations type
442
498
  */
@@ -470,8 +526,6 @@ export declare const aiTranslations: {
470
526
  thoughtsGroupTitle: string;
471
527
  resourcesGroupTitle: string;
472
528
  thinking: string;
473
- exportTable: string;
474
- generatedTableFilename: string;
475
529
  feedbackModal: {
476
530
  positive: {
477
531
  title: string;
@@ -484,9 +538,12 @@ export declare const aiTranslations: {
484
538
  placeholder: string;
485
539
  };
486
540
  };
541
+ dataDownloadPreview: string;
487
542
  expandChat: string;
488
543
  collapseChat: string;
489
544
  ask: string;
545
+ viewProfile: string;
546
+ tools: string;
490
547
  };
491
548
  };
492
549
 
@@ -2451,9 +2508,12 @@ export declare const defaultTranslations: {
2451
2508
  readonly placeholder: "Share what didn’t work";
2452
2509
  };
2453
2510
  };
2511
+ readonly dataDownloadPreview: "Preview {{shown}} of {{total}} rows — download the Excel to see all data.";
2454
2512
  readonly expandChat: "Expand chat";
2455
2513
  readonly collapseChat: "Collapse chat";
2456
2514
  readonly ask: "Ask One";
2515
+ readonly viewProfile: "View profile";
2516
+ readonly tools: "Tools";
2457
2517
  readonly growth: {
2458
2518
  readonly demoCard: {
2459
2519
  readonly title: "See {{moduleName}} in action";
@@ -2705,8 +2765,6 @@ export declare function DndProvider({ driver, children, }: {
2705
2765
  children: ReactNode;
2706
2766
  }): JSX_2.Element;
2707
2767
 
2708
- export declare function downloadTableAsExcel(table: HTMLTableElement, filename?: string): void;
2709
-
2710
2768
  export declare type DragPayload<T = unknown> = {
2711
2769
  kind: string;
2712
2770
  id: string;
@@ -2770,6 +2828,38 @@ declare const emojiVariants: (props?: ({
2770
2828
  className?: ClassValue;
2771
2829
  })) | undefined) => string;
2772
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
+
2773
2863
  declare type Enumerate<N extends number, Acc extends number[] = []> = Acc["length"] extends N ? [...Acc, N][number] : Enumerate<N, [...Acc, Acc["length"]]>;
2774
2864
 
2775
2865
  export declare interface ErrorMessageProps {
@@ -2833,9 +2923,9 @@ export declare const F0AiChat: () => JSX_2.Element | null;
2833
2923
  /**
2834
2924
  * @experimental This is an experimental component use it at your own risk
2835
2925
  */
2836
- export declare const F0AiChatProvider: ({ enabled, greeting, initialMessage, welcomeScreenSuggestions, disclaimer, resizable, defaultVisualizationMode, lockVisualizationMode, footer, onThumbsUp, onThumbsDown, children, agent, ...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;
2837
2927
 
2838
- 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;
2839
2929
 
2840
2930
  /**
2841
2931
  * Props for the F0AiChatTextArea component
@@ -2872,6 +2962,25 @@ export declare interface F0AiChatTextAreaProps {
2872
2962
  * @default true
2873
2963
  */
2874
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;
2875
2984
  }
2876
2985
 
2877
2986
  export declare const F0AiCollapsibleMessage: ({ icon, title, children, }: F0AiCollapsibleMessageProps) => JSX_2.Element;
@@ -3529,6 +3638,68 @@ declare type F0CustomFieldConfigWithConfig<TValue = unknown, TConfig = unknown>
3529
3638
  fieldType: "custom";
3530
3639
  };
3531
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
+
3532
3703
  /**
3533
3704
  * F0 config options specific to date fields
3534
3705
  *
@@ -4342,6 +4513,12 @@ export declare type F0LinkProps = Omit<ActionLinkProps, "variant" | "href"> & {
4342
4513
 
4343
4514
  export declare const f0MarkdownRenderers: NonNullable<AssistantMessageProps["markdownTagRenderers"]>;
4344
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
+
4345
4522
  export declare const F0MessageSources: ({ sources }: F0MessageSourcesProps) => JSX_2.Element | null;
4346
4523
 
4347
4524
  /**
@@ -4437,12 +4614,16 @@ export declare interface F0OneIconProps extends SVGProps<SVGSVGElement> {
4437
4614
  size?: "xs" | "sm" | "md" | "lg";
4438
4615
  }
4439
4616
 
4440
- export declare const F0OneSwitch: ({ className, disabled, tooltip, autoOpen, }: F0OneSwitchProps) => JSX_2.Element | null;
4617
+ export declare const F0OneSwitch: ({ className, disabled, onVisible, tooltip, autoOpen, onToggle, }: F0OneSwitchProps) => JSX_2.Element | null;
4441
4618
 
4442
4619
  /**
4443
4620
  * Props for the F0OneSwitch component
4444
4621
  */
4445
4622
  export declare type F0OneSwitchProps = React.ComponentPropsWithoutRef<typeof SwitchPrimitive.Root> & {
4623
+ /** Callback when the switch is visible */
4624
+ onVisible?: () => void;
4625
+ /** Callback when the switch is toggled */
4626
+ onToggle?: () => void;
4446
4627
  /** Custom text shown in the tooltip when the chat is closed */
4447
4628
  tooltip?: {
4448
4629
  whenDisabled?: string;
@@ -6512,6 +6693,18 @@ export declare type PersonAvatarVariant = Extract<AvatarVariant, {
6512
6693
  type: "person";
6513
6694
  }>;
6514
6695
 
6696
+ /**
6697
+ * Profile data for a person entity (employee), resolved asynchronously
6698
+ * and displayed in the entity reference hover card.
6699
+ */
6700
+ export declare type PersonProfile = {
6701
+ id: string | number;
6702
+ firstName: string;
6703
+ lastName: string;
6704
+ avatarUrl?: string;
6705
+ jobTitle?: string;
6706
+ };
6707
+
6515
6708
  declare type PersonTagProps = ComponentProps<typeof F0TagPerson>;
6516
6709
 
6517
6710
  export declare const PieChart: WithDataTestIdReturnType_5<ForwardRefExoticComponent<Omit<PieChartProps & RefAttributes<HTMLDivElement>, "ref"> & RefAttributes<HTMLElement | SVGElement>>>;
@@ -7228,6 +7421,12 @@ declare interface TableHeadProps {
7228
7421
 
7229
7422
  declare type TableOfContentPopoverVariant = "dark" | "light";
7230
7423
 
7424
+ /**
7425
+ * Table variant without the built-in download button.
7426
+ * Used inside components that already provide their own download controls.
7427
+ */
7428
+ export declare function TableSimple({ children, ...props }: React.HTMLAttributes<HTMLTableElement>): JSX_2.Element;
7429
+
7231
7430
  declare type TableVisualizationOptions<R extends RecordType, _Filters extends FiltersDefinition, Sortings extends SortingsDefinition, Summaries extends SummariesDefinition> = {
7232
7431
  /**
7233
7432
  * The columns to display
@@ -8329,11 +8528,6 @@ declare module "gridstack" {
8329
8528
  }
8330
8529
 
8331
8530
 
8332
- declare namespace Calendar {
8333
- var displayName: string;
8334
- }
8335
-
8336
-
8337
8531
  declare module "@tiptap/core" {
8338
8532
  interface Commands<ReturnType> {
8339
8533
  aiBlock: {
@@ -8346,9 +8540,8 @@ declare module "@tiptap/core" {
8346
8540
 
8347
8541
  declare module "@tiptap/core" {
8348
8542
  interface Commands<ReturnType> {
8349
- enhanceHighlight: {
8350
- setEnhanceHighlight: (from: number, to: number) => ReturnType;
8351
- clearEnhanceHighlight: () => ReturnType;
8543
+ moodTracker: {
8544
+ insertMoodTracker: (data: MoodTrackerData) => ReturnType;
8352
8545
  };
8353
8546
  }
8354
8547
  }
@@ -8356,8 +8549,9 @@ declare module "@tiptap/core" {
8356
8549
 
8357
8550
  declare module "@tiptap/core" {
8358
8551
  interface Commands<ReturnType> {
8359
- moodTracker: {
8360
- insertMoodTracker: (data: MoodTrackerData) => ReturnType;
8552
+ enhanceHighlight: {
8553
+ setEnhanceHighlight: (from: number, to: number) => ReturnType;
8554
+ clearEnhanceHighlight: () => ReturnType;
8361
8555
  };
8362
8556
  }
8363
8557
  }
@@ -8381,3 +8575,8 @@ declare module "@tiptap/core" {
8381
8575
  };
8382
8576
  }
8383
8577
  }
8578
+
8579
+
8580
+ declare namespace Calendar {
8581
+ var displayName: string;
8582
+ }