@instructure/ui-progress 11.7.8 → 11.7.9-pr-snapshot-1792147648392
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 +13 -0
- package/es/ProgressBar/v1/index.js +90 -123
- package/es/ProgressBar/v1/props.js +15 -26
- package/es/ProgressBar/v1/styles.js +167 -209
- package/es/ProgressBar/v1/theme.js +55 -93
- package/es/ProgressBar/v2/index.js +90 -123
- package/es/ProgressBar/v2/props.js +15 -26
- package/es/ProgressBar/v2/styles.js +188 -235
- package/es/ProgressCircle/v1/index.js +128 -165
- package/es/ProgressCircle/v1/props.js +16 -26
- package/es/ProgressCircle/v1/styles.js +291 -348
- package/es/ProgressCircle/v1/theme.js +88 -128
- package/es/ProgressCircle/v2/index.js +128 -165
- package/es/ProgressCircle/v2/props.js +16 -26
- package/es/ProgressCircle/v2/styles.js +291 -348
- package/es/exports/a.js +1 -25
- package/es/exports/b.js +1 -25
- package/package.json +13 -19
- package/tsconfig.build.json +0 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/lib/ProgressBar/v1/index.js +0 -137
- package/lib/ProgressBar/v1/props.js +0 -31
- package/lib/ProgressBar/v1/styles.js +0 -216
- package/lib/ProgressBar/v1/theme.js +0 -100
- package/lib/ProgressBar/v2/index.js +0 -136
- package/lib/ProgressBar/v2/props.js +0 -31
- package/lib/ProgressBar/v2/styles.js +0 -242
- package/lib/ProgressCircle/v1/index.js +0 -182
- package/lib/ProgressCircle/v1/props.js +0 -31
- package/lib/ProgressCircle/v1/styles.js +0 -357
- package/lib/ProgressCircle/v1/theme.js +0 -146
- package/lib/ProgressCircle/v2/index.js +0 -181
- package/lib/ProgressCircle/v2/props.js +0 -31
- package/lib/ProgressCircle/v2/styles.js +0 -357
- package/lib/exports/a.js +0 -19
- package/lib/exports/b.js +0 -19
- package/lib/package.json +0 -1
|
@@ -1,140 +1,100 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* The MIT License (MIT)
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
-
*
|
|
6
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
* in the Software without restriction, including without limitation the rights
|
|
9
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
* furnished to do so, subject to the following conditions:
|
|
12
|
-
*
|
|
13
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
* copies or substantial portions of the Software.
|
|
15
|
-
*
|
|
16
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
* SOFTWARE.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
1
|
const radius = {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
2
|
+
xSmall: 1,
|
|
3
|
+
small: 1.8,
|
|
4
|
+
medium: 2.75,
|
|
5
|
+
large: 3.5
|
|
30
6
|
};
|
|
31
7
|
const size = {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
8
|
+
xSmall: 3,
|
|
9
|
+
small: 5,
|
|
10
|
+
medium: 7,
|
|
11
|
+
large: 9
|
|
36
12
|
};
|
|
37
13
|
const strokeWidth = {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
14
|
+
xSmall: 0.185,
|
|
15
|
+
small: 0.5,
|
|
16
|
+
medium: 0.625,
|
|
17
|
+
large: 0.875
|
|
42
18
|
};
|
|
43
|
-
|
|
44
|
-
// Necessary to get the 1px border line to go "under" the meter
|
|
45
|
-
// strokeWidth is divided in half because SVG strokeWidth is
|
|
46
|
-
// centered along the path of the stroke, unlike CSS
|
|
47
19
|
const borderWidth = 0.0625;
|
|
48
20
|
const borderOffsetRadius = {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
21
|
+
xSmall: radius.xSmall - strokeWidth.xSmall / 2 + borderWidth,
|
|
22
|
+
small: radius.small - strokeWidth.small / 2 + borderWidth,
|
|
23
|
+
medium: radius.medium - strokeWidth.medium / 2 + borderWidth,
|
|
24
|
+
large: radius.large - strokeWidth.large / 2 + borderWidth
|
|
53
25
|
};
|
|
54
|
-
const circumference = function
|
|
55
|
-
|
|
26
|
+
const circumference = function(r) {
|
|
27
|
+
return (2 * Math.PI * r).toFixed(3);
|
|
56
28
|
};
|
|
57
|
-
const transform = function
|
|
58
|
-
|
|
29
|
+
const transform = function(s) {
|
|
30
|
+
return s / 2;
|
|
59
31
|
};
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
meterColorSuccessInverse: colors?.contrasts?.green4570,
|
|
128
|
-
meterColorDanger: colors?.contrasts?.red4570,
|
|
129
|
-
meterColorDangerInverse: colors?.contrasts?.red4570,
|
|
130
|
-
meterColorAlert: colors?.contrasts?.blue4570,
|
|
131
|
-
meterColorAlertInverse: colors?.contrasts?.blue4570,
|
|
132
|
-
meterColorWarning: colors?.contrasts?.orange4570,
|
|
133
|
-
meterColorWarningInverse: colors?.contrasts?.orange4570
|
|
134
|
-
};
|
|
135
|
-
return {
|
|
136
|
-
...componentVariables,
|
|
137
|
-
...themeSpecificStyle[themeName]
|
|
138
|
-
};
|
|
32
|
+
const generateComponentTheme = (theme)=>{
|
|
33
|
+
const { colors, typography, key: themeName } = theme;
|
|
34
|
+
const themeSpecificStyle = {
|
|
35
|
+
canvas: {
|
|
36
|
+
color: theme['ic-brand-font-color-dark'],
|
|
37
|
+
meterColorBrand: theme['ic-brand-primary']
|
|
38
|
+
},
|
|
39
|
+
'canvas-high-contrast': {
|
|
40
|
+
meterColorBrandInverse: colors?.contrasts?.white1010,
|
|
41
|
+
meterColorSuccessInverse: colors?.contrasts?.white1010,
|
|
42
|
+
meterColorInfoInverse: colors?.contrasts?.white1010,
|
|
43
|
+
meterColorAlertInverse: colors?.contrasts?.white1010,
|
|
44
|
+
meterColorWarningInverse: colors?.contrasts?.white1010,
|
|
45
|
+
meterColorDangerInverse: colors?.contrasts?.white1010
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
const componentVariables = {
|
|
49
|
+
fontFamily: typography?.fontFamily,
|
|
50
|
+
fontWeight: typography?.fontWeightNormal,
|
|
51
|
+
lineHeight: typography?.lineHeightCondensed,
|
|
52
|
+
xSmallSize: `${size.xSmall}em`,
|
|
53
|
+
xSmallRadius: `${radius.xSmall}em`,
|
|
54
|
+
xSmallCircumference: `${circumference(radius.xSmall)}em`,
|
|
55
|
+
xSmallTransform: `${transform(size.xSmall)}em`,
|
|
56
|
+
xSmallStrokeWidth: `${strokeWidth.xSmall}em`,
|
|
57
|
+
xSmallBorderOffset: `${borderOffsetRadius.xSmall}em`,
|
|
58
|
+
smallSize: `${size.small}em`,
|
|
59
|
+
smallRadius: `${radius.small}em`,
|
|
60
|
+
smallCircumference: `${circumference(radius.small)}em`,
|
|
61
|
+
smallTransform: `${transform(size.small)}em`,
|
|
62
|
+
smallStrokeWidth: `${strokeWidth.small}em`,
|
|
63
|
+
smallBorderOffset: `${borderOffsetRadius.small}em`,
|
|
64
|
+
mediumSize: `${size.medium}em`,
|
|
65
|
+
mediumRadius: `${radius.medium}em`,
|
|
66
|
+
mediumCircumference: `${circumference(radius.medium)}em`,
|
|
67
|
+
mediumTransform: `${transform(size.medium)}em`,
|
|
68
|
+
mediumStrokeWidth: `${strokeWidth.medium}em`,
|
|
69
|
+
mediumBorderOffset: `${borderOffsetRadius.medium}em`,
|
|
70
|
+
largeSize: `${size.large}em`,
|
|
71
|
+
largeRadius: `${radius.large}em`,
|
|
72
|
+
largeCircumference: `${circumference(radius.large)}em`,
|
|
73
|
+
largeTransform: `${transform(size.large)}em`,
|
|
74
|
+
largeStrokeWidth: `${strokeWidth.large}em`,
|
|
75
|
+
largeBorderOffset: `${borderOffsetRadius.large}em`,
|
|
76
|
+
color: colors?.contrasts?.grey125125,
|
|
77
|
+
colorInverse: colors?.contrasts?.white1010,
|
|
78
|
+
trackColor: colors?.contrasts?.white1010,
|
|
79
|
+
trackColorInverse: 'transparent',
|
|
80
|
+
trackBorderColor: colors?.contrasts?.grey3045,
|
|
81
|
+
trackBorderColorInverse: colors?.contrasts?.white1010,
|
|
82
|
+
meterColorBrand: colors?.contrasts?.blue4570,
|
|
83
|
+
meterColorBrandInverse: colors?.contrasts?.blue4570,
|
|
84
|
+
meterColorInfo: colors?.contrasts?.blue4570,
|
|
85
|
+
meterColorInfoInverse: colors?.contrasts?.blue4570,
|
|
86
|
+
meterColorSuccess: colors?.contrasts?.green4570,
|
|
87
|
+
meterColorSuccessInverse: colors?.contrasts?.green4570,
|
|
88
|
+
meterColorDanger: colors?.contrasts?.red4570,
|
|
89
|
+
meterColorDangerInverse: colors?.contrasts?.red4570,
|
|
90
|
+
meterColorAlert: colors?.contrasts?.blue4570,
|
|
91
|
+
meterColorAlertInverse: colors?.contrasts?.blue4570,
|
|
92
|
+
meterColorWarning: colors?.contrasts?.orange4570,
|
|
93
|
+
meterColorWarningInverse: colors?.contrasts?.orange4570
|
|
94
|
+
};
|
|
95
|
+
return {
|
|
96
|
+
...componentVariables,
|
|
97
|
+
...themeSpecificStyle[themeName]
|
|
98
|
+
};
|
|
139
99
|
};
|
|
140
|
-
export default generateComponentTheme;
|
|
100
|
+
export default generateComponentTheme;
|
|
@@ -1,28 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* The MIT License (MIT)
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
6
|
-
*
|
|
7
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
-
* in the Software without restriction, including without limitation the rights
|
|
10
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
-
* furnished to do so, subject to the following conditions:
|
|
13
|
-
*
|
|
14
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
15
|
-
* copies or substantial portions of the Software.
|
|
16
|
-
*
|
|
17
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
-
* SOFTWARE.
|
|
24
|
-
*/
|
|
25
|
-
|
|
1
|
+
import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
26
3
|
import { Component } from 'react';
|
|
27
4
|
import { ScreenReaderContent } from '@instructure/ui-a11y-content';
|
|
28
5
|
import { View } from '@instructure/ui-view/latest';
|
|
@@ -30,147 +7,133 @@ import { callRenderProp, passthroughProps } from '@instructure/ui-react-utils';
|
|
|
30
7
|
import { withStyleNew } from '@instructure/emotion';
|
|
31
8
|
import generateStyle from './styles.js';
|
|
32
9
|
import { allowedProps } from './props.js';
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
shouldAnimateOnMount: props.shouldAnimateOnMount
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
handleRef = el => {
|
|
70
|
-
const {
|
|
71
|
-
elementRef
|
|
72
|
-
} = this.props;
|
|
73
|
-
this.ref = el;
|
|
74
|
-
if (typeof elementRef === 'function') {
|
|
75
|
-
elementRef(el);
|
|
10
|
+
class ProgressCircle extends Component {
|
|
11
|
+
static{
|
|
12
|
+
this.displayName = 'ProgressCircle';
|
|
13
|
+
}
|
|
14
|
+
static{
|
|
15
|
+
this.componentId = 'ProgressCircle';
|
|
16
|
+
}
|
|
17
|
+
static{
|
|
18
|
+
this.allowedProps = allowedProps;
|
|
19
|
+
}
|
|
20
|
+
static{
|
|
21
|
+
this.defaultProps = {
|
|
22
|
+
formatScreenReaderValue: ({ valueNow, valueMax })=>`${valueNow} / ${valueMax}`,
|
|
23
|
+
size: 'medium',
|
|
24
|
+
valueMax: 100,
|
|
25
|
+
valueNow: 0,
|
|
26
|
+
as: 'div',
|
|
27
|
+
color: 'primary',
|
|
28
|
+
shouldAnimateOnMount: false,
|
|
29
|
+
meterColor: ({ valueNow, valueMax })=>valueNow / valueMax >= 1 ? 'success' : 'brand'
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
constructor(props){
|
|
33
|
+
super(props), this._timeouts = [], this.ref = null, this.handleRef = (el)=>{
|
|
34
|
+
const { elementRef } = this.props;
|
|
35
|
+
this.ref = el;
|
|
36
|
+
if (typeof elementRef === 'function') {
|
|
37
|
+
elementRef(el);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
this.state = {
|
|
41
|
+
shouldAnimateOnMount: props.shouldAnimateOnMount
|
|
42
|
+
};
|
|
76
43
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
44
|
+
get makeStylesVariables() {
|
|
45
|
+
return {
|
|
46
|
+
shouldAnimateOnMount: this.state.shouldAnimateOnMount
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
componentDidMount() {
|
|
50
|
+
if (this.state.shouldAnimateOnMount) {
|
|
51
|
+
this._timeouts.push(setTimeout(()=>{
|
|
52
|
+
this.setState({
|
|
53
|
+
shouldAnimateOnMount: false
|
|
54
|
+
});
|
|
55
|
+
}, this.props.animationDelay || 500));
|
|
56
|
+
}
|
|
57
|
+
this.props.makeStyles?.(this.makeStylesVariables);
|
|
58
|
+
}
|
|
59
|
+
componentDidUpdate() {
|
|
60
|
+
this.props.makeStyles?.(this.makeStylesVariables);
|
|
61
|
+
}
|
|
62
|
+
componentWillUnmount() {
|
|
63
|
+
this._timeouts.forEach((timeout)=>clearTimeout(timeout));
|
|
64
|
+
}
|
|
65
|
+
render() {
|
|
66
|
+
const { color, renderValue, formatScreenReaderValue, meterColor, valueNow, valueMax, screenReaderLabel, size, styles, ...props } = this.props;
|
|
67
|
+
const valueText = typeof formatScreenReaderValue === 'function' ? formatScreenReaderValue({
|
|
68
|
+
valueNow: valueNow,
|
|
69
|
+
valueMax: valueMax
|
|
70
|
+
}) : undefined;
|
|
71
|
+
const labelAndValueText = `${screenReaderLabel} ${valueText}`;
|
|
72
|
+
const value = callRenderProp(renderValue, {
|
|
73
|
+
valueNow: valueNow,
|
|
74
|
+
valueMax: valueMax
|
|
75
|
+
});
|
|
76
|
+
const style = {
|
|
77
|
+
strokeDashoffset: `${styles?.dashOffset}em`
|
|
78
|
+
};
|
|
79
|
+
return /*#__PURE__*/ _jsxs(View, {
|
|
80
|
+
...passthroughProps(props),
|
|
81
|
+
as: this.props.as,
|
|
82
|
+
elementRef: this.handleRef,
|
|
83
|
+
css: styles?.progressCircle,
|
|
84
|
+
margin: this.props.margin,
|
|
85
|
+
"data-cid": "ProgressCircle",
|
|
86
|
+
children: [
|
|
87
|
+
/*#__PURE__*/ _jsx(ScreenReaderContent, {
|
|
88
|
+
children: /*#__PURE__*/ _jsx("progress", {
|
|
89
|
+
max: valueMax,
|
|
90
|
+
value: valueNow,
|
|
91
|
+
"aria-valuetext": labelAndValueText
|
|
92
|
+
})
|
|
93
|
+
}),
|
|
94
|
+
value && /*#__PURE__*/ _jsx("span", {
|
|
95
|
+
css: styles?.center,
|
|
96
|
+
"aria-hidden": "true",
|
|
97
|
+
children: /*#__PURE__*/ _jsx("span", {
|
|
98
|
+
css: styles?.value,
|
|
99
|
+
children: value
|
|
100
|
+
})
|
|
101
|
+
}),
|
|
102
|
+
/*#__PURE__*/ _jsxs("svg", {
|
|
103
|
+
css: styles?.circle,
|
|
104
|
+
role: "presentation",
|
|
105
|
+
focusable: "false",
|
|
106
|
+
children: [
|
|
107
|
+
/*#__PURE__*/ _jsx("circle", {
|
|
108
|
+
css: styles?.track,
|
|
109
|
+
role: "presentation",
|
|
110
|
+
cx: "50%",
|
|
111
|
+
cy: "50%",
|
|
112
|
+
r: styles?.radii?.radius
|
|
113
|
+
}),
|
|
114
|
+
/*#__PURE__*/ _jsx("circle", {
|
|
115
|
+
css: styles?.border,
|
|
116
|
+
role: "presentation",
|
|
117
|
+
cx: "50%",
|
|
118
|
+
cy: "50%",
|
|
119
|
+
r: styles?.radii?.borderOffsetRadius
|
|
120
|
+
}),
|
|
121
|
+
/*#__PURE__*/ _jsx("circle", {
|
|
122
|
+
css: styles?.meter,
|
|
123
|
+
role: "presentation",
|
|
124
|
+
style: style,
|
|
125
|
+
cx: "50%",
|
|
126
|
+
cy: "50%",
|
|
127
|
+
r: styles?.radii?.radius
|
|
128
|
+
})
|
|
129
|
+
]
|
|
130
|
+
})
|
|
131
|
+
]
|
|
88
132
|
});
|
|
89
|
-
}, this.props.animationDelay || 500));
|
|
90
133
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
componentWillUnmount() {
|
|
97
|
-
this._timeouts.forEach(timeout => clearTimeout(timeout));
|
|
98
|
-
}
|
|
99
|
-
render() {
|
|
100
|
-
const {
|
|
101
|
-
color,
|
|
102
|
-
renderValue,
|
|
103
|
-
formatScreenReaderValue,
|
|
104
|
-
meterColor,
|
|
105
|
-
valueNow,
|
|
106
|
-
valueMax,
|
|
107
|
-
screenReaderLabel,
|
|
108
|
-
size,
|
|
109
|
-
styles,
|
|
110
|
-
...props
|
|
111
|
-
} = this.props;
|
|
112
|
-
const valueText = typeof formatScreenReaderValue === 'function' ? formatScreenReaderValue({
|
|
113
|
-
valueNow: valueNow,
|
|
114
|
-
valueMax: valueMax
|
|
115
|
-
}) : undefined;
|
|
116
|
-
// consolidating the label and aria-valuetext to put in aria-label because
|
|
117
|
-
// NVDA does not read aria-valuetext: https://github.com/nvaccess/nvda/issues/913
|
|
118
|
-
// But leaving aria-valuetext because JAWS ignores aria-label
|
|
119
|
-
const labelAndValueText = `${screenReaderLabel} ${valueText}`;
|
|
120
|
-
const value = callRenderProp(renderValue, {
|
|
121
|
-
valueNow: valueNow,
|
|
122
|
-
valueMax: valueMax
|
|
123
|
-
});
|
|
124
|
-
const style = {
|
|
125
|
-
strokeDashoffset: `${styles?.dashOffset}em`
|
|
126
|
-
};
|
|
127
|
-
return _jsxs(View, {
|
|
128
|
-
...passthroughProps(props),
|
|
129
|
-
as: this.props.as,
|
|
130
|
-
elementRef: this.handleRef,
|
|
131
|
-
css: styles?.progressCircle,
|
|
132
|
-
margin: this.props.margin,
|
|
133
|
-
"data-cid": "ProgressCircle",
|
|
134
|
-
children: [_jsx(ScreenReaderContent, {
|
|
135
|
-
children: _jsx("progress", {
|
|
136
|
-
max: valueMax,
|
|
137
|
-
value: valueNow,
|
|
138
|
-
"aria-valuetext": labelAndValueText
|
|
139
|
-
})
|
|
140
|
-
}), value && _jsx("span", {
|
|
141
|
-
css: styles?.center,
|
|
142
|
-
"aria-hidden": "true",
|
|
143
|
-
children: _jsx("span", {
|
|
144
|
-
css: styles?.value,
|
|
145
|
-
children: value
|
|
146
|
-
})
|
|
147
|
-
}), _jsxs("svg", {
|
|
148
|
-
css: styles?.circle,
|
|
149
|
-
role: "presentation",
|
|
150
|
-
focusable: "false",
|
|
151
|
-
children: [_jsx("circle", {
|
|
152
|
-
css: styles?.track,
|
|
153
|
-
role: "presentation",
|
|
154
|
-
cx: "50%",
|
|
155
|
-
cy: "50%",
|
|
156
|
-
r: styles?.radii?.radius
|
|
157
|
-
}), _jsx("circle", {
|
|
158
|
-
css: styles?.border,
|
|
159
|
-
role: "presentation",
|
|
160
|
-
cx: "50%",
|
|
161
|
-
cy: "50%",
|
|
162
|
-
r: styles?.radii?.borderOffsetRadius
|
|
163
|
-
}), _jsx("circle", {
|
|
164
|
-
css: styles?.meter,
|
|
165
|
-
role: "presentation",
|
|
166
|
-
style: style,
|
|
167
|
-
cx: "50%",
|
|
168
|
-
cy: "50%",
|
|
169
|
-
r: styles?.radii?.radius
|
|
170
|
-
})]
|
|
171
|
-
})]
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
}) || _class);
|
|
134
|
+
}
|
|
135
|
+
ProgressCircle = _ts_decorate([
|
|
136
|
+
withStyleNew(generateStyle)
|
|
137
|
+
], ProgressCircle);
|
|
175
138
|
export default ProgressCircle;
|
|
176
|
-
export { ProgressCircle };
|
|
139
|
+
export { ProgressCircle };
|
|
@@ -1,26 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
* SOFTWARE.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
const allowedProps = ['screenReaderLabel', 'size', 'valueMax', 'valueNow', 'formatScreenReaderValue', 'renderValue', 'color', 'meterColor', 'margin', 'elementRef', 'as', 'shouldAnimateOnMount', 'animationDelay'];
|
|
26
|
-
export { allowedProps };
|
|
1
|
+
const allowedProps = [
|
|
2
|
+
'screenReaderLabel',
|
|
3
|
+
'size',
|
|
4
|
+
'valueMax',
|
|
5
|
+
'valueNow',
|
|
6
|
+
'formatScreenReaderValue',
|
|
7
|
+
'renderValue',
|
|
8
|
+
'color',
|
|
9
|
+
'meterColor',
|
|
10
|
+
'margin',
|
|
11
|
+
'elementRef',
|
|
12
|
+
'as',
|
|
13
|
+
'shouldAnimateOnMount',
|
|
14
|
+
'animationDelay'
|
|
15
|
+
];
|
|
16
|
+
export { allowedProps };
|