@trackunit/react-components 0.0.204 → 0.0.206
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/index.js +28 -22
- package/package.json +2 -2
- package/src/components/Pagination/Pagination.d.ts +5 -1
package/index.js
CHANGED
|
@@ -1739,8 +1739,11 @@ const Popover = ({
|
|
|
1739
1739
|
return jsxs(Fragment, {
|
|
1740
1740
|
children: [cloneElement(children, getReferenceProps(Object.assign({
|
|
1741
1741
|
ref
|
|
1742
|
-
}, children.props))), jsx(FloatingPortal, {
|
|
1742
|
+
}, children.props))), jsx(FloatingPortal, Object.assign({
|
|
1743
|
+
id: "tu-floating-ui"
|
|
1744
|
+
}, {
|
|
1743
1745
|
children: open && jsx(FloatingFocusManager, Object.assign({
|
|
1746
|
+
guards: false,
|
|
1744
1747
|
context: context,
|
|
1745
1748
|
modal: false,
|
|
1746
1749
|
order: ["reference", "content"],
|
|
@@ -1763,7 +1766,7 @@ const Popover = ({
|
|
|
1763
1766
|
})
|
|
1764
1767
|
}))
|
|
1765
1768
|
}))
|
|
1766
|
-
})]
|
|
1769
|
+
}))]
|
|
1767
1770
|
});
|
|
1768
1771
|
};
|
|
1769
1772
|
// Utility to merge refs — Heavily inspired by https://github.com/gregberge/react-merge-refs
|
|
@@ -3057,7 +3060,8 @@ const Pagination = ({
|
|
|
3057
3060
|
dataTestId,
|
|
3058
3061
|
logPageChange,
|
|
3059
3062
|
getTranslatedCount,
|
|
3060
|
-
getTranslatedPage
|
|
3063
|
+
getTranslatedPage,
|
|
3064
|
+
cursorBase
|
|
3061
3065
|
}) => {
|
|
3062
3066
|
const [page, setPage] = React.useState(pageIndex);
|
|
3063
3067
|
const [pageInputValue, setPageInputValue] = React.useState(String(pageIndex !== undefined ? pageIndex + 1 : 1));
|
|
@@ -3145,7 +3149,7 @@ const Pagination = ({
|
|
|
3145
3149
|
}, {
|
|
3146
3150
|
children: [jsx(IconButton, {
|
|
3147
3151
|
onClick: () => handlePageChange("prev"),
|
|
3148
|
-
disabled: page !== undefined && page <= 0,
|
|
3152
|
+
disabled: cursorBase ? false : page !== undefined && page <= 0,
|
|
3149
3153
|
"data-testid": "prev-page",
|
|
3150
3154
|
icon: jsx(Icon$1, {
|
|
3151
3155
|
name: "ChevronLeftIcon",
|
|
@@ -3154,25 +3158,27 @@ const Pagination = ({
|
|
|
3154
3158
|
size: "small",
|
|
3155
3159
|
color: "secondary",
|
|
3156
3160
|
variant: "transparent"
|
|
3157
|
-
}),
|
|
3158
|
-
children:
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3161
|
+
}), !cursorBase && jsxs(Fragment, {
|
|
3162
|
+
children: [jsx(Text$1, {
|
|
3163
|
+
children: getTranslatedPage()
|
|
3164
|
+
}), jsx(PageInput, {
|
|
3165
|
+
type: "number",
|
|
3166
|
+
min: 1,
|
|
3167
|
+
// max={amountOfPages}
|
|
3168
|
+
value: pageInputValue,
|
|
3169
|
+
onFocus: handleOnFocus,
|
|
3170
|
+
onBlur: handleOnBlur,
|
|
3171
|
+
onChange: handleOnChange,
|
|
3172
|
+
onKeyPress: handleOnKeyPress,
|
|
3173
|
+
"data-testid": "page-input"
|
|
3174
|
+
}), jsx(TextStyled, Object.assign({
|
|
3175
|
+
dataTestId: "page-count"
|
|
3176
|
+
}, {
|
|
3177
|
+
children: pageCount !== null && pageCount !== undefined && getTranslatedCount(pageCount)
|
|
3178
|
+
}))]
|
|
3179
|
+
}), jsx(IconButton, {
|
|
3174
3180
|
onClick: () => handlePageChange("next"),
|
|
3175
|
-
disabled: page !== undefined && pageCount !== undefined && pageCount !== null && page >= pageCount - 1,
|
|
3181
|
+
disabled: cursorBase ? false : page !== undefined && pageCount !== undefined && pageCount !== null && page >= pageCount - 1,
|
|
3176
3182
|
"data-testid": "next-page",
|
|
3177
3183
|
icon: jsx(Icon$1, {
|
|
3178
3184
|
name: "ChevronRightIcon",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.206",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"dependencies": {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"@trackunit/ui-icons": "0.0.54",
|
|
19
19
|
"react-browser-hooks": "2.2.4",
|
|
20
20
|
"react-useportal": "1.0.17",
|
|
21
|
-
"@floating-ui/react-dom-interactions": "0.
|
|
21
|
+
"@floating-ui/react-dom-interactions": "0.13.3",
|
|
22
22
|
"react-router-dom": "6.4.3",
|
|
23
23
|
"react-helmet": "6.1.0",
|
|
24
24
|
"react-select": "5.7.0",
|
|
@@ -60,6 +60,10 @@ export interface IPaginationProps {
|
|
|
60
60
|
* An helper to get translation for page.
|
|
61
61
|
*/
|
|
62
62
|
getTranslatedPage: () => string;
|
|
63
|
+
/**
|
|
64
|
+
* An flag to disable jumping to particular page by text input, could be used for cursor based pagination
|
|
65
|
+
*/
|
|
66
|
+
cursorBase?: boolean;
|
|
63
67
|
}
|
|
64
68
|
export declare type EventProperties = Record<string, string | number | boolean | null | undefined | (string | number)[]>;
|
|
65
69
|
/**
|
|
@@ -68,4 +72,4 @@ export declare type EventProperties = Record<string, string | number | boolean |
|
|
|
68
72
|
* @param {IPaginationProps} props - The props for the Pagination component
|
|
69
73
|
* @returns {JSX.Element} Pagination component
|
|
70
74
|
*/
|
|
71
|
-
export declare const Pagination: ({ gotoPage, previousPage, nextPage, pageCount, pageIndex, canPreviousPage, canNextPage, loading, eventName, parentName, className, dataTestId, logPageChange, getTranslatedCount, getTranslatedPage, }: IPaginationProps) => JSX.Element;
|
|
75
|
+
export declare const Pagination: ({ gotoPage, previousPage, nextPage, pageCount, pageIndex, canPreviousPage, canNextPage, loading, eventName, parentName, className, dataTestId, logPageChange, getTranslatedCount, getTranslatedPage, cursorBase, }: IPaginationProps) => JSX.Element;
|