@elliemae/ds-progress-indicator 3.0.0-next.1 → 3.0.0-next.5
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/DSProgressIndicator.js +113 -0
- package/dist/cjs/DSProgressIndicator.js.map +7 -0
- package/dist/cjs/ProgressBar.js +99 -0
- package/dist/cjs/ProgressBar.js.map +7 -0
- package/dist/cjs/ProgressCounter.js +50 -0
- package/dist/cjs/ProgressCounter.js.map +7 -0
- package/dist/cjs/classedComponents.js +47 -0
- package/dist/cjs/classedComponents.js.map +7 -0
- package/dist/cjs/index.js +36 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/utils.js +37 -0
- package/dist/cjs/utils.js.map +7 -0
- package/dist/esm/DSProgressIndicator.js +86 -0
- package/dist/esm/DSProgressIndicator.js.map +7 -0
- package/dist/esm/ProgressBar.js +72 -0
- package/dist/esm/ProgressBar.js.map +7 -0
- package/dist/esm/ProgressCounter.js +21 -0
- package/dist/esm/ProgressCounter.js.map +7 -0
- package/dist/esm/classedComponents.js +18 -0
- package/dist/esm/classedComponents.js.map +7 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/utils.js +8 -0
- package/dist/esm/utils.js.map +7 -0
- package/package.json +36 -27
- package/cjs/DSProgressIndicator.js +0 -92
- package/cjs/ProgressBar.js +0 -74
- package/cjs/ProgressCounter.js +0 -50
- package/cjs/classedComponents.js +0 -34
- package/cjs/index.js +0 -11
- package/cjs/utils.js +0 -9
- package/esm/DSProgressIndicator.js +0 -80
- package/esm/ProgressBar.js +0 -67
- package/esm/ProgressCounter.js +0 -44
- package/esm/classedComponents.js +0 -25
- package/esm/index.js +0 -1
- package/esm/utils.js +0 -5
- package/types/DSProgressIndicator.d.ts +0 -101
- package/types/ProgressBar.d.ts +0 -24
- package/types/ProgressCounter.d.ts +0 -12
- package/types/classedComponents.d.ts +0 -7
- package/types/index.d.ts +0 -2
- package/types/utils.d.ts +0 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2 from "react";
|
|
3
|
+
import { getPercentage } from "./utils";
|
|
4
|
+
import { ProgressIndicatorCounter } from "./classedComponents";
|
|
5
|
+
const defaultRenderer = ({ now, max, min }) => `${min || now} of ${max}`;
|
|
6
|
+
const percentageRenderer = ({ now, max, min }) => {
|
|
7
|
+
const percentage = getPercentage(now, min, max);
|
|
8
|
+
return `${percentage}%`;
|
|
9
|
+
};
|
|
10
|
+
const renderers = {
|
|
11
|
+
default: defaultRenderer,
|
|
12
|
+
percentage: percentageRenderer
|
|
13
|
+
};
|
|
14
|
+
function ProgressCounter({ now, max, min, renderer = renderers.default }) {
|
|
15
|
+
return /* @__PURE__ */ React2.createElement(ProgressIndicatorCounter, null, renderer({ now, max, min }));
|
|
16
|
+
}
|
|
17
|
+
var ProgressCounter_default = ProgressCounter;
|
|
18
|
+
export {
|
|
19
|
+
ProgressCounter_default as default
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=ProgressCounter.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/ProgressCounter.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { getPercentage } from './utils';\nimport { ProgressIndicatorCounter } from './classedComponents';\n\nconst defaultRenderer = ({ now, max, min }) => `${min || now} of ${max}`;\nconst percentageRenderer = ({ now, max, min }) => {\n const percentage = getPercentage(now, min, max);\n return `${percentage}%`;\n};\n\nconst renderers = {\n default: defaultRenderer,\n percentage: percentageRenderer,\n};\n\nfunction ProgressCounter({ now, max, min, renderer = renderers.default }) {\n return (\n <ProgressIndicatorCounter>\n {renderer({ now, max, min })}\n </ProgressIndicatorCounter>\n );\n}\n\nexport default ProgressCounter;\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;AACA;AAEA,MAAM,kBAAkB,CAAC,EAAE,KAAK,KAAK,UAAU,GAAG,OAAO,UAAU;AACnE,MAAM,qBAAqB,CAAC,EAAE,KAAK,KAAK,UAAU;AAChD,QAAM,aAAa,cAAc,KAAK,KAAK;AAC3C,SAAO,GAAG;AAAA;AAGZ,MAAM,YAAY;AAAA,EAChB,SAAS;AAAA,EACT,YAAY;AAAA;AAGd,yBAAyB,EAAE,KAAK,KAAK,KAAK,WAAW,UAAU,WAAW;AACxE,SACE,qCAAC,0BAAD,MACG,SAAS,EAAE,KAAK,KAAK;AAAA;AAK5B,IAAO,0BAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { aggregatedClasses } from "@elliemae/ds-classnames";
|
|
3
|
+
const blockName = "determinate-progress-indicator";
|
|
4
|
+
const progressBlockName = "progress-bar";
|
|
5
|
+
const Wrapper = aggregatedClasses("div")(blockName, null, ({ disabled }) => ({ disabled }));
|
|
6
|
+
const Title = aggregatedClasses("div")(blockName, "title");
|
|
7
|
+
const ProgressIndicatorCounter = aggregatedClasses("span")(blockName, "counter");
|
|
8
|
+
const ProgressBarStatusBar = aggregatedClasses("div")(progressBlockName);
|
|
9
|
+
const ProgressBarProgress = aggregatedClasses("div")(progressBlockName, "progress", ({ variant }) => ({ [variant]: true }));
|
|
10
|
+
export {
|
|
11
|
+
ProgressBarProgress,
|
|
12
|
+
ProgressBarStatusBar,
|
|
13
|
+
ProgressIndicatorCounter,
|
|
14
|
+
Title,
|
|
15
|
+
Wrapper,
|
|
16
|
+
blockName
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=classedComponents.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/classedComponents.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { aggregatedClasses } from '@elliemae/ds-classnames';\n\nexport const blockName = 'determinate-progress-indicator';\nconst progressBlockName = 'progress-bar';\n\nexport const Wrapper = aggregatedClasses('div')(\n blockName,\n null,\n ({ disabled }) => ({ disabled }),\n);\nexport const Title = aggregatedClasses('div')(blockName, 'title');\nexport const ProgressIndicatorCounter = aggregatedClasses('span')(\n blockName,\n 'counter',\n);\nexport const ProgressBarStatusBar = aggregatedClasses('div')(progressBlockName);\nexport const ProgressBarProgress = aggregatedClasses('div')(\n progressBlockName,\n 'progress',\n ({ variant }) => ({ [variant]: true }),\n);\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AAEO,MAAM,YAAY;AACzB,MAAM,oBAAoB;AAEnB,MAAM,UAAU,kBAAkB,OACvC,WACA,MACA,CAAC,EAAE,eAAgB,GAAE;AAEhB,MAAM,QAAQ,kBAAkB,OAAO,WAAW;AAClD,MAAM,2BAA2B,kBAAkB,QACxD,WACA;AAEK,MAAM,uBAAuB,kBAAkB,OAAO;AACtD,MAAM,sBAAsB,kBAAkB,OACnD,mBACA,YACA,CAAC,EAAE,cAAe,IAAG,UAAU;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -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 './DSProgressIndicator';\nexport { default } from './DSProgressIndicator';\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/utils.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export function getPercentage(now, min, max) {\n return ((now || min) / max) * 100;\n}\n"],
|
|
5
|
+
"mappings": "AAAA;ACAO,uBAAuB,KAAK,KAAK,KAAK;AAC3C,SAAS,QAAO,OAAO,MAAO;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,35 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-progress-indicator",
|
|
3
|
-
"version": "3.0.0-next.
|
|
3
|
+
"version": "3.0.0-next.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Progress Indicator",
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
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
|
"./utils": {
|
|
15
|
-
"import": "./esm/utils.js",
|
|
16
|
-
"require": "./cjs/utils.js"
|
|
18
|
+
"import": "./dist/esm/utils.js",
|
|
19
|
+
"require": "./dist/cjs/utils.js"
|
|
17
20
|
},
|
|
18
21
|
"./ProgressCounter": {
|
|
19
|
-
"import": "./esm/ProgressCounter.js",
|
|
20
|
-
"require": "./cjs/ProgressCounter.js"
|
|
22
|
+
"import": "./dist/esm/ProgressCounter.js",
|
|
23
|
+
"require": "./dist/cjs/ProgressCounter.js"
|
|
21
24
|
},
|
|
22
25
|
"./ProgressBar": {
|
|
23
|
-
"import": "./esm/ProgressBar.js",
|
|
24
|
-
"require": "./cjs/ProgressBar.js"
|
|
26
|
+
"import": "./dist/esm/ProgressBar.js",
|
|
27
|
+
"require": "./dist/cjs/ProgressBar.js"
|
|
25
28
|
},
|
|
26
29
|
"./DSProgressIndicator": {
|
|
27
|
-
"import": "./esm/DSProgressIndicator.js",
|
|
28
|
-
"require": "./cjs/DSProgressIndicator.js"
|
|
30
|
+
"import": "./dist/esm/DSProgressIndicator.js",
|
|
31
|
+
"require": "./dist/cjs/DSProgressIndicator.js"
|
|
29
32
|
},
|
|
30
33
|
"./classedComponents": {
|
|
31
|
-
"import": "./esm/classedComponents.js",
|
|
32
|
-
"require": "./cjs/classedComponents.js"
|
|
34
|
+
"import": "./dist/esm/classedComponents.js",
|
|
35
|
+
"require": "./dist/cjs/classedComponents.js"
|
|
33
36
|
}
|
|
34
37
|
},
|
|
35
38
|
"sideEffects": [
|
|
@@ -41,19 +44,19 @@
|
|
|
41
44
|
"url": "https://git.elliemae.io/platform-ui/dimsum.git"
|
|
42
45
|
},
|
|
43
46
|
"engines": {
|
|
44
|
-
"
|
|
45
|
-
"node": ">=
|
|
47
|
+
"pnpm": ">=6",
|
|
48
|
+
"node": ">=16"
|
|
46
49
|
},
|
|
47
50
|
"author": "ICE MT",
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
51
|
+
"jestSonar": {
|
|
52
|
+
"sonar56x": true,
|
|
53
|
+
"reportPath": "reports",
|
|
54
|
+
"reportFile": "tests.xml",
|
|
55
|
+
"indent": 4
|
|
53
56
|
},
|
|
54
57
|
"dependencies": {
|
|
55
|
-
"@elliemae/ds-classnames": "3.0.0-next.
|
|
56
|
-
"@elliemae/ds-truncated-tooltip-text": "3.0.0-next.
|
|
58
|
+
"@elliemae/ds-classnames": "3.0.0-next.5",
|
|
59
|
+
"@elliemae/ds-truncated-tooltip-text": "3.0.0-next.5",
|
|
57
60
|
"prop-types": "~15.7.2",
|
|
58
61
|
"react-desc": "~4.1.3"
|
|
59
62
|
},
|
|
@@ -63,7 +66,13 @@
|
|
|
63
66
|
},
|
|
64
67
|
"publishConfig": {
|
|
65
68
|
"access": "public",
|
|
66
|
-
"
|
|
67
|
-
|
|
69
|
+
"typeSafety": false
|
|
70
|
+
},
|
|
71
|
+
"scripts": {
|
|
72
|
+
"dev": "cross-env NODE_ENV=development node ../../scripts/build/build.mjs --watch",
|
|
73
|
+
"test": "node ../../scripts/testing/test.mjs",
|
|
74
|
+
"lint": "node ../../scripts/lint.mjs",
|
|
75
|
+
"dts": "node ../../scripts/dts.mjs",
|
|
76
|
+
"build": "cross-env NODE_ENV=production node ../../scripts/build/build.mjs"
|
|
68
77
|
}
|
|
69
78
|
}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var _jsx2 = require('@babel/runtime/helpers/jsx');
|
|
6
|
-
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
7
|
-
require('core-js/modules/esnext.async-iterator.map.js');
|
|
8
|
-
require('core-js/modules/esnext.iterator.map.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 DSTruncatedTooltipText = require('@elliemae/ds-truncated-tooltip-text');
|
|
17
|
-
var ProgressCounter = require('./ProgressCounter.js');
|
|
18
|
-
var ProgressBar = require('./ProgressBar.js');
|
|
19
|
-
var classedComponents = require('./classedComponents.js');
|
|
20
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
21
|
-
|
|
22
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
23
|
-
|
|
24
|
-
var _jsx2__default = /*#__PURE__*/_interopDefaultLegacy(_jsx2);
|
|
25
|
-
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
26
|
-
var DSTruncatedTooltipText__default = /*#__PURE__*/_interopDefaultLegacy(DSTruncatedTooltipText);
|
|
27
|
-
|
|
28
|
-
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; }
|
|
29
|
-
|
|
30
|
-
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; }
|
|
31
|
-
|
|
32
|
-
const DSProgressIndicator = _ref => {
|
|
33
|
-
var _ProgressBar;
|
|
34
|
-
|
|
35
|
-
let {
|
|
36
|
-
containerProps = {},
|
|
37
|
-
innerRef = () => null,
|
|
38
|
-
title = '',
|
|
39
|
-
counterRenderer = undefined,
|
|
40
|
-
now = undefined,
|
|
41
|
-
min = 0,
|
|
42
|
-
max = undefined,
|
|
43
|
-
disabled = false,
|
|
44
|
-
segments = [],
|
|
45
|
-
style = {}
|
|
46
|
-
} = _ref;
|
|
47
|
-
const renderProgressBar = react.useMemo(() => segments.length ? /*#__PURE__*/_jsx2__default["default"](ProgressBar, {}, void 0, segments.map((segmentProps, i) => !(segmentProps.now < segmentProps.min) && /*#__PURE__*/jsxRuntime.jsx(ProgressBar.Segment, _objectSpread({}, segmentProps), i))) : _ProgressBar || (_ProgressBar = /*#__PURE__*/_jsx2__default["default"](ProgressBar, {
|
|
48
|
-
max: max,
|
|
49
|
-
min: min,
|
|
50
|
-
now: now
|
|
51
|
-
})), [segments, min, max, now]);
|
|
52
|
-
return /*#__PURE__*/jsxRuntime.jsxs(classedComponents.Wrapper, _objectSpread(_objectSpread({
|
|
53
|
-
ref: innerRef,
|
|
54
|
-
"aria-disabled": disabled,
|
|
55
|
-
classProps: {
|
|
56
|
-
disabled
|
|
57
|
-
}
|
|
58
|
-
}, containerProps), {}, {
|
|
59
|
-
style: style,
|
|
60
|
-
children: [/*#__PURE__*/_jsx2__default["default"](DSTruncatedTooltipText__default["default"], {
|
|
61
|
-
containerComponent: classedComponents.Title,
|
|
62
|
-
value: title
|
|
63
|
-
}), /*#__PURE__*/_jsx2__default["default"](ProgressCounter, {
|
|
64
|
-
max: max,
|
|
65
|
-
min: min,
|
|
66
|
-
now: now,
|
|
67
|
-
renderer: counterRenderer
|
|
68
|
-
}), renderProgressBar]
|
|
69
|
-
}));
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
const variants = ['default', 'success', 'warning', 'info', 'error'];
|
|
73
|
-
const progressIndicatorProps = {
|
|
74
|
-
containerProps: reactDesc.PropTypes.object.description('Set of Properties attached to the main container'),
|
|
75
|
-
innerRef: reactDesc.PropTypes.object.description('ref to the components container'),
|
|
76
|
-
title: reactDesc.PropTypes.string.description('components title'),
|
|
77
|
-
variant: reactDesc.PropTypes.oneOf(variants).description('Progress intent variation'),
|
|
78
|
-
now: reactDesc.PropTypes.number.description('Total current value'),
|
|
79
|
-
min: reactDesc.PropTypes.number.description('min value'),
|
|
80
|
-
max: reactDesc.PropTypes.number.description('max value'),
|
|
81
|
-
disabled: reactDesc.PropTypes.bool.description('Whether the progress indicator disabled or not').defaultValue(false),
|
|
82
|
-
counterRenderer: reactDesc.PropTypes.func.description('Render a custom counter'),
|
|
83
|
-
segments: reactDesc.PropTypes.array.description('An array of multiple progress objects'),
|
|
84
|
-
style: reactDesc.PropTypes.object.description('css inline style')
|
|
85
|
-
};
|
|
86
|
-
const ProgressIndicatorWithSchema = reactDesc.describe(DSProgressIndicator);
|
|
87
|
-
ProgressIndicatorWithSchema.propTypes = progressIndicatorProps;
|
|
88
|
-
DSProgressIndicator.ProgressBar = ProgressBar;
|
|
89
|
-
|
|
90
|
-
exports.DSProgressIndicator = DSProgressIndicator;
|
|
91
|
-
exports.ProgressIndicatorWithSchema = ProgressIndicatorWithSchema;
|
|
92
|
-
exports["default"] = DSProgressIndicator;
|
package/cjs/ProgressBar.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
4
|
-
require('core-js/modules/esnext.iterator.constructor.js');
|
|
5
|
-
require('core-js/modules/esnext.iterator.filter.js');
|
|
6
|
-
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
7
|
-
require('core-js/modules/esnext.iterator.for-each.js');
|
|
8
|
-
var _jsx2 = require('@babel/runtime/helpers/jsx');
|
|
9
|
-
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
10
|
-
require('react');
|
|
11
|
-
var utils = require('./utils.js');
|
|
12
|
-
var classedComponents = require('./classedComponents.js');
|
|
13
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
14
|
-
|
|
15
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
16
|
-
|
|
17
|
-
var _jsx2__default = /*#__PURE__*/_interopDefaultLegacy(_jsx2);
|
|
18
|
-
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
19
|
-
|
|
20
|
-
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; }
|
|
21
|
-
|
|
22
|
-
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; }
|
|
23
|
-
|
|
24
|
-
function useProgressTrait(_ref) {
|
|
25
|
-
let {
|
|
26
|
-
now = undefined,
|
|
27
|
-
min = undefined,
|
|
28
|
-
max = undefined,
|
|
29
|
-
text = ''
|
|
30
|
-
} = _ref;
|
|
31
|
-
const percentage = utils.getPercentage(now, min, max);
|
|
32
|
-
return {
|
|
33
|
-
role: 'progressbar',
|
|
34
|
-
'aria-valuenow': now,
|
|
35
|
-
'aria-valuemin': min,
|
|
36
|
-
'aria-valuemax': max,
|
|
37
|
-
'aria-valuetext': text,
|
|
38
|
-
style: {
|
|
39
|
-
width: "".concat(percentage, "%")
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function Progress(props) {
|
|
45
|
-
const {
|
|
46
|
-
variant = 'default'
|
|
47
|
-
} = props;
|
|
48
|
-
const progressTraitProps = useProgressTrait(props);
|
|
49
|
-
return /*#__PURE__*/jsxRuntime.jsx(classedComponents.ProgressBarProgress, _objectSpread({
|
|
50
|
-
classProps: {
|
|
51
|
-
variant
|
|
52
|
-
}
|
|
53
|
-
}, progressTraitProps));
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function ProgressBar(_ref2) {
|
|
57
|
-
let {
|
|
58
|
-
variant = 'default',
|
|
59
|
-
now = undefined,
|
|
60
|
-
min = undefined,
|
|
61
|
-
max = undefined,
|
|
62
|
-
children: progressSegments
|
|
63
|
-
} = _ref2;
|
|
64
|
-
return /*#__PURE__*/_jsx2__default["default"](classedComponents.ProgressBarStatusBar, {}, void 0, progressSegments || /*#__PURE__*/_jsx2__default["default"](Progress, {
|
|
65
|
-
max: max,
|
|
66
|
-
min: min,
|
|
67
|
-
now: now,
|
|
68
|
-
variant: variant
|
|
69
|
-
}));
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
ProgressBar.Segment = Progress;
|
|
73
|
-
|
|
74
|
-
module.exports = ProgressBar;
|
package/cjs/ProgressCounter.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var _jsx2 = require('@babel/runtime/helpers/jsx');
|
|
4
|
-
require('react');
|
|
5
|
-
var utils = require('./utils.js');
|
|
6
|
-
var classedComponents = require('./classedComponents.js');
|
|
7
|
-
|
|
8
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
9
|
-
|
|
10
|
-
var _jsx2__default = /*#__PURE__*/_interopDefaultLegacy(_jsx2);
|
|
11
|
-
|
|
12
|
-
const defaultRenderer = _ref => {
|
|
13
|
-
let {
|
|
14
|
-
now,
|
|
15
|
-
max,
|
|
16
|
-
min
|
|
17
|
-
} = _ref;
|
|
18
|
-
return "".concat(min || now, " of ").concat(max);
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const percentageRenderer = _ref2 => {
|
|
22
|
-
let {
|
|
23
|
-
now,
|
|
24
|
-
max,
|
|
25
|
-
min
|
|
26
|
-
} = _ref2;
|
|
27
|
-
const percentage = utils.getPercentage(now, min, max);
|
|
28
|
-
return "".concat(percentage, "%");
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const renderers = {
|
|
32
|
-
default: defaultRenderer,
|
|
33
|
-
percentage: percentageRenderer
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
function ProgressCounter(_ref3) {
|
|
37
|
-
let {
|
|
38
|
-
now,
|
|
39
|
-
max,
|
|
40
|
-
min,
|
|
41
|
-
renderer = renderers.default
|
|
42
|
-
} = _ref3;
|
|
43
|
-
return /*#__PURE__*/_jsx2__default["default"](classedComponents.ProgressIndicatorCounter, {}, void 0, renderer({
|
|
44
|
-
now,
|
|
45
|
-
max,
|
|
46
|
-
min
|
|
47
|
-
}));
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
module.exports = ProgressCounter;
|
package/cjs/classedComponents.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var dsClassnames = require('@elliemae/ds-classnames');
|
|
6
|
-
|
|
7
|
-
const blockName = 'determinate-progress-indicator';
|
|
8
|
-
const progressBlockName = 'progress-bar';
|
|
9
|
-
const Wrapper = dsClassnames.aggregatedClasses('div')(blockName, null, _ref => {
|
|
10
|
-
let {
|
|
11
|
-
disabled
|
|
12
|
-
} = _ref;
|
|
13
|
-
return {
|
|
14
|
-
disabled
|
|
15
|
-
};
|
|
16
|
-
});
|
|
17
|
-
const Title = dsClassnames.aggregatedClasses('div')(blockName, 'title');
|
|
18
|
-
const ProgressIndicatorCounter = dsClassnames.aggregatedClasses('span')(blockName, 'counter');
|
|
19
|
-
const ProgressBarStatusBar = dsClassnames.aggregatedClasses('div')(progressBlockName);
|
|
20
|
-
const ProgressBarProgress = dsClassnames.aggregatedClasses('div')(progressBlockName, 'progress', _ref2 => {
|
|
21
|
-
let {
|
|
22
|
-
variant
|
|
23
|
-
} = _ref2;
|
|
24
|
-
return {
|
|
25
|
-
[variant]: true
|
|
26
|
-
};
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
exports.ProgressBarProgress = ProgressBarProgress;
|
|
30
|
-
exports.ProgressBarStatusBar = ProgressBarStatusBar;
|
|
31
|
-
exports.ProgressIndicatorCounter = ProgressIndicatorCounter;
|
|
32
|
-
exports.Title = Title;
|
|
33
|
-
exports.Wrapper = Wrapper;
|
|
34
|
-
exports.blockName = blockName;
|
package/cjs/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var DSProgressIndicator = require('./DSProgressIndicator.js');
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
exports.DSProgressIndicator = DSProgressIndicator.DSProgressIndicator;
|
|
10
|
-
exports.ProgressIndicatorWithSchema = DSProgressIndicator.ProgressIndicatorWithSchema;
|
|
11
|
-
exports["default"] = DSProgressIndicator.DSProgressIndicator;
|
package/cjs/utils.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import _jsx2 from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
-
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
3
|
-
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
4
|
-
import 'core-js/modules/esnext.iterator.map.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 { useMemo } from 'react';
|
|
11
|
-
import { PropTypes, describe } from 'react-desc';
|
|
12
|
-
import DSTruncatedTooltipText from '@elliemae/ds-truncated-tooltip-text';
|
|
13
|
-
import ProgressCounter from './ProgressCounter.js';
|
|
14
|
-
import ProgressBar from './ProgressBar.js';
|
|
15
|
-
import { Wrapper, Title } from './classedComponents.js';
|
|
16
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
17
|
-
|
|
18
|
-
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; }
|
|
19
|
-
|
|
20
|
-
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; }
|
|
21
|
-
|
|
22
|
-
const DSProgressIndicator = _ref => {
|
|
23
|
-
var _ProgressBar;
|
|
24
|
-
|
|
25
|
-
let {
|
|
26
|
-
containerProps = {},
|
|
27
|
-
innerRef = () => null,
|
|
28
|
-
title = '',
|
|
29
|
-
counterRenderer = undefined,
|
|
30
|
-
now = undefined,
|
|
31
|
-
min = 0,
|
|
32
|
-
max = undefined,
|
|
33
|
-
disabled = false,
|
|
34
|
-
segments = [],
|
|
35
|
-
style = {}
|
|
36
|
-
} = _ref;
|
|
37
|
-
const renderProgressBar = useMemo(() => segments.length ? /*#__PURE__*/_jsx2(ProgressBar, {}, void 0, segments.map((segmentProps, i) => !(segmentProps.now < segmentProps.min) && /*#__PURE__*/jsx(ProgressBar.Segment, _objectSpread({}, segmentProps), i))) : _ProgressBar || (_ProgressBar = /*#__PURE__*/_jsx2(ProgressBar, {
|
|
38
|
-
max: max,
|
|
39
|
-
min: min,
|
|
40
|
-
now: now
|
|
41
|
-
})), [segments, min, max, now]);
|
|
42
|
-
return /*#__PURE__*/jsxs(Wrapper, _objectSpread(_objectSpread({
|
|
43
|
-
ref: innerRef,
|
|
44
|
-
"aria-disabled": disabled,
|
|
45
|
-
classProps: {
|
|
46
|
-
disabled
|
|
47
|
-
}
|
|
48
|
-
}, containerProps), {}, {
|
|
49
|
-
style: style,
|
|
50
|
-
children: [/*#__PURE__*/_jsx2(DSTruncatedTooltipText, {
|
|
51
|
-
containerComponent: Title,
|
|
52
|
-
value: title
|
|
53
|
-
}), /*#__PURE__*/_jsx2(ProgressCounter, {
|
|
54
|
-
max: max,
|
|
55
|
-
min: min,
|
|
56
|
-
now: now,
|
|
57
|
-
renderer: counterRenderer
|
|
58
|
-
}), renderProgressBar]
|
|
59
|
-
}));
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
const variants = ['default', 'success', 'warning', 'info', 'error'];
|
|
63
|
-
const progressIndicatorProps = {
|
|
64
|
-
containerProps: PropTypes.object.description('Set of Properties attached to the main container'),
|
|
65
|
-
innerRef: PropTypes.object.description('ref to the components container'),
|
|
66
|
-
title: PropTypes.string.description('components title'),
|
|
67
|
-
variant: PropTypes.oneOf(variants).description('Progress intent variation'),
|
|
68
|
-
now: PropTypes.number.description('Total current value'),
|
|
69
|
-
min: PropTypes.number.description('min value'),
|
|
70
|
-
max: PropTypes.number.description('max value'),
|
|
71
|
-
disabled: PropTypes.bool.description('Whether the progress indicator disabled or not').defaultValue(false),
|
|
72
|
-
counterRenderer: PropTypes.func.description('Render a custom counter'),
|
|
73
|
-
segments: PropTypes.array.description('An array of multiple progress objects'),
|
|
74
|
-
style: PropTypes.object.description('css inline style')
|
|
75
|
-
};
|
|
76
|
-
const ProgressIndicatorWithSchema = describe(DSProgressIndicator);
|
|
77
|
-
ProgressIndicatorWithSchema.propTypes = progressIndicatorProps;
|
|
78
|
-
DSProgressIndicator.ProgressBar = ProgressBar;
|
|
79
|
-
|
|
80
|
-
export { DSProgressIndicator, ProgressIndicatorWithSchema, DSProgressIndicator as default };
|
package/esm/ProgressBar.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
-
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
-
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
-
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
-
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
-
import _jsx2 from '@babel/runtime/helpers/esm/jsx';
|
|
7
|
-
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
8
|
-
import 'react';
|
|
9
|
-
import { getPercentage } from './utils.js';
|
|
10
|
-
import { ProgressBarStatusBar, ProgressBarProgress } from './classedComponents.js';
|
|
11
|
-
import { jsx } from 'react/jsx-runtime';
|
|
12
|
-
|
|
13
|
-
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; }
|
|
14
|
-
|
|
15
|
-
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; }
|
|
16
|
-
|
|
17
|
-
function useProgressTrait(_ref) {
|
|
18
|
-
let {
|
|
19
|
-
now = undefined,
|
|
20
|
-
min = undefined,
|
|
21
|
-
max = undefined,
|
|
22
|
-
text = ''
|
|
23
|
-
} = _ref;
|
|
24
|
-
const percentage = getPercentage(now, min, max);
|
|
25
|
-
return {
|
|
26
|
-
role: 'progressbar',
|
|
27
|
-
'aria-valuenow': now,
|
|
28
|
-
'aria-valuemin': min,
|
|
29
|
-
'aria-valuemax': max,
|
|
30
|
-
'aria-valuetext': text,
|
|
31
|
-
style: {
|
|
32
|
-
width: "".concat(percentage, "%")
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function Progress(props) {
|
|
38
|
-
const {
|
|
39
|
-
variant = 'default'
|
|
40
|
-
} = props;
|
|
41
|
-
const progressTraitProps = useProgressTrait(props);
|
|
42
|
-
return /*#__PURE__*/jsx(ProgressBarProgress, _objectSpread({
|
|
43
|
-
classProps: {
|
|
44
|
-
variant
|
|
45
|
-
}
|
|
46
|
-
}, progressTraitProps));
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function ProgressBar(_ref2) {
|
|
50
|
-
let {
|
|
51
|
-
variant = 'default',
|
|
52
|
-
now = undefined,
|
|
53
|
-
min = undefined,
|
|
54
|
-
max = undefined,
|
|
55
|
-
children: progressSegments
|
|
56
|
-
} = _ref2;
|
|
57
|
-
return /*#__PURE__*/_jsx2(ProgressBarStatusBar, {}, void 0, progressSegments || /*#__PURE__*/_jsx2(Progress, {
|
|
58
|
-
max: max,
|
|
59
|
-
min: min,
|
|
60
|
-
now: now,
|
|
61
|
-
variant: variant
|
|
62
|
-
}));
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
ProgressBar.Segment = Progress;
|
|
66
|
-
|
|
67
|
-
export { ProgressBar as default };
|