@elliemae/ds-page-number 2.3.1 → 3.0.0-alpha.3

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.
@@ -0,0 +1,187 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
+ var __spreadValues = (a, b) => {
11
+ for (var prop in b || (b = {}))
12
+ if (__hasOwnProp.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ if (__getOwnPropSymbols)
15
+ for (var prop of __getOwnPropSymbols(b)) {
16
+ if (__propIsEnum.call(b, prop))
17
+ __defNormalProp(a, prop, b[prop]);
18
+ }
19
+ return a;
20
+ };
21
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
22
+ var __objRest = (source, exclude) => {
23
+ var target = {};
24
+ for (var prop in source)
25
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
26
+ target[prop] = source[prop];
27
+ if (source != null && __getOwnPropSymbols)
28
+ for (var prop of __getOwnPropSymbols(source)) {
29
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
30
+ target[prop] = source[prop];
31
+ }
32
+ return target;
33
+ };
34
+ var __export = (target, all) => {
35
+ for (var name in all)
36
+ __defProp(target, name, { get: all[name], enumerable: true });
37
+ };
38
+ var __reExport = (target, module2, copyDefault, desc) => {
39
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
40
+ for (let key of __getOwnPropNames(module2))
41
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
42
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
43
+ }
44
+ return target;
45
+ };
46
+ var __toESM = (module2, isNodeMode) => {
47
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
48
+ };
49
+ var __toCommonJS = /* @__PURE__ */ ((cache) => {
50
+ return (module2, temp) => {
51
+ return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
52
+ };
53
+ })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
54
+ var DSPageNumber_exports = {};
55
+ __export(DSPageNumber_exports, {
56
+ DSPageNumber: () => DSPageNumber,
57
+ PageNumberWithSchema: () => PageNumberWithSchema,
58
+ default: () => DSPageNumber_default
59
+ });
60
+ var React = __toESM(require("react"));
61
+ var import_react = __toESM(require("react"));
62
+ var import_react_desc = require("react-desc");
63
+ var import_ds_classnames = require("@elliemae/ds-classnames");
64
+ var import_ds_icons = require("@elliemae/ds-icons");
65
+ var import_ds_button = __toESM(require("@elliemae/ds-button"));
66
+ var import_ds_form = require("@elliemae/ds-form");
67
+ var import_utils = require("./components/utils");
68
+ const blockName = "page-number-block";
69
+ const PageNumberInputContainer = (0, import_ds_classnames.aggregatedClasses)(import_ds_form.DSInputGroup)(blockName);
70
+ const DSPageNumber = (_a) => {
71
+ var _b = _a, {
72
+ className,
73
+ disabled,
74
+ value,
75
+ onChange,
76
+ containerProps,
77
+ currentPage,
78
+ totalPages,
79
+ separator
80
+ } = _b, otherProps = __objRest(_b, [
81
+ "className",
82
+ "disabled",
83
+ "value",
84
+ "onChange",
85
+ "containerProps",
86
+ "currentPage",
87
+ "totalPages",
88
+ "separator"
89
+ ]);
90
+ const safeTotal = (0, import_utils.cleanPage)(totalPages);
91
+ const ref = (0, import_react.useRef)(null);
92
+ const { cssClassName, classNameElement } = (0, import_ds_classnames.convertPropToCssClassName)("page-number", className, {
93
+ disabled
94
+ });
95
+ const [page, setPage] = (0, import_react.useState)((0, import_utils.cleanPage)(currentPage) || 1);
96
+ const [size, setSize] = (0, import_react.useState)(null);
97
+ (0, import_react.useEffect)(() => {
98
+ const { width } = ref.current.getBoundingClientRect();
99
+ const calculatedWidth = (0, import_utils.lengthToSize)(width, page);
100
+ setSize(calculatedWidth);
101
+ }, [page, safeTotal]);
102
+ function handleUpdateInput(e) {
103
+ const newValue = (0, import_utils.cleanPage)(e.target.value);
104
+ if (newValue > safeTotal || newValue === 0)
105
+ return;
106
+ setPage(newValue);
107
+ onChange(newValue);
108
+ }
109
+ function handleIncrease() {
110
+ const newValue = page ? parseInt(page, 10) + 1 : 1;
111
+ if (newValue > safeTotal)
112
+ return;
113
+ setPage(newValue);
114
+ onChange(newValue);
115
+ }
116
+ function handleDecrease() {
117
+ const newValue = page ? parseInt(page, 10) - 1 : 1;
118
+ if (newValue < 1)
119
+ return;
120
+ setPage(newValue);
121
+ onChange(newValue);
122
+ }
123
+ return /* @__PURE__ */ import_react.default.createElement("div", __spreadValues(__spreadValues({
124
+ "data-testid": "ds-page-number",
125
+ className: `${cssClassName}`
126
+ }, containerProps), otherProps), /* @__PURE__ */ import_react.default.createElement(PageNumberInputContainer, null, /* @__PURE__ */ import_react.default.createElement("div", {
127
+ className: `${classNameElement("pages")}`
128
+ }, /* @__PURE__ */ import_react.default.createElement(import_ds_form.DSInput, {
129
+ className: `${classNameElement("input")}`,
130
+ "data-testid": "page-number__current-page",
131
+ onChange: handleUpdateInput,
132
+ style: {
133
+ width: `${size}px`
134
+ },
135
+ value: page
136
+ }), /* @__PURE__ */ import_react.default.createElement("div", {
137
+ className: `${classNameElement("separator")}`
138
+ }, separator), /* @__PURE__ */ import_react.default.createElement("div", {
139
+ className: `${classNameElement("total")}`,
140
+ "data-testid": "page-number__total-pages"
141
+ }, totalPages), /* @__PURE__ */ import_react.default.createElement("div", {
142
+ ref,
143
+ className: `${classNameElement("ref")}`
144
+ })), /* @__PURE__ */ import_react.default.createElement("div", {
145
+ className: `${classNameElement("limiter")}`
146
+ }), /* @__PURE__ */ import_react.default.createElement(import_ds_button.default, {
147
+ "aria-label": "dropdown-indicator",
148
+ buttonType: "text",
149
+ className: "dropdown-indicator",
150
+ "data-testid": "page-number__increase",
151
+ icon: /* @__PURE__ */ import_react.default.createElement(import_ds_icons.ChevronSmallUp, null),
152
+ onClick: handleIncrease
153
+ }), /* @__PURE__ */ import_react.default.createElement(import_ds_button.default, {
154
+ "aria-label": "dropdown-indicator",
155
+ buttonType: "text",
156
+ className: "dropdown-indicator",
157
+ "data-testid": "page-number__decrease",
158
+ icon: /* @__PURE__ */ import_react.default.createElement(import_ds_icons.ChevronSmallDown, null),
159
+ onClick: handleDecrease
160
+ })));
161
+ };
162
+ const pageNumberProps = {
163
+ className: import_react_desc.PropTypes.string.description("html class attribute"),
164
+ containerProps: import_react_desc.PropTypes.object.description("Set of Properties attached to the main container"),
165
+ disabled: import_react_desc.PropTypes.bool.description("Whether the component is disabled or not").defaultValue(false),
166
+ value: import_react_desc.PropTypes.oneOfType([import_react_desc.PropTypes.string, import_react_desc.PropTypes.number, import_react_desc.PropTypes.object]).description("page number value"),
167
+ onChange: import_react_desc.PropTypes.func.description("function executed when the page number changes"),
168
+ currentPage: import_react_desc.PropTypes.oneOfType([import_react_desc.PropTypes.string, import_react_desc.PropTypes.number]).description("Value of the current page"),
169
+ totalPages: import_react_desc.PropTypes.oneOfType([import_react_desc.PropTypes.string, import_react_desc.PropTypes.number]).description("Amount of pages").defaultValue(1),
170
+ separator: import_react_desc.PropTypes.oneOfType([import_react_desc.PropTypes.string, import_react_desc.PropTypes.number]).description("Separator between current page and total pages").defaultValue("/")
171
+ };
172
+ DSPageNumber.propTypes = pageNumberProps;
173
+ const PageNumberWithSchema = (0, import_react_desc.describe)(DSPageNumber);
174
+ PageNumberWithSchema.propTypes = pageNumberProps;
175
+ DSPageNumber.defaultProps = {
176
+ className: "",
177
+ disabled: false,
178
+ onChange: () => null,
179
+ containerProps: {},
180
+ value: void 0,
181
+ currentPage: void 0,
182
+ totalPages: 1,
183
+ separator: "/"
184
+ };
185
+ var DSPageNumber_default = DSPageNumber;
186
+ module.exports = __toCommonJS(DSPageNumber_exports);
187
+ //# sourceMappingURL=DSPageNumber.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/DSPageNumber.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
+ "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", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": "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",
6
+ "names": []
7
+ }
@@ -0,0 +1,41 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __reExport = (target, module2, copyDefault, desc) => {
13
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
+ for (let key of __getOwnPropNames(module2))
15
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
17
+ }
18
+ return target;
19
+ };
20
+ var __toESM = (module2, isNodeMode) => {
21
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
+ };
23
+ var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
+ return (module2, temp) => {
25
+ return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
+ };
27
+ })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
+ var utils_exports = {};
29
+ __export(utils_exports, {
30
+ cleanPage: () => cleanPage,
31
+ lengthToSize: () => lengthToSize
32
+ });
33
+ var React = __toESM(require("react"));
34
+ const lengthToSize = (referenceWidth, value) => referenceWidth + referenceWidth / 7 * String(value).length;
35
+ const cleanPage = (value) => {
36
+ if (!value || value === "" || isNaN(parseInt(value)))
37
+ return "";
38
+ return parseInt(String(value || 1).replace(/\D/g, ""), 10);
39
+ };
40
+ module.exports = __toCommonJS(utils_exports);
41
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/utils.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
+ "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", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,eAAe,CAAC,gBAAgB,UAC3C,iBAAkB,iBAAiB,IAAK,OAAO,OAAO;AAEjD,MAAM,YAAY,WAAS;AAChC,MAAI,CAAC,SAAS,UAAU,MAAM,MAAM,SAAS;AAAS,WAAO;AAC7D,SAAO,SAAS,OAAO,SAAS,GAAG,QAAQ,OAAO,KAAK;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,36 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __reExport = (target, module2, copyDefault, desc) => {
13
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
+ for (let key of __getOwnPropNames(module2))
15
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
17
+ }
18
+ return target;
19
+ };
20
+ var __toESM = (module2, isNodeMode) => {
21
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
+ };
23
+ var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
+ return (module2, temp) => {
25
+ return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
+ };
27
+ })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
+ var src_exports = {};
29
+ __export(src_exports, {
30
+ default: () => import_DSPageNumber.default
31
+ });
32
+ var React = __toESM(require("react"));
33
+ __reExport(src_exports, require("./DSPageNumber"));
34
+ var import_DSPageNumber = __toESM(require("./DSPageNumber"));
35
+ module.exports = __toCommonJS(src_exports);
36
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/index.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["export * from './DSPageNumber';\n\nexport { default } from './DSPageNumber';\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,wBAAc;AAEd,0BAAwB;",
6
+ "names": []
7
+ }
@@ -0,0 +1,160 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
4
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __spreadValues = (a, b) => {
7
+ for (var prop in b || (b = {}))
8
+ if (__hasOwnProp.call(b, prop))
9
+ __defNormalProp(a, prop, b[prop]);
10
+ if (__getOwnPropSymbols)
11
+ for (var prop of __getOwnPropSymbols(b)) {
12
+ if (__propIsEnum.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ }
15
+ return a;
16
+ };
17
+ var __objRest = (source, exclude) => {
18
+ var target = {};
19
+ for (var prop in source)
20
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
21
+ target[prop] = source[prop];
22
+ if (source != null && __getOwnPropSymbols)
23
+ for (var prop of __getOwnPropSymbols(source)) {
24
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
25
+ target[prop] = source[prop];
26
+ }
27
+ return target;
28
+ };
29
+ import * as React from "react";
30
+ import React2, { useState, useRef, useEffect } from "react";
31
+ import { describe, PropTypes } from "react-desc";
32
+ import { aggregatedClasses, convertPropToCssClassName } from "@elliemae/ds-classnames";
33
+ import { ChevronSmallDown, ChevronSmallUp } from "@elliemae/ds-icons";
34
+ import DSButton from "@elliemae/ds-button";
35
+ import { DSInput, DSInputGroup } from "@elliemae/ds-form";
36
+ import { lengthToSize, cleanPage } from "./components/utils";
37
+ const blockName = "page-number-block";
38
+ const PageNumberInputContainer = aggregatedClasses(DSInputGroup)(blockName);
39
+ const DSPageNumber = (_a) => {
40
+ var _b = _a, {
41
+ className,
42
+ disabled,
43
+ value,
44
+ onChange,
45
+ containerProps,
46
+ currentPage,
47
+ totalPages,
48
+ separator
49
+ } = _b, otherProps = __objRest(_b, [
50
+ "className",
51
+ "disabled",
52
+ "value",
53
+ "onChange",
54
+ "containerProps",
55
+ "currentPage",
56
+ "totalPages",
57
+ "separator"
58
+ ]);
59
+ const safeTotal = cleanPage(totalPages);
60
+ const ref = useRef(null);
61
+ const { cssClassName, classNameElement } = convertPropToCssClassName("page-number", className, {
62
+ disabled
63
+ });
64
+ const [page, setPage] = useState(cleanPage(currentPage) || 1);
65
+ const [size, setSize] = useState(null);
66
+ useEffect(() => {
67
+ const { width } = ref.current.getBoundingClientRect();
68
+ const calculatedWidth = lengthToSize(width, page);
69
+ setSize(calculatedWidth);
70
+ }, [page, safeTotal]);
71
+ function handleUpdateInput(e) {
72
+ const newValue = cleanPage(e.target.value);
73
+ if (newValue > safeTotal || newValue === 0)
74
+ return;
75
+ setPage(newValue);
76
+ onChange(newValue);
77
+ }
78
+ function handleIncrease() {
79
+ const newValue = page ? parseInt(page, 10) + 1 : 1;
80
+ if (newValue > safeTotal)
81
+ return;
82
+ setPage(newValue);
83
+ onChange(newValue);
84
+ }
85
+ function handleDecrease() {
86
+ const newValue = page ? parseInt(page, 10) - 1 : 1;
87
+ if (newValue < 1)
88
+ return;
89
+ setPage(newValue);
90
+ onChange(newValue);
91
+ }
92
+ return /* @__PURE__ */ React2.createElement("div", __spreadValues(__spreadValues({
93
+ "data-testid": "ds-page-number",
94
+ className: `${cssClassName}`
95
+ }, containerProps), otherProps), /* @__PURE__ */ React2.createElement(PageNumberInputContainer, null, /* @__PURE__ */ React2.createElement("div", {
96
+ className: `${classNameElement("pages")}`
97
+ }, /* @__PURE__ */ React2.createElement(DSInput, {
98
+ className: `${classNameElement("input")}`,
99
+ "data-testid": "page-number__current-page",
100
+ onChange: handleUpdateInput,
101
+ style: {
102
+ width: `${size}px`
103
+ },
104
+ value: page
105
+ }), /* @__PURE__ */ React2.createElement("div", {
106
+ className: `${classNameElement("separator")}`
107
+ }, separator), /* @__PURE__ */ React2.createElement("div", {
108
+ className: `${classNameElement("total")}`,
109
+ "data-testid": "page-number__total-pages"
110
+ }, totalPages), /* @__PURE__ */ React2.createElement("div", {
111
+ ref,
112
+ className: `${classNameElement("ref")}`
113
+ })), /* @__PURE__ */ React2.createElement("div", {
114
+ className: `${classNameElement("limiter")}`
115
+ }), /* @__PURE__ */ React2.createElement(DSButton, {
116
+ "aria-label": "dropdown-indicator",
117
+ buttonType: "text",
118
+ className: "dropdown-indicator",
119
+ "data-testid": "page-number__increase",
120
+ icon: /* @__PURE__ */ React2.createElement(ChevronSmallUp, null),
121
+ onClick: handleIncrease
122
+ }), /* @__PURE__ */ React2.createElement(DSButton, {
123
+ "aria-label": "dropdown-indicator",
124
+ buttonType: "text",
125
+ className: "dropdown-indicator",
126
+ "data-testid": "page-number__decrease",
127
+ icon: /* @__PURE__ */ React2.createElement(ChevronSmallDown, null),
128
+ onClick: handleDecrease
129
+ })));
130
+ };
131
+ const pageNumberProps = {
132
+ className: PropTypes.string.description("html class attribute"),
133
+ containerProps: PropTypes.object.description("Set of Properties attached to the main container"),
134
+ disabled: PropTypes.bool.description("Whether the component is disabled or not").defaultValue(false),
135
+ value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.object]).description("page number value"),
136
+ onChange: PropTypes.func.description("function executed when the page number changes"),
137
+ currentPage: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description("Value of the current page"),
138
+ totalPages: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description("Amount of pages").defaultValue(1),
139
+ separator: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description("Separator between current page and total pages").defaultValue("/")
140
+ };
141
+ DSPageNumber.propTypes = pageNumberProps;
142
+ const PageNumberWithSchema = describe(DSPageNumber);
143
+ PageNumberWithSchema.propTypes = pageNumberProps;
144
+ DSPageNumber.defaultProps = {
145
+ className: "",
146
+ disabled: false,
147
+ onChange: () => null,
148
+ containerProps: {},
149
+ value: void 0,
150
+ currentPage: void 0,
151
+ totalPages: 1,
152
+ separator: "/"
153
+ };
154
+ var DSPageNumber_default = DSPageNumber;
155
+ export {
156
+ DSPageNumber,
157
+ PageNumberWithSchema,
158
+ DSPageNumber_default as default
159
+ };
160
+ //# sourceMappingURL=DSPageNumber.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/DSPageNumber.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* 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"],
5
+ "mappings": "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",
6
+ "names": []
7
+ }
@@ -0,0 +1,12 @@
1
+ import * as React from "react";
2
+ const lengthToSize = (referenceWidth, value) => referenceWidth + referenceWidth / 7 * String(value).length;
3
+ const cleanPage = (value) => {
4
+ if (!value || value === "" || isNaN(parseInt(value)))
5
+ return "";
6
+ return parseInt(String(value || 1).replace(/\D/g, ""), 10);
7
+ };
8
+ export {
9
+ cleanPage,
10
+ lengthToSize
11
+ };
12
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/components/utils.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "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"],
5
+ "mappings": "AAAA;ACAO,MAAM,eAAe,CAAC,gBAAgB,UAC3C,iBAAkB,iBAAiB,IAAK,OAAO,OAAO;AAEjD,MAAM,YAAY,WAAS;AAChC,MAAI,CAAC,SAAS,UAAU,MAAM,MAAM,SAAS;AAAS,WAAO;AAC7D,SAAO,SAAS,OAAO,SAAS,GAAG,QAAQ,OAAO,KAAK;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,7 @@
1
+ import * as React from "react";
2
+ export * from "./DSPageNumber";
3
+ import { default as default2 } from "./DSPageNumber";
4
+ export {
5
+ default2 as default
6
+ };
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export * from './DSPageNumber';\n\nexport { default } from './DSPageNumber';\n"],
5
+ "mappings": "AAAA;ACAA;AAEA;",
6
+ "names": []
7
+ }
package/package.json CHANGED
@@ -1,23 +1,26 @@
1
1
  {
2
2
  "name": "@elliemae/ds-page-number",
3
- "version": "2.3.1",
3
+ "version": "3.0.0-alpha.3",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Page Number",
6
- "module": "./esm/index.js",
7
- "main": "./cjs/index.js",
8
- "types": "./types/index.d.ts",
6
+ "files": [
7
+ "dist"
8
+ ],
9
+ "module": "./dist/esm/index.js",
10
+ "main": "./dist/cjs/index.js",
11
+ "types": "./dist/types/index.d.ts",
9
12
  "exports": {
10
13
  ".": {
11
- "import": "./esm/index.js",
12
- "require": "./cjs/index.js"
14
+ "import": "./dist/esm/index.js",
15
+ "require": "./dist/cjs/index.js"
13
16
  },
14
17
  "./DSPageNumber": {
15
- "import": "./esm/DSPageNumber.js",
16
- "require": "./cjs/DSPageNumber.js"
18
+ "import": "./dist/esm/DSPageNumber.js",
19
+ "require": "./dist/cjs/DSPageNumber.js"
17
20
  },
18
21
  "./components/utils": {
19
- "import": "./esm/components/utils.js",
20
- "require": "./cjs/components/utils.js"
22
+ "import": "./dist/esm/components/utils.js",
23
+ "require": "./dist/cjs/components/utils.js"
21
24
  }
22
25
  },
23
26
  "sideEffects": [
@@ -29,25 +32,25 @@
29
32
  "url": "https://git.elliemae.io/platform-ui/dimsum.git"
30
33
  },
31
34
  "engines": {
32
- "npm": ">=7",
33
- "node": ">=14"
35
+ "pnpm": ">=6",
36
+ "node": ">=16"
34
37
  },
35
38
  "author": "ICE MT",
36
- "scripts": {
37
- "dev": "cross-env NODE_ENV=development && node ../../scripts/build/build.js -w",
38
- "prebuild": "exit 0",
39
- "predev": "exit 0",
40
- "build": "node ../../scripts/build/build.js"
39
+ "jestSonar": {
40
+ "sonar56x": true,
41
+ "reportPath": "reports",
42
+ "reportFile": "tests.xml",
43
+ "indent": 4
41
44
  },
42
45
  "dependencies": {
43
- "@elliemae/ds-button": "2.3.1",
44
- "@elliemae/ds-classnames": "2.3.1",
45
- "@elliemae/ds-form": "2.3.1",
46
- "@elliemae/ds-icons": "2.3.1",
46
+ "@elliemae/ds-button": "3.0.0-alpha.3",
47
+ "@elliemae/ds-classnames": "3.0.0-alpha.3",
48
+ "@elliemae/ds-form": "3.0.0-alpha.3",
49
+ "@elliemae/ds-icons": "3.0.0-alpha.3",
47
50
  "react-desc": "~4.1.3"
48
51
  },
49
52
  "devDependencies": {
50
- "@testing-library/jest-dom": "~5.15.0",
53
+ "@testing-library/jest-dom": "~5.15.1",
51
54
  "@testing-library/react": "~12.1.2",
52
55
  "styled-components": "~5.3.3"
53
56
  },
@@ -59,7 +62,13 @@
59
62
  },
60
63
  "publishConfig": {
61
64
  "access": "public",
62
- "directory": "dist",
63
- "generateSubmodules": true
65
+ "typeSafety": false
66
+ },
67
+ "scripts": {
68
+ "dev": "cross-env NODE_ENV=development node ../../scripts/build/build.mjs --watch",
69
+ "test": "node ../../scripts/testing/test.mjs",
70
+ "lint": "node ../../scripts/lint.mjs",
71
+ "dts": "node ../../scripts/dts.mjs",
72
+ "build": "cross-env NODE_ENV=production node ../../scripts/build/build.mjs"
64
73
  }
65
74
  }
