@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 CHANGED
@@ -3,6 +3,44 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [2.5.0](https://github.com/core-ds/core-components/compare/@alfalab/core-components-circular-progress-bar@2.4.3...@alfalab/core-components-circular-progress-bar@2.5.0) (2022-07-22)
7
+
8
+
9
+ ### Features
10
+
11
+ * **circular-progress-bar:** added new sizes and props ([#122](https://github.com/core-ds/core-components/issues/122)) ([9b1c412](https://github.com/core-ds/core-components/commit/9b1c4126aabc516349655a51c6302d6af84aa129))
12
+
13
+
14
+
15
+
16
+
17
+ ## [2.4.3](https://github.com/core-ds/core-components/compare/@alfalab/core-components-circular-progress-bar@2.4.2...@alfalab/core-components-circular-progress-bar@2.4.3) (2022-07-18)
18
+
19
+ **Note:** Version bump only for package @alfalab/core-components-circular-progress-bar
20
+
21
+
22
+
23
+
24
+
25
+ ## [2.4.2](https://github.com/core-ds/core-components/compare/@alfalab/core-components-circular-progress-bar@2.4.1...@alfalab/core-components-circular-progress-bar@2.4.2) (2022-07-15)
26
+
27
+
28
+ ### Bug Fixes
29
+
30
+ * bump packages version ([#153](https://github.com/core-ds/core-components/issues/153)) ([fd3e082](https://github.com/core-ds/core-components/commit/fd3e08205672129cdce04e1000c673f2cd9c10da))
31
+
32
+
33
+
34
+
35
+
36
+ ## [2.4.1](https://github.com/core-ds/core-components/compare/@alfalab/core-components-circular-progress-bar@2.4.0...@alfalab/core-components-circular-progress-bar@2.4.1) (2022-07-14)
37
+
38
+ **Note:** Version bump only for package @alfalab/core-components-circular-progress-bar
39
+
40
+
41
+
42
+
43
+
6
44
  # [2.4.0](https://github.com/core-ds/core-components/compare/@alfalab/core-components-circular-progress-bar@2.3.4...@alfalab/core-components-circular-progress-bar@2.4.0) (2022-06-28)
7
45
 
8
46
 
@@ -174,4 +212,5 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
174
212
 
175
213
  ## [1.2.1](https://github.com/core-ds/core-components/compare/@alfalab/core-components-circular-progress-bar@1.2.0...@alfalab/core-components-circular-progress-bar@1.2.1) (2021-03-03)
176
214
 
215
+
177
216
  **Note:** Version bump only for package @alfalab/core-components-circular-progress-bar
package/Component.d.ts ADDED
@@ -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/Component.js ADDED
@@ -0,0 +1,141 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var cn = require('classnames');
6
+ var React = require('react');
7
+ var coreComponentsTypography = require('@alfalab/core-components-typography');
8
+
9
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
10
+
11
+ var cn__default = /*#__PURE__*/_interopDefaultLegacy(cn);
12
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
13
+
14
+ /*! *****************************************************************************
15
+ Copyright (c) Microsoft Corporation.
16
+
17
+ Permission to use, copy, modify, and/or distribute this software for any
18
+ purpose with or without fee is hereby granted.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
21
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
22
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
23
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
24
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
25
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
26
+ PERFORMANCE OF THIS SOFTWARE.
27
+ ***************************************************************************** */
28
+ var __assign = function () {
29
+ __assign = Object.assign || function __assign(t) {
30
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
31
+ s = arguments[i];
32
+ for (var p in s)
33
+ if (Object.prototype.hasOwnProperty.call(s, p))
34
+ t[p] = s[p];
35
+ }
36
+ return t;
37
+ };
38
+ return __assign.apply(this, arguments);
39
+ };
40
+
41
+ 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"};
42
+ require('./index.css')
43
+
44
+ var SIZES = {
45
+ xs: 24,
46
+ s: 48,
47
+ m: 64,
48
+ l: 80,
49
+ xl: 128,
50
+ xxl: 144,
51
+ };
52
+ var STROKE = {
53
+ xs: 4,
54
+ s: 4,
55
+ m: 6,
56
+ l: 8,
57
+ xl: 10,
58
+ xxl: 12,
59
+ };
60
+ var VIEW_TITLE = {
61
+ xs: 'small',
62
+ s: 'small',
63
+ m: 'small',
64
+ l: 'xsmall',
65
+ xl: 'medium',
66
+ xxl: 'medium',
67
+ };
68
+ var VIEW_TEXT = {
69
+ xs: 'secondary-small',
70
+ s: 'secondary-small',
71
+ m: 'secondary-large',
72
+ l: 'secondary-large',
73
+ xl: 'secondary-large',
74
+ xxl: 'secondary-large',
75
+ };
76
+ /**
77
+ * Компонент круглого прогресс бара.
78
+ */
79
+ var CircularProgressBar = function (_a) {
80
+ var _b, _c, _d;
81
+ 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;
82
+ var memorized = React.useMemo(function () {
83
+ var strokeWidth = STROKE[size];
84
+ var maxProgress = 100;
85
+ var minProgress = 0;
86
+ var widthSVG = SIZES[size];
87
+ var heightSVG = SIZES[size];
88
+ var center = widthSVG / 2;
89
+ var radius = center - strokeWidth / 2;
90
+ var circumference = Math.PI * radius * 2;
91
+ var progress = Math.min(Math.max(value, minProgress), maxProgress);
92
+ var strokeDasharray = circumference.toFixed(3);
93
+ var strokeDashoffset = (((100 - progress) / 100) * circumference).toFixed(3);
94
+ return {
95
+ widthSVG: widthSVG,
96
+ heightSVG: heightSVG,
97
+ center: center,
98
+ radius: radius,
99
+ strokeDasharray: strokeDasharray,
100
+ strokeDashoffset: strokeDashoffset,
101
+ };
102
+ }, [value, size]);
103
+ var isComplete = value === 100;
104
+ var isCompleteTextColor = isComplete && completeTextColor;
105
+ var titleContent = titleComplete && isComplete ? titleComplete : title;
106
+ var subtitleContent = subtitleComplete && isComplete ? subtitleComplete : subtitle;
107
+ var IconComponent = IconComplete && isComplete ? IconComplete : Icon;
108
+ var renderTitleString = function () {
109
+ return (React__default['default'].createElement(React__default['default'].Fragment, null, SIZES[size] > 64 ? (React__default['default'].createElement(coreComponentsTypography.Typography.TitleMobile, { className: cn__default['default'](styles.typography, styles.title), color: isCompleteTextColor ? completeTextColor : contentColor, tag: 'div', font: 'system', view: VIEW_TITLE[size] }, titleContent)) : (React__default['default'].createElement(coreComponentsTypography.Typography.Text, { className: styles.title, color: isCompleteTextColor ? completeTextColor : contentColor, tag: 'div', weight: 'bold', view: VIEW_TEXT[size] }, titleContent))));
110
+ };
111
+ var renderTitle = function () { return (typeof title === 'string' ? renderTitleString() : titleContent); };
112
+ var renderSubTitle = function () {
113
+ return typeof subtitle === 'string' ? (React__default['default'].createElement(coreComponentsTypography.Typography.Text, { tag: 'div', className: styles.subtitle, color: isCompleteTextColor ? completeTextColor : contentColor, view: 'primary-small' }, subtitleContent)) : (subtitleContent);
114
+ };
115
+ var renderIcon = function () {
116
+ var _a;
117
+ return (React__default['default'].createElement("span", { className: cn__default['default'](styles.iconWrapper, styles[size], styles.tertiary, styles["icon-" + contentColor], (_a = {},
118
+ _a[styles["icon-" + completeIconColor]] = completeIconColor,
119
+ _a)) }, IconComponent && React__default['default'].createElement(IconComponent, { className: styles.icon })));
120
+ };
121
+ var renderContent = function () {
122
+ return Icon || (IconComplete && isComplete) ? (renderIcon()) : (React__default['default'].createElement(React__default['default'].Fragment, null,
123
+ SIZES[size] > 24 && renderTitle(),
124
+ SIZES[size] > 64 && renderSubTitle()));
125
+ };
126
+ return (React__default['default'].createElement("div", { className: cn__default['default'](styles.component, styles[size], className), style: __assign({}, (height && { height: height, width: height })), "data-test-id": dataTestId },
127
+ React__default['default'].createElement("svg", { viewBox: "0 0 " + memorized.widthSVG + " " + memorized.heightSVG, className: styles.svg, xmlns: 'http://www.w3.org/2000/svg' },
128
+ React__default['default'].createElement("circle", { className: cn__default['default'](styles.backgroundCircle, styles[size], (_b = {},
129
+ _b[styles.stroke] = !stroke,
130
+ _b)), cx: memorized.center, cy: memorized.center, r: memorized.radius, strokeWidth: STROKE[size] }),
131
+ React__default['default'].createElement("circle", { className: cn__default['default'](styles.progressCircle, styles[view], styles[size], (_c = {},
132
+ _c[styles["bg-" + view]] = fillComplete && isComplete,
133
+ _c)), cx: memorized.center, cy: memorized.center, r: memorized.radius, strokeWidth: STROKE[size], strokeDasharray: memorized.strokeDasharray, strokeDashoffset: direction === 'counter-clockwise'
134
+ ? -memorized.strokeDashoffset
135
+ : memorized.strokeDashoffset, transform: "rotate(" + -90 + " " + memorized.center + " " + memorized.center + ")" })),
136
+ React__default['default'].createElement("div", { className: cn__default['default'](styles.labelWrapper, (_d = {},
137
+ _d[styles.label] = Icon || IconComplete,
138
+ _d)) }, children || renderContent())));
139
+ };
140
+
141
+ exports.CircularProgressBar = CircularProgressBar;
@@ -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 };
@@ -0,0 +1,140 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var cn = require('classnames');
6
+ var React = require('react');
7
+ var coreComponentsTypography = require('@alfalab/core-components-typography/cssm');
8
+ var styles = require('./index.module.css');
9
+
10
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
11
+
12
+ var cn__default = /*#__PURE__*/_interopDefaultLegacy(cn);
13
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
14
+ var styles__default = /*#__PURE__*/_interopDefaultLegacy(styles);
15
+
16
+ /*! *****************************************************************************
17
+ Copyright (c) Microsoft Corporation.
18
+
19
+ Permission to use, copy, modify, and/or distribute this software for any
20
+ purpose with or without fee is hereby granted.
21
+
22
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
23
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
24
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
25
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
26
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
27
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
28
+ PERFORMANCE OF THIS SOFTWARE.
29
+ ***************************************************************************** */
30
+ var __assign = function () {
31
+ __assign = Object.assign || function __assign(t) {
32
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
33
+ s = arguments[i];
34
+ for (var p in s)
35
+ if (Object.prototype.hasOwnProperty.call(s, p))
36
+ t[p] = s[p];
37
+ }
38
+ return t;
39
+ };
40
+ return __assign.apply(this, arguments);
41
+ };
42
+
43
+ var SIZES = {
44
+ xs: 24,
45
+ s: 48,
46
+ m: 64,
47
+ l: 80,
48
+ xl: 128,
49
+ xxl: 144,
50
+ };
51
+ var STROKE = {
52
+ xs: 4,
53
+ s: 4,
54
+ m: 6,
55
+ l: 8,
56
+ xl: 10,
57
+ xxl: 12,
58
+ };
59
+ var VIEW_TITLE = {
60
+ xs: 'small',
61
+ s: 'small',
62
+ m: 'small',
63
+ l: 'xsmall',
64
+ xl: 'medium',
65
+ xxl: 'medium',
66
+ };
67
+ var VIEW_TEXT = {
68
+ xs: 'secondary-small',
69
+ s: 'secondary-small',
70
+ m: 'secondary-large',
71
+ l: 'secondary-large',
72
+ xl: 'secondary-large',
73
+ xxl: 'secondary-large',
74
+ };
75
+ /**
76
+ * Компонент круглого прогресс бара.
77
+ */
78
+ var CircularProgressBar = function (_a) {
79
+ var _b, _c, _d;
80
+ 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;
81
+ var memorized = React.useMemo(function () {
82
+ var strokeWidth = STROKE[size];
83
+ var maxProgress = 100;
84
+ var minProgress = 0;
85
+ var widthSVG = SIZES[size];
86
+ var heightSVG = SIZES[size];
87
+ var center = widthSVG / 2;
88
+ var radius = center - strokeWidth / 2;
89
+ var circumference = Math.PI * radius * 2;
90
+ var progress = Math.min(Math.max(value, minProgress), maxProgress);
91
+ var strokeDasharray = circumference.toFixed(3);
92
+ var strokeDashoffset = (((100 - progress) / 100) * circumference).toFixed(3);
93
+ return {
94
+ widthSVG: widthSVG,
95
+ heightSVG: heightSVG,
96
+ center: center,
97
+ radius: radius,
98
+ strokeDasharray: strokeDasharray,
99
+ strokeDashoffset: strokeDashoffset,
100
+ };
101
+ }, [value, size]);
102
+ var isComplete = value === 100;
103
+ var isCompleteTextColor = isComplete && completeTextColor;
104
+ var titleContent = titleComplete && isComplete ? titleComplete : title;
105
+ var subtitleContent = subtitleComplete && isComplete ? subtitleComplete : subtitle;
106
+ var IconComponent = IconComplete && isComplete ? IconComplete : Icon;
107
+ var renderTitleString = function () {
108
+ return (React__default['default'].createElement(React__default['default'].Fragment, null, SIZES[size] > 64 ? (React__default['default'].createElement(coreComponentsTypography.Typography.TitleMobile, { className: cn__default['default'](styles__default['default'].typography, styles__default['default'].title), color: isCompleteTextColor ? completeTextColor : contentColor, tag: 'div', font: 'system', view: VIEW_TITLE[size] }, titleContent)) : (React__default['default'].createElement(coreComponentsTypography.Typography.Text, { className: styles__default['default'].title, color: isCompleteTextColor ? completeTextColor : contentColor, tag: 'div', weight: 'bold', view: VIEW_TEXT[size] }, titleContent))));
109
+ };
110
+ var renderTitle = function () { return (typeof title === 'string' ? renderTitleString() : titleContent); };
111
+ var renderSubTitle = function () {
112
+ return typeof subtitle === 'string' ? (React__default['default'].createElement(coreComponentsTypography.Typography.Text, { tag: 'div', className: styles__default['default'].subtitle, color: isCompleteTextColor ? completeTextColor : contentColor, view: 'primary-small' }, subtitleContent)) : (subtitleContent);
113
+ };
114
+ var renderIcon = function () {
115
+ var _a;
116
+ return (React__default['default'].createElement("span", { className: cn__default['default'](styles__default['default'].iconWrapper, styles__default['default'][size], styles__default['default'].tertiary, styles__default['default']["icon-" + contentColor], (_a = {},
117
+ _a[styles__default['default']["icon-" + completeIconColor]] = completeIconColor,
118
+ _a)) }, IconComponent && React__default['default'].createElement(IconComponent, { className: styles__default['default'].icon })));
119
+ };
120
+ var renderContent = function () {
121
+ return Icon || (IconComplete && isComplete) ? (renderIcon()) : (React__default['default'].createElement(React__default['default'].Fragment, null,
122
+ SIZES[size] > 24 && renderTitle(),
123
+ SIZES[size] > 64 && renderSubTitle()));
124
+ };
125
+ return (React__default['default'].createElement("div", { className: cn__default['default'](styles__default['default'].component, styles__default['default'][size], className), style: __assign({}, (height && { height: height, width: height })), "data-test-id": dataTestId },
126
+ React__default['default'].createElement("svg", { viewBox: "0 0 " + memorized.widthSVG + " " + memorized.heightSVG, className: styles__default['default'].svg, xmlns: 'http://www.w3.org/2000/svg' },
127
+ React__default['default'].createElement("circle", { className: cn__default['default'](styles__default['default'].backgroundCircle, styles__default['default'][size], (_b = {},
128
+ _b[styles__default['default'].stroke] = !stroke,
129
+ _b)), cx: memorized.center, cy: memorized.center, r: memorized.radius, strokeWidth: STROKE[size] }),
130
+ React__default['default'].createElement("circle", { className: cn__default['default'](styles__default['default'].progressCircle, styles__default['default'][view], styles__default['default'][size], (_c = {},
131
+ _c[styles__default['default']["bg-" + view]] = fillComplete && isComplete,
132
+ _c)), cx: memorized.center, cy: memorized.center, r: memorized.radius, strokeWidth: STROKE[size], strokeDasharray: memorized.strokeDasharray, strokeDashoffset: direction === 'counter-clockwise'
133
+ ? -memorized.strokeDashoffset
134
+ : memorized.strokeDashoffset, transform: "rotate(" + -90 + " " + memorized.center + " " + memorized.center + ")" })),
135
+ React__default['default'].createElement("div", { className: cn__default['default'](styles__default['default'].labelWrapper, (_d = {},
136
+ _d[styles__default['default'].label] = Icon || IconComplete,
137
+ _d)) }, children || renderContent())));
138
+ };
139
+
140
+ exports.CircularProgressBar = CircularProgressBar;
File without changes
@@ -2,11 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var Component = require('./Component.js');
5
6
  require('classnames');
6
7
  require('react');
7
- require('@alfalab/core-components-typography/dist/cssm');
8
+ require('@alfalab/core-components-typography/cssm');
8
9
  require('./index.module.css');
9
- var Component = require('./Component.js');
10
10
 
11
11
 
12
12