@atlaskit/pagination 14.1.8 → 14.2.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.
Files changed (39) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/codemods/{14.0.0-lite-mode.ts → 14.0.0-lite-mode.tsx} +0 -0
  3. package/codemods/__tests__/{14.0.0-lite-mode.ts → 14.0.0-lite-mode.tsx} +0 -0
  4. package/codemods/__tests__/{flatten-i18n-props.ts → flatten-i18n-props.tsx} +0 -0
  5. package/codemods/__tests__/{remove-collapse-range.ts → remove-collapse-range.tsx} +0 -0
  6. package/codemods/__tests__/{remove-i18n-props.ts → remove-i18n-props.tsx} +0 -0
  7. package/codemods/__tests__/{rename-pagination-prop-types.ts → rename-pagination-prop-types.tsx} +0 -0
  8. package/codemods/__tests__/{rename-prev-next-label.ts → rename-prev-next-label.tsx} +0 -0
  9. package/codemods/migrations/{flatten-i18n-props.ts → flatten-i18n-props.tsx} +0 -0
  10. package/codemods/migrations/{remove-collapase-range.ts → remove-collapase-range.tsx} +0 -0
  11. package/codemods/migrations/{remove-i18n-props.ts → remove-i18n-props.tsx} +0 -0
  12. package/codemods/migrations/{rename-inner-styles-props.ts → rename-inner-styles-props.tsx} +0 -0
  13. package/codemods/migrations/{rename-pagination-prop-types.ts → rename-pagination-prop-types.tsx} +0 -0
  14. package/codemods/migrations/{rename-prev-next-label.ts → rename-prev-next-label.tsx} +0 -0
  15. package/dist/cjs/internal/components/navigator.js +4 -3
  16. package/dist/cjs/internal/components/page.js +1 -0
  17. package/dist/cjs/internal/components/render-ellipsis.js +3 -3
  18. package/dist/cjs/internal/utils/collapse-range.js +2 -0
  19. package/dist/cjs/pagination.js +9 -9
  20. package/dist/cjs/version.json +1 -1
  21. package/dist/es2019/internal/components/navigator.js +3 -2
  22. package/dist/es2019/internal/components/page.js +1 -0
  23. package/dist/es2019/internal/components/render-ellipsis.js +1 -1
  24. package/dist/es2019/internal/utils/collapse-range.js +2 -1
  25. package/dist/es2019/pagination.js +2 -2
  26. package/dist/es2019/version.json +1 -1
  27. package/dist/esm/internal/components/navigator.js +3 -2
  28. package/dist/esm/internal/components/page.js +1 -0
  29. package/dist/esm/internal/components/render-ellipsis.js +1 -1
  30. package/dist/esm/internal/utils/collapse-range.js +2 -1
  31. package/dist/esm/pagination.js +2 -2
  32. package/dist/esm/version.json +1 -1
  33. package/dist/types/internal/components/navigator.d.ts +12 -5
  34. package/dist/types/internal/components/page.d.ts +2 -2
  35. package/dist/types/internal/components/render-ellipsis.d.ts +2 -2
  36. package/dist/types/pagination.d.ts +2 -1
  37. package/dist/types/types.d.ts +49 -23
  38. package/package.json +15 -13
  39. package/report.api.md +87 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @atlaskit/pagination
2
2
 
