@elliemae/ds-circular-progress-indicator 2.3.1-rc.2 → 3.0.0-alpha.2

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.
Files changed (51) hide show
  1. package/dist/cjs/DSCircularProgressIndicator.js +246 -0
  2. package/dist/cjs/DSCircularProgressIndicator.js.map +7 -0
  3. package/dist/cjs/index.js +40 -0
  4. package/dist/cjs/index.js.map +7 -0
  5. package/dist/cjs/v2/DSCircularIndeterminateIndicator.js +121 -0
  6. package/dist/cjs/v2/DSCircularIndeterminateIndicator.js.map +7 -0
  7. package/dist/cjs/v2/constants.js +65 -0
  8. package/dist/cjs/v2/constants.js.map +7 -0
  9. package/dist/cjs/v2/index.js +36 -0
  10. package/dist/cjs/v2/index.js.map +7 -0
  11. package/dist/cjs/v2/react-desc-prop-types.js +83 -0
  12. package/dist/cjs/v2/react-desc-prop-types.js.map +7 -0
  13. package/dist/cjs/v2/styled.js +137 -0
  14. package/dist/cjs/v2/styled.js.map +7 -0
  15. package/dist/esm/DSCircularProgressIndicator.js +217 -0
  16. package/dist/esm/DSCircularProgressIndicator.js.map +7 -0
  17. package/dist/esm/index.js +15 -0
  18. package/dist/esm/index.js.map +7 -0
  19. package/dist/esm/v2/DSCircularIndeterminateIndicator.js +97 -0
  20. package/dist/esm/v2/DSCircularIndeterminateIndicator.js.map +7 -0
  21. package/dist/esm/v2/constants.js +36 -0
  22. package/dist/esm/v2/constants.js.map +7 -0
  23. package/dist/esm/v2/index.js +10 -0
  24. package/dist/esm/v2/index.js.map +7 -0
  25. package/dist/esm/v2/react-desc-prop-types.js +56 -0
  26. package/dist/esm/v2/react-desc-prop-types.js.map +7 -0
  27. package/dist/esm/v2/styled.js +108 -0
  28. package/dist/esm/v2/styled.js.map +7 -0
  29. package/package.json +38 -41
  30. package/cjs/DSCircularProgressIndicator.js +0 -268
  31. package/cjs/index.js +0 -14
  32. package/cjs/v2/DSCircularIndeterminateIndicator.js +0 -113
  33. package/cjs/v2/constants.js +0 -37
  34. package/cjs/v2/index.js +0 -10
  35. package/cjs/v2/react-desc-prop-types.js +0 -39
  36. package/cjs/v2/styled.js +0 -51
  37. package/esm/DSCircularProgressIndicator.js +0 -258
  38. package/esm/index.js +0 -2
  39. package/esm/v2/DSCircularIndeterminateIndicator.js +0 -103
  40. package/esm/v2/constants.js +0 -30
  41. package/esm/v2/index.js +0 -1
  42. package/esm/v2/react-desc-prop-types.js +0 -30
  43. package/esm/v2/styled.js +0 -39
  44. package/types/DSCircularProgressIndicator.d.ts +0 -42
  45. package/types/index.d.ts +0 -2
  46. package/types/tests/DSCircularProgressIndicator.test.d.ts +0 -1
  47. package/types/v2/DSCircularIndeterminateIndicator.d.ts +0 -4
  48. package/types/v2/constants.d.ts +0 -28
  49. package/types/v2/index.d.ts +0 -1
  50. package/types/v2/react-desc-prop-types.d.ts +0 -14
  51. package/types/v2/styled.d.ts +0 -12
