@atlaskit/pagination 14.2.3 → 14.2.5
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 +14 -0
- package/dist/cjs/internal/components/navigator.js +2 -14
- package/dist/cjs/internal/components/render-ellipsis.js +16 -12
- package/dist/cjs/internal/utils/collapse-range.js +8 -4
- package/dist/cjs/pagination.js +26 -18
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/internal/components/navigator.js +2 -13
- package/dist/es2019/internal/components/render-ellipsis.js +13 -12
- package/dist/es2019/internal/utils/collapse-range.js +8 -4
- package/dist/es2019/pagination.js +18 -18
- package/dist/es2019/version.json +1 -1
- package/dist/esm/internal/components/navigator.js +2 -13
- package/dist/esm/internal/components/render-ellipsis.js +13 -12
- package/dist/esm/internal/utils/collapse-range.js +8 -4
- package/dist/esm/pagination.js +18 -18
- package/dist/esm/version.json +1 -1
- package/dist/types/internal/components/navigator.d.ts +1 -3
- package/dist/types/internal/components/render-ellipsis.d.ts +2 -2
- package/dist/types/internal/utils/collapse-range.d.ts +1 -0
- package/dist/types/pagination.d.ts +2 -3
- package/package.json +12 -6
- package/report.api.md +15 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/pagination
|
|
2
2
|
|
|
3
|
+
## 14.2.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`207726a4cb2`](https://bitbucket.org/atlassian/atlassian-frontend/commits/207726a4cb2) - [ux] Replace ellipsis made with three periods (...) with ellipsis character (…)
|
|
8
|
+
|
|
9
|
+
## 14.2.4
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`87991a69644`](https://bitbucket.org/atlassian/atlassian-frontend/commits/87991a69644) - - Remove @atlaskit/tokens as a dependency.
|
|
14
|
+
- Remove @emotion/react as a dependency.
|
|
15
|
+
- Remove padding on navigator button in favor of default button sizing.
|
|
16
|
+
|
|
3
17
|
## 14.2.3
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -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
|
|
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("
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
11
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
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
|
-
|
|
23
|
-
},
|
|
23
|
+
paddingInline: "scale.100"
|
|
24
|
+
}, /*#__PURE__*/_react.default.createElement(_text.default, {
|
|
25
|
+
testId: "".concat(testId, "-text"),
|
|
26
|
+
verticalAlign: "middle"
|
|
27
|
+
}, "\u2026"));
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
63
|
+
key: 'ellipsis-2',
|
|
64
|
+
testId: "".concat(testId, "-ellipsis")
|
|
61
65
|
})], (0, _toConsumableArray2.default)(getPageComponents(total - 1)));
|
|
62
66
|
};
|
|
63
67
|
|
package/dist/cjs/pagination.js
CHANGED
|
@@ -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.
|
|
53
|
+
packageVersion: "14.2.5"
|
|
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
|
|
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 (
|
|
119
|
-
|
|
120
|
-
|
|
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
|
-
|
|
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:
|
|
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),
|
|
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:
|
|
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);
|
package/dist/cjs/version.json
CHANGED
|
@@ -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
|
|
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
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
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
|
|
8
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
9
|
+
as: "span",
|
|
10
|
+
testId: testId,
|
|
13
11
|
key: key,
|
|
14
|
-
|
|
15
|
-
},
|
|
12
|
+
paddingInline: "scale.100"
|
|
13
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
14
|
+
testId: `${testId}-text`,
|
|
15
|
+
verticalAlign: "middle"
|
|
16
|
+
}, "\u2026"));
|
|
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: '
|
|
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: '
|
|
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: '
|
|
43
|
+
key: 'ellipsis-1',
|
|
44
|
+
testId: `${testId}-ellipsis`
|
|
42
45
|
}), ...getPageComponents(current - Math.floor(pageCount / 2), current + pageCount - 1), ellipsis({
|
|
43
|
-
key: '
|
|
46
|
+
key: 'ellipsis-2',
|
|
47
|
+
testId: `${testId}-ellipsis`
|
|
44
48
|
}), ...getPageComponents(total - 1)];
|
|
45
49
|
};
|
|
46
50
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
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.
|
|
17
|
+
packageVersion: "14.2.5"
|
|
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
|
|
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
|
|
77
|
-
|
|
78
|
-
|
|
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
|
-
|
|
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:
|
|
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),
|
|
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:
|
|
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);
|
package/dist/es2019/version.json
CHANGED
|
@@ -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
|
|
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
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
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
|
-
|
|
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
|
-
|
|
14
|
-
},
|
|
11
|
+
paddingInline: "scale.100"
|
|
12
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
13
|
+
testId: "".concat(testId, "-text"),
|
|
14
|
+
verticalAlign: "middle"
|
|
15
|
+
}, "\u2026"));
|
|
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: '
|
|
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: '
|
|
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: '
|
|
49
|
+
key: 'ellipsis-1',
|
|
50
|
+
testId: "".concat(testId, "-ellipsis")
|
|
48
51
|
})], _toConsumableArray(getPageComponents(current - Math.floor(pageCount / 2), current + pageCount - 1)), [ellipsis({
|
|
49
|
-
key: '
|
|
52
|
+
key: 'ellipsis-2',
|
|
53
|
+
testId: "".concat(testId, "-ellipsis")
|
|
50
54
|
})], _toConsumableArray(getPageComponents(total - 1)));
|
|
51
55
|
};
|
|
52
56
|
|
package/dist/esm/pagination.js
CHANGED
|
@@ -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
|
-
|
|
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.
|
|
24
|
+
packageVersion: "14.2.5"
|
|
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
|
|
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
|
|
98
|
-
|
|
99
|
-
|
|
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
|
-
|
|
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:
|
|
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),
|
|
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:
|
|
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);
|
package/dist/esm/version.json
CHANGED
|
@@ -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>):
|
|
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
|
-
|
|
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>):
|
|
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.
|
|
3
|
+
"version": "14.2.5",
|
|
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/"
|
|
@@ -30,22 +30,23 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@atlaskit/analytics-next": "^8.0.0",
|
|
33
|
-
"@atlaskit/button": "^16.
|
|
33
|
+
"@atlaskit/button": "^16.5.0",
|
|
34
34
|
"@atlaskit/codemod-utils": "^4.1.0",
|
|
35
|
+
"@atlaskit/ds-explorations": "^1.6.0",
|
|
35
36
|
"@atlaskit/ds-lib": "^2.1.0",
|
|
36
37
|
"@atlaskit/icon": "^21.11.0",
|
|
37
|
-
"@atlaskit/tokens": "^0.11.0",
|
|
38
38
|
"@babel/runtime": "^7.0.0",
|
|
39
|
-
"@emotion/react": "^11.7.1",
|
|
40
39
|
"memoize-one": "^6.0.0"
|
|
41
40
|
},
|
|
42
41
|
"peerDependencies": {
|
|
43
42
|
"react": "^16.8.0"
|
|
44
43
|
},
|
|
45
44
|
"devDependencies": {
|
|
45
|
+
"@atlaskit/code": "^14.4.1",
|
|
46
46
|
"@atlaskit/docs": "*",
|
|
47
47
|
"@atlaskit/ds-lib": "^2.1.0",
|
|
48
48
|
"@atlaskit/dynamic-table": "^14.8.0",
|
|
49
|
+
"@atlaskit/heading": "^1.0.0",
|
|
49
50
|
"@atlaskit/section-message": "^6.3.0",
|
|
50
51
|
"@atlaskit/ssr": "*",
|
|
51
52
|
"@atlaskit/visual-regression": "*",
|
|
@@ -69,9 +70,14 @@
|
|
|
69
70
|
"@repo/internal": {
|
|
70
71
|
"design-system": "v1",
|
|
71
72
|
"dom-events": "use-bind-event-listener",
|
|
72
|
-
"ui-components":
|
|
73
|
+
"ui-components": [
|
|
74
|
+
"primitives",
|
|
75
|
+
"lite-mode"
|
|
76
|
+
],
|
|
73
77
|
"analytics": "analytics-next",
|
|
74
|
-
"design-tokens":
|
|
78
|
+
"design-tokens": [
|
|
79
|
+
"spacing"
|
|
80
|
+
],
|
|
75
81
|
"theming": "tokens",
|
|
76
82
|
"deprecation": "no-deprecated-imports",
|
|
77
83
|
"styling": [
|
package/report.api.md
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
|
+
<!-- API Report Version: 2.3 -->
|
|
2
|
+
|
|
1
3
|
## API Report File for "@atlaskit/pagination"
|
|
2
4
|
|
|
3
|
-
> Do not edit this file.
|
|
5
|
+
> Do not edit this file. This report is auto-generated using [API Extractor](https://api-extractor.com/).
|
|
6
|
+
> [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
|
|
4
7
|
|
|
5
|
-
|
|
6
|
-
Generated API Report version: 2.0
|
|
7
|
-
-->
|
|
8
|
+
### Table of contents
|
|
8
9
|
|
|
9
|
-
[
|
|
10
|
+
- [Main Entry Types](#main-entry-types)
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
### Main Entry Types
|
|
13
|
+
|
|
14
|
+
<!--SECTION START: Main Entry Types-->
|
|
13
15
|
|
|
16
|
+
```ts
|
|
14
17
|
import type { CSSProperties } from 'react';
|
|
15
|
-
import {
|
|
18
|
+
import { default as React_2 } from 'react';
|
|
16
19
|
import type { ReactElement } from 'react';
|
|
17
20
|
import type { SyntheticEvent } from 'react';
|
|
18
21
|
import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
@@ -39,8 +42,8 @@ function InnerPagination<T>(
|
|
|
39
42
|
analyticsContext,
|
|
40
43
|
testId,
|
|
41
44
|
}: PaginationPropTypes<T>,
|
|
42
|
-
ref:
|
|
43
|
-
):
|
|
45
|
+
ref: React_2.Ref<HTMLDivElement>,
|
|
46
|
+
): JSX.Element;
|
|
44
47
|
|
|
45
48
|
// @public (undocumented)
|
|
46
49
|
export interface PaginationPropTypes<T = unknown> {
|
|
@@ -70,3 +73,5 @@ export interface PaginationPropTypes<T = unknown> {
|
|
|
70
73
|
|
|
71
74
|
// (No @packageDocumentation comment for this package)
|
|
72
75
|
```
|
|
76
|
+
|
|
77
|
+
<!--SECTION END: Main Entry Types-->
|