@factorialco/f0-react 1.288.0 → 1.290.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
@@ -52,7 +52,6 @@ import { LongTextCellValue } from './types/longText';
52
52
  import { NumberCellValue } from '../../value-display/types/number';
53
53
  import { NumberCellValue as NumberCellValue_2 } from './types/number';
54
54
  import { NumberFilterOptions } from './NumberFilter/NumberFilter';
55
- import { NumberFilterValue } from './NumberFilter/NumberFilter';
56
55
  import { Observable } from 'zen-observable-ts';
57
56
  import { PercentageCellValue } from './types/percentage';
58
57
  import { PersonCellValue } from '../../value-display/types/person';
@@ -64,6 +63,7 @@ import { ReactElement } from 'react';
64
63
  import { ReactNode } from 'react';
65
64
  import { RefAttributes } from 'react';
66
65
  import { RefObject } from 'react';
66
+ import { SearchFilterOptions } from './SearchFilter/SearchFilter';
67
67
  import { StatusCellValue } from '../../value-display/types/status';
68
68
  import { StatusCellValue as StatusCellValue_2 } from './types/status';
69
69
  import { SVGProps } from 'react';
@@ -920,7 +920,22 @@ declare interface CheckboxProps extends DataAttributes_2 {
920
920
  name?: string;
921
921
  }
922
922
 
923
- declare type ChildrenResponse<R extends RecordType> = BaseResponse<R> | R[] | NestedResponseWithType<R>;
923
+ declare type ChildrenPaginationInfo<R extends RecordType> = Omit<InfiniteScrollPaginatedResponse<R>, "type" | "records">;
924
+
925
+ declare type ChildrenResponse<R extends RecordType> = NestedResponseWithType<R>;
926
+
927
+ declare type ChipLabel = {
928
+ label: string;
929
+ } & ({
930
+ icon: IconType;
931
+ avatar?: never;
932
+ } | {
933
+ icon?: never;
934
+ avatar: AvatarVariant_2;
935
+ } | {
936
+ icon?: never;
937
+ avatar?: never;
938
+ });
924
939
 
925
940
  declare type ChipProps = BaseChipProps & ChipVariants & {
926
941
  variant?: "default" | "selected";
@@ -1295,11 +1310,11 @@ export declare type DataSourceDefinition<R extends RecordType = RecordType, Filt
1295
1310
  currentGrouping?: GroupingState<R, Grouping>;
1296
1311
  /*******************************************************/
1297
1312
  /***** NESTED RECORDS ***************************************************/
1298
- fetchChildren?: (item: R, filters?: FiltersState<FiltersDefinition>) => Promise<ChildrenResponse<R>>;
1313
+ fetchChildren?: (item: R, filters?: FiltersState<FiltersDefinition>, pagination?: ChildrenPaginationInfo<R>) => Promise<ChildrenResponse<R>>;
1299
1314
  /** Function to determine if an item has children */
1300
1315
  itemsWithChildren?: (item: R) => boolean;
1301
1316
  /** Function to get the number of children for an item */
1302
- childrenCount?: (item: R) => number | undefined;
1317
+ childrenCount?: (item: R, pagination?: ChildrenPaginationInfo<R>) => number | undefined;
1303
1318
  };
1304
1319
 
