@factorialco/f0-react 1.454.0 → 1.456.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
@@ -25,6 +25,7 @@ import { ChartPropsBase } from './utils/types';
25
25
  import { ClassValue } from 'cva';
26
26
  import { CompanyCellValue } from './f0';
27
27
  import { CompanyCellValue as CompanyCellValue_2 } from './types/company';
28
+ import { CompanyItemProps } from './types';
28
29
  import { ComponentProps } from 'react';
29
30
  import { ComponentType } from 'react';
30
31
  import { CompoundCellValue } from './types/compound';
@@ -42,6 +43,7 @@ import { DotTagCellValue } from './f0';
42
43
  import { DotTagCellValue as DotTagCellValue_2 } from './types/dotTag';
43
44
  import type * as echarts_2 from 'echarts';
44
45
  import { Editor } from '@tiptap/react';
46
+ import { EmployeeItemProps } from './types';
45
47
  import { F0AnalyticsDashboardProps as F0AnalyticsDashboardProps_2 } from './types';
46
48
  import { F0AvatarCompanyProps as F0AvatarCompanyProps_2 } from './types';
47
49
  import { F0AvatarDateProps } from './F0AvatarDate';
@@ -90,6 +92,7 @@ import { InputProps } from '@copilotkit/react-ui';
90
92
  import { internalAvatarColors as internalAvatarColors_2 } from './f0';
91
93
  import { internalAvatarSizes as internalAvatarSizes_2 } from './f0';
92
94
  import { internalAvatarTypes as internalAvatarTypes_2 } from './f0';
95
+ import { ItemProps } from './types';
93
96
  import { JSONContent } from '@tiptap/react';
94
97
  import { JSONContent as JSONContent_2 } from '@tiptap/core';
95
98
  import { JSX as JSX_2 } from 'react';
@@ -117,6 +120,7 @@ import * as React_2 from 'react';
117
120
  import { ReactElement } from 'react';
118
121
  import { ReactNode } from 'react';
119
122
  import * as RechartsPrimitive from 'recharts';
123
+ import { Ref } from 'react';
120
124
  import { RefAttributes } from 'react';
121
125
  import { RefObject } from 'react';
122
126
  import { RemoteAudioTrack } from 'livekit-client';
@@ -127,14 +131,22 @@ import { StatusCellValue as StatusCellValue_2 } from './types/status';
127
131
  import { SummaryCellValue } from './types/summary';
128
132
  import { SVGProps } from 'react';
129
133
  import * as SwitchPrimitive from '@radix-ui/react-switch';
134
+ import { TagAlertProps as TagAlertProps_2 } from './f0';
135
+ import { TagBalanceProps as TagBalanceProps_2 } from './f0';
130
136
  import { TagCellValue } from './f0';
131
137
  import { TagCellValue as TagCellValue_2 } from './types/tag';
138
+ import { TagDotProps as TagDotProps_2 } from './f0';
132
139
  import { TagListCellValue } from './f0';
133
140
  import { TagListCellValue as TagListCellValue_2 } from './types/tagList';
141
+ import { TagListProps as TagListProps_2 } from './f0';
142
+ import { TagRawProps as TagRawProps_2 } from './f0';
143
+ import { TagStatusProps as TagStatusProps_2 } from './f0';
134
144
  import { TagType as TagType_2 } from './types';
145
+ import { TagType as TagType_3 } from './f0';
135
146
  import { TagVariant as TagVariant_2 } from './F0Tag';
136
147
  import { TeamCellValue } from './f0';
137
148
  import { TeamCellValue as TeamCellValue_2 } from './types/team';
149
+ import { TeamItemProps } from './types';
138
150
  import { TextCellValue } from './f0';
139
151
  import { TextCellValue as TextCellValue_2 } from './types/text';
140
152
  import { TrackReferenceOrPlaceholder } from '@livekit/components-react';
