@elliemae/ds-pagination 2.0.0-next.13 → 2.0.0-rc.12
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 +3 -3
- package/cjs/index.js +1 -2
- package/cjs/parts/Paginator.js +1 -0
- package/cjs/parts/PerPageSelector.js +15 -7
- package/cjs/props.js +8 -3
- package/esm/Pagination.js +4 -5
- package/esm/index.js +1 -2
- package/esm/parts/Paginator.js +1 -0
- package/esm/parts/PerPageSelector.js +15 -7
- package/esm/props.js +8 -3
- package/package.json +12 -8
- package/types/Pagination.d.ts +2 -2
- package/types/props.d.ts +56 -18
- package/types/styled.d.ts +6 -46
package/cjs/Pagination.js
CHANGED
|
@@ -25,12 +25,12 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
25
25
|
|
|
26
26
|
const DSPagination = props$1 => {
|
|
27
27
|
const propsWithDefault = dsPropsHelpers.useMemoMergePropsWithDefault(props$1, props.defaultProps);
|
|
28
|
-
dsPropsHelpers.useValidateTypescriptPropTypes(propsWithDefault,
|
|
28
|
+
dsPropsHelpers.useValidateTypescriptPropTypes(propsWithDefault, props.propTypes);
|
|
29
29
|
return /*#__PURE__*/jsxRuntime.jsx(PaginationContent.PaginationContent, _objectSpread({}, propsWithDefault));
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
const DSPaginationWithSchema = reactDesc.describe(DSPagination).description('DSPagination');
|
|
33
|
-
DSPaginationWithSchema.propTypes = props.
|
|
33
|
+
DSPaginationWithSchema.propTypes = props.propTypes;
|
|
34
34
|
|
|
35
|
-
exports.DSPaginationSchema = props.DSPaginationSchema;
|
|
36
35
|
exports.DSPagination = DSPagination;
|
|
36
|
+
exports.DSPaginationWithSchema = DSPaginationWithSchema;
|
package/cjs/index.js
CHANGED
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var Pagination = require('./Pagination.js');
|
|
6
|
-
var props = require('./props.js');
|
|
7
6
|
|
|
8
7
|
|
|
9
8
|
|
|
10
9
|
exports.DSPagination = Pagination.DSPagination;
|
|
11
|
-
exports.
|
|
10
|
+
exports.DSPaginationWithSchema = Pagination.DSPaginationWithSchema;
|
package/cjs/parts/Paginator.js
CHANGED
|
@@ -16,12 +16,18 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
16
16
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
17
17
|
var memoize__default = /*#__PURE__*/_interopDefaultLegacy(memoize);
|
|
18
18
|
|
|
19
|
-
const generateOption = value =>
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
+
};
|
|
25
31
|
|
|
26
32
|
const getOptions = memoize__default["default"]((step, min, max) => {
|
|
27
33
|
const options = dsUtilities.range(min, max + step, step).map(generateOption);
|
|
@@ -69,10 +75,12 @@ const PerPageSelector = props => {
|
|
|
69
75
|
setIsOpened(false);
|
|
70
76
|
btnRef.current.focus();
|
|
71
77
|
},
|
|
78
|
+
customOffset: [0, 2],
|
|
72
79
|
startPlacementPreference: "top-end",
|
|
73
80
|
actionRef: actionRef,
|
|
74
81
|
minWidth: width + 25,
|
|
75
|
-
maxHeight: 300
|
|
82
|
+
maxHeight: 300,
|
|
83
|
+
HeaderComp: () => 'Per Page'
|
|
76
84
|
}, void 0, /*#__PURE__*/_jsx__default["default"]("div", {
|
|
77
85
|
style: {
|
|
78
86
|
marginLeft: '32px'
|
package/cjs/props.js
CHANGED
|
@@ -6,14 +6,19 @@ var reactDesc = require('react-desc');
|
|
|
6
6
|
|
|
7
7
|
const emptyFunc = () => null;
|
|
8
8
|
|
|
9
|
-
const
|
|
9
|
+
const propTypes = {
|
|
10
10
|
pageCount: reactDesc.PropTypes.number.description('How many pages are there'),
|
|
11
11
|
pageIndex: reactDesc.PropTypes.number.description('Index of the current page, starting from 1').defaultValue(1),
|
|
12
12
|
canPreviousPage: reactDesc.PropTypes.bool.description('Whether the previous button is disabled or not').defaultValue(true),
|
|
13
13
|
canNextPage: reactDesc.PropTypes.bool.description('Whether the next button is disabled or not').defaultValue(true),
|
|
14
14
|
pageSize: reactDesc.PropTypes.number.description('The current page size').defaultValue(10),
|
|
15
15
|
showPerPageSelector: reactDesc.PropTypes.bool.description('Whether to show the page selector').defaultValue(true),
|
|
16
|
-
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]),
|
|
17
22
|
perPageStep: reactDesc.PropTypes.number.description('Step for the per page options').defaultValue(5),
|
|
18
23
|
minPerPage: reactDesc.PropTypes.number.description('Step for the per page options').defaultValue(0),
|
|
19
24
|
maxPerPage: reactDesc.PropTypes.number.description('Step for the per page options').defaultValue(100),
|
|
@@ -44,5 +49,5 @@ const defaultProps = {
|
|
|
44
49
|
width: '100%'
|
|
45
50
|
};
|
|
46
51
|
|
|
47
|
-
exports.DSPaginationSchema = DSPaginationSchema;
|
|
48
52
|
exports.defaultProps = defaultProps;
|
|
53
|
+
exports.propTypes = propTypes;
|
package/esm/Pagination.js
CHANGED
|
@@ -8,8 +8,7 @@ import 'react';
|
|
|
8
8
|
import { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';
|
|
9
9
|
import { describe } from 'react-desc';
|
|
10
10
|
import { PaginationContent } from './parts/PaginationContent.js';
|
|
11
|
-
import {
|
|
12
|
-
export { DSPaginationSchema } from './props.js';
|
|
11
|
+
import { propTypes, defaultProps } from './props.js';
|
|
13
12
|
import { jsx } from 'react/jsx-runtime';
|
|
14
13
|
|
|
15
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; }
|
|
@@ -18,11 +17,11 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
18
17
|
|
|
19
18
|
const DSPagination = props => {
|
|
20
19
|
const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);
|
|
21
|
-
useValidateTypescriptPropTypes(propsWithDefault,
|
|
20
|
+
useValidateTypescriptPropTypes(propsWithDefault, propTypes);
|
|
22
21
|
return /*#__PURE__*/jsx(PaginationContent, _objectSpread({}, propsWithDefault));
|
|
23
22
|
};
|
|
24
23
|
|
|
25
24
|
const DSPaginationWithSchema = describe(DSPagination).description('DSPagination');
|
|
26
|
-
DSPaginationWithSchema.propTypes =
|
|
25
|
+
DSPaginationWithSchema.propTypes = propTypes;
|
|
27
26
|
|
|
28
|
-
export { DSPagination };
|
|
27
|
+
export { DSPagination, DSPaginationWithSchema };
|
package/esm/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export { DSPagination } from './Pagination.js';
|
|
2
|
-
export { DSPaginationSchema } from './props.js';
|
|
1
|
+
export { DSPagination, DSPaginationWithSchema } from './Pagination.js';
|
package/esm/parts/Paginator.js
CHANGED
|
@@ -9,12 +9,18 @@ import { DSDropdownMenuV2 } from '@elliemae/ds-dropdownmenu';
|
|
|
9
9
|
import { ChevronDown } from '@elliemae/ds-icons';
|
|
10
10
|
import { PaginationDropdownButton } from '../styled.js';
|
|
11
11
|
|
|
12
|
-
const generateOption = value =>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
const generateOption = value => {
|
|
13
|
+
if (typeof value === 'object') {
|
|
14
|
+
return value;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
dsId: value.toString(),
|
|
19
|
+
value,
|
|
20
|
+
label: value.toString(),
|
|
21
|
+
type: 'single'
|
|
22
|
+
};
|
|
23
|
+
};
|
|
18
24
|
|
|
19
25
|
const getOptions = memoize((step, min, max) => {
|
|
20
26
|
const options = range(min, max + step, step).map(generateOption);
|
|
@@ -62,10 +68,12 @@ const PerPageSelector = props => {
|
|
|
62
68
|
setIsOpened(false);
|
|
63
69
|
btnRef.current.focus();
|
|
64
70
|
},
|
|
71
|
+
customOffset: [0, 2],
|
|
65
72
|
startPlacementPreference: "top-end",
|
|
66
73
|
actionRef: actionRef,
|
|
67
74
|
minWidth: width + 25,
|
|
68
|
-
maxHeight: 300
|
|
75
|
+
maxHeight: 300,
|
|
76
|
+
HeaderComp: () => 'Per Page'
|
|
69
77
|
}, void 0, /*#__PURE__*/_jsx("div", {
|
|
70
78
|
style: {
|
|
71
79
|
marginLeft: '32px'
|
package/esm/props.js
CHANGED
|
@@ -2,14 +2,19 @@ import { PropTypes } from 'react-desc';
|
|
|
2
2
|
|
|
3
3
|
const emptyFunc = () => null;
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const propTypes = {
|
|
6
6
|
pageCount: PropTypes.number.description('How many pages are there'),
|
|
7
7
|
pageIndex: PropTypes.number.description('Index of the current page, starting from 1').defaultValue(1),
|
|
8
8
|
canPreviousPage: PropTypes.bool.description('Whether the previous button is disabled or not').defaultValue(true),
|
|
9
9
|
canNextPage: PropTypes.bool.description('Whether the next button is disabled or not').defaultValue(true),
|
|
10
10
|
pageSize: PropTypes.number.description('The current page size').defaultValue(10),
|
|
11
11
|
showPerPageSelector: PropTypes.bool.description('Whether to show the page selector').defaultValue(true),
|
|
12
|
-
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]),
|
|
13
18
|
perPageStep: PropTypes.number.description('Step for the per page options').defaultValue(5),
|
|
14
19
|
minPerPage: PropTypes.number.description('Step for the per page options').defaultValue(0),
|
|
15
20
|
maxPerPage: PropTypes.number.description('Step for the per page options').defaultValue(100),
|
|
@@ -40,4 +45,4 @@ const defaultProps = {
|
|
|
40
45
|
width: '100%'
|
|
41
46
|
};
|
|
42
47
|
|
|
43
|
-
export {
|
|
48
|
+
export { defaultProps, propTypes };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-pagination",
|
|
3
|
-
"version": "2.0.0-
|
|
3
|
+
"version": "2.0.0-rc.12",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Pagination",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -72,21 +72,25 @@
|
|
|
72
72
|
"build": "node ../../scripts/build/build.js"
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
|
-
"@elliemae/ds-
|
|
76
|
-
"@elliemae/ds-
|
|
77
|
-
"@elliemae/ds-
|
|
78
|
-
"@elliemae/ds-
|
|
79
|
-
"@elliemae/ds-
|
|
75
|
+
"@elliemae/ds-button": "2.0.0-rc.12",
|
|
76
|
+
"@elliemae/ds-dropdownmenu": "2.0.0-rc.12",
|
|
77
|
+
"@elliemae/ds-grid": "2.0.0-rc.12",
|
|
78
|
+
"@elliemae/ds-icons": "2.0.0-rc.12",
|
|
79
|
+
"@elliemae/ds-props-helpers": "2.0.0-rc.12",
|
|
80
|
+
"@elliemae/ds-utilities": "2.0.0-rc.12",
|
|
81
|
+
"memoize-one": "~5.1.1",
|
|
80
82
|
"react-desc": "~4.1.3"
|
|
81
83
|
},
|
|
82
84
|
"devDependencies": {
|
|
83
|
-
"styled-components": "~5.3.3"
|
|
85
|
+
"styled-components": "~5.3.3",
|
|
86
|
+
"styled-system": "~5.1.5"
|
|
84
87
|
},
|
|
85
88
|
"peerDependencies": {
|
|
86
89
|
"lodash": "^4.17.21",
|
|
87
90
|
"react": "^17.0.2",
|
|
88
91
|
"react-dom": "^17.0.2",
|
|
89
|
-
"styled-components": "^5.3.3"
|
|
92
|
+
"styled-components": "^5.3.3",
|
|
93
|
+
"styled-system": "^5.1.5"
|
|
90
94
|
},
|
|
91
95
|
"publishConfig": {
|
|
92
96
|
"access": "public",
|
package/types/Pagination.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { DSPaginationSchema } from './props';
|
|
3
2
|
import { DSPaginationProps } from './index.d';
|
|
4
3
|
declare const DSPagination: React.ComponentType<DSPaginationProps>;
|
|
5
|
-
|
|
4
|
+
declare const DSPaginationWithSchema: any;
|
|
5
|
+
export { DSPagination, DSPaginationWithSchema };
|
package/types/props.d.ts
CHANGED
|
@@ -1,21 +1,59 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
+
};
|
|
19
57
|
};
|
|
20
58
|
export declare const defaultProps: {
|
|
21
59
|
pageIndex: number;
|
package/types/styled.d.ts
CHANGED
|
@@ -1,47 +1,7 @@
|
|
|
1
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>>,
|
|
3
|
-
export declare const PaginationWrapper: import("styled-components").StyledComponent<"div",
|
|
4
|
-
export declare const PaginationSeparator: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("@elliemae/ds-grid/types/types").GridPropsT & import("react").RefAttributes<HTMLDivElement>>,
|
|
5
|
-
export declare const PaginationBoldText: import("styled-components").StyledComponent<"span",
|
|
6
|
-
export declare const PaginationDropdownButton: import("styled-components").StyledComponent<
|
|
7
|
-
|
|
8
|
-
propTypes: {
|
|
9
|
-
id: any;
|
|
10
|
-
buttonType: any;
|
|
11
|
-
size: any;
|
|
12
|
-
disabled: any;
|
|
13
|
-
onClick: any;
|
|
14
|
-
onKeyDown: any;
|
|
15
|
-
onBlur: any;
|
|
16
|
-
onFocus: any;
|
|
17
|
-
className: any;
|
|
18
|
-
tabIndex: any;
|
|
19
|
-
innerRef: any;
|
|
20
|
-
'aria-label': any;
|
|
21
|
-
'aria-pressed': any;
|
|
22
|
-
'data-testid': any;
|
|
23
|
-
role: any;
|
|
24
|
-
children: any;
|
|
25
|
-
};
|
|
26
|
-
}, any, {}, never>;
|
|
27
|
-
export declare const PreviousNextPageButton: import("styled-components").StyledComponent<{
|
|
28
|
-
(props: import("@elliemae/ds-button/types/v2/DSButtonV2Types").DSButtonPropsT): JSX.Element;
|
|
29
|
-
propTypes: {
|
|
30
|
-
id: any;
|
|
31
|
-
buttonType: any;
|
|
32
|
-
size: any;
|
|
33
|
-
disabled: any;
|
|
34
|
-
onClick: any;
|
|
35
|
-
onKeyDown: any;
|
|
36
|
-
onBlur: any;
|
|
37
|
-
onFocus: any;
|
|
38
|
-
className: any;
|
|
39
|
-
tabIndex: any;
|
|
40
|
-
innerRef: any;
|
|
41
|
-
'aria-label': any;
|
|
42
|
-
'aria-pressed': any;
|
|
43
|
-
'data-testid': any;
|
|
44
|
-
role: any;
|
|
45
|
-
children: any;
|
|
46
|
-
};
|
|
47
|
-
}, any, {}, never>;
|
|
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<any, import("styled-components").DefaultTheme, any, any>;
|
|
7
|
+
export declare const PreviousNextPageButton: import("styled-components").StyledComponent<any, import("styled-components").DefaultTheme, any, any>;
|