@factorialco/f0-react 1.289.0 → 1.291.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.
@@ -31,6 +31,7 @@ import { DotTagCellValue } from './types/dotTag';
31
31
  import { DotTagCellValue as DotTagCellValue_2 } from '../../value-display/types/dotTag';
32
32
  import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
33
33
  import { Editor } from '@tiptap/react';
34
+ import { F0SelectProps as F0SelectProps_2 } from './types';
34
35
  import { f1Colors } from '@factorialco/f0-core';
35
36
  import { FC } from 'react';
36
37
  import { FieldPath } from 'react-hook-form';
@@ -216,7 +217,9 @@ declare type ActionLinkProps = ActionBaseProps & {
216
217
  className?: string;
217
218
  };
218
219
 
219
- declare type ActionProps = {
220
+ declare type ActionProps = ActionLinkProps | ActionButtonProps;
221
+
222
+ declare type ActionProps_2 = {
220
223
  buttonType: "gradient" | "internal";
221
224
  label: string;
222
225
  onClick: () => void;
@@ -225,8 +228,6 @@ declare type ActionProps = {
225
228
  icon?: IconType;
226
229
  };
227
230
 
228
- declare type ActionProps_2 = ActionLinkProps | ActionButtonProps;
229
-
230
231
  declare type ActionProps_3 = {
231
232
  /**
232
233
  * The label of the action
@@ -464,7 +465,7 @@ export declare type AiPromotionChatProviderProps = {
464
465
  noBoldText: string;
465
466
  boldText: string;
466
467
  }[];
467
- actions?: ActionProps[];
468
+ actions?: ActionProps_2[];
468
469
  onShow?: () => void;
469
470
  onHide?: () => void;
470
471
  children: React.ReactNode;
@@ -501,7 +502,7 @@ declare interface AiPromotionChatState {
501
502
  noBoldText: string;
502
503
  boldText: string;
503
504
  }[];
504
- actions?: ActionProps[];
505
+ actions?: ActionProps_2[];
505
506
  onShow?: () => void;
506
507
  onHide?: () => void;
507
508
  }
@@ -939,18 +940,20 @@ export declare type BreadcrumbSelectItemType = BreadcrumbBaseItemType & {
939
940
  externalSearch?: boolean;
940
941
  onChange: BreadcrumbSelectProps<string, RecordType>["onChange"];
941
942
  value?: string;
942
- defaultItem?: SelectItemObject<string, RecordType>;
943
+ defaultItem?: F0SelectItemObject<string, RecordType>;
943
944
  } & ({
944
945
  source: DataSourceDefinition<RecordType, FiltersDefinition, SortingsDefinition, GroupingDefinition<RecordType>>;
945
- mapOptions: (item: RecordType) => SelectItemProps<string>;
946
+ mapOptions: (item: RecordType) => F0SelectItemProps<string>;
946
947
  options?: never;
947
948
  } | {
948
949
  source?: never;
949
950
  mapOptions?: never;
950
- options: SelectItemProps<string, RecordType>[];
951
+ options: F0SelectItemProps<string, RecordType>[];
951
952
  });
952
953
 
953
- export declare type BreadcrumbSelectProps<T extends string, R = unknown> = SelectProps<T, R>;
954
+ export declare type BreadcrumbSelectProps<T extends string, R = unknown> = F0SelectProps<T, R> & {
955
+ multiple?: false;
956
+ };
954
957
 
955
958
  export declare interface BreadcrumbsProps {
956
959
  /** Array of breadcrumb items to display */
@@ -1039,7 +1042,7 @@ declare type ButtonDropdownItem<T = string> = {
1039
1042
  description?: string;
1040
1043
  };
1041
1044
 
1042
- declare type ButtonInternalProps = Pick<ActionProps_2, "size" | "disabled" | "className" | "pressed" | "compact" | "variant" | "tooltip"> & DataAttributes & {
1045
+ declare type ButtonInternalProps = Pick<ActionProps, "size" | "disabled" | "className" | "pressed" | "compact" | "variant" | "tooltip"> & DataAttributes & {
1043
1046
  /**
1044
1047
  * The aria-label of the button if not provided title or label will be used.
1045
1048
  */
@@ -1353,7 +1356,9 @@ export declare const ChartWidgetEmptyState: ForwardRefExoticComponent<Props_5 &
1353
1356
 
1354
1357
  export declare type ChatWidgetEmptyStateProps = Props_5;
1355
1358
 
1356
- declare type ChildrenResponse<R extends RecordType> = BaseResponse<R> | R[] | NestedResponseWithType<R>;
1359
+ declare type ChildrenPaginationInfo<R extends RecordType> = Omit<InfiniteScrollPaginatedResponse<R>, "type" | "records">;
1360
+
1361
+ declare type ChildrenResponse<R extends RecordType> = NestedResponseWithType<R>;
1357
1362
 
1358
1363
  declare type ChipLabel = {
1359
1364
  label: string;
@@ -1905,11 +1910,11 @@ export declare type DataSourceDefinition<R extends RecordType = RecordType, Filt
1905
1910
  currentGrouping?: GroupingState<R, Grouping>;
1906
1911
  /*******************************************************/
1907
1912
  /***** NESTED RECORDS ***************************************************/
1908
- fetchChildren?: (item: R, filters?: FiltersState<FiltersDefinition>) => Promise<ChildrenResponse<R>>;
1913
+ fetchChildren?: (item: R, filters?: FiltersState<FiltersDefinition>, pagination?: ChildrenPaginationInfo<R>) => Promise<ChildrenResponse<R>>;
1909
1914
  /** Function to determine if an item has children */
1910
1915
  itemsWithChildren?: (item: R) => boolean;
1911
1916
  /** Function to get the number of children for an item */
1912
- childrenCount?: (item: R) => number | undefined;
1917
+ childrenCount?: (item: R, pagination?: ChildrenPaginationInfo<R>) => number | undefined;
1913
1918
  };
1914
1919
 
1915
1920
  export declare type DateFilterDefinition = BaseFilterDefinition<"date"> & {
@@ -2191,6 +2196,7 @@ declare const defaultTranslations: {
2191
2196
  readonly other: "Other actions";
2192
2197
  readonly toggle: "Toggle";
2193
2198
  readonly toggleDropdownMenu: "Toggle dropdown menu";
2199
+ readonly selectAll: "Select all";
2194
2200
  };
2195
2201
  readonly status: {
2196
2202
  readonly selected: {
@@ -2199,6 +2205,13 @@ declare const defaultTranslations: {
2199
2205
  };
2200
2206
  };
2201
2207
  readonly filters: {
2208
+ readonly searchPlaceholder: "Search filters...";
2209
+ readonly inFilter: {
2210
+ readonly searchPlaceholder: "Search options...";
2211
+ };
2212
+ readonly activeFilters: "Active filters: {{filters}}";
2213
+ readonly filteringBy: "Filtering by {{label}}";
2214
+ readonly availableFilters: "Available filters";
2202
2215
  readonly label: "Filters";
2203
2216
  readonly applyFilters: "Apply filters";
2204
2217
  readonly applySelection: "Apply selection";
@@ -2842,6 +2855,78 @@ declare interface F0IconProps extends SVGProps<SVGSVGElement>, VariantProps<type
2842
2855
  color?: "default" | "currentColor" | `#${string}` | Lowercase<NestedKeyOf<typeof f1Colors.icon>>;
2843
2856
  }
2844
2857
 
2858
+ declare type F0SelectItemObject<T, R = unknown> = {
2859
+ type?: "item";
2860
+ value: T;
2861
+ label: string;
2862
+ description?: string;
2863
+ avatar?: AvatarVariant;
2864
+ tag?: string;
2865
+ icon?: IconType;
2866
+ item?: R;
2867
+ disabled?: boolean;
2868
+ };
2869
+ export { F0SelectItemObject }
2870
+ export { F0SelectItemObject as SelectItemObject }
2871
+
2872
+ declare type F0SelectItemProps<T, R = unknown> = F0SelectItemObject<T, R> | {
2873
+ type: "separator";
2874
+ };
2875
+ export { F0SelectItemProps }
2876
+ export { F0SelectItemProps as SelectItemProps }
2877
+
2878
+ /**
2879
+ * Select component for choosing from a list of options.
2880
+ *
2881
+ * @template T - The type of the emitted value
2882
+ * @template R - The type of the record/item data (used with data source)
2883
+ *
2884
+ */
2885
+ declare type F0SelectProps<T extends string, R = unknown> = {
2886
+ onChangeSelectedOption?: (option: F0SelectItemObject<T, ResolvedRecordType<R>> | undefined, checked: boolean) => void;
2887
+ children?: React.ReactNode;
2888
+ open?: boolean;
2889
+ showSearchBox?: boolean;
2890
+ searchBoxPlaceholder?: string;
2891
+ onSearchChange?: (value: string) => void;
2892
+ searchValue?: string;
2893
+ onOpenChange?: (open: boolean) => void;
2894
+ searchEmptyMessage?: string;
2895
+ className?: string;
2896
+ selectContentClassName?: string;
2897
+ actions?: Action[];
2898
+ portalContainer?: HTMLElement | null;
2899
+ } & ({
2900
+ clearable?: false;
2901
+ multiple?: false;
2902
+ value?: T;
2903
+ defaultItem?: F0SelectItemObject<T, ResolvedRecordType<R>>;
2904
+ onChange?: (value: T, originalItem?: ResolvedRecordType<R> | undefined, option?: F0SelectItemObject<T, ResolvedRecordType<R>>) => void;
2905
+ } | {
2906
+ clearable: true;
2907
+ multiple?: false;
2908
+ value?: T;
2909
+ defaultItem?: F0SelectItemObject<T, ResolvedRecordType<R>>;
2910
+ onChange?: (value: T, originalItem?: ResolvedRecordType<R> | undefined, option?: F0SelectItemObject<T, ResolvedRecordType<R>>) => void;
2911
+ } | {
2912
+ multiple: true;
2913
+ clearable?: boolean;
2914
+ value?: T[];
2915
+ defaultItem?: F0SelectItemObject<T, ResolvedRecordType<R>>[];
2916
+ onChange?: (value: T[], originalItems: ResolvedRecordType<R>[], options: F0SelectItemObject<T, ResolvedRecordType<R>>[]) => void;
2917
+ }) & ({
2918
+ source: DataSourceDefinition<ResolvedRecordType<R>, FiltersDefinition, SortingsDefinition, GroupingDefinition<ResolvedRecordType<R>>>;
2919
+ mapOptions: (item: ResolvedRecordType<R>) => F0SelectItemProps<T, ResolvedRecordType<R>>;
2920
+ options?: never;
2921
+ } | {
2922
+ source?: never;
2923
+ mapOptions?: never;
2924
+ searchFn?: (option: F0SelectItemProps<T, unknown>, search?: string) => boolean | undefined;
2925
+ options: F0SelectItemProps<T, unknown>[];
2926
+ }) & Pick<InputFieldProps<T>, "required" | "loading" | "hideLabel" | "labelIcon" | "size" | "label" | "icon" | "placeholder" | "disabled" | "name" | "error" | "status" | "hint">;
2927
+ export { F0SelectProps }
2928
+ export { F0SelectProps as SelectProps }
2929
+
2845
2930
  export declare function F0TableOfContent(props: TOCProps): JSX_2.Element;
2846
2931
 
2847
2932
  declare const F0TagAlert: ForwardRefExoticComponent<Props_8 & RefAttributes<HTMLDivElement>>;
@@ -3962,6 +4047,7 @@ declare type NestedKeyOf<T> = {
3962
4047
  declare type NestedResponseWithType<R extends RecordType> = {
3963
4048
  records: R[];
3964
4049
  type?: NestedVariant;
4050
+ paginationInfo?: ChildrenPaginationInfo<R>;
3965
4051
  };
3966
4052
 
3967
4053
  declare type NestedVariant = "basic" | "detailed";
@@ -5090,7 +5176,10 @@ declare type SectionProps_2 = {
5090
5176
  onItemVisible?: (id: string) => void;
5091
5177
  };
5092
5178
 
5093
- export declare const Select: <T extends string = string, R = unknown>(props: SelectProps<T, R> & {
5179
+ /**
5180
+ * @experimental This is an experimental component use it at your own risk
5181
+ */
5182
+ export declare const Select: <T extends string = string, R = unknown>(props: F0SelectProps_2<T, R> & {
5094
5183
  ref?: React.Ref<HTMLButtonElement>;
5095
5184
  }) => React.ReactElement;
5096
5185
 
@@ -5126,57 +5215,6 @@ export declare type SelectedItemsState = {
5126
5215
  }>;
5127
5216
  };
5128
5217
 
5129
- export declare type SelectItemObject<T, R = unknown> = {
5130
- type?: "item";
5131
- value: T;
5132
- label: string;
5133
- description?: string;
5134
- avatar?: AvatarVariant;
5135
- tag?: string;
5136
- icon?: IconType;
5137
- item?: R;
5138
- disabled?: boolean;
5139
- };
5140
-
5141
- export declare type SelectItemProps<T, R = unknown> = SelectItemObject<T, R> | {
5142
- type: "separator";
5143
- };
5144
-
5145
- /**
5146
- * Select component for choosing from a list of options.
5147
- *
5148
- * @template T - The type of the emitted value
5149
- * @template R - The type of the record/item data (used with data source)
5150
- *
5151
- */
5152
- export declare type SelectProps<T extends string, R = unknown> = {
5153
- onChange: (value: T, originalItem?: ResolvedRecordType<R>, option?: SelectItemObject<T, ResolvedRecordType<R>>) => void;
5154
- onChangeSelectedOption?: (option: SelectItemObject<T, ResolvedRecordType<R>> | undefined) => void;
5155
- value?: T;
5156
- defaultItem?: SelectItemObject<T, ResolvedRecordType<R>>;
5157
- children?: React.ReactNode;
5158
- open?: boolean;
5159
- showSearchBox?: boolean;
5160
- searchBoxPlaceholder?: string;
5161
- onSearchChange?: (value: string) => void;
5162
- searchValue?: string;
5163
- onOpenChange?: (open: boolean) => void;
5164
- searchEmptyMessage?: string;
5165
- className?: string;
5166
- selectContentClassName?: string;
5167
- actions?: Action[];
5168
- portalContainer?: HTMLElement | null;
5169
- } & ({
5170
- source: DataSourceDefinition<ResolvedRecordType<R>, FiltersDefinition, SortingsDefinition, GroupingDefinition<ResolvedRecordType<R>>>;
5171
- mapOptions: (item: ResolvedRecordType<R>) => SelectItemProps<T, ResolvedRecordType<R>>;
5172
- options?: never;
5173
- } | {
5174
- source?: never;
5175
- mapOptions?: never;
5176
- searchFn?: (option: SelectItemProps<T, unknown>, search?: string) => boolean | undefined;
5177
- options: SelectItemProps<T, unknown>[];
5178
- }) & Pick<InputFieldProps<T>, "required" | "loading" | "hideLabel" | "clearable" | "labelIcon" | "size" | "label" | "icon" | "placeholder" | "disabled" | "name" | "error" | "status" | "hint">;
5179
-
5180
5218
  export declare type SelectQuestionOption = {
5181
5219
  id?: string;
5182
5220
  value: string;
@@ -6229,6 +6267,31 @@ declare global {
6229
6267
  }
6230
6268
 
6231
6269
 
6270
+ declare module "gridstack" {
6271
+ interface GridStackWidget {
6272
+ id?: string;
6273
+ allowedSizes?: Array<{
6274
+ w: number;
6275
+ h: number;
6276
+ }>;
6277
+ renderFn?: () => React.ReactElement | null;
6278
+ meta?: Record<string, unknown>;
6279
+ }
6280
+ interface GridStackNode {
6281
+ id?: string;
6282
+ w?: number;
6283
+ h?: number;
6284
+ x?: number;
6285
+ y?: number;
6286
+ allowedSizes?: Array<{
6287
+ w: number;
6288
+ h: number;
6289
+ }>;
6290
+ renderFn?: () => React.ReactElement | null;
6291
+ }
6292
+ }
6293
+
6294
+
6232
6295
  declare module "@tiptap/core" {
6233
6296
  interface Commands<ReturnType> {
6234
6297
  aiBlock: {
@@ -6256,31 +6319,6 @@ declare module "@tiptap/core" {
6256
6319
  }
6257
6320
 
6258
6321
 
6259
- declare module "gridstack" {
6260
- interface GridStackWidget {
6261
- id?: string;
6262
- allowedSizes?: Array<{
6263
- w: number;
6264
- h: number;
6265
- }>;
6266
- renderFn?: () => React.ReactElement | null;
6267
- meta?: Record<string, unknown>;
6268
- }
6269
- interface GridStackNode {
6270
- id?: string;
6271
- w?: number;
6272
- h?: number;
6273
- x?: number;
6274
- y?: number;
6275
- allowedSizes?: Array<{
6276
- w: number;
6277
- h: number;
6278
- }>;
6279
- renderFn?: () => React.ReactElement | null;
6280
- }
6281
- }
6282
-
6283
-
6284
6322
  declare namespace Calendar {
6285
6323
  var displayName: string;
6286
6324
  }