@factorialco/f0-react 1.388.4 → 1.390.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
@@ -1051,6 +1051,10 @@ export declare type ButtonDropdownItem<T = string> = {
1051
1051
  description?: string;
1052
1052
  };
1053
1053
 
1054
+ export declare type ButtonDropdownMode = (typeof buttonDropdownModes)[number];
1055
+
1056
+ export declare const buttonDropdownModes: readonly ["split", "dropdown"];
1057
+
1054
1058
  export declare type ButtonDropdownSize = (typeof buttonDropdownSizes)[number];
1055
1059
 
1056
1060
  export declare const buttonDropdownSizes: readonly ["sm", "md", "lg"];
@@ -1785,6 +1789,8 @@ declare type DataCollectionSourceDefinition<R extends RecordType = RecordType, F
1785
1789
  itemActions?: ItemActions;
1786
1790
  /** Available primary actions that can be performed on the collection */
1787
1791
  primaryActions?: PrimaryActionsDefinitionFn;
1792
+ /** Label for the primary actions dropdown trigger button */
1793
+ primaryActionsLabel?: string;
1788
1794
  /** Available secondary actions that can be performed on the collection */
1789
1795
  secondaryActions?: SecondaryActionsDefinition;
1790
1796
  /** Available summaries fields. If not provided, summaries is not allowed. */
@@ -2573,6 +2579,8 @@ export declare const defaultTranslations: {
2573
2579
  readonly deleteQuestion: "Delete question";
2574
2580
  readonly duplicateSection: "Duplicate section";
2575
2581
  readonly deleteSection: "Delete section";
2582
+ readonly confirmMoveLastQuestion: "Move question";
2583
+ readonly cancelMoveLastQuestion: "Cancel";
2576
2584
  };
