@trackunit/react-components 0.0.204 → 0.0.205

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 CHANGED
@@ -3057,7 +3057,8 @@ const Pagination = ({
3057
3057
  dataTestId,
3058
3058
  logPageChange,
3059
3059
  getTranslatedCount,
3060
- getTranslatedPage
3060
+ getTranslatedPage,
3061
+ cursorBase
3061
3062
  }) => {
3062
3063
  const [page, setPage] = React.useState(pageIndex);
3063
3064
  const [pageInputValue, setPageInputValue] = React.useState(String(pageIndex !== undefined ? pageIndex + 1 : 1));
@@ -3145,7 +3146,7 @@ const Pagination = ({
3145
3146
  }, {
3146
3147
  children: [jsx(IconButton, {
3147
3148
  onClick: () => handlePageChange("prev"),
3148
- disabled: page !== undefined && page <= 0,
3149
+ disabled: cursorBase ? false : page !== undefined && page <= 0,
3149
3150
  "data-testid": "prev-page",
3150
3151
  icon: jsx(Icon$1, {
3151
3152
  name: "ChevronLeftIcon",
@@ -3154,25 +3155,27 @@ const Pagination = ({
3154
3155
  size: "small",
3155
3156
  color: "secondary",
3156
3157
  variant: "transparent"
3157
- }), jsx(Text$1, {
3158
- children: getTranslatedPage()
3159
- }), jsx(PageInput, {
3160
- type: "number",
3161
- min: 1,
3162
- // max={amountOfPages}
3163
- value: pageInputValue,
3164
- onFocus: handleOnFocus,
3165
- onBlur: handleOnBlur,
3166
- onChange: handleOnChange,
3167
- onKeyPress: handleOnKeyPress,
3168
- "data-testid": "page-input"
3169
- }), jsx(TextStyled, Object.assign({
3170
- dataTestId: "page-count"
3171
- }, {
3172
- children: pageCount !== null && pageCount !== undefined && getTranslatedCount(pageCount)
3173
- })), jsx(IconButton, {
3158
+ }), !cursorBase && jsxs(Fragment, {
3159
+ children: [jsx(Text$1, {
3160
+ children: getTranslatedPage()
3161
+ }), jsx(PageInput, {
3162
+ type: "number",
3163
+ min: 1,
3164
+ // max={amountOfPages}
3165
+ value: pageInputValue,
3166
+ onFocus: handleOnFocus,
3167
+ onBlur: handleOnBlur,
3168
+ onChange: handleOnChange,
3169
+ onKeyPress: handleOnKeyPress,
3170
+ "data-testid": "page-input"
3171
+ }), jsx(TextStyled, Object.assign({
3172
+ dataTestId: "page-count"
3173
+ }, {
3174
+ children: pageCount !== null && pageCount !== undefined && getTranslatedCount(pageCount)
3175
+ }))]
3176
+ }), jsx(IconButton, {
3174
3177
  onClick: () => handlePageChange("next"),
3175
- disabled: page !== undefined && pageCount !== undefined && pageCount !== null && page >= pageCount - 1,
3178
+ disabled: cursorBase ? false : page !== undefined && pageCount !== undefined && pageCount !== null && page >= pageCount - 1,
3176
3179
  "data-testid": "next-page",
3177
3180
  icon: jsx(Icon$1, {
3178
3181
  name: "ChevronRightIcon",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-components",
3
- "version": "0.0.204",
3
+ "version": "0.0.205",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "dependencies": {
@@ -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;