@@ -1,159 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var _defineProperty = require('@babel/runtime/helpers/defineProperty');
6
- var _jsx = require('@babel/runtime/helpers/jsx');
7
- var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
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');
15
- var reactDesc = require('react-desc');
16
- var dsClassnames = require('@elliemae/ds-classnames');
17
- var dsIcons = require('@elliemae/ds-icons');
18
- var DSButton = require('@elliemae/ds-button');
19
- var dsForm = require('@elliemae/ds-form');
20
- var utils = require('./components/utils.js');
21
- var jsxRuntime = require('react/jsx-runtime');
22
-
23
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
24
-
25
- var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
26
- var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
27
- var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
28
- var DSButton__default = /*#__PURE__*/_interopDefaultLegacy(DSButton);
29
-
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); 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 = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
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);
68
- setSize(calculatedWidth);
69
- }, [page, safeTotal]);
70
-
71
- function handleUpdateInput(e) {
72
- const newValue = utils.cleanPage(e.target.value);
73
- if (newValue > safeTotal || newValue === 0) return;
74
- setPage(newValue);
75
- onChange(newValue);
76
- }
77
-
78
- function handleIncrease() {
79
- const newValue = page ? parseInt(page, 10) + 1 : 1;
80
- if (newValue > safeTotal) return;
81
- setPage(newValue);
82
- onChange(newValue);
83
- }
84
-
85
- function handleDecrease() {
86
- const newValue = page ? parseInt(page, 10) - 1 : 1;
87
- if (newValue < 1) return;
88
- setPage(newValue);
89
- onChange(newValue);
90
- }
91
-
92
- return /*#__PURE__*/jsxRuntime.jsx("div", _objectSpread(_objectSpread(_objectSpread({
93
- "data-testid": "ds-page-number",
94
- className: "".concat(cssClassName)
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
- }));
132
- };
133
-
134
- const pageNumberProps = {
135
- className: reactDesc.PropTypes.string.description('html class attribute'),
136
- containerProps: reactDesc.PropTypes.object.description('Set of Properties attached to the main container'),
137
- disabled: reactDesc.PropTypes.bool.description('Whether the component is disabled or not').defaultValue(false),
138
- value: reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.string, reactDesc.PropTypes.number, reactDesc.PropTypes.object]).description('page number value'),
139
- onChange: reactDesc.PropTypes.func.description('function executed when the page number changes'),
140
- currentPage: reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.string, reactDesc.PropTypes.number]).description('Value of the current page'),
141
- totalPages: reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.string, reactDesc.PropTypes.number]).description('Amount of pages').defaultValue(1),
142
- separator: reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.string, reactDesc.PropTypes.number]).description('Separator between current page and total pages').defaultValue('/')
143
- };
144
- const PageNumberWithSchema = reactDesc.describe(DSPageNumber);
145
- PageNumberWithSchema.propTypes = pageNumberProps;
146
- DSPageNumber.defaultProps = {
147
- className: '',
148
- disabled: false,
149
- onChange: () => null,
150
- containerProps: {},
151
- value: undefined,
152
- currentPage: undefined,
153
- totalPages: 1,
154
- separator: '/'
155
- };
156
-
157
- exports.DSPageNumber = DSPageNumber;
158
- exports.PageNumberWithSchema = PageNumberWithSchema;
159
- exports["default"] = DSPageNumber;
@@ -1,48 +0,0 @@
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
- });
@@ -1,14 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
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
- if (!value || value === '' || isNaN(parseInt(value))) return '';
10
- return parseInt(String(value || 1).replace(/\D/g, ''), 10);
11
- };
12
-
13
- exports.cleanPage = cleanPage;
14
- exports.lengthToSize = lengthToSize;
package/cjs/index.js DELETED
@@ -1,11 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var DSPageNumber = require('./DSPageNumber.js');
6
-
7
-
8
-
9
- exports.DSPageNumber = DSPageNumber.DSPageNumber;
10
- exports.PageNumberWithSchema = DSPageNumber.PageNumberWithSchema;
11
- exports["default"] = DSPageNumber.DSPageNumber;
@@ -1,146 +0,0 @@
1
- import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
2
- import _jsx from '@babel/runtime/helpers/esm/jsx';
3
- import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
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';
11
- import { PropTypes, describe } from 'react-desc';
12
- import { aggregatedClasses, convertPropToCssClassName } from '@elliemae/ds-classnames';
13
- import { ChevronSmallUp, ChevronSmallDown } from '@elliemae/ds-icons';
14
- import DSButton from '@elliemae/ds-button';
15
- import { DSInputGroup, DSInput } from '@elliemae/ds-form';
16
- import { cleanPage, lengthToSize } from './components/utils.js';
17
- import { jsx } from 'react/jsx-runtime';
18
-
19
- var _ChevronSmallUp, _ChevronSmallDown;
20
-
21
- const _excluded = ["className", "disabled", "value", "onChange", "containerProps", "currentPage", "totalPages", "separator"];
22
-
23
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
24
-
25
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
26
- const blockName = 'page-number-block';
27
- const PageNumberInputContainer = aggregatedClasses(DSInputGroup)(blockName);
28
-
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);
41
-
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);
57
- setSize(calculatedWidth);
58
- }, [page, safeTotal]);
59
-
60
- function handleUpdateInput(e) {
61
- const newValue = cleanPage(e.target.value);
62
- if (newValue > safeTotal || newValue === 0) return;
63
- setPage(newValue);
64
- onChange(newValue);
65
- }
66
-
67
- function handleIncrease() {
68
- const newValue = page ? parseInt(page, 10) + 1 : 1;
69
- if (newValue > safeTotal) return;
70
- setPage(newValue);
71
- onChange(newValue);
72
- }
73
-
74
- function handleDecrease() {
75
- const newValue = page ? parseInt(page, 10) - 1 : 1;
76
- if (newValue < 1) return;
77
- setPage(newValue);
78
- onChange(newValue);
79
- }
80
-
81
- return /*#__PURE__*/jsx("div", _objectSpread(_objectSpread(_objectSpread({
82
- "data-testid": "ds-page-number",
83
- className: "".concat(cssClassName)
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
- }));
121
- };
122
-
123
- const pageNumberProps = {
124
- className: PropTypes.string.description('html class attribute'),
125
- containerProps: PropTypes.object.description('Set of Properties attached to the main container'),
126
- disabled: PropTypes.bool.description('Whether the component is disabled or not').defaultValue(false),
127
- value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.object]).description('page number value'),
128
- onChange: PropTypes.func.description('function executed when the page number changes'),
129
- currentPage: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description('Value of the current page'),
130
- totalPages: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description('Amount of pages').defaultValue(1),
131
- separator: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description('Separator between current page and total pages').defaultValue('/')
132
- };
133
- const PageNumberWithSchema = describe(DSPageNumber);
134
- PageNumberWithSchema.propTypes = pageNumberProps;
135
- DSPageNumber.defaultProps = {
136
- className: '',
137
- disabled: false,
138
- onChange: () => null,
139
- containerProps: {},
140
- value: undefined,
141
- currentPage: undefined,
142
- totalPages: 1,
143
- separator: '/'
144
- };
145
-
146
- export { DSPageNumber, PageNumberWithSchema, DSPageNumber as default };
@@ -1,42 +0,0 @@
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
- });
@@ -1,9 +0,0 @@
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
- if (!value || value === '' || isNaN(parseInt(value))) return '';
6
- return parseInt(String(value || 1).replace(/\D/g, ''), 10);
7
- };
8
-
9
- export { cleanPage, lengthToSize };
package/esm/index.js DELETED
@@ -1 +0,0 @@
1
- export { DSPageNumber, PageNumberWithSchema, DSPageNumber as default } from './DSPageNumber.js';
@@ -1,73 +0,0 @@
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(arg: import("react-desc").ReactDescPossibleDefaultValues): {
18
- deprecated: import("react-desc").PropTypesDescValidator;
19
- };
20
- isRequired: import("react-desc").PropTypesDescValue;
21
- };
22
- containerProps: {
23
- defaultValue(arg: import("react-desc").ReactDescPossibleDefaultValues): {
24
- deprecated: import("react-desc").PropTypesDescValidator;
25
- };
26
- isRequired: import("react-desc").PropTypesDescValue;
27
- };
28
- disabled: {
29
- deprecated: import("react-desc").PropTypesDescValidator;
30
- };
31
- value: {
32
- defaultValue(arg: import("react-desc").ReactDescPossibleDefaultValues): {
33
- deprecated: import("react-desc").PropTypesDescValidator;
34
- };
35
- isRequired: import("react-desc").PropTypesDescValue;
36
- };
37
- onChange: {
38
- defaultValue(arg: import("react-desc").ReactDescPossibleDefaultValues): {
39
- deprecated: import("react-desc").PropTypesDescValidator;
40
- };
41
- isRequired: import("react-desc").PropTypesDescValue;
42
- };
43
- currentPage: {
44
- defaultValue(arg: import("react-desc").ReactDescPossibleDefaultValues): {
45
- deprecated: import("react-desc").PropTypesDescValidator;
46
- };
47
- isRequired: import("react-desc").PropTypesDescValue;
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?: unknown): JSX.Element;
69
- propTypes: unknown;
70
- toTypescript: () => import("react-desc").TypescriptSchema;
71
- };
72
- export { DSPageNumber, PageNumberWithSchema };
73
- export default DSPageNumber;
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- export declare const lengthToSize: (referenceWidth: any, value: any) => any;
2
- export declare const cleanPage: (value: any) => number | "";
package/types/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from './DSPageNumber';
2
- export { default } from './DSPageNumber';