@factorialco/f0-react 1.449.1 → 1.450.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
@@ -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}}";
@@ -887,6 +890,7 @@ export declare const aiTranslations: {
887
890
  };
888
891
  readonly attachFile: "Attach file";
889
892
  readonly removeFile: "Remove";
893
+ readonly fileUploadError: "Upload failed";
890
894
  readonly dropFilesHere: "Drop your files here";
891
895
  readonly clarifyingQuestion: {
892
896
  readonly submit: "Submit";
@@ -1720,7 +1724,7 @@ declare type CandidateProfile = {
1720
1724
  * Discriminated union for canvas panel content.
1721
1725
  * Add new entity types to this union as they are implemented.
1722
1726
  */
1723
- export declare type CanvasContent = DashboardCanvasContent | DataDownloadCanvasContent;
1727
+ export declare type CanvasContent = DashboardCanvasContent | FormCanvasContent | DataDownloadCanvasContent;
1724
1728
 
1725
1729
  /**
1726
1730
  * Base shape shared by all canvas content types.
@@ -1729,6 +1733,7 @@ export declare type CanvasContent = DashboardCanvasContent | DataDownloadCanvasC
1729
1733
  export declare type CanvasContentBase = {
1730
1734
  type: string;
1731
1735
  title: string;
1736
+ description?: string;
1732
1737
  toolCallId?: string;
1733
1738
  };
1734
1739
 
@@ -1765,6 +1770,11 @@ export declare type CanvasEntityDefinition<T extends CanvasContentBase = CanvasC
1765
1770
  content: T;
1766
1771
  children: ReactNode;
1767
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;
1768
1778
  };
1769
1779
 
1770
1780
  declare type CardAvatarVariant = AvatarVariant | {
@@ -3664,6 +3674,7 @@ export declare const defaultTranslations: {
3664
3674
  readonly expand: "Expand";
3665
3675
  readonly showAll: "Show all";
3666
3676
  readonly showLess: "Show less";
3677
+ readonly seeMore: "See more";
3667
3678
  readonly skipToContent: "Skip to content";
3668
3679
  readonly view: "View";
3669
3680
  readonly unselect: "Unselect";
@@ -3941,6 +3952,9 @@ export declare const defaultTranslations: {
3941
3952
  readonly reportLabel: "Report";
3942
3953
  readonly openButton: "Open";
3943
3954
  };
3955
+ readonly formCard: {
3956
+ readonly moreFields: "Open to see all fields";
3957
+ };
3944
3958
  readonly dataDownload: {
3945
3959
  readonly title: "Download";
3946
3960
  readonly download: "Download {{format}}";
@@ -3974,6 +3988,7 @@ export declare const defaultTranslations: {
3974
3988
  };
3975
3989
  readonly attachFile: "Attach file";
3976
3990
  readonly removeFile: "Remove";
3991
+ readonly fileUploadError: "Upload failed";
3977
3992
  readonly dropFilesHere: "Drop your files here";
3978
3993
  readonly clarifyingQuestion: {
3979
3994
  readonly submit: "Submit";
@@ -4679,13 +4694,13 @@ export declare interface F0AiAvailableFormDefinition<TParams extends Record<stri
4679
4694
  schema: F0FormSchema;
4680
4695
  /**
4681
4696
  * Default values for the form fields.
4682
- * 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)
4683
4698
  * and returns the defaults.
4684
4699
  */
4685
4700
  defaultValues?: Record<string, unknown> | ((params: TParams) => Record<string, unknown>);
4686
4701
  /**
4687
4702
  * Zod schema that describes the params accepted by a functional `defaultValues`.
4688
- * 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.
4689
4704
  * Params are validated against this schema before being passed to `defaultValues`.
4690
4705
  */
4691
4706
  defaultValuesParamsSchema?: ZodType<TParams>;
@@ -4697,8 +4712,14 @@ export declare interface F0AiAvailableFormDefinition<TParams extends Record<stri
4697
4712
  title?: string;
4698
4713
  /** Description shown under the title in dialog mode */
4699
4714
  description?: string;
4715
+ /** Module associated with this form (for avatar display in canvas cards) */
4716
+ module?: ModuleId;
4700
4717
  /** Wizard steps (required for wizard mode to work with multiple steps) */
4701
4718
  steps?: F0WizardFormStep[];
4719
+ /** Submit button configuration (label, icon, etc.) */
4720
+ submitConfig?: F0FormSubmitConfig;
4721
+ /** When to trigger validation errors */
4722
+ errorTriggerMode?: F0FormErrorTriggerMode;
4702
4723
  }
4703
4724
 
4704
4725
  /**
@@ -4713,64 +4734,97 @@ export declare const F0AiChatProvider: ({ enabled, greeting, initialMessage, wel
4713
4734
 
4714
4735
  export declare const F0AiChatTextArea: ({ submitLabel, inProgress, onSend, onStop, creditWarning, }: ChatTextareaProps) => JSX_2.Element;
4715
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
+
4716
4769
  /**
4717
4770
  * Entry in the AI form registry
4718
4771
  */
4719
4772
  export declare interface F0AiFormEntry {
4720
4773
  ref: React.MutableRefObject<F0FormRef | null>;
4721
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;
4722
4779
  /** Whether this entry was registered from an availableFormDefinition (not a rendered form) */
4723
4780
  virtual?: boolean;
4724
4781
  /** Section configs (title, description) keyed by section ID */
4725
4782
  sections?: Record<string, F0SectionConfig>;
4726
- /** Zod schema for params accepted by presentForm (virtual entries only) */
4783
+ /** Zod schema for params accepted by the AI (virtual entries only) */
4727
4784
  defaultValuesParamsSchema?: ZodType;
4728
4785
  /** Raw defaultValues function that accepts params (from rendered forms with defaultValuesParamsSchema) */
4729
4786
  defaultValuesFn?: (params: Record<string, unknown>) => Promise<Record<string, unknown>>;
4730
4787
  /** Field names explicitly set via setValue/setValues on a virtual ref */
4731
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;
4732
4797
  }
4733
4798
 
4734
- /**
4735
- * Context value for the AI form registry
4736
- */
4737
4799
  declare interface F0AiFormRegistryContextValue {
4738
- 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;
4739
4801
  unregister: (name: string) => void;
4740
4802
  get: (name: string) => F0AiFormEntry | undefined;
4741
4803
  getFormNames: () => string[];
4742
4804
  /** Rebuild the form descriptions snapshot (call after mutating form state) */
4743
4805
  rebuildDescriptions: () => void;
4744
- /** Structured descriptions of all active forms, updated on register/unregister */
4745
- formDescriptions: {
4746
- formName: string;
4747
- formSchema: Record<string, unknown>;
4748
- fieldDescriptions: Record<string, {
4749
- label: string;
4750
- section?: string;
4751
- placeholder?: string;
4752
- helpText?: string;
4753
- description?: string;
4754
- }>;
4755
- sectionDescriptions: Record<string, {
4756
- title: string;
4757
- description?: string;
4758
- }>;
4759
- formValues: Record<string, unknown>;
4760
- formErrors: Record<string, unknown>;
4761
- isDirty: boolean;
4762
- /** JSON Schema of defaultValuesParams accepted by presentForm (only for forms with defaultValuesParamsSchema) */
4763
- defaultValuesParamsSchema?: Record<string, unknown>;
4764
- }[];
4765
- /** Currently AI-presented form, or null */
4766
- presentedForm: F0AiPresentedForm | null;
4767
- /** Called by the AI tool to present a form */
4768
- 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
+ }) => {
4769
4817
  success: boolean;
4770
4818
  error?: string;
4771
4819
  };
