@elliemae/ds-circular-progress-indicator 2.3.0-alpha.8 → 2.3.0-next.10

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 (43) hide show
  1. package/cjs/DSCircularProgressIndicator.js +268 -0
  2. package/cjs/index.js +14 -0
  3. package/cjs/v2/DSCircularIndeterminateIndicator.js +113 -0
  4. package/cjs/v2/constants.js +37 -0
  5. package/cjs/v2/index.js +10 -0
  6. package/cjs/v2/react-desc-prop-types.js +39 -0
  7. package/cjs/v2/styled.js +51 -0
  8. package/esm/DSCircularProgressIndicator.js +258 -0
  9. package/esm/index.js +2 -0
  10. package/esm/v2/DSCircularIndeterminateIndicator.js +103 -0
  11. package/esm/v2/constants.js +30 -0
  12. package/esm/v2/index.js +1 -0
  13. package/esm/v2/react-desc-prop-types.js +30 -0
  14. package/esm/v2/styled.js +39 -0
  15. package/package.json +35 -29
  16. package/types/DSCircularProgressIndicator.d.ts +42 -0
  17. package/types/index.d.ts +2 -0
  18. package/types/tests/DSCircularProgressIndicator.test.d.ts +1 -0
  19. package/types/v2/DSCircularIndeterminateIndicator.d.ts +4 -0
  20. package/types/v2/constants.d.ts +28 -0
  21. package/types/v2/index.d.ts +1 -0
  22. package/types/v2/react-desc-prop-types.d.ts +14 -0
  23. package/types/v2/styled.d.ts +12 -0
  24. package/dist/cjs/DSCircularProgressIndicator.js +0 -246
  25. package/dist/cjs/DSCircularProgressIndicator.js.map +0 -7
  26. package/dist/cjs/index.js +0 -40
  27. package/dist/cjs/index.js.map +0 -7
  28. package/dist/cjs/v2/DSCircularIndeterminateIndicator.js +0 -149
  29. package/dist/cjs/v2/DSCircularIndeterminateIndicator.js.map +0 -7
  30. package/dist/cjs/v2/index.js +0 -36
  31. package/dist/cjs/v2/index.js.map +0 -7
  32. package/dist/cjs/v2/react-desc-prop-types.js +0 -56
  33. package/dist/cjs/v2/react-desc-prop-types.js.map +0 -7
  34. package/dist/esm/DSCircularProgressIndicator.js +0 -217
  35. package/dist/esm/DSCircularProgressIndicator.js.map +0 -7
  36. package/dist/esm/index.js +0 -15
  37. package/dist/esm/index.js.map +0 -7
  38. package/dist/esm/v2/DSCircularIndeterminateIndicator.js +0 -120
  39. package/dist/esm/v2/DSCircularIndeterminateIndicator.js.map +0 -7
  40. package/dist/esm/v2/index.js +0 -10
  41. package/dist/esm/v2/index.js.map +0 -7
  42. package/dist/esm/v2/react-desc-prop-types.js +0 -27
  43. package/dist/esm/v2/react-desc-prop-types.js.map +0 -7
