@up42/up-components 3.0.2 → 3.1.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/cjs/index.js +2 -2
- package/dist/cjs/types/components/Button/Button.d.ts +8 -0
- package/dist/cjs/types/index.d.ts +1 -0
- package/dist/cjs/types/utils/hooks/useCursorPagination.d.ts +34 -0
- package/dist/cjs/types/utils/hooks/useCursorPagination.test.d.ts +1 -0
- package/dist/esm/index.js +2 -2
- package/dist/esm/types/components/Button/Button.d.ts +8 -0
- package/dist/esm/types/index.d.ts +1 -0
- package/dist/esm/types/utils/hooks/useCursorPagination.d.ts +34 -0
- package/dist/esm/types/utils/hooks/useCursorPagination.test.d.ts +1 -0
- package/dist/index.d.ts +43 -1
- package/package.json +1 -1
|
@@ -7,6 +7,10 @@ export type ButtonProps = MUIGlobalOmit<Omit<MUIButtonProps, 'size' | 'color'>,
|
|
|
7
7
|
color?: 'critical' | MUIButtonProps['color'];
|
|
8
8
|
component?: MUIButtonProps['LinkComponent'];
|
|
9
9
|
to?: MUIButtonProps['href'];
|
|
10
|
+
/**
|
|
11
|
+
* Determines whether to open the link in the same tab for external links.
|
|
12
|
+
*/
|
|
13
|
+
openInSameTab?: boolean;
|
|
10
14
|
}>;
|
|
11
15
|
/**
|
|
12
16
|
* ### Routing Libraries
|
|
@@ -30,4 +34,8 @@ export declare const Button: React.ForwardRefExoticComponent<Omit<{
|
|
|
30
34
|
color?: 'critical' | MUIButtonProps['color'];
|
|
31
35
|
component?: MUIButtonProps['LinkComponent'];
|
|
32
36
|
to?: MUIButtonProps['href'];
|
|
37
|
+
/**
|
|
38
|
+
* Determines whether to open the link in the same tab for external links.
|
|
39
|
+
*/
|
|
40
|
+
openInSameTab?: boolean | undefined;
|
|
33
41
|
} & Omit<Omit<MUIButtonProps<"button", {}>, "color" | "size">, "classes" | "tabIndex" | "action" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "TouchRippleProps" | "touchRippleRef" | "disableElevation" | "disableFocusRipple">, "ref"> & React.RefAttributes<unknown>>;
|
|
@@ -54,5 +54,6 @@ export { formatDate } from './utils/helpers/formatDate';
|
|
|
54
54
|
export { formatFileSize } from './utils/helpers/formatFileSize';
|
|
55
55
|
export { useQueryParams } from './utils/hooks/useQueryParams';
|
|
56
56
|
export { useRemotePagination, type PaginatedResponse } from './utils/hooks/useRemotePagination';
|
|
57
|
+
export { useCursorPagination, type CursorPaginatedResponse } from './utils/hooks/useCursorPagination';
|
|
57
58
|
export { useDebounce } from './utils/hooks/useDebounce';
|
|
58
59
|
export { useAlert, type CreateAlertProps, type CreateSnackbarProps, } from './global/providers/AlertProvider/AlertProvider';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export interface CursorPaginatedResponse<T> {
|
|
2
|
+
content: T[];
|
|
3
|
+
nextCursor: number | null;
|
|
4
|
+
prevCursor: number | null;
|
|
5
|
+
}
|
|
6
|
+
type UseCursorPaginationResponse = {
|
|
7
|
+
pageSize: number;
|
|
8
|
+
page: number;
|
|
9
|
+
data: any[];
|
|
10
|
+
isLoading: boolean;
|
|
11
|
+
refetch: () => Promise<any>;
|
|
12
|
+
isRefetching: boolean;
|
|
13
|
+
setPage: (page: number) => void;
|
|
14
|
+
setPageSize: (pageSize: number) => void;
|
|
15
|
+
handlePageChange: (page: number, pageSize: number) => void;
|
|
16
|
+
cursor: number;
|
|
17
|
+
setCursor: (cursor: number) => void;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Returns cursor-based pagination data and and helper functions.
|
|
21
|
+
*
|
|
22
|
+
* Documentation: https://up-components.up42.com/?path=/docs/utils--docs#usecursorpagination
|
|
23
|
+
*/
|
|
24
|
+
export declare const useCursorPagination: (fetchingHook: ({ params }: {
|
|
25
|
+
params: string;
|
|
26
|
+
}) => {
|
|
27
|
+
data: CursorPaginatedResponse<any> | undefined;
|
|
28
|
+
isLoading: boolean;
|
|
29
|
+
refetch: () => Promise<any>;
|
|
30
|
+
isRefetching: boolean;
|
|
31
|
+
}, searchParams?: {
|
|
32
|
+
[paramName: string]: string;
|
|
33
|
+
} | undefined) => UseCursorPaginationResponse;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|