2577
2585
  readonly questionTypes: {
2578
2586
  readonly section: "Section";
@@ -2584,6 +2592,7 @@ export declare const defaultTranslations: {
2584
2592
  readonly numeric: "Numeric";
2585
2593
  readonly link: "Link";
2586
2594
  readonly date: "Date";
2595
+ readonly dropdownSingle: "Dropdown";
2587
2596
  };
2588
2597
  readonly selectQuestion: {
2589
2598
  readonly addOption: "Add option";
@@ -2610,6 +2619,8 @@ export declare const defaultTranslations: {
2610
2619
  readonly questionOptions: "Question options";
2611
2620
  readonly actions: "Actions";
2612
2621
  readonly sectionTitlePlaceholder: "Section title";
2622
+ readonly lastQuestionDialogTitle: "Remove last question from section";
2623
+ readonly lastQuestionDialogDescription: "Moving this question will leave the section empty and it will be removed. Do you want to continue?";
2613
2624
  };
2614
2625
  };
2615
2626
  readonly richTextEditor: {
@@ -3449,9 +3460,9 @@ export declare const F0Button: WithDataTestIdReturnType_3<ForwardRefExoticCompon
3449
3460
  variant?: Exclude<ButtonInternalProps["variant"], "ai">;
3450
3461
  } & RefAttributes<HTMLAnchorElement | HTMLButtonElement>>>;
3451
3462
 
3452
- export declare const F0ButtonDropdown: WithDataTestIdReturnType_6<({ onClick, value, ...props }: F0ButtonDropdownProps) => JSX_2.Element | undefined>;
3463
+ export declare const F0ButtonDropdown: WithDataTestIdReturnType_6<(props: F0ButtonDropdownProps) => JSX_2.Element>;
3453
3464
 
3454
- export declare type F0ButtonDropdownProps<T = string> = {
3465
+ declare type F0ButtonDropdownBaseProps<T = string> = {
3455
3466
  /**
3456
3467
  * The size of the button.
3457
3468
  * @default "md"
@@ -3466,10 +3477,6 @@ export declare type F0ButtonDropdownProps<T = string> = {
3466
3477
  * @default "default"
3467
3478
  */
3468
3479
  variant?: ButtonDropdownVariant;
3469
- /**
3470
- * The value of the button.
3471
- */
3472
- value?: T;
3473
3480
  /**
3474
3481
  * The disabled state of the button.
3475
3482
  * @default false
@@ -3485,8 +3492,51 @@ export declare type F0ButtonDropdownProps<T = string> = {
3485
3492
  * @default undefined
3486
3493
  */
3487
3494
  tooltip?: string;
3495
+ };
3496
+
3497
+ /**
3498
+ * Props for dropdown mode: a unified button with chevron that opens a dropdown
3499
+ * showing all items (with optional descriptions and icons).
3500
+ */
3501
+ declare type F0ButtonDropdownDropdownProps<T = string> = F0ButtonDropdownBaseProps<T> & {
3502
+ /**
3503
+ * The rendering mode.
3504
+ * - "dropdown": Single button with chevron — clicking anywhere opens the dropdown with all items.
3505
+ */
3506
+ mode: "dropdown";
3507
+ /**
3508
+ * Optional trigger button label. Customize the label shown on the
3509
+ * trigger button independently from the dropdown items.
3510
+ * Falls back to the first item's label if not provided.
3511
+ */
3512
+ trigger?: string;
3513
+ /**
3514
+ * Called when a dropdown item is clicked.
3515
+ * @param value The value of the item that was clicked.
3516
+ * @param item The item that was clicked.
3517
+ */
3518
+ onClick: (value: T, item: ButtonDropdownItem<T>) => void;
3519
+ };
3520
+
3521
+ export declare type F0ButtonDropdownProps<T = string> = F0ButtonDropdownSplitProps<T> | F0ButtonDropdownDropdownProps<T>;
3522
+
3523
+ /**
3524
+ * Props for split mode (default): a split button where the main button triggers the selected item,
3525
+ * and a chevron reveals the remaining items.
3526
+ */
3527
+ declare type F0ButtonDropdownSplitProps<T = string> = F0ButtonDropdownBaseProps<T> & {
3528
+ /**
3529
+ * The rendering mode.
3530
+ * - "split": (default) Split button — main button triggers the selected item, chevron reveals others.
3531
+ * @default "split"
3532
+ */
3533
+ mode?: "split";
3488
3534
  /**
3489
- * The callback function to be called when the button is clicked.
3535
+ * The currently selected value. Defaults to the first item.
3536
+ */
3537
+ value?: T;
3538
+ /**
3539
+ * Called when the main button or a dropdown item is clicked.
3490
3540
  * @param value The value of the item that was clicked.
3491
3541
  * @param item The item that was clicked.
3492
3542
  */
@@ -5070,9 +5120,9 @@ export declare const F0TableOfContentPopover: WithDataTestIdReturnType_3<typeof
5070
5120
  * Internal implementation of the TableOfContentPopover component.
5071
5121
  * This component includes all props including private ones.
5072
5122
  */
5073
- declare function F0TableOfContentPopover_2({ title, items, className, activeItem, collapsible, showChildrenCounter, barsAlign, size, variant, }: F0TableOfContentPopoverProps): JSX_2.Element;
5123
+ declare function F0TableOfContentPopover_2({ title, items, className, activeItem, collapsible, sortable, onReorder, showChildrenCounter, barsAlign, size, variant, }: F0TableOfContentPopoverProps): JSX_2.Element;
5074
5124
 
5075
- declare interface F0TableOfContentPopoverProps extends Omit<TOCProps, "sortable" | "onReorder" | "showSearchBox" | "title" | "hideChildrenCounter"> {
5125
+ declare interface F0TableOfContentPopoverProps extends Omit<TOCProps, "showSearchBox" | "title" | "hideChildrenCounter"> {
5076
5126
  /** Optional title displayed at the top of the menu popup */
5077
5127
  title?: string;
5078
5128
  /** Alignment of the collapsed bars (left or right) */
@@ -6800,7 +6850,7 @@ declare type PrevNextDateNavigation = {
6800
6850
  next: DateRange | false;
6801
6851
  };
6802
6852
 
6803
- declare type PrimaryActionItemDefinition = Pick<DropdownItemObject, "label" | "icon"> & {
6853
+ declare type PrimaryActionItemDefinition = Pick<DropdownItemObject, "label" | "icon" | "description"> & {
6804
6854
  loading?: boolean;
6805
6855
  onClick?: () => void | Promise<void>;
6806
6856
  disabled?: boolean;
@@ -7787,8 +7837,27 @@ declare type TOCItemAction = {
7787
7837
  label: string;
7788
7838
  onClick: () => void;
7789
7839
  icon?: IconType;
7840
+ critical?: boolean;
7841
+ /** Show a check icon to indicate this item is selected */
7842
+ selected?: boolean;
7790
7843
  } | {
7791
7844
  type: "separator";
7845
+ } | {
7846
+ type: "label";
7847
+ text: string;
7848
+ } | {
7849
+ type: "toggle";
7850
+ label: string;
7851
+ icon?: IconType;
7852
+ checked: boolean;
7853
+ onCheckedChange: (checked: boolean) => void;
7854
+ } | {
7855
+ type: "submenu";
7856
+ label: string;
7857
+ icon?: IconType;
7858
+ /** Currently selected option label shown inline */
7859
+ selectedLabel?: string;
7860
+ children: TOCItemAction[];
7792
7861
  };
7793
7862
 
7794
7863
  declare interface TOCProps {