@factorialco/f0-react 1.201.5 → 1.201.7

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.
@@ -841,6 +841,11 @@ declare type CardAvatarVariant = AvatarVariant | {
841
841
  icon: IconType;
842
842
  };
843
843
 
844
+ /**
845
+ * Group Cards: Renders
846
+ */
847
+ declare type CardCollectionProps<Record extends RecordType, Filters extends FiltersDefinition, Sortings extends SortingsDefinition, Summaries extends SummariesDefinition, ItemActions extends ItemActionsDefinition<Record>, NavigationFilters extends NavigationFiltersDefinition, Grouping extends GroupingDefinition<Record>> = CollectionProps<Record, Filters, Sortings, Summaries, ItemActions, NavigationFilters, Grouping, CardVisualizationOptions<Record, Filters, Sortings>>;
848
+
844
849
  /**
845
850
  * Card metadata property renderers.
846
851
  * Each metadata item consists of an icon and a property with its data.
@@ -1046,6 +1051,8 @@ declare interface ClockInGraphProps {
1046
1051
 
1047
1052
  declare type ClockInStatus = "clocked-in" | "break" | "clocked-out";
1048
1053
 
1054
+ declare type ColId = string;
1055
+
1049
1056
  /**
1050
1057
  * Props for the Collection component.
1051
1058
  * @template Record - The type of records in the collection
@@ -1063,6 +1070,15 @@ export declare type CollectionProps<Record extends RecordType, Filters extends F
1063
1070
  onLoadError: OnLoadErrorCallback;
1064
1071
  } & VisualizationOptions;
1065
1072
 
1073
+ declare type CollectionVisualizations<Record extends RecordType, Filters extends FiltersDefinition, Sortings extends SortingsDefinition, Summaries extends SummariesDefinition, ItemActions extends ItemActionsDefinition<Record>, NavigationFilters extends NavigationFiltersDefinition, Grouping extends GroupingDefinition<Record>> = {
1074
+ table: VisualizacionTypeDefinition<TableCollectionProps<Record, Filters, Sortings, Summaries, ItemActions, NavigationFilters, Grouping>, TableVisualizationSettings>;
1075
+ list: VisualizacionTypeDefinition<ListCollectionProps<Record, Filters, Sortings, Summaries, ItemActions, NavigationFilters, Grouping>>;
1076
+ card: VisualizacionTypeDefinition<CardCollectionProps<Record, Filters, Sortings, Summaries, ItemActions, NavigationFilters, Grouping>>;
1077
+ kanban: VisualizacionTypeDefinition<KanbanCollectionProps<Record, Filters, Sortings, Summaries, ItemActions, NavigationFilters, Grouping>>;
1078
+ };
1079
+
1080
+ declare const collectionVisualizations: CollectionVisualizations<RecordType, FiltersDefinition, SortingsDefinition, SummariesDefinition, ItemActionsDefinition<RecordType>, NavigationFiltersDefinition, GroupingDefinition<RecordType>>;
1081
+
1066
1082
  declare type ColumnNumber = 1 | 2 | 3 | 4 | 6;
1067
1083
 
1068
1084
  declare type ColumnWidth = keyof typeof columnWidths | number;
@@ -1251,6 +1267,10 @@ declare type DataCollectionExtendFetchOptions<NavigationFilters extends Navigati
1251
1267
  */
1252
1268
  export declare type DataCollectionPaginatedFetchOptions<Filters extends FiltersDefinition, NavigationFilters extends NavigationFiltersDefinition> = PaginatedFetchOptions<Filters> & DataCollectionExtendFetchOptions<NavigationFilters>;
1253
1269
 
