@atlaskit/pagination 14.2.2 → 14.2.4

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 (32) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/codemods/migrations/rename-pagination-prop-types.tsx +6 -5
  3. package/dist/cjs/internal/components/navigator.js +2 -14
  4. package/dist/cjs/internal/components/render-ellipsis.js +16 -12
  5. package/dist/cjs/internal/utils/collapse-range.js +8 -4
  6. package/dist/cjs/pagination.js +26 -18
  7. package/dist/cjs/version.json +1 -1
  8. package/dist/es2019/internal/components/navigator.js +2 -13
  9. package/dist/es2019/internal/components/render-ellipsis.js +13 -12
  10. package/dist/es2019/internal/utils/collapse-range.js +8 -4
  11. package/dist/es2019/pagination.js +18 -18
  12. package/dist/es2019/version.json +1 -1
  13. package/dist/esm/internal/components/navigator.js +2 -13
  14. package/dist/esm/internal/components/render-ellipsis.js +13 -12
  15. package/dist/esm/internal/utils/collapse-range.js +8 -4
  16. package/dist/esm/pagination.js +18 -18
  17. package/dist/esm/version.json +1 -1
  18. package/dist/types/internal/components/navigator.d.ts +1 -3
  19. package/dist/types/internal/components/render-ellipsis.d.ts +2 -2
  20. package/dist/types/internal/utils/collapse-range.d.ts +1 -0
  21. package/dist/types/pagination.d.ts +2 -3
  22. package/package.json +12 -14
  23. package/report.api.md +18 -62
  24. package/dist/types-ts4.0/entry-points/types.d.ts +0 -1
  25. package/dist/types-ts4.0/index.d.ts +0 -2
  26. package/dist/types-ts4.0/internal/components/navigator.d.ts +0 -22
  27. package/dist/types-ts4.0/internal/components/page.d.ts +0 -17
  28. package/dist/types-ts4.0/internal/components/render-ellipsis.d.ts +0 -6
  29. package/dist/types-ts4.0/internal/constants.d.ts +0 -1
  30. package/dist/types-ts4.0/internal/utils/collapse-range.d.ts +0 -9
  31. package/dist/types-ts4.0/pagination.d.ts +0 -6
  32. package/dist/types-ts4.0/types.d.ts +0 -75
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/pagination
2
2
 
3
+ ## 14.2.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`87991a69644`](https://bitbucket.org/atlassian/atlassian-frontend/commits/87991a69644) - - Remove @atlaskit/tokens as a dependency.
8
+ - Remove @emotion/react as a dependency.
9
+ - Remove padding on navigator button in favor of default button sizing.
10
+
11
+ ## 14.2.3
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 14.2.2
4
18
 
5
19
  ### Patch Changes
@@ -1,7 +1,8 @@
1
1
  import { renameNamedImportWithAliasName } from '@atlaskit/codemod-utils';
2
2
 
3
- export const renamePaginationPropTypeToPaginationProps = renameNamedImportWithAliasName(
4
- '@atlaskit/pagination',
5
- 'PaginationPropTypes',
6
- 'PaginationProps',
7
- );
3
+ export const renamePaginationPropTypeToPaginationProps =
4
+ renameNamedImportWithAliasName(
5
+ '@atlaskit/pagination',
6
+ 'PaginationPropTypes',
7
+ 'PaginationProps',
8
+ );
@@ -11,23 +11,11 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
11
11
 
12
12
  var _react = _interopRequireDefault(require("react"));
13
13
 
14
- var _react2 = require("@emotion/react");
15
-
16
14
  var _standardButton = _interopRequireDefault(require("@atlaskit/button/standard-button"));
17
15
 
