@factorialco/f0-react 1.302.1 → 1.303.2

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
@@ -10,6 +10,8 @@ import { AvatarListCellValue as AvatarListCellValue_2 } from './types/avatarList
10
10
  import * as AvatarPrimitive from '@radix-ui/react-avatar';
11
11
  import { AvatarProps as AvatarProps_2 } from '@radix-ui/react-avatar';
12
12
  import { baseColors } from '@factorialco/f0-core';
13
+ import { BlockContentExtraProps } from './blocks/BlockContent';
14
+ import { BlockProps } from './blocks/Block';
13
15
  import { CategoryBarProps } from './CategoryBarChart';
14
16
  import { ChartConfig } from '../../ui/chart';
15
17
  import { ChartConfig as ChartConfig_2 } from './utils/types';
@@ -18,7 +20,9 @@ import { ClassValue } from 'cva';
18
20
  import { CompanyCellValue } from '../../value-display/types/company';
19
21
  import { CompanyCellValue as CompanyCellValue_2 } from './types/company';
20
22
  import { ComponentProps } from 'react';
23
+ import { ComponentType } from 'react';
21
24
  import { CountryCellValue } from './types/country';
25
+ import { DashboardProps as DashboardProps_2 } from './Dashboard';
22
26
  import { DateCellValue } from '../../value-display/types/date';
23
27
  import { DateCellValue as DateCellValue_2 } from './types/date';
24
28
  import { DateFilterOptions } from './DateFilter/DateFilter';
@@ -37,6 +41,10 @@ import { ForwardedRef } from 'react';
37
41
  import { ForwardRefExoticComponent } from 'react';
38
42
  import { GridStackOptions } from 'gridstack';
39
43
  import { GridStackWidget } from 'gridstack';
44
+ import { GroupGridProps as GroupGridProps_2 } from './groups/GroupGrid';
45
+ import { GroupGridWidget as GroupGridWidget_2 } from './groups/GroupGrid';
46
+ import { GroupLinearProps } from './groups/GroupLinear';
47
+ import { GroupMasonryProps } from './groups/GroupMasonry';
40
48
  import { HTMLAttributeAnchorTarget } from 'react';
41
49
  import { HTMLAttributes } from 'react';
42
50
  import { IconCellValue } from './types/icon';
@@ -53,6 +61,8 @@ import { NumberCellValue } from '../../value-display/types/number';
53
61
  import { NumberCellValue as NumberCellValue_2 } from './types/number';
54
62
  import { NumberFilterOptions } from './NumberFilter/NumberFilter';
55
63
  import { Observable } from 'zen-observable-ts';
64
+ import { PageLayoutBlockComponent as PageLayoutBlockComponent_2 } from './types';
65
+ import { PageProps } from './pages/Page';
56
66
  import { PercentageCellValue } from './types/percentage';
57
67
  import { PersonCellValue } from '../../value-display/types/person';
58
68
  import { PersonCellValue as PersonCellValue_2 } from './types/person';
@@ -1121,6 +1131,19 @@ export declare type CurrentFilters<F extends FilterOptions<string>> = F extends
1121
1131
  [Key in K]?: FilterValue<F["fields"][Key]>;
1122
1132
  } : Record<string, never>;
1123
1133
 
