@factorialco/f0-react 1.287.0 → 1.289.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';
@@ -922,6 +922,19 @@ declare interface CheckboxProps extends DataAttributes_2 {
922
922
 
923
923
  declare type ChildrenResponse<R extends RecordType> = BaseResponse<R> | R[] | NestedResponseWithType<R>;
924
924
 
925
+ declare type ChipLabel = {
926
+ label: string;
927
+ } & ({
928
+ icon: IconType;
929
+ avatar?: never;
930
+ } | {
931
+ icon?: never;
932
+ avatar: AvatarVariant_2;
933
+ } | {
934
+ icon?: never;
935
+ avatar?: never;
936
+ });
937
+
925
938
  declare type ChipProps = BaseChipProps & ChipVariants & {
926
939
  variant?: "default" | "selected";
927
940
  };
@@ -1567,12 +1580,20 @@ export declare const defaultTranslations: {
1567
1580
  readonly equal: "Equal to";
1568
1581
  readonly equalTo: "Equal to {{value}}";
1569
1582
  readonly lessOrEqual: "Less or equal to";
1583
+ readonly lessThan: "Less than";
1570
1584
  readonly greaterOrEqual: "Greater or equal to";
1585
+ readonly greaterThan: "Greater than";
1571
1586
  readonly equalShort: "= {{value}}";
1572
1587
  readonly greaterThanOrEqualShort: ">= {{value}}";
1588
+ readonly greaterThanShort: "> {{value}}";
1573
1589
  readonly lessThanOrEqualShort: "<= {{value}}";
1590
+ readonly lessThanShort: "< {{value}}";
1574
1591
  readonly rangeTitle: "Use range";
1575
- readonly range: "Between {{min}} and {{max}}";
1592
+ readonly range: "{{minStrict}} {{min}} and {{maxStrict}} {{max}}";
1593
+ };
1594
+ readonly search: {
1595
+ readonly relaxed: "Relaxed";
1596
+ readonly strict: "Strict";
1576
1597
  };
1577
1598
  readonly selectAll: "Select all";
1578
1599
  readonly clear: "Clear";
@@ -2411,12 +2432,12 @@ declare type FilterTypeContext<Options extends object = never> = {
2411
2432
  i18n: I18nContextType;
2412
2433
  };
2413
2434
 
2414
- declare type FilterTypeDefinition<Value = unknown, Options extends object = never, EmptyValue = Value> = {
2415
- /** Check if the value is empty */
2435
+ declare type FilterTypeDefinition<Value = unknown, Options extends object = never, EmptyValue = Value, OptionalOptions extends boolean = false> = {
2416
2436
  emptyValue: EmptyValue;
2437
+ /** Check if the value is empty */
2417
2438
  isEmpty: (value: Value | undefined, context: FilterTypeContext<Options>) => boolean;
2418
2439
  /** Render the filter form */
2419
- render: <Schema extends FilterTypeSchema<Options>>(props: {
2440
+ render: <Schema extends FilterTypeSchema<Options, OptionalOptions>>(props: {
2420
2441
  schema: Schema;
2421
2442
  value: Value;
2422
2443
  onChange: (value: Value) => void;
@@ -2425,7 +2446,7 @@ declare type FilterTypeDefinition<Value = unknown, Options extends object = neve
2425
2446
  /**
2426
2447
  * The value label to display in the filter chips
2427
2448
  */
2428
- chipLabel: (value: Value, context: FilterTypeContext<Options>) => string | Promise<string>;
2449
+ chipLabel: (value: Value, context: FilterTypeContext<Options>) => string | ChipLabel | Promise<string | ChipLabel>;
2429
2450
  /**
2430
2451
  * 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
2452
  */
@@ -2440,14 +2461,27 @@ declare type FilterTypeKey = keyof typeof filterTypes;
2440
2461
 
2441
2462
  declare const filterTypes: {
2442
2463
  readonly in: FilterTypeDefinition<string[], InFilterOptions<string>>;
2443
- readonly search: FilterTypeDefinition<string>;
2464
+ readonly search: FilterTypeDefinition<string | {
2465
+ value: string;
2466
+ strict: boolean;
2467
+ }, SearchFilterOptions, string | {
2468
+ value: string;
2469
+ strict: boolean;
2470
+ }, true>;
2444
2471
  readonly date: FilterTypeDefinition<Date | DateRange | undefined, DateFilterOptions>;
2445
2472
  readonly number: FilterTypeDefinition<NumberFilterValue, NumberFilterOptions>;
2446
2473
  };
2447
2474
 
2448
- declare type FilterTypeSchema<Options extends object = never> = {
2449
- options: Options extends never ? never : Options;
2475
+ declare type FilterTypeSchema<Options extends object = never, OptionalOptions extends boolean = false> = OptionalOptions extends true ? FilterTypeSchemaOptionalOptions<Options> : FilterTypeSchemaRequiredOptions<Options>;
2476
+
2477
+ declare type FilterTypeSchemaOptionalOptions<Options extends object = never> = {
2478
+ label: string;
2479
+ options?: Options extends never ? never : Options;
2480
+ };
2481
+
2482
+ declare type FilterTypeSchemaRequiredOptions<Options extends object = never> = {
2450
2483
  label: string;
2484
+ options: Options extends never ? never : Options;
2451
2485
  };
2452
2486
 
2453
2487
  /**
@@ -2458,7 +2492,7 @@ declare type FilterTypeSchema<Options extends object = never> = {
2458
2492
  * This type is used to ensure type safety when working with filter values.
2459
2493
  * @template T - The filter definition type
2460
2494
  */
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;
2495
+ 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
2496
 
2463
2497
  /**
2464
2498
  * Extracts the value type for a specific filter key from a FiltersDefinition.
@@ -2799,6 +2833,16 @@ declare type InputFieldProps<T> = {
2799
2833
  */
2800
2834
  offset?: number;
2801
2835
  };
2836
+ /**
2837
+ * Renders a button toggle inside the input field
2838
+ */
2839
+ buttonToggle?: {
2840
+ label: string | [string, string];
2841
+ icon: IconType | [IconType, IconType];
2842
+ selected: boolean;
2843
+ disabled?: boolean;
2844
+ onChange: (selected: boolean) => void;
2845
+ };
2802
2846
  };
2803
2847
 
2804
2848
  declare type InputFieldSize = (typeof INPUTFIELD_SIZES)[number];
@@ -3088,9 +3132,25 @@ export declare type NumberFilterDefinition = BaseFilterDefinition<"number"> & {
3088
3132
  declare type NumberFilterOptions_2 = {
3089
3133
  min?: number;
3090
3134
  max?: number;
3091
- modes?: ("range" | "single")[];
3135
+ modes?: readonly ("range" | "single")[];
3136
+ openCloseToggle?: boolean;
3092
3137
  };
3093
3138
 
3139
+ declare type NumberFilterValue = {
3140
+ mode: "single";
3141
+ value: number | undefined;
3142
+ } | {
3143
+ mode: "range";
3144
+ from: {
3145
+ value: number | undefined;
3146
+ closed: boolean;
3147
+ };
3148
+ to: {
3149
+ value: number | undefined;
3150
+ closed: boolean;
3151
+ };
3152
+ } | undefined;
3153
+
3094
3154
  declare type OnBulkActionCallback<Record extends RecordType, Filters extends FiltersDefinition> = (...args: [
3095
3155
  action: BulkAction,
3096
3156
  ...Parameters<OnSelectItemsCallback<Record, Filters>>
@@ -4347,27 +4407,11 @@ declare global {
4347
4407
  }
4348
4408
 
4349
4409
 
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;
4410
+ declare module "@tiptap/core" {
4411
+ interface Commands<ReturnType> {
4412
+ aiBlock: {
4413
+ insertAIBlock: (data: AIBlockData, config: AIBlockConfigWithLabels) => ReturnType;
4414
+ };
4371
4415
  }
4372
4416
  }
4373
4417
 
@@ -4390,11 +4434,27 @@ declare module "@tiptap/core" {
4390
4434
  }
4391
4435
 
4392
4436
 
4393
- declare module "@tiptap/core" {
4394
- interface Commands<ReturnType> {
4395
- aiBlock: {
4396
- insertAIBlock: (data: AIBlockData, config: AIBlockConfigWithLabels) => ReturnType;
4397
- };
4437
+ declare module "gridstack" {
4438
+ interface GridStackWidget {
4439
+ id?: string;
4440
+ allowedSizes?: Array<{
4441
+ w: number;
4442
+ h: number;
4443
+ }>;
4444
+ renderFn?: () => React.ReactElement | null;
4445
+ meta?: Record<string, unknown>;
4446
+ }
4447
+ interface GridStackNode {
4448
+ id?: string;
4449
+ w?: number;
4450
+ h?: number;
4451
+ x?: number;
4452
+ y?: number;
4453
+ allowedSizes?: Array<{
4454
+ w: number;
4455
+ h: number;
4456
+ }>;
4457
+ renderFn?: () => React.ReactElement | null;
4398
4458
  }
4399
4459
  }
4400
4460