@elliemae/ds-pagination 1.60.0 → 2.0.0-alpha.13
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/cjs/Pagination.js +21 -29
- package/cjs/PaginationDataTestID.js +1 -2
- package/cjs/hooks/usePaginationSearch.js +11 -26
- package/cjs/index.d.js +0 -1
- package/cjs/index.js +1 -24
- package/cjs/parts/PageNextButton.js +12 -17
- package/cjs/parts/PagePrevButton.js +11 -14
- package/cjs/parts/PaginationContent.js +45 -50
- package/cjs/parts/Paginator.js +112 -113
- package/cjs/parts/PerPageSelector.js +44 -46
- package/cjs/props.js +14 -20
- package/cjs/styled.js +16 -31
- package/esm/Pagination.js +20 -29
- package/esm/PaginationDataTestID.js +1 -2
- package/esm/hooks/usePaginationSearch.js +9 -20
- package/esm/index.d.js +0 -1
- package/esm/index.js +1 -24
- package/esm/parts/PageNextButton.js +11 -16
- package/esm/parts/PagePrevButton.js +10 -13
- package/esm/parts/PaginationContent.js +40 -45
- package/esm/parts/Paginator.js +110 -109
- package/esm/parts/PerPageSelector.js +43 -43
- package/esm/props.js +14 -20
- package/esm/styled.js +16 -31
- package/package.json +77 -16
- package/types/Pagination.d.ts +5 -0
- package/types/PaginationDataTestID.d.ts +5 -0
- package/types/hooks/usePaginationSearch.d.ts +1 -0
- package/types/index.d.ts +1 -0
- package/types/parts/PageNextButton.d.ts +3 -0
- package/types/parts/PagePrevButton.d.ts +3 -0
- package/types/parts/PaginationContent.d.ts +3 -0
- package/types/parts/Paginator.d.ts +4 -0
- package/types/parts/PerPageSelector.d.ts +4 -0
- package/types/props.d.ts +75 -0
- package/types/styled.d.ts +13 -0
- package/Pagination/package.json +0 -10
- package/PaginationDataTestID/package.json +0 -10
- package/cjs/Pagination.js.map +0 -1
- package/cjs/PaginationDataTestID.js.map +0 -1
- package/cjs/hooks/usePaginationSearch.js.map +0 -1
- package/cjs/index.d.js.map +0 -1
- package/cjs/index.js.map +0 -1
- package/cjs/parts/PageNextButton.js.map +0 -1
- package/cjs/parts/PagePrevButton.js.map +0 -1
- package/cjs/parts/PaginationContent.js.map +0 -1
- package/cjs/parts/Paginator.js.map +0 -1
- package/cjs/parts/PerPageSelector.js.map +0 -1
- package/cjs/props.js.map +0 -1
- package/cjs/styled.js.map +0 -1
- package/esm/Pagination.js.map +0 -1
- package/esm/PaginationDataTestID.js.map +0 -1
- package/esm/hooks/usePaginationSearch.js.map +0 -1
- package/esm/index.d.js.map +0 -1
- package/esm/index.js.map +0 -1
- package/esm/parts/PageNextButton.js.map +0 -1
- package/esm/parts/PagePrevButton.js.map +0 -1
- package/esm/parts/PaginationContent.js.map +0 -1
- package/esm/parts/Paginator.js.map +0 -1
- package/esm/parts/PerPageSelector.js.map +0 -1
- package/esm/props.js.map +0 -1
- package/esm/styled.js.map +0 -1
- package/hooks/usePaginationSearch/package.json +0 -10
- package/parts/PageNextButton/package.json +0 -10
- package/parts/PagePrevButton/package.json +0 -10
- package/parts/PaginationContent/package.json +0 -10
- package/parts/Paginator/package.json +0 -10
- package/parts/PerPageSelector/package.json +0 -10
- package/props/package.json +0 -10
- package/styled/package.json +0 -10
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
4
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
5
|
+
import { useState, useMemo, useRef, useEffect } from 'react';
|
|
4
6
|
import memoize from 'memoize-one';
|
|
5
7
|
import { range, useOnElementResize } from '@elliemae/ds-utilities';
|
|
6
8
|
import { DSDropdownMenuV2 } from '@elliemae/ds-dropdownmenu';
|
|
7
9
|
import { ChevronDown } from '@elliemae/ds-icons';
|
|
8
10
|
import { PaginationDropdownButton } from '../styled.js';
|
|
9
|
-
import '@elliemae/ds-grid';
|
|
10
|
-
import '@elliemae/ds-button';
|
|
11
|
-
import 'styled-components';
|
|
12
|
-
import 'styled-system';
|
|
13
11
|
|
|
14
|
-
|
|
12
|
+
const generateOption = value => {
|
|
13
|
+
if (typeof value === 'object') {
|
|
14
|
+
return value;
|
|
15
|
+
}
|
|
16
|
+
|
|
15
17
|
return {
|
|
16
18
|
dsId: value.toString(),
|
|
17
|
-
value
|
|
19
|
+
value,
|
|
18
20
|
label: value.toString(),
|
|
19
21
|
type: 'single'
|
|
20
22
|
};
|
|
21
23
|
};
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
const getOptions = memoize((step, min, max) => {
|
|
26
|
+
const options = range(min, max + step, step).map(generateOption);
|
|
25
27
|
return min === 0 ? options.slice(1, options.length) : options;
|
|
26
28
|
});
|
|
27
29
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
minPerPage = props.minPerPage;
|
|
40
|
-
var options = useMemo(function () {
|
|
30
|
+
const PerPageSelector = props => {
|
|
31
|
+
const [isOpened, setIsOpened] = useState(false);
|
|
32
|
+
const {
|
|
33
|
+
pageSize,
|
|
34
|
+
onPageSizeChange,
|
|
35
|
+
perPageOptions,
|
|
36
|
+
maxPerPage,
|
|
37
|
+
perPageStep,
|
|
38
|
+
minPerPage
|
|
39
|
+
} = props;
|
|
40
|
+
const options = useMemo(() => {
|
|
41
41
|
if (perPageOptions) return perPageOptions.map(generateOption);
|
|
42
42
|
return getOptions(perPageStep, minPerPage, maxPerPage);
|
|
43
43
|
}, [maxPerPage, minPerPage, perPageOptions, perPageStep]);
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
useEffect(
|
|
44
|
+
const actionRef = useRef({});
|
|
45
|
+
const btnRef = useRef(null);
|
|
46
|
+
useEffect(() => {
|
|
47
47
|
if (isOpened) {
|
|
48
48
|
actionRef.current.setActiveDescendant(pageSize.toString());
|
|
49
49
|
actionRef.current.scrollOptionIntoView(pageSize.toString());
|
|
50
50
|
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
51
51
|
|
|
52
52
|
}, [isOpened]);
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
return /*#__PURE__*/React.createElement(DSDropdownMenuV2, {
|
|
53
|
+
const {
|
|
54
|
+
width
|
|
55
|
+
} = useOnElementResize(btnRef);
|
|
56
|
+
return /*#__PURE__*/_jsx(DSDropdownMenuV2, {
|
|
58
57
|
isOpened: isOpened,
|
|
59
58
|
options: options,
|
|
60
|
-
selectedOptions:
|
|
61
|
-
|
|
59
|
+
selectedOptions: {
|
|
60
|
+
[pageSize.toString()]: true
|
|
61
|
+
},
|
|
62
|
+
onOptionClick: (_, clickedOption) => {
|
|
62
63
|
onPageSizeChange(clickedOption.value);
|
|
63
64
|
setIsOpened(false);
|
|
64
65
|
btnRef.current.focus();
|
|
65
66
|
},
|
|
66
|
-
onClickOutside:
|
|
67
|
+
onClickOutside: () => {
|
|
67
68
|
setIsOpened(false);
|
|
68
69
|
btnRef.current.focus();
|
|
69
70
|
},
|
|
71
|
+
customOffset: [0, 2],
|
|
70
72
|
startPlacementPreference: "top-end",
|
|
71
73
|
actionRef: actionRef,
|
|
72
74
|
minWidth: width + 25,
|
|
73
|
-
maxHeight: 300
|
|
74
|
-
|
|
75
|
+
maxHeight: 300,
|
|
76
|
+
HeaderComp: () => 'Per Page'
|
|
77
|
+
}, void 0, /*#__PURE__*/_jsx("div", {
|
|
75
78
|
style: {
|
|
76
79
|
marginLeft: '32px'
|
|
77
80
|
}
|
|
78
|
-
}, /*#__PURE__*/
|
|
81
|
+
}, void 0, /*#__PURE__*/_jsx(PaginationDropdownButton, {
|
|
79
82
|
buttonType: "raw",
|
|
80
|
-
onClick:
|
|
81
|
-
return setIsOpened(true);
|
|
82
|
-
},
|
|
83
|
+
onClick: () => setIsOpened(true),
|
|
83
84
|
"aria-pressed": isOpened,
|
|
84
85
|
innerRef: btnRef
|
|
85
|
-
}, pageSize, " / page", /*#__PURE__*/
|
|
86
|
+
}, void 0, pageSize, " / page", /*#__PURE__*/_jsx(ChevronDown, {
|
|
86
87
|
color: ['brand-primary', '700']
|
|
87
88
|
}))));
|
|
88
89
|
};
|
|
89
90
|
|
|
90
91
|
export { PerPageSelector as default };
|
|
91
|
-
//# sourceMappingURL=PerPageSelector.js.map
|
package/esm/props.js
CHANGED
|
@@ -1,37 +1,32 @@
|
|
|
1
1
|
import { PropTypes } from 'react-desc';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
return null;
|
|
5
|
-
};
|
|
3
|
+
const emptyFunc = () => null;
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
const propTypes = {
|
|
8
6
|
pageCount: PropTypes.number.description('How many pages are there'),
|
|
9
7
|
pageIndex: PropTypes.number.description('Index of the current page, starting from 1').defaultValue(1),
|
|
10
8
|
canPreviousPage: PropTypes.bool.description('Whether the previous button is disabled or not').defaultValue(true),
|
|
11
9
|
canNextPage: PropTypes.bool.description('Whether the next button is disabled or not').defaultValue(true),
|
|
12
10
|
pageSize: PropTypes.number.description('The current page size').defaultValue(10),
|
|
13
11
|
showPerPageSelector: PropTypes.bool.description('Whether to show the page selector').defaultValue(true),
|
|
14
|
-
perPageOptions: PropTypes.arrayOf(PropTypes.number
|
|
12
|
+
perPageOptions: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.shape({
|
|
13
|
+
dsId: PropTypes.string,
|
|
14
|
+
value: PropTypes.number,
|
|
15
|
+
label: PropTypes.string,
|
|
16
|
+
type: PropTypes.oneOf(['single'])
|
|
17
|
+
})])).description('The available options for page size').defaultValue([10]),
|
|
15
18
|
perPageStep: PropTypes.number.description('Step for the per page options').defaultValue(5),
|
|
16
19
|
minPerPage: PropTypes.number.description('Step for the per page options').defaultValue(0),
|
|
17
20
|
maxPerPage: PropTypes.number.description('Step for the per page options').defaultValue(100),
|
|
18
|
-
onPageSizeChange: PropTypes.func.description('Function invoked when the page size changes').defaultValue(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return null;
|
|
23
|
-
}),
|
|
24
|
-
onPageChange: PropTypes.func.description('Function invoked when the page changes').defaultValue(function () {
|
|
25
|
-
return null;
|
|
26
|
-
}),
|
|
27
|
-
onNextPage: PropTypes.func.description('Function invoked when next button is pressed').defaultValue(function () {
|
|
28
|
-
return null;
|
|
29
|
-
}),
|
|
21
|
+
onPageSizeChange: PropTypes.func.description('Function invoked when the page size changes').defaultValue(() => null),
|
|
22
|
+
onPreviousPage: PropTypes.func.description('Function invoked when the previous button is pressed').defaultValue(() => null),
|
|
23
|
+
onPageChange: PropTypes.func.description('Function invoked when the page changes').defaultValue(() => null),
|
|
24
|
+
onNextPage: PropTypes.func.description('Function invoked when next button is pressed').defaultValue(() => null),
|
|
30
25
|
pageDetails: PropTypes.arrayOf(PropTypes.string).description('Details to provide for each page').defaultValue([]),
|
|
31
26
|
pageDetailsTitle: PropTypes.string.description('The title of the details (usually a column of your dataset)').defaultValue(''),
|
|
32
27
|
width: PropTypes.any.description('Width for the container of the pagination').defaultValue('100%')
|
|
33
28
|
};
|
|
34
|
-
|
|
29
|
+
const defaultProps = {
|
|
35
30
|
pageIndex: 1,
|
|
36
31
|
canPreviousPage: true,
|
|
37
32
|
canNextPage: true,
|
|
@@ -50,5 +45,4 @@ var defaultProps = {
|
|
|
50
45
|
width: '100%'
|
|
51
46
|
};
|
|
52
47
|
|
|
53
|
-
export {
|
|
54
|
-
//# sourceMappingURL=props.js.map
|
|
48
|
+
export { defaultProps, propTypes };
|
package/esm/styled.js
CHANGED
|
@@ -3,47 +3,32 @@ import { DSButtonV2 } from '@elliemae/ds-button';
|
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
import { typography, space } from 'styled-system';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
return typeof size === 'number' && !Number.isNaN(size) ? "".concat(size, "px") : size;
|
|
8
|
-
};
|
|
6
|
+
const sizeToCss = size => typeof size === 'number' && !Number.isNaN(size) ? "".concat(size, "px") : size;
|
|
9
7
|
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
const styledFocusCss = _ref => {
|
|
9
|
+
let {
|
|
10
|
+
theme
|
|
11
|
+
} = _ref;
|
|
12
12
|
return "\n&:after {\n display: block;\n content: ' ';\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n border: 2px solid ".concat(theme.colors.brand[700], ";\n pointer-events: none;\n z-index: 7;\n}");
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
const PaginationContainer = /*#__PURE__*/styled(Grid).withConfig({
|
|
16
16
|
componentId: "sc-mxz59e-0"
|
|
17
|
-
})(["padding:0 ", ";height:42px;width:", ";max-width:100%;align-items:center;box-shadow:0 -1px 3px 0 rgba(0,0,0,0.5);"],
|
|
18
|
-
|
|
19
|
-
}, function (props) {
|
|
20
|
-
return sizeToCss(props.width) || '100%';
|
|
21
|
-
});
|
|
22
|
-
var PaginationWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
17
|
+
})(["padding:0 ", ";height:42px;width:", ";max-width:100%;align-items:center;box-shadow:0 -1px 3px 0 rgba(0,0,0,0.5);"], props => props.theme.space.xs, props => sizeToCss(props.width) || '100%');
|
|
18
|
+
const PaginationWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
23
19
|
componentId: "sc-mxz59e-1"
|
|
24
20
|
})(["display:flex;justify-content:center;align-items:center;margin:0 32px;"]);
|
|
25
|
-
|
|
21
|
+
const PaginationSeparator = /*#__PURE__*/styled(Grid).withConfig({
|
|
26
22
|
componentId: "sc-mxz59e-2"
|
|
27
|
-
})(["background-color:", ";width:1px;height:", ";"],
|
|
28
|
-
|
|
29
|
-
}, function (props) {
|
|
30
|
-
return props.height || '30px';
|
|
31
|
-
});
|
|
32
|
-
var PaginationBoldText = /*#__PURE__*/styled.span.withConfig({
|
|
23
|
+
})(["background-color:", ";width:1px;height:", ";"], props => props.theme.colors.neutral[300], props => props.height || '30px');
|
|
24
|
+
const PaginationBoldText = /*#__PURE__*/styled.span.withConfig({
|
|
33
25
|
componentId: "sc-mxz59e-3"
|
|
34
|
-
})(["font-weight:", ";", " ", " position:relative;"],
|
|
35
|
-
|
|
36
|
-
}, typography, space);
|
|
37
|
-
var PaginationDropdownButton = /*#__PURE__*/styled(DSButtonV2).withConfig({
|
|
26
|
+
})(["font-weight:", ";", " ", " position:relative;"], props => props.theme.fontWeights.semibold, typography, space);
|
|
27
|
+
const PaginationDropdownButton = /*#__PURE__*/styled(DSButtonV2).withConfig({
|
|
38
28
|
componentId: "sc-mxz59e-4"
|
|
39
|
-
})(["height:42px;display:flex;justify-content:center;align-items:center;position:relative;padding-left:16px;padding-right:16px;grid-gap:8px;font-size:13px;color:", ";cursor:pointer;border-radius:0;font-weight:", ";:focus{", "}"],
|
|
40
|
-
|
|
41
|
-
}, function (props) {
|
|
42
|
-
return props.theme.fontWeights.regular;
|
|
43
|
-
}, styledFocusCss);
|
|
44
|
-
var PreviousNextPageButton = /*#__PURE__*/styled(DSButtonV2).withConfig({
|
|
29
|
+
})(["height:42px;display:flex;justify-content:center;align-items:center;position:relative;padding-left:16px;padding-right:16px;grid-gap:8px;font-size:13px;color:", ";cursor:pointer;border-radius:0;font-weight:", ";:focus{", "}"], props => props.theme.colors.neutral[700], props => props.theme.fontWeights.regular, styledFocusCss);
|
|
30
|
+
const PreviousNextPageButton = /*#__PURE__*/styled(DSButtonV2).withConfig({
|
|
45
31
|
componentId: "sc-mxz59e-5"
|
|
46
|
-
})(["height:42px;display:grid;place-items:center;position:relative;padding-left:8px;padding-right:8px;border-radius:0;cursor:
|
|
32
|
+
})(["height:42px;display:grid;place-items:center;position:relative;padding-left:8px;padding-right:8px;border-radius:0;cursor:", ";:focus{", "}"], props => props.disabled ? 'not-allowed' : 'pointer', styledFocusCss);
|
|
47
33
|
|
|
48
34
|
export { PaginationBoldText, PaginationContainer, PaginationDropdownButton, PaginationSeparator, PaginationWrapper, PreviousNextPageButton };
|
|
49
|
-
//# sourceMappingURL=styled.js.map
|
package/package.json
CHANGED
|
@@ -1,14 +1,70 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-pagination",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-alpha.13",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"description": "
|
|
6
|
-
"
|
|
7
|
-
"
|
|
5
|
+
"description": "ICE MT - Dimsum - Pagination",
|
|
6
|
+
"module": "./esm/index.js",
|
|
7
|
+
"main": "./cjs/index.js",
|
|
8
|
+
"types": "./types/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./esm/index.js",
|
|
12
|
+
"require": "./cjs/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./styled": {
|
|
15
|
+
"import": "./esm/styled.js",
|
|
16
|
+
"require": "./cjs/styled.js"
|
|
17
|
+
},
|
|
18
|
+
"./props": {
|
|
19
|
+
"import": "./esm/props.js",
|
|
20
|
+
"require": "./cjs/props.js"
|
|
21
|
+
},
|
|
22
|
+
"./parts/PerPageSelector": {
|
|
23
|
+
"import": "./esm/parts/PerPageSelector.js",
|
|
24
|
+
"require": "./cjs/parts/PerPageSelector.js"
|
|
25
|
+
},
|
|
26
|
+
"./parts/Paginator": {
|
|
27
|
+
"import": "./esm/parts/Paginator.js",
|
|
28
|
+
"require": "./cjs/parts/Paginator.js"
|
|
29
|
+
},
|
|
30
|
+
"./parts/PaginationContent": {
|
|
31
|
+
"import": "./esm/parts/PaginationContent.js",
|
|
32
|
+
"require": "./cjs/parts/PaginationContent.js"
|
|
33
|
+
},
|
|
34
|
+
"./parts/PagePrevButton": {
|
|
35
|
+
"import": "./esm/parts/PagePrevButton.js",
|
|
36
|
+
"require": "./cjs/parts/PagePrevButton.js"
|
|
37
|
+
},
|
|
38
|
+
"./parts/PageNextButton": {
|
|
39
|
+
"import": "./esm/parts/PageNextButton.js",
|
|
40
|
+
"require": "./cjs/parts/PageNextButton.js"
|
|
41
|
+
},
|
|
42
|
+
"./PaginationDataTestID": {
|
|
43
|
+
"import": "./esm/PaginationDataTestID.js",
|
|
44
|
+
"require": "./cjs/PaginationDataTestID.js"
|
|
45
|
+
},
|
|
46
|
+
"./Pagination": {
|
|
47
|
+
"import": "./esm/Pagination.js",
|
|
48
|
+
"require": "./cjs/Pagination.js"
|
|
49
|
+
},
|
|
50
|
+
"./hooks/usePaginationSearch": {
|
|
51
|
+
"import": "./esm/hooks/usePaginationSearch.js",
|
|
52
|
+
"require": "./cjs/hooks/usePaginationSearch.js"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
8
55
|
"sideEffects": [
|
|
9
56
|
"*.css",
|
|
10
57
|
"*.scss"
|
|
11
58
|
],
|
|
59
|
+
"repository": {
|
|
60
|
+
"type": "git",
|
|
61
|
+
"url": "https://git.elliemae.io/platform-ui/dimsum.git"
|
|
62
|
+
},
|
|
63
|
+
"engines": {
|
|
64
|
+
"npm": ">=7",
|
|
65
|
+
"node": ">=14"
|
|
66
|
+
},
|
|
67
|
+
"author": "ICE MT",
|
|
12
68
|
"scripts": {
|
|
13
69
|
"dev": "cross-env NODE_ENV=development && node ../../scripts/build/build.js -w",
|
|
14
70
|
"prebuild": "exit 0",
|
|
@@ -16,24 +72,29 @@
|
|
|
16
72
|
"build": "node ../../scripts/build/build.js"
|
|
17
73
|
},
|
|
18
74
|
"dependencies": {
|
|
19
|
-
"@elliemae/ds-
|
|
20
|
-
"@elliemae/ds-
|
|
21
|
-
"@elliemae/ds-
|
|
22
|
-
"@elliemae/ds-
|
|
23
|
-
"@elliemae/ds-
|
|
24
|
-
"
|
|
75
|
+
"@elliemae/ds-button": "2.0.0-alpha.13",
|
|
76
|
+
"@elliemae/ds-dropdownmenu": "2.0.0-alpha.13",
|
|
77
|
+
"@elliemae/ds-grid": "2.0.0-alpha.13",
|
|
78
|
+
"@elliemae/ds-icons": "2.0.0-alpha.13",
|
|
79
|
+
"@elliemae/ds-props-helpers": "2.0.0-alpha.13",
|
|
80
|
+
"@elliemae/ds-utilities": "2.0.0-alpha.13",
|
|
81
|
+
"memoize-one": "~5.1.1",
|
|
82
|
+
"react-desc": "~4.1.3"
|
|
25
83
|
},
|
|
26
84
|
"devDependencies": {
|
|
27
|
-
"styled-components": "~5.3.
|
|
85
|
+
"styled-components": "~5.3.3",
|
|
86
|
+
"styled-system": "~5.1.5"
|
|
28
87
|
},
|
|
29
88
|
"peerDependencies": {
|
|
30
|
-
"lodash": "^4.17.
|
|
31
|
-
"react": "
|
|
32
|
-
"react-dom": "^17.0.
|
|
33
|
-
"styled-components": "^5.3.
|
|
89
|
+
"lodash": "^4.17.21",
|
|
90
|
+
"react": "^17.0.2",
|
|
91
|
+
"react-dom": "^17.0.2",
|
|
92
|
+
"styled-components": "^5.3.3",
|
|
93
|
+
"styled-system": "^5.1.5"
|
|
34
94
|
},
|
|
35
95
|
"publishConfig": {
|
|
36
96
|
"access": "public",
|
|
37
|
-
"directory": "dist"
|
|
97
|
+
"directory": "dist",
|
|
98
|
+
"generateSubmodules": true
|
|
38
99
|
}
|
|
39
100
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const usePaginationSearch: (pageCount: number, actionRef: React.MutableRefObject<any>) => React.KeyboardEventHandler;
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Pagination';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DSPaginationProps } from '../index.d';
|
|
3
|
+
declare const PerPageSelector: React.ComponentType<Pick<DSPaginationProps, 'pageSize' | 'onPageSizeChange' | 'perPageOptions' | 'perPageStep' | 'minPerPage' | 'maxPerPage'>>;
|
|
4
|
+
export default PerPageSelector;
|
package/types/props.d.ts
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/// <reference path="../../../../shared/typings/react-desc.d.ts" />
|
|
2
|
+
export declare const propTypes: {
|
|
3
|
+
pageCount: {
|
|
4
|
+
defaultValue<T = unknown>(arg: T): {
|
|
5
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
6
|
+
};
|
|
7
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
8
|
+
};
|
|
9
|
+
pageIndex: {
|
|
10
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
11
|
+
};
|
|
12
|
+
canPreviousPage: {
|
|
13
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
14
|
+
};
|
|
15
|
+
canNextPage: {
|
|
16
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
17
|
+
};
|
|
18
|
+
pageSize: {
|
|
19
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
20
|
+
};
|
|
21
|
+
showPerPageSelector: {
|
|
22
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
23
|
+
};
|
|
24
|
+
perPageOptions: {
|
|
25
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
26
|
+
};
|
|
27
|
+
perPageStep: {
|
|
28
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
29
|
+
};
|
|
30
|
+
minPerPage: {
|
|
31
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
32
|
+
};
|
|
33
|
+
maxPerPage: {
|
|
34
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
35
|
+
};
|
|
36
|
+
onPageSizeChange: {
|
|
37
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
38
|
+
};
|
|
39
|
+
onPreviousPage: {
|
|
40
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
41
|
+
};
|
|
42
|
+
onPageChange: {
|
|
43
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
44
|
+
};
|
|
45
|
+
onNextPage: {
|
|
46
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
47
|
+
};
|
|
48
|
+
pageDetails: {
|
|
49
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
50
|
+
};
|
|
51
|
+
pageDetailsTitle: {
|
|
52
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
53
|
+
};
|
|
54
|
+
width: {
|
|
55
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
export declare const defaultProps: {
|
|
59
|
+
pageIndex: number;
|
|
60
|
+
canPreviousPage: boolean;
|
|
61
|
+
canNextPage: boolean;
|
|
62
|
+
pageSize: number;
|
|
63
|
+
showPerPageSelector: boolean;
|
|
64
|
+
perPageOptions: number[];
|
|
65
|
+
perPageStep: number;
|
|
66
|
+
minPerPage: number;
|
|
67
|
+
maxPerPage: number;
|
|
68
|
+
onPageSizeChange: () => void;
|
|
69
|
+
onPreviousPage: () => void;
|
|
70
|
+
onNextPage: () => void;
|
|
71
|
+
onPageChange: () => void;
|
|
72
|
+
pageDetails: never[];
|
|
73
|
+
pageDetailsTitle: string;
|
|
74
|
+
width: string;
|
|
75
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const PaginationContainer: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("@elliemae/ds-grid/types/types").GridPropsT & import("react").RefAttributes<HTMLDivElement>>, import("styled-components").DefaultTheme, {}, never>;
|
|
3
|
+
export declare const PaginationWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
4
|
+
export declare const PaginationSeparator: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("@elliemae/ds-grid/types/types").GridPropsT & import("react").RefAttributes<HTMLDivElement>>, import("styled-components").DefaultTheme, {}, never>;
|
|
5
|
+
export declare const PaginationBoldText: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, any, never>;
|
|
6
|
+
export declare const PaginationDropdownButton: import("styled-components").StyledComponent<{
|
|
7
|
+
(props: import("@elliemae/ds-button/types/v2/propTypes").DSButtonPropsT): JSX.Element;
|
|
8
|
+
propTypes: import("react").WeakValidationMap<unknown>;
|
|
9
|
+
}, import("styled-components").DefaultTheme, {}, never>;
|
|
10
|
+
export declare const PreviousNextPageButton: import("styled-components").StyledComponent<{
|
|
11
|
+
(props: import("@elliemae/ds-button/types/v2/propTypes").DSButtonPropsT): JSX.Element;
|
|
12
|
+
propTypes: import("react").WeakValidationMap<unknown>;
|
|
13
|
+
}, import("styled-components").DefaultTheme, {}, never>;
|
package/Pagination/package.json
DELETED
package/cjs/Pagination.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Pagination.js","sources":["../../src/Pagination.tsx"],"sourcesContent":["import React from 'react';\nimport { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';\nimport { describe } from 'react-desc';\nimport { PaginationContent } from './parts/PaginationContent';\nimport { DSPaginationSchema, defaultProps } from './props';\nimport { DSPaginationProps } from './index.d';\n\nconst DSPagination: React.ComponentType<DSPaginationProps> = (props) => {\n const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);\n useValidateTypescriptPropTypes(propsWithDefault, DSPaginationWithSchema.toTypescript());\n\n return <PaginationContent {...propsWithDefault} />;\n};\n\nDSPagination.propTypes = DSPaginationSchema;\nconst DSPaginationWithSchema = describe(DSPagination).description('DSPagination');\nDSPaginationWithSchema.propTypes = DSPaginationSchema;\n\nexport { DSPagination, DSPaginationSchema };\n"],"names":["DSPagination","props","propsWithDefault","useMemoMergePropsWithDefault","defaultProps","useValidateTypescriptPropTypes","DSPaginationWithSchema","toTypescript","React","PaginationContent","propTypes","DSPaginationSchema","describe","description"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAOMA,YAAoD,GAAG,SAAvDA,YAAuD,CAACC,OAAD,EAAW;AACtE,MAAMC,gBAAgB,GAAGC,2CAA4B,CAACF,OAAD,EAAQG,kBAAR,CAArD;AACAC,EAAAA,6CAA8B,CAACH,gBAAD,EAAmBI,sBAAsB,CAACC,YAAvB,EAAnB,CAA9B;AAEA,sBAAOC,wCAACC,yCAAD,EAAuBP,gBAAvB,CAAP;AACD;;AAEDF,YAAY,CAACU,SAAb,GAAyBC,wBAAzB;AACA,IAAML,sBAAsB,GAAGM,kBAAQ,CAACZ,YAAD,CAAR,CAAuBa,WAAvB,CAAmC,cAAnC,CAA/B;AACAP,sBAAsB,CAACI,SAAvB,GAAmCC,wBAAnC;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PaginationDataTestID.js","sources":["../../src/PaginationDataTestID.tsx"],"sourcesContent":["export const PAGINATION_DATA_TESTID = {\n PREVIOUS_BUTTON: 'data-table-pagination-prev-button',\n NEXT_BUTTON: 'data-table-pagination-next-button',\n CONTAINER: 'data-table-pagination-container',\n};\n"],"names":["PAGINATION_DATA_TESTID","PREVIOUS_BUTTON","NEXT_BUTTON","CONTAINER"],"mappings":";;;;IAAaA,sBAAsB,GAAG;AACpCC,EAAAA,eAAe,EAAE,mCADmB;AAEpCC,EAAAA,WAAW,EAAE,mCAFuB;AAGpCC,EAAAA,SAAS,EAAE;AAHyB;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"usePaginationSearch.js","sources":["../../../src/hooks/usePaginationSearch.tsx"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\n\nexport const usePaginationSearch = (\n pageCount: number,\n actionRef: React.MutableRefObject<any>,\n): React.KeyboardEventHandler => {\n const [searchValue, setSearchValue] = useState('');\n const [shouldResetSearchValue, setShouldResetSearchValue] = useState(true);\n\n const timeoutRef = useRef<NodeJS.Timeout>(null);\n\n useEffect(() => {\n if (searchValue !== '' && Number.parseInt(searchValue, 10) <= pageCount) {\n actionRef.current.setActiveDescendant(searchValue);\n actionRef.current.scrollOptionIntoView(searchValue);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [searchValue]);\n\n const onKeyDown = useCallback(\n (e) => {\n if (e.code.startsWith('Digit')) {\n if (shouldResetSearchValue) setSearchValue(e.key);\n else setSearchValue((prevValue) => prevValue + e.key);\n\n setShouldResetSearchValue(false);\n clearTimeout(timeoutRef.current);\n timeoutRef.current = setTimeout(() => {\n setShouldResetSearchValue(true);\n }, 1000);\n }\n },\n [shouldResetSearchValue],\n );\n\n return onKeyDown;\n};\n"],"names":["usePaginationSearch","pageCount","actionRef","useState","searchValue","setSearchValue","shouldResetSearchValue","setShouldResetSearchValue","timeoutRef","useRef","useEffect","Number","parseInt","current","setActiveDescendant","scrollOptionIntoView","onKeyDown","useCallback","e","code","startsWith","key","prevValue","clearTimeout","setTimeout"],"mappings":";;;;;;;;;;;IAEaA,mBAAmB,GAAG,SAAtBA,mBAAsB,CACjCC,SADiC,EAEjCC,SAFiC,EAGF;AAC/B,kBAAsCC,cAAQ,CAAC,EAAD,CAA9C;AAAA;AAAA,MAAOC,WAAP;AAAA,MAAoBC,cAApB;;AACA,mBAA4DF,cAAQ,CAAC,IAAD,CAApE;AAAA;AAAA,MAAOG,sBAAP;AAAA,MAA+BC,yBAA/B;;AAEA,MAAMC,UAAU,GAAGC,YAAM,CAAiB,IAAjB,CAAzB;AAEAC,EAAAA,eAAS,CAAC,YAAM;AACd,QAAIN,WAAW,KAAK,EAAhB,IAAsBO,MAAM,CAACC,QAAP,CAAgBR,WAAhB,EAA6B,EAA7B,KAAoCH,SAA9D,EAAyE;AACvEC,MAAAA,SAAS,CAACW,OAAV,CAAkBC,mBAAlB,CAAsCV,WAAtC;AACAF,MAAAA,SAAS,CAACW,OAAV,CAAkBE,oBAAlB,CAAuCX,WAAvC;AACD,KAJa;;AAMf,GANQ,EAMN,CAACA,WAAD,CANM,CAAT;AAQA,MAAMY,SAAS,GAAGC,iBAAW,CAC3B,UAACC,CAAD,EAAO;AACL,QAAIA,CAAC,CAACC,IAAF,CAAOC,UAAP,CAAkB,OAAlB,CAAJ,EAAgC;AAC9B,UAAId,sBAAJ,EAA4BD,cAAc,CAACa,CAAC,CAACG,GAAH,CAAd,CAA5B,KACKhB,cAAc,CAAC,UAACiB,SAAD;AAAA,eAAeA,SAAS,GAAGJ,CAAC,CAACG,GAA7B;AAAA,OAAD,CAAd;AAELd,MAAAA,yBAAyB,CAAC,KAAD,CAAzB;AACAgB,MAAAA,YAAY,CAACf,UAAU,CAACK,OAAZ,CAAZ;AACAL,MAAAA,UAAU,CAACK,OAAX,GAAqBW,UAAU,CAAC,YAAM;AACpCjB,QAAAA,yBAAyB,CAAC,IAAD,CAAzB;AACD,OAF8B,EAE5B,IAF4B,CAA/B;AAGD;AACF,GAZ0B,EAa3B,CAACD,sBAAD,CAb2B,CAA7B;AAgBA,SAAOU,SAAP;AACD;;;;"}
|
package/cjs/index.d.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
package/cjs/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PageNextButton.js","sources":["../../../src/parts/PageNextButton.tsx"],"sourcesContent":["/* eslint-disable react/prop-types */\nimport React from 'react';\nimport { ChevronRight } from '@elliemae/ds-icons';\nimport { PAGINATION_DATA_TESTID } from '../PaginationDataTestID';\nimport { PreviousNextPageButton } from '../styled';\nimport { DSPaginationProps } from '../index.d';\n\nexport const PageNextButton: React.ComponentType<Pick<DSPaginationProps, 'onNextPage' | 'canNextPage'>> = ({\n onNextPage,\n canNextPage,\n}) => (\n <PreviousNextPageButton\n onClick={() => {\n if (canNextPage) onNextPage();\n }}\n disabled={!canNextPage}\n buttonType=\"raw\"\n data-testid={PAGINATION_DATA_TESTID.NEXT_BUTTON}\n HeaderComp={() => 'Page'}\n >\n <ChevronRight color={canNextPage ? ['brand-primary', '700'] : ['neutral', '500']} />\n </PreviousNextPageButton>\n);\n"],"names":["PageNextButton","onNextPage","canNextPage","React","PreviousNextPageButton","PAGINATION_DATA_TESTID","NEXT_BUTTON","ChevronRight"],"mappings":";;;;;;;;;;;;;;;;;AAAA;IAOaA,cAA0F,GAAG,SAA7FA,cAA6F;AAAA,MACxGC,UADwG,QACxGA,UADwG;AAAA,MAExGC,WAFwG,QAExGA,WAFwG;AAAA,sBAIxGC,wCAACC,6BAAD;AACE,IAAA,OAAO,EAAE,mBAAM;AACb,UAAIF,WAAJ,EAAiBD,UAAU;AAC5B,KAHH;AAIE,IAAA,QAAQ,EAAE,CAACC,WAJb;AAKE,IAAA,UAAU,EAAC,KALb;AAME,mBAAaG,2CAAsB,CAACC,WANtC;AAOE,IAAA,UAAU,EAAE;AAAA,aAAM,MAAN;AAAA;AAPd,kBASEH,wCAACI,oBAAD;AAAc,IAAA,KAAK,EAAEL,WAAW,GAAG,CAAC,eAAD,EAAkB,KAAlB,CAAH,GAA8B,CAAC,SAAD,EAAY,KAAZ;AAA9D,IATF,CAJwG;AAAA;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PagePrevButton.js","sources":["../../../src/parts/PagePrevButton.tsx"],"sourcesContent":["/* eslint-disable react/prop-types */\nimport React from 'react';\nimport { ChevronLeft } from '@elliemae/ds-icons';\nimport { PAGINATION_DATA_TESTID } from '../PaginationDataTestID';\nimport { PreviousNextPageButton } from '../styled';\nimport { DSPaginationProps } from '../index.d';\n\nexport const PagePrevButton: React.ComponentType<Pick<DSPaginationProps, 'onPreviousPage' | 'canPreviousPage'>> = ({\n onPreviousPage,\n canPreviousPage,\n}) => (\n <PreviousNextPageButton\n onClick={() => {\n if (canPreviousPage) onPreviousPage();\n }}\n disabled={!canPreviousPage}\n buttonType=\"raw\"\n data-testid={PAGINATION_DATA_TESTID.PREVIOUS_BUTTON}\n >\n <ChevronLeft color={canPreviousPage ? ['brand-primary', '700'] : ['neutral', '500']} />\n </PreviousNextPageButton>\n);\n"],"names":["PagePrevButton","onPreviousPage","canPreviousPage","React","PreviousNextPageButton","PAGINATION_DATA_TESTID","PREVIOUS_BUTTON","ChevronLeft"],"mappings":";;;;;;;;;;;;;;;;;AAAA;IAOaA,cAAkG,GAAG,SAArGA,cAAqG;AAAA,MAChHC,cADgH,QAChHA,cADgH;AAAA,MAEhHC,eAFgH,QAEhHA,eAFgH;AAAA,sBAIhHC,wCAACC,6BAAD;AACE,IAAA,OAAO,EAAE,mBAAM;AACb,UAAIF,eAAJ,EAAqBD,cAAc;AACpC,KAHH;AAIE,IAAA,QAAQ,EAAE,CAACC,eAJb;AAKE,IAAA,UAAU,EAAC,KALb;AAME,mBAAaG,2CAAsB,CAACC;AANtC,kBAQEH,wCAACI,mBAAD;AAAa,IAAA,KAAK,EAAEL,eAAe,GAAG,CAAC,eAAD,EAAkB,KAAlB,CAAH,GAA8B,CAAC,SAAD,EAAY,KAAZ;AAAjE,IARF,CAJgH;AAAA;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PaginationContent.js","sources":["../../../src/parts/PaginationContent.tsx"],"sourcesContent":["/* eslint-disable react/prop-types */\nimport React from 'react';\nimport Grid from '@elliemae/ds-grid';\nimport { PaginationContainer, PaginationSeparator, PaginationWrapper } from '../styled';\nimport PerPageSelector from './PerPageSelector';\nimport Paginator from './Paginator';\nimport { PAGINATION_DATA_TESTID } from '../PaginationDataTestID';\nimport { PagePrevButton } from './PagePrevButton';\nimport { PageNextButton } from './PageNextButton';\nimport { DSPaginationProps } from '../index.d';\n\nexport const PaginationContent: React.ComponentType<DSPaginationProps> = ({\n pageIndex,\n pageSize,\n canPreviousPage,\n canNextPage,\n onPageSizeChange,\n onNextPage,\n onPreviousPage,\n onPageChange,\n pageCount,\n showPerPageSelector,\n pageDetails,\n pageDetailsTitle,\n perPageOptions,\n maxPerPage,\n perPageStep,\n minPerPage,\n width,\n}) => (\n <PaginationContainer\n justifyContent=\"center\"\n alignItems=\"center\"\n width={width}\n data-testid={PAGINATION_DATA_TESTID.CONTAINER}\n >\n <PaginationWrapper>\n {showPerPageSelector && (\n <>\n <PerPageSelector\n pageSize={pageSize}\n onPageSizeChange={onPageSizeChange}\n perPageOptions={perPageOptions}\n maxPerPage={maxPerPage}\n perPageStep={perPageStep}\n minPerPage={minPerPage}\n />\n <PaginationSeparator mr={24} />\n </>\n )}\n <Grid cols={['auto', 'auto', 'auto', 'auto', 'auto']} mr=\"32px\" alignItems=\"center\">\n <PagePrevButton canPreviousPage={canPreviousPage} onPreviousPage={onPreviousPage} />\n <Paginator\n pageCount={pageCount}\n pageIndex={pageIndex}\n onNextPage={onNextPage}\n onPageChange={onPageChange}\n pageDetails={pageDetails}\n pageDetailsTitle={pageDetailsTitle}\n />\n <PageNextButton canNextPage={canNextPage} onNextPage={onNextPage} />\n </Grid>\n </PaginationWrapper>\n </PaginationContainer>\n);\n"],"names":["PaginationContent","pageIndex","pageSize","canPreviousPage","canNextPage","onPageSizeChange","onNextPage","onPreviousPage","onPageChange","pageCount","showPerPageSelector","pageDetails","pageDetailsTitle","perPageOptions","maxPerPage","perPageStep","minPerPage","width","React","PaginationContainer","PAGINATION_DATA_TESTID","CONTAINER","PaginationWrapper","PerPageSelector","PaginationSeparator","Grid","PagePrevButton","Paginator","PageNextButton"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;IAWaA,iBAAyD,GAAG,SAA5DA,iBAA4D;AAAA,MACvEC,SADuE,QACvEA,SADuE;AAAA,MAEvEC,QAFuE,QAEvEA,QAFuE;AAAA,MAGvEC,eAHuE,QAGvEA,eAHuE;AAAA,MAIvEC,WAJuE,QAIvEA,WAJuE;AAAA,MAKvEC,gBALuE,QAKvEA,gBALuE;AAAA,MAMvEC,UANuE,QAMvEA,UANuE;AAAA,MAOvEC,cAPuE,QAOvEA,cAPuE;AAAA,MAQvEC,Y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UAHd;AAIE,IAAA,YAAY,EAAEE,YAJhB;AAKE,IAAA,WAAW,EAAEG,WALf;AAME,IAAA,gBAAgB,EAAEC;AANpB,IAFF,eAUEM,wCAACU,mCAAD;AAAgB,IAAA,WAAW,EAAExB,WAA7B;AAA0C,IAAA,UAAU,EAAEE;AAAtD,IAVF,CAdF,CANF,CAnBuE;AAAA;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Paginator.js","sources":["../../../src/parts/Paginator.tsx"],"sourcesContent":["/* eslint-disable react/prop-types */\nimport React, { useEffect, useMemo, useRef, useState } from 'react';\nimport { Checkmark, ChevronDown } from '@elliemae/ds-icons';\nimport { useOnElementResize } from '@elliemae/ds-utilities';\nimport Grid from '@elliemae/ds-grid';\nimport { DSDropdownMenuV2 } from '@elliemae/ds-dropdownmenu';\nimport { PaginationBoldText, PaginationDropdownButton, PaginationSeparator } from '../styled';\nimport { usePaginationSearch } from '../hooks/usePaginationSearch';\nimport { DSPaginationProps } from '../index.d';\n\nconst Paginator: React.ComponentType<DSPaginationProps> = (props) => {\n const { pageIndex, pageCount, onPageChange, pageDetails, pageDetailsTitle } = props;\n\n const [isOpened, setIsOpened] = useState(false);\n\n const btnRef = useRef(null);\n const pageInfoRef = useRef(null);\n\n const { width: btnWidth } = useOnElementResize(btnRef);\n const { width: txtWidth } = useOnElementResize(pageInfoRef);\n\n const options = useMemo(\n () =>\n new Array(pageCount).fill(0).map((_, index) => {\n const option: Record<string, unknown> = {\n dsId: (index + 1).toString(),\n label: (index + 1).toString(),\n value: index + 1,\n type: 'single',\n };\n if (pageDetails.length) {\n option.render = () => (\n <Grid cols={['16px', `${txtWidth + 16}px`, 'auto']} gutter=\"xxs\" alignItems=\"center\">\n {pageIndex === index ? <Checkmark size=\"s\" color={['brand-primary', '600']} /> : <div />}\n <span>{index + 1}</span>\n <span\n style={{\n whiteSpace: 'nowrap',\n textOverflow: 'ellipsis',\n overflow: 'hidden',\n }}\n >\n {pageDetails[index]}\n </span>\n </Grid>\n );\n }\n return option;\n }),\n [pageCount, pageDetails, pageIndex, txtWidth],\n );\n\n const actionRef = useRef<Record<string, (dsId: string) => void>>({});\n\n useEffect(() => {\n if (isOpened) {\n actionRef.current.setActiveDescendant((pageIndex + 1).toString());\n actionRef.current.scrollOptionIntoView((pageIndex + 1).toString());\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isOpened]);\n\n const onKeyDown = usePaginationSearch(pageCount, actionRef);\n\n return (\n <>\n <PaginationSeparator />\n <DSDropdownMenuV2\n isOpened={isOpened}\n options={options}\n selectedOptions={{ [(pageIndex + 1).toString()]: true }}\n onOptionClick={(_, clickedOption) => {\n onPageChange(clickedOption.value);\n setIsOpened(false);\n btnRef.current.focus();\n }}\n onClickOutside={() => {\n setIsOpened(false);\n btnRef.current.focus();\n }}\n startPlacementPreference=\"top-end\"\n actionRef={actionRef}\n onKeyDown={onKeyDown}\n minWidth={btnWidth + 23}\n maxHeight={300}\n HeaderComp={() =>\n pageDetailsTitle !== '' ? (\n <Grid cols={[`${txtWidth + 50}px`, '8px', 'auto']}>\n <span style={{ marginLeft: '8px' }}>Page</span>\n <PaginationSeparator height=\"100%\" />\n <span>{pageDetailsTitle}</span>\n </Grid>\n ) : (\n 'Page'\n )\n }\n >\n <PaginationDropdownButton buttonType=\"raw\" onClick={() => setIsOpened(true)} innerRef={btnRef}>\n <div style={{ display: 'flex', gridGap: '8px', alignItems: 'center' }}>\n <Grid cols={['auto', 'auto', 'auto']} alignItems=\"center\" gutter=\"xxxs\" ref={pageInfoRef}>\n <PaginationBoldText fontSize=\"18px\">{pageIndex + 1}</PaginationBoldText> / {pageCount}\n </Grid>\n {pageDetails.length !== 0 && (\n <>\n <PaginationSeparator height=\"12px\" ml=\"8px\" />\n <PaginationBoldText fontSize=\"13px\" mr=\"8px\">\n {pageDetails[pageIndex]}\n </PaginationBoldText>\n </>\n )}\n <ChevronDown color={['brand-primary', '700']} />\n </div>\n </PaginationDropdownButton>\n </DSDropdownMenuV2>\n <PaginationSeparator />\n </>\n );\n};\n\nexport default Paginator;\n"],"names":["Paginator","props","pageIndex","pageCount","onPageChange","pageDetails","pageDetailsTitle","useState","isOpened","setIsOpened","btnRef","useRef","pageInfoRef","useOnElementResize","btnWidth","width","txtWidth","options","useMemo","Array","fill","map","_","index","option","dsId","toString","label","value","type","length","render","React","Grid","Checkmark","whiteSpace","textOverflow","overflow","actionRef","useEffect","current","setActiveDescendant","scrollOptionIntoView","onKeyDown","usePaginationSearch","PaginationSeparator","DSDropdownMenuV2","clickedOption","focus","marginLeft","PaginationDropdownButton","display","gridGap","alignItems","PaginationBoldText","ChevronDown"],"mappings":";;;;;;;;;;;;;;;;;;;;;;IAUMA,SAAiD,GAAG,SAApDA,SAAoD,CAACC,KAAD,EAAW;AACnE,MAAQC,SAAR,GAA8ED,KAA9E,CAAQC,SAAR;AAAA,MAAmBC,SAAnB,GAA8EF,KAA9E,CAAmBE,SAAnB;AAAA,MAA8BC,YAA9B,GAA8EH,KAA9E,CAA8BG,YAA9B;AAAA,MAA4CC,WAA5C,GAA8EJ,KAA9E,CAA4CI,WAA5C;AAAA,MAAyDC,gBAAzD,GAA8EL,KAA9E,CAAyDK,gBAAzD;;AAEA,kBAAgCC,cAAQ,CAAC,KAAD,CAAxC;AAAA;AAAA,MAAOC,QAAP;AAAA,MAAiBC,WAAjB;;AAEA,MAAMC,MAAM,GAAGC,YAAM,CAAC,IAAD,CAArB;AACA,MAAMC,WAAW,GAAGD,YAAM,CAAC,IAAD,CAA1B;;AAEA,4BAA4BE,8BAAkB,CAACH,MAAD,CAA9C;AAAA,MAAeI,QAAf,uBAAQC,KAAR;;AACA,6BAA4BF,8BAAkB,CAACD,WAAD,CAA9C;AAAA,MAAeI,QAAf,wBAAQD,KAAR;;AAEA,MAAME,OAAO,GAAGC,aAAO,CACrB;AAAA,WACE,IAAIC,KAAJ,CAAUhB,SAAV,EAAqBiB,IAArB,CAA0B,CAA1B,EAA6BC,GAA7B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