@@ -0,0 +1,258 @@
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 ADDED
@@ -0,0 +1,2 @@
1
+ export { CircularProgressIndicatorWithSchema, default as DSCircularProgressIndicator, default } from './DSCircularProgressIndicator.js';
2
+ export { DSCircularIndeterminateIndicator, DSCircularIndeterminateIndicatorWithSchema } from './v2/DSCircularIndeterminateIndicator.js';
@@ -0,0 +1,103 @@
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 };
@@ -0,0 +1,30 @@
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 };
@@ -0,0 +1 @@
1
+ export { DSCircularIndeterminateIndicator, DSCircularIndeterminateIndicatorWithSchema } from './DSCircularIndeterminateIndicator.js';
@@ -0,0 +1,30 @@
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 { PropTypes, globalAttributesPropTypes } from '@elliemae/ds-props-helpers';
8
+
9
+ 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; }
10
+
11
+ 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; }
12
+ const CircularIndeterminateIndicatorPropTypes = _objectSpread(_objectSpread({}, globalAttributesPropTypes), {}, {
13
+ size: PropTypes.oneOf(['xs', 's', 'm', 'l', 'xl', 'xxl']).description('Size of the indicator').defaultValue('m'),
14
+ color: PropTypes.oneOf(['light', 'dark']).description('Color mode for the indicator').defaultValue('dark'),
15
+ text: PropTypes.string.description('Optional text to show under the indicator').defaultValue(''),
16
+ showText: PropTypes.bool.description('Whether to show the optional text or not').defaultValue(true),
17
+ withTooltip: PropTypes.bool.description('Whether to include a tooltip that shows the optional text on hover').defaultValue(false),
18
+ tooltipStartPlacementPreference: 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')
19
+ });
20
+ const defaultProps = {
21
+ size: 'm',
22
+ color: 'dark',
23
+ text: '',
24
+ showText: true,
25
+ withTooltip: false,
26
+ tooltipStartPlacementPreference: 'bottom',
27
+ __duration: 4
28
+ };
29
+
30
+ export { CircularIndeterminateIndicatorPropTypes, defaultProps };
@@ -0,0 +1,39 @@
1
+ import _taggedTemplateLiteral from '@babel/runtime/helpers/esm/taggedTemplateLiteral';
2
+ import styled from 'styled-components';
3
+ import { kfrm } from '@elliemae/ds-system';
4
+
5
+ var _templateObject, _templateObject2, _templateObject3;
6
+ const {
7
+ PI
8
+ } = Math;
9
+
10
+ const getArcLength = (percentage, radius) => 2 * PI * radius / 100 * percentage;
11
+
12
+ const strokeTailAnimation = r => {
13
+ const miniDash = "".concat(getArcLength(0, r), " ").concat(getArcLength(100, r));
14
+ const fullDash = "".concat(getArcLength(75, r), " ").concat(getArcLength(25, r));
15
+ return kfrm(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n 0% {\n stroke-dasharray: ", ";\n }\n 50% {\n stroke-dasharray: ", ";\n }\n 100% {\n stroke-dasharray: ", ";\n }\n"])), miniDash, fullDash, miniDash);
16
+ };
17
+
18
+ const rotateAnimation = kfrm(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\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"])));
19
+
20
+ const dashAnimation = r => {
21
+ const miniDash = "".concat(getArcLength(0, r), " ").concat(getArcLength(100, r));
22
+ const fullDash = "".concat(getArcLength(75, r), " ").concat(getArcLength(25, r));
23
+ return kfrm(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\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));
24
+ };
25
+
26
+ const StyledSvg = /*#__PURE__*/styled.svg.withConfig({
27
+ componentId: "sc-bvvh5i-0"
28
+ })(["display:block;margin:auto;transform-origin:center center;transform:rotate(-90deg);"]);
29
+ const StyledPath = /*#__PURE__*/styled.path.withConfig({
30
+ componentId: "sc-bvvh5i-1"
31
+ })(["transform-origin:center center;animation:", " ", "s linear infinite,", " ", "s linear infinite;"], rotateAnimation, props => props.__duration, props => strokeTailAnimation(props.r), props => props.__duration / 4);
32
+ const StyledRect = /*#__PURE__*/styled.rect.withConfig({
33
+ componentId: "sc-bvvh5i-2"
34
+ })(["transform-origin:center center;animation:", " ", "s linear infinite;"], rotateAnimation, props => props.__duration);
35
+ const StyledCircle = /*#__PURE__*/styled.circle.withConfig({
36
+ componentId: "sc-bvvh5i-3"
37
+ })(["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);
38
+
39
+ export { StyledCircle, StyledPath, StyledRect, StyledSvg };
package/package.json CHANGED
@@ -1,34 +1,39 @@
1
1
  {
2
2
  "name": "@elliemae/ds-circular-progress-indicator",
3
- "version": "2.3.0-alpha.8",
3
+ "version": "2.3.0-next.10",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Circular progress indicator",
6
- "files": [
7
- "dist"
8
- ],
9
- "module": "./dist/esm/index.js",
10
- "main": "./dist/cjs/index.js",
11
- "types": "./dist/types/index.d.ts",
6
+ "module": "./esm/index.js",
7
+ "main": "./cjs/index.js",
8
+ "types": "./types/index.d.ts",
12
9
  "exports": {
13
10
  ".": {
14
- "import": "./dist/esm/index.js",
15
- "require": "./dist/cjs/index.js"
11
+ "import": "./esm/index.js",
12
+ "require": "./cjs/index.js"
13
+ },
14
+ "./v2/styled": {
15
+ "import": "./esm/v2/styled.js",
16
+ "require": "./cjs/v2/styled.js"
16
17
  },
17
18
  "./v2/react-desc-prop-types": {
18
- "import": "./dist/esm/v2/react-desc-prop-types.js",
19
- "require": "./dist/cjs/v2/react-desc-prop-types.js"
19
+ "import": "./esm/v2/react-desc-prop-types.js",
20
+ "require": "./cjs/v2/react-desc-prop-types.js"
20
21
  },
21
22
  "./v2": {
22
- "import": "./dist/esm/v2/index.js",
23
- "require": "./dist/cjs/v2/index.js"
23
+ "import": "./esm/v2/index.js",
24
+ "require": "./cjs/v2/index.js"
24
25
  },
25
26
  "./v2/DSCircularIndeterminateIndicator": {
26
- "import": "./dist/esm/v2/DSCircularIndeterminateIndicator.js",
27
- "require": "./dist/cjs/v2/DSCircularIndeterminateIndicator.js"
27
+ "import": "./esm/v2/DSCircularIndeterminateIndicator.js",
28
+ "require": "./cjs/v2/DSCircularIndeterminateIndicator.js"
29
+ },
30
+ "./v2/constants": {
31
+ "import": "./esm/v2/constants.js",
32
+ "require": "./cjs/v2/constants.js"
28
33
  },
29
34
  "./DSCircularProgressIndicator": {
30
- "import": "./dist/esm/DSCircularProgressIndicator.js",
31
- "require": "./dist/cjs/DSCircularProgressIndicator.js"
35
+ "import": "./esm/DSCircularProgressIndicator.js",
36
+ "require": "./cjs/DSCircularProgressIndicator.js"
32
37
  }
33
38
  },
34
39
  "sideEffects": [
@@ -40,17 +45,23 @@
40
45
  "url": "https://git.elliemae.io/platform-ui/dimsum.git"
41
46
  },
42
47
  "engines": {
43
- "pnpm": ">=6",
44
- "node": ">=16"
48
+ "npm": ">=7",
49
+ "node": ">=14"
45
50
  },
46
51
  "author": "ICE MT",
52
+ "scripts": {
53
+ "dev": "cross-env NODE_ENV=development && node ../../scripts/build/build.js -w",
54
+ "prebuild": "exit 0",
55
+ "predev": "exit 0",
56
+ "build": "node ../../scripts/build/build.js"
57
+ },
47
58
  "dependencies": {
48
- "@elliemae/ds-classnames": "2.3.0-alpha.8",
49
- "@elliemae/ds-tooltip": "2.3.0-alpha.8",
59
+ "@elliemae/ds-classnames": "2.3.0-next.10",
60
+ "@elliemae/ds-tooltip": "2.3.0-next.10",
50
61
  "react-desc": "~4.1.3"
51
62
  },
52
63
  "devDependencies": {
53
- "@testing-library/jest-dom": "~5.15.1",
64
+ "@testing-library/jest-dom": "~5.15.0",
54
65
  "@testing-library/react": "~12.1.2"
55
66
  },
56
67
  "peerDependencies": {
@@ -59,12 +70,7 @@
59
70
  },
60
71
  "publishConfig": {
61
72
  "access": "public",
62
- "typeSafety": false
63
- },
64
- "scripts": {
65
- "dev": "cross-env NODE_ENV=development && node ../../scripts/build/build.js -w",
66
- "prebuild": "exit 0",
67
- "predev": "exit 0",
68
- "build": "node ../../scripts/build/build.js"
73
+ "directory": "dist",
74
+ "generateSubmodules": true
69
75
  }
70
76
  }
@@ -0,0 +1,42 @@
1
+ /// <reference path="../../../../shared/typings/react-desc.d.ts" />
2
+ /// <reference types="react" />
3
+ declare const CircularProgressIndicator: {
4
+ ({ size, showLabel, showTooltip, waiting, loading }: {
5
+ size: any;
6
+ showLabel: any;
7
+ showTooltip: any;
8
+ waiting: any;
9
+ loading: any;
10
+ }): JSX.Element;
11
+ defaultProps: {
12
+ size: string;
13
+ showLabel: boolean;
14
+ showTooltip: boolean;
15
+ waiting: boolean;
16
+ loading: boolean;
17
+ };
18
+ propTypes: {
19
+ size: {
20
+ deprecated: import("react-desc").PropTypesDescValidator;
21
+ };
22
+ showLabel: {
23
+ deprecated: import("react-desc").PropTypesDescValidator;
24
+ };
25
+ showTooltip: {
26
+ deprecated: import("react-desc").PropTypesDescValidator;
27
+ };
28
+ waiting: {
29
+ deprecated: import("react-desc").PropTypesDescValidator;
30
+ };
31
+ loading: {
32
+ deprecated: import("react-desc").PropTypesDescValidator;
33
+ };
34
+ };
35
+ };
36
+ declare const CircularProgressIndicatorWithSchema: {
37
+ (props?: unknown): JSX.Element;
38
+ propTypes: unknown;
39
+ toTypescript: () => import("react-desc").TypescriptSchema;
40
+ };
41
+ export { CircularProgressIndicatorWithSchema };
42
+ export default CircularProgressIndicator;
@@ -0,0 +1,2 @@
1
+ export { default, default as DSCircularProgressIndicator, CircularProgressIndicatorWithSchema, } from './DSCircularProgressIndicator';
2
+ export * from './v2';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { DSCircularIndeterminateIndicatorT } from './react-desc-prop-types';
3
+ export declare const DSCircularIndeterminateIndicator: React.ComponentType<DSCircularIndeterminateIndicatorT.Props>;
4
+ export declare const DSCircularIndeterminateIndicatorWithSchema: import("@elliemae/ds-props-helpers/types/propTypes/types").DocumentedReactComponent<DSCircularIndeterminateIndicatorT.Props>;
@@ -0,0 +1,28 @@
1
+ export declare const sizeToPx: {
2
+ xs: number;
3
+ s: number;
4
+ m: number;
5
+ l: number;
6
+ xl: number;
7
+ xxl: number;
8
+ };
9
+ export declare const sizeToWeight: {
10
+ xs: string;
11
+ s: string;
12
+ m: string;
13
+ l: string;
14
+ xl: string;
15
+ xxl: string;
16
+ };
17
+ export declare const colorToHex: {
18
+ light: string;
19
+ dark: string;
20
+ };
21
+ export declare const sizeToTextSize: {
22
+ xs: string;
23
+ s: string;
24
+ m: string;
25
+ l: string;
26
+ xl: string;
27
+ xxl: string;
28
+ };
@@ -0,0 +1 @@
1
+ export * from './DSCircularIndeterminateIndicator';