18
- /** @jsx jsx */
19
- var navigatorStyles = (0, _react2.css)({
20
- // TODO Delete this comment after verifying spacing token -> previous value `gridSize / 2`
21
- paddingRight: "var(--ds-scale-050, 4px)",
22
- // TODO Delete this comment after verifying spacing token -> previous value `gridSize / 2`
23
- paddingLeft: "var(--ds-scale-050, 4px)"
24
- });
25
-
26
16
  function Navigator(props) {
27
- return (0, _react2.jsx)(_standardButton.default // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
17
+ return /*#__PURE__*/_react.default.createElement(_standardButton.default // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
28
18
  , (0, _extends2.default)({}, props, {
29
- appearance: "subtle",
30
- spacing: "none",
31
- css: navigatorStyles
19
+ appearance: "subtle"
32
20
  }));
33
21
  }
@@ -1,24 +1,28 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
6
8
  exports.default = renderEllipsis;
7
9
 
8
- var _react = require("@emotion/react");
10
+ var _react = _interopRequireDefault(require("react"));
9
11
 
10
- /** @jsx jsx */
11
- var ellipsisStyles = (0, _react.css)({
12
- display: 'inline-flex',
13
- padding: "var(--ds-scale-0, 0px)".concat(" ", "var(--ds-scale-100, 8px)"),
14
- alignItems: 'center',
15
- textAlign: 'center'
16
- });
12
+ var _box = _interopRequireDefault(require("@atlaskit/ds-explorations/box"));
13
+
14
+ var _text = _interopRequireDefault(require("@atlaskit/ds-explorations/text"));
17
15
 
18
16
  function renderEllipsis(_ref) {
19
- var key = _ref.key;
20
- return (0, _react.jsx)("span", {
17
+ var key = _ref.key,
18
+ testId = _ref.testId;
19
+ return /*#__PURE__*/_react.default.createElement(_box.default, {
20
+ as: "span",
21
+ testId: testId,
21
22
  key: key,
22
- css: ellipsisStyles
23
- }, "...");
23
+ paddingInline: "scale.100"
24
+ }, /*#__PURE__*/_react.default.createElement(_text.default, {
25
+ testId: "".concat(testId, "-text"),
26
+ verticalAlign: "middle"
27
+ }, "..."));
24
28
  }
@@ -40,7 +40,8 @@ var collapseRange = function collapseRange(pages, current, _ref, testId) {
40
40
  var _pageCount = max - 2;
41
41
 
42
42
  return [].concat((0, _toConsumableArray2.default)(getPageComponents(0, 1)), [ellipsis({
43
- key: 'elipses-1'
43
+ key: 'ellipsis-1',
44
+ testId: "".concat(testId, "-ellipsis")
44
45
  })], (0, _toConsumableArray2.default)(getPageComponents(total - _pageCount)));
45
46
  }
46
47
 
@@ -48,16 +49,19 @@ var collapseRange = function collapseRange(pages, current, _ref, testId) {
48
49
  var _pageCount2 = max - 2;
49
50
 
50
51
  return [].concat((0, _toConsumableArray2.default)(getPageComponents(0, _pageCount2)), [ellipsis({
51
- key: 'elipses-1'
52
+ key: 'ellipsis-1',
53
+ testId: "".concat(testId, "-ellipsis")
52
54
  })], (0, _toConsumableArray2.default)(getPageComponents(total - 1)));
53
55
  } // we have both start and end ellipsis
54
56
 
55
57
 
56
58
  var pageCount = max - 4;
57
59
  return [].concat((0, _toConsumableArray2.default)(getPageComponents(0, 1)), [ellipsis({
58
- key: 'elipses-1'
60
+ key: 'ellipsis-1',
61
+ testId: "".concat(testId, "-ellipsis")
59
62
  })], (0, _toConsumableArray2.default)(getPageComponents(current - Math.floor(pageCount / 2), current + pageCount - 1)), [ellipsis({
60
- key: 'elipses-2'
63
+ key: 'ellipsis-2',
64
+ testId: "".concat(testId, "-ellipsis")
61
65
  })], (0, _toConsumableArray2.default)(getPageComponents(total - 1)));
62
66
  };
63
67
 
@@ -2,6 +2,8 @@
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
4
 
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
6
+
5
7
  Object.defineProperty(exports, "__esModule", {
6
8
  value: true
7
9
  });
@@ -11,12 +13,14 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
11
13
 
12
14
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
13
15
 
14
- var _react = require("react");
15
-
16
- var _react2 = require("@emotion/react");
16
+ var _react = _interopRequireWildcard(require("react"));
17
17
 
18
18
  var _analyticsNext = require("@atlaskit/analytics-next");
19
19
 
20
+ var _box = _interopRequireDefault(require("@atlaskit/ds-explorations/box"));
21
+
22
+ var _inline = _interopRequireDefault(require("@atlaskit/ds-explorations/inline"));
23
+
20
24
  var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
21
25
 
22
26
  var _useControlled3 = _interopRequireDefault(require("@atlaskit/ds-lib/use-controlled"));
@@ -35,6 +39,10 @@ var _constants = require("./internal/constants");
35
39
 
36
40
  var _collapseRange = _interopRequireDefault(require("./internal/utils/collapse-range"));
37
41
 
42
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
43
+
44
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
45
+
38
46
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
39
47
 
40
48
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -42,11 +50,8 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
42
50
  var analyticsAttributes = {
43
51
  componentName: 'pagination',
44
52
  packageName: "@atlaskit/pagination",
45
- packageVersion: "14.2.2"
53
+ packageVersion: "14.2.4"
46
54
  };
47
- var navStyles = (0, _react2.css)({
48
- display: 'flex'
49
- });
50
55
 
