@alfalab/core-components-circular-progress-bar 2.4.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +39 -0
- package/Component.d.ts +93 -0
- package/Component.js +141 -0
- package/cssm/Component.d.ts +93 -0
- package/cssm/Component.js +140 -0
- package/{dist/cssm → cssm}/index.d.ts +0 -0
- package/{dist/cssm → cssm}/index.js +2 -2
- package/cssm/index.module.css +211 -0
- package/esm/Component.d.ts +93 -0
- package/esm/Component.js +132 -0
- package/esm/index.css +212 -0
- package/{dist/esm → esm}/index.d.ts +0 -0
- package/{dist/esm → esm}/index.js +2 -2
- package/index.css +212 -0
- package/{dist/index.d.ts → index.d.ts} +0 -0
- package/{dist/index.js → index.js} +1 -1
- package/modern/Component.d.ts +93 -0
- package/modern/Component.js +100 -0
- package/modern/index.css +212 -0
- package/{dist/modern → modern}/index.d.ts +0 -0
- package/{dist/modern → modern}/index.js +1 -1
- package/package.json +8 -11
- package/{dist/send-stats.js → send-stats.js} +0 -0
- package/dist/Component.d.ts +0 -38
- package/dist/Component.js +0 -57
- package/dist/cssm/Component.d.ts +0 -38
- package/dist/cssm/Component.js +0 -56
- package/dist/cssm/index.module.css +0 -106
- package/dist/esm/Component.d.ts +0 -38
- package/dist/esm/Component.js +0 -48
- package/dist/esm/index.css +0 -107
- package/dist/index.css +0 -107
- package/dist/modern/Component.d.ts +0 -38
- package/dist/modern/Component.js +0 -47
- package/dist/modern/index.css +0 -107
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--color-light-bg-tertiary: #e7e9eb;
|
|
3
|
+
--color-light-graphic-negative: #f15045;
|
|
4
|
+
--color-light-graphic-positive: #2fc26e;
|
|
5
|
+
--color-light-graphic-primary: #0b1f35;
|
|
6
|
+
--color-light-graphic-primary-inverted: #fff;
|
|
7
|
+
--color-light-graphic-secondary: #6d7986;
|
|
8
|
+
--color-light-graphic-tertiary: #b6bcc3;
|
|
9
|
+
}
|
|
10
|
+
:root {
|
|
11
|
+
|
|
12
|
+
/* Hard */
|
|
13
|
+
|
|
14
|
+
/* Up */
|
|
15
|
+
|
|
16
|
+
/* Hard up */
|
|
17
|
+
}
|
|
18
|
+
:root {
|
|
19
|
+
--font-family-system: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Helvetica,
|
|
20
|
+
sans-serif;
|
|
21
|
+
}
|
|
22
|
+
:root {
|
|
23
|
+
/* bg */
|
|
24
|
+
--circular-progress-bar-bg-color: var(--color-light-bg-tertiary);
|
|
25
|
+
|
|
26
|
+
/* positive */
|
|
27
|
+
--circular-progress-bar-positive-color: var(--color-light-graphic-positive);
|
|
28
|
+
|
|
29
|
+
/* negative */
|
|
30
|
+
--circular-progress-bar-negative-color: var(--color-light-graphic-negative);
|
|
31
|
+
|
|
32
|
+
/* theme */
|
|
33
|
+
--circular-progress-bar-font-family: var(--font-family-system);
|
|
34
|
+
--circular-progress-bar-font-weight: 600;
|
|
35
|
+
}
|
|
36
|
+
.component {
|
|
37
|
+
position: relative;
|
|
38
|
+
display: flex;
|
|
39
|
+
justify-content: center;
|
|
40
|
+
align-items: center;
|
|
41
|
+
}
|
|
42
|
+
.svg {
|
|
43
|
+
display: block;
|
|
44
|
+
width: 100%;
|
|
45
|
+
}
|
|
46
|
+
.title,
|
|
47
|
+
.subtitle {
|
|
48
|
+
overflow: hidden;
|
|
49
|
+
word-break: break-word;
|
|
50
|
+
white-space: nowrap;
|
|
51
|
+
text-overflow: ellipsis;
|
|
52
|
+
margin: 0 6px;
|
|
53
|
+
}
|
|
54
|
+
.subtitle {
|
|
55
|
+
max-height: 40px;
|
|
56
|
+
}
|
|
57
|
+
.labelWrapper {
|
|
58
|
+
text-align: center;
|
|
59
|
+
position: absolute;
|
|
60
|
+
top: 50%;
|
|
61
|
+
left: 50%;
|
|
62
|
+
width: 100%;
|
|
63
|
+
transform: translate(-50%, -50%)
|
|
64
|
+
}
|
|
65
|
+
.labelWrapper.label {
|
|
66
|
+
display: flex;
|
|
67
|
+
align-items: center;
|
|
68
|
+
justify-content: center;
|
|
69
|
+
}
|
|
70
|
+
.typography {
|
|
71
|
+
font-feature-settings: 'ss01';
|
|
72
|
+
font-weight: var(--circular-progress-bar-font-weight);
|
|
73
|
+
font-family: var(--circular-progress-bar-font-family);
|
|
74
|
+
}
|
|
75
|
+
.xxl {
|
|
76
|
+
width: 144px;
|
|
77
|
+
height: 144px
|
|
78
|
+
}
|
|
79
|
+
.xxl .labelWrapper {
|
|
80
|
+
max-width: 128px;
|
|
81
|
+
}
|
|
82
|
+
.xxl .title {
|
|
83
|
+
max-height: 32px;
|
|
84
|
+
}
|
|
85
|
+
.xl {
|
|
86
|
+
width: 128px;
|
|
87
|
+
height: 128px
|
|
88
|
+
}
|
|
89
|
+
.xl .labelWrapper {
|
|
90
|
+
max-width: 108px;
|
|
91
|
+
}
|
|
92
|
+
.xl .title {
|
|
93
|
+
max-height: 32px;
|
|
94
|
+
}
|
|
95
|
+
.l {
|
|
96
|
+
width: 80px;
|
|
97
|
+
height: 80px
|
|
98
|
+
}
|
|
99
|
+
.l .labelWrapper {
|
|
100
|
+
max-width: 64px;
|
|
101
|
+
}
|
|
102
|
+
.l .title {
|
|
103
|
+
max-height: 24px;
|
|
104
|
+
}
|
|
105
|
+
.m {
|
|
106
|
+
width: 64px;
|
|
107
|
+
height: 64px
|
|
108
|
+
}
|
|
109
|
+
.m .labelWrapper {
|
|
110
|
+
max-width: 48px;
|
|
111
|
+
}
|
|
112
|
+
.m .title {
|
|
113
|
+
max-height: 16px;
|
|
114
|
+
margin: 0;
|
|
115
|
+
}
|
|
116
|
+
.s {
|
|
117
|
+
width: 48px;
|
|
118
|
+
height: 48px
|
|
119
|
+
}
|
|
120
|
+
.s .labelWrapper {
|
|
121
|
+
max-width: 40px;
|
|
122
|
+
}
|
|
123
|
+
.s .title {
|
|
124
|
+
max-height: 16px;
|
|
125
|
+
margin: 0;
|
|
126
|
+
}
|
|
127
|
+
.xs {
|
|
128
|
+
width: 24px;
|
|
129
|
+
height: 24px
|
|
130
|
+
}
|
|
131
|
+
.xs .labelWrapper {
|
|
132
|
+
max-width: 24px;
|
|
133
|
+
}
|
|
134
|
+
.backgroundCircle,
|
|
135
|
+
.progressCircle {
|
|
136
|
+
width: 100%;
|
|
137
|
+
height: 100%;
|
|
138
|
+
fill: transparent;
|
|
139
|
+
}
|
|
140
|
+
.positive {
|
|
141
|
+
stroke: var(--circular-progress-bar-positive-color);
|
|
142
|
+
}
|
|
143
|
+
.negative {
|
|
144
|
+
stroke: var(--circular-progress-bar-negative-color);
|
|
145
|
+
}
|
|
146
|
+
.backgroundCircle {
|
|
147
|
+
stroke: var(--circular-progress-bar-bg-color)
|
|
148
|
+
}
|
|
149
|
+
.backgroundCircle.stroke {
|
|
150
|
+
stroke: transparent;
|
|
151
|
+
}
|
|
152
|
+
.progressCircle {
|
|
153
|
+
stroke-linecap: round
|
|
154
|
+
}
|
|
155
|
+
.progressCircle.bg-positive {
|
|
156
|
+
fill: var(--circular-progress-bar-positive-color);
|
|
157
|
+
}
|
|
158
|
+
.progressCircle.bg-negative {
|
|
159
|
+
fill: var(--circular-progress-bar-negative-color);
|
|
160
|
+
}
|
|
161
|
+
.iconWrapper {
|
|
162
|
+
display: flex;
|
|
163
|
+
align-items: center;
|
|
164
|
+
justify-content: center
|
|
165
|
+
}
|
|
166
|
+
.iconWrapper.xxl {
|
|
167
|
+
max-width: 64px;
|
|
168
|
+
max-height: 64px;
|
|
169
|
+
}
|
|
170
|
+
.iconWrapper.xl {
|
|
171
|
+
max-width: 64px;
|
|
172
|
+
max-height: 64px;
|
|
173
|
+
}
|
|
174
|
+
.iconWrapper.l {
|
|
175
|
+
max-width: 48px;
|
|
176
|
+
max-height: 48px;
|
|
177
|
+
}
|
|
178
|
+
.iconWrapper.m {
|
|
179
|
+
max-width: 36px;
|
|
180
|
+
max-height: 36px;
|
|
181
|
+
}
|
|
182
|
+
.iconWrapper.s {
|
|
183
|
+
max-width: 24px;
|
|
184
|
+
max-height: 24px;
|
|
185
|
+
}
|
|
186
|
+
.iconWrapper.xs {
|
|
187
|
+
max-width: 16px;
|
|
188
|
+
max-height: 16px;
|
|
189
|
+
}
|
|
190
|
+
.iconWrapper.icon-tertiary {
|
|
191
|
+
color: var(--color-light-graphic-tertiary);
|
|
192
|
+
}
|
|
193
|
+
.iconWrapper.icon-positive {
|
|
194
|
+
color: var(--color-light-graphic-positive);
|
|
195
|
+
}
|
|
196
|
+
.iconWrapper.icon-negative {
|
|
197
|
+
color: var(--color-light-graphic-negative);
|
|
198
|
+
}
|
|
199
|
+
.iconWrapper.icon-primary-inverted {
|
|
200
|
+
color: var(--color-light-graphic-primary-inverted);
|
|
201
|
+
}
|
|
202
|
+
.iconWrapper.icon-primary {
|
|
203
|
+
color: var(--color-light-graphic-primary);
|
|
204
|
+
}
|
|
205
|
+
.iconWrapper.icon-secondary {
|
|
206
|
+
color: var(--color-light-graphic-secondary);
|
|
207
|
+
}
|
|
208
|
+
.icon {
|
|
209
|
+
width: 100%;
|
|
210
|
+
height: 100%;
|
|
211
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { ReactNode, ElementType } from "react";
|
|
4
|
+
type CircularProgressBarProps = {
|
|
5
|
+
/**
|
|
6
|
+
* Уровень прогресса, %
|
|
7
|
+
*/
|
|
8
|
+
value: number;
|
|
9
|
+
/**
|
|
10
|
+
* Дополнительный класс
|
|
11
|
+
*/
|
|
12
|
+
className?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Основной текст
|
|
15
|
+
*/
|
|
16
|
+
title?: ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* Цвет контента
|
|
19
|
+
*/
|
|
20
|
+
contentColor?: 'primary' | 'secondary' | 'tertiary' | 'positive' | 'negative';
|
|
21
|
+
/**
|
|
22
|
+
* Дополнительный текст
|
|
23
|
+
*/
|
|
24
|
+
subtitle?: ReactNode;
|
|
25
|
+
/**
|
|
26
|
+
* Основной текст при 100%
|
|
27
|
+
*/
|
|
28
|
+
titleComplete?: ReactNode;
|
|
29
|
+
/**
|
|
30
|
+
* Дополнительный текст при 100%
|
|
31
|
+
*/
|
|
32
|
+
subtitleComplete?: ReactNode;
|
|
33
|
+
/**
|
|
34
|
+
* Цвет заполнения
|
|
35
|
+
*/
|
|
36
|
+
view?: 'positive' | 'negative';
|
|
37
|
+
/**
|
|
38
|
+
* Размер (xxl — 144×144px, xl — 128×128px, l — 80×80px, m — 64×64px, s — 48×48px, xs — 24×24px)
|
|
39
|
+
*/
|
|
40
|
+
size?: 'xxl' | 'xl' | 'l' | 'm' | 's' | 'xs';
|
|
41
|
+
/**
|
|
42
|
+
* Наличие желоба
|
|
43
|
+
*/
|
|
44
|
+
stroke?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Заливка при 100%
|
|
47
|
+
*/
|
|
48
|
+
fillComplete?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Цвет текста при 100%
|
|
51
|
+
*/
|
|
52
|
+
completeTextColor?: 'primary' | 'primary-inverted' | 'positive' | 'negative';
|
|
53
|
+
/**
|
|
54
|
+
* Цвет иконки при 100%
|
|
55
|
+
*/
|
|
56
|
+
completeIconColor?: 'primary-inverted' | 'positive' | 'negative' | 'tertiary';
|
|
57
|
+
/**
|
|
58
|
+
* Компонент иконки
|
|
59
|
+
*/
|
|
60
|
+
icon?: ElementType<{
|
|
61
|
+
className?: string;
|
|
62
|
+
}>;
|
|
63
|
+
/**
|
|
64
|
+
* Компонент иконки при 100%
|
|
65
|
+
*/
|
|
66
|
+
iconComplete?: ElementType<{
|
|
67
|
+
className?: string;
|
|
68
|
+
}>;
|
|
69
|
+
/**
|
|
70
|
+
* Направление прогресса (clockwise - по часовой стрелке, counter-clockwise - против часовой стрелки)
|
|
71
|
+
*/
|
|
72
|
+
direction?: 'clockwise' | 'counter-clockwise';
|
|
73
|
+
/**
|
|
74
|
+
* Высота компонента, min = 24; max = 144
|
|
75
|
+
* использовать совместно с size :
|
|
76
|
+
* xxl от 144
|
|
77
|
+
* xl от 128 до 143
|
|
78
|
+
* l от 80 до 127
|
|
79
|
+
* m от 64 до 79
|
|
80
|
+
* s от 48 до 63
|
|
81
|
+
* xs от 24 до 47
|
|
82
|
+
*/
|
|
83
|
+
height?: number;
|
|
84
|
+
/**
|
|
85
|
+
* Id компонента для тестов
|
|
86
|
+
*/
|
|
87
|
+
dataTestId?: string;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Компонент круглого прогресс бара.
|
|
91
|
+
*/
|
|
92
|
+
declare const CircularProgressBar: React.FC<CircularProgressBarProps>;
|
|
93
|
+
export { CircularProgressBarProps, CircularProgressBar };
|
package/esm/Component.js
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import cn from 'classnames';
|
|
2
|
+
import React, { useMemo } from 'react';
|
|
3
|
+
import { Typography } from '@alfalab/core-components-typography/esm';
|
|
4
|
+
|
|
5
|
+
/*! *****************************************************************************
|
|
6
|
+
Copyright (c) Microsoft Corporation.
|
|
7
|
+
|
|
8
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
9
|
+
purpose with or without fee is hereby granted.
|
|
10
|
+
|
|
11
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
12
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
13
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
14
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
15
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
16
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
17
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
18
|
+
***************************************************************************** */
|
|
19
|
+
var __assign = function () {
|
|
20
|
+
__assign = Object.assign || function __assign(t) {
|
|
21
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
22
|
+
s = arguments[i];
|
|
23
|
+
for (var p in s)
|
|
24
|
+
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
25
|
+
t[p] = s[p];
|
|
26
|
+
}
|
|
27
|
+
return t;
|
|
28
|
+
};
|
|
29
|
+
return __assign.apply(this, arguments);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
var styles = {"component":"circular-progress-bar__component_1h0qp","svg":"circular-progress-bar__svg_1h0qp","title":"circular-progress-bar__title_1h0qp","subtitle":"circular-progress-bar__subtitle_1h0qp","labelWrapper":"circular-progress-bar__labelWrapper_1h0qp","label":"circular-progress-bar__label_1h0qp","typography":"circular-progress-bar__typography_1h0qp","xxl":"circular-progress-bar__xxl_1h0qp","xl":"circular-progress-bar__xl_1h0qp","l":"circular-progress-bar__l_1h0qp","m":"circular-progress-bar__m_1h0qp","s":"circular-progress-bar__s_1h0qp","xs":"circular-progress-bar__xs_1h0qp","backgroundCircle":"circular-progress-bar__backgroundCircle_1h0qp","progressCircle":"circular-progress-bar__progressCircle_1h0qp","positive":"circular-progress-bar__positive_1h0qp","negative":"circular-progress-bar__negative_1h0qp","stroke":"circular-progress-bar__stroke_1h0qp","bg-positive":"circular-progress-bar__bg-positive_1h0qp","bg-negative":"circular-progress-bar__bg-negative_1h0qp","iconWrapper":"circular-progress-bar__iconWrapper_1h0qp","icon-tertiary":"circular-progress-bar__icon-tertiary_1h0qp","icon-positive":"circular-progress-bar__icon-positive_1h0qp","icon-negative":"circular-progress-bar__icon-negative_1h0qp","icon-primary-inverted":"circular-progress-bar__icon-primary-inverted_1h0qp","icon-primary":"circular-progress-bar__icon-primary_1h0qp","icon-secondary":"circular-progress-bar__icon-secondary_1h0qp","icon":"circular-progress-bar__icon_1h0qp"};
|
|
33
|
+
require('./index.css')
|
|
34
|
+
|
|
35
|
+
var SIZES = {
|
|
36
|
+
xs: 24,
|
|
37
|
+
s: 48,
|
|
38
|
+
m: 64,
|
|
39
|
+
l: 80,
|
|
40
|
+
xl: 128,
|
|
41
|
+
xxl: 144,
|
|
42
|
+
};
|
|
43
|
+
var STROKE = {
|
|
44
|
+
xs: 4,
|
|
45
|
+
s: 4,
|
|
46
|
+
m: 6,
|
|
47
|
+
l: 8,
|
|
48
|
+
xl: 10,
|
|
49
|
+
xxl: 12,
|
|
50
|
+
};
|
|
51
|
+
var VIEW_TITLE = {
|
|
52
|
+
xs: 'small',
|
|
53
|
+
s: 'small',
|
|
54
|
+
m: 'small',
|
|
55
|
+
l: 'xsmall',
|
|
56
|
+
xl: 'medium',
|
|
57
|
+
xxl: 'medium',
|
|
58
|
+
};
|
|
59
|
+
var VIEW_TEXT = {
|
|
60
|
+
xs: 'secondary-small',
|
|
61
|
+
s: 'secondary-small',
|
|
62
|
+
m: 'secondary-large',
|
|
63
|
+
l: 'secondary-large',
|
|
64
|
+
xl: 'secondary-large',
|
|
65
|
+
xxl: 'secondary-large',
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Компонент круглого прогресс бара.
|
|
69
|
+
*/
|
|
70
|
+
var CircularProgressBar = function (_a) {
|
|
71
|
+
var _b, _c, _d;
|
|
72
|
+
var value = _a.value, _e = _a.view, view = _e === void 0 ? 'positive' : _e, _f = _a.size, size = _f === void 0 ? 'm' : _f, className = _a.className, dataTestId = _a.dataTestId, _g = _a.title, title = _g === void 0 ? value ? value.toString() : '0' : _g, titleComplete = _a.titleComplete, subtitle = _a.subtitle, _h = _a.contentColor, contentColor = _h === void 0 ? 'secondary' : _h, subtitleComplete = _a.subtitleComplete, _j = _a.stroke, stroke = _j === void 0 ? true : _j, fillComplete = _a.fillComplete, Icon = _a.icon, IconComplete = _a.iconComplete, completeTextColor = _a.completeTextColor, _k = _a.completeIconColor, completeIconColor = _k === void 0 ? 'tertiary' : _k, _l = _a.direction, direction = _l === void 0 ? 'clockwise' : _l, height = _a.height, children = _a.children;
|
|
73
|
+
var memorized = useMemo(function () {
|
|
74
|
+
var strokeWidth = STROKE[size];
|
|
75
|
+
var maxProgress = 100;
|
|
76
|
+
var minProgress = 0;
|
|
77
|
+
var widthSVG = SIZES[size];
|
|
78
|
+
var heightSVG = SIZES[size];
|
|
79
|
+
var center = widthSVG / 2;
|
|
80
|
+
var radius = center - strokeWidth / 2;
|
|
81
|
+
var circumference = Math.PI * radius * 2;
|
|
82
|
+
var progress = Math.min(Math.max(value, minProgress), maxProgress);
|
|
83
|
+
var strokeDasharray = circumference.toFixed(3);
|
|
84
|
+
var strokeDashoffset = (((100 - progress) / 100) * circumference).toFixed(3);
|
|
85
|
+
return {
|
|
86
|
+
widthSVG: widthSVG,
|
|
87
|
+
heightSVG: heightSVG,
|
|
88
|
+
center: center,
|
|
89
|
+
radius: radius,
|
|
90
|
+
strokeDasharray: strokeDasharray,
|
|
91
|
+
strokeDashoffset: strokeDashoffset,
|
|
92
|
+
};
|
|
93
|
+
}, [value, size]);
|
|
94
|
+
var isComplete = value === 100;
|
|
95
|
+
var isCompleteTextColor = isComplete && completeTextColor;
|
|
96
|
+
var titleContent = titleComplete && isComplete ? titleComplete : title;
|
|
97
|
+
var subtitleContent = subtitleComplete && isComplete ? subtitleComplete : subtitle;
|
|
98
|
+
var IconComponent = IconComplete && isComplete ? IconComplete : Icon;
|
|
99
|
+
var renderTitleString = function () {
|
|
100
|
+
return (React.createElement(React.Fragment, null, SIZES[size] > 64 ? (React.createElement(Typography.TitleMobile, { className: cn(styles.typography, styles.title), color: isCompleteTextColor ? completeTextColor : contentColor, tag: 'div', font: 'system', view: VIEW_TITLE[size] }, titleContent)) : (React.createElement(Typography.Text, { className: styles.title, color: isCompleteTextColor ? completeTextColor : contentColor, tag: 'div', weight: 'bold', view: VIEW_TEXT[size] }, titleContent))));
|
|
101
|
+
};
|
|
102
|
+
var renderTitle = function () { return (typeof title === 'string' ? renderTitleString() : titleContent); };
|
|
103
|
+
var renderSubTitle = function () {
|
|
104
|
+
return typeof subtitle === 'string' ? (React.createElement(Typography.Text, { tag: 'div', className: styles.subtitle, color: isCompleteTextColor ? completeTextColor : contentColor, view: 'primary-small' }, subtitleContent)) : (subtitleContent);
|
|
105
|
+
};
|
|
106
|
+
var renderIcon = function () {
|
|
107
|
+
var _a;
|
|
108
|
+
return (React.createElement("span", { className: cn(styles.iconWrapper, styles[size], styles.tertiary, styles["icon-" + contentColor], (_a = {},
|
|
109
|
+
_a[styles["icon-" + completeIconColor]] = completeIconColor,
|
|
110
|
+
_a)) }, IconComponent && React.createElement(IconComponent, { className: styles.icon })));
|
|
111
|
+
};
|
|
112
|
+
var renderContent = function () {
|
|
113
|
+
return Icon || (IconComplete && isComplete) ? (renderIcon()) : (React.createElement(React.Fragment, null,
|
|
114
|
+
SIZES[size] > 24 && renderTitle(),
|
|
115
|
+
SIZES[size] > 64 && renderSubTitle()));
|
|
116
|
+
};
|
|
117
|
+
return (React.createElement("div", { className: cn(styles.component, styles[size], className), style: __assign({}, (height && { height: height, width: height })), "data-test-id": dataTestId },
|
|
118
|
+
React.createElement("svg", { viewBox: "0 0 " + memorized.widthSVG + " " + memorized.heightSVG, className: styles.svg, xmlns: 'http://www.w3.org/2000/svg' },
|
|
119
|
+
React.createElement("circle", { className: cn(styles.backgroundCircle, styles[size], (_b = {},
|
|
120
|
+
_b[styles.stroke] = !stroke,
|
|
121
|
+
_b)), cx: memorized.center, cy: memorized.center, r: memorized.radius, strokeWidth: STROKE[size] }),
|
|
122
|
+
React.createElement("circle", { className: cn(styles.progressCircle, styles[view], styles[size], (_c = {},
|
|
123
|
+
_c[styles["bg-" + view]] = fillComplete && isComplete,
|
|
124
|
+
_c)), cx: memorized.center, cy: memorized.center, r: memorized.radius, strokeWidth: STROKE[size], strokeDasharray: memorized.strokeDasharray, strokeDashoffset: direction === 'counter-clockwise'
|
|
125
|
+
? -memorized.strokeDashoffset
|
|
126
|
+
: memorized.strokeDashoffset, transform: "rotate(" + -90 + " " + memorized.center + " " + memorized.center + ")" })),
|
|
127
|
+
React.createElement("div", { className: cn(styles.labelWrapper, (_d = {},
|
|
128
|
+
_d[styles.label] = Icon || IconComplete,
|
|
129
|
+
_d)) }, children || renderContent())));
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
export { CircularProgressBar };
|
package/esm/index.css
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/* hash: o4wfv */
|
|
2
|
+
:root {
|
|
3
|
+
--color-light-bg-tertiary: #e7e9eb;
|
|
4
|
+
--color-light-graphic-negative: #f15045;
|
|
5
|
+
--color-light-graphic-positive: #2fc26e;
|
|
6
|
+
--color-light-graphic-primary: #0b1f35;
|
|
7
|
+
--color-light-graphic-primary-inverted: #fff;
|
|
8
|
+
--color-light-graphic-secondary: #6d7986;
|
|
9
|
+
--color-light-graphic-tertiary: #b6bcc3;
|
|
10
|
+
}
|
|
11
|
+
:root {
|
|
12
|
+
|
|
13
|
+
/* Hard */
|
|
14
|
+
|
|
15
|
+
/* Up */
|
|
16
|
+
|
|
17
|
+
/* Hard up */
|
|
18
|
+
}
|
|
19
|
+
:root {
|
|
20
|
+
--font-family-system: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Helvetica,
|
|
21
|
+
sans-serif;
|
|
22
|
+
}
|
|
23
|
+
:root {
|
|
24
|
+
/* bg */
|
|
25
|
+
--circular-progress-bar-bg-color: var(--color-light-bg-tertiary);
|
|
26
|
+
|
|
27
|
+
/* positive */
|
|
28
|
+
--circular-progress-bar-positive-color: var(--color-light-graphic-positive);
|
|
29
|
+
|
|
30
|
+
/* negative */
|
|
31
|
+
--circular-progress-bar-negative-color: var(--color-light-graphic-negative);
|
|
32
|
+
|
|
33
|
+
/* theme */
|
|
34
|
+
--circular-progress-bar-font-family: var(--font-family-system);
|
|
35
|
+
--circular-progress-bar-font-weight: 600;
|
|
36
|
+
}
|
|
37
|
+
.circular-progress-bar__component_1h0qp {
|
|
38
|
+
position: relative;
|
|
39
|
+
display: flex;
|
|
40
|
+
justify-content: center;
|
|
41
|
+
align-items: center;
|
|
42
|
+
}
|
|
43
|
+
.circular-progress-bar__svg_1h0qp {
|
|
44
|
+
display: block;
|
|
45
|
+
width: 100%;
|
|
46
|
+
}
|
|
47
|
+
.circular-progress-bar__title_1h0qp,
|
|
48
|
+
.circular-progress-bar__subtitle_1h0qp {
|
|
49
|
+
overflow: hidden;
|
|
50
|
+
word-break: break-word;
|
|
51
|
+
white-space: nowrap;
|
|
52
|
+
text-overflow: ellipsis;
|
|
53
|
+
margin: 0 6px;
|
|
54
|
+
}
|
|
55
|
+
.circular-progress-bar__subtitle_1h0qp {
|
|
56
|
+
max-height: 40px;
|
|
57
|
+
}
|
|
58
|
+
.circular-progress-bar__labelWrapper_1h0qp {
|
|
59
|
+
text-align: center;
|
|
60
|
+
position: absolute;
|
|
61
|
+
top: 50%;
|
|
62
|
+
left: 50%;
|
|
63
|
+
width: 100%;
|
|
64
|
+
transform: translate(-50%, -50%)
|
|
65
|
+
}
|
|
66
|
+
.circular-progress-bar__labelWrapper_1h0qp.circular-progress-bar__label_1h0qp {
|
|
67
|
+
display: flex;
|
|
68
|
+
align-items: center;
|
|
69
|
+
justify-content: center;
|
|
70
|
+
}
|
|
71
|
+
.circular-progress-bar__typography_1h0qp {
|
|
72
|
+
font-feature-settings: 'ss01';
|
|
73
|
+
font-weight: var(--circular-progress-bar-font-weight);
|
|
74
|
+
font-family: var(--circular-progress-bar-font-family);
|
|
75
|
+
}
|
|
76
|
+
.circular-progress-bar__xxl_1h0qp {
|
|
77
|
+
width: 144px;
|
|
78
|
+
height: 144px
|
|
79
|
+
}
|
|
80
|
+
.circular-progress-bar__xxl_1h0qp .circular-progress-bar__labelWrapper_1h0qp {
|
|
81
|
+
max-width: 128px;
|
|
82
|
+
}
|
|
83
|
+
.circular-progress-bar__xxl_1h0qp .circular-progress-bar__title_1h0qp {
|
|
84
|
+
max-height: 32px;
|
|
85
|
+
}
|
|
86
|
+
.circular-progress-bar__xl_1h0qp {
|
|
87
|
+
width: 128px;
|
|
88
|
+
height: 128px
|
|
89
|
+
}
|
|
90
|
+
.circular-progress-bar__xl_1h0qp .circular-progress-bar__labelWrapper_1h0qp {
|
|
91
|
+
max-width: 108px;
|
|
92
|
+
}
|
|
93
|
+
.circular-progress-bar__xl_1h0qp .circular-progress-bar__title_1h0qp {
|
|
94
|
+
max-height: 32px;
|
|
95
|
+
}
|
|
96
|
+
.circular-progress-bar__l_1h0qp {
|
|
97
|
+
width: 80px;
|
|
98
|
+
height: 80px
|
|
99
|
+
}
|
|
100
|
+
.circular-progress-bar__l_1h0qp .circular-progress-bar__labelWrapper_1h0qp {
|
|
101
|
+
max-width: 64px;
|
|
102
|
+
}
|
|
103
|
+
.circular-progress-bar__l_1h0qp .circular-progress-bar__title_1h0qp {
|
|
104
|
+
max-height: 24px;
|
|
105
|
+
}
|
|
106
|
+
.circular-progress-bar__m_1h0qp {
|
|
107
|
+
width: 64px;
|
|
108
|
+
height: 64px
|
|
109
|
+
}
|
|
110
|
+
.circular-progress-bar__m_1h0qp .circular-progress-bar__labelWrapper_1h0qp {
|
|
111
|
+
max-width: 48px;
|
|
112
|
+
}
|
|
113
|
+
.circular-progress-bar__m_1h0qp .circular-progress-bar__title_1h0qp {
|
|
114
|
+
max-height: 16px;
|
|
115
|
+
margin: 0;
|
|
116
|
+
}
|
|
117
|
+
.circular-progress-bar__s_1h0qp {
|
|
118
|
+
width: 48px;
|
|
119
|
+
height: 48px
|
|
120
|
+
}
|
|
121
|
+
.circular-progress-bar__s_1h0qp .circular-progress-bar__labelWrapper_1h0qp {
|
|
122
|
+
max-width: 40px;
|
|
123
|
+
}
|
|
124
|
+
.circular-progress-bar__s_1h0qp .circular-progress-bar__title_1h0qp {
|
|
125
|
+
max-height: 16px;
|
|
126
|
+
margin: 0;
|
|
127
|
+
}
|
|
128
|
+
.circular-progress-bar__xs_1h0qp {
|
|
129
|
+
width: 24px;
|
|
130
|
+
height: 24px
|
|
131
|
+
}
|
|
132
|
+
.circular-progress-bar__xs_1h0qp .circular-progress-bar__labelWrapper_1h0qp {
|
|
133
|
+
max-width: 24px;
|
|
134
|
+
}
|
|
135
|
+
.circular-progress-bar__backgroundCircle_1h0qp,
|
|
136
|
+
.circular-progress-bar__progressCircle_1h0qp {
|
|
137
|
+
width: 100%;
|
|
138
|
+
height: 100%;
|
|
139
|
+
fill: transparent;
|
|
140
|
+
}
|
|
141
|
+
.circular-progress-bar__positive_1h0qp {
|
|
142
|
+
stroke: var(--circular-progress-bar-positive-color);
|
|
143
|
+
}
|
|
144
|
+
.circular-progress-bar__negative_1h0qp {
|
|
145
|
+
stroke: var(--circular-progress-bar-negative-color);
|
|
146
|
+
}
|
|
147
|
+
.circular-progress-bar__backgroundCircle_1h0qp {
|
|
148
|
+
stroke: var(--circular-progress-bar-bg-color)
|
|
149
|
+
}
|
|
150
|
+
.circular-progress-bar__backgroundCircle_1h0qp.circular-progress-bar__stroke_1h0qp {
|
|
151
|
+
stroke: transparent;
|
|
152
|
+
}
|
|
153
|
+
.circular-progress-bar__progressCircle_1h0qp {
|
|
154
|
+
stroke-linecap: round
|
|
155
|
+
}
|
|
156
|
+
.circular-progress-bar__progressCircle_1h0qp.circular-progress-bar__bg-positive_1h0qp {
|
|
157
|
+
fill: var(--circular-progress-bar-positive-color);
|
|
158
|
+
}
|
|
159
|
+
.circular-progress-bar__progressCircle_1h0qp.circular-progress-bar__bg-negative_1h0qp {
|
|
160
|
+
fill: var(--circular-progress-bar-negative-color);
|
|
161
|
+
}
|
|
162
|
+
.circular-progress-bar__iconWrapper_1h0qp {
|
|
163
|
+
display: flex;
|
|
164
|
+
align-items: center;
|
|
165
|
+
justify-content: center
|
|
166
|
+
}
|
|
167
|
+
.circular-progress-bar__iconWrapper_1h0qp.circular-progress-bar__xxl_1h0qp {
|
|
168
|
+
max-width: 64px;
|
|
169
|
+
max-height: 64px;
|
|
170
|
+
}
|
|
171
|
+
.circular-progress-bar__iconWrapper_1h0qp.circular-progress-bar__xl_1h0qp {
|
|
172
|
+
max-width: 64px;
|
|
173
|
+
max-height: 64px;
|
|
174
|
+
}
|
|
175
|
+
.circular-progress-bar__iconWrapper_1h0qp.circular-progress-bar__l_1h0qp {
|
|
176
|
+
max-width: 48px;
|
|
177
|
+
max-height: 48px;
|
|
178
|
+
}
|
|
179
|
+
.circular-progress-bar__iconWrapper_1h0qp.circular-progress-bar__m_1h0qp {
|
|
180
|
+
max-width: 36px;
|
|
181
|
+
max-height: 36px;
|
|
182
|
+
}
|
|
183
|
+
.circular-progress-bar__iconWrapper_1h0qp.circular-progress-bar__s_1h0qp {
|
|
184
|
+
max-width: 24px;
|
|
185
|
+
max-height: 24px;
|
|
186
|
+
}
|
|
187
|
+
.circular-progress-bar__iconWrapper_1h0qp.circular-progress-bar__xs_1h0qp {
|
|
188
|
+
max-width: 16px;
|
|
189
|
+
max-height: 16px;
|
|
190
|
+
}
|
|
191
|
+
.circular-progress-bar__iconWrapper_1h0qp.circular-progress-bar__icon-tertiary_1h0qp {
|
|
192
|
+
color: var(--color-light-graphic-tertiary);
|
|
193
|
+
}
|
|
194
|
+
.circular-progress-bar__iconWrapper_1h0qp.circular-progress-bar__icon-positive_1h0qp {
|
|
195
|
+
color: var(--color-light-graphic-positive);
|
|
196
|
+
}
|
|
197
|
+
.circular-progress-bar__iconWrapper_1h0qp.circular-progress-bar__icon-negative_1h0qp {
|
|
198
|
+
color: var(--color-light-graphic-negative);
|
|
199
|
+
}
|
|
200
|
+
.circular-progress-bar__iconWrapper_1h0qp.circular-progress-bar__icon-primary-inverted_1h0qp {
|
|
201
|
+
color: var(--color-light-graphic-primary-inverted);
|
|
202
|
+
}
|
|
203
|
+
.circular-progress-bar__iconWrapper_1h0qp.circular-progress-bar__icon-primary_1h0qp {
|
|
204
|
+
color: var(--color-light-graphic-primary);
|
|
205
|
+
}
|
|
206
|
+
.circular-progress-bar__iconWrapper_1h0qp.circular-progress-bar__icon-secondary_1h0qp {
|
|
207
|
+
color: var(--color-light-graphic-secondary);
|
|
208
|
+
}
|
|
209
|
+
.circular-progress-bar__icon_1h0qp {
|
|
210
|
+
width: 100%;
|
|
211
|
+
height: 100%;
|
|
212
|
+
}
|
|
File without changes
|