@atlaskit/pagination 14.4.16 → 14.5.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/pagination
2
2
 
3
+ ## 14.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#68812](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/68812) [`91d4a48c1430`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/91d4a48c1430) - Support better loading state for assistive tech
8
+
9
+ ## 14.4.17
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
3
15
  ## 14.4.16
4
16
 
5
17
  ### Patch Changes
@@ -27,7 +27,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
27
27
  var analyticsAttributes = {
28
28
  componentName: 'pagination',
29
29
  packageName: "@atlaskit/pagination",
30
- packageVersion: "14.4.16"
30
+ packageVersion: "14.5.0"
31
31
  };
32
32
  function InnerPagination(_ref, ref) {
33
33
  var _ref$components = _ref.components,
@@ -54,7 +54,8 @@ function InnerPagination(_ref, ref) {
54
54
  _ref$renderEllipsis = _ref.renderEllipsis,
55
55
  renderEllipsis = _ref$renderEllipsis === void 0 ? _renderEllipsis.default : _ref$renderEllipsis,
56
56
  analyticsContext = _ref.analyticsContext,
57
- testId = _ref.testId;
57
+ testId = _ref.testId,
58
+ isDisabled = _ref.isDisabled;
58
59
  var _useControlled = (0, _useControlled3.default)(selectedIndex, function () {
59
60
  return defaultSelectedIndex || 0;
60
61
  }),
@@ -91,6 +92,7 @@ function InnerPagination(_ref, ref) {
91
92
  "aria-current": page === selectedPage ? 'page' : undefined,
92
93
  "aria-label": pageIndexLabel,
93
94
  isSelected: page === selectedPage,
95
+ isDisabled: isDisabled,
94
96
  page: page,
95
97
  testId: testId && "".concat(testId, "--").concat(page === selectedPage ? 'current-' : '', "page-").concat(currPageIndex)
96
98
  }, getPageLabel ? getPageLabel(page, currPageIndex) : page);
@@ -113,7 +115,7 @@ function InnerPagination(_ref, ref) {
113
115
  selectedPageIndex: selectedIndexValue - 1
114
116
  });
115
117
  },
116
- isDisabled: selectedIndexValue === 0,
118
+ isDisabled: isDisabled || selectedIndexValue === 0,
117
119
  iconBefore: /*#__PURE__*/_react.default.createElement(_chevronLeftLarge.default, {
118
120
  label: ""
119
121
  }),
@@ -133,7 +135,7 @@ function InnerPagination(_ref, ref) {
133
135
  selectedPageIndex: selectedIndexValue + 1
134
136
  });
135
137
  },
136
- isDisabled: selectedIndexValue === pages.length - 1,
138
+ isDisabled: isDisabled || selectedIndexValue === pages.length - 1,
137
139
  iconBefore: /*#__PURE__*/_react.default.createElement(_chevronRightLarge.default, {
138
140
  label: ""
139
141
  }),
@@ -13,7 +13,7 @@ import collapseRange from './internal/utils/collapse-range';
13
13
  const analyticsAttributes = {
14
14
  componentName: 'pagination',
15
15
  packageName: "@atlaskit/pagination",
16
- packageVersion: "14.4.16"
16
+ packageVersion: "14.5.0"
17
17
  };
