@elliemae/ds-pagination 2.3.0-next.3 → 3.0.0-alpha.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/dist/cjs/Pagination.js +50 -0
- package/dist/cjs/Pagination.js.map +7 -0
- package/dist/cjs/PaginationDataTestID.js +39 -0
- package/dist/cjs/PaginationDataTestID.js.map +7 -0
- package/dist/cjs/hooks/usePaginationSearch.js +60 -0
- package/dist/cjs/hooks/usePaginationSearch.js.map +7 -0
- package/dist/cjs/index.d.js +27 -0
- package/dist/cjs/index.d.js.map +7 -0
- package/dist/cjs/index.js +28 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/parts/PageNextButton.js +53 -0
- package/dist/cjs/parts/PageNextButton.js.map +7 -0
- package/dist/cjs/parts/PagePrevButton.js +52 -0
- package/dist/cjs/parts/PagePrevButton.js.map +7 -0
- package/dist/cjs/parts/PaginationContent.js +92 -0
- package/dist/cjs/parts/PaginationContent.js.map +7 -0
- package/dist/cjs/parts/Paginator.js +131 -0
- package/dist/cjs/parts/Paginator.js.map +7 -0
- package/dist/cjs/parts/PerPageSelector.js +103 -0
- package/dist/cjs/parts/PerPageSelector.js.map +7 -0
- package/dist/cjs/props.js +82 -0
- package/dist/cjs/props.js.map +7 -0
- package/dist/cjs/styled.js +113 -0
- package/dist/cjs/styled.js.map +7 -0
- package/dist/esm/Pagination.js +21 -0
- package/dist/esm/Pagination.js.map +7 -0
- package/dist/esm/PaginationDataTestID.js +10 -0
- package/dist/esm/PaginationDataTestID.js.map +7 -0
- package/{esm → dist/esm}/hooks/usePaginationSearch.js +16 -13
- package/dist/esm/hooks/usePaginationSearch.js.map +7 -0
- package/dist/esm/index.d.js +2 -0
- package/dist/esm/index.d.js.map +7 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/parts/PageNextButton.js +24 -0
- package/dist/esm/parts/PageNextButton.js.map +7 -0
- package/dist/esm/parts/PagePrevButton.js +23 -0
- package/dist/esm/parts/PagePrevButton.js.map +7 -0
- package/dist/esm/parts/PaginationContent.js +63 -0
- package/dist/esm/parts/PaginationContent.js.map +7 -0
- package/dist/esm/parts/Paginator.js +102 -0
- package/dist/esm/parts/Paginator.js.map +7 -0
- package/dist/esm/parts/PerPageSelector.js +74 -0
- package/dist/esm/parts/PerPageSelector.js.map +7 -0
- package/dist/esm/props.js +53 -0
- package/dist/esm/props.js.map +7 -0
- package/dist/esm/styled.js +84 -0
- package/dist/esm/styled.js.map +7 -0
- package/{types → dist/types}/Pagination.d.ts +1 -1
- package/{types → dist/types}/PaginationDataTestID.d.ts +0 -0
- package/{types → dist/types}/hooks/usePaginationSearch.d.ts +0 -0
- package/{types → dist/types}/index.d.ts +0 -0
- package/dist/types/parts/PageNextButton.d.ts +3 -0
- package/dist/types/parts/PagePrevButton.d.ts +3 -0
- package/dist/types/parts/PaginationContent.d.ts +3 -0
- package/dist/types/parts/Paginator.d.ts +4 -0
- package/dist/types/parts/PerPageSelector.d.ts +4 -0
- package/dist/types/props.d.ts +75 -0
- package/package.json +49 -43
- package/cjs/Pagination.js +0 -35
- package/cjs/PaginationDataTestID.js +0 -11
- package/cjs/hooks/usePaginationSearch.js +0 -32
- package/cjs/index.d.js +0 -2
- package/cjs/index.js +0 -10
- package/cjs/parts/PageNextButton.js +0 -33
- package/cjs/parts/PagePrevButton.js +0 -32
- package/cjs/parts/PaginationContent.js +0 -95
- package/cjs/parts/Paginator.js +0 -153
- package/cjs/parts/PerPageSelector.js +0 -102
- package/cjs/props.js +0 -53
- package/cjs/styled.js +0 -57
- package/esm/Pagination.js +0 -26
- package/esm/PaginationDataTestID.js +0 -7
- package/esm/index.d.js +0 -1
- package/esm/index.js +0 -1
- package/esm/parts/PageNextButton.js +0 -25
- package/esm/parts/PagePrevButton.js +0 -24
- package/esm/parts/PaginationContent.js +0 -85
- package/esm/parts/Paginator.js +0 -146
- package/esm/parts/PerPageSelector.js +0 -95
- package/esm/props.js +0 -48
- package/esm/styled.js +0 -40
- package/types/parts/PageNextButton.d.ts +0 -3
- package/types/parts/PagePrevButton.d.ts +0 -3
- package/types/parts/PaginationContent.d.ts +0 -3
- package/types/parts/Paginator.d.ts +0 -10
- package/types/parts/PerPageSelector.d.ts +0 -4
- package/types/props.d.ts +0 -20
- package/types/styled.d.ts +0 -16
package/package.json
CHANGED
|
@@ -1,55 +1,58 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-pagination",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-alpha.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Pagination",
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"module": "./dist/esm/index.js",
|
|
10
|
+
"main": "./dist/cjs/index.js",
|
|
11
|
+
"types": "./dist/types/index.d.ts",
|
|
9
12
|
"exports": {
|
|
10
13
|
".": {
|
|
11
|
-
"import": "./esm/index.js",
|
|
12
|
-
"require": "./cjs/index.js"
|
|
14
|
+
"import": "./dist/esm/index.js",
|
|
15
|
+
"require": "./dist/cjs/index.js"
|
|
13
16
|
},
|
|
14
17
|
"./styled": {
|
|
15
|
-
"import": "./esm/styled.js",
|
|
16
|
-
"require": "./cjs/styled.js"
|
|
18
|
+
"import": "./dist/esm/styled.js",
|
|
19
|
+
"require": "./dist/cjs/styled.js"
|
|
17
20
|
},
|
|
18
21
|
"./props": {
|
|
19
|
-
"import": "./esm/props.js",
|
|
20
|
-
"require": "./cjs/props.js"
|
|
22
|
+
"import": "./dist/esm/props.js",
|
|
23
|
+
"require": "./dist/cjs/props.js"
|
|
21
24
|
},
|
|
22
25
|
"./parts/PerPageSelector": {
|
|
23
|
-
"import": "./esm/parts/PerPageSelector.js",
|
|
24
|
-
"require": "./cjs/parts/PerPageSelector.js"
|
|
26
|
+
"import": "./dist/esm/parts/PerPageSelector.js",
|
|
27
|
+
"require": "./dist/cjs/parts/PerPageSelector.js"
|
|
25
28
|
},
|
|
26
29
|
"./parts/Paginator": {
|
|
27
|
-
"import": "./esm/parts/Paginator.js",
|
|
28
|
-
"require": "./cjs/parts/Paginator.js"
|
|
30
|
+
"import": "./dist/esm/parts/Paginator.js",
|
|
31
|
+
"require": "./dist/cjs/parts/Paginator.js"
|
|
29
32
|
},
|
|
30
33
|
"./parts/PaginationContent": {
|
|
31
|
-
"import": "./esm/parts/PaginationContent.js",
|
|
32
|
-
"require": "./cjs/parts/PaginationContent.js"
|
|
34
|
+
"import": "./dist/esm/parts/PaginationContent.js",
|
|
35
|
+
"require": "./dist/cjs/parts/PaginationContent.js"
|
|
33
36
|
},
|
|
34
37
|
"./parts/PagePrevButton": {
|
|
35
|
-
"import": "./esm/parts/PagePrevButton.js",
|
|
36
|
-
"require": "./cjs/parts/PagePrevButton.js"
|
|
38
|
+
"import": "./dist/esm/parts/PagePrevButton.js",
|
|
39
|
+
"require": "./dist/cjs/parts/PagePrevButton.js"
|
|
37
40
|
},
|
|
38
41
|
"./parts/PageNextButton": {
|
|
39
|
-
"import": "./esm/parts/PageNextButton.js",
|
|
40
|
-
"require": "./cjs/parts/PageNextButton.js"
|
|
42
|
+
"import": "./dist/esm/parts/PageNextButton.js",
|
|
43
|
+
"require": "./dist/cjs/parts/PageNextButton.js"
|
|
41
44
|
},
|
|
42
45
|
"./PaginationDataTestID": {
|
|
43
|
-
"import": "./esm/PaginationDataTestID.js",
|
|
44
|
-
"require": "./cjs/PaginationDataTestID.js"
|
|
46
|
+
"import": "./dist/esm/PaginationDataTestID.js",
|
|
47
|
+
"require": "./dist/cjs/PaginationDataTestID.js"
|
|
45
48
|
},
|
|
46
49
|
"./Pagination": {
|
|
47
|
-
"import": "./esm/Pagination.js",
|
|
48
|
-
"require": "./cjs/Pagination.js"
|
|
50
|
+
"import": "./dist/esm/Pagination.js",
|
|
51
|
+
"require": "./dist/cjs/Pagination.js"
|
|
49
52
|
},
|
|
50
53
|
"./hooks/usePaginationSearch": {
|
|
51
|
-
"import": "./esm/hooks/usePaginationSearch.js",
|
|
52
|
-
"require": "./cjs/hooks/usePaginationSearch.js"
|
|
54
|
+
"import": "./dist/esm/hooks/usePaginationSearch.js",
|
|
55
|
+
"require": "./dist/cjs/hooks/usePaginationSearch.js"
|
|
53
56
|
}
|
|
54
57
|
},
|
|
55
58
|
"sideEffects": [
|
|
@@ -61,25 +64,23 @@
|
|
|
61
64
|
"url": "https://git.elliemae.io/platform-ui/dimsum.git"
|
|
62
65
|
},
|
|
63
66
|
"engines": {
|
|
64
|
-
"
|
|
65
|
-
"node": ">=
|
|
67
|
+
"pnpm": ">=6",
|
|
68
|
+
"node": ">=16"
|
|
66
69
|
},
|
|
67
70
|
"author": "ICE MT",
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
71
|
+
"jestSonar": {
|
|
72
|
+
"sonar56x": true,
|
|
73
|
+
"reportPath": "reports",
|
|
74
|
+
"reportFile": "tests.xml",
|
|
75
|
+
"indent": 4
|
|
73
76
|
},
|
|
74
77
|
"dependencies": {
|
|
75
|
-
"@elliemae/ds-button": "
|
|
76
|
-
"@elliemae/ds-dropdownmenu": "
|
|
77
|
-
"@elliemae/ds-grid": "
|
|
78
|
-
"@elliemae/ds-icons": "
|
|
79
|
-
"@elliemae/ds-props-helpers": "
|
|
80
|
-
"@elliemae/ds-
|
|
81
|
-
"@elliemae/ds-truncated-tooltip-text": "2.3.0-next.3",
|
|
82
|
-
"@elliemae/ds-utilities": "2.3.0-next.3",
|
|
78
|
+
"@elliemae/ds-button": "3.0.0-alpha.0",
|
|
79
|
+
"@elliemae/ds-dropdownmenu": "3.0.0-alpha.0",
|
|
80
|
+
"@elliemae/ds-grid": "3.0.0-alpha.0",
|
|
81
|
+
"@elliemae/ds-icons": "3.0.0-alpha.0",
|
|
82
|
+
"@elliemae/ds-props-helpers": "3.0.0-alpha.0",
|
|
83
|
+
"@elliemae/ds-utilities": "3.0.0-alpha.0",
|
|
83
84
|
"memoize-one": "~5.1.1",
|
|
84
85
|
"react-desc": "~4.1.3"
|
|
85
86
|
},
|
|
@@ -96,7 +97,12 @@
|
|
|
96
97
|
},
|
|
97
98
|
"publishConfig": {
|
|
98
99
|
"access": "public",
|
|
99
|
-
"
|
|
100
|
-
|
|
100
|
+
"typeSafety": false
|
|
101
|
+
},
|
|
102
|
+
"scripts": {
|
|
103
|
+
"dev": "cross-env NODE_ENV=development node ../../scripts/build/build.mjs --watch",
|
|
104
|
+
"test": "node ../../scripts/testing/test.mjs",
|
|
105
|
+
"lint": "node ../../scripts/lint.mjs",
|
|
106
|
+
"build": "cross-env NODE_ENV=production node ../../scripts/build/build.mjs"
|
|
101
107
|
}
|
|
102
108
|
}
|
package/cjs/Pagination.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
6
|
-
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
|
-
require('core-js/modules/esnext.iterator.filter.js');
|
|
8
|
-
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
9
|
-
require('core-js/modules/esnext.iterator.for-each.js');
|
|
10
|
-
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
11
|
-
require('react');
|
|
12
|
-
var dsPropsHelpers = require('@elliemae/ds-props-helpers');
|
|
13
|
-
var PaginationContent = require('./parts/PaginationContent.js');
|
|
14
|
-
var props = require('./props.js');
|
|
15
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
16
|
-
|
|
17
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
18
|
-
|
|
19
|
-
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
20
|
-
|
|
21
|
-
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; }
|
|
22
|
-
|
|
23
|
-
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__default["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; }
|
|
24
|
-
|
|
25
|
-
const DSPagination = props$1 => {
|
|
26
|
-
const propsWithDefault = dsPropsHelpers.useMemoMergePropsWithDefault(props$1, props.defaultProps);
|
|
27
|
-
dsPropsHelpers.useValidateTypescriptPropTypes(propsWithDefault, props.propTypes);
|
|
28
|
-
return /*#__PURE__*/jsxRuntime.jsx(PaginationContent.PaginationContent, _objectSpread({}, propsWithDefault));
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const DSPaginationWithSchema = dsPropsHelpers.describe(DSPagination).description('DSPagination');
|
|
32
|
-
DSPaginationWithSchema.propTypes = props.propTypes;
|
|
33
|
-
|
|
34
|
-
exports.DSPagination = DSPagination;
|
|
35
|
-
exports.DSPaginationWithSchema = DSPaginationWithSchema;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const PAGINATION_DATA_TESTID = {
|
|
6
|
-
PREVIOUS_BUTTON: 'data-table-pagination-prev-button',
|
|
7
|
-
NEXT_BUTTON: 'data-table-pagination-next-button',
|
|
8
|
-
CONTAINER: 'data-table-pagination-container'
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
exports.PAGINATION_DATA_TESTID = PAGINATION_DATA_TESTID;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
require('core-js/modules/web.dom-collections.iterator.js');
|
|
6
|
-
var react = require('react');
|
|
7
|
-
|
|
8
|
-
const usePaginationSearch = (pageCount, actionRef) => {
|
|
9
|
-
const [searchValue, setSearchValue] = react.useState('');
|
|
10
|
-
const [shouldResetSearchValue, setShouldResetSearchValue] = react.useState(true);
|
|
11
|
-
const timeoutRef = react.useRef(null);
|
|
12
|
-
react.useEffect(() => {
|
|
13
|
-
if (searchValue !== '' && Number.parseInt(searchValue, 10) <= pageCount) {
|
|
14
|
-
actionRef.current.setActiveDescendant(searchValue);
|
|
15
|
-
actionRef.current.scrollOptionIntoView(searchValue);
|
|
16
|
-
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
17
|
-
|
|
18
|
-
}, [searchValue]);
|
|
19
|
-
const onKeyDown = react.useCallback(e => {
|
|
20
|
-
if (e.code.startsWith('Digit')) {
|
|
21
|
-
if (shouldResetSearchValue) setSearchValue(e.key);else setSearchValue(prevValue => prevValue + e.key);
|
|
22
|
-
setShouldResetSearchValue(false);
|
|
23
|
-
clearTimeout(timeoutRef.current);
|
|
24
|
-
timeoutRef.current = setTimeout(() => {
|
|
25
|
-
setShouldResetSearchValue(true);
|
|
26
|
-
}, 1000);
|
|
27
|
-
}
|
|
28
|
-
}, [shouldResetSearchValue]);
|
|
29
|
-
return onKeyDown;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
exports.usePaginationSearch = usePaginationSearch;
|
package/cjs/index.d.js
DELETED
package/cjs/index.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
|
-
require('react');
|
|
7
|
-
var dsIcons = require('@elliemae/ds-icons');
|
|
8
|
-
var PaginationDataTestID = require('../PaginationDataTestID.js');
|
|
9
|
-
var styled = require('../styled.js');
|
|
10
|
-
|
|
11
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
12
|
-
|
|
13
|
-
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
14
|
-
|
|
15
|
-
const PageNextButton = _ref => {
|
|
16
|
-
let {
|
|
17
|
-
onNextPage,
|
|
18
|
-
canNextPage
|
|
19
|
-
} = _ref;
|
|
20
|
-
return /*#__PURE__*/_jsx__default["default"](styled.PreviousNextPageButton, {
|
|
21
|
-
onClick: () => {
|
|
22
|
-
if (canNextPage) onNextPage();
|
|
23
|
-
},
|
|
24
|
-
disabled: !canNextPage,
|
|
25
|
-
buttonType: "raw",
|
|
26
|
-
"data-testid": PaginationDataTestID.PAGINATION_DATA_TESTID.NEXT_BUTTON,
|
|
27
|
-
HeaderComp: () => 'Page'
|
|
28
|
-
}, void 0, /*#__PURE__*/_jsx__default["default"](dsIcons.ChevronRight, {
|
|
29
|
-
color: canNextPage ? ['brand-primary', '700'] : ['neutral', '500']
|
|
30
|
-
}));
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
exports.PageNextButton = PageNextButton;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
|
-
require('react');
|
|
7
|
-
var dsIcons = require('@elliemae/ds-icons');
|
|
8
|
-
var PaginationDataTestID = require('../PaginationDataTestID.js');
|
|
9
|
-
var styled = require('../styled.js');
|
|
10
|
-
|
|
11
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
12
|
-
|
|
13
|
-
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
14
|
-
|
|
15
|
-
const PagePrevButton = _ref => {
|
|
16
|
-
let {
|
|
17
|
-
onPreviousPage,
|
|
18
|
-
canPreviousPage
|
|
19
|
-
} = _ref;
|
|
20
|
-
return /*#__PURE__*/_jsx__default["default"](styled.PreviousNextPageButton, {
|
|
21
|
-
onClick: () => {
|
|
22
|
-
if (canPreviousPage) onPreviousPage();
|
|
23
|
-
},
|
|
24
|
-
disabled: !canPreviousPage,
|
|
25
|
-
buttonType: "raw",
|
|
26
|
-
"data-testid": PaginationDataTestID.PAGINATION_DATA_TESTID.PREVIOUS_BUTTON
|
|
27
|
-
}, void 0, /*#__PURE__*/_jsx__default["default"](dsIcons.ChevronLeft, {
|
|
28
|
-
color: canPreviousPage ? ['brand-primary', '700'] : ['neutral', '500']
|
|
29
|
-
}));
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
exports.PagePrevButton = PagePrevButton;
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
6
|
-
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
|
-
require('core-js/modules/esnext.iterator.filter.js');
|
|
8
|
-
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
9
|
-
require('core-js/modules/esnext.iterator.for-each.js');
|
|
10
|
-
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
11
|
-
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
12
|
-
require('react');
|
|
13
|
-
var Grid = require('@elliemae/ds-grid');
|
|
14
|
-
var dsPropsHelpers = require('@elliemae/ds-props-helpers');
|
|
15
|
-
var styled = require('../styled.js');
|
|
16
|
-
var PerPageSelector = require('./PerPageSelector.js');
|
|
17
|
-
var Paginator = require('./Paginator.js');
|
|
18
|
-
var PaginationDataTestID = require('../PaginationDataTestID.js');
|
|
19
|
-
var PagePrevButton = require('./PagePrevButton.js');
|
|
20
|
-
var PageNextButton = require('./PageNextButton.js');
|
|
21
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
22
|
-
|
|
23
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
24
|
-
|
|
25
|
-
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
26
|
-
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
27
|
-
var Grid__default = /*#__PURE__*/_interopDefaultLegacy(Grid);
|
|
28
|
-
|
|
29
|
-
var _PaginationSeparator;
|
|
30
|
-
|
|
31
|
-
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; }
|
|
32
|
-
|
|
33
|
-
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__default["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; }
|
|
34
|
-
const PaginationContent = props => {
|
|
35
|
-
const {
|
|
36
|
-
pageIndex,
|
|
37
|
-
pageSize,
|
|
38
|
-
canPreviousPage,
|
|
39
|
-
canNextPage,
|
|
40
|
-
onPageSizeChange,
|
|
41
|
-
onNextPage,
|
|
42
|
-
onPreviousPage,
|
|
43
|
-
onPageChange,
|
|
44
|
-
pageCount,
|
|
45
|
-
showPerPageSelector,
|
|
46
|
-
pageDetails,
|
|
47
|
-
pageDetailsTitle,
|
|
48
|
-
perPageOptions,
|
|
49
|
-
maxPerPage,
|
|
50
|
-
perPageStep,
|
|
51
|
-
minPerPage,
|
|
52
|
-
width
|
|
53
|
-
} = props;
|
|
54
|
-
const globalAttributes = dsPropsHelpers.useGetGlobalAttributes(props);
|
|
55
|
-
return /*#__PURE__*/jsxRuntime.jsx(styled.PaginationContainer, _objectSpread(_objectSpread({
|
|
56
|
-
justifyContent: "center",
|
|
57
|
-
alignItems: "center",
|
|
58
|
-
width: width.toString(),
|
|
59
|
-
"data-testid": PaginationDataTestID.PAGINATION_DATA_TESTID.CONTAINER,
|
|
60
|
-
cols: ['minmax(auto, 80%)']
|
|
61
|
-
}, globalAttributes), {}, {
|
|
62
|
-
children: /*#__PURE__*/_jsx__default["default"](styled.PaginationWrapper, {}, void 0, showPerPageSelector && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
63
|
-
children: [/*#__PURE__*/_jsx__default["default"](PerPageSelector, {
|
|
64
|
-
pageSize: pageSize,
|
|
65
|
-
onPageSizeChange: onPageSizeChange,
|
|
66
|
-
perPageOptions: perPageOptions,
|
|
67
|
-
maxPerPage: maxPerPage,
|
|
68
|
-
perPageStep: perPageStep,
|
|
69
|
-
minPerPage: minPerPage
|
|
70
|
-
}), _PaginationSeparator || (_PaginationSeparator = /*#__PURE__*/_jsx__default["default"](styled.PaginationSeparator, {
|
|
71
|
-
mr: 24
|
|
72
|
-
}))]
|
|
73
|
-
}), /*#__PURE__*/_jsx__default["default"](Grid__default["default"], {
|
|
74
|
-
mr: "32px",
|
|
75
|
-
alignItems: "center",
|
|
76
|
-
style: {
|
|
77
|
-
gridAutoFlow: 'column'
|
|
78
|
-
}
|
|
79
|
-
}, void 0, /*#__PURE__*/_jsx__default["default"](PagePrevButton.PagePrevButton, {
|
|
80
|
-
canPreviousPage: canPreviousPage,
|
|
81
|
-
onPreviousPage: onPreviousPage
|
|
82
|
-
}), /*#__PURE__*/_jsx__default["default"](Paginator, {
|
|
83
|
-
pageCount: pageCount,
|
|
84
|
-
pageIndex: pageIndex,
|
|
85
|
-
onPageChange: onPageChange,
|
|
86
|
-
pageDetails: pageDetails,
|
|
87
|
-
pageDetailsTitle: pageDetailsTitle
|
|
88
|
-
}), /*#__PURE__*/_jsx__default["default"](PageNextButton.PageNextButton, {
|
|
89
|
-
canNextPage: canNextPage,
|
|
90
|
-
onNextPage: onNextPage
|
|
91
|
-
})))
|
|
92
|
-
}));
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
exports.PaginationContent = PaginationContent;
|
package/cjs/parts/Paginator.js
DELETED
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
4
|
-
require('core-js/modules/web.dom-collections.iterator.js');
|
|
5
|
-
require('core-js/modules/esnext.async-iterator.reduce.js');
|
|
6
|
-
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
|
-
require('core-js/modules/esnext.iterator.reduce.js');
|
|
8
|
-
require('core-js/modules/esnext.async-iterator.map.js');
|
|
9
|
-
require('core-js/modules/esnext.iterator.map.js');
|
|
10
|
-
var react = require('react');
|
|
11
|
-
var dsIcons = require('@elliemae/ds-icons');
|
|
12
|
-
var dsUtilities = require('@elliemae/ds-utilities');
|
|
13
|
-
var Grid = require('@elliemae/ds-grid');
|
|
14
|
-
var dsDropdownmenu = require('@elliemae/ds-dropdownmenu');
|
|
15
|
-
var dsTruncatedTooltipText = require('@elliemae/ds-truncated-tooltip-text');
|
|
16
|
-
var styled = require('../styled.js');
|
|
17
|
-
var usePaginationSearch = require('../hooks/usePaginationSearch.js');
|
|
18
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
19
|
-
|
|
20
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
21
|
-
|
|
22
|
-
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
23
|
-
var Grid__default = /*#__PURE__*/_interopDefaultLegacy(Grid);
|
|
24
|
-
|
|
25
|
-
var _div, _PaginationSeparator, _PaginationSeparator2, _PaginationSeparator3, _PaginationSeparator4;
|
|
26
|
-
|
|
27
|
-
const Paginator = props => {
|
|
28
|
-
var _span2;
|
|
29
|
-
|
|
30
|
-
const {
|
|
31
|
-
pageIndex,
|
|
32
|
-
pageCount,
|
|
33
|
-
onPageChange,
|
|
34
|
-
pageDetails,
|
|
35
|
-
pageDetailsTitle
|
|
36
|
-
} = props;
|
|
37
|
-
const [isOpened, setIsOpened] = react.useState(false);
|
|
38
|
-
const btnRef = react.useRef(null);
|
|
39
|
-
const pageInfoRef = react.useRef(null);
|
|
40
|
-
const longestPageDetail = pageDetails.reduce((acc, cur) => acc.length > cur.length ? acc : cur, '');
|
|
41
|
-
const {
|
|
42
|
-
width: btnWidth
|
|
43
|
-
} = dsUtilities.useOnElementResize(btnRef);
|
|
44
|
-
const {
|
|
45
|
-
width: txtWidth
|
|
46
|
-
} = dsUtilities.useOnElementResize(pageInfoRef);
|
|
47
|
-
const options = react.useMemo(() => new Array(pageCount).fill(0).map((_, index) => {
|
|
48
|
-
var _span;
|
|
49
|
-
|
|
50
|
-
const option = {
|
|
51
|
-
dsId: (index + 1).toString(),
|
|
52
|
-
label: (index + 1).toString(),
|
|
53
|
-
value: index + 1,
|
|
54
|
-
type: 'single'
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
if (pageDetails !== null && pageDetails !== void 0 && pageDetails.length) {
|
|
58
|
-
option.render = () => /*#__PURE__*/_jsx__default["default"](Grid__default["default"], {
|
|
59
|
-
cols: ['16px', "".concat(txtWidth + 16, "px"), 'auto'],
|
|
60
|
-
gutter: "xxs",
|
|
61
|
-
alignItems: "center"
|
|
62
|
-
}, void 0, pageIndex === index ? /*#__PURE__*/_jsx__default["default"](dsIcons.Checkmark, {
|
|
63
|
-
size: "s",
|
|
64
|
-
color: ['brand-primary', '600']
|
|
65
|
-
}) : _div || (_div = /*#__PURE__*/_jsx__default["default"]("div", {})), _span || (_span = /*#__PURE__*/_jsx__default["default"]("span", {}, void 0, index + 1)), /*#__PURE__*/_jsx__default["default"]("span", {
|
|
66
|
-
style: {
|
|
67
|
-
whiteSpace: 'nowrap',
|
|
68
|
-
textOverflow: 'ellipsis',
|
|
69
|
-
overflow: 'hidden'
|
|
70
|
-
}
|
|
71
|
-
}, void 0, pageDetails[index]));
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return option;
|
|
75
|
-
}), [pageCount, pageDetails, pageIndex, txtWidth]);
|
|
76
|
-
const actionRef = react.useRef({});
|
|
77
|
-
react.useEffect(() => {
|
|
78
|
-
if (isOpened) {
|
|
79
|
-
actionRef.current.setActiveDescendant((pageIndex + 1).toString());
|
|
80
|
-
actionRef.current.scrollOptionIntoView((pageIndex + 1).toString());
|
|
81
|
-
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
82
|
-
|
|
83
|
-
}, [isOpened]);
|
|
84
|
-
const onKeyDown = usePaginationSearch.usePaginationSearch(pageCount, actionRef);
|
|
85
|
-
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
86
|
-
children: [_PaginationSeparator || (_PaginationSeparator = /*#__PURE__*/_jsx__default["default"](styled.PaginationSeparator, {})), /*#__PURE__*/_jsx__default["default"](dsDropdownmenu.DSDropdownMenuV2, {
|
|
87
|
-
isOpened: isOpened,
|
|
88
|
-
options: options,
|
|
89
|
-
selectedOptions: {
|
|
90
|
-
[(pageIndex + 1).toString()]: true
|
|
91
|
-
},
|
|
92
|
-
onOptionClick: (_, clickedOption) => {
|
|
93
|
-
var _btnRef$current;
|
|
94
|
-
|
|
95
|
-
onPageChange(clickedOption.value);
|
|
96
|
-
setIsOpened(false);
|
|
97
|
-
(_btnRef$current = btnRef.current) === null || _btnRef$current === void 0 ? void 0 : _btnRef$current.focus();
|
|
98
|
-
},
|
|
99
|
-
onClickOutside: () => {
|
|
100
|
-
var _btnRef$current2;
|
|
101
|
-
|
|
102
|
-
setIsOpened(false);
|
|
103
|
-
(_btnRef$current2 = btnRef.current) === null || _btnRef$current2 === void 0 ? void 0 : _btnRef$current2.focus();
|
|
104
|
-
},
|
|
105
|
-
customOffset: [0, 2],
|
|
106
|
-
startPlacementPreference: "top-end",
|
|
107
|
-
actionRef: actionRef,
|
|
108
|
-
onKeyDown: onKeyDown,
|
|
109
|
-
minWidth: btnWidth + 23,
|
|
110
|
-
maxHeight: 300,
|
|
111
|
-
HeaderComp: () => pageDetailsTitle !== '' ? /*#__PURE__*/_jsx__default["default"](Grid__default["default"], {
|
|
112
|
-
cols: ["".concat(txtWidth + 50, "px"), '8px', 'auto']
|
|
113
|
-
}, void 0, /*#__PURE__*/_jsx__default["default"]("span", {
|
|
114
|
-
style: {
|
|
115
|
-
marginLeft: '8px'
|
|
116
|
-
}
|
|
117
|
-
}, void 0, "Page"), _PaginationSeparator2 || (_PaginationSeparator2 = /*#__PURE__*/_jsx__default["default"](styled.PaginationSeparator, {
|
|
118
|
-
height: "100%"
|
|
119
|
-
})), _span2 || (_span2 = /*#__PURE__*/_jsx__default["default"]("span", {}, void 0, pageDetailsTitle))) : 'Page'
|
|
120
|
-
}, void 0, /*#__PURE__*/_jsx__default["default"](styled.PaginationDropdownButton, {
|
|
121
|
-
buttonType: "raw",
|
|
122
|
-
onClick: () => setIsOpened(prev => !prev),
|
|
123
|
-
innerRef: btnRef
|
|
124
|
-
}, void 0, /*#__PURE__*/_jsx__default["default"](Grid__default["default"], {
|
|
125
|
-
gutter: "xxs",
|
|
126
|
-
alignItems: "center",
|
|
127
|
-
cols: pageDetails.length !== 0 ? ['auto', 'min-content', 'minmax(100px, 70%)', 'min-content'] : ['auto', 'min-content']
|
|
128
|
-
}, void 0, /*#__PURE__*/jsxRuntime.jsxs(Grid__default["default"], {
|
|
129
|
-
alignItems: "center",
|
|
130
|
-
gutter: "xxxs",
|
|
131
|
-
ref: pageInfoRef,
|
|
132
|
-
style: {
|
|
133
|
-
gridAutoFlow: 'column'
|
|
134
|
-
},
|
|
135
|
-
children: [/*#__PURE__*/_jsx__default["default"](styled.PaginationBoldText, {
|
|
136
|
-
fontSize: "18px"
|
|
137
|
-
}, void 0, pageIndex + 1), " / ", pageCount]
|
|
138
|
-
}), pageDetails.length !== 0 && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
139
|
-
children: [_PaginationSeparator3 || (_PaginationSeparator3 = /*#__PURE__*/_jsx__default["default"](styled.PaginationSeparator, {
|
|
140
|
-
height: "12px",
|
|
141
|
-
ml: "8px"
|
|
142
|
-
})), /*#__PURE__*/_jsx__default["default"](styled.PaginationBoldText, {
|
|
143
|
-
fontSize: "13px"
|
|
144
|
-
}, void 0, /*#__PURE__*/_jsx__default["default"](styled.InvisibleDetail, {}, void 0, longestPageDetail), /*#__PURE__*/_jsx__default["default"](styled.PaginationDetail, {}, void 0, /*#__PURE__*/_jsx__default["default"](dsTruncatedTooltipText.SimpleTruncatedTooltipText, {
|
|
145
|
-
value: pageDetails[pageIndex]
|
|
146
|
-
}, void 0, pageDetails[pageIndex])))]
|
|
147
|
-
}), /*#__PURE__*/_jsx__default["default"](dsIcons.ChevronDown, {
|
|
148
|
-
color: ['brand-primary', '700']
|
|
149
|
-
})))), _PaginationSeparator4 || (_PaginationSeparator4 = /*#__PURE__*/_jsx__default["default"](styled.PaginationSeparator, {}))]
|
|
150
|
-
});
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
module.exports = Paginator;
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
4
|
-
require('core-js/modules/esnext.async-iterator.map.js');
|
|
5
|
-
require('core-js/modules/esnext.iterator.map.js');
|
|
6
|
-
require('core-js/modules/web.dom-collections.iterator.js');
|
|
7
|
-
var react = require('react');
|
|
8
|
-
var memoize = require('memoize-one');
|
|
9
|
-
var dsUtilities = require('@elliemae/ds-utilities');
|
|
10
|
-
var dsDropdownmenu = require('@elliemae/ds-dropdownmenu');
|
|
11
|
-
var dsIcons = require('@elliemae/ds-icons');
|
|
12
|
-
var styled = require('../styled.js');
|
|
13
|
-
|
|
14
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
15
|
-
|
|
16
|
-
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
17
|
-
var memoize__default = /*#__PURE__*/_interopDefaultLegacy(memoize);
|
|
18
|
-
|
|
19
|
-
const generateOption = value => {
|
|
20
|
-
if (typeof value === 'object') {
|
|
21
|
-
return value;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return {
|
|
25
|
-
dsId: value.toString(),
|
|
26
|
-
value,
|
|
27
|
-
label: value.toString(),
|
|
28
|
-
type: 'single'
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const getOptions = memoize__default["default"]((step, min, max) => {
|
|
33
|
-
const options = dsUtilities.range(min, max + step, step).map(generateOption);
|
|
34
|
-
return min === 0 ? options.slice(1, options.length) : options;
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
const PerPageSelector = props => {
|
|
38
|
-
const [isOpened, setIsOpened] = react.useState(false);
|
|
39
|
-
const {
|
|
40
|
-
pageSize,
|
|
41
|
-
onPageSizeChange,
|
|
42
|
-
perPageOptions,
|
|
43
|
-
maxPerPage,
|
|
44
|
-
perPageStep,
|
|
45
|
-
minPerPage
|
|
46
|
-
} = props;
|
|
47
|
-
const options = react.useMemo(() => {
|
|
48
|
-
if (perPageOptions) return perPageOptions.map(generateOption);
|
|
49
|
-
return getOptions(perPageStep, minPerPage, maxPerPage);
|
|
50
|
-
}, [maxPerPage, minPerPage, perPageOptions, perPageStep]);
|
|
51
|
-
const actionRef = react.useRef({});
|
|
52
|
-
const btnRef = react.useRef(null);
|
|
53
|
-
react.useEffect(() => {
|
|
54
|
-
if (isOpened) {
|
|
55
|
-
actionRef.current.setActiveDescendant(pageSize.toString());
|
|
56
|
-
actionRef.current.scrollOptionIntoView(pageSize.toString());
|
|
57
|
-
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
58
|
-
|
|
59
|
-
}, [isOpened]);
|
|
60
|
-
const {
|
|
61
|
-
width
|
|
62
|
-
} = dsUtilities.useOnElementResize(btnRef);
|
|
63
|
-
return /*#__PURE__*/_jsx__default["default"](dsDropdownmenu.DSDropdownMenuV2, {
|
|
64
|
-
isOpened: isOpened,
|
|
65
|
-
options: options,
|
|
66
|
-
selectedOptions: {
|
|
67
|
-
[pageSize.toString()]: true
|
|
68
|
-
},
|
|
69
|
-
onOptionClick: (_, clickedOption) => {
|
|
70
|
-
var _btnRef$current;
|
|
71
|
-
|
|
72
|
-
onPageSizeChange(clickedOption.value);
|
|
73
|
-
setIsOpened(false);
|
|
74
|
-
(_btnRef$current = btnRef.current) === null || _btnRef$current === void 0 ? void 0 : _btnRef$current.focus();
|
|
75
|
-
},
|
|
76
|
-
onClickOutside: () => {
|
|
77
|
-
var _btnRef$current2;
|
|
78
|
-
|
|
79
|
-
setIsOpened(false);
|
|
80
|
-
(_btnRef$current2 = btnRef.current) === null || _btnRef$current2 === void 0 ? void 0 : _btnRef$current2.focus();
|
|
81
|
-
},
|
|
82
|
-
customOffset: [0, 2],
|
|
83
|
-
startPlacementPreference: "top-end",
|
|
84
|
-
actionRef: actionRef,
|
|
85
|
-
minWidth: width + 25,
|
|
86
|
-
maxHeight: 300,
|
|
87
|
-
HeaderComp: () => 'Per Page'
|
|
88
|
-
}, void 0, /*#__PURE__*/_jsx__default["default"]("div", {
|
|
89
|
-
style: {
|
|
90
|
-
marginLeft: '32px'
|
|
91
|
-
}
|
|
92
|
-
}, void 0, /*#__PURE__*/_jsx__default["default"](styled.PaginationDropdownButton, {
|
|
93
|
-
buttonType: "raw",
|
|
94
|
-
onClick: () => setIsOpened(prev => !prev),
|
|
95
|
-
"aria-pressed": isOpened,
|
|
96
|
-
innerRef: btnRef
|
|
97
|
-
}, void 0, pageSize, " / page", /*#__PURE__*/_jsx__default["default"](dsIcons.ChevronDown, {
|
|
98
|
-
color: ['brand-primary', '700']
|
|
99
|
-
}))));
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
module.exports = PerPageSelector;
|