@factorialco/f0-react 1.388.4 → 1.389.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.
@@ -1738,6 +1738,8 @@ declare type CompareToDef = {
1738
1738
 
1739
1739
  declare type CompareToDefKey = string;
1740
1740
 
1741
+ export declare function computeSectionEndIds(elements: CoCreationFormElement[]): Set<string>;
1742
+
1741
1743
  declare type Content = (ComponentProps<typeof DataList.Item> & {
1742
1744
  type: "item";
1743
1745
  }) | (ComponentProps<typeof DataList.PersonItem> & {
@@ -2677,6 +2679,8 @@ declare const defaultTranslations: {
2677
2679
  readonly deleteQuestion: "Delete question";
2678
2680
  readonly duplicateSection: "Duplicate section";
2679
2681
  readonly deleteSection: "Delete section";
2682
+ readonly confirmMoveLastQuestion: "Move question";
2683
+ readonly cancelMoveLastQuestion: "Cancel";
2680
2684
  };
2681
2685
  readonly questionTypes: {
2682
2686
  readonly section: "Section";
@@ -2688,6 +2692,7 @@ declare const defaultTranslations: {
2688
2692
  readonly numeric: "Numeric";
2689
2693
  readonly link: "Link";
2690
2694
  readonly date: "Date";
2695
+ readonly dropdownSingle: "Dropdown";
2691
2696
  };
2692
2697
  readonly selectQuestion: {
2693
2698
  readonly addOption: "Add option";
@@ -2714,6 +2719,8 @@ declare const defaultTranslations: {
2714
2719
  readonly questionOptions: "Question options";
2715
2720
  readonly actions: "Actions";
2716
2721
  readonly sectionTitlePlaceholder: "Section title";
2722
+ readonly lastQuestionDialogTitle: "Remove last question from section";
2723
+ readonly lastQuestionDialogDescription: "Moving this question will leave the section empty and it will be removed. Do you want to continue?";
2717
2724
  };
2718
2725
  };
2719
2726
  readonly richTextEditor: {
@@ -3813,6 +3820,20 @@ declare type FlagAvatarVariant = Extract<AvatarVariant, {
3813
3820
  type: "flag";
3814
3821
  }>;
3815
3822
 
3823
+ export declare type FlatFormItem = {
3824
+ type: "section-header";
3825
+ id: string;
3826
+ section: SectionElement;
3827
+ } | {
3828
+ type: "question";
3829
+ id: string;
3830
+ question: QuestionElement;
3831
+ } | {
3832
+ type: "section-end";
3833
+ id: string;
3834
+ sectionId: string;
3835
+ };
3836
+
3816
3837
  export declare type FlattenedItem = {
3817
3838
  parent: EntitySelectEntity | null;
3818
3839
  subItem: EntitySelectSubEntity & {
@@ -3821,6 +3842,8 @@ export declare type FlattenedItem = {
3821
3842
  };
3822
3843
  };
3823
3844
 
3845
+ export declare function flattenElements(elements: CoCreationFormElement[]): FlatFormItem[];
3846
+
3824
3847
  declare type FontSize = (typeof fontSizes)[number];
3825
3848
 
3826
3849
  declare const fontSizes: readonly ["sm", "md", "lg"];
@@ -4137,6 +4160,21 @@ export declare type InfiniteScrollPaginatedResponse<TRecord> = BasePaginatedResp
4137
4160
  hasMore: boolean;
4138
4161
  };
4139
4162
 
4163
+ /**
4164
+ * Re-inject section-end markers into a flat list that has none.
4165
+ *
4166
+ * Uses `inSectionQuestionIds` (the set of question IDs that originally
4167
+ * belonged to *any* section) to determine where each section ends:
4168
+ * - Questions in the set stay inside the current section.
4169
+ * - Original standalone questions (NOT in the set) cause the section to close
4170
+ * before them so they remain standalone.
4171
+ *
4172
+ * This allows cross-section moves (a question from section B placed after
4173
+ * section A's header joins section A) while keeping standalone questions
4174
+ * outside sections unless the user explicitly drags them between section items.
4175
+ */
4176
+ export declare function injectSectionEnds(items: FlatFormItem[], inSectionQuestionIds: Set<string>): FlatFormItem[];
4177
+
4140
4178
  /**
4141
4179
  * @experimental This is an experimental component use it at your own risk
4142
4180
  */
@@ -5733,6 +5771,8 @@ declare interface ReactionsProps {
5733
5771
  };
5734
5772
  }
5735
5773
 
5774
+ export declare function reconstructElements(flatItems: FlatFormItem[]): CoCreationFormElement[];
5775
+
5736
5776
  /**
5737
5777
  * Utility type to get all possible paths through an object using dot notation
5738
5778
  * @template T - The object type to traverse
@@ -6498,8 +6538,27 @@ export declare type TOCItemAction = {
6498
6538
  label: string;
6499
6539
  onClick: () => void;
6500
6540
  icon?: IconType;
6541
+ critical?: boolean;
6542
+ /** Show a check icon to indicate this item is selected */
6543
+ selected?: boolean;
6501
6544
  } | {
6502
6545
  type: "separator";
6546
+ } | {
6547
+ type: "label";
6548
+ text: string;
6549
+ } | {
6550
+ type: "toggle";
6551
+ label: string;
6552
+ icon?: IconType;
6553
+ checked: boolean;
6554
+ onCheckedChange: (checked: boolean) => void;
6555
+ } | {
6556
+ type: "submenu";
6557
+ label: string;
6558
+ icon?: IconType;
6559
+ /** Currently selected option label shown inline */
6560
+ selectedLabel?: string;
6561
+ children: TOCItemAction[];
6503
6562
  };
6504
6563
 
6505
6564
  declare interface TOCItemProps {