@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
package/cjs/parts/Paginator.js
CHANGED
|
@@ -1,144 +1,143 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
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.map.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.map.js');
|
|
7
|
+
var react = require('react');
|
|
6
8
|
var dsIcons = require('@elliemae/ds-icons');
|
|
7
9
|
var dsUtilities = require('@elliemae/ds-utilities');
|
|
8
10
|
var Grid = require('@elliemae/ds-grid');
|
|
9
11
|
var dsDropdownmenu = require('@elliemae/ds-dropdownmenu');
|
|
10
12
|
var styled = require('../styled.js');
|
|
11
|
-
var
|
|
12
|
-
require('
|
|
13
|
-
require('styled-components');
|
|
14
|
-
require('styled-system');
|
|
13
|
+
var usePaginationSearch = require('../hooks/usePaginationSearch.js');
|
|
14
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
15
15
|
|
|
16
16
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
17
17
|
|
|
18
|
-
var
|
|
19
|
-
var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
|
|
20
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
18
|
+
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
21
19
|
var Grid__default = /*#__PURE__*/_interopDefaultLegacy(Grid);
|
|
22
20
|
|
|
23
|
-
var
|
|
24
|
-
var pageIndex = props.pageIndex,
|
|
25
|
-
pageCount = props.pageCount,
|
|
26
|
-
onPageChange = props.onPageChange,
|
|
27
|
-
pageDetails = props.pageDetails,
|
|
28
|
-
pageDetailsTitle = props.pageDetailsTitle;
|
|
21
|
+
var _div, _PaginationSeparator, _PaginationSeparator2, _PaginationSeparator3, _PaginationSeparator4;
|
|
29
22
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
isOpened = _useState2[0],
|
|
33
|
-
setIsOpened = _useState2[1];
|
|
23
|
+
const Paginator = props => {
|
|
24
|
+
var _span2;
|
|
34
25
|
|
|
35
|
-
|
|
36
|
-
|
|
26
|
+
const {
|
|
27
|
+
pageIndex,
|
|
28
|
+
pageCount,
|
|
29
|
+
onPageChange,
|
|
30
|
+
pageDetails,
|
|
31
|
+
pageDetailsTitle
|
|
32
|
+
} = props;
|
|
33
|
+
const [isOpened, setIsOpened] = react.useState(false);
|
|
34
|
+
const btnRef = react.useRef(null);
|
|
35
|
+
const pageInfoRef = react.useRef(null);
|
|
36
|
+
const {
|
|
37
|
+
width: btnWidth
|
|
38
|
+
} = dsUtilities.useOnElementResize(btnRef);
|
|
39
|
+
const {
|
|
40
|
+
width: txtWidth
|
|
41
|
+
} = dsUtilities.useOnElementResize(pageInfoRef);
|
|
42
|
+
const options = react.useMemo(() => new Array(pageCount).fill(0).map((_, index) => {
|
|
43
|
+
var _span;
|
|
37
44
|
|
|
38
|
-
|
|
39
|
-
|
|
45
|
+
const option = {
|
|
46
|
+
dsId: (index + 1).toString(),
|
|
47
|
+
label: (index + 1).toString(),
|
|
48
|
+
value: index + 1,
|
|
49
|
+
type: 'single'
|
|
50
|
+
};
|
|
40
51
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
gutter: "xxs",
|
|
58
|
-
alignItems: "center"
|
|
59
|
-
}, pageIndex === index ? /*#__PURE__*/React__default['default'].createElement(dsIcons.Checkmark, {
|
|
60
|
-
size: "s",
|
|
61
|
-
color: ['brand-primary', '600']
|
|
62
|
-
}) : /*#__PURE__*/React__default['default'].createElement("div", null), /*#__PURE__*/React__default['default'].createElement("span", null, index + 1), /*#__PURE__*/React__default['default'].createElement("span", {
|
|
63
|
-
style: {
|
|
64
|
-
whiteSpace: 'nowrap',
|
|
65
|
-
textOverflow: 'ellipsis',
|
|
66
|
-
overflow: 'hidden'
|
|
67
|
-
}
|
|
68
|
-
}, pageDetails[index]));
|
|
69
|
-
};
|
|
70
|
-
}
|
|
52
|
+
if (pageDetails.length) {
|
|
53
|
+
option.render = () => /*#__PURE__*/_jsx__default["default"](Grid__default["default"], {
|
|
54
|
+
cols: ['16px', "".concat(txtWidth + 16, "px"), 'auto'],
|
|
55
|
+
gutter: "xxs",
|
|
56
|
+
alignItems: "center"
|
|
57
|
+
}, void 0, pageIndex === index ? /*#__PURE__*/_jsx__default["default"](dsIcons.Checkmark, {
|
|
58
|
+
size: "s",
|
|
59
|
+
color: ['brand-primary', '600']
|
|
60
|
+
}) : _div || (_div = /*#__PURE__*/_jsx__default["default"]("div", {})), _span || (_span = /*#__PURE__*/_jsx__default["default"]("span", {}, void 0, index + 1)), /*#__PURE__*/_jsx__default["default"]("span", {
|
|
61
|
+
style: {
|
|
62
|
+
whiteSpace: 'nowrap',
|
|
63
|
+
textOverflow: 'ellipsis',
|
|
64
|
+
overflow: 'hidden'
|
|
65
|
+
}
|
|
66
|
+
}, void 0, pageDetails[index]));
|
|
67
|
+
}
|
|
71
68
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
React.useEffect(function () {
|
|
69
|
+
return option;
|
|
70
|
+
}), [pageCount, pageDetails, pageIndex, txtWidth]);
|
|
71
|
+
const actionRef = react.useRef({});
|
|
72
|
+
react.useEffect(() => {
|
|
77
73
|
if (isOpened) {
|
|
78
74
|
actionRef.current.setActiveDescendant((pageIndex + 1).toString());
|
|
79
75
|
actionRef.current.scrollOptionIntoView((pageIndex + 1).toString());
|
|
80
76
|
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
81
77
|
|
|
82
78
|
}, [isOpened]);
|
|
83
|
-
|
|
84
|
-
return /*#__PURE__*/
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
79
|
+
const onKeyDown = usePaginationSearch.usePaginationSearch(pageCount, actionRef);
|
|
80
|
+
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
81
|
+
children: [_PaginationSeparator || (_PaginationSeparator = /*#__PURE__*/_jsx__default["default"](styled.PaginationSeparator, {})), /*#__PURE__*/_jsx__default["default"](dsDropdownmenu.DSDropdownMenuV2, {
|
|
82
|
+
isOpened: isOpened,
|
|
83
|
+
options: options,
|
|
84
|
+
selectedOptions: {
|
|
85
|
+
[(pageIndex + 1).toString()]: true
|
|
86
|
+
},
|
|
87
|
+
onOptionClick: (_, clickedOption) => {
|
|
88
|
+
onPageChange(clickedOption.value);
|
|
89
|
+
setIsOpened(false);
|
|
90
|
+
btnRef.current.focus();
|
|
91
|
+
},
|
|
92
|
+
onClickOutside: () => {
|
|
93
|
+
setIsOpened(false);
|
|
94
|
+
btnRef.current.focus();
|
|
95
|
+
},
|
|
96
|
+
customOffset: [0, 2],
|
|
97
|
+
startPlacementPreference: "top-end",
|
|
98
|
+
actionRef: actionRef,
|
|
99
|
+
onKeyDown: onKeyDown,
|
|
100
|
+
minWidth: btnWidth + 23,
|
|
101
|
+
maxHeight: 300,
|
|
102
|
+
HeaderComp: () => pageDetailsTitle !== '' ? /*#__PURE__*/_jsx__default["default"](Grid__default["default"], {
|
|
104
103
|
cols: ["".concat(txtWidth + 50, "px"), '8px', 'auto']
|
|
105
|
-
}, /*#__PURE__*/
|
|
104
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"]("span", {
|
|
106
105
|
style: {
|
|
107
106
|
marginLeft: '8px'
|
|
108
107
|
}
|
|
109
|
-
}, "Page"), /*#__PURE__*/
|
|
108
|
+
}, void 0, "Page"), _PaginationSeparator2 || (_PaginationSeparator2 = /*#__PURE__*/_jsx__default["default"](styled.PaginationSeparator, {
|
|
110
109
|
height: "100%"
|
|
111
|
-
}), /*#__PURE__*/
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
110
|
+
})), _span2 || (_span2 = /*#__PURE__*/_jsx__default["default"]("span", {}, void 0, pageDetailsTitle))) : 'Page'
|
|
111
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](styled.PaginationDropdownButton, {
|
|
112
|
+
buttonType: "raw",
|
|
113
|
+
onClick: () => setIsOpened(true),
|
|
114
|
+
innerRef: btnRef
|
|
115
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"]("div", {
|
|
116
|
+
style: {
|
|
117
|
+
display: 'flex',
|
|
118
|
+
gridGap: '8px',
|
|
119
|
+
alignItems: 'center'
|
|
120
|
+
}
|
|
121
|
+
}, void 0, /*#__PURE__*/jsxRuntime.jsxs(Grid__default["default"], {
|
|
122
|
+
cols: ['auto', 'auto', 'auto'],
|
|
123
|
+
alignItems: "center",
|
|
124
|
+
gutter: "xxxs",
|
|
125
|
+
ref: pageInfoRef,
|
|
126
|
+
children: [/*#__PURE__*/_jsx__default["default"](styled.PaginationBoldText, {
|
|
127
|
+
fontSize: "18px"
|
|
128
|
+
}, void 0, pageIndex + 1), " / ", pageCount]
|
|
129
|
+
}), pageDetails.length !== 0 && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
130
|
+
children: [_PaginationSeparator3 || (_PaginationSeparator3 = /*#__PURE__*/_jsx__default["default"](styled.PaginationSeparator, {
|
|
131
|
+
height: "12px",
|
|
132
|
+
ml: "8px"
|
|
133
|
+
})), /*#__PURE__*/_jsx__default["default"](styled.PaginationBoldText, {
|
|
134
|
+
fontSize: "13px",
|
|
135
|
+
mr: "8px"
|
|
136
|
+
}, void 0, pageDetails[pageIndex])]
|
|
137
|
+
}), /*#__PURE__*/_jsx__default["default"](dsIcons.ChevronDown, {
|
|
138
|
+
color: ['brand-primary', '700']
|
|
139
|
+
})))), _PaginationSeparator4 || (_PaginationSeparator4 = /*#__PURE__*/_jsx__default["default"](styled.PaginationSeparator, {}))]
|
|
140
|
+
});
|
|
141
141
|
};
|
|
142
142
|
|
|
143
143
|
module.exports = Paginator;
|
|
144
|
-
//# sourceMappingURL=Paginator.js.map
|
|
@@ -1,100 +1,98 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
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');
|
|
6
8
|
var memoize = require('memoize-one');
|
|
7
9
|
var dsUtilities = require('@elliemae/ds-utilities');
|
|
8
10
|
var dsDropdownmenu = require('@elliemae/ds-dropdownmenu');
|
|
9
11
|
var dsIcons = require('@elliemae/ds-icons');
|
|
10
12
|
var styled = require('../styled.js');
|
|
11
|
-
require('@elliemae/ds-grid');
|
|
12
|
-
require('@elliemae/ds-button');
|
|
13
|
-
require('styled-components');
|
|
14
|
-
require('styled-system');
|
|
15
13
|
|
|
16
14
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
17
15
|
|
|
18
|
-
var
|
|
19
|
-
var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
|
|
20
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
16
|
+
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
21
17
|
var memoize__default = /*#__PURE__*/_interopDefaultLegacy(memoize);
|
|
22
18
|
|
|
23
|
-
|
|
19
|
+
const generateOption = value => {
|
|
20
|
+
if (typeof value === 'object') {
|
|
21
|
+
return value;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
24
|
return {
|
|
25
25
|
dsId: value.toString(),
|
|
26
|
-
value
|
|
26
|
+
value,
|
|
27
27
|
label: value.toString(),
|
|
28
28
|
type: 'single'
|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
const getOptions = memoize__default["default"]((step, min, max) => {
|
|
33
|
+
const options = dsUtilities.range(min, max + step, step).map(generateOption);
|
|
34
34
|
return min === 0 ? options.slice(1, options.length) : options;
|
|
35
35
|
});
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
minPerPage = props.minPerPage;
|
|
49
|
-
var options = React.useMemo(function () {
|
|
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(() => {
|
|
50
48
|
if (perPageOptions) return perPageOptions.map(generateOption);
|
|
51
49
|
return getOptions(perPageStep, minPerPage, maxPerPage);
|
|
52
50
|
}, [maxPerPage, minPerPage, perPageOptions, perPageStep]);
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
const actionRef = react.useRef({});
|
|
52
|
+
const btnRef = react.useRef(null);
|
|
53
|
+
react.useEffect(() => {
|
|
56
54
|
if (isOpened) {
|
|
57
55
|
actionRef.current.setActiveDescendant(pageSize.toString());
|
|
58
56
|
actionRef.current.scrollOptionIntoView(pageSize.toString());
|
|
59
57
|
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
60
58
|
|
|
61
59
|
}, [isOpened]);
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
return /*#__PURE__*/React__default['default'].createElement(dsDropdownmenu.DSDropdownMenuV2, {
|
|
60
|
+
const {
|
|
61
|
+
width
|
|
62
|
+
} = dsUtilities.useOnElementResize(btnRef);
|
|
63
|
+
return /*#__PURE__*/_jsx__default["default"](dsDropdownmenu.DSDropdownMenuV2, {
|
|
67
64
|
isOpened: isOpened,
|
|
68
65
|
options: options,
|
|
69
|
-
selectedOptions:
|
|
70
|
-
|
|
66
|
+
selectedOptions: {
|
|
67
|
+
[pageSize.toString()]: true
|
|
68
|
+
},
|
|
69
|
+
onOptionClick: (_, clickedOption) => {
|
|
71
70
|
onPageSizeChange(clickedOption.value);
|
|
72
71
|
setIsOpened(false);
|
|
73
72
|
btnRef.current.focus();
|
|
74
73
|
},
|
|
75
|
-
onClickOutside:
|
|
74
|
+
onClickOutside: () => {
|
|
76
75
|
setIsOpened(false);
|
|
77
76
|
btnRef.current.focus();
|
|
78
77
|
},
|
|
78
|
+
customOffset: [0, 2],
|
|
79
79
|
startPlacementPreference: "top-end",
|
|
80
80
|
actionRef: actionRef,
|
|
81
81
|
minWidth: width + 25,
|
|
82
|
-
maxHeight: 300
|
|
83
|
-
|
|
82
|
+
maxHeight: 300,
|
|
83
|
+
HeaderComp: () => 'Per Page'
|
|
84
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"]("div", {
|
|
84
85
|
style: {
|
|
85
86
|
marginLeft: '32px'
|
|
86
87
|
}
|
|
87
|
-
}, /*#__PURE__*/
|
|
88
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](styled.PaginationDropdownButton, {
|
|
88
89
|
buttonType: "raw",
|
|
89
|
-
onClick:
|
|
90
|
-
return setIsOpened(true);
|
|
91
|
-
},
|
|
90
|
+
onClick: () => setIsOpened(true),
|
|
92
91
|
"aria-pressed": isOpened,
|
|
93
92
|
innerRef: btnRef
|
|
94
|
-
}, pageSize, " / page", /*#__PURE__*/
|
|
93
|
+
}, void 0, pageSize, " / page", /*#__PURE__*/_jsx__default["default"](dsIcons.ChevronDown, {
|
|
95
94
|
color: ['brand-primary', '700']
|
|
96
95
|
}))));
|
|
97
96
|
};
|
|
98
97
|
|
|
99
98
|
module.exports = PerPageSelector;
|
|
100
|
-
//# sourceMappingURL=PerPageSelector.js.map
|
package/cjs/props.js
CHANGED
|
@@ -4,38 +4,33 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var reactDesc = require('react-desc');
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
return null;
|
|
9
|
-
};
|
|
7
|
+
const emptyFunc = () => null;
|
|
10
8
|
|
|
11
|
-
|
|
9
|
+
const propTypes = {
|
|
12
10
|
pageCount: reactDesc.PropTypes.number.description('How many pages are there'),
|
|
13
11
|
pageIndex: reactDesc.PropTypes.number.description('Index of the current page, starting from 1').defaultValue(1),
|
|
14
12
|
canPreviousPage: reactDesc.PropTypes.bool.description('Whether the previous button is disabled or not').defaultValue(true),
|
|
15
13
|
canNextPage: reactDesc.PropTypes.bool.description('Whether the next button is disabled or not').defaultValue(true),
|
|
16
14
|
pageSize: reactDesc.PropTypes.number.description('The current page size').defaultValue(10),
|
|
17
15
|
showPerPageSelector: reactDesc.PropTypes.bool.description('Whether to show the page selector').defaultValue(true),
|
|
18
|
-
perPageOptions: reactDesc.PropTypes.arrayOf(reactDesc.PropTypes.number
|
|
16
|
+
perPageOptions: reactDesc.PropTypes.arrayOf(reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.number, reactDesc.PropTypes.shape({
|
|
17
|
+
dsId: reactDesc.PropTypes.string,
|
|
18
|
+
value: reactDesc.PropTypes.number,
|
|
19
|
+
label: reactDesc.PropTypes.string,
|
|
20
|
+
type: reactDesc.PropTypes.oneOf(['single'])
|
|
21
|
+
})])).description('The available options for page size').defaultValue([10]),
|
|
19
22
|
perPageStep: reactDesc.PropTypes.number.description('Step for the per page options').defaultValue(5),
|
|
20
23
|
minPerPage: reactDesc.PropTypes.number.description('Step for the per page options').defaultValue(0),
|
|
21
24
|
maxPerPage: reactDesc.PropTypes.number.description('Step for the per page options').defaultValue(100),
|
|
22
|
-
onPageSizeChange: reactDesc.PropTypes.func.description('Function invoked when the page size changes').defaultValue(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return null;
|
|
27
|
-
}),
|
|
28
|
-
onPageChange: reactDesc.PropTypes.func.description('Function invoked when the page changes').defaultValue(function () {
|
|
29
|
-
return null;
|
|
30
|
-
}),
|
|
31
|
-
onNextPage: reactDesc.PropTypes.func.description('Function invoked when next button is pressed').defaultValue(function () {
|
|
32
|
-
return null;
|
|
33
|
-
}),
|
|
25
|
+
onPageSizeChange: reactDesc.PropTypes.func.description('Function invoked when the page size changes').defaultValue(() => null),
|
|
26
|
+
onPreviousPage: reactDesc.PropTypes.func.description('Function invoked when the previous button is pressed').defaultValue(() => null),
|
|
27
|
+
onPageChange: reactDesc.PropTypes.func.description('Function invoked when the page changes').defaultValue(() => null),
|
|
28
|
+
onNextPage: reactDesc.PropTypes.func.description('Function invoked when next button is pressed').defaultValue(() => null),
|
|
34
29
|
pageDetails: reactDesc.PropTypes.arrayOf(reactDesc.PropTypes.string).description('Details to provide for each page').defaultValue([]),
|
|
35
30
|
pageDetailsTitle: reactDesc.PropTypes.string.description('The title of the details (usually a column of your dataset)').defaultValue(''),
|
|
36
31
|
width: reactDesc.PropTypes.any.description('Width for the container of the pagination').defaultValue('100%')
|
|
37
32
|
};
|
|
38
|
-
|
|
33
|
+
const defaultProps = {
|
|
39
34
|
pageIndex: 1,
|
|
40
35
|
canPreviousPage: true,
|
|
41
36
|
canNextPage: true,
|
|
@@ -54,6 +49,5 @@ var defaultProps = {
|
|
|
54
49
|
width: '100%'
|
|
55
50
|
};
|
|
56
51
|
|
|
57
|
-
exports.DSPaginationSchema = DSPaginationSchema;
|
|
58
52
|
exports.defaultProps = defaultProps;
|
|
59
|
-
|
|
53
|
+
exports.propTypes = propTypes;
|
package/cjs/styled.js
CHANGED
|
@@ -12,47 +12,33 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
12
12
|
var Grid__default = /*#__PURE__*/_interopDefaultLegacy(Grid);
|
|
13
13
|
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
return typeof size === 'number' && !Number.isNaN(size) ? "".concat(size, "px") : size;
|
|
17
|
-
};
|
|
15
|
+
const sizeToCss = size => typeof size === 'number' && !Number.isNaN(size) ? "".concat(size, "px") : size;
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
const styledFocusCss = _ref => {
|
|
18
|
+
let {
|
|
19
|
+
theme
|
|
20
|
+
} = _ref;
|
|
21
21
|
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}");
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
const PaginationContainer = /*#__PURE__*/styled__default["default"](Grid__default["default"]).withConfig({
|
|
25
25
|
componentId: "sc-mxz59e-0"
|
|
26
|
-
})(["padding:0 ", ";height:42px;width:", ";max-width:100%;align-items:center;box-shadow:0 -1px 3px 0 rgba(0,0,0,0.5);"],
|
|
27
|
-
|
|
28
|
-
}, function (props) {
|
|
29
|
-
return sizeToCss(props.width) || '100%';
|
|
30
|
-
});
|
|
31
|
-
var PaginationWrapper = /*#__PURE__*/styled__default['default'].div.withConfig({
|
|
26
|
+
})(["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%');
|
|
27
|
+
const PaginationWrapper = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
32
28
|
componentId: "sc-mxz59e-1"
|
|
33
29
|
})(["display:flex;justify-content:center;align-items:center;margin:0 32px;"]);
|
|
34
|
-
|
|
30
|
+
const PaginationSeparator = /*#__PURE__*/styled__default["default"](Grid__default["default"]).withConfig({
|
|
35
31
|
componentId: "sc-mxz59e-2"
|
|
36
|
-
})(["background-color:", ";width:1px;height:", ";"],
|
|
37
|
-
|
|
38
|
-
}, function (props) {
|
|
39
|
-
return props.height || '30px';
|
|
40
|
-
});
|
|
41
|
-
var PaginationBoldText = /*#__PURE__*/styled__default['default'].span.withConfig({
|
|
32
|
+
})(["background-color:", ";width:1px;height:", ";"], props => props.theme.colors.neutral[300], props => props.height || '30px');
|
|
33
|
+
const PaginationBoldText = /*#__PURE__*/styled__default["default"].span.withConfig({
|
|
42
34
|
componentId: "sc-mxz59e-3"
|
|
43
|
-
})(["font-weight:", ";", " ", " position:relative;"],
|
|
44
|
-
|
|
45
|
-
}, styledSystem.typography, styledSystem.space);
|
|
46
|
-
var PaginationDropdownButton = /*#__PURE__*/styled__default['default'](dsButton.DSButtonV2).withConfig({
|
|
35
|
+
})(["font-weight:", ";", " ", " position:relative;"], props => props.theme.fontWeights.semibold, styledSystem.typography, styledSystem.space);
|
|
36
|
+
const PaginationDropdownButton = /*#__PURE__*/styled__default["default"](dsButton.DSButtonV2).withConfig({
|
|
47
37
|
componentId: "sc-mxz59e-4"
|
|
48
|
-
})(["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{", "}"],
|
|
49
|
-
|
|
50
|
-
}, function (props) {
|
|
51
|
-
return props.theme.fontWeights.regular;
|
|
52
|
-
}, styledFocusCss);
|
|
53
|
-
var PreviousNextPageButton = /*#__PURE__*/styled__default['default'](dsButton.DSButtonV2).withConfig({
|
|
38
|
+
})(["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);
|
|
39
|
+
const PreviousNextPageButton = /*#__PURE__*/styled__default["default"](dsButton.DSButtonV2).withConfig({
|
|
54
40
|
componentId: "sc-mxz59e-5"
|
|
55
|
-
})(["height:42px;display:grid;place-items:center;position:relative;padding-left:8px;padding-right:8px;border-radius:0;cursor:
|
|
41
|
+
})(["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);
|
|
56
42
|
|
|
57
43
|
exports.PaginationBoldText = PaginationBoldText;
|
|
58
44
|
exports.PaginationContainer = PaginationContainer;
|
|
@@ -60,4 +46,3 @@ exports.PaginationDropdownButton = PaginationDropdownButton;
|
|
|
60
46
|
exports.PaginationSeparator = PaginationSeparator;
|
|
61
47
|
exports.PaginationWrapper = PaginationWrapper;
|
|
62
48
|
exports.PreviousNextPageButton = PreviousNextPageButton;
|
|
63
|
-
//# sourceMappingURL=styled.js.map
|
package/esm/Pagination.js
CHANGED
|
@@ -1,36 +1,27 @@
|
|
|
1
|
-
import
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
7
|
+
import 'react';
|
|
2
8
|
import { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';
|
|
3
9
|
import { describe } from 'react-desc';
|
|
4
10
|
import { PaginationContent } from './parts/PaginationContent.js';
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
import '@elliemae/ds-grid';
|
|
8
|
-
import './styled.js';
|
|
9
|
-
import '@elliemae/ds-button';
|
|
10
|
-
import 'styled-components';
|
|
11
|
-
import 'styled-system';
|
|
12
|
-
import './parts/PerPageSelector.js';
|
|
13
|
-
import '@babel/runtime/helpers/esm/defineProperty';
|
|
14
|
-
import '@babel/runtime/helpers/esm/slicedToArray';
|
|
15
|
-
import 'memoize-one';
|
|
16
|
-
import '@elliemae/ds-utilities';
|
|
17
|
-
import '@elliemae/ds-dropdownmenu';
|
|
18
|
-
import '@elliemae/ds-icons';
|
|
19
|
-
import './parts/Paginator.js';
|
|
20
|
-
import './hooks/usePaginationSearch.js';
|
|
21
|
-
import './PaginationDataTestID.js';
|
|
22
|
-
import './parts/PagePrevButton.js';
|
|
23
|
-
import './parts/PageNextButton.js';
|
|
11
|
+
import { propTypes, defaultProps } from './props.js';
|
|
12
|
+
import { jsx } from 'react/jsx-runtime';
|
|
24
13
|
|
|
25
|
-
var
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
14
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
15
|
+
|
|
16
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
17
|
+
|
|
18
|
+
const DSPagination = props => {
|
|
19
|
+
const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);
|
|
20
|
+
useValidateTypescriptPropTypes(propsWithDefault, propTypes);
|
|
21
|
+
return /*#__PURE__*/jsx(PaginationContent, _objectSpread({}, propsWithDefault));
|
|
29
22
|
};
|
|
30
23
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
DSPaginationWithSchema.propTypes = DSPaginationSchema;
|
|
24
|
+
const DSPaginationWithSchema = describe(DSPagination).description('DSPagination');
|
|
25
|
+
DSPaginationWithSchema.propTypes = propTypes;
|
|
34
26
|
|
|
35
|
-
export { DSPagination };
|
|
36
|
-
//# sourceMappingURL=Pagination.js.map
|
|
27
|
+
export { DSPagination, DSPaginationWithSchema };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
const PAGINATION_DATA_TESTID = {
|
|
2
2
|
PREVIOUS_BUTTON: 'data-table-pagination-prev-button',
|
|
3
3
|
NEXT_BUTTON: 'data-table-pagination-next-button',
|
|
4
4
|
CONTAINER: 'data-table-pagination-container'
|
|
5
5
|
};
|
|
6
6
|
|
|
7
7
|
export { PAGINATION_DATA_TESTID };
|
|
8
|
-
//# sourceMappingURL=PaginationDataTestID.js.map
|