@factorialco/f0-react 1.276.2 → 1.276.3

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.
@@ -1827,7 +1827,7 @@ export declare type DataSourceDefinition<R extends RecordType = RecordType, Filt
1827
1827
  currentGrouping?: GroupingState<R, Grouping>;
1828
1828
  };
1829
1829
 
1830
- declare type DateFilterDefinition = BaseFilterDefinition<"date"> & {
1830
+ export declare type DateFilterDefinition = BaseFilterDefinition<"date"> & {
1831
1831
  options?: DateFilterOptions_2;
1832
1832
  };
1833
1833
 
@@ -2778,6 +2778,26 @@ declare type FilterTypeSchema<Options extends object = never> = {
2778
2778
  */
2779
2779
  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;
2780
2780
 
2781
+ /**
2782
+ * Extracts the value type for a specific filter key from a FiltersDefinition.
2783
+ * This helper type allows for type-safe access to filter values when you know the specific filter key.
2784
+ *
2785
+ * @example
2786
+ * ```ts
2787
+ * type MyFilters = {
2788
+ * department: InFilterDefinition<string>
2789
+ * search: SearchFilterDefinition
2790
+ * }
2791
+ *
2792
+ * type DepartmentValue = FilterValueByKey<MyFilters, 'department'> // string[]
2793
+ * type SearchValue = FilterValueByKey<MyFilters, 'search'> // string
2794
+ * ```
2795
+ *
2796
+ * @template Definition - The FiltersDefinition type
2797
+ * @template Key - The specific filter key to extract the value type for
2798
+ */
2799
+ export declare type FilterValueByKey<Definition extends Record<string, FilterDefinition>, Key extends keyof Definition> = FilterValue<Definition[Key]>;
2800
+
2781
2801
  export declare type FlattenedItem = {
2782
2802
  parent: EntitySelectEntity | null;
2783
2803
  subItem: EntitySelectSubEntity & {
@@ -3038,7 +3058,7 @@ declare type InferRecord<S> = S extends {
3038
3058
 
3039
3059
  declare type InferSchema<T extends SchemaType> = z.infer<T>;
3040
3060
 
3041
- declare type InFilterDefinition<T = unknown, R extends RecordType = RecordType> = BaseFilterDefinition<"in"> & {
3061
+ export declare type InFilterDefinition<T = string | number, R extends RecordType = RecordType> = BaseFilterDefinition<"in"> & {
3042
3062
  options: InFilterOptions_2<T, R>;
3043
3063
  };
3044
3064
 
@@ -3058,13 +3078,13 @@ declare type InFilterOptionItem<T = unknown> = {
3058
3078
  * Represents the options for the InFilter component.
3059
3079
  * @template T - Type of the underlying value
3060
3080
  */
3061
- declare type InFilterOptions_2<T, R extends RecordType = RecordType> = {
3081
+ declare type InFilterOptions_2<T, _R extends RecordType = RecordType> = {
3062
3082
  cache?: boolean;
3063
3083
  } & ({
3064
3084
  options: Array<InFilterOptionItem<T>> | (() => Array<InFilterOptionItem<T>> | Promise<Array<InFilterOptionItem<T>>>);
3065
3085
  } | {
3066
- source: DataSourceDefinition<R, FiltersDefinition, SortingsDefinition, GroupingDefinition<R>>;
3067
- mapOptions: (item: R) => InFilterOptionItem<T>;
3086
+ source: DataSourceDefinition<any, FiltersDefinition, SortingsDefinition, GroupingDefinition<any>>;
3087
+ mapOptions: (item: any) => InFilterOptionItem<T>;
3068
3088
  });
3069
3089
 
3070
3090
  /**
@@ -3699,7 +3719,7 @@ export declare interface NotesTextEditorSkeletonProps {
3699
3719
  withToolbar?: boolean;
3700
3720
  }
3701
3721
 
3702
- declare type NumberFilterDefinition = BaseFilterDefinition<"number"> & {
3722
+ export declare type NumberFilterDefinition = BaseFilterDefinition<"number"> & {
3703
3723
  options?: NumberFilterOptions_2;
3704
3724
  };
3705
3725
 
@@ -4589,7 +4609,7 @@ declare interface SearchBarProps extends ButtonHTMLAttributes<HTMLButtonElement>
4589
4609
  shortcut?: string[];
4590
4610
  }
4591
4611
 
4592
- declare type SearchFilterDefinition = BaseFilterDefinition<"search">;
4612
+ export declare type SearchFilterDefinition = BaseFilterDefinition<"search">;
4593
4613
 
4594
4614
  declare type SearchOptions = {
4595
4615
  /** Whether search is enabled */
@@ -5811,6 +5831,11 @@ declare module "gridstack" {
5811
5831
  }
5812
5832
 
5813
5833
 
5834
+ declare namespace Calendar {
5835
+ var displayName: string;
5836
+ }
5837
+
5838
+
5814
5839
  declare module "@tiptap/core" {
5815
5840
  interface Commands<ReturnType> {
5816
5841
  moodTracker: {
@@ -5818,8 +5843,3 @@ declare module "@tiptap/core" {
5818
5843
  };
5819
5844
  }
5820
5845
  }
5821
-
5822
-
5823
- declare namespace Calendar {
5824
- var displayName: string;
5825
- }
package/dist/f0.d.ts CHANGED
@@ -1282,7 +1282,7 @@ export declare type DataSourceDefinition<R extends RecordType = RecordType, Filt
1282
1282
  currentGrouping?: GroupingState<R, Grouping>;
1283
1283
  };
1284
1284
 
1285
- declare type DateFilterDefinition = BaseFilterDefinition<"date"> & {
1285
+ export declare type DateFilterDefinition = BaseFilterDefinition<"date"> & {
1286
1286
  options?: DateFilterOptions_2;
1287
1287
  };
1288
1288
 
@@ -2271,6 +2271,26 @@ declare type FilterTypeSchema<Options extends object = never> = {
2271
2271
  */
2272
2272
  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;
2273
2273
 
2274
+ /**
2275
+ * Extracts the value type for a specific filter key from a FiltersDefinition.
2276
+ * This helper type allows for type-safe access to filter values when you know the specific filter key.
2277
+ *
2278
+ * @example
2279
+ * ```ts
2280
+ * type MyFilters = {
2281
+ * department: InFilterDefinition<string>
2282
+ * search: SearchFilterDefinition
2283
+ * }
2284
+ *
2285
+ * type DepartmentValue = FilterValueByKey<MyFilters, 'department'> // string[]
2286
+ * type SearchValue = FilterValueByKey<MyFilters, 'search'> // string
2287
+ * ```
2288
+ *
2289
+ * @template Definition - The FiltersDefinition type
2290
+ * @template Key - The specific filter key to extract the value type for
2291
+ */
2292
+ export declare type FilterValueByKey<Definition extends Record<string, FilterDefinition>, Key extends keyof Definition> = FilterValue<Definition[Key]>;
2293
+
2274
2294
  export declare type FlagAvatarVariant = Extract<AvatarVariant, {
2275
2295
  type: "flag";
2276
2296
  }>;
@@ -2456,7 +2476,7 @@ declare type ImageContextValue = {
2456
2476
 
2457
2477
  declare type ImageProps = ImgHTMLAttributes<HTMLImageElement>;
2458
2478
 
2459
- declare type InFilterDefinition<T = unknown, R extends RecordType = RecordType> = BaseFilterDefinition<"in"> & {
2479
+ export declare type InFilterDefinition<T = string | number, R extends RecordType = RecordType> = BaseFilterDefinition<"in"> & {
2460
2480
  options: InFilterOptions_2<T, R>;
2461
2481
  };
2462
2482
 
@@ -2476,13 +2496,13 @@ declare type InFilterOptionItem<T = unknown> = {
2476
2496
  * Represents the options for the InFilter component.
2477
2497
  * @template T - Type of the underlying value
2478
2498
  */
2479
- declare type InFilterOptions_2<T, R extends RecordType = RecordType> = {
2499
+ declare type InFilterOptions_2<T, _R extends RecordType = RecordType> = {
2480
2500
  cache?: boolean;
2481
2501
  } & ({
2482
2502
  options: Array<InFilterOptionItem<T>> | (() => Array<InFilterOptionItem<T>> | Promise<Array<InFilterOptionItem<T>>>);
2483
2503
  } | {
2484
- source: DataSourceDefinition<R, FiltersDefinition, SortingsDefinition, GroupingDefinition<R>>;
2485
- mapOptions: (item: R) => InFilterOptionItem<T>;
2504
+ source: DataSourceDefinition<any, FiltersDefinition, SortingsDefinition, GroupingDefinition<any>>;
2505
+ mapOptions: (item: any) => InFilterOptionItem<T>;
2486
2506
  });
2487
2507
 
2488
2508
  /**
@@ -2852,7 +2872,7 @@ export declare interface NextStepsProps {
2852
2872
  items: StepItemProps[];
2853
2873
  }
2854
2874
 
2855
- declare type NumberFilterDefinition = BaseFilterDefinition<"number"> & {
2875
+ export declare type NumberFilterDefinition = BaseFilterDefinition<"number"> & {
2856
2876
  options?: NumberFilterOptions_2;
2857
2877
  };
2858
2878
 
@@ -3257,7 +3277,7 @@ declare type RegularAction = BaseAction & {
3257
3277
 
3258
3278
  declare type RendererDefinition = ValueDisplayRendererDefinition;
3259
3279
 
3260
- declare type SearchFilterDefinition = BaseFilterDefinition<"search">;
3280
+ export declare type SearchFilterDefinition = BaseFilterDefinition<"search">;
3261
3281
 
3262
3282
  declare type SearchOptions = {
3263
3283
  /** Whether search is enabled */
@@ -4104,6 +4124,11 @@ declare module "gridstack" {
4104
4124
  }
4105
4125
 
4106
4126
 
4127
+ declare namespace Calendar {
4128
+ var displayName: string;
4129
+ }
4130
+
4131
+
4107
4132
  declare module "@tiptap/core" {
4108
4133
  interface Commands<ReturnType> {
4109
4134
  moodTracker: {
@@ -4111,8 +4136,3 @@ declare module "@tiptap/core" {
4111
4136
  };
4112
4137
  }
4113
4138
  }
4114
-
4115
-
4116
- declare namespace Calendar {
4117
- var displayName: string;
4118
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@factorialco/f0-react",
3
- "version": "1.276.2",
3
+ "version": "1.276.3",
4
4
  "main": "dist/f0.js",
5
5
  "typings": "dist/f0.d.ts",
6
6
  "private": false,