3
+ ## 14.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`2afcf534bad`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2afcf534bad) - Updates `@emotion/core` to `@emotion/react`; v10 to v11. There is no expected behavior change.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+
13
+ ## 14.1.10
14
+
15
+ ### Patch Changes
16
+
17
+ - [`8d4228767b0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8d4228767b0) - Upgrade Typescript from `4.2.4` to `4.3.5`.
18
+
19
+ ## 14.1.9
20
+
21
+ ### Patch Changes
22
+
23
+ - [`ac051e856a6`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ac051e856a6) - Internal code change turning on new linting rules.
24
+ - Updated dependencies
25
+
3
26
  ## 14.1.8
4
27
 
5
28
  ### Patch Changes
@@ -11,7 +11,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
11
11
 
12
12
  var _react = _interopRequireDefault(require("react"));
13
13
 
14
- var _core = require("@emotion/core");
14
+ var _react2 = require("@emotion/react");
15
15
 
16
16
  var _standardButton = _interopRequireDefault(require("@atlaskit/button/standard-button"));
17
17
 
@@ -19,13 +19,14 @@ var _constants = require("@atlaskit/theme/constants");
19
19
 
20
20
  /** @jsx jsx */
21
21
  var gridSize = (0, _constants.gridSize)();
22
- var navigatorStyles = (0, _core.css)({
22
+ var navigatorStyles = (0, _react2.css)({
23
23
  paddingRight: gridSize / 2,
24
24
  paddingLeft: gridSize / 2
25
25
  });
26
26
 
27
27
  function Navigator(props) {
28
- return (0, _core.jsx)(_standardButton.default, (0, _extends2.default)({}, props, {
28
+ return (0, _react2.jsx)(_standardButton.default // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
29
+ , (0, _extends2.default)({}, props, {
29
30
  appearance: "subtle",
30
31
  spacing: "none",
31
32
  css: navigatorStyles
@@ -14,6 +14,7 @@ var _react = _interopRequireDefault(require("react"));
14
14
  var _standardButton = _interopRequireDefault(require("@atlaskit/button/standard-button"));
15
15
 
16
16
  function Page(props) {
17
+ // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
17
18
  return /*#__PURE__*/_react.default.createElement(_standardButton.default, (0, _extends2.default)({}, props, {
18
19
  appearance: "subtle"
19
20
  }));
@@ -5,10 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = renderEllipsis;
7
7
 
8
- var _core = require("@emotion/core");
8
+ var _react = require("@emotion/react");
9
9
 
10
10
  /** @jsx jsx */
11
- var ellipsisStyles = (0, _core.css)({
11
+ var ellipsisStyles = (0, _react.css)({
12
12
  display: 'inline-flex',
13
13
  padding: '0 8px',
14
14
  alignItems: 'center',
@@ -17,7 +17,7 @@ var ellipsisStyles = (0, _core.css)({
17
17
 
18
18
  function renderEllipsis(_ref) {
19
19
  var key = _ref.key;
20
- return (0, _core.jsx)("span", {
20
+ return (0, _react.jsx)("span", {
21
21
  key: key,
22
22
  css: ellipsisStyles
23
23
  }, "...");
@@ -11,6 +11,8 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
11
11
 
12
12
  var _memoizeOne = _interopRequireDefault(require("memoize-one"));
13
13
 
14
+ // TODO: comma needed after generic declaration below, or the .tsx file thinks
15
+ // it is a JSX element. Tidy up in a future refactor.
14
16
  var collapseRange = function collapseRange(pages, current, _ref, testId) {
15
17
  var max = _ref.max,
16
18
  ellipsis = _ref.ellipsis,
@@ -13,7 +13,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
13
13
 
14
14
  var _react = require("react");
15
15
 
16
- var _core = require("@emotion/core");
16
+ var _react2 = require("@emotion/react");
17
17
 
18
18
  var _analyticsNext = require("@atlaskit/analytics-next");
19
19
 
@@ -42,9 +42,9 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
42
42
  var analyticsAttributes = {
43
43
  componentName: 'pagination',
44
44
  packageName: "@atlaskit/pagination",
45
- packageVersion: "14.1.8"
45
+ packageVersion: "14.2.0"
46
46
  };
47
- var navStyles = (0, _core.css)({
47
+ var navStyles = (0, _react2.css)({
48
48
  display: 'flex'
49
49
  });
50
50
 
@@ -100,7 +100,7 @@ function InnerPagination(_ref, ref) {
100
100
 
101
101
  var transform = function transform(page, currPageIndex, testId) {
102
102
  var selectedPage = pages[selectedIndexValue];
103
- return (0, _core.jsx)(_page.default, {
103
+ return (0, _react2.jsx)(_page.default, {
104
104
  key: "page-".concat(getPageLabel ? getPageLabel(page, currPageIndex) : currPageIndex),
105
105
  component: components.Page,
106
106
  onClick: function onClick(event) {
@@ -115,13 +115,13 @@ function InnerPagination(_ref, ref) {
115
115
  }, getPageLabel ? getPageLabel(page, currPageIndex) : page);
116
116
  };
117
117
 
118
- return (0, _core.jsx)("nav", {
118
+ return (0, _react2.jsx)("nav", {
119
119
  "data-testid": testId,
120
120
  css: navStyles,
121
121
  style: style,
122
122
  ref: ref,
123
123
  "aria-label": label
124
- }, (0, _core.jsx)(_navigator.default, {
124
+ }, (0, _react2.jsx)(_navigator.default, {
125
125
  key: "left-navigator",
126
126
  component: components.Previous,
127
127
  onClick: function onClick(event) {
@@ -131,7 +131,7 @@ function InnerPagination(_ref, ref) {
131
131
  });
132
132
  },
133
133
  isDisabled: selectedIndexValue === 0,
134
- iconBefore: (0, _core.jsx)(_chevronLeftLarge.default, {
134
+ iconBefore: (0, _react2.jsx)(_chevronLeftLarge.default, {
135
135
  label: ""
136
136
  }),
137
137
  "aria-label": previousLabel,
@@ -141,7 +141,7 @@ function InnerPagination(_ref, ref) {
141
141
  max: max,
142
142
  ellipsis: renderEllipsis,
143
143
  transform: transform
144
- }, testId), (0, _core.jsx)(_navigator.default, {
144
+ }, testId), (0, _react2.jsx)(_navigator.default, {
145
145
  key: "right-navigator",
146
146
  component: components.Next,
147
147
  onClick: function onClick(event) {
@@ -151,7 +151,7 @@ function InnerPagination(_ref, ref) {
151
151
  });
152
152
  },
153
153
  isDisabled: selectedIndexValue === pages.length - 1,
154
- iconBefore: (0, _core.jsx)(_chevronRightLarge.default, {
154
+ iconBefore: (0, _react2.jsx)(_chevronRightLarge.default, {
155
155
  label: ""
156
156
  }),
157
157
  "aria-label": nextLabel,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/pagination",
3
- "version": "14.1.8",
3
+ "version": "14.2.0",
4
4
  "sideEffects": false
5
5
  }
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
 
3
3
  /** @jsx jsx */
4
4
  import React from 'react';
5
- import { css, jsx } from '@emotion/core';
5
+ import { css, jsx } from '@emotion/react';
6
6
  import Button from '@atlaskit/button/standard-button';
7
7
  import { gridSize as getGridSize } from '@atlaskit/theme/constants';
8
8
  const gridSize = getGridSize();
@@ -11,7 +11,8 @@ const navigatorStyles = css({
11
11
  paddingLeft: gridSize / 2
12
12
  });
13
13
  export default function Navigator(props) {
14
- return jsx(Button, _extends({}, props, {
14
+ return jsx(Button // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
15
+ , _extends({}, props, {
15
16
  appearance: "subtle",
16
17
  spacing: "none",
17
18
  css: navigatorStyles
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import React from 'react';
3
3
  import Button from '@atlaskit/button/standard-button';
4
4
  export default function Page(props) {
5
+ // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
5
6
  return /*#__PURE__*/React.createElement(Button, _extends({}, props, {
6
7
  appearance: "subtle"
7
8
  }));
@@ -1,5 +1,5 @@
1
1
  /** @jsx jsx */
2
- import { css, jsx } from '@emotion/core';
2
+ import { css, jsx } from '@emotion/react';
3
3
  const ellipsisStyles = css({
4
4
  display: 'inline-flex',
5
5
  padding: '0 8px',
@@ -1,4 +1,5 @@
1
- import memoizeOne from 'memoize-one';
1
+ import memoizeOne from 'memoize-one'; // TODO: comma needed after generic declaration below, or the .tsx file thinks
2
+ // it is a JSX element. Tidy up in a future refactor.
2
3
 
3
4
  const collapseRange = (pages, current, {
4
5
  max,
@@ -1,6 +1,6 @@
1
1
  /** @jsx jsx */
2
2
  import { forwardRef, memo } from 'react';
3
- import { css, jsx } from '@emotion/core';
3
+ import { css, jsx } from '@emotion/react';
4
4
  import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
5
5
  import noop from '@atlaskit/ds-lib/noop';
6
6
  import useControlled from '@atlaskit/ds-lib/use-controlled';
@@ -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.1.8"
17
+ packageVersion: "14.2.0"
18
18
  };
19
19
  const navStyles = css({
20
20
  display: 'flex'
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/pagination",
3
- "version": "14.1.8",
3
+ "version": "14.2.0",
4
4
  "sideEffects": false
5
5
  }
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
 
3
3
  /** @jsx jsx */
4
4
  import React from 'react';
5
- import { css, jsx } from '@emotion/core';
5
+ import { css, jsx } from '@emotion/react';
6
6
  import Button from '@atlaskit/button/standard-button';
7
7
  import { gridSize as getGridSize } from '@atlaskit/theme/constants';
8
8
  var gridSize = getGridSize();
@@ -11,7 +11,8 @@ var navigatorStyles = css({
11
11
  paddingLeft: gridSize / 2
12
12
  });
13
13
  export default function Navigator(props) {
14
- return jsx(Button, _extends({}, props, {
14
+ return jsx(Button // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
15
+ , _extends({}, props, {
15
16
  appearance: "subtle",
16
17
  spacing: "none",
17
18
  css: navigatorStyles
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import React from 'react';
3
3
  import Button from '@atlaskit/button/standard-button';
4
4
  export default function Page(props) {
5
+ // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
5
6
  return /*#__PURE__*/React.createElement(Button, _extends({}, props, {
6
7
  appearance: "subtle"
7
8
  }));
@@ -1,5 +1,5 @@
1
1
  /** @jsx jsx */
2
- import { css, jsx } from '@emotion/core';
2
+ import { css, jsx } from '@emotion/react';
3
3
  var ellipsisStyles = css({
4
4
  display: 'inline-flex',
5
5
  padding: '0 8px',
@@ -1,5 +1,6 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
- import memoizeOne from 'memoize-one';
2
+ import memoizeOne from 'memoize-one'; // TODO: comma needed after generic declaration below, or the .tsx file thinks
3
+ // it is a JSX element. Tidy up in a future refactor.
3
4
 
4
5
  var collapseRange = function collapseRange(pages, current, _ref, testId) {
5
6
  var max = _ref.max,
@@ -7,7 +7,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
7
7
 
8
8
  /** @jsx jsx */
9
9
  import { forwardRef, memo } from 'react';
10
- import { css, jsx } from '@emotion/core';
10
+ import { css, jsx } from '@emotion/react';
11
11
  import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
12
12
  import noop from '@atlaskit/ds-lib/noop';
13
13
  import useControlled from '@atlaskit/ds-lib/use-controlled';
@@ -21,7 +21,7 @@ import collapseRange from './internal/utils/collapse-range';
21
21
  var analyticsAttributes = {
22
22
  componentName: 'pagination',
23
23
  packageName: "@atlaskit/pagination",
24
- packageVersion: "14.1.8"
24
+ packageVersion: "14.2.0"
25
25
  };
26
26
  var navStyles = css({
27
27
  display: 'flex'
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/pagination",
3
- "version": "14.1.8",
3
+ "version": "14.2.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,15 +1,22 @@
1
1
  /** @jsx jsx */
2
2
  import React, { ReactElement, SyntheticEvent } from 'react';
3
- export declare type NavigatorPropsType<T> = {
4
- /** This will be passed in as aria-label to button. This is what screen reader will read */
3
+ import { jsx } from '@emotion/react';
4
+ export declare type NavigatorProps<T> = {
5
+ /**
6
+ * This will be passed in as aria-label to button. This is what screen reader will read
7
+ */
5
8
  'aria-label'?: string;
6
- /** Is the navigator disabled */
9
+ /**
10
+ * Is the navigator disabled
11
+ */
7
12
  isDisabled?: boolean;
8
13
  iconBefore: ReactElement;
9
14
  pages: T[];
10
15
  testId?: string;
11
- /** This function is called with the when user clicks on navigator */
16
+ /**
17
+ * This function is called with the when user clicks on navigator
18
+ */
12
19
  onClick?: (event: SyntheticEvent) => void;
13
20
  component?: React.ElementType<any>;
14
21
  };
15
- export default function Navigator<T>(props: NavigatorPropsType<T>): JSX.Element;
22
+ export default function Navigator<T>(props: NavigatorProps<T>): jsx.JSX.Element;
@@ -2,7 +2,7 @@
2
2
  import { ButtonProps } from '@atlaskit/button/standard-button';
3
3
  import type { Appearance } from '@atlaskit/button/types';
4
4
  declare type Diff<T, U> = T extends U ? never : T;
5
- declare type PagePropsType = Diff<ButtonProps, {
5
+ declare type PageProps = Diff<ButtonProps, {
6
6
  appearance?: Appearance;
7
7
  autoFocus: boolean;
8
8
  isDisabled: boolean;
@@ -13,5 +13,5 @@ declare type PagePropsType = Diff<ButtonProps, {
13
13
  }> & {
14
14
  page?: any;
15
15
  };
16
- export default function Page(props: PagePropsType): JSX.Element;
16
+ export default function Page(props: PageProps): JSX.Element;
17
17
  export {};
@@ -1,6 +1,6 @@
1
1
  /** @jsx jsx */
2
2
  import { ReactElement } from 'react';
3
- export declare type EllipsisPropType = {
3
+ export declare type EllipsisProp = {
4
4
  key: string;
5
5
  };
6
- export default function renderEllipsis({ key, }: EllipsisPropType): ReactElement;
6
+ export default function renderEllipsis({ key }: EllipsisProp): ReactElement;
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
+ import { jsx } from '@emotion/react';
2
3
  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 function InnerPagination<T>({ components, defaultSelectedIndex, selectedIndex, label, previousLabel, nextLabel, style, max, onChange, pages, getPageLabel, renderEllipsis, analyticsContext, testId, }: PaginationPropTypes<T>, ref: React.Ref<HTMLDivElement>): jsx.JSX.Element;
4
5
  declare const _default: typeof InnerPagination;
5
6
  export default _default;
@@ -1,49 +1,75 @@
1
1
  import type { CSSProperties, ReactElement, SyntheticEvent } from 'react';
2
2
  import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
3
3
  export interface PaginationPropTypes<T = unknown> {
4
- /** Replace the built-in Page, Previous, Next and/ or Ellipsis component */
4
+ /**
5
+ * Replace the built-in Page, Previous, Next and/ or Ellipsis component
6
+ */
5
7
  components?: {
6
8
  Page?: React.ElementType;
7
9
  Previous?: React.ElementType;
8
10
  Next?: React.ElementType;
9
11
  };
10
- /** Index of the page to be selected by default */
12
+ /**
13
+ * Index of the page to be selected by default
14
+ */
11
15
  defaultSelectedIndex?: number;
12
- /** Helper function to get text displayed on the page button. It is helpful in scenarios when page the page passed in is an object */
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
+ */
13
19
  getPageLabel?: (page: T, pageIndex: number) => number | string;
14
- /** The aria-label for the pagination wrapper */
20
+ /**
21
+ * The aria-label for the pagination wrapper
22
+ */
15
23
  label?: string;
16
- /** The aria-label for the next button */
24
+ /**
25
+ * The aria-label for the next button
26
+ */
17
27
  nextLabel?: string;
18
- /** The aria-label for the previous button */
28
+ /**
29
+ * The aria-label for the previous button
30
+ */
19
31
  previousLabel?: string;
20
- /** Style to spread on the container element */
32
+ /**
33
+ * Style to spread on the container element
34
+ */
21
35
  style?: CSSProperties;
22
- /** Maximum number of pages to be displayed in the pagination */
36
+ /**
37
+ * Maximum number of pages to be displayed in the pagination
38
+ */
23
39
  max?: number;
24
- /** The onChange handler which is called when the page is changed */
40
+ /**
41
+ * The onChange handler which is called when the page is changed
42
+ */
25
43
  onChange?: (event: SyntheticEvent, page: T, analyticsEvent?: UIAnalyticsEvent) => void;
26
- /** Array of the pages to display */
44
+ /**
45
+ * Array of the pages to display
46
+ */
27
47
  pages: T[];
28
- /** Index of the selected page. This will make this pagination controlled */
48
+ /**
49
+ * Index of the selected page. This will make this pagination controlled
50
+ */
29
51
  selectedIndex?: number;
30
- /** The react Node returned from the function is rendered instead of the default ellipsis node */
52
+ /**
53
+ * The react Node returned from the function is rendered instead of the default ellipsis node
54
+ */
31
55
  renderEllipsis?: (arg: {
32
56
  key: string;
33
57
  }) => ReactElement;
34
- /** Additional information to be included in the `context` of analytics events */
58
+ /**
59
+ * Additional information to be included in the `context` of analytics events
60
+ */
35
61
  analyticsContext?: Record<string, any>;
36
62
  /**
37
- A `testId` prop is provided for specified elements,
38
- which is a unique string that appears as a data attribute `data-testid`
39
- in the rendered code, serving as a hook for automated tests.
40
-
41
- Will set data-testid on these elements when defined:
42
- - Pagination nav wrapper - {testId}
43
- - Page - {testId}--page-{page index}
44
- - Current page - {testId}--current-page-{page index}
45
- - Left navigator - {testId}--left-navigator
46
- - Right navigator - {testId}--right-navigator
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
47
73
  */
48
74
  testId?: string;
49
75
  }
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@atlaskit/pagination",
3
- "version": "14.1.8",
3
+ "version": "14.2.0",
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/"
7
7
  },
8
8
  "repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
9
+ "homepage": "https://atlassian.design/components/pagination/",
9
10
  "author": "Atlassian Pty Ltd",
10
11
  "license": "Apache-2.0",
11
12
  "main": "dist/cjs/index.js",
@@ -13,7 +14,11 @@
13
14
  "module:es2019": "dist/es2019/index.js",
14
15
  "types": "dist/types/index.d.ts",
15
16
  "sideEffects": false,
16
- "atlaskit:src": "src/index.ts",
17
+ "atlaskit:src": "src/index.tsx",
18
+ "af:exports": {
19
+ "./types": "./src/entry-points/types.tsx",
20
+ ".": "./src/index.tsx"
21
+ },
17
22
  "atlassian": {
18
23
  "team": "Design System Team",
19
24
  "releaseModel": "scheduled",
@@ -26,11 +31,11 @@
26
31
  "@atlaskit/analytics-next": "^8.0.0",
27
32
  "@atlaskit/button": "^16.3.0",
28
33
  "@atlaskit/codemod-utils": "^4.1.0",
29
- "@atlaskit/ds-lib": "^2.0.0",
34
+ "@atlaskit/ds-lib": "^2.1.0",
30
35
  "@atlaskit/icon": "^21.10.0",
31
- "@atlaskit/theme": "^12.1.0",
36
+ "@atlaskit/theme": "^12.2.0",
32
37
  "@babel/runtime": "^7.0.0",
33
- "@emotion/core": "^10.0.9",
38
+ "@emotion/react": "^11.7.1",
34
39
  "memoize-one": "^6.0.0"
35
40
  },
36
41
  "peerDependencies": {
@@ -38,8 +43,9 @@
38
43
  },
39
44
  "devDependencies": {
40
45
  "@atlaskit/docs": "*",
41
- "@atlaskit/dynamic-table": "^14.6.0",
42
- "@atlaskit/section-message": "^6.1.0",
46
+ "@atlaskit/ds-lib": "^2.1.0",
47
+ "@atlaskit/dynamic-table": "^14.8.0",
48
+ "@atlaskit/section-message": "^6.2.0",
43
49
  "@atlaskit/ssr": "*",
44
50
  "@atlaskit/visual-regression": "*",
45
51
  "@atlaskit/webdriver-runner": "*",
@@ -52,7 +58,7 @@
52
58
  "react-router-dom": "^4.2.2",
53
59
  "storybook-addon-performance": "^0.16.0",
54
60
  "tiny-invariant": "^1.2.0",
55
- "typescript": "4.2.4",
61
+ "typescript": "4.3.5",
56
62
  "wait-for-expect": "^1.2.0"
57
63
  },
58
64
  "techstack": {
@@ -60,6 +66,7 @@
60
66
  "import-structure": "atlassian-conventions"
61
67
  },
62
68
  "@repo/internal": {
69
+ "design-system": "v1",
63
70
  "dom-events": "use-bind-event-listener",
64
71
  "ui-components": "lite-mode",
65
72
  "analytics": "analytics-next",
@@ -71,10 +78,5 @@
71
78
  ]
72
79
  }
73
80
  },
74
- "af:exports": {
75
- "./types": "./src/entry-points/types.ts",
76
- ".": "./src/index.ts"
77
- },
78
- "homepage": "https://atlassian.design/components/pagination/",
79
81
  "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
80
82
  }
package/report.api.md ADDED
@@ -0,0 +1,87 @@
1
+ ## API Report File for "@atlaskit/pagination"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+ /// <reference types="react" />
7
+
8
+ import type { CSSProperties } from 'react';
9
+ import type { ReactElement } from 'react';
10
+ import type { SyntheticEvent } from 'react';
11
+ import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
12
+
13
+ declare const _default: typeof InnerPagination;
14
+ export default _default;
15
+
16
+ declare function InnerPagination<T>(
17
+ {
18
+ components,
19
+ defaultSelectedIndex,
20
+ selectedIndex,
21
+ label,
22
+ previousLabel,
23
+ nextLabel,
24
+ style,
25
+ max,
26
+ onChange,
27
+ pages,
28
+ getPageLabel,
29
+ renderEllipsis,
30
+ analyticsContext,
31
+ testId,
32
+ }: PaginationPropTypes<T>,
33
+ ref: React.Ref<HTMLDivElement>,
34
+ ): JSX.Element;
35
+
36
+ export declare interface PaginationPropTypes<T = unknown> {
37
+ /** Replace the built-in Page, Previous, Next and/ or Ellipsis component */
38
+ components?: {
39
+ Page?: React.ElementType;
40
+ Previous?: React.ElementType;
41
+ Next?: React.ElementType;
42
+ };
43
+ /** Index of the page to be selected by default */
44
+ defaultSelectedIndex?: number;
45
+ /** Helper function to get text displayed on the page button. It is helpful in scenarios when page the page passed in is an object */
46
+ getPageLabel?: (page: T, pageIndex: number) => number | string;
47
+ /** The aria-label for the pagination wrapper */
48
+ label?: string;
49
+ /** The aria-label for the next button */
50
+ nextLabel?: string;
51
+ /** The aria-label for the previous button */
52
+ previousLabel?: string;
53
+ /** Style to spread on the container element */
54
+ style?: CSSProperties;
55
+ /** Maximum number of pages to be displayed in the pagination */
56
+ max?: number;
57
+ /** The onChange handler which is called when the page is changed */
58
+ onChange?: (
59
+ event: SyntheticEvent,
60
+ page: T,
61
+ analyticsEvent?: UIAnalyticsEvent,
62
+ ) => void;
63
+ /** Array of the pages to display */
64
+ pages: T[];
65
+ /** Index of the selected page. This will make this pagination controlled */
66
+ selectedIndex?: number;
67
+ /** The react Node returned from the function is rendered instead of the default ellipsis node */
68
+ renderEllipsis?: (arg: { key: string }) => ReactElement;
69
+ /** Additional information to be included in the `context` of analytics events */
70
+ analyticsContext?: Record<string, any>;
71
+ /**
72
+ A `testId` prop is provided for specified elements,
73
+ which is a unique string that appears as a data attribute `data-testid`
74
+ in the rendered code, serving as a hook for automated tests.
75
+
76
+ Will set data-testid on these elements when defined:
77
+ - Pagination nav wrapper - {testId}
78
+ - Page - {testId}--page-{page index}
79
+ - Current page - {testId}--current-page-{page index}
80
+ - Left navigator - {testId}--left-navigator
81
+ - Right navigator - {testId}--right-navigator
82
+ */
83
+ testId?: string;
84
+ }
85
+
86
+ export {};
87
+ ```