1305
1320
  export declare type DateFilterDefinition = BaseFilterDefinition<"date"> & {
@@ -1567,12 +1582,20 @@ export declare const defaultTranslations: {
1567
1582
  readonly equal: "Equal to";
1568
1583
  readonly equalTo: "Equal to {{value}}";
1569
1584
  readonly lessOrEqual: "Less or equal to";
1585
+ readonly lessThan: "Less than";
1570
1586
  readonly greaterOrEqual: "Greater or equal to";
1587
+ readonly greaterThan: "Greater than";
1571
1588
  readonly equalShort: "= {{value}}";
1572
1589
  readonly greaterThanOrEqualShort: ">= {{value}}";
1590
+ readonly greaterThanShort: "> {{value}}";
1573
1591
  readonly lessThanOrEqualShort: "<= {{value}}";
1592
+ readonly lessThanShort: "< {{value}}";
1574
1593
  readonly rangeTitle: "Use range";
1575
- readonly range: "Between {{min}} and {{max}}";
1594
+ readonly range: "{{minStrict}} {{min}} and {{maxStrict}} {{max}}";
1595
+ };
1596
+ readonly search: {
1597
+ readonly relaxed: "Relaxed";
1598
+ readonly strict: "Strict";
1576
1599
  };
1577
1600
  readonly selectAll: "Select all";
1578
1601
  readonly clear: "Clear";
@@ -2411,12 +2434,12 @@ declare type FilterTypeContext<Options extends object = never> = {
2411
2434
  i18n: I18nContextType;
2412
2435
  };
2413
2436
 
2414
- declare type FilterTypeDefinition<Value = unknown, Options extends object = never, EmptyValue = Value> = {
2415
- /** Check if the value is empty */
2437
+ declare type FilterTypeDefinition<Value = unknown, Options extends object = never, EmptyValue = Value, OptionalOptions extends boolean = false> = {
2416
2438
  emptyValue: EmptyValue;
2439
+ /** Check if the value is empty */
2417
2440
  isEmpty: (value: Value | undefined, context: FilterTypeContext<Options>) => boolean;
2418
2441
  /** Render the filter form */
2419
- render: <Schema extends FilterTypeSchema<Options>>(props: {
2442
+ render: <Schema extends FilterTypeSchema<Options, OptionalOptions>>(props: {
2420
2443
  schema: Schema;
2421
2444
  value: Value;
2422
2445
  onChange: (value: Value) => void;
@@ -2425,7 +2448,7 @@ declare type FilterTypeDefinition<Value = unknown, Options extends object = neve
2425
2448
  /**
2426
2449
  * The value label to display in the filter chips
2427
2450
  */
2428
- chipLabel: (value: Value, context: FilterTypeContext<Options>) => string | Promise<string>;
2451
+ chipLabel: (value: Value, context: FilterTypeContext<Options>) => string | ChipLabel | Promise<string | ChipLabel>;
2429
2452
  /**
2430
2453
  * The default options to render a filter of this type, for example max and min date for a date filter, the list of options for an in filter, etc
2431
2454
  */
@@ -2440,14 +2463,27 @@ declare type FilterTypeKey = keyof typeof filterTypes;
2440
2463
 
2441
2464
  declare const filterTypes: {
2442
2465
  readonly in: FilterTypeDefinition<string[], InFilterOptions<string>>;
2443
- readonly search: FilterTypeDefinition<string>;
2466
+ readonly search: FilterTypeDefinition<string | {
2467
+ value: string;
2468
+ strict: boolean;
2469
+ }, SearchFilterOptions, string | {
2470
+ value: string;
2471
+ strict: boolean;
2472
+ }, true>;
2444
2473
  readonly date: FilterTypeDefinition<Date | DateRange | undefined, DateFilterOptions>;
2445
2474
  readonly number: FilterTypeDefinition<NumberFilterValue, NumberFilterOptions>;
2446
2475
  };
2447
2476
 
2448
- declare type FilterTypeSchema<Options extends object = never> = {
2449
- options: Options extends never ? never : Options;
2477
+ declare type FilterTypeSchema<Options extends object = never, OptionalOptions extends boolean = false> = OptionalOptions extends true ? FilterTypeSchemaOptionalOptions<Options> : FilterTypeSchemaRequiredOptions<Options>;
2478
+
2479
+ declare type FilterTypeSchemaOptionalOptions<Options extends object = never> = {
2480
+ label: string;
2481
+ options?: Options extends never ? never : Options;
2482
+ };
2483
+
2484
+ declare type FilterTypeSchemaRequiredOptions<Options extends object = never> = {
2450
2485
  label: string;
2486
+ options: Options extends never ? never : Options;
2451
2487
  };
2452
2488
 
2453
2489
  /**
@@ -2458,7 +2494,7 @@ declare type FilterTypeSchema<Options extends object = never> = {
2458
2494
  * This type is used to ensure type safety when working with filter values.
2459
2495
  * @template T - The filter definition type
2460
2496
  */
2461
- export declare type FilterValue<T extends FilterDefinition> = T extends InFilterDefinition<infer U> ? U[] : T extends SearchFilterDefinition ? string : T extends DateFilterDefinition ? DateRange | Date | undefined : T extends NumberFilterDefinition ? [number | undefined, number | undefined] | undefined : never;
2497
+ export declare type FilterValue<T extends FilterDefinition> = T extends InFilterDefinition<infer U> ? U[] : T extends SearchFilterDefinition ? string : T extends DateFilterDefinition ? DateRange | Date | undefined : T extends NumberFilterDefinition ? NumberFilterValue | undefined : never;
2462
2498
 
2463
2499
  /**
2464
2500
  * Extracts the value type for a specific filter key from a FiltersDefinition.
@@ -2799,6 +2835,16 @@ declare type InputFieldProps<T> = {
2799
2835
  */
2800
2836
  offset?: number;
2801
2837
  };
2838
+ /**
2839
+ * Renders a button toggle inside the input field
2840
+ */
2841
+ buttonToggle?: {
2842
+ label: string | [string, string];
2843
+ icon: IconType | [IconType, IconType];
2844
+ selected: boolean;
2845
+ disabled?: boolean;
2846
+ onChange: (selected: boolean) => void;
2847
+ };
2802
2848
  };
2803
2849
 
2804
2850
  declare type InputFieldSize = (typeof INPUTFIELD_SIZES)[number];
@@ -3070,6 +3116,7 @@ declare type NestedKeyOf<T> = {
3070
3116
  declare type NestedResponseWithType<R extends RecordType> = {
3071
3117
  records: R[];
3072
3118
  type?: NestedVariant;
3119
+ paginationInfo?: ChildrenPaginationInfo<R>;
3073
3120
  };
3074
3121
 
3075
3122
  declare type NestedVariant = "basic" | "detailed";
@@ -3088,9 +3135,25 @@ export declare type NumberFilterDefinition = BaseFilterDefinition<"number"> & {
3088
3135
  declare type NumberFilterOptions_2 = {
3089
3136
  min?: number;
3090
3137
  max?: number;
3091
- modes?: ("range" | "single")[];
3138
+ modes?: readonly ("range" | "single")[];
3139
+ openCloseToggle?: boolean;
3092
3140
  };
3093
3141
 
3142
+ declare type NumberFilterValue = {
3143
+ mode: "single";
3144
+ value: number | undefined;
3145
+ } | {
3146
+ mode: "range";
3147
+ from: {
3148
+ value: number | undefined;
3149
+ closed: boolean;
3150
+ };
3151
+ to: {
3152
+ value: number | undefined;
3153
+ closed: boolean;
3154
+ };
3155
+ } | undefined;
3156
+
3094
3157
  declare type OnBulkActionCallback<Record extends RecordType, Filters extends FiltersDefinition> = (...args: [
3095
3158
  action: BulkAction,
3096
3159
  ...Parameters<OnSelectItemsCallback<Record, Filters>>
@@ -4347,31 +4410,6 @@ declare global {
4347
4410
  }
4348
4411
 
4349
4412
 
4350
- declare module "gridstack" {
4351
- interface GridStackWidget {
4352
- id?: string;
4353
- allowedSizes?: Array<{
4354
- w: number;
4355
- h: number;
4356
- }>;
4357
- renderFn?: () => React.ReactElement | null;
4358
- meta?: Record<string, unknown>;
4359
- }
4360
- interface GridStackNode {
4361
- id?: string;
4362
- w?: number;
4363
- h?: number;
4364
- x?: number;
4365
- y?: number;
4366
- allowedSizes?: Array<{
4367
- w: number;
4368
- h: number;
4369
- }>;
4370
- renderFn?: () => React.ReactElement | null;
4371
- }
4372
- }
4373
-
4374
-
4375
4413
  declare module "@tiptap/core" {
4376
4414
  interface Commands<ReturnType> {
4377
4415
  aiBlock: {
@@ -4399,8 +4437,28 @@ declare module "@tiptap/core" {
4399
4437
  }
4400
4438
 
4401
4439
 
4402
- declare namespace Calendar {
4403
- var displayName: string;
4440
+ declare module "gridstack" {
4441
+ interface GridStackWidget {
4442
+ id?: string;
4443
+ allowedSizes?: Array<{
4444
+ w: number;
4445
+ h: number;
4446
+ }>;
4447
+ renderFn?: () => React.ReactElement | null;
4448
+ meta?: Record<string, unknown>;
4449
+ }
4450
+ interface GridStackNode {
4451
+ id?: string;
4452
+ w?: number;
4453
+ h?: number;
4454
+ x?: number;
4455
+ y?: number;
4456
+ allowedSizes?: Array<{
4457
+ w: number;
4458
+ h: number;
4459
+ }>;
4460
+ renderFn?: () => React.ReactElement | null;
4461
+ }
4404
4462
  }
4405
4463
 
4406
4464
 
@@ -4411,3 +4469,8 @@ declare module "@tiptap/core" {
4411
4469
  };
4412
4470
  }
4413
4471
  }
4472
+
4473
+
4474
+ declare namespace Calendar {
4475
+ var displayName: string;
4476
+ }