@atlaskit/pagination 14.1.8 → 14.1.9

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 (35) hide show
  1. package/CHANGELOG.md +7 -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 +2 -1
  16. package/dist/cjs/internal/components/page.js +1 -0
  17. package/dist/cjs/internal/utils/collapse-range.js +2 -0
  18. package/dist/cjs/pagination.js +1 -1
  19. package/dist/cjs/version.json +1 -1
  20. package/dist/es2019/internal/components/navigator.js +2 -1
  21. package/dist/es2019/internal/components/page.js +1 -0
  22. package/dist/es2019/internal/utils/collapse-range.js +2 -1
  23. package/dist/es2019/pagination.js +1 -1
  24. package/dist/es2019/version.json +1 -1
  25. package/dist/esm/internal/components/navigator.js +2 -1
  26. package/dist/esm/internal/components/page.js +1 -0
  27. package/dist/esm/internal/utils/collapse-range.js +2 -1
  28. package/dist/esm/pagination.js +1 -1
  29. package/dist/esm/version.json +1 -1
  30. package/dist/types/internal/components/navigator.d.ts +11 -5
  31. package/dist/types/internal/components/page.d.ts +2 -2
  32. package/dist/types/internal/components/render-ellipsis.d.ts +2 -2
  33. package/dist/types/types.d.ts +49 -23
  34. package/package.json +11 -9
  35. package/report.api.md +87 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @atlaskit/pagination
2
2
 
3
+ ## 14.1.9
4
+
5
+ ### Patch Changes
6
+
7
+ - [`ac051e856a6`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ac051e856a6) - Internal code change turning on new linting rules.
8
+ - Updated dependencies
9
+
3
10
  ## 14.1.8
4
11
 
5
12
  ### Patch Changes
@@ -25,7 +25,8 @@ var navigatorStyles = (0, _core.css)({
25
25
  });
26
26
 
27
27
  function Navigator(props) {
28
- return (0, _core.jsx)(_standardButton.default, (0, _extends2.default)({}, props, {
28
+ return (0, _core.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
  }));
@@ -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,
@@ -42,7 +42,7 @@ 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.1.9"
46
46
  };
47
47
  var navStyles = (0, _core.css)({
48
48
  display: 'flex'
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/pagination",
3
- "version": "14.1.8",
3
+ "version": "14.1.9",
4
4
  "sideEffects": false
5
5
  }
@@ -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,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,
@@ -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.1.9"
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.1.9",
4
4
  "sideEffects": false
5
5
  }
@@ -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,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,
@@ -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.1.9"
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.1.9",
4
4
  "sideEffects": false
5
5
  }
@@ -1,15 +1,21 @@
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
+ export declare type NavigatorProps<T> = {
4
+ /**
5
+ * This will be passed in as aria-label to button. This is what screen reader will read
6
+ */
5
7
  'aria-label'?: string;
6
- /** Is the navigator disabled */
8
+ /**
9
+ * Is the navigator disabled
10
+ */
7
11
  isDisabled?: boolean;
8
12
  iconBefore: ReactElement;
9
13
  pages: T[];
10
14
  testId?: string;
11
- /** This function is called with the when user clicks on navigator */
15
+ /**
16
+ * This function is called with the when user clicks on navigator
17
+ */
12
18
  onClick?: (event: SyntheticEvent) => void;
13
19
  component?: React.ElementType<any>;
14
20
  };
15
- export default function Navigator<T>(props: NavigatorPropsType<T>): JSX.Element;
21
+ export default function Navigator<T>(props: NavigatorProps<T>): 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,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.1.9",
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,7 +31,7 @@
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
36
  "@atlaskit/theme": "^12.1.0",
32
37
  "@babel/runtime": "^7.0.0",
@@ -38,7 +43,8 @@
38
43
  },
39
44
  "devDependencies": {
40
45
  "@atlaskit/docs": "*",
41
- "@atlaskit/dynamic-table": "^14.6.0",
46
+ "@atlaskit/ds-lib": "^2.1.0",
47
+ "@atlaskit/dynamic-table": "^14.7.0",
42
48
  "@atlaskit/section-message": "^6.1.0",
43
49
  "@atlaskit/ssr": "*",
44
50
  "@atlaskit/visual-regression": "*",
@@ -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
+ ```