@elliemae/ds-circular-progress-indicator 2.3.0-next.3 → 3.0.0-alpha.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.
Files changed (38) 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 +149 -0
  6. package/dist/cjs/v2/DSCircularIndeterminateIndicator.js.map +7 -0
  7. package/dist/cjs/v2/index.js +36 -0
  8. package/dist/cjs/v2/index.js.map +7 -0
  9. package/dist/cjs/v2/react-desc-prop-types.js +56 -0
  10. package/dist/cjs/v2/react-desc-prop-types.js.map +7 -0
  11. package/dist/esm/DSCircularProgressIndicator.js +217 -0
  12. package/dist/esm/DSCircularProgressIndicator.js.map +7 -0
  13. package/dist/esm/index.js +15 -0
  14. package/dist/esm/index.js.map +7 -0
  15. package/dist/esm/v2/DSCircularIndeterminateIndicator.js +120 -0
  16. package/dist/esm/v2/DSCircularIndeterminateIndicator.js.map +7 -0
  17. package/dist/esm/v2/index.js +10 -0
  18. package/dist/esm/v2/index.js.map +7 -0
  19. package/dist/esm/v2/react-desc-prop-types.js +27 -0
  20. package/dist/esm/v2/react-desc-prop-types.js.map +7 -0
  21. package/{types → dist/types}/DSCircularProgressIndicator.d.ts +0 -0
  22. package/{types → dist/types}/index.d.ts +1 -1
  23. package/{types → dist/types}/tests/DSCircularProgressIndicator.test.d.ts +0 -0
  24. package/{types → dist/types}/v2/DSCircularIndeterminateIndicator.d.ts +0 -0
  25. package/dist/types/v2/index.d.ts +1 -0
  26. package/{types → dist/types}/v2/react-desc-prop-types.d.ts +0 -0
  27. package/package.json +34 -26
  28. package/cjs/DSCircularProgressIndicator.js +0 -268
  29. package/cjs/index.js +0 -14
  30. package/cjs/v2/DSCircularIndeterminateIndicator.js +0 -134
  31. package/cjs/v2/index.js +0 -10
  32. package/cjs/v2/react-desc-prop-types.js +0 -17
  33. package/esm/DSCircularProgressIndicator.js +0 -258
  34. package/esm/index.js +0 -2
  35. package/esm/v2/DSCircularIndeterminateIndicator.js +0 -123
  36. package/esm/v2/index.js +0 -1
  37. package/esm/v2/react-desc-prop-types.js +0 -13
  38. package/types/v2/index.d.ts +0 -1
