@elliemae/ds-page-number 3.5.0-rc.9 → 3.5.1-next.0
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/dist/cjs/DSPageNumber.js
CHANGED
|
@@ -30,7 +30,8 @@ __export(DSPageNumber_exports, {
|
|
|
30
30
|
});
|
|
31
31
|
module.exports = __toCommonJS(DSPageNumber_exports);
|
|
32
32
|
var React = __toESM(require("react"));
|
|
33
|
-
var
|
|
33
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
34
|
+
var import_react = require("react");
|
|
34
35
|
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
35
36
|
var import_ds_classnames = require("@elliemae/ds-classnames");
|
|
36
37
|
var import_ds_icons = require("@elliemae/ds-icons");
|
|
@@ -83,46 +84,62 @@ const DSPageNumber = ({
|
|
|
83
84
|
setPage(newValue);
|
|
84
85
|
onChange(newValue);
|
|
85
86
|
}
|
|
86
|
-
return /* @__PURE__ */
|
|
87
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
87
88
|
"data-testid": "ds-page-number",
|
|
88
89
|
className: `${cssClassName}`,
|
|
89
90
|
...containerProps,
|
|
90
|
-
...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
|
-
|
|
125
|
-
|
|
91
|
+
...otherProps,
|
|
92
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(PageNumberInputContainer, {
|
|
93
|
+
children: [
|
|
94
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
95
|
+
className: `${classNameElement("pages")}`,
|
|
96
|
+
children: [
|
|
97
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_form.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
|
+
}),
|
|
106
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
107
|
+
className: `${classNameElement("separator")}`,
|
|
108
|
+
children: separator
|
|
109
|
+
}),
|
|
110
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
111
|
+
className: `${classNameElement("total")}`,
|
|
112
|
+
"data-testid": "page-number__total-pages",
|
|
113
|
+
children: totalPages
|
|
114
|
+
}),
|
|
115
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
116
|
+
ref,
|
|
117
|
+
className: `${classNameElement("ref")}`
|
|
118
|
+
})
|
|
119
|
+
]
|
|
120
|
+
}),
|
|
121
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
122
|
+
className: `${classNameElement("limiter")}`
|
|
123
|
+
}),
|
|
124
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_button.default, {
|
|
125
|
+
"aria-label": "dropdown-indicator",
|
|
126
|
+
buttonType: "text",
|
|
127
|
+
className: "dropdown-indicator",
|
|
128
|
+
"data-testid": "page-number__increase",
|
|
129
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.ChevronSmallUp, {}),
|
|
130
|
+
onClick: handleIncrease
|
|
131
|
+
}),
|
|
132
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_button.default, {
|
|
133
|
+
"aria-label": "dropdown-indicator",
|
|
134
|
+
buttonType: "text",
|
|
135
|
+
className: "dropdown-indicator",
|
|
136
|
+
"data-testid": "page-number__decrease",
|
|
137
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.ChevronSmallDown, {}),
|
|
138
|
+
onClick: handleDecrease
|
|
139
|
+
})
|
|
140
|
+
]
|
|
141
|
+
})
|
|
142
|
+
});
|
|
126
143
|
};
|
|
127
144
|
const pageNumberProps = {
|
|
128
145
|
className: import_ds_utilities.PropTypes.string.description("html class attribute"),
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/DSPageNumber.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["/* eslint-disable max-lines */\nimport React, { useState, useRef, useEffect } from 'react';\nimport { describe, PropTypes } from '@elliemae/ds-utilities';\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;\nDSPageNumber.displayName = 'DSPageNumber';\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": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
6
|
-
"names": ["
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB;AACA,mBAAmD;AACnD,0BAAoC;AACpC,2BAA6D;AAC7D,sBAAiD;AACjD,uBAAqB;AACrB,qBAAsC;AACtC,mBAAwC;AAExC,MAAM,YAAY;AAClB,MAAM,+BAA2B,wCAAkB,2BAAY,EAAE,SAAS;AAE1E,MAAM,eAAe,CAAC;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,KACG;AACL,MAAM;AACJ,QAAM,gBAAY,wBAAU,UAAU;AACtC,QAAM,UAAM,qBAAO,IAAI;AACvB,QAAM,EAAE,cAAc,iBAAiB,QAAI,gDAA0B,eAAe,WAAW;AAAA,IAC7F;AAAA,EACF,CAAC;AACD,QAAM,CAAC,MAAM,OAAO,QAAI,2BAAS,wBAAU,WAAW,KAAK,CAAC;AAC5D,QAAM,CAAC,MAAM,OAAO,QAAI,uBAAS,IAAI;AACrC,8BAAU,MAAM;AACd,UAAM,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AAU;AAAA,EACV,UAAU,MAAM;AAAA,EAChB,gBAAgB,CAAC;AAAA,EACjB,OAAO;AAAA,EACP,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,WAAW;AACb;AAGA,IAAO,uBAAQ;",
|
|
6
|
+
"names": ["DSButton"]
|
|
7
7
|
}
|
package/dist/esm/DSPageNumber.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState, useRef, useEffect } from "react";
|
|
3
4
|
import { describe, PropTypes } from "@elliemae/ds-utilities";
|
|
4
5
|
import { aggregatedClasses, convertPropToCssClassName } from "@elliemae/ds-classnames";
|
|
5
6
|
import { ChevronSmallDown, ChevronSmallUp } from "@elliemae/ds-icons";
|
|
@@ -52,46 +53,62 @@ const DSPageNumber = ({
|
|
|
52
53
|
setPage(newValue);
|
|
53
54
|
onChange(newValue);
|
|
54
55
|
}
|
|
55
|
-
return /* @__PURE__ */
|
|
56
|
+
return /* @__PURE__ */ jsx("div", {
|
|
56
57
|
"data-testid": "ds-page-number",
|
|
57
58
|
className: `${cssClassName}`,
|
|
58
59
|
...containerProps,
|
|
59
|
-
...otherProps
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
60
|
+
...otherProps,
|
|
61
|
+
children: /* @__PURE__ */ jsxs(PageNumberInputContainer, {
|
|
62
|
+
children: [
|
|
63
|
+
/* @__PURE__ */ jsxs("div", {
|
|
64
|
+
className: `${classNameElement("pages")}`,
|
|
65
|
+
children: [
|
|
66
|
+
/* @__PURE__ */ jsx(DSInput, {
|
|
67
|
+
className: `${classNameElement("input")}`,
|
|
68
|
+
"data-testid": "page-number__current-page",
|
|
69
|
+
onChange: handleUpdateInput,
|
|
70
|
+
style: {
|
|
71
|
+
width: `${size}px`
|
|
72
|
+
},
|
|
73
|
+
value: page
|
|
74
|
+
}),
|
|
75
|
+
/* @__PURE__ */ jsx("div", {
|
|
76
|
+
className: `${classNameElement("separator")}`,
|
|
77
|
+
children: separator
|
|
78
|
+
}),
|
|
79
|
+
/* @__PURE__ */ jsx("div", {
|
|
80
|
+
className: `${classNameElement("total")}`,
|
|
81
|
+
"data-testid": "page-number__total-pages",
|
|
82
|
+
children: totalPages
|
|
83
|
+
}),
|
|
84
|
+
/* @__PURE__ */ jsx("div", {
|
|
85
|
+
ref,
|
|
86
|
+
className: `${classNameElement("ref")}`
|
|
87
|
+
})
|
|
88
|
+
]
|
|
89
|
+
}),
|
|
90
|
+
/* @__PURE__ */ jsx("div", {
|
|
91
|
+
className: `${classNameElement("limiter")}`
|
|
92
|
+
}),
|
|
93
|
+
/* @__PURE__ */ jsx(DSButton, {
|
|
94
|
+
"aria-label": "dropdown-indicator",
|
|
95
|
+
buttonType: "text",
|
|
96
|
+
className: "dropdown-indicator",
|
|
97
|
+
"data-testid": "page-number__increase",
|
|
98
|
+
icon: /* @__PURE__ */ jsx(ChevronSmallUp, {}),
|
|
99
|
+
onClick: handleIncrease
|
|
100
|
+
}),
|
|
101
|
+
/* @__PURE__ */ jsx(DSButton, {
|
|
102
|
+
"aria-label": "dropdown-indicator",
|
|
103
|
+
buttonType: "text",
|
|
104
|
+
className: "dropdown-indicator",
|
|
105
|
+
"data-testid": "page-number__decrease",
|
|
106
|
+
icon: /* @__PURE__ */ jsx(ChevronSmallDown, {}),
|
|
107
|
+
onClick: handleDecrease
|
|
108
|
+
})
|
|
109
|
+
]
|
|
110
|
+
})
|
|
111
|
+
});
|
|
95
112
|
};
|
|
96
113
|
const pageNumberProps = {
|
|
97
114
|
className: PropTypes.string.description("html class attribute"),
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/DSPageNumber.tsx"],
|
|
4
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 '@elliemae/ds-utilities';\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;\nDSPageNumber.displayName = 'DSPageNumber';\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": "AAAA,YAAY,WAAW;
|
|
6
|
-
"names": [
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AACA,SAAgB,UAAU,QAAQ,iBAAiB;AACnD,SAAS,UAAU,iBAAiB;AACpC,SAAS,mBAAmB,iCAAiC;AAC7D,SAAS,kBAAkB,sBAAsB;AACjD,OAAO,cAAc;AACrB,SAAS,SAAS,oBAAoB;AACtC,SAAS,cAAc,iBAAiB;AAExC,MAAM,YAAY;AAClB,MAAM,2BAA2B,kBAAkB,YAAY,EAAE,SAAS;AAE1E,MAAM,eAAe,CAAC;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,KACG;AACL,MAAM;AACJ,QAAM,YAAY,UAAU,UAAU;AACtC,QAAM,MAAM,OAAO,IAAI;AACvB,QAAM,EAAE,cAAc,iBAAiB,IAAI,0BAA0B,eAAe,WAAW;AAAA,IAC7F;AAAA,EACF,CAAC;AACD,QAAM,CAAC,MAAM,OAAO,IAAI,SAAS,UAAU,WAAW,KAAK,CAAC;AAC5D,QAAM,CAAC,MAAM,OAAO,IAAI,SAAS,IAAI;AACrC,YAAU,MAAM;AACd,UAAM,EAAE,MAAM,IAAI,IAAI,QAAQ,sBAAsB;AACpD,UAAM,kBAAkB,aAAa,OAAO,IAAI;AAChD,YAAQ,eAAe;AAAA,EACzB,GAAG,CAAC,MAAM,SAAS,CAAC;AAEpB,WAAS,kBAAkB,GAAG;AAC5B,UAAM,WAAW,UAAU,EAAE,OAAO,KAAK;AACzC,QAAI,WAAW,aAAa,aAAa;AAAG;AAC5C,YAAQ,QAAQ;AAChB,aA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
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Page Number",
|
|
6
6
|
"files": [
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
"indent": 4
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@elliemae/ds-button": "3.5.
|
|
47
|
-
"@elliemae/ds-classnames": "3.5.
|
|
48
|
-
"@elliemae/ds-form": "3.5.
|
|
49
|
-
"@elliemae/ds-icons": "3.5.
|
|
50
|
-
"@elliemae/ds-utilities": "3.5.
|
|
46
|
+
"@elliemae/ds-button": "3.5.1-next.0",
|
|
47
|
+
"@elliemae/ds-classnames": "3.5.1-next.0",
|
|
48
|
+
"@elliemae/ds-form": "3.5.1-next.0",
|
|
49
|
+
"@elliemae/ds-icons": "3.5.1-next.0",
|
|
50
|
+
"@elliemae/ds-utilities": "3.5.1-next.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@testing-library/jest-dom": "~5.16.4",
|