@elliemae/ds-page-number 1.60.0 → 2.0.0-alpha.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/DSPageNumber.js +96 -93
- package/cjs/DSPageNumber.test.js +48 -0
- package/cjs/components/utils.js +4 -5
- package/cjs/index.js +1 -12
- package/esm/DSPageNumber.js +87 -83
- package/esm/DSPageNumber.test.js +42 -0
- package/esm/components/utils.js +4 -5
- package/esm/index.js +0 -11
- package/package.json +42 -15
- package/types/DSPageNumber.d.ts +83 -0
- package/types/DSPageNumber.test.d.ts +1 -0
- package/types/components/utils.d.ts +2 -0
- package/types/index.d.ts +2 -0
- package/DSPageNumber/package.json +0 -10
- package/cjs/DSPageNumber.js.map +0 -1
- package/cjs/components/utils.js.map +0 -1
- package/cjs/index.js.map +0 -1
- package/components/utils/package.json +0 -10
- package/esm/DSPageNumber.js.map +0 -1
- package/esm/components/utils.js.map +0 -1
- package/esm/index.js.map +0 -1
package/cjs/DSPageNumber.js
CHANGED
|
@@ -2,129 +2,136 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
var
|
|
5
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
|
+
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
7
7
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
8
|
-
|
|
8
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
9
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
10
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
11
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
12
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
13
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
14
|
+
var react = require('react');
|
|
9
15
|
var reactDesc = require('react-desc');
|
|
10
16
|
var dsClassnames = require('@elliemae/ds-classnames');
|
|
11
17
|
var dsIcons = require('@elliemae/ds-icons');
|
|
12
18
|
var DSButton = require('@elliemae/ds-button');
|
|
13
19
|
var dsForm = require('@elliemae/ds-form');
|
|
14
|
-
var
|
|
20
|
+
var utils = require('./components/utils.js');
|
|
21
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
15
22
|
|
|
16
23
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
17
24
|
|
|
18
|
-
var
|
|
19
|
-
var
|
|
25
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
26
|
+
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
20
27
|
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
21
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
22
28
|
var DSButton__default = /*#__PURE__*/_interopDefaultLegacy(DSButton);
|
|
23
29
|
|
|
24
|
-
var
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
var calculatedWidth = components_utils.lengthToSize(width, page);
|
|
30
|
+
var _ChevronSmallUp, _ChevronSmallDown;
|
|
31
|
+
|
|
32
|
+
const _excluded = ["className", "disabled", "value", "onChange", "containerProps", "currentPage", "totalPages", "separator"];
|
|
33
|
+
|
|
34
|
+
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; }
|
|
35
|
+
|
|
36
|
+
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__default["default"](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; }
|
|
37
|
+
const blockName = 'page-number-block';
|
|
38
|
+
const PageNumberInputContainer = dsClassnames.aggregatedClasses(dsForm.DSInputGroup)(blockName);
|
|
39
|
+
|
|
40
|
+
const DSPageNumber = _ref => {
|
|
41
|
+
let {
|
|
42
|
+
className,
|
|
43
|
+
disabled,
|
|
44
|
+
value,
|
|
45
|
+
onChange,
|
|
46
|
+
containerProps,
|
|
47
|
+
currentPage,
|
|
48
|
+
totalPages,
|
|
49
|
+
separator
|
|
50
|
+
} = _ref,
|
|
51
|
+
otherProps = _objectWithoutProperties__default["default"](_ref, _excluded);
|
|
52
|
+
|
|
53
|
+
const safeTotal = utils.cleanPage(totalPages);
|
|
54
|
+
const ref = react.useRef(null);
|
|
55
|
+
const {
|
|
56
|
+
cssClassName,
|
|
57
|
+
classNameElement
|
|
58
|
+
} = dsClassnames.convertPropToCssClassName('page-number', className, {
|
|
59
|
+
disabled
|
|
60
|
+
});
|
|
61
|
+
const [page, setPage] = react.useState(utils.cleanPage(currentPage) || 1);
|
|
62
|
+
const [size, setSize] = react.useState(null);
|
|
63
|
+
react.useEffect(() => {
|
|
64
|
+
const {
|
|
65
|
+
width
|
|
66
|
+
} = ref.current.getBoundingClientRect();
|
|
67
|
+
const calculatedWidth = utils.lengthToSize(width, page);
|
|
63
68
|
setSize(calculatedWidth);
|
|
64
69
|
}, [page, safeTotal]);
|
|
65
70
|
|
|
66
71
|
function handleUpdateInput(e) {
|
|
67
|
-
|
|
72
|
+
const newValue = utils.cleanPage(e.target.value);
|
|
68
73
|
if (newValue > safeTotal || newValue === 0) return;
|
|
69
74
|
setPage(newValue);
|
|
70
75
|
onChange(newValue);
|
|
71
76
|
}
|
|
72
77
|
|
|
73
78
|
function handleIncrease() {
|
|
74
|
-
|
|
79
|
+
const newValue = page ? parseInt(page, 10) + 1 : 1;
|
|
75
80
|
if (newValue > safeTotal) return;
|
|
76
81
|
setPage(newValue);
|
|
77
82
|
onChange(newValue);
|
|
78
83
|
}
|
|
79
84
|
|
|
80
85
|
function handleDecrease() {
|
|
81
|
-
|
|
86
|
+
const newValue = page ? parseInt(page, 10) - 1 : 1;
|
|
82
87
|
if (newValue < 1) return;
|
|
83
88
|
setPage(newValue);
|
|
84
89
|
onChange(newValue);
|
|
85
90
|
}
|
|
86
91
|
|
|
87
|
-
return /*#__PURE__*/
|
|
92
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", _objectSpread(_objectSpread(_objectSpread({
|
|
88
93
|
"data-testid": "ds-page-number",
|
|
89
94
|
className: "".concat(cssClassName)
|
|
90
|
-
}, containerProps, otherProps),
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
"
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
"
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
95
|
+
}, containerProps), otherProps), {}, {
|
|
96
|
+
children: /*#__PURE__*/_jsx__default["default"](PageNumberInputContainer, {}, void 0, /*#__PURE__*/_jsx__default["default"]("div", {
|
|
97
|
+
className: "".concat(classNameElement('pages'))
|
|
98
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](dsForm.DSInput, {
|
|
99
|
+
className: "".concat(classNameElement('input')),
|
|
100
|
+
"data-testid": "page-number__current-page",
|
|
101
|
+
onChange: handleUpdateInput,
|
|
102
|
+
style: {
|
|
103
|
+
width: "".concat(size, "px")
|
|
104
|
+
},
|
|
105
|
+
value: page
|
|
106
|
+
}), /*#__PURE__*/_jsx__default["default"]("div", {
|
|
107
|
+
className: "".concat(classNameElement('separator'))
|
|
108
|
+
}, void 0, separator), /*#__PURE__*/_jsx__default["default"]("div", {
|
|
109
|
+
className: "".concat(classNameElement('total')),
|
|
110
|
+
"data-testid": "page-number__total-pages"
|
|
111
|
+
}, void 0, totalPages), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
112
|
+
ref: ref,
|
|
113
|
+
className: "".concat(classNameElement('ref'))
|
|
114
|
+
})), /*#__PURE__*/_jsx__default["default"]("div", {
|
|
115
|
+
className: "".concat(classNameElement('limiter'))
|
|
116
|
+
}), /*#__PURE__*/_jsx__default["default"](DSButton__default["default"], {
|
|
117
|
+
"aria-label": "dropdown-indicator",
|
|
118
|
+
buttonType: "text",
|
|
119
|
+
className: "dropdown-indicator",
|
|
120
|
+
"data-testid": "page-number__increase",
|
|
121
|
+
icon: _ChevronSmallUp || (_ChevronSmallUp = /*#__PURE__*/_jsx__default["default"](dsIcons.ChevronSmallUp, {})),
|
|
122
|
+
onClick: handleIncrease
|
|
123
|
+
}), /*#__PURE__*/_jsx__default["default"](DSButton__default["default"], {
|
|
124
|
+
"aria-label": "dropdown-indicator",
|
|
125
|
+
buttonType: "text",
|
|
126
|
+
className: "dropdown-indicator",
|
|
127
|
+
"data-testid": "page-number__decrease",
|
|
128
|
+
icon: _ChevronSmallDown || (_ChevronSmallDown = /*#__PURE__*/_jsx__default["default"](dsIcons.ChevronSmallDown, {})),
|
|
129
|
+
onClick: handleDecrease
|
|
130
|
+
}))
|
|
131
|
+
}));
|
|
125
132
|
};
|
|
126
133
|
|
|
127
|
-
|
|
134
|
+
const pageNumberProps = {
|
|
128
135
|
className: reactDesc.PropTypes.string.description('html class attribute'),
|
|
129
136
|
containerProps: reactDesc.PropTypes.object.description('Set of Properties attached to the main container'),
|
|
130
137
|
disabled: reactDesc.PropTypes.bool.description('Whether the component is disabled or not').defaultValue(false),
|
|
@@ -134,15 +141,12 @@ var pageNumberProps = {
|
|
|
134
141
|
totalPages: reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.string, reactDesc.PropTypes.number]).description('Amount of pages').defaultValue(1),
|
|
135
142
|
separator: reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.string, reactDesc.PropTypes.number]).description('Separator between current page and total pages').defaultValue('/')
|
|
136
143
|
};
|
|
137
|
-
|
|
138
|
-
var PageNumberWithSchema = reactDesc.describe(DSPageNumber);
|
|
144
|
+
const PageNumberWithSchema = reactDesc.describe(DSPageNumber);
|
|
139
145
|
PageNumberWithSchema.propTypes = pageNumberProps;
|
|
140
146
|
DSPageNumber.defaultProps = {
|
|
141
147
|
className: '',
|
|
142
148
|
disabled: false,
|
|
143
|
-
onChange:
|
|
144
|
-
return null;
|
|
145
|
-
},
|
|
149
|
+
onChange: () => null,
|
|
146
150
|
containerProps: {},
|
|
147
151
|
value: undefined,
|
|
148
152
|
currentPage: undefined,
|
|
@@ -152,5 +156,4 @@ DSPageNumber.defaultProps = {
|
|
|
152
156
|
|
|
153
157
|
exports.DSPageNumber = DSPageNumber;
|
|
154
158
|
exports.PageNumberWithSchema = PageNumberWithSchema;
|
|
155
|
-
exports[
|
|
156
|
-
//# sourceMappingURL=DSPageNumber.js.map
|
|
159
|
+
exports["default"] = DSPageNumber;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
4
|
+
require('react');
|
|
5
|
+
require('@testing-library/jest-dom/extend-expect');
|
|
6
|
+
var react = require('@testing-library/react');
|
|
7
|
+
var DSPageNumber = require('./DSPageNumber.js');
|
|
8
|
+
|
|
9
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
|
+
|
|
11
|
+
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
12
|
+
|
|
13
|
+
var _PageNumber, _PageNumber2, _PageNumber3;
|
|
14
|
+
test('Increases page number ', async () => {
|
|
15
|
+
const {
|
|
16
|
+
queryByTestId
|
|
17
|
+
} = react.render(_PageNumber || (_PageNumber = /*#__PURE__*/_jsx__default["default"](DSPageNumber.DSPageNumber, {
|
|
18
|
+
totalPages: 3
|
|
19
|
+
})));
|
|
20
|
+
const increaseButton = queryByTestId('page-number__increase');
|
|
21
|
+
const currentPage = queryByTestId('page-number__current-page');
|
|
22
|
+
react.fireEvent.click(increaseButton);
|
|
23
|
+
expect(currentPage).toHaveValue('2');
|
|
24
|
+
});
|
|
25
|
+
test('Decreases page number ', async () => {
|
|
26
|
+
const {
|
|
27
|
+
queryByTestId
|
|
28
|
+
} = react.render(_PageNumber2 || (_PageNumber2 = /*#__PURE__*/_jsx__default["default"](DSPageNumber.DSPageNumber, {
|
|
29
|
+
currentPage: 2,
|
|
30
|
+
totalPages: 3
|
|
31
|
+
})));
|
|
32
|
+
const decreaseButton = queryByTestId('page-number__decrease');
|
|
33
|
+
const currentPage = queryByTestId('page-number__current-page');
|
|
34
|
+
react.fireEvent.click(decreaseButton);
|
|
35
|
+
expect(currentPage).toHaveValue('1');
|
|
36
|
+
});
|
|
37
|
+
test('Increases page number until last page number', async () => {
|
|
38
|
+
const {
|
|
39
|
+
queryByTestId
|
|
40
|
+
} = react.render(_PageNumber3 || (_PageNumber3 = /*#__PURE__*/_jsx__default["default"](DSPageNumber.DSPageNumber, {
|
|
41
|
+
currentPage: 2,
|
|
42
|
+
totalPages: 3
|
|
43
|
+
})));
|
|
44
|
+
const increaseButton = queryByTestId('page-number__increase');
|
|
45
|
+
const currentPage = queryByTestId('page-number__current-page');
|
|
46
|
+
react.fireEvent.click(increaseButton);
|
|
47
|
+
expect(currentPage).toHaveValue('3');
|
|
48
|
+
});
|
package/cjs/components/utils.js
CHANGED
|
@@ -2,14 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
require('core-js/modules/es.string.replace.js');
|
|
6
|
+
|
|
7
|
+
const lengthToSize = (referenceWidth, value) => referenceWidth + referenceWidth / 7 * String(value).length;
|
|
8
|
+
const cleanPage = value => {
|
|
9
9
|
if (!value || value === '' || isNaN(parseInt(value))) return '';
|
|
10
10
|
return parseInt(String(value || 1).replace(/\D/g, ''), 10);
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
exports.cleanPage = cleanPage;
|
|
14
14
|
exports.lengthToSize = lengthToSize;
|
|
15
|
-
//# sourceMappingURL=utils.js.map
|
package/cjs/index.js
CHANGED
|
@@ -3,20 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var DSPageNumber = require('./DSPageNumber.js');
|
|
6
|
-
require('@babel/runtime/helpers/extends');
|
|
7
|
-
require('@babel/runtime/helpers/slicedToArray');
|
|
8
|
-
require('@babel/runtime/helpers/objectWithoutProperties');
|
|
9
|
-
require('react');
|
|
10
|
-
require('react-desc');
|
|
11
|
-
require('@elliemae/ds-classnames');
|
|
12
|
-
require('@elliemae/ds-icons');
|
|
13
|
-
require('@elliemae/ds-button');
|
|
14
|
-
require('@elliemae/ds-form');
|
|
15
|
-
require('./components/utils.js');
|
|
16
6
|
|
|
17
7
|
|
|
18
8
|
|
|
19
9
|
exports.DSPageNumber = DSPageNumber.DSPageNumber;
|
|
20
10
|
exports.PageNumberWithSchema = DSPageNumber.PageNumberWithSchema;
|
|
21
|
-
exports
|
|
22
|
-
//# sourceMappingURL=index.js.map
|
|
11
|
+
exports["default"] = DSPageNumber.DSPageNumber;
|
package/esm/DSPageNumber.js
CHANGED
|
@@ -1,118 +1,126 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
3
3
|
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
4
|
-
import
|
|
4
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
5
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
6
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
7
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
8
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
9
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
10
|
+
import { useRef, useState, useEffect } from 'react';
|
|
5
11
|
import { PropTypes, describe } from 'react-desc';
|
|
6
12
|
import { aggregatedClasses, convertPropToCssClassName } from '@elliemae/ds-classnames';
|
|
7
13
|
import { ChevronSmallUp, ChevronSmallDown } from '@elliemae/ds-icons';
|
|
8
14
|
import DSButton from '@elliemae/ds-button';
|
|
9
15
|
import { DSInputGroup, DSInput } from '@elliemae/ds-form';
|
|
10
16
|
import { cleanPage, lengthToSize } from './components/utils.js';
|
|
17
|
+
import { jsx } from 'react/jsx-runtime';
|
|
11
18
|
|
|
12
|
-
var
|
|
13
|
-
var blockName = 'page-number-block';
|
|
14
|
-
var PageNumberInputContainer = aggregatedClasses(DSInputGroup)(blockName);
|
|
19
|
+
var _ChevronSmallUp, _ChevronSmallDown;
|
|
15
20
|
|
|
16
|
-
|
|
17
|
-
var className = _ref.className,
|
|
18
|
-
disabled = _ref.disabled;
|
|
19
|
-
_ref.value;
|
|
20
|
-
var onChange = _ref.onChange,
|
|
21
|
-
containerProps = _ref.containerProps,
|
|
22
|
-
currentPage = _ref.currentPage,
|
|
23
|
-
totalPages = _ref.totalPages,
|
|
24
|
-
separator = _ref.separator,
|
|
25
|
-
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
26
|
-
|
|
27
|
-
var safeTotal = cleanPage(totalPages);
|
|
28
|
-
var ref = useRef(null);
|
|
21
|
+
const _excluded = ["className", "disabled", "value", "onChange", "containerProps", "currentPage", "totalPages", "separator"];
|
|
29
22
|
|
|
30
|
-
|
|
31
|
-
disabled: disabled
|
|
32
|
-
}),
|
|
33
|
-
cssClassName = _convertPropToCssClas.cssClassName,
|
|
34
|
-
classNameElement = _convertPropToCssClas.classNameElement;
|
|
23
|
+
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; }
|
|
35
24
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
setPage = _useState2[1];
|
|
25
|
+
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; }
|
|
26
|
+
const blockName = 'page-number-block';
|
|
27
|
+
const PageNumberInputContainer = aggregatedClasses(DSInputGroup)(blockName);
|
|
40
28
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
29
|
+
const DSPageNumber = _ref => {
|
|
30
|
+
let {
|
|
31
|
+
className,
|
|
32
|
+
disabled,
|
|
33
|
+
value,
|
|
34
|
+
onChange,
|
|
35
|
+
containerProps,
|
|
36
|
+
currentPage,
|
|
37
|
+
totalPages,
|
|
38
|
+
separator
|
|
39
|
+
} = _ref,
|
|
40
|
+
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
49
41
|
|
|
50
|
-
|
|
42
|
+
const safeTotal = cleanPage(totalPages);
|
|
43
|
+
const ref = useRef(null);
|
|
44
|
+
const {
|
|
45
|
+
cssClassName,
|
|
46
|
+
classNameElement
|
|
47
|
+
} = convertPropToCssClassName('page-number', className, {
|
|
48
|
+
disabled
|
|
49
|
+
});
|
|
50
|
+
const [page, setPage] = useState(cleanPage(currentPage) || 1);
|
|
51
|
+
const [size, setSize] = useState(null);
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
const {
|
|
54
|
+
width
|
|
55
|
+
} = ref.current.getBoundingClientRect();
|
|
56
|
+
const calculatedWidth = lengthToSize(width, page);
|
|
51
57
|
setSize(calculatedWidth);
|
|
52
58
|
}, [page, safeTotal]);
|
|
53
59
|
|
|
54
60
|
function handleUpdateInput(e) {
|
|
55
|
-
|
|
61
|
+
const newValue = cleanPage(e.target.value);
|
|
56
62
|
if (newValue > safeTotal || newValue === 0) return;
|
|
57
63
|
setPage(newValue);
|
|
58
64
|
onChange(newValue);
|
|
59
65
|
}
|
|
60
66
|
|
|
61
67
|
function handleIncrease() {
|
|
62
|
-
|
|
68
|
+
const newValue = page ? parseInt(page, 10) + 1 : 1;
|
|
63
69
|
if (newValue > safeTotal) return;
|
|
64
70
|
setPage(newValue);
|
|
65
71
|
onChange(newValue);
|
|
66
72
|
}
|
|
67
73
|
|
|
68
74
|
function handleDecrease() {
|
|
69
|
-
|
|
75
|
+
const newValue = page ? parseInt(page, 10) - 1 : 1;
|
|
70
76
|
if (newValue < 1) return;
|
|
71
77
|
setPage(newValue);
|
|
72
78
|
onChange(newValue);
|
|
73
79
|
}
|
|
74
80
|
|
|
75
|
-
return /*#__PURE__*/
|
|
81
|
+
return /*#__PURE__*/jsx("div", _objectSpread(_objectSpread(_objectSpread({
|
|
76
82
|
"data-testid": "ds-page-number",
|
|
77
83
|
className: "".concat(cssClassName)
|
|
78
|
-
}, containerProps, otherProps),
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
84
|
+
}, containerProps), otherProps), {}, {
|
|
85
|
+
children: /*#__PURE__*/_jsx(PageNumberInputContainer, {}, void 0, /*#__PURE__*/_jsx("div", {
|
|
86
|
+
className: "".concat(classNameElement('pages'))
|
|
87
|
+
}, void 0, /*#__PURE__*/_jsx(DSInput, {
|
|
88
|
+
className: "".concat(classNameElement('input')),
|
|
89
|
+
"data-testid": "page-number__current-page",
|
|
90
|
+
onChange: handleUpdateInput,
|
|
91
|
+
style: {
|
|
92
|
+
width: "".concat(size, "px")
|
|
93
|
+
},
|
|
94
|
+
value: page
|
|
95
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
96
|
+
className: "".concat(classNameElement('separator'))
|
|
97
|
+
}, void 0, separator), /*#__PURE__*/_jsx("div", {
|
|
98
|
+
className: "".concat(classNameElement('total')),
|
|
99
|
+
"data-testid": "page-number__total-pages"
|
|
100
|
+
}, void 0, totalPages), /*#__PURE__*/jsx("div", {
|
|
101
|
+
ref: ref,
|
|
102
|
+
className: "".concat(classNameElement('ref'))
|
|
103
|
+
})), /*#__PURE__*/_jsx("div", {
|
|
104
|
+
className: "".concat(classNameElement('limiter'))
|
|
105
|
+
}), /*#__PURE__*/_jsx(DSButton, {
|
|
106
|
+
"aria-label": "dropdown-indicator",
|
|
107
|
+
buttonType: "text",
|
|
108
|
+
className: "dropdown-indicator",
|
|
109
|
+
"data-testid": "page-number__increase",
|
|
110
|
+
icon: _ChevronSmallUp || (_ChevronSmallUp = /*#__PURE__*/_jsx(ChevronSmallUp, {})),
|
|
111
|
+
onClick: handleIncrease
|
|
112
|
+
}), /*#__PURE__*/_jsx(DSButton, {
|
|
113
|
+
"aria-label": "dropdown-indicator",
|
|
114
|
+
buttonType: "text",
|
|
115
|
+
className: "dropdown-indicator",
|
|
116
|
+
"data-testid": "page-number__decrease",
|
|
117
|
+
icon: _ChevronSmallDown || (_ChevronSmallDown = /*#__PURE__*/_jsx(ChevronSmallDown, {})),
|
|
118
|
+
onClick: handleDecrease
|
|
119
|
+
}))
|
|
120
|
+
}));
|
|
113
121
|
};
|
|
114
122
|
|
|
115
|
-
|
|
123
|
+
const pageNumberProps = {
|
|
116
124
|
className: PropTypes.string.description('html class attribute'),
|
|
117
125
|
containerProps: PropTypes.object.description('Set of Properties attached to the main container'),
|
|
118
126
|
disabled: PropTypes.bool.description('Whether the component is disabled or not').defaultValue(false),
|
|
@@ -122,15 +130,12 @@ var pageNumberProps = {
|
|
|
122
130
|
totalPages: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description('Amount of pages').defaultValue(1),
|
|
123
131
|
separator: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description('Separator between current page and total pages').defaultValue('/')
|
|
124
132
|
};
|
|
125
|
-
|
|
126
|
-
var PageNumberWithSchema = describe(DSPageNumber);
|
|
133
|
+
const PageNumberWithSchema = describe(DSPageNumber);
|
|
127
134
|
PageNumberWithSchema.propTypes = pageNumberProps;
|
|
128
135
|
DSPageNumber.defaultProps = {
|
|
129
136
|
className: '',
|
|
130
137
|
disabled: false,
|
|
131
|
-
onChange:
|
|
132
|
-
return null;
|
|
133
|
-
},
|
|
138
|
+
onChange: () => null,
|
|
134
139
|
containerProps: {},
|
|
135
140
|
value: undefined,
|
|
136
141
|
currentPage: undefined,
|
|
@@ -139,4 +144,3 @@ DSPageNumber.defaultProps = {
|
|
|
139
144
|
};
|
|
140
145
|
|
|
141
146
|
export { DSPageNumber, PageNumberWithSchema, DSPageNumber as default };
|
|
142
|
-
//# sourceMappingURL=DSPageNumber.js.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'react';
|
|
3
|
+
import '@testing-library/jest-dom/extend-expect';
|
|
4
|
+
import { render, fireEvent } from '@testing-library/react';
|
|
5
|
+
import { DSPageNumber } from './DSPageNumber.js';
|
|
6
|
+
|
|
7
|
+
var _PageNumber, _PageNumber2, _PageNumber3;
|
|
8
|
+
test('Increases page number ', async () => {
|
|
9
|
+
const {
|
|
10
|
+
queryByTestId
|
|
11
|
+
} = render(_PageNumber || (_PageNumber = /*#__PURE__*/_jsx(DSPageNumber, {
|
|
12
|
+
totalPages: 3
|
|
13
|
+
})));
|
|
14
|
+
const increaseButton = queryByTestId('page-number__increase');
|
|
15
|
+
const currentPage = queryByTestId('page-number__current-page');
|
|
16
|
+
fireEvent.click(increaseButton);
|
|
17
|
+
expect(currentPage).toHaveValue('2');
|
|
18
|
+
});
|
|
19
|
+
test('Decreases page number ', async () => {
|
|
20
|
+
const {
|
|
21
|
+
queryByTestId
|
|
22
|
+
} = render(_PageNumber2 || (_PageNumber2 = /*#__PURE__*/_jsx(DSPageNumber, {
|
|
23
|
+
currentPage: 2,
|
|
24
|
+
totalPages: 3
|
|
25
|
+
})));
|
|
26
|
+
const decreaseButton = queryByTestId('page-number__decrease');
|
|
27
|
+
const currentPage = queryByTestId('page-number__current-page');
|
|
28
|
+
fireEvent.click(decreaseButton);
|
|
29
|
+
expect(currentPage).toHaveValue('1');
|
|
30
|
+
});
|
|
31
|
+
test('Increases page number until last page number', async () => {
|
|
32
|
+
const {
|
|
33
|
+
queryByTestId
|
|
34
|
+
} = render(_PageNumber3 || (_PageNumber3 = /*#__PURE__*/_jsx(DSPageNumber, {
|
|
35
|
+
currentPage: 2,
|
|
36
|
+
totalPages: 3
|
|
37
|
+
})));
|
|
38
|
+
const increaseButton = queryByTestId('page-number__increase');
|
|
39
|
+
const currentPage = queryByTestId('page-number__current-page');
|
|
40
|
+
fireEvent.click(increaseButton);
|
|
41
|
+
expect(currentPage).toHaveValue('3');
|
|
42
|
+
});
|
package/esm/components/utils.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import 'core-js/modules/es.string.replace.js';
|
|
2
|
+
|
|
3
|
+
const lengthToSize = (referenceWidth, value) => referenceWidth + referenceWidth / 7 * String(value).length;
|
|
4
|
+
const cleanPage = value => {
|
|
5
5
|
if (!value || value === '' || isNaN(parseInt(value))) return '';
|
|
6
6
|
return parseInt(String(value || 1).replace(/\D/g, ''), 10);
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
export { cleanPage, lengthToSize };
|
|
10
|
-
//# sourceMappingURL=utils.js.map
|
package/esm/index.js
CHANGED
|
@@ -1,12 +1 @@
|
|
|
1
1
|
export { DSPageNumber, PageNumberWithSchema, DSPageNumber as default } from './DSPageNumber.js';
|
|
2
|
-
import '@babel/runtime/helpers/esm/extends';
|
|
3
|
-
import '@babel/runtime/helpers/esm/slicedToArray';
|
|
4
|
-
import '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
5
|
-
import 'react';
|
|
6
|
-
import 'react-desc';
|
|
7
|
-
import '@elliemae/ds-classnames';
|
|
8
|
-
import '@elliemae/ds-icons';
|
|
9
|
-
import '@elliemae/ds-button';
|
|
10
|
-
import '@elliemae/ds-form';
|
|
11
|
-
import './components/utils.js';
|
|
12
|
-
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,14 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-page-number",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-alpha.12",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"description": "
|
|
6
|
-
"module": "esm/index.js",
|
|
7
|
-
"main": "cjs/index.js",
|
|
5
|
+
"description": "ICE MT - Dimsum - Page Number",
|
|
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
|
+
"./DSPageNumber": {
|
|
15
|
+
"import": "./esm/DSPageNumber.js",
|
|
16
|
+
"require": "./cjs/DSPageNumber.js"
|
|
17
|
+
},
|
|
18
|
+
"./components/utils": {
|
|
19
|
+
"import": "./esm/components/utils.js",
|
|
20
|
+
"require": "./cjs/components/utils.js"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
8
23
|
"sideEffects": [
|
|
9
24
|
"*.css",
|
|
10
25
|
"*.scss"
|
|
11
26
|
],
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "https://git.elliemae.io/platform-ui/dimsum.git"
|
|
30
|
+
},
|
|
31
|
+
"engines": {
|
|
32
|
+
"npm": ">=7",
|
|
33
|
+
"node": ">=14"
|
|
34
|
+
},
|
|
35
|
+
"author": "ICE MT",
|
|
12
36
|
"scripts": {
|
|
13
37
|
"dev": "cross-env NODE_ENV=development && node ../../scripts/build/build.js -w",
|
|
14
38
|
"prebuild": "exit 0",
|
|
@@ -16,23 +40,26 @@
|
|
|
16
40
|
"build": "node ../../scripts/build/build.js"
|
|
17
41
|
},
|
|
18
42
|
"dependencies": {
|
|
19
|
-
"@elliemae/ds-button": "
|
|
20
|
-
"@elliemae/ds-classnames": "
|
|
21
|
-
"@elliemae/ds-form": "
|
|
22
|
-
"@elliemae/ds-icons": "
|
|
23
|
-
"react-desc": "
|
|
43
|
+
"@elliemae/ds-button": "2.0.0-alpha.12",
|
|
44
|
+
"@elliemae/ds-classnames": "2.0.0-alpha.12",
|
|
45
|
+
"@elliemae/ds-form": "2.0.0-alpha.12",
|
|
46
|
+
"@elliemae/ds-icons": "2.0.0-alpha.12",
|
|
47
|
+
"react-desc": "~4.1.3"
|
|
24
48
|
},
|
|
25
49
|
"devDependencies": {
|
|
26
|
-
"
|
|
50
|
+
"@testing-library/jest-dom": "~5.15.0",
|
|
51
|
+
"@testing-library/react": "~12.1.2",
|
|
52
|
+
"styled-components": "~5.3.3"
|
|
27
53
|
},
|
|
28
54
|
"peerDependencies": {
|
|
29
|
-
"lodash": "^4.17.
|
|
30
|
-
"react": "^17.0.
|
|
31
|
-
"react-dom": "^17.0.
|
|
32
|
-
"styled-components": "^5.3.
|
|
55
|
+
"lodash": "^4.17.21",
|
|
56
|
+
"react": "^17.0.2",
|
|
57
|
+
"react-dom": "^17.0.2",
|
|
58
|
+
"styled-components": "^5.3.3"
|
|
33
59
|
},
|
|
34
60
|
"publishConfig": {
|
|
35
61
|
"access": "public",
|
|
36
|
-
"directory": "dist"
|
|
62
|
+
"directory": "dist",
|
|
63
|
+
"generateSubmodules": true
|
|
37
64
|
}
|
|
38
65
|
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/// <reference path="../../../../shared/typings/react-desc.d.ts" />
|
|
2
|
+
/// <reference types="react" />
|
|
3
|
+
declare const DSPageNumber: {
|
|
4
|
+
({ className, disabled, value, onChange, containerProps, currentPage, totalPages, separator, ...otherProps }: {
|
|
5
|
+
[x: string]: any;
|
|
6
|
+
className: any;
|
|
7
|
+
disabled: any;
|
|
8
|
+
value: any;
|
|
9
|
+
onChange: any;
|
|
10
|
+
containerProps: any;
|
|
11
|
+
currentPage: any;
|
|
12
|
+
totalPages: any;
|
|
13
|
+
separator: any;
|
|
14
|
+
}): JSX.Element;
|
|
15
|
+
propTypes: {
|
|
16
|
+
className: {
|
|
17
|
+
defaultValue<T = unknown>(arg: T): {
|
|
18
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
19
|
+
};
|
|
20
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
21
|
+
};
|
|
22
|
+
containerProps: {
|
|
23
|
+
defaultValue<T = unknown>(arg: T): {
|
|
24
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
25
|
+
};
|
|
26
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
27
|
+
};
|
|
28
|
+
disabled: {
|
|
29
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
30
|
+
};
|
|
31
|
+
value: {
|
|
32
|
+
defaultValue<T = unknown>(arg: T): {
|
|
33
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
34
|
+
};
|
|
35
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
36
|
+
};
|
|
37
|
+
onChange: {
|
|
38
|
+
defaultValue<T = unknown>(arg: T): {
|
|
39
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
40
|
+
};
|
|
41
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
42
|
+
};
|
|
43
|
+
currentPage: {
|
|
44
|
+
defaultValue<T = unknown>(arg: T): {
|
|
45
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
46
|
+
};
|
|
47
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
48
|
+
};
|
|
49
|
+
totalPages: {
|
|
50
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
51
|
+
};
|
|
52
|
+
separator: {
|
|
53
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
defaultProps: {
|
|
57
|
+
className: string;
|
|
58
|
+
disabled: boolean;
|
|
59
|
+
onChange: () => null;
|
|
60
|
+
containerProps: {};
|
|
61
|
+
value: undefined;
|
|
62
|
+
currentPage: undefined;
|
|
63
|
+
totalPages: number;
|
|
64
|
+
separator: string;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
declare const PageNumberWithSchema: {
|
|
68
|
+
(props?: {
|
|
69
|
+
[x: string]: any;
|
|
70
|
+
className: any;
|
|
71
|
+
disabled: any;
|
|
72
|
+
value: any;
|
|
73
|
+
onChange: any;
|
|
74
|
+
containerProps: any;
|
|
75
|
+
currentPage: any;
|
|
76
|
+
totalPages: any;
|
|
77
|
+
separator: any;
|
|
78
|
+
} | undefined): JSX.Element;
|
|
79
|
+
propTypes: unknown;
|
|
80
|
+
toTypescript: () => import("react-desc").TypescriptSchema;
|
|
81
|
+
};
|
|
82
|
+
export { DSPageNumber, PageNumberWithSchema };
|
|
83
|
+
export default DSPageNumber;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/types/index.d.ts
ADDED
package/cjs/DSPageNumber.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DSPageNumber.js","sources":["../../src/DSPageNumber.tsx"],"sourcesContent":["/* eslint-disable max-lines */\nimport React, { useState, useRef, useEffect } from 'react';\nimport { describe, PropTypes } from 'react-desc';\nimport { aggregatedClasses, convertPropToCssClassName } from '@elliemae/ds-classnames';\nimport { ChevronSmallDown, ChevronSmallUp } from '@elliemae/ds-icons';\nimport DSButton from '@elliemae/ds-button';\nimport { DSInput, DSInputGroup } from '@elliemae/ds-form';\nimport { lengthToSize, cleanPage } from './components/utils';\n\nconst blockName = 'page-number-block';\nconst PageNumberInputContainer = aggregatedClasses(DSInputGroup)(blockName);\n\nconst DSPageNumber = ({\n className,\n disabled,\n value,\n onChange,\n containerProps,\n currentPage,\n totalPages,\n separator,\n ...otherProps\n}) => {\n const safeTotal = cleanPage(totalPages);\n const ref = useRef(null);\n const { cssClassName, classNameElement } = convertPropToCssClassName('page-number', className, {\n disabled,\n });\n const [page, setPage] = useState(cleanPage(currentPage) || 1);\n const [size, setSize] = useState(null);\n useEffect(() => {\n const { width } = ref.current.getBoundingClientRect();\n const calculatedWidth = lengthToSize(width, page);\n setSize(calculatedWidth);\n }, [page, safeTotal]);\n\n function handleUpdateInput(e) {\n const newValue = cleanPage(e.target.value);\n if (newValue > safeTotal || newValue === 0) return;\n setPage(newValue);\n onChange(newValue);\n }\n function handleIncrease() {\n const newValue = page ? parseInt(page, 10) + 1 : 1;\n if (newValue > safeTotal) return;\n setPage(newValue);\n onChange(newValue);\n }\n function handleDecrease() {\n const newValue = page ? parseInt(page, 10) - 1 : 1;\n if (newValue < 1) return;\n setPage(newValue);\n onChange(newValue);\n }\n\n return (\n <div data-testid=\"ds-page-number\" className={`${cssClassName}`} {...containerProps} {...otherProps}>\n <PageNumberInputContainer>\n <div className={`${classNameElement('pages')}`}>\n <DSInput\n className={`${classNameElement('input')}`}\n data-testid=\"page-number__current-page\"\n onChange={handleUpdateInput}\n style={{\n width: `${size}px`,\n }}\n value={page}\n />\n <div className={`${classNameElement('separator')}`}>{separator}</div>\n <div className={`${classNameElement('total')}`} data-testid=\"page-number__total-pages\">\n {totalPages}\n </div>\n <div ref={ref} className={`${classNameElement('ref')}`} />\n </div>\n <div className={`${classNameElement('limiter')}`} />\n <DSButton\n aria-label=\"dropdown-indicator\"\n buttonType=\"text\"\n className=\"dropdown-indicator\"\n data-testid=\"page-number__increase\"\n icon={<ChevronSmallUp />}\n onClick={handleIncrease}\n />\n <DSButton\n aria-label=\"dropdown-indicator\"\n buttonType=\"text\"\n className=\"dropdown-indicator\"\n data-testid=\"page-number__decrease\"\n icon={<ChevronSmallDown />}\n onClick={handleDecrease}\n />\n </PageNumberInputContainer>\n </div>\n );\n};\n\nconst pageNumberProps = {\n className: PropTypes.string.description('html class attribute'),\n containerProps: PropTypes.object.description('Set of Properties attached to the main container'),\n disabled: PropTypes.bool.description('Whether the component is disabled or not').defaultValue(false),\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.object]).description('page number value'),\n onChange: PropTypes.func.description('function executed when the page number changes'),\n currentPage: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description('Value of the current page'),\n totalPages: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description('Amount of pages').defaultValue(1),\n separator: PropTypes.oneOfType([PropTypes.string, PropTypes.number])\n .description('Separator between current page and total pages')\n .defaultValue('/'),\n};\n\nDSPageNumber.propTypes = pageNumberProps;\n\nconst PageNumberWithSchema = describe(DSPageNumber);\nPageNumberWithSchema.propTypes = pageNumberProps;\n\nDSPageNumber.defaultProps = {\n className: '',\n disabled: false,\n onChange: () => null,\n containerProps: {},\n value: undefined,\n currentPage: undefined,\n totalPages: 1,\n separator: '/',\n};\n\nexport { DSPageNumber, PageNumberWithSchema };\nexport default DSPageNumber;\n"],"names":["blockName","PageNumberInputContainer","aggregatedClasses","DSInputGroup","DSPageNumber","className","disabled","value","onChange","containerProps","currentPage","totalPages","separator","otherProps","safeTotal","cleanPage","ref","useRef","convertPropToCssClassName","cssClassName","classNameElement","useState","page","setPage","size","setSize","useEffect","current","getBoundingClientRect","width","calculatedWidth","lengthToSize","handleUpdateInput","e","newValue","target","handleIncrease","parseInt","handleDecrease","React","DSInput","DSButton","ChevronSmallUp","ChevronSmallDown","pageNumberProps","PropTypes","string","description","object","bool","defaultValue","oneOfType","number","func","propTypes","PageNumberWithSchema","describe","defaultProps","undefined"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AASA,IAAMA,SAAS,GAAG,mBAAlB;AACA,IAAMC,wBAAwB,GAAGC,8BAAiB,CAACC,mBAAD,CAAjB,CAAgCH,SAAhC,CAAjC;;IAEMI,YAAY,GAAG,SAAfA,YAAe,OAUf;AAAA,MATJC,SASI,QATJA,SAS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BAAS,CAACC,MAAX,EAAmBD,mBAAS,CAACO,MAA7B,CAApB,EAA0DL,WAA1D,CAAsE,2BAAtE,CANS;AAOtBpC,EAAAA,UAAU,EAAEkC,mBAAS,CAACM,SAAV,CAAoB,CAACN,mBAAS,CAACC,MAAX,EAAmBD,mBAAS,CAACO,MAA7B,CAApB,EAA0DL,WAA1D,CAAsE,iBAAtE,EAAyFG,YAAzF,CAAsG,CAAtG,CAPU;AAQtBtC,EAAAA,SAAS,EAAEiC,mBAAS,CAACM,SAAV,CAAoB,CAACN,mBAAS,CAACC,MAAX,EAAmBD,mBAAS,CAACO,MAA7B,CAApB,EACRL,WADQ,CACI,gDADJ,EAERG,YAFQ,CAEK,GAFL;AARW,CAAxB;AAaA9C,YAAY,CAACkD,SAAb,GAAyBV,eAAzB;IAEMW,oBAAoB,GAAGC,kBAAQ,CAACpD,YAAD;AACrCmD,oBAAoB,CAACD,SAArB,GAAiCV,eAAjC;AAEAxC,YAAY,CAACqD,YAAb,GAA4B;AAC1BpD,EAAAA,SAAS,EAAE,EADe;AAE1BC,EAAAA,QAAQ,EAAE,KAFgB;AAG1BE,EAAAA,QAAQ,EAAE;AAAA,WAAM,IAAN;AAAA,GAHgB;AAI1BC,EAAAA,cAAc,EAAE,EAJU;AAK1BF,EAAAA,KAAK,EAAEmD,SALmB;AAM1BhD,EAAAA,WAAW,EAAEgD,SANa;AAO1B/C,EAAAA,UAAU,EAAE,CAPc;AAQ1BC,EAAAA,SAAS,EAAE;AARe,CAA5B;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../src/components/utils.tsx"],"sourcesContent":["export const lengthToSize = (referenceWidth, value) =>\n referenceWidth + (referenceWidth / 7) * String(value).length;\n\nexport const cleanPage = value => {\n if (!value || value === '' || isNaN(parseInt(value))) return '';\n return parseInt(String(value || 1).replace(/\\D/g, ''), 10);\n};\n"],"names":["lengthToSize","referenceWidth","value","String","length","cleanPage","isNaN","parseInt","replace"],"mappings":";;;;IAAaA,YAAY,GAAG,SAAfA,YAAe,CAACC,cAAD,EAAiBC,KAAjB;AAAA,SAC1BD,cAAc,GAAIA,cAAc,GAAG,CAAlB,GAAuBE,MAAM,CAACD,KAAD,CAAN,CAAcE,MAD5B;AAAA;IAGfC,SAAS,GAAG,SAAZA,SAAY,CAAAH,KAAK,EAAI;AAChC,MAAI,CAACA,KAAD,IAAUA,KAAK,KAAK,EAApB,IAA0BI,KAAK,CAACC,QAAQ,CAACL,KAAD,CAAT,CAAnC,EAAsD,OAAO,EAAP;AACtD,SAAOK,QAAQ,CAACJ,MAAM,CAACD,KAAK,IAAI,CAAV,CAAN,CAAmBM,OAAnB,CAA2B,KAA3B,EAAkC,EAAlC,CAAD,EAAwC,EAAxC,CAAf;AACD;;;;;"}
|
package/cjs/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;"}
|
package/esm/DSPageNumber.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DSPageNumber.js","sources":["../../src/DSPageNumber.tsx"],"sourcesContent":["/* eslint-disable max-lines */\nimport React, { useState, useRef, useEffect } from 'react';\nimport { describe, PropTypes } from 'react-desc';\nimport { aggregatedClasses, convertPropToCssClassName } from '@elliemae/ds-classnames';\nimport { ChevronSmallDown, ChevronSmallUp } from '@elliemae/ds-icons';\nimport DSButton from '@elliemae/ds-button';\nimport { DSInput, DSInputGroup } from '@elliemae/ds-form';\nimport { lengthToSize, cleanPage } from './components/utils';\n\nconst blockName = 'page-number-block';\nconst PageNumberInputContainer = aggregatedClasses(DSInputGroup)(blockName);\n\nconst DSPageNumber = ({\n className,\n disabled,\n value,\n onChange,\n containerProps,\n currentPage,\n totalPages,\n separator,\n ...otherProps\n}) => {\n const safeTotal = cleanPage(totalPages);\n const ref = useRef(null);\n const { cssClassName, classNameElement } = convertPropToCssClassName('page-number', className, {\n disabled,\n });\n const [page, setPage] = useState(cleanPage(currentPage) || 1);\n const [size, setSize] = useState(null);\n useEffect(() => {\n const { width } = ref.current.getBoundingClientRect();\n const calculatedWidth = lengthToSize(width, page);\n setSize(calculatedWidth);\n }, [page, safeTotal]);\n\n function handleUpdateInput(e) {\n const newValue = cleanPage(e.target.value);\n if (newValue > safeTotal || newValue === 0) return;\n setPage(newValue);\n onChange(newValue);\n }\n function handleIncrease() {\n const newValue = page ? parseInt(page, 10) + 1 : 1;\n if (newValue > safeTotal) return;\n setPage(newValue);\n onChange(newValue);\n }\n function handleDecrease() {\n const newValue = page ? parseInt(page, 10) - 1 : 1;\n if (newValue < 1) return;\n setPage(newValue);\n onChange(newValue);\n }\n\n return (\n <div data-testid=\"ds-page-number\" className={`${cssClassName}`} {...containerProps} {...otherProps}>\n <PageNumberInputContainer>\n <div className={`${classNameElement('pages')}`}>\n <DSInput\n className={`${classNameElement('input')}`}\n data-testid=\"page-number__current-page\"\n onChange={handleUpdateInput}\n style={{\n width: `${size}px`,\n }}\n value={page}\n />\n <div className={`${classNameElement('separator')}`}>{separator}</div>\n <div className={`${classNameElement('total')}`} data-testid=\"page-number__total-pages\">\n {totalPages}\n </div>\n <div ref={ref} className={`${classNameElement('ref')}`} />\n </div>\n <div className={`${classNameElement('limiter')}`} />\n <DSButton\n aria-label=\"dropdown-indicator\"\n buttonType=\"text\"\n className=\"dropdown-indicator\"\n data-testid=\"page-number__increase\"\n icon={<ChevronSmallUp />}\n onClick={handleIncrease}\n />\n <DSButton\n aria-label=\"dropdown-indicator\"\n buttonType=\"text\"\n className=\"dropdown-indicator\"\n data-testid=\"page-number__decrease\"\n icon={<ChevronSmallDown />}\n onClick={handleDecrease}\n />\n </PageNumberInputContainer>\n </div>\n );\n};\n\nconst pageNumberProps = {\n className: PropTypes.string.description('html class attribute'),\n containerProps: PropTypes.object.description('Set of Properties attached to the main container'),\n disabled: PropTypes.bool.description('Whether the component is disabled or not').defaultValue(false),\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.object]).description('page number value'),\n onChange: PropTypes.func.description('function executed when the page number changes'),\n currentPage: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description('Value of the current page'),\n totalPages: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description('Amount of pages').defaultValue(1),\n separator: PropTypes.oneOfType([PropTypes.string, PropTypes.number])\n .description('Separator between current page and total pages')\n .defaultValue('/'),\n};\n\nDSPageNumber.propTypes = pageNumberProps;\n\nconst PageNumberWithSchema = describe(DSPageNumber);\nPageNumberWithSchema.propTypes = pageNumberProps;\n\nDSPageNumber.defaultProps = {\n className: '',\n disabled: false,\n onChange: () => null,\n containerProps: {},\n value: undefined,\n currentPage: undefined,\n totalPages: 1,\n separator: '/',\n};\n\nexport { DSPageNumber, PageNumberWithSchema };\nexport default DSPageNumber;\n"],"names":["blockName","PageNumberInputContainer","aggregatedClasses","DSInputGroup","DSPageNumber","className","disabled","value","onChange","containerProps","currentPage","totalPages","separator","otherProps","safeTotal","cleanPage","ref","useRef","convertPropToCssClassName","cssClassName","classNameElement","useState","page","setPage","size","setSize","useEffect","current","getBoundingClientRect","width","calculatedWidth","lengthToSize","handleUpdateInput","e","newValue","target","handleIncrease","parseInt","handleDecrease","pageNumberProps","PropTypes","string","description","object","bool","defaultValue","oneOfType","number","func","propTypes","PageNumberWithSchema","describe","defaultProps","undefined"],"mappings":";;;;;;;;;;;;AASA,IAAMA,SAAS,GAAG,mBAAlB;AACA,IAAMC,wBAAwB,GAAGC,iBAAiB,CAACC,YAAD,CAAjB,CAAgCH,SAAhC,CAAjC;;IAEMI,YAAY,GAAG,SAAfA,YAAe,OAUf;AAAA,MATJC,SASI,QATJA,SASI;AAAA,MARJC,QAQI,QARJA,QAQI;AAAA,WAPJC,KAOI;AAAA,UANJC,QAMI,QANJA,QAMI;AAAA,MALJC,cAKI,QALJA,cAKI;AAAA,MAJJC,WAII,QAJJA,WAII;AAAA,MAHJC,U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0DL,WAA1D,CAAsE,iBAAtE,EAAyFG,YAAzF,CAAsG,CAAtG,CAPU;AAQtBjC,EAAAA,SAAS,EAAE4B,SAAS,CAACM,SAAV,CAAoB,CAACN,SAAS,CAACC,MAAX,EAAmBD,SAAS,CAACO,MAA7B,CAApB,EACRL,WADQ,CACI,gDADJ,EAERG,YAFQ,CAEK,GAFL;AARW,CAAxB;AAaAzC,YAAY,CAAC6C,SAAb,GAAyBV,eAAzB;IAEMW,oBAAoB,GAAGC,QAAQ,CAAC/C,YAAD;AACrC8C,oBAAoB,CAACD,SAArB,GAAiCV,eAAjC;AAEAnC,YAAY,CAACgD,YAAb,GAA4B;AAC1B/C,EAAAA,SAAS,EAAE,EADe;AAE1BC,EAAAA,QAAQ,EAAE,KAFgB;AAG1BE,EAAAA,QAAQ,EAAE;AAAA,WAAM,IAAN;AAAA,GAHgB;AAI1BC,EAAAA,cAAc,EAAE,EAJU;AAK1BF,EAAAA,KAAK,EAAE8C,SALmB;AAM1B3C,EAAAA,WAAW,EAAE2C,SANa;AAO1B1C,EAAAA,UAAU,EAAE,CAPc;AAQ1BC,EAAAA,SAAS,EAAE;AARe,CAA5B;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../src/components/utils.tsx"],"sourcesContent":["export const lengthToSize = (referenceWidth, value) =>\n referenceWidth + (referenceWidth / 7) * String(value).length;\n\nexport const cleanPage = value => {\n if (!value || value === '' || isNaN(parseInt(value))) return '';\n return parseInt(String(value || 1).replace(/\\D/g, ''), 10);\n};\n"],"names":["lengthToSize","referenceWidth","value","String","length","cleanPage","isNaN","parseInt","replace"],"mappings":"IAAaA,YAAY,GAAG,SAAfA,YAAe,CAACC,cAAD,EAAiBC,KAAjB;AAAA,SAC1BD,cAAc,GAAIA,cAAc,GAAG,CAAlB,GAAuBE,MAAM,CAACD,KAAD,CAAN,CAAcE,MAD5B;AAAA;IAGfC,SAAS,GAAG,SAAZA,SAAY,CAAAH,KAAK,EAAI;AAChC,MAAI,CAACA,KAAD,IAAUA,KAAK,KAAK,EAApB,IAA0BI,KAAK,CAACC,QAAQ,CAACL,KAAD,CAAT,CAAnC,EAAsD,OAAO,EAAP;AACtD,SAAOK,QAAQ,CAACJ,MAAM,CAACD,KAAK,IAAI,CAAV,CAAN,CAAmBM,OAAnB,CAA2B,KAA3B,EAAkC,EAAlC,CAAD,EAAwC,EAAxC,CAAf;AACD;;;;"}
|
package/esm/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
|