@atlaskit/pagination 14.3.0 → 14.3.2
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/CHANGELOG.md +12 -0
- package/dist/cjs/pagination.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/pagination.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/pagination.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/internal/components/navigator.d.ts +1 -1
- package/dist/types/internal/components/page.d.ts +2 -2
- package/dist/types/internal/components/render-ellipsis.d.ts +1 -1
- package/dist/types/internal/utils/collapse-range.d.ts +2 -2
- package/dist/types-ts4.5/entry-points/types.d.ts +1 -0
- package/dist/types-ts4.5/index.d.ts +2 -0
- package/dist/types-ts4.5/internal/components/navigator.d.ts +20 -0
- package/dist/types-ts4.5/internal/components/page.d.ts +17 -0
- package/dist/types-ts4.5/internal/components/render-ellipsis.d.ts +6 -0
- package/dist/types-ts4.5/internal/constants.d.ts +1 -0
- package/dist/types-ts4.5/internal/utils/collapse-range.d.ts +10 -0
- package/dist/types-ts4.5/pagination.d.ts +5 -0
- package/dist/types-ts4.5/types.d.ts +75 -0
- package/package.json +10 -2
- package/types/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/pagination
|
|
2
2
|
|
|
3
|
+
## 14.3.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`9d00501a414`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9d00501a414) - Ensure legacy types are published for TS 4.5-4.8
|
|
8
|
+
|
|
9
|
+
## 14.3.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`41fae2c6f68`](https://bitbucket.org/atlassian/atlassian-frontend/commits/41fae2c6f68) - Upgrade Typescript from `4.5.5` to `4.9.5`
|
|
14
|
+
|
|
3
15
|
## 14.3.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/dist/cjs/pagination.js
CHANGED
|
@@ -28,7 +28,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
28
28
|
var analyticsAttributes = {
|
|
29
29
|
componentName: 'pagination',
|
|
30
30
|
packageName: "@atlaskit/pagination",
|
|
31
|
-
packageVersion: "14.3.
|
|
31
|
+
packageVersion: "14.3.2"
|
|
32
32
|
};
|
|
33
33
|
function InnerPagination(_ref, ref) {
|
|
34
34
|
var _ref$components = _ref.components,
|
package/dist/cjs/version.json
CHANGED
|
@@ -14,7 +14,7 @@ import collapseRange from './internal/utils/collapse-range';
|
|
|
14
14
|
const analyticsAttributes = {
|
|
15
15
|
componentName: 'pagination',
|
|
16
16
|
packageName: "@atlaskit/pagination",
|
|
17
|
-
packageVersion: "14.3.
|
|
17
|
+
packageVersion: "14.3.2"
|
|
18
18
|
};
|
|
19
19
|
function InnerPagination({
|
|
20
20
|
components = emptyObject,
|
package/dist/es2019/version.json
CHANGED
package/dist/esm/pagination.js
CHANGED
|
@@ -18,7 +18,7 @@ import collapseRange from './internal/utils/collapse-range';
|
|
|
18
18
|
var analyticsAttributes = {
|
|
19
19
|
componentName: 'pagination',
|
|
20
20
|
packageName: "@atlaskit/pagination",
|
|
21
|
-
packageVersion: "14.3.
|
|
21
|
+
packageVersion: "14.3.2"
|
|
22
22
|
};
|
|
23
23
|
function InnerPagination(_ref, ref) {
|
|
24
24
|
var _ref$components = _ref.components,
|
package/dist/esm/version.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ButtonProps } from '@atlaskit/button/standard-button';
|
|
3
3
|
import type { Appearance } from '@atlaskit/button/types';
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
type Diff<T, U> = T extends U ? never : T;
|
|
5
|
+
type PageProps = Diff<ButtonProps, {
|
|
6
6
|
appearance?: Appearance;
|
|
7
7
|
autoFocus: boolean;
|
|
8
8
|
isDisabled: boolean;
|
|
@@ -5,6 +5,6 @@ declare const collapseRange: <T>(pages: T[], current: number, { max, ellipsis, t
|
|
|
5
5
|
key: string;
|
|
6
6
|
testId: string;
|
|
7
7
|
}) => ReactElement;
|
|
8
|
-
transform: (page: T, index: number, testId?: string
|
|
9
|
-
}, testId?: string
|
|
8
|
+
transform: (page: T, index: number, testId?: string) => ReactElement;
|
|
9
|
+
}, testId?: string) => ReactElement[];
|
|
10
10
|
export default collapseRange;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { PaginationPropTypes } from '../types';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React, { ReactElement, SyntheticEvent } from 'react';
|
|
2
|
+
export type NavigatorProps<T> = {
|
|
3
|
+
/**
|
|
4
|
+
* This will be passed in as aria-label to button. This is what screen reader will read
|
|
5
|
+
*/
|
|
6
|
+
'aria-label'?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Is the navigator disabled
|
|
9
|
+
*/
|
|
10
|
+
isDisabled?: boolean;
|
|
11
|
+
iconBefore: ReactElement;
|
|
12
|
+
pages: T[];
|
|
13
|
+
testId?: string;
|
|
14
|
+
/**
|
|
15
|
+
* This function is called with the when user clicks on navigator
|
|
16
|
+
*/
|
|
17
|
+
onClick?: (event: SyntheticEvent) => void;
|
|
18
|
+
component?: React.ElementType<any>;
|
|
19
|
+
};
|
|
20
|
+
export default function Navigator<T>(props: NavigatorProps<T>): JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ButtonProps } from '@atlaskit/button/standard-button';
|
|
3
|
+
import type { Appearance } from '@atlaskit/button/types';
|
|
4
|
+
type Diff<T, U> = T extends U ? never : T;
|
|
5
|
+
type PageProps = Diff<ButtonProps, {
|
|
6
|
+
appearance?: Appearance;
|
|
7
|
+
autoFocus: boolean;
|
|
8
|
+
isDisabled: boolean;
|
|
9
|
+
isLoading: boolean;
|
|
10
|
+
spacing: 'compact' | 'default' | 'none';
|
|
11
|
+
shouldFitContainer: boolean;
|
|
12
|
+
type: 'button' | 'submit';
|
|
13
|
+
}> & {
|
|
14
|
+
page?: any;
|
|
15
|
+
};
|
|
16
|
+
export default function Page(props: PageProps): JSX.Element;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const emptyObject: {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
declare const collapseRange: <T>(pages: T[], current: number, { max, ellipsis, transform, }: {
|
|
3
|
+
max: number;
|
|
4
|
+
ellipsis: (arg: {
|
|
5
|
+
key: string;
|
|
6
|
+
testId: string;
|
|
7
|
+
}) => ReactElement;
|
|
8
|
+
transform: (page: T, index: number, testId?: string) => ReactElement;
|
|
9
|
+
}, testId?: string) => ReactElement[];
|
|
10
|
+
export default collapseRange;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PaginationPropTypes } from './types';
|
|
3
|
+
declare function InnerPagination<T>({ components, defaultSelectedIndex, selectedIndex, label, previousLabel, nextLabel, style, max, onChange, pages, getPageLabel, renderEllipsis, analyticsContext, testId, }: PaginationPropTypes<T>, ref: React.Ref<HTMLDivElement>): JSX.Element;
|
|
4
|
+
declare const _default: typeof InnerPagination;
|
|
5
|
+
export default _default;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { CSSProperties, ReactElement, SyntheticEvent } from 'react';
|
|
2
|
+
import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
3
|
+
export interface PaginationPropTypes<T = unknown> {
|
|
4
|
+
/**
|
|
5
|
+
* Replace the built-in Page, Previous, Next and/ or Ellipsis component
|
|
6
|
+
*/
|
|
7
|
+
components?: {
|
|
8
|
+
Page?: React.ElementType;
|
|
9
|
+
Previous?: React.ElementType;
|
|
10
|
+
Next?: React.ElementType;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Index of the page to be selected by default
|
|
14
|
+
*/
|
|
15
|
+
defaultSelectedIndex?: number;
|
|
16
|
+
/**
|
|
17
|
+
* Helper function to get text displayed on the page button. It is helpful in scenarios when page the page passed in is an object
|
|
18
|
+
*/
|
|
19
|
+
getPageLabel?: (page: T, pageIndex: number) => number | string;
|
|
20
|
+
/**
|
|
21
|
+
* The aria-label for the pagination wrapper
|
|
22
|
+
*/
|
|
23
|
+
label?: string;
|
|
24
|
+
/**
|
|
25
|
+
* The aria-label for the next button
|
|
26
|
+
*/
|
|
27
|
+
nextLabel?: string;
|
|
28
|
+
/**
|
|
29
|
+
* The aria-label for the previous button
|
|
30
|
+
*/
|
|
31
|
+
previousLabel?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Style to spread on the container element
|
|
34
|
+
*/
|
|
35
|
+
style?: CSSProperties;
|
|
36
|
+
/**
|
|
37
|
+
* Maximum number of pages to be displayed in the pagination
|
|
38
|
+
*/
|
|
39
|
+
max?: number;
|
|
40
|
+
/**
|
|
41
|
+
* The onChange handler which is called when the page is changed
|
|
42
|
+
*/
|
|
43
|
+
onChange?: (event: SyntheticEvent, page: T, analyticsEvent?: UIAnalyticsEvent) => void;
|
|
44
|
+
/**
|
|
45
|
+
* Array of the pages to display
|
|
46
|
+
*/
|
|
47
|
+
pages: T[];
|
|
48
|
+
/**
|
|
49
|
+
* Index of the selected page. This will make this pagination controlled
|
|
50
|
+
*/
|
|
51
|
+
selectedIndex?: number;
|
|
52
|
+
/**
|
|
53
|
+
* The react Node returned from the function is rendered instead of the default ellipsis node
|
|
54
|
+
*/
|
|
55
|
+
renderEllipsis?: (arg: {
|
|
56
|
+
key: string;
|
|
57
|
+
}) => ReactElement;
|
|
58
|
+
/**
|
|
59
|
+
* Additional information to be included in the `context` of analytics events
|
|
60
|
+
*/
|
|
61
|
+
analyticsContext?: Record<string, any>;
|
|
62
|
+
/**
|
|
63
|
+
* A `testId` prop is provided for specified elements,
|
|
64
|
+
* which is a unique string that appears as a data attribute `data-testid`
|
|
65
|
+
* in the rendered code, serving as a hook for automated tests.
|
|
66
|
+
*
|
|
67
|
+
* Will set data-testid on these elements when defined:
|
|
68
|
+
* - Pagination nav wrapper - {testId}
|
|
69
|
+
* - Page - {testId}--page-{page index}
|
|
70
|
+
* - Current page - {testId}--current-page-{page index}
|
|
71
|
+
* - Left navigator - {testId}--left-navigator
|
|
72
|
+
* - Right navigator - {testId}--right-navigator
|
|
73
|
+
*/
|
|
74
|
+
testId?: string;
|
|
75
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/pagination",
|
|
3
|
-
"version": "14.3.
|
|
3
|
+
"version": "14.3.2",
|
|
4
4
|
"description": "Pagination allows you to divide large amounts of content into smaller chunks across multiple pages.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -13,6 +13,14 @@
|
|
|
13
13
|
"module": "dist/esm/index.js",
|
|
14
14
|
"module:es2019": "dist/es2019/index.js",
|
|
15
15
|
"types": "dist/types/index.d.ts",
|
|
16
|
+
"typesVersions": {
|
|
17
|
+
">=4.5 <4.9": {
|
|
18
|
+
"*": [
|
|
19
|
+
"dist/types-ts4.5/*",
|
|
20
|
+
"dist/types-ts4.5/index.d.ts"
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
},
|
|
16
24
|
"sideEffects": false,
|
|
17
25
|
"atlaskit:src": "src/index.tsx",
|
|
18
26
|
"af:exports": {
|
|
@@ -60,7 +68,7 @@
|
|
|
60
68
|
"react-router-dom": "^4.2.2",
|
|
61
69
|
"storybook-addon-performance": "^0.16.0",
|
|
62
70
|
"tiny-invariant": "^1.2.0",
|
|
63
|
-
"typescript": "4.
|
|
71
|
+
"typescript": "~4.9.5",
|
|
64
72
|
"wait-for-expect": "^1.2.0"
|
|
65
73
|
},
|
|
66
74
|
"techstack": {
|
package/types/package.json
CHANGED