1270
+ declare type DataCollectionSettings = {
1271
+ visualization: VisualizationSettings;
1272
+ };
1273
+
1254
1274
  /**
1255
1275
  * Data collection source
1256
1276
  * Extends the base data source with data collection specific elements / features
@@ -1296,6 +1316,31 @@ export declare type DataCollectionSourceDefinition<R extends RecordType = Record
1296
1316
  lanes?: ReadonlyArray<Lane<Filters>>;
1297
1317
  };
1298
1318
 
1319
+ /**
1320
+ * The status of the data collection
1321
+ */
1322
+ declare type DataCollectionStatus = {
1323
+ grouping?: GroupingState<RecordType, GroupingDefinition<RecordType>>;
1324
+ sortings?: SortingsState<SortingsDefinition>;
1325
+ filters?: FiltersState<FiltersDefinition>;
1326
+ search?: string | undefined;
1327
+ navigationFilters?: NavigationFiltersState<NavigationFiltersDefinition>;
1328
+ visualization?: number;
1329
+ };
1330
+
1331
+ declare type DataCollectionStatusComplete = DataCollectionStatus & {
1332
+ settings?: DataCollectionSettings;
1333
+ };
1334
+
1335
+ declare type DataCollectionStorageFeature = (typeof dataCollectionStorageFeatures)[number];
1336
+
1337
+ /**
1338
+ * The available features of the data collection status storage
1339
+ */
1340
+ declare const dataCollectionStorageFeatures: readonly ["filters", "navigationFilters", "sortings", "grouping", "visualization", "search"];
1341
+
1342
+ declare type DataCollectionStorageFeaturesDefinition = ("*" | `all` | `!${DataCollectionStorageFeature}` | `${DataCollectionStorageFeature}`)[];
1343
+
1299
1344
  /**
1300
1345
  * Represents an error that occurred during data fetching
1301
1346
  */
@@ -1561,6 +1606,7 @@ declare const defaultTranslations: {
1561
1606
  readonly pagination: {
1562
1607
  readonly of: "of";
1563
1608
  };
1609
+ readonly settings: "{%visualizationName} settings";
1564
1610
  };
1565
1611
  readonly itemsCount: "items";
1566
1612
  readonly emptyStates: {
@@ -1670,6 +1716,10 @@ declare const defaultTranslations: {
1670
1716
  readonly welcome: "Ask or create with One";
1671
1717
  readonly initialMessage: "How can I help you today?";
1672
1718
  };
1719
+ readonly select: {
1720
+ readonly noResults: "No results found";
1721
+ readonly loadingMore: "Loading...";
1722
+ };
1673
1723
  };
1674
1724
 
1675
1725
  export declare const DetailsItem: ForwardRefExoticComponent<DetailsItemType & RefAttributes<HTMLDivElement>>;
