@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.
@@ -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 {};
package/dist/index.d.ts CHANGED
@@ -60,6 +60,10 @@ type ButtonProps = MUIGlobalOmit<Omit<ButtonProps$1, 'size' | 'color'>, {
60
60
  color?: 'critical' | ButtonProps$1['color'];
61
61
  component?: ButtonProps$1['LinkComponent'];
62
62
  to?: ButtonProps$1['href'];
63
+ /**
64
+ * Determines whether to open the link in the same tab for external links.
65
+ */
66
+ openInSameTab?: boolean;
63
67
  }>;
64
68
  /**
65
69
  * ### Routing Libraries
@@ -83,6 +87,10 @@ declare const Button: React__default.ForwardRefExoticComponent<Omit<{
83
87
  color?: 'critical' | ButtonProps$1['color'];
84
88
  component?: ButtonProps$1['LinkComponent'];
85
89
  to?: ButtonProps$1['href'];
90
+ /**
91
+ * Determines whether to open the link in the same tab for external links.
92
+ */
93
+ openInSameTab?: boolean | undefined;
86
94
  } & Omit<Omit<ButtonProps$1<"button", {}>, "color" | "size">, "classes" | "tabIndex" | "action" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "TouchRippleProps" | "touchRippleRef" | "disableElevation" | "disableFocusRipple">, "ref"> & React__default.RefAttributes<unknown>>;
87
95
 
