@factorialco/f0-react 1.449.2 → 1.450.1

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
@@ -854,6 +854,9 @@ export declare const aiTranslations: {
854
854
  readonly reportLabel: "Report";
855
855
  readonly openButton: "Open";
856
856
  };
857
+ readonly formCard: {
858
+ readonly moreFields: "Open to see all fields";
859
+ };
857
860
  readonly dataDownload: {
858
861
  readonly title: "Download";
859
862
  readonly download: "Download {{format}}";
@@ -1721,7 +1724,7 @@ declare type CandidateProfile = {
1721
1724
  * Discriminated union for canvas panel content.
1722
1725
  * Add new entity types to this union as they are implemented.
1723
1726
  */
1724
- export declare type CanvasContent = DashboardCanvasContent | DataDownloadCanvasContent;
1727
+ export declare type CanvasContent = DashboardCanvasContent | FormCanvasContent | DataDownloadCanvasContent;
1725
1728
 
1726
1729
  /**
1727
1730
  * Base shape shared by all canvas content types.
@@ -1730,6 +1733,7 @@ export declare type CanvasContent = DashboardCanvasContent | DataDownloadCanvasC
1730
1733
  export declare type CanvasContentBase = {
1731
1734
  type: string;
1732
1735
  title: string;
1736
+ description?: string;
1733
1737
  toolCallId?: string;
1734
1738
  };
1735
1739
 
@@ -1766,6 +1770,11 @@ export declare type CanvasEntityDefinition<T extends CanvasContentBase = CanvasC
1766
1770
  content: T;
1767
1771
  children: ReactNode;
1768
1772
  }) => ReactNode;
1773
+ /**
1774
+ * When true the content area uses `overflow-hidden` instead of
1775
+ * `overflow-auto`, letting the entity manage its own scrolling.
1776
+ */
1777
+ overflowHidden?: boolean;
1769
1778
  };
1770
1779
 
1771
1780
  declare type CardAvatarVariant = AvatarVariant | {
@@ -3665,6 +3674,7 @@ export declare const defaultTranslations: {
3665
3674
  readonly expand: "Expand";
3666
3675
  readonly showAll: "Show all";
3667
3676
  readonly showLess: "Show less";
3677
+ readonly seeMore: "See more";
3668
3678
  readonly skipToContent: "Skip to content";
3669
3679
  readonly view: "View";
3670
3680
  readonly unselect: "Unselect";
@@ -3942,6 +3952,9 @@ export declare const defaultTranslations: {
3942
3952
  readonly reportLabel: "Report";
3943
3953
  readonly openButton: "Open";
3944
3954
  };
3955
+ readonly formCard: {
3956
+ readonly moreFields: "Open to see all fields";
3957
+ };
3945
3958
  readonly dataDownload: {
3946
3959
  readonly title: "Download";
3947
3960
  readonly download: "Download {{format}}";
@@ -4681,13 +4694,13 @@ export declare interface F0AiAvailableFormDefinition<TParams extends Record<stri
4681
4694
  schema: F0FormSchema;
4682
4695
  /**
4683
4696
  * Default values for the form fields.
4684
- * Can be a static object or a function that receives params (supplied by the AI via presentForm)
4697
+ * Can be a static object or a function that receives params (supplied by the AI)
4685
4698
  * and returns the defaults.
4686
4699
  */
4687
4700
  defaultValues?: Record<string, unknown> | ((params: TParams) => Record<string, unknown>);
4688
4701
  /**
4689
4702
  * Zod schema that describes the params accepted by a functional `defaultValues`.
4690
- * When provided, the AI will see this schema and can supply params when calling presentForm.
4703
+ * When provided, the AI will see this schema and can supply params.
4691
4704
  * Params are validated against this schema before being passed to `defaultValues`.
4692
4705
  */
4693
4706
  defaultValuesParamsSchema?: ZodType<TParams>;
@@ -4699,8 +4712,14 @@ export declare interface F0AiAvailableFormDefinition<TParams extends Record<stri
4699
4712
  title?: string;
4700
4713
  /** Description shown under the title in dialog mode */
4701
4714
  description?: string;
4715
+ /** Module associated with this form (for avatar display in canvas cards) */
4716
+ module?: ModuleId;
4702
4717
  /** Wizard steps (required for wizard mode to work with multiple steps) */
4703
4718
  steps?: F0WizardFormStep[];
4719
+ /** Submit button configuration (label, icon, etc.) */
4720
+ submitConfig?: F0FormSubmitConfig;
4721
+ /** When to trigger validation errors */
4722
+ errorTriggerMode?: F0FormErrorTriggerMode;
4704
4723
  }
4705
4724
 
4706
4725
  /**
@@ -4715,64 +4734,97 @@ export declare const F0AiChatProvider: ({ enabled, greeting, initialMessage, wel
4715
4734
 
4716
4735
  export declare const F0AiChatTextArea: ({ submitLabel, inProgress, onSend, onStop, creditWarning, }: ChatTextareaProps) => JSX_2.Element;
4717
4736
 
4737
+ /**
4738
+ * Context value for the AI form registry
4739
+ */
4740
+ /** Full runtime description of a form (used for formsOnCurrentPage and activeForm) */
4741
+ declare interface F0AiFormDescription {
4742
+ formName: string;
4743
+ description?: string;
4744
+ module?: ModuleId;
4745
+ /** Custom title for the card (set via fillForm) */
4746
+ cardTitle: string;
4747
+ /** Custom description for the card (set via fillForm) */
4748
+ cardDescription: string;
4749
+ formSchema: Record<string, unknown>;
4750
+ fieldDescriptions: Record<string, {
4751
+ label: string;
4752
+ section?: string;
4753
+ placeholder?: string;
4754
+ helpText?: string;
4755
+ description?: string;
4756
+ fieldType?: string;
4757
+ }>;
4758
+ sectionDescriptions: Record<string, {
4759
+ title: string;
4760
+ description?: string;
4761
+ }>;
4762
+ formValues: Record<string, unknown>;
4763
+ formErrors: Record<string, unknown>;
4764
+ isDirty: boolean;
4765
+ /** JSON Schema of defaultValuesParams (only for forms with defaultValuesParamsSchema) */
4766
+ defaultValuesParamsSchema?: Record<string, unknown>;
4767
+ }
4768
+
4718
4769
  /**
4719
4770
  * Entry in the AI form registry
4720
4771
  */
4721
4772
  export declare interface F0AiFormEntry {
4722
4773
  ref: React.MutableRefObject<F0FormRef | null>;
4723
4774
  schema: F0FormSchema;
4775
+ /** Human-readable description of the form's purpose */
4776
+ description?: string;
4777
+ /** Module associated with this form (for avatar display in canvas cards) */
4778
+ module?: ModuleId;
4724
4779
  /** Whether this entry was registered from an availableFormDefinition (not a rendered form) */
4725
4780
  virtual?: boolean;
4726
4781
  /** Section configs (title, description) keyed by section ID */
4727
4782
  sections?: Record<string, F0SectionConfig>;
4728
- /** Zod schema for params accepted by presentForm (virtual entries only) */
4783
+ /** Zod schema for params accepted by the AI (virtual entries only) */
4729
4784
  defaultValuesParamsSchema?: ZodType;
4730
4785
  /** Raw defaultValues function that accepts params (from rendered forms with defaultValuesParamsSchema) */
4731
4786
  defaultValuesFn?: (params: Record<string, unknown>) => Promise<Record<string, unknown>>;
4732
4787
  /** Field names explicitly set via setValue/setValues on a virtual ref */
4733
4788
  dirtyFields?: Set<string>;
4789
+ /** Consumer submit callback (from availableFormDefinition). Preserved across virtual ↔ rendered transitions. */
4790
+ onSubmit?: (values: Record<string, unknown>) => void | Promise<void>;
4791
+ /** Wizard steps (for multi-step form rendering) */
4792
+ steps?: F0WizardFormStep[];
4793
+ /** Submit button configuration (label, icon, etc.) */
4794
+ submitConfig?: F0FormSubmitConfig;
4795
+ /** When to trigger validation errors */
4796
+ errorTriggerMode?: F0FormErrorTriggerMode;
4734
4797
  }
4735
4798
 
4736
- /**
4737
- * Context value for the AI form registry
4738
- */
4739
4799
  declare interface F0AiFormRegistryContextValue {
4740
- register: (name: string, ref: React.MutableRefObject<F0FormRef | null>, schema: F0FormSchema, sections?: Record<string, F0SectionConfig>, defaultValuesParamsSchema?: ZodType, defaultValuesFn?: (params: Record<string, unknown>) => Promise<Record<string, unknown>>) => void;
4800
+ register: (name: string, ref: React.MutableRefObject<F0FormRef | null>, schema: F0FormSchema, sections?: Record<string, F0SectionConfig>, defaultValuesParamsSchema?: ZodType, defaultValuesFn?: (params: Record<string, unknown>) => Promise<Record<string, unknown>>, description?: string, module?: ModuleId) => void;
4741
4801
  unregister: (name: string) => void;
4742
4802
  get: (name: string) => F0AiFormEntry | undefined;
4743
4803
  getFormNames: () => string[];
4744
4804
  /** Rebuild the form descriptions snapshot (call after mutating form state) */
4745
4805
  rebuildDescriptions: () => void;
4746
- /** Structured descriptions of all active forms, updated on register/unregister */
4747
- formDescriptions: {
4748
- formName: string;
4749
- formSchema: Record<string, unknown>;
4750
- fieldDescriptions: Record<string, {
4751
- label: string;
4752
- section?: string;
4753
- placeholder?: string;
4754
- helpText?: string;
4755
- description?: string;
4756
- }>;
4757
- sectionDescriptions: Record<string, {
4758
- title: string;
4759
- description?: string;
4760
- }>;
4761
- formValues: Record<string, unknown>;
4762
- formErrors: Record<string, unknown>;
4763
- isDirty: boolean;
4764
- /** JSON Schema of defaultValuesParams accepted by presentForm (only for forms with defaultValuesParamsSchema) */
4765
- defaultValuesParamsSchema?: Record<string, unknown>;
4766
- }[];
4767
- /** Currently AI-presented form, or null */
4768
- presentedForm: F0AiPresentedForm | null;
4769
- /** Called by the AI tool to present a form */
4770
- presentForm: (formName: string, mode: "dialog" | "wizard", defaultValuesParams?: Record<string, unknown>) => {
4806
+ /** Full runtime state of all rendered (non-virtual) forms on the current page */
4807
+ formsOnCurrentPage: F0AiFormDescription[];
4808
+ /** Full runtime state of all virtual/available forms */
4809
+ availableForms: F0AiFormDescription[];
4810
+ /** Full runtime state of the form the AI is actively co-editing, or null */
4811
+ activeForm: F0AiFormDescription | null;
4812
+ /** Set an available form as the active co-editing form */
4813
+ setActiveForm: (formName: string, cardMeta?: {
4814
+ cardTitle: string;
4815
+ cardDescription: string;
4816
+ }) => {
4771
4817
  success: boolean;
4772
4818
  error?: string;
4773
4819
  };
4774
- /** Called when the presented form is closed (submit/cancel) */
4775
- dismissForm: () => void;
4820
+ /** Clear the active co-editing form (e.g. after submit) */
4821
+ clearActiveForm: () => void;
4822
+ /** Bump the fill-version counter for a form (called after fillForm succeeds) */
4823
+ incrementFillVersion: (formName: string) => void;
4824
+ /** Reset the fill-version counter for a form (e.g. after submit) */
4825
+ resetFillVersion: (formName: string) => void;
4826
+ /** Get the fill-version counter for a form (0 = never filled) */
4827
+ getFillVersion: (formName: string) => number;
4776
4828
  }
4777
4829
 
4778
4830
  /**
@@ -4846,20 +4898,6 @@ export declare class F0AiMask {
4846
4898
  private render;
4847
4899
  }
4848
4900
 
4849
- /**
4850
- * Tracks an AI-presented form (opened via the presentForm tool)
4851
- */
4852
- export declare interface F0AiPresentedForm {
4853
- /** Name of the form (matches an availableFormDefinition) */
4854
- name: string;
4855
- /** Render mode chosen by the LLM */
4856
- mode: "dialog" | "wizard";
4857
- /** Resolved definition from availableFormDefinitions */
4858
- definition: F0AiAvailableFormDefinition;
4859
- /** Snapshot of the virtual form's values at the time presentForm was called */
4860
- initialValues: Record<string, unknown>;
4861
- }
4862
-
4863
4901
  export declare const F0Alert: WithDataTestIdReturnType_3<({ title, description, action, link, icon, variant, onClose, }: F0AlertProps) => JSX_2.Element>;
4864
4902
 
4865
4903
  export declare interface F0AlertProps {
@@ -6507,6 +6545,10 @@ export declare type F0FormDefinition<T extends F0FormSchema_2 | F0PerSectionSche
6507
6545
  export declare interface F0FormDefinitionPerSection<T extends F0PerSectionSchema_2> {
6508
6546
  /* Excluded from this release type: _brand */
6509
6547
  name: string;
6548
+ /** Human-readable description of the form's purpose */
6549
+ description?: string;
6550
+ /** Module associated with this form (for avatar display in canvas cards) */
6551
+ module?: ModuleId;
6510
6552
  schema: T;
6511
6553
  sections?: Record<string, F0PerSectionSectionConfig>;
6512
6554
  defaultValues?: {
@@ -6523,11 +6565,17 @@ export declare interface F0FormDefinitionPerSection<T extends F0PerSectionSchema
6523
6565
  defaultValuesFn?: (params: Record<string, unknown>) => Promise<{
6524
6566
  [K in keyof T]?: Partial<z.infer<T[K]>>;
6525
6567
  }>;
6568
+ /** Wizard steps — when present, F0WizardForm uses these instead of auto-deriving from sections */
6569
+ steps?: F0WizardFormStep[];
6526
6570
  }
6527
6571
 
6528
6572
  export declare interface F0FormDefinitionSingleSchema<TSchema extends F0FormSchema_2> {
6529
6573
  /* Excluded from this release type: _brand */
6530
6574
  name: string;
6575
+ /** Human-readable description of the form's purpose */
6576
+ description?: string;
6577
+ /** Module associated with this form (for avatar display in canvas cards) */
6578
+ module?: ModuleId;
6531
6579
  schema: TSchema;
6532
6580
  sections?: Record<string, F0SectionConfig>;
6533
6581
  defaultValues?: Partial<z.infer<TSchema>>;
@@ -6540,6 +6588,8 @@ export declare interface F0FormDefinitionSingleSchema<TSchema extends F0FormSche
6540
6588
  defaultValuesParamsSchema?: ZodType;
6541
6589
  /** Raw defaultValues function for AI registry use when params are involved */
6542
6590
  defaultValuesFn?: (params: Record<string, unknown>) => Promise<Partial<z.infer<TSchema>>>;
6591
+ /** Wizard steps — when present, F0WizardForm uses these instead of auto-deriving from sections */
6592
+ steps?: F0WizardFormStep[];
6543
6593
  }
6544
6594
 
6545
6595
  /**
@@ -6791,6 +6841,10 @@ export declare interface F0FormPropsWithPerSectionSchema<T extends F0PerSectionS
6791
6841
  export declare interface F0FormPropsWithSingleSchema<TSchema extends F0FormSchema> {
6792
6842
  /** Unique name for the form, used for generating anchor links */
6793
6843
  name: string;
6844
+ /** Human-readable description of the form's purpose */
6845
+ description?: string;
6846
+ /** Module associated with this form (for avatar display in canvas cards) */
6847
+ module?: ModuleId;
6794
6848
  /** Zod object schema with F0 field configurations */
6795
6849
  schema: TSchema;
6796
6850
  /** Section configurations keyed by section ID */
@@ -8270,6 +8324,16 @@ declare type FormatPreset = {
8270
8324
  type: "compact";
8271
8325
  };
8272
8326
 
8327
+ /**
8328
+ * Form canvas content — renders an interactive F0Form in the canvas panel.
8329
+ */
8330
+ declare type FormCanvasContent = CanvasContentBase & {
8331
+ type: "form";
8332
+ formName: string;
8333
+ formDescription?: string;
8334
+ formModule?: ModuleId;
8335
+ };
8336
+
8273
8337
  /* Excluded from this release type: FormDefinitionItem */
8274
8338
 
8275
8339
  /**
@@ -12245,11 +12309,17 @@ export declare function useF0FormDefinition<T extends F0PerSectionSchema_2, TPar
12245
12309
  /** Base fields shared by all per-section input variants */
12246
12310
  declare interface UseF0FormDefinitionPerSectionInputBase<T extends F0PerSectionSchema_2> {
12247
12311
  name: string;
12312
+ /** Human-readable description of the form's purpose */
12313
+ description?: string;
12314
+ /** Module associated with this form (for avatar display in canvas cards) */
12315
+ module?: ModuleId;
12248
12316
  schema: T;
12249
12317
  sections?: Record<string, F0PerSectionSectionConfig>;
12250
12318
  onSubmit: (arg: F0WizardFormPerSectionSubmitArg<T>) => Promise<F0FormSubmitResult> | F0FormSubmitResult;
12251
12319
  submitConfig?: F0PerSectionSubmitConfig;
12252
12320
  errorTriggerMode?: F0FormErrorTriggerMode;
12321
+ /** Wizard steps — when present, F0WizardForm uses these instead of auto-deriving from sections */
12322
+ steps?: F0WizardFormStep[];
12253
12323
  }
12254
12324
 
12255
12325
  /** Per-section input WITHOUT `defaultValuesParamsSchema` */
@@ -12273,11 +12343,17 @@ declare interface UseF0FormDefinitionPerSectionInputWithParams<T extends F0PerSe
12273
12343
  /** Base fields shared by all single-schema input variants */
12274
12344
  declare interface UseF0FormDefinitionSingleSchemaInputBase<TSchema extends F0FormSchema_2> {
12275
12345
  name: string;
12346
+ /** Human-readable description of the form's purpose */
12347
+ description?: string;
12348
+ /** Module associated with this form (for avatar display in canvas cards) */
12349
+ module?: ModuleId;
12276
12350
  schema: TSchema;
12277
12351
  sections?: Record<string, F0SectionConfig>;
12278
12352
  onSubmit: (arg: F0WizardFormSingleSubmitArg<TSchema>) => Promise<F0FormSubmitResult> | F0FormSubmitResult;
12279
12353
  submitConfig?: F0FormSubmitConfig;
12280
12354
  errorTriggerMode?: F0FormErrorTriggerMode;
12355
+ /** Wizard steps — when present, F0WizardForm uses these instead of auto-deriving from sections */
12356
+ steps?: F0WizardFormStep[];
12281
12357
  }
12282
12358
 
12283
12359
  /** Single-schema input WITHOUT `defaultValuesParamsSchema` → `defaultValues` is sync or `(signal) => Promise<T>` */
@@ -12731,16 +12807,11 @@ declare module "gridstack" {
12731
12807
  }
12732
12808
 
12733
12809
 
12734
- declare namespace Calendar {
12735
- var displayName: string;
12736
- }
12737
-
12738
-
12739
12810
  declare module "@tiptap/core" {
12740
12811
  interface Commands<ReturnType> {
12741
- enhanceHighlight: {
12742
- setEnhanceHighlight: (from: number, to: number) => ReturnType;
12743
- clearEnhanceHighlight: () => ReturnType;
12812
+ aiBlock: {
12813
+ insertAIBlock: (data: AIBlockData, config: AIBlockConfig) => ReturnType;
12814
+ executeAIAction: (actionType: string, config: AIBlockConfig) => ReturnType;
12744
12815
  };
12745
12816
  }
12746
12817
  }
@@ -12748,9 +12819,8 @@ declare module "@tiptap/core" {
12748
12819
 
12749
12820
  declare module "@tiptap/core" {
12750
12821
  interface Commands<ReturnType> {
12751
- aiBlock: {
12752
- insertAIBlock: (data: AIBlockData, config: AIBlockConfig) => ReturnType;
12753
- executeAIAction: (actionType: string, config: AIBlockConfig) => ReturnType;
12822
+ moodTracker: {
12823
+ insertMoodTracker: (data: MoodTrackerData) => ReturnType;
12754
12824
  };
12755
12825
  }
12756
12826
  }
@@ -12758,8 +12828,9 @@ declare module "@tiptap/core" {
12758
12828
 
12759
12829
  declare module "@tiptap/core" {
12760
12830
  interface Commands<ReturnType> {
12761
- moodTracker: {
12762
- insertMoodTracker: (data: MoodTrackerData) => ReturnType;
12831
+ enhanceHighlight: {
12832
+ setEnhanceHighlight: (from: number, to: number) => ReturnType;
12833
+ clearEnhanceHighlight: () => ReturnType;
12763
12834
  };
12764
12835
  }
12765
12836
  }
@@ -12783,3 +12854,8 @@ declare module "@tiptap/core" {
12783
12854
  };
12784
12855
  }
12785
12856
  }
12857
+
12858
+
12859
+ declare namespace Calendar {
12860
+ var displayName: string;
12861
+ }