@factorialco/f0-react 1.250.0 → 1.251.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
@@ -46,6 +46,8 @@ import { LineChartPropsBase } from './utils/types';
46
46
  import { LongTextCellValue } from './types/longText.tsx';
47
47
  import { NumberCellValue } from '../../value-display/types/number';
48
48
  import { NumberCellValue as NumberCellValue_2 } from './types/number.tsx';
49
+ import { NumberFilterOptions } from './NumberFilter/NumberFilter';
50
+ import { NumberFilterValue } from './NumberFilter/NumberFilter';
49
51
  import { Observable } from 'zen-observable-ts';
50
52
  import { PercentageCellValue } from './types/percentage.tsx';
51
53
  import { PersonCellValue } from '../../value-display/types/person';
@@ -1386,6 +1388,11 @@ export declare const defaultTranslations: {
1386
1388
  readonly cancel: "Cancel";
1387
1389
  readonly failedToLoadOptions: "Failed to load options";
1388
1390
  readonly retry: "Retry";
1391
+ readonly aboveOrEqual: "Above or equal to";
1392
+ readonly value: "Value";
1393
+ readonly belowOrEqual: "Below or equal to";
1394
+ readonly range_title: "Use range";
1395
+ readonly range: "Between {{min}} and {{max}}";
1389
1396
  };
1390
1397
  readonly toc: {
1391
1398
  readonly search: "Search...";
@@ -1545,6 +1552,11 @@ export declare const defaultTranslations: {
1545
1552
  readonly noResults: "No results found";
1546
1553
  readonly loadingMore: "Loading...";
1547
1554
  };
1555
+ readonly numberInput: {
1556
+ readonly between: "Between {{min}} and {{max}}";
1557
+ readonly greaterThan: "Greater than {{min}}";
1558
+ readonly lessThan: "Less than {{max}}";
1559
+ };
1548
1560
  };
1549
1561
 
1550
1562
  /**
@@ -2057,6 +2069,7 @@ declare type FilterDefinitionsByType<T = unknown, R extends RecordType = RecordT
2057
2069
  in: InFilterDefinition<T, R>;
2058
2070
  search: SearchFilterDefinition;
2059
2071
  date: DateFilterDefinition;
2072
+ number: NumberFilterDefinition;
2060
2073
  };
2061
2074
 
2062
2075
  /**
@@ -2088,13 +2101,13 @@ export declare type FiltersState<Definition extends Record<string, FilterDefinit
2088
2101
 
2089
2102
  declare type FilterTypeContext<Options extends object = never> = {
2090
2103
  schema: FilterTypeSchema<Options>;
2091
- i18n: TranslationsType;
2104
+ i18n: I18nContextType;
2092
2105
  };
2093
2106
 
2094
2107
  declare type FilterTypeDefinition<Value = unknown, Options extends object = never, EmptyValue = Value> = {
2095
2108
  /** Check if the value is empty */
2096
2109
  emptyValue: EmptyValue;
2097
- isEmpty: (value: Value, context: FilterTypeContext<Options>) => boolean;
2110
+ isEmpty: (value: Value | undefined, context: FilterTypeContext<Options>) => boolean;
2098
2111
  /** Render the filter form */