@@ -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,123 +0,0 @@
1
- import _jsx from '@babel/runtime/helpers/esm/jsx';
2
- import _taggedTemplateLiteral from '@babel/runtime/helpers/esm/taggedTemplateLiteral';
3
- import 'react';
4
- import { Grid } from '@elliemae/ds-grid';
5
- import { DSTooltipV3 } from '@elliemae/ds-tooltip';
6
- import { describe } from 'react-desc';
7
- import styled from 'styled-components';
8
- import { kfrm } from '@elliemae/ds-system';
9
- import { uid } from 'uid';
10
- import { CircularIndeterminateIndicatorPropTypes } from './react-desc-prop-types.js';
11
- import { jsx, Fragment } from 'react/jsx-runtime';
12
-
13
- var _templateObject, _templateObject2, _circle;
14
- const r = kfrm(_templateObject || (_templateObject = _taggedTemplateLiteral(["to { transform: rotate(2turn) }"])));
15
- const s = kfrm(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["0%, 39% { stroke-dasharray: 942px 2826px }"])));
16
- const StyledSvg = /*#__PURE__*/styled.svg.withConfig({
17
- componentId: "sc-3syz25-0"
18
- })(["#gg{transform:rotate(45deg);stroke:url(#", ");mask:url(#", ");}mask use{stroke:#fff;stroke-linecap:round;stroke-dasharray:942px 2826px;animation:", " ", "s cubic-bezier(0.5,-0.43,0.5,1.43) infinite,", " ", "s ease-in-out infinite alternate;}"], props => props.linearGradientUid, props => props.maskUid, r, props => props.duration, s, props => props.duration / 2);
19
- const sizeToPx = {
20
- xs: '16px',
21
- s: '24px',
22
- m: '32px',
23
- l: '48px',
24
- xl: '56px',
25
- xxl: '64px'
26
- };
27
- const sizeToWeight = {
28
- xs: '10%',
29
- s: '9%',
30
- m: '8%',
31
- l: '6%',
32
- xl: '5%',
33
- xxl: '4%'
34
- };
35
- const colorToHex = {
36
- light: '#FFFFFF',
37
- dark: '#0F364A'
38
- };
39
- const sizeToTextSize = {
40
- xs: '12px',
41
- s: '12px',
42
- m: '12px',
43
- l: '13px',
44
- xl: '14px',
45
- xxl: '16px'
46
- };
47
- const DSCircularIndeterminateIndicator = _ref => {
48
- let {
49
- size = 'm',
50
- color = 'dark',
51
- text = '',
52
- showText = true,
53
- withTooltip = false,
54
- tooltipStartPlacementPreference = 'bottom',
55
- __duration = 1.5
56
- } = _ref;
57
- const Wrapper = withTooltip ? DSTooltipV3 : _ref2 => {
58
- let {
59
- children
60
- } = _ref2;
61
- return /*#__PURE__*/jsx(Fragment, {
62
- children: children
63
- });
64
- };
65
- const linearGradientUid = uid(16);
66
- const maskUid = uid(16);
67
- const circleUid = uid(16);
68
- return /*#__PURE__*/_jsx(Grid, {
69
- gutter: "xs",
70
- justifyContent: "center",
71
- role: "status"
72
- }, void 0, /*#__PURE__*/_jsx(Wrapper, {
73
- text: text,
74
- textAlign: "center",
75
- startPlacementPreference: tooltipStartPlacementPreference
76
- }, void 0, /*#__PURE__*/_jsx(StyledSvg, {
77
- viewBox: "-1950 -975 3900 1950",
78
- fill: "none",
79
- stroke: "transparent",
80
- strokeWidth: sizeToWeight[size],
81
- width: sizeToPx[size],
82
- height: sizeToPx[size],
83
- style: {
84
- display: 'block',
85
- margin: 'auto'
86
- },
87
- linearGradientUid: linearGradientUid,
88
- maskUid: maskUid,
89
- duration: __duration
90
- }, void 0, /*#__PURE__*/_jsx("g", {
91
- transform: "scale(2.298)"
92
- }, void 0, /*#__PURE__*/_jsx("linearGradient", {
93
- id: linearGradientUid
94
- }, void 0, /*#__PURE__*/_jsx("stop", {
95
- stopColor: color === 'dark' ? '#48a3ff' : '#ccd6ff'
96
- }), /*#__PURE__*/_jsx("stop", {
97
- stopColor: color === 'dark' ? '#49d0ff' : '#ebf6ff',
98
- offset: "1"
99
- })), /*#__PURE__*/_jsx("mask", {
100
- id: maskUid
101
- }, void 0, _circle || (_circle = /*#__PURE__*/_jsx("circle", {
102
- r: "1200",
103
- fill: "#000"
104
- })), /*#__PURE__*/_jsx("use", {
105
- xlinkHref: "#".concat(circleUid)
106
- })), /*#__PURE__*/_jsx("circle", {
107
- id: circleUid,
108
- r: "600"
109
- }), /*#__PURE__*/_jsx("g", {
110
- id: "gg"
111
- }, void 0, /*#__PURE__*/_jsx("use", {
112
- xlinkHref: "#".concat(circleUid)
113
- })))), text !== '' && showText && /*#__PURE__*/_jsx("span", {
114
- style: {
115
- color: colorToHex[color],
116
- fontSize: sizeToTextSize[size]
117
- }
118
- }, void 0, text)));
119
- };
120
- const DSCircularIndeterminateIndicatorWithSchema = describe(DSCircularIndeterminateIndicator);
121
- DSCircularIndeterminateIndicatorWithSchema.propTypes = CircularIndeterminateIndicatorPropTypes;
122
-
123
- export { DSCircularIndeterminateIndicator, DSCircularIndeterminateIndicatorWithSchema };
package/esm/v2/index.js DELETED
@@ -1 +0,0 @@
1
- export { DSCircularIndeterminateIndicator, DSCircularIndeterminateIndicatorWithSchema } from './DSCircularIndeterminateIndicator.js';
@@ -1,13 +0,0 @@
1
- import { PropTypes } from 'react-desc';
2
-
3
- /* eslint-disable max-lines */
4
- const CircularIndeterminateIndicatorPropTypes = {
5
- size: PropTypes.oneOf(['xs', 's', 'm', 'l', 'xl', 'xxl']).description('Size of the indicator').defaultValue('m'),
6
- color: PropTypes.oneOf(['light', 'dark']).description('Color mode for the indicator').defaultValue('dark'),
7
- text: PropTypes.string.description('Optional text to show under the indicator').defaultValue(''),
8
- showText: PropTypes.bool.description('Whether to show the optional text or not').defaultValue(true),
9
- withTooltip: PropTypes.bool.description('Whether to include a tooltip that shows the optional text on hover').defaultValue(false),
10
- 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')
11
- };
12
-
13
- export { CircularIndeterminateIndicatorPropTypes };
@@ -1 +0,0 @@
1
- export * from './DSCircularIndeterminateIndicator';