@factorialco/f0-react 2.8.2 → 2.14.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
@@ -1531,6 +1531,7 @@ declare type BaseQuestionProps = {
1531
1531
  children: React.ReactNode;
1532
1532
  required?: boolean;
1533
1533
  locked?: boolean;
1534
+ hiddenActions?: HiddenActions;
1534
1535
  };
1535
1536
 
1536
1537
  declare type BaseQuestionPropsForOtherQuestionComponents = Omit<BaseQuestionProps, "children" | "onChange">;
@@ -2001,6 +2002,48 @@ export declare type CanvasEntityDefinition<T extends CanvasContentBase = CanvasC
2001
2002
  overflowHidden?: boolean;
2002
2003
  };
2003
2004
 
2005
+ declare interface CardAlertBase {
2006
+ /**
2007
+ * The visual variant of the alert, which determines the color scheme and default icon.
2008
+ */
2009
+ variant: CardAlertVariant;
2010
+ /**
2011
+ * The title text displayed in the alert banner.
2012
+ */
2013
+ title: string;
2014
+ /**
2015
+ * Optional custom icon. When omitted, defaults to the icon that best represents the variant.
2016
+ */
2017
+ icon?: IconType;
2018
+ /**
2019
+ * Controls whether the alert is visible. Defaults to true.
2020
+ * Use this together with onDismiss for controlled dismiss behaviour:
2021
+ * alert={{ ..., visible, dismissible: true, onDismiss: () => setVisible(false) }}
2022
+ */
2023
+ visible?: boolean;
2024
+ }
2025
+
2026
+ declare type CardAlertDismissible = CardAlertBase & {
2027
+ /** Renders a dismiss (×) button. Requires onDismiss. */
2028
+ dismissible: true;
2029
+ /**
2030
+ * Called when the dismiss (×) button is clicked.
2031
+ * The consumer is responsible for hiding the alert (e.g. by setting visible: false).
2032
+ */
2033
+ onDismiss: () => void;
2034
+ };
2035
+
2036
+ declare type CardAlertNonDismissible = CardAlertBase & {
2037
+ dismissible?: false;
2038
+ onDismiss?: never;
2039
+ };
2040
+
2041
+ export declare type CardAlertProps = CardAlertDismissible | CardAlertNonDismissible;
2042
+
2043
+ export declare type CardAlertVariant = (typeof cardAlertVariants)[number];
2044
+
2045
+ export declare const cardAlertVariants: readonly ["info", "warning", "critical", "positive"];
2046
+
2004
2047
  declare type CardAvatarVariant = AvatarVariant | {
2005
2048
  type: "emoji";
2006
2049
  emoji: string;
@@ -2125,6 +2168,12 @@ declare interface CardInternalProps {
2125
2168
  * can manage drag-and-drop while still allowing click navigation via onClick
2126
2169
  */
2127
2170
  disableOverlayLink?: boolean;
2171
+ /**
2172
+ * Alert banner displayed above the card with a coloured header strip and matching border.
2173
+ * Supports info, warning, critical, and positive variants with a default icon per variant.
2174
+ * Use `visible` + `onDismiss` for controlled dismiss behaviour.
2175
+ */
2176
+ alert?: CardAlertProps;
2128
2177
  }
2129
2178
 
2130
2179
  declare type CardInternalProps_2 = F0AiInsightCardProps & {
@@ -2445,6 +2494,12 @@ declare interface ChatDashboardColumn {
2445
2494
  label: string;
2446
2495
  /** Optional fixed width in pixels */
2447
2496
  width?: number;
2497
+ /**
2498
+ * Optional header tooltip explaining what the column represents — formula
2499
+ * or aggregation if derived, source if direct. Forwarded to the underlying
2500
+ * table column's `info` prop. Omit when the label is self-explanatory.
2501
+ */
2502
+ info?: string;
2448
2503
  }
2449
2504
 
2450
2505
  /**
@@ -4582,6 +4637,9 @@ export declare const defaultTranslations: {
4582
4637
  readonly noResults: "No results found";
4583
4638
  readonly loadingMore: "Loading...";
4584
4639
  readonly applySelection: "Apply selection";
4640
+ readonly create: "Create";
4641
+ readonly createWithValue: "Create \"{{value}}\"";
4642
+ readonly createEmptyMessage: "Try another search or create a new item";
4585
4643
  };
4586
4644
  readonly numberInput: {
4587
4645
  readonly between: "It should be between {{min}} and {{max}}";
@@ -4657,6 +4715,7 @@ export declare const defaultTranslations: {
4657
4715
  readonly sectionDescriptionPlaceholder: "Describe the section in a few words";
4658
4716
  readonly required: "Required";
4659
4717
  readonly allowMultiSelection: "Allow multi-selection";
4718
+ readonly allowCreate: "Allow creation";
4660
4719
  readonly singleSelection: "Single selection";
4661
4720
  readonly multiSelection: "Multi selection";
4662
4721
  readonly questionType: "Question type";
@@ -4962,6 +5021,7 @@ declare type DropdownSingleQuestionProps = BaseQuestionPropsForOtherQuestionComp
4962
5021
  value?: string | null;
4963
5022
  showSearchBox?: boolean;
4964
5023
  searchBoxPlaceholder?: string;
5024
+ allowCreate?: boolean;
4965
5025
  };
4966
5026
 
4967
5027
  export declare type DropIntent = {
@@ -8731,6 +8791,7 @@ export declare const F0Select: <T extends string = string, R = unknown>(props: F
8731
8791
  * Base props shared across all F0Select variants
8732
8792
  */
8733
8793
  declare type F0SelectBaseProps<T extends string, R = unknown> = {
8794
+ onApply?: () => void;
8734
8795
  onChangeSelectedOption?: (option: F0SelectItemObject<T, ResolvedRecordType<R>> | undefined, checked: boolean) => void;
8735
8796
  children?: React.ReactNode;
8736
8797
  open?: boolean;
@@ -8742,6 +8803,8 @@ declare type F0SelectBaseProps<T extends string, R = unknown> = {
8742
8803
  searchEmptyMessage?: string;
8743
8804
  className?: string;
8744
8805
  actions?: Action_2[];
8806
+ /** Callback to create a new item from the current search text. When provided, a "+ Create" button is shown in the empty state of the dropdown. */
8807
+ onCreate?: (value: string) => Promise<void> | void;
8745
8808
  /** Container element to render the portal content into */
8746
8809
  portalContainer?: HTMLElement | null;
8747
8810
  /**
@@ -8793,6 +8856,8 @@ declare interface F0SelectConfigBase {
8793
8856
  searchBoxPlaceholder?: string;
8794
8857
  /** Icon displayed on the left side of the select input */
8795
8858
  icon?: IconType;
8859
+ /** Callback to create a new item from the search text. Shows a "+ Create" button in the empty state of the dropdown. */
8860
+ onCreate?: (value: string) => Promise<void> | void;
8796
8861
  }
8797
8862
 
8798
8863
  /**
@@ -8923,6 +8988,10 @@ export declare type F0SelectTagProp = string | {
8923
8988
  type: "person";
8924
8989
  name: string;
8925
8990
  src?: string;
8991
+ } | {
8992
+ type: "icon";
8993
+ text: string;
8994
+ icon: IconType;
8926
8995
  };
8927
8996
 
8928
8997
  /**
@@ -10157,6 +10226,19 @@ declare interface HeatmapComputation {
10157
10226
 
10158
10227
  export declare type heightType = "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "full" | "auto";
10159
10228
 
10229
+ /**
10230
+ * Per-question control to hide individual entries from the question
10231
+ * actions menu (the "⋯" dropdown). Useful when a consumer wants to
10232
+ * lock down a subset of question editing without disabling the whole
10233
+ * question.
10234
+ *
10235
+ * When every available action is hidden, the actions menu trigger is
10236
+ * not rendered at all.
10237
+ */
10238
+ export declare type HiddenAction = "required" | "multiSelect" | "allowCreate" | "questionType" | "duplicate" | "delete";
10239
+
10240
+ export declare type HiddenActions = ReadonlyArray<HiddenAction>;
10241
+
10160
10242
  export declare const HomeLayout: WithDataTestIdReturnType_2<ForwardRefExoticComponent<Omit<{
10161
10243
  widgets?: ReactNode[];
10162
10244
  children?: ReactNode;
@@ -11371,6 +11453,7 @@ declare type OnChangeQuestionParams = BaseQuestionOnChangeParams & ({
11371
11453
  datasetKey?: string;
11372
11454
  showSearchBox?: boolean;
11373
11455
  searchBoxPlaceholder?: string;
11456
+ allowCreate?: boolean;
11374
11457
  } | {
11375
11458
  type: "dropdown-multi";
11376
11459
  value?: string[] | null;
@@ -12898,7 +12981,8 @@ export declare type SurveyDataset = {
12898
12981
  icon?: IconType;
12899
12982
  placeholder?: string;
12900
12983
  dataSource: DataSourceDefinition;
12901
- mapOptions: (item: RecordType) => F0SelectItemProps<string, RecordType>;
12984
+ mapOptions: (item: RecordType) => F0SelectItemObject<string, RecordType>;
12985
+ onCreate?: (value: string) => Promise<RecordType>;
12902
12986
  };
12903
12987
 
12904
12988
  export declare type SurveyDatasets = Record<string, SurveyDataset>;