1134
+ export declare const Dashboard: {
1135
+ ({ widgets, editMode, onChange, }: DashboardProps_2): JSX_2.Element;
1136
+ displayName: string;
1137
+ };
1138
+
1139
+ export declare type DashboardProps = GroupGridProps<DashboardWidget>;
1140
+
1141
+ export declare type DashboardWidget = GroupGridWidget<{
1142
+ title: string;
1143
+ actions?: DropdownItem[];
1144
+ aiButton?: () => void;
1145
+ }>;
1146
+
1124
1147
  export declare type Data<R extends RecordType> = {
1125
1148
  records: WithGroupId<R>[];
1126
1149
  type: "grouped" | "flat";
@@ -1988,7 +2011,7 @@ declare type EventParams = Record<string, EventScalar | Array<EventScalar>>;
1988
2011
 
1989
2012
  declare type EventScalar = string | number | boolean | undefined | null;
1990
2013
 
1991
- export declare const experimental: <T extends (...args: any[]) => any>(name: string, component: T) => T;
2014
+ export declare const experimental: <T extends React.ComponentType<any>>(name: string, component: T) => T;
1992
2015
 
1993
2016
  declare type ExtractVisualizationSettings<T> = T extends {
1994
2017
  settings: {
@@ -2716,6 +2739,37 @@ export declare interface GridStackReactWidget extends Omit<GridStackWidget, "con
2716
2739
  */
2717
2740
  export declare const GROUP_ID_SYMBOL: unique symbol;
2718
2741
 
2742
+ declare interface GroupGridProps<Widget extends GroupGridWidget> {
2743
+ widgets: Optional<Widget, "x" | "y">[];
2744
+ editMode?: boolean;
2745
+ /**
2746
+ * Callback function that is called whenever the layout changes.
2747
+ * Receives an array of widgets with updated positions and properties.
2748
+ * This can be used to keep widgets in sync by using the returned data.
2749
+ */
2750
+ onChange?: (widgets: Widget[]) => void;
2751
+ WidgetWrapper?: (children: React.ReactNode, meta: Widget["meta"] | undefined, editMode: boolean) => React.ReactElement;
2752
+ /**
2753
+ * If the group is the main content of the page, it will try to take the full height of the page
2754
+ */
2755
+ main?: boolean;
2756
+ }
2757
+
2758
+ declare type GroupGridWidget<Meta extends Record<string, unknown> = Record<string, unknown>> = {
2759
+ id: string;
2760
+ availableSizes?: GroupGridWidgetSize[];
2761
+ content: React.ReactNode;
2762
+ x: number;
2763
+ y: number;
2764
+ locked?: boolean;
2765
+ meta?: Meta;
2766
+ } & GroupGridWidgetSize;
2767
+
2768
+ declare type GroupGridWidgetSize = {
2769
+ w: number;
2770
+ h: number;
2771
+ };
2772
+
2719
2773
  /**
2720
2774
  * Defines the structure and configuration of a grouping options for a data source.
2721
2775
  * @template RecordType - The type of records in the collection
@@ -3037,6 +3091,21 @@ declare type Lane<Filters extends FiltersDefinition> = {
3037
3091
  filters: FiltersState<Filters>;
3038
3092
  };
3039
3093
 
3094
+ export declare const Layout: {
3095
+ Page: ForwardRefExoticComponent<PageProps & RefAttributes<HTMLDivElement>>;
3096
+ Block: ForwardRefExoticComponent<BlockProps & RefAttributes<HTMLDivElement>>;
3097
+ BlockContent: ComponentType<BlockProps & BlockContentExtraProps> & PageLayoutBlockComponent_2;
3098
+ Group: ForwardRefExoticComponent<GroupLinearProps & RefAttributes<HTMLDivElement>>;
3099
+ GroupGrid: {
3100
+ <Widget extends GroupGridWidget_2>({ widgets, editMode, onChange, WidgetWrapper, main, }: GroupGridProps_2<Widget>): JSX_2.Element;
3101
+ displayName: string;
3102
+ };
3103
+ GroupMasonry: {
3104
+ ({ blocks, sortable: _sortable, onSort: _onSort, main, }: GroupMasonryProps): JSX_2.Element;
3105
+ displayName: string;
3106
+ };
3107
+ };
3108
+
3040
3109
  declare interface LayoutProps {
3041
3110
  fullScreen?: boolean;
3042
3111
  addBodyClasses?: boolean;
@@ -3308,6 +3377,8 @@ export declare type OnSelectItemsCallback<R extends RecordType, Filters extends
3308
3377
  byLane?: Record<string, SelectedItemsDetailedStatus<R, Filters>>;
3309
3378
  }, clearSelectedItems: () => void) => void;
3310
3379
 
3380
+ declare type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
3381
+
3311
3382
  /**
3312
3383
  * Represents a paginated response with page-based navigation.
3313
3384
  *
@@ -3331,6 +3402,16 @@ export declare type PageBasedPaginatedResponse<TRecord> = BasePaginatedResponse<
3331
3402
  pagesCount: number;
3332
3403
  };
3333
3404
 
3405
+ export declare interface PageLayoutBlockComponent {
3406
+ __isPageLayoutBlock: true;
3407
+ displayName?: string;
3408
+ }
3409
+
3410
+ export declare interface PageLayoutGroupComponent {
3411
+ __isPageLayoutGroup: true;
3412
+ displayName?: string;
3413
+ }
3414
+
3334
3415
  /**
3335
3416
  * Paginated data adapter configuration
3336
3417
  * @template R - The type of records in the collection
@@ -4339,6 +4420,8 @@ export declare interface UseDataOptions<R extends RecordType, Filters extends Fi
4339
4420
  */
4340
4421
  export declare interface UseDataReturn<R extends RecordType> {
4341
4422
  data: Data<R>;
4423
+ search: string | undefined;
4424
+ setSearch: (search: string | undefined) => void;
4342
4425
  isInitialLoading: boolean;
4343
4426
  isLoading: boolean;
4344
4427
  isLoadingMore: boolean;
@@ -4590,23 +4673,6 @@ declare global {
4590
4673
  }
4591
4674
  }
4592
4675
 
4593
- declare module "gridstack" {
4594
- interface GridStackWidget {
4595
- id?: string;
4596
- allowedSizes?: Array<{
4597
- w: number;
4598
- h: number;
4599
- }>;
4600
- meta?: Record<string, unknown>;
4601
- }
4602
- interface GridStackNode {
4603
- allowedSizes?: Array<{
4604
- w: number;
4605
- h: number;
4606
- }>;
4607
- }
4608
- }
4609
-
4610
4676
 
4611
4677
  declare module "@tiptap/core" {
4612
4678
  interface Commands<ReturnType> {
@@ -4634,6 +4700,23 @@ declare module "@tiptap/core" {
4634
4700
  }
4635
4701
  }
4636
4702
 
4703
+ declare module "gridstack" {
4704
+ interface GridStackWidget {
4705
+ id?: string;
4706
+ allowedSizes?: Array<{
4707
+ w: number;
4708
+ h: number;
4709
+ }>;
4710
+ meta?: Record<string, unknown>;
4711
+ }
4712
+ interface GridStackNode {
4713
+ allowedSizes?: Array<{
4714
+ w: number;
4715
+ h: number;
4716
+ }>;
4717
+ }
4718
+ }
4719
+
4637
4720
 
4638
4721
  declare namespace Calendar {
4639
4722
  var displayName: string;