@@ -512,6 +524,11 @@ export declare type AiChatProviderProps = {
512
524
  * URL builders (navigation links) for each entity type.
513
525
  */
514
526
  entityRefs?: EntityRefs;
527
+ /**
528
+ * Canvas action callbacks grouped by entity type.
529
+ * Provides save/create functions for persisting canvas entities externally.
530
+ */
531
+ canvasActions?: CanvasActions;
515
532
  /**
516
533
  * Available tool hints that the user can activate to provide intent context
517
534
  * to the AI. Renders a selector button next to the send button.
@@ -599,8 +616,14 @@ declare type AiChatProviderReturnValue = {
599
616
  * Append messages to the current conversation.
600
617
  * Useful for injecting pre-built assistant responses (e.g. dashboards)
601
618
  * from outside the chat. IDs are generated internally.
619
+ *
620
+ * @param options.persist - Whether to persist messages to the backend thread.
621
+ * Defaults to `true`. Pass `false` for client-only display messages that
622
+ * should not create or modify a backend thread (e.g. seed messages).
602
623
  */
603
- appendMessages: (messages: AppendMessage[]) => void;
624
+ appendMessages: (messages: AppendMessage[], options?: {
625
+ persist?: boolean;
626
+ }) => void;
604
627
  /* Excluded from this release type: setAppendMessagesFunction */
605
628
  /**
606
629
  * Atomically clear the conversation and inject new messages.
@@ -666,7 +689,14 @@ declare type AiChatProviderReturnValue = {
666
689
  */
667
690
  fileDragOver: boolean;
668
691
  /* Excluded from this release type: setFileDragOver */
669
- } & Pick<AiChatState, "greeting" | "agent" | "disclaimer" | "resizable" | "entityRefs" | "toolHints" | "credits" | "creditWarning" | "fileAttachments"> & {
692
+ /**
693
+ * Pre-loaded context shown as an empty state in the chat.
694
+ * Prepended to the first user message as `<pending-context>`.
695
+ */
696
+ pendingContext: PendingContext | null;
697
+ /** Set pending context (pass null to clear) */
698
+ setPendingContext: React.Dispatch<React.SetStateAction<PendingContext | null>>;
699
+ } & Pick<AiChatState, "greeting" | "agent" | "disclaimer" | "resizable" | "entityRefs" | "canvasActions" | "toolHints" | "credits" | "creditWarning" | "fileAttachments"> & {
670
700
  /** The current canvas content, or null when canvas is closed */
671
701
  canvasContent: CanvasContent | null;
672
702
  /** Open the canvas panel with the given content */
@@ -696,6 +726,7 @@ declare interface AiChatState {
696
726
  footer?: React.ReactNode;
697
727
  VoiceMode?: React.ComponentType;
698
728
  entityRefs?: EntityRefs;
729
+ canvasActions?: CanvasActions;
699
730
  toolHints?: AiChatToolHint[];
700
731
  credits?: AiChatCredits;
701
732
  creditWarning?: AiChatCreditWarning;
@@ -858,6 +889,19 @@ export declare const aiTranslations: {
858
889
  readonly formCard: {
859
890
  readonly moreFields: "Open to see all fields";
860
891
  };
892
+ readonly dashboard: {
893
+ readonly save: "Save";
894
+ readonly saveToAnalytics: "Save the dashboard in Analytics";
895
+ readonly saveAs: "Save as";
896
+ readonly saveDialog: {
897
+ readonly title: "Save dashboard";
898
+ readonly titleLabel: "Title";
899
+ readonly descriptionLabel: "Description";
900
+ readonly descriptionPlaceholder: "Add a description (optional)";
901
+ readonly save: "Save";
902
+ readonly cancel: "Cancel";
903
+ };
904
+ };
861
905
  readonly dataDownload: {
862
906
  readonly title: "Download";
863
907
  readonly download: "Download {{format}}";
@@ -984,13 +1028,26 @@ export declare type AppendMessage = {
984
1028
  role: "user" | "assistant";
985
1029
  content: string;
986
1030
  toolCalls?: AppendToolCall[];
1031
+ } | {
1032
+ /** Tool result message — pairs with a toolCall from a previous assistant message */
1033
+ role: "tool";
1034
+ content: string;
1035
+ /**
1036
+ * ID of the paired tool call. Must equal the corresponding assistant
1037
+ * message's `toolCalls[i].id` — supply `AppendToolCall.id` on that call
1038
+ * and pass the same value here so the messages are correctly paired.
1039
+ */
1040
+ toolCallId: string;
987
1041
  };
988
1042
 
989
1043
  /**
990
1044
  * A tool call to inject via appendMessages.
991
- * IDs are generated internally callers only provide the function payload.
1045
+ * IDs are generated internally unless `id` is provided.
1046
+ * When pairing with a tool-result message, provide the same `id`
1047
+ * in both the tool call and the tool-result's `toolCallId`.
992
1048
  */
993
1049
  export declare type AppendToolCall = {
1050
+ id?: string;
994
1051
  function: {
995
1052
  name: string;
996
1053
  arguments: string;
@@ -1721,6 +1778,15 @@ declare type CandidateProfile = {
1721
1778
  source?: string;
1722
1779
  };
1723
1780
 
1781
+ /**
1782
+ * Canvas-level action callbacks grouped by entity type.
1783
+ * Each entity defines its own actions type; this aggregates them.
1784
+ * Passed by the host app to F0AiChatProvider via `canvasActions`.
1785
+ */
1786
+ export declare type CanvasActions = {
1787
+ dashboard?: DashboardCanvasActions;
1788
+ };
1789
+
1724
1790
  /**
1725
1791
  * Discriminated union for canvas panel content.
1726
1792
  * Add new entity types to this union as they are implemented.
@@ -2857,6 +2923,16 @@ declare interface CustomFieldRenderPropsBase {
2857
2923
 
2858
2924
  export declare const Dashboard: WithDataTestIdReturnType_3<ComponentType<DashboardProps_2> & PageLayoutGroupComponent_2>;
2859
2925
 
2926
+ /**
2927
+ * Callbacks for persisting dashboards externally (beyond chat history).
2928
+ */
2929
+ declare type DashboardCanvasActions = {
2930
+ /** Update an existing saved dashboard */
2931
+ save: (id: string, category: string, config: ChatDashboardConfig) => Promise<void>;
2932
+ /** Create a new saved dashboard. Returns the new dashboard ID if available. */
2933
+ create: (title: string, description: string, config: ChatDashboardConfig, category?: string) => Promise<string | void>;
2934
+ };
2935
+
2860
2936
  /**
2861
2937
  * Dashboard canvas content — renders an analytics dashboard.
2862
2938
  */
@@ -2867,6 +2943,14 @@ export declare type DashboardCanvasContent = CanvasContentBase & {
2867
2943
  baseUrl: string;
2868
2944
  headers: Record<string, string>;
2869
2945
  };
2946
+ /** Present when the dashboard is a pre-saved dashboard */
2947
+ savedDashboardId?: string;
2948
+ /** Category of the saved dashboard */
2949
+ savedDashboardCategory?: string;
2950
+ /** Description of the saved dashboard */
2951
+ savedDashboardDescription?: string;
2952
+ /** True when the agent has iterated on a saved dashboard but the user hasn't saved yet */
2953
+ savedDashboardUnsaved?: boolean;
2870
2954
  };
2871
2955
 
2872
2956
  /**
@@ -3220,6 +3304,27 @@ export declare interface DataError {
3220
3304
  cause?: unknown;
3221
3305
  }
3222
3306
 
3307
+ declare const DataList: ForwardRefExoticComponent<DataListProps & RefAttributes<HTMLUListElement>> & {
3308
+ Item: ForwardRefExoticComponent<ItemProps & RefAttributes<HTMLLIElement>>;
3309
+ CompanyItem: ForwardRefExoticComponent<CompanyItemProps & RefAttributes<HTMLLIElement>>;
3310
+ PersonItem: ForwardRefExoticComponent<EmployeeItemProps & RefAttributes<HTMLLIElement>>;
3311
+ TeamItem: ForwardRefExoticComponent<TeamItemProps & RefAttributes<HTMLLIElement>>;
3312
+ DotTagItem: ForwardRefExoticComponent<TagDotProps_2 & RefAttributes<HTMLLIElement>>;
3313
+ AlertTagItem: ForwardRefExoticComponent<TagAlertProps_2 & RefAttributes<HTMLLIElement>>;
3314
+ BalanceTagItem: ForwardRefExoticComponent<TagBalanceProps_2 & RefAttributes<HTMLLIElement>>;
3315
+ StatusTagItem: ForwardRefExoticComponent<TagStatusProps_2 & RefAttributes<HTMLLIElement>>;
3316
+ RawTagItem: ForwardRefExoticComponent<TagRawProps_2 & RefAttributes<HTMLLIElement>>;
3317
+ TagListItem: <T extends TagType_3>(props: TagListProps_2<T> & {
3318
+ ref?: Ref<HTMLLIElement>;
3319
+ }) => ReturnType<(<T_1 extends TagType_3>(props: TagListProps_2<T_1>, ref: ForwardedRef<HTMLLIElement>) => JSX_2.Element)>;
3320
+ };
3321
+
3322
+ declare type DataListProps = {
3323
+ children: ReactElement | ReactElement[];
3324
+ label?: string;
3325
+ isHorizontal?: boolean;
3326
+ };
3327
+
3223
3328
  /**
3224
3329
  * Represents a data source with filtering capabilities and data fetching functionality.
3225
3330
  * Extends DataSourceDefinition with runtime properties for state management.
@@ -3956,6 +4061,19 @@ export declare const defaultTranslations: {
3956
4061
  readonly formCard: {
3957
4062
  readonly moreFields: "Open to see all fields";
3958
4063
  };
4064
+ readonly dashboard: {
4065
+ readonly save: "Save";
4066
+ readonly saveToAnalytics: "Save the dashboard in Analytics";
4067
+ readonly saveAs: "Save as";
4068
+ readonly saveDialog: {
4069
+ readonly title: "Save dashboard";
4070
+ readonly titleLabel: "Title";
4071
+ readonly descriptionLabel: "Description";
4072
+ readonly descriptionPlaceholder: "Add a description (optional)";
4073
+ readonly save: "Save";
4074
+ readonly cancel: "Cancel";
4075
+ };
4076
+ };
3959
4077
  readonly dataDownload: {
3960
4078
  readonly title: "Download";
3961
4079
  readonly download: "Download {{format}}";
@@ -4186,6 +4304,8 @@ export declare const defaultTranslations: {
4186
4304
  };
4187
4305
  };
4188
4306
  readonly forms: {
4307
+ readonly yes: "Yes";
4308
+ readonly no: "No";
4189
4309
  readonly actionBar: {
4190
4310
  readonly unsavedChanges: "You have changes pending to be saved";
4191
4311
  readonly saving: "Saving...";
@@ -4284,6 +4404,36 @@ declare interface DeleteBlockNotesTextEditorPageDocumentPatch {
4284
4404
  */
4285
4405
  export declare function describeFormSchema(schema: F0FormSchema): FormFieldDescription[];
4286
4406
 
4407
+ declare type DetailsItemContent = (ComponentProps<typeof DataList.Item> & {
4408
+ type: "item";
4409
+ }) | (ComponentProps<typeof DataList.PersonItem> & {
4410
+ type: "person";
4411
+ }) | (ComponentProps<typeof DataList.CompanyItem> & {
4412
+ type: "company";
4413
+ }) | (ComponentProps<typeof DataList.TeamItem> & {
4414
+ type: "team";
4415
+ }) | (ComponentProps<typeof Weekdays> & {
4416
+ type: "weekdays";
4417
+ }) | (ComponentProps<typeof DataList.DotTagItem> & {
4418
+ type: "dot-tag";
4419
+ }) | (TagAlertProps & {
4420
+ type: "alert-tag";
4421
+ }) | (TagBalanceProps & {
4422
+ type: "balance-tag";
4423
+ }) | (TagStatusProps & {
4424
+ type: "status-tag";
4425
+ }) | (TagRawProps & {
4426
+ type: "raw-tag";
4427
+ }) | {
4428
+ [T in TagType]: {
4429
+ type: "tag-list";
4430
+ tagList: TagListProps<T>;
4431
+ };
4432
+ }[TagType] | {
4433
+ type: "avatar-list";
4434
+ avatarList: F0AvatarListProps;
4435
+ };
4436
+
4287
4437
  export declare type DialogPosition = (typeof dialogPositions)[number];
4288
4438
 
4289
4439
  declare const dialogPositions: readonly ["center", "left", "right", "fullscreen"];
@@ -4735,7 +4885,7 @@ export declare const F0AiChat: () => JSX_2.Element | null;
4735
4885
  /**
4736
4886
  * @experimental This is an experimental component use it at your own risk
4737
4887
  */
4738
- export declare const F0AiChatProvider: ({ enabled, greeting, initialMessage, welcomeScreenSuggestions, disclaimer, resizable, defaultVisualizationMode, lockVisualizationMode, historyEnabled, footer, VoiceMode, entityRefs, toolHints, credits, creditWarning, fileAttachments, onThumbsUp, onThumbsDown, children, agent, tracking, ...copilotKitProps }: AiChatProviderProps) => JSX_2.Element;
4888
+ export declare const F0AiChatProvider: ({ enabled, greeting, initialMessage, welcomeScreenSuggestions, disclaimer, resizable, defaultVisualizationMode, lockVisualizationMode, historyEnabled, footer, VoiceMode, entityRefs, canvasActions, toolHints, credits, creditWarning, fileAttachments, onThumbsUp, onThumbsDown, children, agent, tracking, ...copilotKitProps }: AiChatProviderProps) => JSX_2.Element;
4739
4889
 
4740
4890
  export declare const F0AiChatTextArea: ({ submitLabel, inProgress, onSend, onStop, creditWarning, }: ChatTextareaProps) => JSX_2.Element;
4741
4891
 
@@ -8378,6 +8528,23 @@ declare type FormCanvasContent = CanvasContentBase & {
8378
8528
  formModule?: ModuleId;
8379
8529
  };
8380
8530
 
8531
+ export declare interface FormCardValueFormatterEntry<T = unknown> {
8532
+ /** Scope to a specific form. Omit to apply to all forms. */
8533
+ formName?: string;
8534
+ /** Scope to a specific custom field name. Omit to apply to all fields. */
8535
+ customFieldName?: string;
8536
+ /** Format function. Return `undefined` to fall back to built-in formatting. */
8537
+ format: (value: T, meta: {
8538
+ key: string;
8539
+ fieldType?: string;
8540
+ customFieldName?: string;
8541
+ }) => DetailsItemContent | DetailsItemContent[] | undefined;
8542
+ }
8543
+
8544
+ export declare function FormCardValueFormatterProvider({ children, }: {
8545
+ children: ReactNode;
8546
+ }): JSX_2.Element;
8547
+
8381
8548
  /* Excluded from this release type: FormDefinitionItem */
8382
8549
 
8383
8550
  /**
@@ -10210,6 +10377,19 @@ declare type PathsToStringProps<T> = T extends string ? [] : {
10210
10377
  [K in Extract<keyof T, string>]: [K, ...PathsToStringProps<T[K]>];
10211
10378
  }[Extract<keyof T, string>];
10212
10379
 
10380
+ /**
10381
+ * Pre-loaded context shown as an empty state in the chat.
10382
+ * The `context` string is prepended to the user's first message
10383
+ * as `<pending-context>...</pending-context>` so the agent receives it.
10384
+ * The conversation is not created until the user actually sends a message.
10385
+ */
10386
+ declare type PendingContext = {
10387
+ /** Human-readable label shown in the empty state (e.g. "Expenses dashboard") */
10388
+ label: string;
10389
+ /** Full context string prepended invisibly to the first user message */
10390
+ context: string;
10391
+ };
10392
+
10213
10393
  /**
10214
10394
  * Creates a union of `[sectionId, data]` pairs for each key in T.
10215
10395
  * Used to build a callback where TypeScript narrows `data` based on `sectionId`.
@@ -11147,6 +11327,8 @@ export declare const selectSizes: readonly ["sm", "md"];
11147
11327
  */
11148
11328
  declare type SelectValueType = string | number;
11149
11329
 
11330
+ declare type SetFormCardValueFormatter = <T = unknown>(entry: FormCardValueFormatterEntry<T>) => void;
11331
+
11150
11332
  /**
11151
11333
  * @experimental This is an experimental component use it at your own risk
11152
11334
  */
@@ -12496,6 +12678,17 @@ export declare interface UseF0FormReturn {
12496
12678
  */
12497
12679
  export declare type UseFileUpload = () => FileUploadHookReturn;
12498
12680
 
12681
+ /**
12682
+ * Returns a resolved formatter for the given `formName`.
12683
+ * Matches registered formatters by specificity:
12684
+ * formName + customFieldName > formName only > customFieldName only > global
12685
+ * Returns `null` when no provider is present or no formatters are registered.
12686
+ */
12687
+ export declare function useFormCardValueFormatter(formName: string): ((key: string, value: unknown, meta: {
12688
+ fieldType?: string;
12689
+ customFieldName?: string;
12690
+ }) => DetailsItemContent | DetailsItemContent[] | undefined) | null;
12691
+
12499
12692
  export declare const useFormComponent: () => F0FormLikeComponent | undefined;
12500
12693
 
12501
12694
  export declare const useGroups: <R extends RecordType>(groups: GroupRecord<R>[], defaultOpenGroups?: boolean | GroupRecord<R>["key"][]) => {
@@ -12648,6 +12841,27 @@ export declare type UseSelectableReturn<R extends RecordType, Filters extends Fi
12648
12841
  handleSelectGroupChange: (groupOrId: GroupRecord<R> | SelectionId | readonly SelectionId[], checked: boolean) => void;
12649
12842
  };
12650
12843
 
12844
+ /**
12845
+ * Returns a setter to register value formatters used by FormCard.
12846
+ *
12847
+ * ```ts
12848
+ * const setFormatter = useSetFormCardValueFormatter()
12849
+ *
12850
+ * // Global formatter (all forms, all fields)
12851
+ * setFormatter({ format: (value) => ({ type: "item", text: String(value) }) })
12852
+ *
12853
+ * // Scoped to a form
12854
+ * setFormatter({ formName: "create-task", format: (value) => ... })
12855
+ *
12856
+ * // Scoped to a custom field name (across all forms)
12857
+ * setFormatter({ customFieldName: "assignees_selector", format: (value) => ... })
12858
+ *
12859
+ * // Scoped to both
12860
+ * setFormatter({ formName: "create-task", customFieldName: "assignees_selector", format: (value) => ... })
12861
+ * ```
12862
+ */
12863
+ export declare function useSetFormCardValueFormatter(): SetFormCardValueFormatter;
12864
+
12651
12865
  export declare const useXRay: () => {
12652
12866
  enabled: boolean;
12653
12867
  filter: ComponentTypes[];
@@ -12754,6 +12968,13 @@ declare type VisualizationSettings = {
12754
12968
  [K in keyof typeof collectionVisualizations]: ExtractVisualizationSettings<(typeof collectionVisualizations)[K]>;
12755
12969
  };
12756
12970
 
12971
+ declare const Weekdays: ForwardRefExoticComponent<WeekdaysProps & RefAttributes<HTMLDivElement>>;
12972
+
12973
+ declare interface WeekdaysProps {
12974
+ activatedDays?: number[];
12975
+ daysOfTheWeek?: string[];
12976
+ }
12977
+
12757
12978
  export declare const WeekStartDay: {
12758
12979
  readonly Sunday: 0;
12759
12980
  readonly Monday: 1;
@@ -12875,6 +13096,11 @@ declare module "gridstack" {
12875
13096
  }
12876
13097
 
12877
13098
 
13099
+ declare namespace Calendar {
13100
+ var displayName: string;
13101
+ }
13102
+
13103
+
12878
13104
  declare module "@tiptap/core" {
12879
13105
  interface Commands<ReturnType> {
12880
13106
  aiBlock: {
@@ -12922,8 +13148,3 @@ declare module "@tiptap/core" {
12922
13148
  };
12923
13149
  }
12924
13150
  }
12925
-
12926
-
12927
- declare namespace Calendar {
12928
- var displayName: string;
12929
- }