@sonamu-kit/react-components 0.3.9 → 0.4.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.
|
@@ -1,9 +1,18 @@
|
|
|
1
|
-
import { UseQueryResult } from '@tanstack/react-query';
|
|
1
|
+
import { InfiniteData, UseInfiniteQueryResult, UseQueryResult } from '@tanstack/react-query';
|
|
2
2
|
export type AsyncIdConfig<TSubsetKey extends string = string, _TSubsetMapping = Record<string, unknown>, _TListParams extends Record<string, unknown> = Record<string, unknown>> = {
|
|
3
3
|
placeholderKey: string;
|
|
4
4
|
useList: <T extends TSubsetKey>(subset: T, params?: any, options?: {
|
|
5
5
|
enabled?: boolean;
|
|
6
6
|
}) => UseQueryResult<Record<string, unknown>>;
|
|
7
|
+
useListInfinite: <T extends TSubsetKey>(subset: T, params?: any, options?: {
|
|
8
|
+
enabled?: boolean;
|
|
9
|
+
}) => UseInfiniteQueryResult<InfiniteData<{
|
|
10
|
+
rows: Record<string, unknown>[];
|
|
11
|
+
total: number;
|
|
12
|
+
}> & {
|
|
13
|
+
rows: Record<string, unknown>[];
|
|
14
|
+
total: number;
|
|
15
|
+
}, Error>;
|
|
7
16
|
};
|
|
8
17
|
type SubsetFieldKeys<TSubsetKey extends string, TSubsetMapping> = TSubsetKey extends keyof TSubsetMapping ? TSubsetMapping[TSubsetKey] extends Record<string, unknown> ? string & keyof TSubsetMapping[TSubsetKey] : string : string;
|
|
9
18
|
type SubsetRow<TSubsetKey extends string, TSubsetMapping> = TSubsetKey extends keyof TSubsetMapping ? TSubsetMapping[TSubsetKey] : Record<string, unknown>;
|
|
@@ -39,6 +39,11 @@ interface SingleAsyncProps<Item> {
|
|
|
39
39
|
error?: Error;
|
|
40
40
|
onSearch: (keyword: string) => void;
|
|
41
41
|
searchDebounce?: number;
|
|
42
|
+
searchable?: boolean;
|
|
43
|
+
onOpenChange?: (open: boolean) => void;
|
|
44
|
+
onLoadMore?: () => void;
|
|
45
|
+
hasMore?: boolean;
|
|
46
|
+
isLoadingMore?: boolean;
|
|
42
47
|
}
|
|
43
48
|
interface MultiSyncProps<Item> {
|
|
44
49
|
multiple: true;
|
|
@@ -60,6 +65,11 @@ interface MultiAsyncProps<Item> {
|
|
|
60
65
|
searchDebounce?: number;
|
|
61
66
|
maxCount?: number;
|
|
62
67
|
hideSelectAll?: boolean;
|
|
68
|
+
searchable?: boolean;
|
|
69
|
+
onOpenChange?: (open: boolean) => void;
|
|
70
|
+
onLoadMore?: () => void;
|
|
71
|
+
hasMore?: boolean;
|
|
72
|
+
isLoadingMore?: boolean;
|
|
63
73
|
}
|
|
64
74
|
type SelectProps<Item> = SelectPropsBase<Item> & SelectPropsWithValueKey<Item> & (SingleSyncProps<Item> | SingleAsyncProps<Item> | MultiSyncProps<Item> | MultiAsyncProps<Item>);
|
|
65
75
|
export declare const Select: <Item>(props: SelectProps<Item> & React.RefAttributes<HTMLSelectElement>) => React.ReactElement;
|