4772
- /** Called when the presented form is closed (submit/cancel) */
4773
- 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;
4774
4828
  }
4775
4829
 
4776
4830
  /**
@@ -4844,20 +4898,6 @@ export declare class F0AiMask {
4844
4898
  private render;
4845
4899
  }
4846
4900
 
4847
- /**
4848
- * Tracks an AI-presented form (opened via the presentForm tool)
4849
- */
4850
- export declare interface F0AiPresentedForm {
4851
- /** Name of the form (matches an availableFormDefinition) */
4852
- name: string;
4853
- /** Render mode chosen by the LLM */
4854
- mode: "dialog" | "wizard";
4855
- /** Resolved definition from availableFormDefinitions */
4856
- definition: F0AiAvailableFormDefinition;
4857
- /** Snapshot of the virtual form's values at the time presentForm was called */
4858
- initialValues: Record<string, unknown>;
4859
- }
4860
-
4861
4901
  export declare const F0Alert: WithDataTestIdReturnType_3<({ title, description, action, link, icon, variant, onClose, }: F0AlertProps) => JSX_2.Element>;
4862
4902
 
4863
4903
  export declare interface F0AlertProps {
@@ -6505,6 +6545,10 @@ export declare type F0FormDefinition<T extends F0FormSchema_2 | F0PerSectionSche
6505
6545
  export declare interface F0FormDefinitionPerSection<T extends F0PerSectionSchema_2> {
6506
6546
  /* Excluded from this release type: _brand */
6507
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;
6508
6552
  schema: T;
6509
6553
  sections?: Record<string, F0PerSectionSectionConfig>;
6510
6554
  defaultValues?: {
@@ -6521,11 +6565,17 @@ export declare interface F0FormDefinitionPerSection<T extends F0PerSectionSchema
6521
6565
  defaultValuesFn?: (params: Record<string, unknown>) => Promise<{
6522
6566
  [K in keyof T]?: Partial<z.infer<T[K]>>;
6523
6567
  }>;
6568
+ /** Wizard steps — when present, F0WizardForm uses these instead of auto-deriving from sections */
6569
+ steps?: F0WizardFormStep[];
6524
6570
  }
6525
6571
 
6526
6572
  export declare interface F0FormDefinitionSingleSchema<TSchema extends F0FormSchema_2> {
6527
6573
  /* Excluded from this release type: _brand */
6528
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;
6529
6579
  schema: TSchema;
6530
6580
  sections?: Record<string, F0SectionConfig>;
6531
6581
  defaultValues?: Partial<z.infer<TSchema>>;
@@ -6538,6 +6588,8 @@ export declare interface F0FormDefinitionSingleSchema<TSchema extends F0FormSche
6538
6588
  defaultValuesParamsSchema?: ZodType;
6539
6589
  /** Raw defaultValues function for AI registry use when params are involved */
6540
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[];
6541
6593
  }
6542
6594
 
6543
6595
  /**
@@ -6789,6 +6841,10 @@ export declare interface F0FormPropsWithPerSectionSchema<T extends F0PerSectionS
6789
6841
  export declare interface F0FormPropsWithSingleSchema<TSchema extends F0FormSchema> {
6790
6842
  /** Unique name for the form, used for generating anchor links */
6791
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;
6792
6848
  /** Zod object schema with F0 field configurations */
6793
6849
  schema: TSchema;
6794
6850
  /** Section configurations keyed by section ID */
@@ -8268,6 +8324,16 @@ declare type FormatPreset = {
8268
8324
  type: "compact";
8269
8325
  };
8270
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
+
8271
8337
  /* Excluded from this release type: FormDefinitionItem */
8272
8338
 
8273
8339
  /**
@@ -12243,11 +12309,17 @@ export declare function useF0FormDefinition<T extends F0PerSectionSchema_2, TPar
12243
12309
  /** Base fields shared by all per-section input variants */
12244
12310
  declare interface UseF0FormDefinitionPerSectionInputBase<T extends F0PerSectionSchema_2> {
12245
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;
12246
12316
  schema: T;
12247
12317
  sections?: Record<string, F0PerSectionSectionConfig>;
12248
12318
  onSubmit: (arg: F0WizardFormPerSectionSubmitArg<T>) => Promise<F0FormSubmitResult> | F0FormSubmitResult;
12249
12319
  submitConfig?: F0PerSectionSubmitConfig;
12250
12320
  errorTriggerMode?: F0FormErrorTriggerMode;
12321
+ /** Wizard steps — when present, F0WizardForm uses these instead of auto-deriving from sections */
12322
+ steps?: F0WizardFormStep[];
12251
12323
  }
12252
12324
 
12253
12325
  /** Per-section input WITHOUT `defaultValuesParamsSchema` */
@@ -12271,11 +12343,17 @@ declare interface UseF0FormDefinitionPerSectionInputWithParams<T extends F0PerSe
12271
12343
  /** Base fields shared by all single-schema input variants */
12272
12344
  declare interface UseF0FormDefinitionSingleSchemaInputBase<TSchema extends F0FormSchema_2> {
12273
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;
12274
12350
  schema: TSchema;
12275
12351
  sections?: Record<string, F0SectionConfig>;
12276
12352
  onSubmit: (arg: F0WizardFormSingleSubmitArg<TSchema>) => Promise<F0FormSubmitResult> | F0FormSubmitResult;
12277
12353
  submitConfig?: F0FormSubmitConfig;
12278
12354
  errorTriggerMode?: F0FormErrorTriggerMode;
12355
+ /** Wizard steps — when present, F0WizardForm uses these instead of auto-deriving from sections */
12356
+ steps?: F0WizardFormStep[];
12279
12357
  }
12280
12358
 
12281
12359
  /** Single-schema input WITHOUT `defaultValuesParamsSchema` → `defaultValues` is sync or `(signal) => Promise<T>` */
@@ -12729,11 +12807,6 @@ declare module "gridstack" {
12729
12807
  }
12730
12808
 
12731
12809
 
12732
- declare namespace Calendar {
12733
- var displayName: string;
12734
- }
12735
-
12736
-
12737
12810
  declare module "@tiptap/core" {
12738
12811
  interface Commands<ReturnType> {
12739
12812
  aiBlock: {
@@ -12781,3 +12854,8 @@ declare module "@tiptap/core" {
12781
12854
  };
12782
12855
  }
12783
12856
  }
12857
+
12858
+
12859
+ declare namespace Calendar {
12860
+ var displayName: string;
12861
+ }