51
56
  function InnerPagination(_ref, ref) {
52
57
  var _ref$components = _ref.components,
@@ -100,7 +105,7 @@ function InnerPagination(_ref, ref) {
100
105
 
101
106
  var transform = function transform(page, currPageIndex, testId) {
102
107
  var selectedPage = pages[selectedIndexValue];
103
- return (0, _react2.jsx)(_page.default, {
108
+ return /*#__PURE__*/_react.default.createElement(_page.default, {
104
109
  key: "page-".concat(getPageLabel ? getPageLabel(page, currPageIndex) : currPageIndex),
105
110
  component: components.Page,
106
111
  onClick: function onClick(event) {
@@ -115,13 +120,16 @@ function InnerPagination(_ref, ref) {
115
120
  }, getPageLabel ? getPageLabel(page, currPageIndex) : page);
116
121
  };
117
122
 
118
- return (0, _react2.jsx)("nav", {
119
- "data-testid": testId,
120
- css: navStyles,
121
- style: style,
123
+ return /*#__PURE__*/_react.default.createElement(_box.default, {
124
+ testId: testId,
125
+ UNSAFE_style: style,
122
126
  ref: ref,
123
- "aria-label": label
124
- }, (0, _react2.jsx)(_navigator.default, {
127
+ "aria-label": label,
128
+ as: "nav"
129
+ }, /*#__PURE__*/_react.default.createElement(_inline.default, {
130
+ gap: "scale.0",
131
+ alignItems: "center"
132
+ }, /*#__PURE__*/_react.default.createElement(_navigator.default, {
125
133
  key: "left-navigator",
126
134
  component: components.Previous,
127
135
  onClick: function onClick(event) {
@@ -131,7 +139,7 @@ function InnerPagination(_ref, ref) {
131
139
  });
132
140
  },
133
141
  isDisabled: selectedIndexValue === 0,
134
- iconBefore: (0, _react2.jsx)(_chevronLeftLarge.default, {
142
+ iconBefore: /*#__PURE__*/_react.default.createElement(_chevronLeftLarge.default, {
135
143
  label: ""
136
144
  }),
137
145
  "aria-label": previousLabel,
@@ -141,7 +149,7 @@ function InnerPagination(_ref, ref) {
141
149
  max: max,
142
150
  ellipsis: renderEllipsis,
143
151
  transform: transform
144
- }, testId), (0, _react2.jsx)(_navigator.default, {
152
+ }, testId), /*#__PURE__*/_react.default.createElement(_navigator.default, {
145
153
  key: "right-navigator",
146
154
  component: components.Next,
147
155
  onClick: function onClick(event) {
@@ -151,13 +159,13 @@ function InnerPagination(_ref, ref) {
151
159
  });
152
160
  },
153
161
  isDisabled: selectedIndexValue === pages.length - 1,
154
- iconBefore: (0, _react2.jsx)(_chevronRightLarge.default, {
162
+ iconBefore: /*#__PURE__*/_react.default.createElement(_chevronRightLarge.default, {
155
163
  label: ""
156
164
  }),
157
165
  "aria-label": nextLabel,
158
166
  pages: pages,
159
167
  testId: testId && "".concat(testId, "--right-navigator")
160
- }));
168
+ })));
161
169
  }
162
170
 
163
171
  var Pagination = /*#__PURE__*/(0, _react.forwardRef)(InnerPagination);
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/pagination",
3
- "version": "14.2.2",
3
+ "version": "14.2.4",
4
4
  "sideEffects": false
5
5
  }
@@ -1,20 +1,9 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
-
3
- /** @jsx jsx */
4
2
  import React from 'react';
5
- import { css, jsx } from '@emotion/react';
6
3
  import Button from '@atlaskit/button/standard-button';
7
- const navigatorStyles = css({
8
- // TODO Delete this comment after verifying spacing token -> previous value `gridSize / 2`
9
- paddingRight: "var(--ds-scale-050, 4px)",
10
- // TODO Delete this comment after verifying spacing token -> previous value `gridSize / 2`
11
- paddingLeft: "var(--ds-scale-050, 4px)"
12
- });
13
4
  export default function Navigator(props) {
14
- return jsx(Button // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
5
+ return /*#__PURE__*/React.createElement(Button // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
15
6
  , _extends({}, props, {
16
- appearance: "subtle",
17
- spacing: "none",
18
- css: navigatorStyles
7
+ appearance: "subtle"
19
8
  }));
20
9
  }
@@ -1,16 +1,17 @@
1
- /** @jsx jsx */
2
- import { css, jsx } from '@emotion/react';
3
- const ellipsisStyles = css({
4
- display: 'inline-flex',
5
- padding: `${"var(--ds-scale-0, 0px)"} ${"var(--ds-scale-100, 8px)"}`,
6
- alignItems: 'center',
7
- textAlign: 'center'
8
- });
1
+ import React from 'react';
2
+ import Box from '@atlaskit/ds-explorations/box';
3
+ import Text from '@atlaskit/ds-explorations/text';
9
4
  export default function renderEllipsis({
10
- key
5
+ key,
6
+ testId
11
7
  }) {
12
- return jsx("span", {
8
+ return /*#__PURE__*/React.createElement(Box, {
9
+ as: "span",
10
+ testId: testId,
13
11
  key: key,
14
- css: ellipsisStyles
15
- }, "...");
12
+ paddingInline: "scale.100"
13
+ }, /*#__PURE__*/React.createElement(Text, {
14
+ testId: `${testId}-text`,
15
+ verticalAlign: "middle"
16
+ }, "..."));
16
17
  }
@@ -24,23 +24,27 @@ const collapseRange = (pages, current, {
24
24
  if (hasStartEllipsis && !hasEndEllipsis) {
25
25
  const pageCount = max - 2;
26
26
  return [...getPageComponents(0, 1), ellipsis({
27
- key: 'elipses-1'
27
+ key: 'ellipsis-1',
28
+ testId: `${testId}-ellipsis`
28
29
  }), ...getPageComponents(total - pageCount)];
29
30
  }
30
31
 
31
32
  if (!hasStartEllipsis && hasEndEllipsis) {
32
33
  const pageCount = max - 2;
33
34
  return [...getPageComponents(0, pageCount), ellipsis({
34
- key: 'elipses-1'
35
+ key: 'ellipsis-1',
36
+ testId: `${testId}-ellipsis`
35
37
  }), ...getPageComponents(total - 1)];
36
38
  } // we have both start and end ellipsis
37
39
 
38
40
 
39
41
  const pageCount = max - 4;
40
42
  return [...getPageComponents(0, 1), ellipsis({
41
- key: 'elipses-1'
43
+ key: 'ellipsis-1',
44
+ testId: `${testId}-ellipsis`
42
45
  }), ...getPageComponents(current - Math.floor(pageCount / 2), current + pageCount - 1), ellipsis({
43
- key: 'elipses-2'
46
+ key: 'ellipsis-2',
47
+ testId: `${testId}-ellipsis`
44
48
  }), ...getPageComponents(total - 1)];
45
49
  };
46
50
 
@@ -1,7 +1,7 @@
1
- /** @jsx jsx */
2
- import { forwardRef, memo } from 'react';
3
- import { css, jsx } from '@emotion/react';
1
+ import React, { forwardRef, memo } from 'react';
4
2
  import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
3
+ import Box from '@atlaskit/ds-explorations/box';
4
+ import Inline from '@atlaskit/ds-explorations/inline';
5
5
  import noop from '@atlaskit/ds-lib/noop';
6
6
  import useControlled from '@atlaskit/ds-lib/use-controlled';
7
7
  import ChevronLeftLargeIcon from '@atlaskit/icon/glyph/chevron-left-large';
@@ -14,11 +14,8 @@ import collapseRange from './internal/utils/collapse-range';
14
14
  const analyticsAttributes = {
15
15
  componentName: 'pagination',
16
16
  packageName: "@atlaskit/pagination",
17
- packageVersion: "14.2.2"
17
+ packageVersion: "14.2.4"
18
18
  };
19
- const navStyles = css({
20
- display: 'flex'
21
- });
22
19
 
23
20
  function InnerPagination({
24
21
  components = emptyObject,
@@ -60,7 +57,7 @@ function InnerPagination({
60
57
 
61
58
  const transform = (page, currPageIndex, testId) => {
62
59
  const selectedPage = pages[selectedIndexValue];
63
- return jsx(PageComponent, {
60
+ return /*#__PURE__*/React.createElement(PageComponent, {
64
61
  key: `page-${getPageLabel ? getPageLabel(page, currPageIndex) : currPageIndex}`,
65
62
  component: components.Page,
66
63
  onClick: event => onChangeWithAnalytics({
@@ -73,13 +70,16 @@ function InnerPagination({
73
70
  }, getPageLabel ? getPageLabel(page, currPageIndex) : page);
74
71
  };
75
72
 
76
- return jsx("nav", {
77
- "data-testid": testId,
78
- css: navStyles,
79
- style: style,
73
+ return /*#__PURE__*/React.createElement(Box, {
74
+ testId: testId,
75
+ UNSAFE_style: style,
80
76
  ref: ref,
81
- "aria-label": label
82
- }, jsx(Navigator, {
77
+ "aria-label": label,
78
+ as: "nav"
79
+ }, /*#__PURE__*/React.createElement(Inline, {
80
+ gap: "scale.0",
81
+ alignItems: "center"
82
+ }, /*#__PURE__*/React.createElement(Navigator, {
83
83
  key: "left-navigator",
84
84
  component: components.Previous,
85
85
  onClick: event => onChangeWithAnalytics({
@@ -87,7 +87,7 @@ function InnerPagination({
87
87
  selectedPageIndex: selectedIndexValue - 1
88
88
  }),
89
89
  isDisabled: selectedIndexValue === 0,
90
- iconBefore: jsx(ChevronLeftLargeIcon, {
90
+ iconBefore: /*#__PURE__*/React.createElement(ChevronLeftLargeIcon, {
91
91
  label: ""
92
92
  }),
93
93
  "aria-label": previousLabel,
@@ -97,7 +97,7 @@ function InnerPagination({
97
97
  max: max,
98
98
  ellipsis: renderEllipsis,
99
99
  transform
100
- }, testId), jsx(Navigator, {
100
+ }, testId), /*#__PURE__*/React.createElement(Navigator, {
101
101
  key: "right-navigator",
102
102
  component: components.Next,
103
103
  onClick: event => onChangeWithAnalytics({
@@ -105,13 +105,13 @@ function InnerPagination({
105
105
  selectedPageIndex: selectedIndexValue + 1
106
106
  }),
107
107
  isDisabled: selectedIndexValue === pages.length - 1,
108
- iconBefore: jsx(ChevronRightLargeIcon, {
108
+ iconBefore: /*#__PURE__*/React.createElement(ChevronRightLargeIcon, {
109
109
  label: ""
110
110
  }),
111
111
  "aria-label": nextLabel,
112
112
  pages: pages,
113
113
  testId: testId && `${testId}--right-navigator`
114
- }));
114
+ })));
115
115
  }
116
116
 
117
117
  const Pagination = /*#__PURE__*/forwardRef(InnerPagination);
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/pagination",
3
- "version": "14.2.2",
3
+ "version": "14.2.4",
4
4
  "sideEffects": false
5
5
  }
@@ -1,20 +1,9 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
-
3
- /** @jsx jsx */
4
2
  import React from 'react';
5
- import { css, jsx } from '@emotion/react';
6
3
  import Button from '@atlaskit/button/standard-button';
7
- var navigatorStyles = css({
8
- // TODO Delete this comment after verifying spacing token -> previous value `gridSize / 2`
9
- paddingRight: "var(--ds-scale-050, 4px)",
10
- // TODO Delete this comment after verifying spacing token -> previous value `gridSize / 2`
11
- paddingLeft: "var(--ds-scale-050, 4px)"
12
- });
13
4
  export default function Navigator(props) {
14
- return jsx(Button // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
5
+ return /*#__PURE__*/React.createElement(Button // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
15
6
  , _extends({}, props, {
16
- appearance: "subtle",
17
- spacing: "none",
18
- css: navigatorStyles
7
+ appearance: "subtle"
19
8
  }));
20
9
  }
@@ -1,15 +1,16 @@
1
- /** @jsx jsx */
2
- import { css, jsx } from '@emotion/react';
3
- var ellipsisStyles = css({
4
- display: 'inline-flex',
5
- padding: "var(--ds-scale-0, 0px)".concat(" ", "var(--ds-scale-100, 8px)"),
6
- alignItems: 'center',
7
- textAlign: 'center'
8
- });
1
+ import React from 'react';
2
+ import Box from '@atlaskit/ds-explorations/box';
3
+ import Text from '@atlaskit/ds-explorations/text';
9
4
  export default function renderEllipsis(_ref) {
10
- var key = _ref.key;
11
- return jsx("span", {
5
+ var key = _ref.key,
6
+ testId = _ref.testId;
7
+ return /*#__PURE__*/React.createElement(Box, {
8
+ as: "span",
9
+ testId: testId,
12
10
  key: key,
13
- css: ellipsisStyles
14
- }, "...");
11
+ paddingInline: "scale.100"
12
+ }, /*#__PURE__*/React.createElement(Text, {
13
+ testId: "".concat(testId, "-text"),
14
+ verticalAlign: "middle"
15
+ }, "..."));
15
16
  }
@@ -29,7 +29,8 @@ var collapseRange = function collapseRange(pages, current, _ref, testId) {
29
29
  var _pageCount = max - 2;
30
30
 
31
31
  return [].concat(_toConsumableArray(getPageComponents(0, 1)), [ellipsis({
32
- key: 'elipses-1'
32
+ key: 'ellipsis-1',
33
+ testId: "".concat(testId, "-ellipsis")
33
34
  })], _toConsumableArray(getPageComponents(total - _pageCount)));
34
35
  }
35
36
 
@@ -37,16 +38,19 @@ var collapseRange = function collapseRange(pages, current, _ref, testId) {
37
38
  var _pageCount2 = max - 2;
38
39
 
39
40
  return [].concat(_toConsumableArray(getPageComponents(0, _pageCount2)), [ellipsis({
40
- key: 'elipses-1'
41
+ key: 'ellipsis-1',
42
+ testId: "".concat(testId, "-ellipsis")
41
43
  })], _toConsumableArray(getPageComponents(total - 1)));
42
44
  } // we have both start and end ellipsis
43
45
 
44
46
 
45
47
  var pageCount = max - 4;
46
48
  return [].concat(_toConsumableArray(getPageComponents(0, 1)), [ellipsis({
47
- key: 'elipses-1'
49
+ key: 'ellipsis-1',
50
+ testId: "".concat(testId, "-ellipsis")
48
51
  })], _toConsumableArray(getPageComponents(current - Math.floor(pageCount / 2), current + pageCount - 1)), [ellipsis({
49
- key: 'elipses-2'
52
+ key: 'ellipsis-2',
53
+ testId: "".concat(testId, "-ellipsis")
50
54
  })], _toConsumableArray(getPageComponents(total - 1)));
51
55
  };
52
56
 
@@ -5,10 +5,10 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
5
5
 
6
6
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
7
7
 
8
- /** @jsx jsx */
9
- import { forwardRef, memo } from 'react';
10
- import { css, jsx } from '@emotion/react';
8
+ import React, { forwardRef, memo } from 'react';
11
9
  import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
10
+ import Box from '@atlaskit/ds-explorations/box';
11
+ import Inline from '@atlaskit/ds-explorations/inline';
12
12
  import noop from '@atlaskit/ds-lib/noop';
13
13
  import useControlled from '@atlaskit/ds-lib/use-controlled';
14
14
  import ChevronLeftLargeIcon from '@atlaskit/icon/glyph/chevron-left-large';
@@ -21,11 +21,8 @@ import collapseRange from './internal/utils/collapse-range';
21
21
  var analyticsAttributes = {
22
22
  componentName: 'pagination',
23
23
  packageName: "@atlaskit/pagination",
24
- packageVersion: "14.2.2"
24
+ packageVersion: "14.2.4"
25
25
  };
26
- var navStyles = css({
27
- display: 'flex'
28
- });
29
26
 
30
27
  function InnerPagination(_ref, ref) {
31
28
  var _ref$components = _ref.components,
@@ -79,7 +76,7 @@ function InnerPagination(_ref, ref) {
79
76
 
80
77
  var transform = function transform(page, currPageIndex, testId) {
81
78
  var selectedPage = pages[selectedIndexValue];
82
- return jsx(PageComponent, {
79
+ return /*#__PURE__*/React.createElement(PageComponent, {
83
80
  key: "page-".concat(getPageLabel ? getPageLabel(page, currPageIndex) : currPageIndex),
84
81
  component: components.Page,
85
82
  onClick: function onClick(event) {
@@ -94,13 +91,16 @@ function InnerPagination(_ref, ref) {
94
91
  }, getPageLabel ? getPageLabel(page, currPageIndex) : page);
95
92
  };
96
93
 
97
- return jsx("nav", {
98
- "data-testid": testId,
99
- css: navStyles,
100
- style: style,
94
+ return /*#__PURE__*/React.createElement(Box, {
95
+ testId: testId,
96
+ UNSAFE_style: style,
101
97
  ref: ref,
102
- "aria-label": label
103
- }, jsx(Navigator, {
98
+ "aria-label": label,
99
+ as: "nav"
100
+ }, /*#__PURE__*/React.createElement(Inline, {
101
+ gap: "scale.0",
102
+ alignItems: "center"
103
+ }, /*#__PURE__*/React.createElement(Navigator, {
104
104
  key: "left-navigator",
105
105
  component: components.Previous,
106
106
  onClick: function onClick(event) {
@@ -110,7 +110,7 @@ function InnerPagination(_ref, ref) {
110
110
  });
111
111
  },
112
112
  isDisabled: selectedIndexValue === 0,
113
- iconBefore: jsx(ChevronLeftLargeIcon, {
113
+ iconBefore: /*#__PURE__*/React.createElement(ChevronLeftLargeIcon, {
114
114
  label: ""
115
115
  }),
116
116
  "aria-label": previousLabel,
@@ -120,7 +120,7 @@ function InnerPagination(_ref, ref) {
120
120
  max: max,
121
121
  ellipsis: renderEllipsis,
122
122
  transform: transform
123
- }, testId), jsx(Navigator, {
123
+ }, testId), /*#__PURE__*/React.createElement(Navigator, {
124
124
  key: "right-navigator",
125
125
  component: components.Next,
126
126
  onClick: function onClick(event) {
@@ -130,13 +130,13 @@ function InnerPagination(_ref, ref) {
130
130
  });
131
131
  },
132
132
  isDisabled: selectedIndexValue === pages.length - 1,
133
- iconBefore: jsx(ChevronRightLargeIcon, {
133
+ iconBefore: /*#__PURE__*/React.createElement(ChevronRightLargeIcon, {
134
134
  label: ""
135
135
  }),
136
136
  "aria-label": nextLabel,
137
137
  pages: pages,
138
138
  testId: testId && "".concat(testId, "--right-navigator")
139
- }));
139
+ })));
140
140
  }
141
141
 
142
142
  var Pagination = /*#__PURE__*/forwardRef(InnerPagination);
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/pagination",
3
- "version": "14.2.2",
3
+ "version": "14.2.4",
4
4
  "sideEffects": false
5
5
  }
@@ -1,6 +1,4 @@
1
- /** @jsx jsx */
2
1
  import React, { ReactElement, SyntheticEvent } from 'react';
3
- import { jsx } from '@emotion/react';
4
2
  export declare type NavigatorProps<T> = {
5
3
  /**
6
4
  * This will be passed in as aria-label to button. This is what screen reader will read
@@ -19,4 +17,4 @@ export declare type NavigatorProps<T> = {
19
17
  onClick?: (event: SyntheticEvent) => void;
20
18
  component?: React.ElementType<any>;
21
19
  };
22
- export default function Navigator<T>(props: NavigatorProps<T>): jsx.JSX.Element;
20
+ export default function Navigator<T>(props: NavigatorProps<T>): JSX.Element;
@@ -1,6 +1,6 @@
1
- /** @jsx jsx */
2
1
  import { ReactElement } from 'react';
3
2
  export declare type EllipsisProp = {
4
3
  key: string;
4
+ testId?: string;
5
5
  };
6
- export default function renderEllipsis({ key }: EllipsisProp): ReactElement;
6
+ export default function renderEllipsis({ key, testId, }: EllipsisProp): ReactElement;
@@ -3,6 +3,7 @@ declare const collapseRange: <T>(pages: T[], current: number, { max, ellipsis, t
3
3
  max: number;
4
4
  ellipsis: (arg: {
5
5
  key: string;
6
+ testId: string;
6
7
  }) => ReactElement;
7
8
  transform: (page: T, index: number, testId?: string | undefined) => ReactElement;
8
9
  }, testId?: string | undefined) => ReactElement[];
@@ -1,6 +1,5 @@
1
- /// <reference types="react" />
2
- import { jsx } from '@emotion/react';
1
+ import React from 'react';
3
2
  import { PaginationPropTypes } from './types';
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;
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;
5
4
  declare const _default: typeof InnerPagination;
6
5
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/pagination",
3
- "version": "14.2.2",
3
+ "version": "14.2.4",
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,14 +13,6 @@
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.0 <4.5": {
18
- "*": [
19
- "dist/types-ts4.0/*",
20
- "dist/types-ts4.0/index.d.ts"
21
- ]
22
- }
23
- },
24
16
  "sideEffects": false,
25
17
  "atlaskit:src": "src/index.tsx",
26
18
  "af:exports": {
@@ -38,22 +30,23 @@
38
30
  },
39
31
  "dependencies": {
40
32
  "@atlaskit/analytics-next": "^8.0.0",
41
- "@atlaskit/button": "^16.3.0",
33
+ "@atlaskit/button": "^16.4.0",
42
34
  "@atlaskit/codemod-utils": "^4.1.0",
35
+ "@atlaskit/ds-explorations": "^1.2.0",
43
36
  "@atlaskit/ds-lib": "^2.1.0",
44
37
  "@atlaskit/icon": "^21.11.0",
45
- "@atlaskit/tokens": "^0.10.27",
46
38
  "@babel/runtime": "^7.0.0",
47
- "@emotion/react": "^11.7.1",
48
39
  "memoize-one": "^6.0.0"
49
40
  },
50
41
  "peerDependencies": {
51
42
  "react": "^16.8.0"
52
43
  },
53
44
  "devDependencies": {
45
+ "@atlaskit/code": "^14.4.1",
54
46
  "@atlaskit/docs": "*",
55
47
  "@atlaskit/ds-lib": "^2.1.0",
56
48
  "@atlaskit/dynamic-table": "^14.8.0",
49
+ "@atlaskit/heading": "^1.0.0",
57
50
  "@atlaskit/section-message": "^6.3.0",
58
51
  "@atlaskit/ssr": "*",
59
52
  "@atlaskit/visual-regression": "*",
@@ -77,9 +70,14 @@
77
70
  "@repo/internal": {
78
71
  "design-system": "v1",
79
72
  "dom-events": "use-bind-event-listener",
80
- "ui-components": "lite-mode",
73
+ "ui-components": [
74
+ "primitives",
75
+ "lite-mode"
76
+ ],
81
77
  "analytics": "analytics-next",
82
- "design-tokens": "spacing",
78
+ "design-tokens": [
79
+ "spacing"
80
+ ],
83
81
  "theming": "tokens",
84
82
  "deprecation": "no-deprecated-imports",
85
83
  "styling": [
package/report.api.md CHANGED
@@ -1,6 +1,10 @@
1
- ## API Report File for "@atlaskit/pagination".
1
+ ## API Report File for "@atlaskit/pagination"
2
2
 
3
- > Do not edit this file. This report is auto-generated by [API Extractor](https://api-extractor.com/).
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ <!--
6
+ Generated API Report version: 2.0
7
+ -->
4
8
 
5
9
  [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
6
10
 
@@ -13,10 +17,12 @@ import type { ReactElement } from 'react';
13
17
  import type { SyntheticEvent } from 'react';
14
18
  import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
15
19
 
16
- declare const _default: typeof InnerPagination;
20
+ // @public (undocumented)
21
+ const _default: typeof InnerPagination;
17
22
  export default _default;
18
23
 
19
- declare function InnerPagination<T>(
24
+ // @public (undocumented)
25
+ function InnerPagination<T>(
20
26
  {
21
27
  components,
22
28
  defaultSelectedIndex,
@@ -36,81 +42,31 @@ declare function InnerPagination<T>(
36
42
  ref: React.Ref<HTMLDivElement>,
37
43
  ): jsx.JSX.Element;
38
44
 
39
- export declare interface PaginationPropTypes<T = unknown> {
40
- /**
41
- * Replace the built-in Page, Previous, Next and/ or Ellipsis component
42
- */
45
+ // @public (undocumented)
46
+ export interface PaginationPropTypes<T = unknown> {
47
+ analyticsContext?: Record<string, any>;
43
48
  components?: {
44
49
  Page?: React.ElementType;
45
50
  Previous?: React.ElementType;
46
51
  Next?: React.ElementType;
47
52
  };
48
- /**
49
- * Index of the page to be selected by default
50
- */
51
53
  defaultSelectedIndex?: number;
52
- /**
53
- * Helper function to get text displayed on the page button. It is helpful in scenarios when page the page passed in is an object
54
- */
55
54
  getPageLabel?: (page: T, pageIndex: number) => number | string;
56
- /**
57
- * The aria-label for the pagination wrapper
58
- */
59
55
  label?: string;
60
- /**
61
- * The aria-label for the next button
62
- */
63
- nextLabel?: string;
64
- /**
65
- * The aria-label for the previous button
66
- */
67
- previousLabel?: string;
68
- /**
69
- * Style to spread on the container element
70
- */
71
- style?: CSSProperties;
72
- /**
73
- * Maximum number of pages to be displayed in the pagination
74
- */
75
56
  max?: number;
76
- /**
77
- * The onChange handler which is called when the page is changed
78
- */
57
+ nextLabel?: string;
79
58
  onChange?: (
80
59
  event: SyntheticEvent,
81
60
  page: T,
82
61
  analyticsEvent?: UIAnalyticsEvent,
83
62
  ) => void;
84
- /**
85
- * Array of the pages to display
86
- */
87
63
  pages: T[];
88
- /**
89
- * Index of the selected page. This will make this pagination controlled
90
- */
91
- selectedIndex?: number;
92
- /**
93
- * The react Node returned from the function is rendered instead of the default ellipsis node
94
- */
64
+ previousLabel?: string;
95
65
  renderEllipsis?: (arg: { key: string }) => ReactElement;
96
- /**
97
- * Additional information to be included in the `context` of analytics events
98
- */
99
- analyticsContext?: Record<string, any>;
100
- /**
101
- * A `testId` prop is provided for specified elements,
102
- * which is a unique string that appears as a data attribute `data-testid`
103
- * in the rendered code, serving as a hook for automated tests.
104
- *
105
- * Will set data-testid on these elements when defined:
106
- * - Pagination nav wrapper - {testId}
107
- * - Page - {testId}--page-{page index}
108
- * - Current page - {testId}--current-page-{page index}
109
- * - Left navigator - {testId}--left-navigator
110
- * - Right navigator - {testId}--right-navigator
111
- */
66
+ selectedIndex?: number;
67
+ style?: CSSProperties;
112
68
  testId?: string;
113
69
  }
114
70
 
115
- export {};
71
+ // (No @packageDocumentation comment for this package)
116
72
  ```
@@ -1 +0,0 @@
1
- export type { PaginationPropTypes } from '../types';
@@ -1,2 +0,0 @@
1
- export { default } from './pagination';
2
- export type { PaginationPropTypes } from './types';
@@ -1,22 +0,0 @@
1
- /** @jsx jsx */
2
- import React, { ReactElement, SyntheticEvent } from 'react';
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
- */
8
- 'aria-label'?: string;
9
- /**
10
- * Is the navigator disabled
11
- */
12
- isDisabled?: boolean;
13
- iconBefore: ReactElement;
14
- pages: T[];
15
- testId?: string;
16
- /**
17
- * This function is called with the when user clicks on navigator
18
- */
19
- onClick?: (event: SyntheticEvent) => void;
20
- component?: React.ElementType<any>;
21
- };
22
- export default function Navigator<T>(props: NavigatorProps<T>): jsx.JSX.Element;
@@ -1,17 +0,0 @@
1
- /// <reference types="react" />
2
- import { ButtonProps } from '@atlaskit/button/standard-button';
3
- import type { Appearance } from '@atlaskit/button/types';
4
- declare type Diff<T, U> = T extends U ? never : T;
5
- declare 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 {};
@@ -1,6 +0,0 @@
1
- /** @jsx jsx */
2
- import { ReactElement } from 'react';
3
- export declare type EllipsisProp = {
4
- key: string;
5
- };
6
- export default function renderEllipsis({ key }: EllipsisProp): ReactElement;
@@ -1 +0,0 @@
1
- export declare const emptyObject: {};
@@ -1,9 +0,0 @@
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
- }) => ReactElement;
7
- transform: (page: T, index: number, testId?: string | undefined) => ReactElement;
8
- }, testId?: string | undefined) => ReactElement[];
9
- export default collapseRange;
@@ -1,6 +0,0 @@
1
- /// <reference types="react" />
2
- import { jsx } from '@emotion/react';
3
- import { PaginationPropTypes } from './types';
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;
5
- declare const _default: typeof InnerPagination;
6
- export default _default;
@@ -1,75 +0,0 @@
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
- }