@@ -1915,6 +1965,10 @@ declare interface ErrorMessageProps {
1915
1965
  */
1916
1966
  export declare type ExtractPropertyKeys<RecordType> = keyof RecordType;
1917
1967
 
1968
+ declare type ExtractVisualizationSettings<T> = T extends {
1969
+ settings: infer S;
1970
+ } ? S : never;
1971
+
1918
1972
  export declare const F0AiBanner: ForwardRefExoticComponent<AiBannerInternalProps & RefAttributes<HTMLDivElement>> & {
1919
1973
  Skeleton: ({ compact }: AiBannerSkeletonProps) => JSX_2.Element;
1920
1974
  };
@@ -2512,6 +2566,16 @@ declare type InputFieldProps<T> = {
2512
2566
  appendTag?: string;
2513
2567
  lengthProvider?: (value: T | undefined) => number;
2514
2568
  loading?: boolean;
2569
+ loadingIndicator?: {
2570
+ /**
2571
+ * If true, the loading spinner will be displayed over the content without affecting the layout
2572
+ */
2573
+ asOverlay?: boolean;
2574
+ /**
2575
+ * The offset of the loading spinner from the content
2576
+ */
2577
+ offset?: number;
2578
+ };
2515
2579
  };
2516
2580
 
2517
2581
  declare type InputFieldSize = (typeof INPUTFIELD_SIZES)[number];
@@ -2566,6 +2630,8 @@ declare type Items = typeof Item_2 | typeof PersonItem | typeof CompanyItem | ty
2566
2630
 
2567
2631
  export declare function ItemSectionHeader({ item, children, isActive, collapsible, isExpanded, onToggleExpanded, sortable, }: TOCItemSectionHeaderProps): JSX_2.Element;
2568
2632
 
2633
+ declare type KanbanCollectionProps<Record extends RecordType, Filters extends FiltersDefinition, Sortings extends SortingsDefinition, Summaries extends SummariesDefinition, ItemActions extends ItemActionsDefinition<Record>, NavigationFilters extends NavigationFiltersDefinition, Grouping extends GroupingDefinition<Record>> = CollectionProps<Record, Filters, Sortings, Summaries, ItemActions, NavigationFilters, Grouping, KanbanVisualizationOptions<Record, Filters, Sortings>>;
2634
+
2569
2635
  declare type KanbanLaneDefinition = {
2570
2636
  id: string;
2571
2637
  title: string;
@@ -2614,6 +2680,11 @@ declare type LinkProps = AnchorHTMLAttributes<HTMLAnchorElement> & {
2614
2680
  disabled?: boolean;
2615
2681
  };
2616
2682
 
2683
+ /**
2684
+ * Group List: Renders the list for a group
2685
+ */
2686
+ declare type ListCollectionProps<Record extends RecordType, Filters extends FiltersDefinition, Sortings extends SortingsDefinition, Summaries extends SummariesDefinition, ItemActions extends ItemActionsDefinition<Record>, NavigationFilters extends NavigationFiltersDefinition, Grouping extends GroupingDefinition<Record>> = CollectionProps<Record, Filters, Sortings, Summaries, ItemActions, NavigationFilters, Grouping, ListVisualizationOptions<Record, Filters, Sortings>>;
2687
+
2617
2688
  declare type ListPropertyDefinition<R, Sortings extends SortingsDefinition> = WithOptionalSorting_2<R, Sortings> & PropertyDefinition_2<R>;
2618
2689
 
2619
2690
  declare type ListVisualizationOptions<R extends RecordType, _Filters extends FiltersDefinition, Sortings extends SortingsDefinition> = {
@@ -3068,7 +3139,31 @@ export declare interface OneCalendarProps {
3068
3139
  /**
3069
3140
  * @experimental This is an experimental component use it at your own risk
3070
3141
  */
3071
- export declare const OneDataCollection: <R extends RecordType, Filters extends FiltersDefinition, Sortings extends SortingsDefinition, Summaries extends SummariesDefinition, ItemActions extends ItemActionsDefinition<R>, NavigationFilters extends NavigationFiltersDefinition, Grouping extends GroupingDefinition<R>>({ source, visualizations, onSelectItems, onBulkAction, emptyStates, fullHeight, }: {
3142
+ export declare const OneDataCollection: <R extends RecordType, Filters extends FiltersDefinition, Sortings extends SortingsDefinition, Summaries extends SummariesDefinition, ItemActions extends ItemActionsDefinition<R>, NavigationFilters extends NavigationFiltersDefinition, Grouping extends GroupingDefinition<R>>(props: OneDataCollectionProps<R, Filters, Sortings, Summaries, ItemActions, NavigationFilters, Grouping>) => JSX_2.Element;
3143
+
3144
+ /**
3145
+ * A component that renders a collection of data with filtering and visualization capabilities.
3146
+ * It consumes a data source (created by useDataCollectionSource) and displays it through one or more visualizations.
3147
+ *
3148
+ * DataCollection is separated from useDataCollectionSource to:
3149
+ * 1. Support the composition pattern - data sources can be created and managed independently
3150
+ * 2. Allow a single data source to be visualized in multiple ways simultaneously
3151
+ * 3. Enable reuse of the same data source in different parts of the application
3152
+ * 4. Provide a clean separation of concerns between data management and UI rendering
3153
+ *
3154
+ * @template Record - The type of records in the collection
3155
+ * @template Filters - The definition of available filters for the collection
3156
+ * @template ItemActions - The definition of available item actions
3157
+ *
3158
+ * @param source - The data source containing filters, data, and state management
3159
+ * @param visualizations - Array of available visualization options (e.g., table, card view)
3160
+ *
3161
+ * @returns A JSX element containing:
3162
+ * - Filter controls (if filters are defined)
3163
+ * - Visualization selector (if multiple visualizations are available)
3164
+ * - The selected visualization of the data
3165
+ */
3166
+ declare type OneDataCollectionProps<R extends RecordType, Filters extends FiltersDefinition, Sortings extends SortingsDefinition, Summaries extends SummariesDefinition, ItemActions extends ItemActionsDefinition<R>, NavigationFilters extends NavigationFiltersDefinition, Grouping extends GroupingDefinition<R>> = {
3072
3167
  source: DataCollectionSource<R, Filters, Sortings, Summaries, ItemActions, NavigationFilters, Grouping>;
3073
3168
  visualizations: ReadonlyArray<Visualization<R, Filters, Sortings, Summaries, ItemActions, NavigationFilters, Grouping>>;
3074
3169
  onSelectItems?: OnSelectItemsCallback<R, Filters>;
@@ -3076,7 +3171,27 @@ export declare const OneDataCollection: <R extends RecordType, Filters extends F
3076
3171
  emptyStates?: CustomEmptyStates;
3077
3172
  onTotalItemsChange?: (totalItems: number) => void;
3078
3173
  fullHeight?: boolean;
3079
- }) => JSX.Element;
3174
+ /** Function to handle state change */
3175
+ onStateChange?: (state: DataCollectionStatusComplete) => void;
3176
+ /** Key for the data collection settings and state, must be unique for each data collection and contain the version e.g. "employees/v1"
3177
+ */
3178
+ id?: string;
3179
+ /** Storage for the data collection settings and state */
3180
+ storage?: {
3181
+ /** Features for the data collection storage , for example you can disable the storage for the data collection filters state
3182
+ * You can use "*" for all features and ! to disable a feature
3183
+ *
3184
+ * For example:
3185
+ * - "*" - will use all storage features (empty "" means all)
3186
+ * - "filters" - will use only the storage for the data collection filters state
3187
+ * - "filters, sortings" - will use the storage for the data collection filters and sortings state
3188
+ * - "*, !filters" - will not use the storage for the data collection filters state
3189
+ * - "!filters, sortings" - will not use the storage for the data collection filters and sortings state
3190
+ *
3191
+ */
3192
+ features?: DataCollectionStorageFeaturesDefinition;
3193
+ };
3194
+ };
3080
3195
 
3081
3196
  export declare function OneDateNavigator({ onSelect, defaultValue, presets, granularities, hideNavigation, hideGoToCurrent, compareTo, defaultCompareTo, onCompareToChange, ...props }: OneDatePickerProps): JSX_2.Element;
3082
3197
 
@@ -4247,12 +4362,30 @@ export declare type TabItem = {
4247
4362
  id: string;
4248
4363
  });
4249
4364
 
4365
+ declare type TableCollectionProps<R extends RecordType, Filters extends FiltersDefinition, Sortings extends SortingsDefinition, Summaries extends SummariesDefinition, ItemActions extends ItemActionsDefinition<R>, NavigationFilters extends NavigationFiltersDefinition, Grouping extends GroupingDefinition<R>> = CollectionProps<R, Filters, Sortings, Summaries, ItemActions, NavigationFilters, Grouping, TableVisualizationOptions<R, Filters, Sortings, Summaries>>;
4366
+
4250
4367
  declare type TableColumnDefinition<R extends RecordType, Sortings extends SortingsDefinition, Summaries extends SummariesDefinition> = WithOptionalSorting<R, Sortings> & Pick<ComponentProps<typeof TableHead>, "hidden" | "info" | "infoIcon" | "sticky" | "width"> & {
4251
4368
  /**
4252
4369
  * Optional summary configuration for this column
4253
4370
  * References a key in the Summaries definition, similar to how sorting works
4254
4371
  */
4255
4372
  summary?: SummaryKey<Summaries>;
4373
+ /**
4374
+ * The id of the column (if not provided, the id will be the label of the column)
4375
+ */
4376
+ id?: ColId;
4377
+ /**
4378
+ * The initial order of the column
4379
+ */
4380
+ order?: number;
4381
+ /**
4382
+ * The initial state of the hidden (only applies if allowColumnHiding is true)
4383
+ */
4384
+ hidden?: boolean;
4385
+ /**
4386
+ * Avoid hiding the column by the user
4387
+ */
4388
+ noHiding?: boolean;
4256
4389
  };
4257
4390
 
4258
4391
  declare function TableHead({ children, width, sortState, onSortClick, info, infoIcon, sticky, hidden, align, className, }: TableHeadProps): JSX_2.Element;
@@ -4313,8 +4446,27 @@ declare interface TableHeadProps {
4313
4446
  }
4314
4447
 
4315
4448
  declare type TableVisualizationOptions<R extends RecordType, _Filters extends FiltersDefinition, Sortings extends SortingsDefinition, Summaries extends SummariesDefinition> = {
4449
+ /**
4450
+ * The columns to display
4451
+ */
4316
4452
  columns: ReadonlyArray<TableColumnDefinition<R, Sortings, Summaries>>;
4453
+ /**
4454
+ * The number of columns to freeze on the left
4455
+ */
4317
4456
  frozenColumns?: 0 | 1 | 2;
4457
+ /**
4458
+ * Allow users to reorder columns (you can only reorder columns that are not frozen) (check cols props to define the order)
4459
+ */
4460
+ allowColumnReordering?: boolean;
4461
+ /**
4462
+ * Allow users to hide columns (you can define especifcally non hiddable columns in col props, also frozen columns are not hiddable)
4463
+ */
4464
+ allowColumnHiding?: boolean;
4465
+ };
4466
+
4467
+ declare type TableVisualizationSettings = {
4468
+ order: ColId[];
4469
+ hidden: ColId[];
4318
4470
  };
4319
4471
 
4320
4472
  export declare const Tabs: FC<TabsProps> & {
@@ -4658,6 +4810,14 @@ declare const VerticalOverflowList: {
4658
4810
  displayName: string;
4659
4811
  };
4660
4812
 
4813
+ declare type VisualizacionTypeDefinition<Props, Settings = Record<string, never>> = {
4814
+ render: (props: Props) => JSX.Element;
4815
+ renderSettings?: (props: Props) => JSX.Element | null;
4816
+ name: string;
4817
+ icon: IconType;
4818
+ settings: Settings;
4819
+ };
4820
+
4661
4821
  /**
4662
4822
  * Represents a visualization configuration for displaying collection data.
4663
4823
  * Supports different visualization types (card, table, or custom) with their respective options.
@@ -4702,6 +4862,10 @@ declare type Visualization<R extends RecordType, Filters extends FiltersDefiniti
4702
4862
  }) => JSX.Element;
4703
4863
  };
4704
4864
 
4865
+ declare type VisualizationSettings = {
4866
+ [K in keyof typeof collectionVisualizations]: ExtractVisualizationSettings<(typeof collectionVisualizations)[K]>;
4867
+ };
4868
+
4705
4869
  export declare const Weekdays: ForwardRefExoticComponent<WeekdaysProps & RefAttributes<HTMLDivElement>>;
4706
4870
 
4707
4871
  declare interface WeekdaysProps {