88
96
  type TypographyProps = Omit<TypographyProps$1, 'variant'> & {
@@ -5015,6 +5023,40 @@ declare const useRemotePagination: (fetchingHook: ({ params }: {
5015
5023
  [paramName: string]: string;
5016
5024
  } | undefined) => UseRemotePaginationResponse;
5017
5025
 
5026
+ interface CursorPaginatedResponse<T> {
5027
+ content: T[];
5028
+ nextCursor: number | null;
5029
+ prevCursor: number | null;
5030
+ }
5031
+ type UseCursorPaginationResponse = {
5032
+ pageSize: number;
5033
+ page: number;
5034
+ data: any[];
5035
+ isLoading: boolean;
5036
+ refetch: () => Promise<any>;
5037
+ isRefetching: boolean;
5038
+ setPage: (page: number) => void;
5039
+ setPageSize: (pageSize: number) => void;
5040
+ handlePageChange: (page: number, pageSize: number) => void;
5041
+ cursor: number;
5042
+ setCursor: (cursor: number) => void;
5043
+ };
5044
+ /**
5045
+ * Returns cursor-based pagination data and and helper functions.
5046
+ *
5047
+ * Documentation: https://up-components.up42.com/?path=/docs/utils--docs#usecursorpagination
5048
+ */
5049
+ declare const useCursorPagination: (fetchingHook: ({ params }: {
5050
+ params: string;
5051
+ }) => {
5052
+ data: CursorPaginatedResponse<any> | undefined;
5053
+ isLoading: boolean;
5054
+ refetch: () => Promise<any>;
5055
+ isRefetching: boolean;
5056
+ }, searchParams?: {
5057
+ [paramName: string]: string;
5058
+ } | undefined) => UseCursorPaginationResponse;
5059
+
5018
5060
  /**
5019
5061
  * useDebounce is a generic React Hook that returns a debounced version of a given value.
5020
5062
  * @param {T} value - The value to debounce.
@@ -5076,4 +5118,4 @@ type ContextState = {
5076
5118
  */
5077
5119
  declare const useAlert: () => ContextState;
5078
5120
 
5079
- export { Alert, type AlertProps, Avatar, type AvatarProps, Badge, type BadgeProps, Banner, type BannerProps, Button, type ButtonProps, Checkbox, type CheckboxProps, CodeInline, type CodeInlineProps, CodeSnippet, type CodeSnippetItemProps, type CodeSnippetProps, ContactBox, type ContactBoxProps, ControlButton, type ControlButtonProps, CopyButton, type CopyButtonProps, type CreateAlertProps, type CreateSnackbarProps, DataGrid, type DataGridProps, type DatePickerDateType, DateTime, type DateTimeProps, Divider, type DividerProps, DocumentationPopover, type DocumentationPopoverProps, EmptyState, type EmptyStateProps, FormCheckbox, type FormCheckboxProps, FormDatePicker, type FormDatePickerProps, FormDateRangePicker, type FormDateRangePickerProps, FormInput, type FormInputProps, FormRadio, type FormRadioProps, FormSelect, type FormSelectProps, FormSwitch, type FormSwitchProps, GridContainer, type GridContainerProps, GridItem, type GridItemProps, Icon, type IconProps, Illustration, type IllustrationProps, InfoCard, type InfoCardProps, InfoModal, type InfoModalProps, InfoPopover, type InfoPopoverProps, Input, type InputProps, Link, type LinkProps, Loading, type LoadingProps, NotFound, type NotFoundProps, PageContainer, type PageContainerProps, PageHeader, type PageHeaderProps, type PaginatedResponse, Radio, type RadioProps, Select, type SelectProps, Slider, type SliderProps, Switch, type SwitchProps, Tab, TabGroup, type TabGroupProps, type TabProps, Table, TableBody, type TableBodyProps, TableCell, type TableCellProps, TableContainer, type TableContainerProps, TableFooter, type TableFooterProps, TableHead, type TableHeadProps, TablePagination, type TablePaginationProps, type TableProps, TableRow, type TableRowProps, TableSortLabel, type TableSortLabelProps, Tabs, type TabsProps, Tag, type TagProps, Typography, type TypographyProps, UpComponentsProvider, capitalize, copyToClipboard, formatDate, formatFileSize, formatNumber, theme, useAlert, useDebounce, useQueryParams, useRemotePagination };
5121
+ export { Alert, type AlertProps, Avatar, type AvatarProps, Badge, type BadgeProps, Banner, type BannerProps, Button, type ButtonProps, Checkbox, type CheckboxProps, CodeInline, type CodeInlineProps, CodeSnippet, type CodeSnippetItemProps, type CodeSnippetProps, ContactBox, type ContactBoxProps, ControlButton, type ControlButtonProps, CopyButton, type CopyButtonProps, type CreateAlertProps, type CreateSnackbarProps, type CursorPaginatedResponse, DataGrid, type DataGridProps, type DatePickerDateType, DateTime, type DateTimeProps, Divider, type DividerProps, DocumentationPopover, type DocumentationPopoverProps, EmptyState, type EmptyStateProps, FormCheckbox, type FormCheckboxProps, FormDatePicker, type FormDatePickerProps, FormDateRangePicker, type FormDateRangePickerProps, FormInput, type FormInputProps, FormRadio, type FormRadioProps, FormSelect, type FormSelectProps, FormSwitch, type FormSwitchProps, GridContainer, type GridContainerProps, GridItem, type GridItemProps, Icon, type IconProps, Illustration, type IllustrationProps, InfoCard, type InfoCardProps, InfoModal, type InfoModalProps, InfoPopover, type InfoPopoverProps, Input, type InputProps, Link, type LinkProps, Loading, type LoadingProps, NotFound, type NotFoundProps, PageContainer, type PageContainerProps, PageHeader, type PageHeaderProps, type PaginatedResponse, Radio, type RadioProps, Select, type SelectProps, Slider, type SliderProps, Switch, type SwitchProps, Tab, TabGroup, type TabGroupProps, type TabProps, Table, TableBody, type TableBodyProps, TableCell, type TableCellProps, TableContainer, type TableContainerProps, TableFooter, type TableFooterProps, TableHead, type TableHeadProps, TablePagination, type TablePaginationProps, type TableProps, TableRow, type TableRowProps, TableSortLabel, type TableSortLabelProps, Tabs, type TabsProps, Tag, type TagProps, Typography, type TypographyProps, UpComponentsProvider, capitalize, copyToClipboard, formatDate, formatFileSize, formatNumber, theme, useAlert, useCursorPagination, useDebounce, useQueryParams, useRemotePagination };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@up42/up-components",
3
- "version": "3.0.2",
3
+ "version": "3.1.0",
4
4
  "description": "UP42 Component Library",
5
5
  "author": "Axel Fuhrmann axel.fuhrmann@up42.com",
6
6
  "license": "ISC",