@@ -1,113 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- require('core-js/modules/esnext.async-iterator.filter.js');
6
- require('core-js/modules/esnext.iterator.constructor.js');
7
- require('core-js/modules/esnext.iterator.filter.js');
8
- require('core-js/modules/esnext.async-iterator.for-each.js');
9
- require('core-js/modules/esnext.iterator.for-each.js');
10
- var _defineProperty = require('@babel/runtime/helpers/defineProperty');
11
- var _jsx = require('@babel/runtime/helpers/jsx');
12
- var react = require('react');
13
- var dsGrid = require('@elliemae/ds-grid');
14
- var DSTooltip = require('@elliemae/ds-tooltip');
15
- var dsPropsHelpers = require('@elliemae/ds-props-helpers');
16
- var uid = require('uid');
17
- var reactDescPropTypes = require('./react-desc-prop-types.js');
18
- var constants = require('./constants.js');
19
- var styled = require('./styled.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 _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
25
- var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
26
-
27
- 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; }
28
-
29
- 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; }
30
- const DSCircularIndeterminateIndicator = props => {
31
- const propsWithDefault = dsPropsHelpers.useMemoMergePropsWithDefault(props, reactDescPropTypes.defaultProps);
32
- const globalAttributes = dsPropsHelpers.useGetGlobalAttributes(propsWithDefault);
33
- const {
34
- size,
35
- color,
36
- text,
37
- showText,
38
- withTooltip,
39
- tooltipStartPlacementPreference,
40
- __duration
41
- } = propsWithDefault;
42
- const Wrapper = react.useMemo(() => withTooltip ? DSTooltip.DSTooltipV3 : _ref => {
43
- let {
44
- children
45
- } = _ref;
46
- return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
47
- children: children
48
- });
49
- }, [withTooltip]);
50
- const uniqueId = react.useMemo(() => uid.uid(16), []);
51
- const circleRadius = react.useMemo(() => (constants.sizeToPx[size] - Number.parseInt(constants.sizeToWeight[size], 10)) / 2, [size]);
52
- return /*#__PURE__*/jsxRuntime.jsx(dsGrid.Grid, _objectSpread(_objectSpread({
53
- gutter: "xs",
54
- justifyContent: "center",
55
- role: "status"
56
- }, globalAttributes), {}, {
57
- children: /*#__PURE__*/_jsx__default["default"](Wrapper, {
58
- text: text,
59
- textAlign: "center",
60
- startPlacementPreference: tooltipStartPlacementPreference
61
- }, void 0, /*#__PURE__*/_jsx__default["default"](styled.StyledSvg, {
62
- width: constants.sizeToPx[size],
63
- height: constants.sizeToPx[size]
64
- }, void 0, /*#__PURE__*/_jsx__default["default"]("defs", {}, void 0, /*#__PURE__*/_jsx__default["default"]("clipPath", {
65
- id: "not-gradient-clip-".concat(uniqueId)
66
- }, void 0, /*#__PURE__*/_jsx__default["default"](styled.StyledRect, {
67
- x: "0%",
68
- y: "0%",
69
- width: "52%",
70
- height: "100%",
71
- __duration: __duration
72
- })), /*#__PURE__*/_jsx__default["default"]("linearGradient", {
73
- id: "gradient-color-".concat(uniqueId),
74
- x1: "0%",
75
- x2: "0%",
76
- y1: "0%",
77
- y2: "100%"
78
- }, void 0, /*#__PURE__*/_jsx__default["default"]("stop", {
79
- offset: "10%",
80
- stopColor: "".concat(constants.colorToHex[color], "00")
81
- }), /*#__PURE__*/_jsx__default["default"]("stop", {
82
- offset: "90%",
83
- stopColor: "".concat(constants.colorToHex[color], "FF")
84
- }))), /*#__PURE__*/_jsx__default["default"](styled.StyledCircle, {
85
- cx: "50%",
86
- cy: "50%",
87
- r: circleRadius,
88
- strokeWidth: constants.sizeToWeight[size],
89
- stroke: constants.colorToHex[color],
90
- strokeLinecap: "round",
91
- clipPath: "url(#not-gradient-clip-".concat(uniqueId, ")"),
92
- __duration: __duration
93
- }), /*#__PURE__*/_jsx__default["default"](styled.StyledPath, {
94
- d: "M ".concat(constants.sizeToPx[size] / 2, " ").concat(constants.sizeToPx[size] / 2, "\n m ").concat(circleRadius, ", 0\n a ").concat(circleRadius, ", ").concat(circleRadius, " 0 0, 1 -").concat(circleRadius, ", ").concat(circleRadius),
95
- strokeWidth: constants.sizeToWeight[size],
96
- fill: "transparent",
97
- stroke: "url(#gradient-color-".concat(uniqueId, ")"),
98
- strokeLinecap: "round",
99
- r: circleRadius,
100
- __duration: __duration
101
- })), text !== '' && showText && /*#__PURE__*/_jsx__default["default"]("span", {
102
- style: {
103
- color: color === 'light' ? '#FFFFFF' : '#25292F99',
104
- fontSize: constants.sizeToTextSize[size]
105
- }
106
- }, void 0, text))
107
- }));
108
- };
109
- const DSCircularIndeterminateIndicatorWithSchema = dsPropsHelpers.describe(DSCircularIndeterminateIndicator);
110
- DSCircularIndeterminateIndicatorWithSchema.propTypes = reactDescPropTypes.CircularIndeterminateIndicatorPropTypes;
111
-
112
- exports.DSCircularIndeterminateIndicator = DSCircularIndeterminateIndicator;
113
- exports.DSCircularIndeterminateIndicatorWithSchema = DSCircularIndeterminateIndicatorWithSchema;
@@ -1,37 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const sizeToPx = {
6
- xs: 16,
7
- s: 24,
8
- m: 32,
9
- l: 48,
10
- xl: 56,
11
- xxl: 64
12
- };
13
- const sizeToWeight = {
14
- xs: '3px',
15
- s: '3px',
16
- m: '3px',
17
- l: '4px',
18
- xl: '5px',
19
- xxl: '6px'
20
- };
21
- const colorToHex = {
22
- light: '#EBF6FF',
23
- dark: '#1394E5'
24
- };
25
- const sizeToTextSize = {
26
- xs: '12px',
27
- s: '12px',
28
- m: '12px',
29
- l: '13px',
30
- xl: '14px',
31
- xxl: '16px'
32
- };
33
-
34
- exports.colorToHex = colorToHex;
35
- exports.sizeToPx = sizeToPx;
36
- exports.sizeToTextSize = sizeToTextSize;
37
- exports.sizeToWeight = sizeToWeight;
package/cjs/v2/index.js DELETED
@@ -1,10 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var DSCircularIndeterminateIndicator = require('./DSCircularIndeterminateIndicator.js');
6
-
7
-
8
-
9
- exports.DSCircularIndeterminateIndicator = DSCircularIndeterminateIndicator.DSCircularIndeterminateIndicator;
10
- exports.DSCircularIndeterminateIndicatorWithSchema = DSCircularIndeterminateIndicator.DSCircularIndeterminateIndicatorWithSchema;
@@ -1,39 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- require('core-js/modules/esnext.async-iterator.filter.js');
6
- require('core-js/modules/esnext.iterator.constructor.js');
7
- require('core-js/modules/esnext.iterator.filter.js');
8
- require('core-js/modules/esnext.async-iterator.for-each.js');
9
- require('core-js/modules/esnext.iterator.for-each.js');
10
- var _defineProperty = require('@babel/runtime/helpers/defineProperty');
11
- var dsPropsHelpers = require('@elliemae/ds-props-helpers');
12
-
13
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
14
-
15
- var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
16
-
17
- 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; }
18
-
19
- 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; }
20
- const CircularIndeterminateIndicatorPropTypes = _objectSpread(_objectSpread({}, dsPropsHelpers.globalAttributesPropTypes), {}, {
21
- size: dsPropsHelpers.PropTypes.oneOf(['xs', 's', 'm', 'l', 'xl', 'xxl']).description('Size of the indicator').defaultValue('m'),
22
- color: dsPropsHelpers.PropTypes.oneOf(['light', 'dark']).description('Color mode for the indicator').defaultValue('dark'),
23
- text: dsPropsHelpers.PropTypes.string.description('Optional text to show under the indicator').defaultValue(''),
24
- showText: dsPropsHelpers.PropTypes.bool.description('Whether to show the optional text or not').defaultValue(true),
25
- withTooltip: dsPropsHelpers.PropTypes.bool.description('Whether to include a tooltip that shows the optional text on hover').defaultValue(false),
26
- tooltipStartPlacementPreference: dsPropsHelpers.PropTypes.oneOf(['top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start']).description('start placement preference for the tooltip').defaultValue('center')
27
- });
28
- const defaultProps = {
29
- size: 'm',
30
- color: 'dark',
31
- text: '',
32
- showText: true,
33
- withTooltip: false,
34
- tooltipStartPlacementPreference: 'bottom',
35
- __duration: 4
36
- };
37
-
38
- exports.CircularIndeterminateIndicatorPropTypes = CircularIndeterminateIndicatorPropTypes;
39
- exports.defaultProps = defaultProps;
package/cjs/v2/styled.js DELETED
@@ -1,51 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var _taggedTemplateLiteral = require('@babel/runtime/helpers/taggedTemplateLiteral');
6
- var styled = require('styled-components');
7
- var dsSystem = require('@elliemae/ds-system');
8
-
9
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
10
-
11
- var _taggedTemplateLiteral__default = /*#__PURE__*/_interopDefaultLegacy(_taggedTemplateLiteral);
12
- var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
13
-
14
- var _templateObject, _templateObject2, _templateObject3;
15
- const {
16
- PI
17
- } = Math;
18
-
19
- const getArcLength = (percentage, radius) => 2 * PI * radius / 100 * percentage;
20
-
21
- const strokeTailAnimation = r => {
22
- const miniDash = "".concat(getArcLength(0, r), " ").concat(getArcLength(100, r));
23
- const fullDash = "".concat(getArcLength(75, r), " ").concat(getArcLength(25, r));
24
- return dsSystem.kfrm(_templateObject || (_templateObject = _taggedTemplateLiteral__default["default"](["\n 0% {\n stroke-dasharray: ", ";\n }\n 50% {\n stroke-dasharray: ", ";\n }\n 100% {\n stroke-dasharray: ", ";\n }\n"])), miniDash, fullDash, miniDash);
25
- };
26
-
27
- const rotateAnimation = dsSystem.kfrm(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral__default["default"](["\n 0%, 12.5% {\n transform: rotate(0);\n }\n 25%, 37.5% {\n transform: rotate(270deg);\n }\n 50%, 62.5% {\n transform: rotate(540deg);\n }\n 75%, 87.5% {\n transform: rotate(810deg);\n }\n 100% {\n transform: rotate(1080deg);\n }\n"])));
28
-
29
- const dashAnimation = r => {
30
- const miniDash = "".concat(getArcLength(0, r), " ").concat(getArcLength(100, r));
31
- const fullDash = "".concat(getArcLength(75, r), " ").concat(getArcLength(25, r));
32
- return dsSystem.kfrm(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral__default["default"](["\n 0% {\n stroke-dasharray: ", ";\n stroke-dashoffset: 0;\n }\n 12.5% {\n stroke-dasharray: ", ";\n stroke-dashoffset: 0;\n }\n 25% {\n stroke-dasharray: ", ";\n stroke-dashoffset: ", ";\n }\n 37.5% {\n stroke-dasharray: ", ";\n stroke-dashoffset: ", ";\n }\n 50% {\n stroke-dasharray: ", ";\n stroke-dashoffset: ", ";\n }\n 62.5% {\n stroke-dasharray: ", ";\n stroke-dashoffset: ", ";\n }\n 75% {\n stroke-dasharray: ", ";\n stroke-dashoffset: ", ";\n }\n 87.5% {\n stroke-dasharray: ", ";\n stroke-dashoffset: ", ";\n }\n 100% {\n stroke-dasharray: ", ";\n stroke-dashoffset: ", ";\n }\n"])), miniDash, fullDash, miniDash, getArcLength(-75, r), fullDash, getArcLength(-75, r), miniDash, getArcLength(-150, r), fullDash, getArcLength(-150, r), miniDash, getArcLength(-225, r), fullDash, getArcLength(-225, r), miniDash, getArcLength(-300, r));
33
- };
34
-
35
- const StyledSvg = /*#__PURE__*/styled__default["default"].svg.withConfig({
36
- componentId: "sc-bvvh5i-0"
37
- })(["display:block;margin:auto;transform-origin:center center;transform:rotate(-90deg);"]);
38
- const StyledPath = /*#__PURE__*/styled__default["default"].path.withConfig({
39
- componentId: "sc-bvvh5i-1"
40
- })(["transform-origin:center center;animation:", " ", "s linear infinite,", " ", "s linear infinite;"], rotateAnimation, props => props.__duration, props => strokeTailAnimation(props.r), props => props.__duration / 4);
41
- const StyledRect = /*#__PURE__*/styled__default["default"].rect.withConfig({
42
- componentId: "sc-bvvh5i-2"
43
- })(["transform-origin:center center;animation:", " ", "s linear infinite;"], rotateAnimation, props => props.__duration);
44
- const StyledCircle = /*#__PURE__*/styled__default["default"].circle.withConfig({
45
- componentId: "sc-bvvh5i-3"
46
- })(["stroke-dashoffset:0;fill:none;animation:", " ", "s linear infinite;clip-path:", ";-webkit-clip-path:", ";"], props => dashAnimation(props.r), props => props.__duration, props => props.clipPath, props => props.clipPath);
47
-
48
- exports.StyledCircle = StyledCircle;
49
- exports.StyledPath = StyledPath;
50
- exports.StyledRect = StyledRect;
51
- exports.StyledSvg = StyledSvg;
@@ -1,258 +0,0 @@
1
- import _jsx from '@babel/runtime/helpers/esm/jsx';
2
- import 'react';
3
- import { PropTypes, describe } from 'react-desc';
4
- import { convertPropToCssClassName } from '@elliemae/ds-classnames';
5
- import DSTooltip from '@elliemae/ds-tooltip';
6
-
7
- var _path, _path2;
8
- const {
9
- classNameBlock,
10
- classNameElement
11
- } = convertPropToCssClassName('circular-progress-indicator');
12
-
13
- const CircularProgressIndicator = _ref => {
14
- let {
15
- size,
16
- showLabel,
17
- showTooltip,
18
- waiting,
19
- loading
20
- } = _ref;
21
- const waitingLabel = 'Waiting...';
22
- const loadingLabel = 'Loading...';
23
- const currentLabel = waiting && !loading ? waitingLabel : loadingLabel;
24
- let sizePx;
25
- let sizeLabel;
26
- let strokeWidth;
27
- let trackWidth;
28
- let markerHeight = '0.7';
29
- let markerRefY = '4.8';
30
- let grayArcStrokeDasharray = '45 170';
31
- let grayArcStrokeDashoffset = '127.5';
32
-
33
- switch (size.toUpperCase()) {
34
- case 'XS':
35
- sizePx = 8;
36
- sizeLabel = 12;
37
- strokeWidth = 10;
38
- trackWidth = 3;
39
- markerHeight = '1';
40
- grayArcStrokeDasharray = '46 174';
41
- grayArcStrokeDashoffset = '133';
42
- break;
43
-
44
- case 'S':
45
- sizePx = 16;
46
- sizeLabel = 12;
47
- strokeWidth = 8;
48
- trackWidth = 3;
49
- markerHeight = '1';
50
- grayArcStrokeDasharray = '46 174';
51
- grayArcStrokeDashoffset = '133';
52
- break;
53
-
54
- case 'M':
55
- sizePx = 24;
56
- sizeLabel = 12;
57
- strokeWidth = 7;
58
- trackWidth = 3;
59
- markerHeight = '1';
60
- markerRefY = '5.5';
61
- grayArcStrokeDasharray = '46 174';
62
- grayArcStrokeDashoffset = '133';
63
- break;
64
-
65
- case 'L':
66
- sizePx = 32;
67
- sizeLabel = 13;
68
- strokeWidth = 6;
69
- trackWidth = 3;
70
- markerRefY = '5';
71
- break;
72
-
73
- case 'XL':
74
- sizePx = 48;
75
- sizeLabel = 14;
76
- strokeWidth = 5;
77
- trackWidth = 1;
78
- break;
79
-
80
- case 'XXL':
81
- sizePx = 56;
82
- sizeLabel = 16;
83
- strokeWidth = 4;
84
- trackWidth = 1;
85
- break;
86
-
87
- case 'XXXL':
88
- sizePx = 64;
89
- sizeLabel = 16;
90
- strokeWidth = 5;
91
- trackWidth = 2;
92
- break;
93
- }
94
-
95
- const labelText = /*#__PURE__*/_jsx("p", {
96
- "data-testid": "circular-indicator-label",
97
- className: classNameElement('label'),
98
- style: {
99
- fontSize: "".concat(sizeLabel, "px")
100
- }
101
- }, void 0, currentLabel); // Only adds the tooltip if sizePx < 17 or showTooltip is true
102
-
103
-
104
- const buildIndicator = Component => sizePx < 17 || showTooltip ? /*#__PURE__*/_jsx(DSTooltip, {
105
- containerProps: {
106
- id: 'ds-circular-progress-indicator',
107
- 'data-testid': 'circular-indicator-title'
108
- },
109
- interactionType: "hover",
110
- title: currentLabel,
111
- triggerComponent: Component,
112
- placement: "bottom"
113
- }) : Component;
114
-
115
- const grayTrack = /*#__PURE__*/_jsx("circle", {
116
- className: classNameElement('track'),
117
- cx: "50%",
118
- cy: "50%",
119
- fill: "none",
120
- r: "28",
121
- strokeWidth: "".concat(trackWidth, "px")
122
- });
123
-
124
- const grayArc = /*#__PURE__*/_jsx("circle", {
125
- className: classNameElement('arc-gray'),
126
- stroke: "#E0E3E8",
127
- strokeDasharray: "".concat(grayArcStrokeDasharray),
128
- strokeDashoffset: "".concat(grayArcStrokeDashoffset),
129
- cx: "50%",
130
- cy: "50%",
131
- fill: "none",
132
- r: "28",
133
- strokeWidth: "".concat(trackWidth, "px")
134
- });
135
-
136
- const indicator = /*#__PURE__*/_jsx("svg", {
137
- height: "".concat(sizePx, "px"),
138
- version: "1.1",
139
- viewBox: "0 0 66 66",
140
- width: "".concat(sizePx, "px"),
141
- "data-testid": "circular-indicator"
142
- }, void 0, /*#__PURE__*/_jsx("defs", {}, void 0, /*#__PURE__*/_jsx("linearGradient", {
143
- id: "grad1",
144
- x1: "0%",
145
- x2: "100%",
146
- y1: "100%",
147
- y2: "0%"
148
- }, void 0, /*#__PURE__*/_jsx("stop", {
149
- offset: "0%",
150
- style: {
151
- stopColor: '#E0E3E8',
152
- stopOpacity: 1
153
- }
154
- }), /*#__PURE__*/_jsx("stop", {
155
- offset: "89%",
156
- style: {
157
- stopColor: '#5594e2',
158
- stopOpacity: 1
159
- }
160
- }), /*#__PURE__*/_jsx("stop", {
161
- offset: "100%",
162
- style: {
163
- stopColor: '#5594e2',
164
- stopOpacity: 1
165
- }
166
- })), /*#__PURE__*/_jsx("linearGradient", {
167
- id: "grad2",
168
- x1: "0%",
169
- x2: "100%",
170
- y1: "100%",
171
- y2: "0%"
172
- }, void 0, /*#__PURE__*/_jsx("stop", {
173
- offset: "0%",
174
- style: {
175
- stopColor: '#5594e2',
176
- stopOpacity: 1
177
- }
178
- }), /*#__PURE__*/_jsx("stop", {
179
- offset: "11%",
180
- style: {
181
- stopColor: '#5594e2',
182
- stopOpacity: 1
183
- }
184
- }), /*#__PURE__*/_jsx("stop", {
185
- offset: "100%",
186
- style: {
187
- stopColor: '#E0E3E8',
188
- stopOpacity: 1
189
- }
190
- })), /*#__PURE__*/_jsx("marker", {
191
- id: "inverseL",
192
- viewBox: "0 0 5 10",
193
- refX: "0.5",
194
- refY: "".concat(markerRefY),
195
- markerUnits: "strokeWidth",
196
- markerWidth: "0.5",
197
- markerHeight: "".concat(markerHeight),
198
- orient: "auto"
199
- }, void 0, _path || (_path = /*#__PURE__*/_jsx("path", {
200
- d: "M 0 0 L 6 0 A 5 5 0 0 0 6 10 L 0 10 z",
201
- fill: "#FFF"
202
- }))), /*#__PURE__*/_jsx("marker", {
203
- id: "inverseR",
204
- viewBox: "0 0 5 10",
205
- refX: "0",
206
- refY: "5",
207
- markerUnits: "strokeWidth",
208
- markerWidth: "0.7",
209
- markerHeight: "".concat(markerHeight)
210
- }, void 0, _path2 || (_path2 = /*#__PURE__*/_jsx("path", {
211
- d: "M 0 0 L 6 0 A 5 5 0 0 0 6 10 L 0 10 z",
212
- fill: "#FFF"
213
- })))), grayTrack, !waiting && /*#__PURE__*/_jsx("g", {
214
- fill: "none",
215
- fillRule: "evenodd",
216
- stroke: "none",
217
- strokeWidth: "1"
218
- }, void 0, /*#__PURE__*/_jsx("path", {
219
- className: classNameElement('arc-blue'),
220
- d: "M30,5 C17.536025,6 6,17.536027 5,31",
221
- stroke: "#5594e2",
222
- strokeWidth: "".concat(strokeWidth - 0.5, "px"),
223
- strokeLinecap: "round",
224
- "data-testid": "circular-indicator-blue-arc"
225
- }), /*#__PURE__*/_jsx("path", {
226
- className: classNameElement('arc-white'),
227
- d: "M33,5 C17.536027,5 5,17.536027 5,33",
228
- stroke: "#FFF",
229
- strokeWidth: "".concat(strokeWidth + 2, "px"),
230
- markerStart: "url(#inverseR)",
231
- markerEnd: "url(#inverseL)"
232
- }), grayArc));
233
-
234
- return /*#__PURE__*/_jsx("div", {
235
- className: classNameBlock('wrapper'),
236
- role: "status",
237
- "aria-hidden": waiting || loading ? 'false' : 'true'
238
- }, void 0, buildIndicator(indicator), showLabel && labelText);
239
- };
240
-
241
- CircularProgressIndicator.defaultProps = {
242
- size: 'm',
243
- showLabel: false,
244
- showTooltip: false,
245
- waiting: false,
246
- loading: false
247
- };
248
- const circularProgressIndicatorProps = {
249
- size: PropTypes.oneOf(['xs', 's', 'm', 'l', 'xl', 'xxl', 'xxxl']).description('Defines the size of the indicator').defaultValue('m'),
250
- showLabel: PropTypes.bool.description('Wheter the indicator displays its state on a label or not').defaultValue(false),
251
- showTooltip: PropTypes.bool.description('Wheter the indicator displays its state on a tooltip or not').defaultValue(false),
252
- waiting: PropTypes.bool.description('Defines the state of the indicator as Waiting and only displays the gray track').defaultValue(false),
253
- loading: PropTypes.bool.description('Defines the state of the indicator as Loading and displays a blue spinner animation').defaultValue(false)
254
- };
255
- const CircularProgressIndicatorWithSchema = describe(CircularProgressIndicator);
256
- CircularProgressIndicatorWithSchema.propTypes = circularProgressIndicatorProps;
257
-
258
- export { CircularProgressIndicatorWithSchema, CircularProgressIndicator as default };
package/esm/index.js DELETED
@@ -1,2 +0,0 @@
1
- export { CircularProgressIndicatorWithSchema, default as DSCircularProgressIndicator, default } from './DSCircularProgressIndicator.js';
2
- export { DSCircularIndeterminateIndicator, DSCircularIndeterminateIndicatorWithSchema } from './v2/DSCircularIndeterminateIndicator.js';
@@ -1,103 +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 _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
7
- import _jsx from '@babel/runtime/helpers/esm/jsx';
8
- import { useMemo } from 'react';
9
- import { Grid } from '@elliemae/ds-grid';
10
- import { DSTooltipV3 } from '@elliemae/ds-tooltip';
11
- import { describe, useMemoMergePropsWithDefault, useGetGlobalAttributes } from '@elliemae/ds-props-helpers';
12
- import { uid } from 'uid';
13
- import { CircularIndeterminateIndicatorPropTypes, defaultProps } from './react-desc-prop-types.js';
14
- import { sizeToPx, sizeToWeight, colorToHex, sizeToTextSize } from './constants.js';
15
- import { StyledSvg, StyledRect, StyledCircle, StyledPath } from './styled.js';
16
- import { jsx, Fragment } 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
- const DSCircularIndeterminateIndicator = props => {
22
- const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);
23
- const globalAttributes = useGetGlobalAttributes(propsWithDefault);
24
- const {
25
- size,
26
- color,
27
- text,
28
- showText,
29
- withTooltip,
30
- tooltipStartPlacementPreference,
31
- __duration
32
- } = propsWithDefault;
33
- const Wrapper = useMemo(() => withTooltip ? DSTooltipV3 : _ref => {
34
- let {
35
- children
36
- } = _ref;
37
- return /*#__PURE__*/jsx(Fragment, {
38
- children: children
39
- });
40
- }, [withTooltip]);
41
- const uniqueId = useMemo(() => uid(16), []);
42
- const circleRadius = useMemo(() => (sizeToPx[size] - Number.parseInt(sizeToWeight[size], 10)) / 2, [size]);
43
- return /*#__PURE__*/jsx(Grid, _objectSpread(_objectSpread({
44
- gutter: "xs",
45
- justifyContent: "center",
46
- role: "status"
47
- }, globalAttributes), {}, {
48
- children: /*#__PURE__*/_jsx(Wrapper, {
49
- text: text,
50
- textAlign: "center",
51
- startPlacementPreference: tooltipStartPlacementPreference
52
- }, void 0, /*#__PURE__*/_jsx(StyledSvg, {
53
- width: sizeToPx[size],
54
- height: sizeToPx[size]
55
- }, void 0, /*#__PURE__*/_jsx("defs", {}, void 0, /*#__PURE__*/_jsx("clipPath", {
56
- id: "not-gradient-clip-".concat(uniqueId)
57
- }, void 0, /*#__PURE__*/_jsx(StyledRect, {
58
- x: "0%",
59
- y: "0%",
60
- width: "52%",
61
- height: "100%",
62
- __duration: __duration
63
- })), /*#__PURE__*/_jsx("linearGradient", {
64
- id: "gradient-color-".concat(uniqueId),
65
- x1: "0%",
66
- x2: "0%",
67
- y1: "0%",
68
- y2: "100%"
69
- }, void 0, /*#__PURE__*/_jsx("stop", {
70
- offset: "10%",
71
- stopColor: "".concat(colorToHex[color], "00")
72
- }), /*#__PURE__*/_jsx("stop", {
73
- offset: "90%",
74
- stopColor: "".concat(colorToHex[color], "FF")
75
- }))), /*#__PURE__*/_jsx(StyledCircle, {
76
- cx: "50%",
77
- cy: "50%",
78
- r: circleRadius,
79
- strokeWidth: sizeToWeight[size],
80
- stroke: colorToHex[color],
81
- strokeLinecap: "round",
82
- clipPath: "url(#not-gradient-clip-".concat(uniqueId, ")"),
83
- __duration: __duration
84
- }), /*#__PURE__*/_jsx(StyledPath, {
85
- d: "M ".concat(sizeToPx[size] / 2, " ").concat(sizeToPx[size] / 2, "\n m ").concat(circleRadius, ", 0\n a ").concat(circleRadius, ", ").concat(circleRadius, " 0 0, 1 -").concat(circleRadius, ", ").concat(circleRadius),
86
- strokeWidth: sizeToWeight[size],
87
- fill: "transparent",
88
- stroke: "url(#gradient-color-".concat(uniqueId, ")"),
89
- strokeLinecap: "round",
90
- r: circleRadius,
91
- __duration: __duration
92
- })), text !== '' && showText && /*#__PURE__*/_jsx("span", {
93
- style: {
94
- color: color === 'light' ? '#FFFFFF' : '#25292F99',
95
- fontSize: sizeToTextSize[size]
96
- }
97
- }, void 0, text))
98
- }));
99
- };
100
- const DSCircularIndeterminateIndicatorWithSchema = describe(DSCircularIndeterminateIndicator);
101
- DSCircularIndeterminateIndicatorWithSchema.propTypes = CircularIndeterminateIndicatorPropTypes;
102
-
103
- export { DSCircularIndeterminateIndicator, DSCircularIndeterminateIndicatorWithSchema };
@@ -1,30 +0,0 @@
1
- const sizeToPx = {
2
- xs: 16,
3
- s: 24,
4
- m: 32,
5
- l: 48,
6
- xl: 56,
7
- xxl: 64
8
- };
9
- const sizeToWeight = {
10
- xs: '3px',
11
- s: '3px',
12
- m: '3px',
13
- l: '4px',
14
- xl: '5px',
15
- xxl: '6px'
16
- };
17
- const colorToHex = {
18
- light: '#EBF6FF',
19
- dark: '#1394E5'
20
- };
21
- const sizeToTextSize = {
22
- xs: '12px',
23
- s: '12px',
24
- m: '12px',
25
- l: '13px',
26
- xl: '14px',
27
- xxl: '16px'
28
- };
29
-
30
- export { colorToHex, sizeToPx, sizeToTextSize, sizeToWeight };
package/esm/v2/index.js DELETED
@@ -1 +0,0 @@
1
- export { DSCircularIndeterminateIndicator, DSCircularIndeterminateIndicatorWithSchema } from './DSCircularIndeterminateIndicator.js';