18
18
  function InnerPagination({
19
19
  components = emptyObject,
@@ -30,7 +30,8 @@ function InnerPagination({
30
30
  getPageLabel,
31
31
  renderEllipsis = renderDefaultEllipsis,
32
32
  analyticsContext,
33
- testId
33
+ testId,
34
+ isDisabled
34
35
  }, ref) {
35
36
  const [selectedIndexValue, setSelectedIndexValue] = useControlled(selectedIndex, () => defaultSelectedIndex || 0);
36
37
  const onChangeWithAnalytics = usePlatformLeafEventHandler({
@@ -64,6 +65,7 @@ function InnerPagination({
64
65
  "aria-current": page === selectedPage ? 'page' : undefined,
65
66
  "aria-label": pageIndexLabel,
66
67
  isSelected: page === selectedPage,
68
+ isDisabled: isDisabled,
67
69
  page: page,
68
70
  testId: testId && `${testId}--${page === selectedPage ? 'current-' : ''}page-${currPageIndex}`
69
71
  }, getPageLabel ? getPageLabel(page, currPageIndex) : page);
@@ -84,7 +86,7 @@ function InnerPagination({
84
86
  event,
85
87
  selectedPageIndex: selectedIndexValue - 1
86
88
  }),
87
- isDisabled: selectedIndexValue === 0,
89
+ isDisabled: isDisabled || selectedIndexValue === 0,
88
90
  iconBefore: /*#__PURE__*/React.createElement(ChevronLeftLargeIcon, {
89
91
  label: ""
90
92
  }),
@@ -102,7 +104,7 @@ function InnerPagination({
102
104
  event,
103
105
  selectedPageIndex: selectedIndexValue + 1
104
106
  }),
105
- isDisabled: selectedIndexValue === pages.length - 1,
107
+ isDisabled: isDisabled || selectedIndexValue === pages.length - 1,
106
108
  iconBefore: /*#__PURE__*/React.createElement(ChevronRightLargeIcon, {
107
109
  label: ""
108
110
  }),
@@ -17,7 +17,7 @@ import collapseRange from './internal/utils/collapse-range';
17
17
  var analyticsAttributes = {
18
18
  componentName: 'pagination',
19
19
  packageName: "@atlaskit/pagination",
20
- packageVersion: "14.4.16"
20
+ packageVersion: "14.5.0"
21
21
  };
22
22
  function InnerPagination(_ref, ref) {
23
23
  var _ref$components = _ref.components,
@@ -44,7 +44,8 @@ function InnerPagination(_ref, ref) {
44
44
  _ref$renderEllipsis = _ref.renderEllipsis,
45
45
  renderEllipsis = _ref$renderEllipsis === void 0 ? renderDefaultEllipsis : _ref$renderEllipsis,
46
46
  analyticsContext = _ref.analyticsContext,
47
- testId = _ref.testId;
47
+ testId = _ref.testId,
48
+ isDisabled = _ref.isDisabled;
48
49
  var _useControlled = useControlled(selectedIndex, function () {
49
50
  return defaultSelectedIndex || 0;
50
51
  }),
@@ -81,6 +82,7 @@ function InnerPagination(_ref, ref) {
81
82
  "aria-current": page === selectedPage ? 'page' : undefined,
82
83
  "aria-label": pageIndexLabel,
83
84
  isSelected: page === selectedPage,
85
+ isDisabled: isDisabled,
84
86
  page: page,
85
87
  testId: testId && "".concat(testId, "--").concat(page === selectedPage ? 'current-' : '', "page-").concat(currPageIndex)
86
88
  }, getPageLabel ? getPageLabel(page, currPageIndex) : page);
@@ -103,7 +105,7 @@ function InnerPagination(_ref, ref) {
103
105
  selectedPageIndex: selectedIndexValue - 1
104
106
  });
105
107
  },
106
- isDisabled: selectedIndexValue === 0,
108
+ isDisabled: isDisabled || selectedIndexValue === 0,
107
109
  iconBefore: /*#__PURE__*/React.createElement(ChevronLeftLargeIcon, {
108
110
  label: ""
109
111
  }),
@@ -123,7 +125,7 @@ function InnerPagination(_ref, ref) {
123
125
  selectedPageIndex: selectedIndexValue + 1
124
126
  });
125
127
  },
126
- isDisabled: selectedIndexValue === pages.length - 1,
128
+ isDisabled: isDisabled || selectedIndexValue === pages.length - 1,
127
129
  iconBefore: /*#__PURE__*/React.createElement(ChevronRightLargeIcon, {
128
130
  label: ""
129
131
  }),
@@ -1,18 +1,18 @@
1
1
  import React, { ReactElement, SyntheticEvent } from 'react';
2
2
  export type NavigatorProps<T> = {
3
3
  /**
4
- * This will be passed in as aria-label to button. This is what screen reader will read
4
+ * This will be passed in as aria-label to the button. Use this to supply a descriptive label for assistive technology.
5
5
  */
6
6
  'aria-label'?: string;
7
7
  /**
8
- * Is the navigator disabled
8
+ * Sets whether the navigator is disabled.
9
9
  */
10
10
  isDisabled?: boolean;
11
11
  iconBefore: ReactElement;
12
12
  pages: T[];
13
13
  testId?: string;
14
14
  /**
15
- * This function is called with the when user clicks on navigator
15
+ * This function is called when the user clicks on the navigator.
16
16
  */
17
17
  onClick?: (event: SyntheticEvent) => void;
18
18
  component?: React.ElementType<any>;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  import { PaginationPropTypes } from './types';
3
- declare function InnerPagination<T>({ components, defaultSelectedIndex, selectedIndex, label, pageLabel, previousLabel, nextLabel, style, max, onChange, pages, getPageLabel, renderEllipsis, analyticsContext, testId, }: PaginationPropTypes<T>, ref: React.Ref<HTMLDivElement>): JSX.Element;
3
+ declare function InnerPagination<T>({ components, defaultSelectedIndex, selectedIndex, label, pageLabel, previousLabel, nextLabel, style, max, onChange, pages, getPageLabel, renderEllipsis, analyticsContext, testId, isDisabled, }: PaginationPropTypes<T>, ref: React.Ref<HTMLDivElement>): JSX.Element;
4
4
  declare const _default: typeof InnerPagination;
5
5
  export default _default;
@@ -2,7 +2,7 @@ import type { CSSProperties, ReactElement, SyntheticEvent } from 'react';
2
2
  import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
3
3
  export interface PaginationPropTypes<T = unknown> {
4
4
  /**
5
- * Replace the built-in Page, Previous, Next and/ or Ellipsis component
5
+ * Replace the built-in page, previous, next and/ or ellipsis component
6
6
  */
7
7
  components?: {
8
8
  Page?: React.ElementType;
@@ -10,11 +10,11 @@ export interface PaginationPropTypes<T = unknown> {
10
10
  Next?: React.ElementType;
11
11
  };
12
12
  /**
13
- * Index of the page to be selected by default
13
+ * Index of the page to be selected by default.
14
14
  */
15
15
  defaultSelectedIndex?: number;
16
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
17
+ * Helper function to get text displayed on the page button. This is helpful in scenarios when page the page passed in is an object.
18
18
  */
19
19
  getPageLabel?: (page: T, pageIndex: number) => number | string;
20
20
  /**
@@ -41,33 +41,33 @@ export interface PaginationPropTypes<T = unknown> {
41
41
  */
42
42
  previousLabel?: string;
43
43
  /**
44
- * Style to spread on the container element
44
+ * Style to spread on the container element.
45
45
  */
46
46
  style?: CSSProperties;
47
47
  /**
48
- * Maximum number of pages to be displayed in the pagination
48
+ * Maximum number of pages to be displayed in the pagination.
49
49
  */
50
50
  max?: number;
51
51
  /**
52
- * The onChange handler which is called when the page is changed
52
+ * The onChange handler which is called when the page is changed.
53
53
  */
54
54
  onChange?: (event: SyntheticEvent, page: T, analyticsEvent?: UIAnalyticsEvent) => void;
55
55
  /**
56
- * Array of the pages to display
56
+ * Array of the pages to display.
57
57
  */
58
58
  pages: T[];
59
59
  /**
60
- * Index of the selected page. This will make this pagination controlled
60
+ * Index of the selected page. This will make this pagination controlled.
61
61
  */
62
62
  selectedIndex?: number;
63
63
  /**
64
- * The react Node returned from the function is rendered instead of the default ellipsis node
64
+ * The react Node returned from the function is rendered instead of the default ellipsis node.
65
65
  */
66
66
  renderEllipsis?: (arg: {
67
67
  key: string;
68
68
  }) => ReactElement;
69
69
  /**
70
- * Additional information to be included in the `context` of analytics events
70
+ * Additional information to be included in the `context` of analytics events.
71
71
  */
72
72
  analyticsContext?: Record<string, any>;
73
73
  /**
@@ -83,4 +83,8 @@ export interface PaginationPropTypes<T = unknown> {
83
83
  * - Right navigator - {testId}--right-navigator
84
84
  */
85
85
  testId?: string;
86
+ /**
87
+ * Sets whether the Paginator is disabled
88
+ */
89
+ isDisabled?: boolean;
86
90
  }
@@ -1,18 +1,18 @@
1
1
  import React, { ReactElement, SyntheticEvent } from 'react';
2
2
  export type NavigatorProps<T> = {
3
3
  /**
4
- * This will be passed in as aria-label to button. This is what screen reader will read
4
+ * This will be passed in as aria-label to the button. Use this to supply a descriptive label for assistive technology.
5
5
  */
6
6
  'aria-label'?: string;
7
7
  /**
8
- * Is the navigator disabled
8
+ * Sets whether the navigator is disabled.
9
9
  */
10
10
  isDisabled?: boolean;
11
11
  iconBefore: ReactElement;
12
12
  pages: T[];
13
13
  testId?: string;
14
14
  /**
15
- * This function is called with the when user clicks on navigator
15
+ * This function is called when the user clicks on the navigator.
16
16
  */
17
17
  onClick?: (event: SyntheticEvent) => void;
18
18
  component?: React.ElementType<any>;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  import { PaginationPropTypes } from './types';
3
- declare function InnerPagination<T>({ components, defaultSelectedIndex, selectedIndex, label, pageLabel, previousLabel, nextLabel, style, max, onChange, pages, getPageLabel, renderEllipsis, analyticsContext, testId, }: PaginationPropTypes<T>, ref: React.Ref<HTMLDivElement>): JSX.Element;
3
+ declare function InnerPagination<T>({ components, defaultSelectedIndex, selectedIndex, label, pageLabel, previousLabel, nextLabel, style, max, onChange, pages, getPageLabel, renderEllipsis, analyticsContext, testId, isDisabled, }: PaginationPropTypes<T>, ref: React.Ref<HTMLDivElement>): JSX.Element;
4
4
  declare const _default: typeof InnerPagination;
5
5
  export default _default;
@@ -2,7 +2,7 @@ import type { CSSProperties, ReactElement, SyntheticEvent } from 'react';
2
2
  import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
3
3
  export interface PaginationPropTypes<T = unknown> {
4
4
  /**
5
- * Replace the built-in Page, Previous, Next and/ or Ellipsis component
5
+ * Replace the built-in page, previous, next and/ or ellipsis component
6
6
  */
7
7
  components?: {
8
8
  Page?: React.ElementType;
@@ -10,11 +10,11 @@ export interface PaginationPropTypes<T = unknown> {
10
10
  Next?: React.ElementType;
11
11
  };
12
12
  /**
13
- * Index of the page to be selected by default
13
+ * Index of the page to be selected by default.
14
14
  */
15
15
  defaultSelectedIndex?: number;
16
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
17
+ * Helper function to get text displayed on the page button. This is helpful in scenarios when page the page passed in is an object.
18
18
  */
19
19
  getPageLabel?: (page: T, pageIndex: number) => number | string;
20
20
  /**
@@ -41,33 +41,33 @@ export interface PaginationPropTypes<T = unknown> {
41
41
  */
42
42
  previousLabel?: string;
43
43
  /**
44
- * Style to spread on the container element
44
+ * Style to spread on the container element.
45
45
  */
46
46
  style?: CSSProperties;
47
47
  /**
48
- * Maximum number of pages to be displayed in the pagination
48
+ * Maximum number of pages to be displayed in the pagination.
49
49
  */
50
50
  max?: number;
51
51
  /**
52
- * The onChange handler which is called when the page is changed
52
+ * The onChange handler which is called when the page is changed.
53
53
  */
54
54
  onChange?: (event: SyntheticEvent, page: T, analyticsEvent?: UIAnalyticsEvent) => void;
55
55
  /**
56
- * Array of the pages to display
56
+ * Array of the pages to display.
57
57
  */
58
58
  pages: T[];
59
59
  /**
60
- * Index of the selected page. This will make this pagination controlled
60
+ * Index of the selected page. This will make this pagination controlled.
61
61
  */
62
62
  selectedIndex?: number;
63
63
  /**
64
- * The react Node returned from the function is rendered instead of the default ellipsis node
64
+ * The react Node returned from the function is rendered instead of the default ellipsis node.
65
65
  */
66
66
  renderEllipsis?: (arg: {
67
67
  key: string;
68
68
  }) => ReactElement;
69
69
  /**
70
- * Additional information to be included in the `context` of analytics events
70
+ * Additional information to be included in the `context` of analytics events.
71
71
  */
72
72
  analyticsContext?: Record<string, any>;
73
73
  /**
@@ -83,4 +83,8 @@ export interface PaginationPropTypes<T = unknown> {
83
83
  * - Right navigator - {testId}--right-navigator
84
84
  */
85
85
  testId?: string;
86
+ /**
87
+ * Sets whether the Paginator is disabled
88
+ */
89
+ isDisabled?: boolean;
86
90
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/pagination",
3
- "version": "14.4.16",
3
+ "version": "14.5.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/"
@@ -40,12 +40,12 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "@atlaskit/analytics-next": "^9.1.0",
43
- "@atlaskit/button": "^16.16.0",
43
+ "@atlaskit/button": "^17.2.0",
44
44
  "@atlaskit/codemod-utils": "^4.2.0",
45
- "@atlaskit/ds-explorations": "^3.0.0",
45
+ "@atlaskit/ds-explorations": "^3.2.0",
46
46
  "@atlaskit/ds-lib": "^2.2.0",
47
47
  "@atlaskit/icon": "^22.0.0",
48
- "@atlaskit/primitives": "^1.10.0",
48
+ "@atlaskit/primitives": "^1.20.0",
49
49
  "@babel/runtime": "^7.0.0",
50
50
  "memoize-one": "^6.0.0"
51
51
  },
@@ -54,9 +54,10 @@
54
54
  },
55
55
  "devDependencies": {
56
56
  "@af/accessibility-testing": "*",
57
+ "@af/integration-testing": "*",
58
+ "@af/visual-regression": "*",
57
59
  "@atlaskit/ssr": "*",
58
60
  "@atlaskit/visual-regression": "*",
59
- "@atlaskit/webdriver-runner": "*",
60
61
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
61
62
  "@testing-library/dom": "^8.17.1",
62
63
  "@testing-library/react": "^12.1.5",
@@ -1,47 +0,0 @@
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
-
7
- import type { CSSProperties } from 'react';
8
- import { default as React_2 } from 'react';
9
- import type { ReactElement } from 'react';
10
- import type { SyntheticEvent } from 'react';
11
- import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
12
-
13
- // @public (undocumented)
14
- const _default: typeof InnerPagination;
15
- export default _default;
16
-
17
- // @public (undocumented)
18
- function InnerPagination<T>({ components, defaultSelectedIndex, selectedIndex, label, pageLabel, previousLabel, nextLabel, style, max, onChange, pages, getPageLabel, renderEllipsis, analyticsContext, testId, }: PaginationPropTypes<T>, ref: React_2.Ref<HTMLDivElement>): JSX.Element;
19
-
20
- // @public (undocumented)
21
- export interface PaginationPropTypes<T = unknown> {
22
- analyticsContext?: Record<string, any>;
23
- components?: {
24
- Page?: React.ElementType;
25
- Previous?: React.ElementType;
26
- Next?: React.ElementType;
27
- };
28
- defaultSelectedIndex?: number;
29
- getPageLabel?: (page: T, pageIndex: number) => number | string;
30
- label?: string;
31
- max?: number;
32
- nextLabel?: string;
33
- onChange?: (event: SyntheticEvent, page: T, analyticsEvent?: UIAnalyticsEvent) => void;
34
- pageLabel?: string;
35
- pages: T[];
36
- previousLabel?: string;
37
- renderEllipsis?: (arg: {
38
- key: string;
39
- }) => ReactElement;
40
- selectedIndex?: number;
41
- style?: CSSProperties;
42
- testId?: string;
43
- }
44
-
45
- // (No @packageDocumentation comment for this package)
46
-
47
- ```