2099
2112
  render: <Schema extends FilterTypeSchema<Options>>(props: {
2100
2113
  schema: Schema;
@@ -2122,6 +2135,7 @@ declare const filterTypes: {
2122
2135
  readonly in: FilterTypeDefinition<string[], InFilterOptions<string>>;
2123
2136
  readonly search: FilterTypeDefinition<string>;
2124
2137
  readonly date: FilterTypeDefinition<Date | DateRange | undefined, DateFilterOptions>;
2138
+ readonly number: FilterTypeDefinition<NumberFilterValue, NumberFilterOptions>;
2125
2139
  };
2126
2140
 
2127
2141
  declare type FilterTypeSchema<Options extends object = never> = {
@@ -2137,7 +2151,7 @@ declare type FilterTypeSchema<Options extends object = never> = {
2137
2151
  * This type is used to ensure type safety when working with filter values.
2138
2152
  * @template T - The filter definition type
2139
2153
  */
2140
- export declare type FilterValue<T extends FilterDefinition> = T extends InFilterDefinition<infer U> ? U[] : T extends SearchFilterDefinition ? string : T extends DateFilterDefinition ? DateRange | Date | undefined : never;
2154
+ 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;
2141
2155
 
2142
2156
  export declare type FlagAvatarVariant = Extract<AvatarVariant, {
2143
2157
  type: "flag";
@@ -2259,6 +2273,10 @@ widgets?: ReactNode[];
2259
2273
  children?: ReactNode;
2260
2274
  } & RefAttributes<HTMLDivElement>, "ref"> & RefAttributes<HTMLElement | SVGElement>>;
2261
2275
 
2276
+ declare type I18nContextType = TranslationsType & {
2277
+ t: (key: TranslationKey, args?: Record<string, string | number>) => string;
2278
+ };
2279
+
2262
2280
  declare interface I18nProviderProps {
2263
2281
  children: ReactNode;
2264
2282
  translations: TranslationsType;
@@ -2452,6 +2470,8 @@ declare type ItemDefinition = {
2452
2470
  avatar?: AvatarVariant;
2453
2471
  };
2454
2472
 
2473
+ declare type Join<T extends string[], D extends string> = T extends [] ? never : T extends [infer F] ? F : T extends [infer F, ...infer R] ? F extends string ? `${F}${D}${Join<Extract<R, string[]>, D>}` : never : string;
2474
+
2455
2475
  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>>;
2456
2476
 
2457
2477
  declare type KanbanLaneDefinition = {
@@ -2685,6 +2705,16 @@ export declare interface NextStepsProps {
2685
2705
  items: StepItemProps[];
2686
2706
  }
2687
2707
 
2708
+ declare type NumberFilterDefinition = BaseFilterDefinition<"number"> & {
2709
+ options?: NumberFilterOptions_2;
2710
+ };
2711
+
2712
+ declare type NumberFilterOptions_2 = {
2713
+ min?: number;
2714
+ max?: number;
2715
+ modes?: ("range" | "single")[];
2716
+ };
2717
+
2688
2718
  declare type OnBulkActionCallback<Record extends RecordType, Filters extends FiltersDefinition> = (...args: [
2689
2719
  action: BulkAction,
2690
2720
  ...Parameters<OnSelectItemsCallback<Record, Filters>>
@@ -2807,6 +2837,10 @@ export declare type PaginationInfo = Omit<PageBasedPaginatedResponse<unknown>, "
2807
2837
  */
2808
2838
  export declare type PaginationType = "pages" | "infinite-scroll" | "no-pagination";
2809
2839
 
2840
+ declare type PathsToStringProps<T> = T extends string ? [] : {
2841
+ [K in Extract<keyof T, string>]: [K, ...PathsToStringProps<T[K]>];
2842
+ }[Extract<keyof T, string>];
2843
+
2810
2844
  export declare type PersonAvatarVariant = Extract<AvatarVariant, {
2811
2845
  type: "person";
2812
2846
  }>;
@@ -3438,6 +3472,8 @@ export declare type TeamAvatarVariant = Extract<AvatarVariant, {
3438
3472
 
3439
3473
  declare type TeamTagProps = ComponentProps<typeof F0TagTeam>;
3440
3474
 
3475
+ declare type TranslationKey = Join<PathsToStringProps<typeof defaultTranslations>, ".">;
3476
+
3441
3477
  declare type TranslationShape<T> = {
3442
3478
  [K in keyof T]: T[K] extends string ? string : T[K] extends Record<string, string | Record<string, unknown>> ? TranslationShape<T[K]> : never;
3443
3479
  };
@@ -3889,6 +3925,11 @@ declare module "@tiptap/core" {
3889
3925
  }
3890
3926
 
3891
3927
 
3928
+ declare namespace Calendar {
3929
+ var displayName: string;
3930
+ }
3931
+
3932
+
3892
3933
  declare module "@tiptap/core" {
3893
3934
  interface Commands<ReturnType> {
3894
3935
  moodTracker: {
@@ -3896,8 +3937,3 @@ declare module "@tiptap/core" {
3896
3937
  };
3897
3938
  }
3898
3939
  }
3899
-
3900
-
3901
- declare namespace Calendar {
3902
- var displayName: string;
3903
- }