@instructure/ui-progress 11.6.0 → 11.6.1-snapshot-129

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 (97) hide show
  1. package/CHANGELOG.md +37 -294
  2. package/es/ProgressBar/{index.js → v1/index.js} +2 -2
  3. package/es/ProgressBar/v2/index.js +130 -0
  4. package/{src/index.ts → es/ProgressBar/v2/props.js} +2 -5
  5. package/es/ProgressBar/v2/styles.js +237 -0
  6. package/es/ProgressCircle/{index.js → v1/index.js} +2 -2
  7. package/es/ProgressCircle/v2/index.js +173 -0
  8. package/es/ProgressCircle/v2/props.js +26 -0
  9. package/es/ProgressCircle/v2/styles.js +349 -0
  10. package/es/{index.js → exports/a.js} +2 -2
  11. package/es/exports/b.js +25 -0
  12. package/lib/ProgressBar/{index.js → v1/index.js} +3 -3
  13. package/lib/ProgressBar/v2/index.js +136 -0
  14. package/lib/ProgressBar/v2/props.js +31 -0
  15. package/lib/ProgressBar/v2/styles.js +243 -0
  16. package/lib/ProgressCircle/{index.js → v1/index.js} +3 -3
  17. package/lib/ProgressCircle/v2/index.js +179 -0
  18. package/lib/ProgressCircle/v2/props.js +31 -0
  19. package/lib/ProgressCircle/v2/styles.js +355 -0
  20. package/lib/{index.js → exports/a.js} +4 -4
  21. package/lib/exports/b.js +19 -0
  22. package/package.json +40 -18
  23. package/src/ProgressBar/{index.tsx → v1/index.tsx} +2 -2
  24. package/src/ProgressBar/v2/README.md +384 -0
  25. package/src/ProgressBar/v2/index.tsx +142 -0
  26. package/src/ProgressBar/v2/props.ts +155 -0
  27. package/src/ProgressBar/v2/styles.ts +221 -0
  28. package/src/ProgressCircle/{index.tsx → v1/index.tsx} +2 -2
  29. package/src/ProgressCircle/v2/README.md +219 -0
  30. package/src/ProgressCircle/v2/index.tsx +196 -0
  31. package/src/ProgressCircle/v2/props.ts +141 -0
  32. package/src/ProgressCircle/v2/styles.ts +343 -0
  33. package/src/exports/a.ts +29 -0
  34. package/src/exports/b.ts +29 -0
  35. package/tsconfig.build.tsbuildinfo +1 -1
  36. package/types/ProgressBar/v1/index.d.ts.map +1 -0
  37. package/types/ProgressBar/v1/props.d.ts.map +1 -0
  38. package/types/ProgressBar/v1/styles.d.ts.map +1 -0
  39. package/types/ProgressBar/v1/theme.d.ts.map +1 -0
  40. package/types/ProgressBar/v2/index.d.ts +43 -0
  41. package/types/ProgressBar/v2/index.d.ts.map +1 -0
  42. package/types/ProgressBar/v2/props.d.ts +77 -0
  43. package/types/ProgressBar/v2/props.d.ts.map +1 -0
  44. package/types/ProgressBar/v2/styles.d.ts +15 -0
  45. package/types/ProgressBar/v2/styles.d.ts.map +1 -0
  46. package/types/ProgressCircle/v1/index.d.ts.map +1 -0
  47. package/types/ProgressCircle/v1/props.d.ts.map +1 -0
  48. package/types/ProgressCircle/v1/styles.d.ts.map +1 -0
  49. package/types/ProgressCircle/v1/theme.d.ts.map +1 -0
  50. package/types/ProgressCircle/v2/index.d.ts +49 -0
  51. package/types/ProgressCircle/v2/index.d.ts.map +1 -0
  52. package/types/ProgressCircle/v2/props.d.ts +75 -0
  53. package/types/ProgressCircle/v2/props.d.ts.map +1 -0
  54. package/types/ProgressCircle/v2/styles.d.ts +15 -0
  55. package/types/ProgressCircle/v2/styles.d.ts.map +1 -0
  56. package/types/exports/a.d.ts +5 -0
  57. package/types/exports/a.d.ts.map +1 -0
  58. package/types/exports/b.d.ts +5 -0
  59. package/types/exports/b.d.ts.map +1 -0
  60. package/types/ProgressBar/index.d.ts.map +0 -1
  61. package/types/ProgressBar/props.d.ts.map +0 -1
  62. package/types/ProgressBar/styles.d.ts.map +0 -1
  63. package/types/ProgressBar/theme.d.ts.map +0 -1
  64. package/types/ProgressCircle/index.d.ts.map +0 -1
  65. package/types/ProgressCircle/props.d.ts.map +0 -1
  66. package/types/ProgressCircle/styles.d.ts.map +0 -1
  67. package/types/ProgressCircle/theme.d.ts.map +0 -1
  68. package/types/index.d.ts +0 -5
  69. package/types/index.d.ts.map +0 -1
  70. /package/es/ProgressBar/{props.js → v1/props.js} +0 -0
  71. /package/es/ProgressBar/{styles.js → v1/styles.js} +0 -0
  72. /package/es/ProgressBar/{theme.js → v1/theme.js} +0 -0
  73. /package/es/ProgressCircle/{props.js → v1/props.js} +0 -0
  74. /package/es/ProgressCircle/{styles.js → v1/styles.js} +0 -0
  75. /package/es/ProgressCircle/{theme.js → v1/theme.js} +0 -0
  76. /package/lib/ProgressBar/{props.js → v1/props.js} +0 -0
  77. /package/lib/ProgressBar/{styles.js → v1/styles.js} +0 -0
  78. /package/lib/ProgressBar/{theme.js → v1/theme.js} +0 -0
  79. /package/lib/ProgressCircle/{props.js → v1/props.js} +0 -0
  80. /package/lib/ProgressCircle/{styles.js → v1/styles.js} +0 -0
  81. /package/lib/ProgressCircle/{theme.js → v1/theme.js} +0 -0
  82. /package/src/ProgressBar/{README.md → v1/README.md} +0 -0
  83. /package/src/ProgressBar/{props.ts → v1/props.ts} +0 -0
  84. /package/src/ProgressBar/{styles.ts → v1/styles.ts} +0 -0
  85. /package/src/ProgressBar/{theme.ts → v1/theme.ts} +0 -0
  86. /package/src/ProgressCircle/{README.md → v1/README.md} +0 -0
  87. /package/src/ProgressCircle/{props.ts → v1/props.ts} +0 -0
  88. /package/src/ProgressCircle/{styles.ts → v1/styles.ts} +0 -0
  89. /package/src/ProgressCircle/{theme.ts → v1/theme.ts} +0 -0
  90. /package/types/ProgressBar/{index.d.ts → v1/index.d.ts} +0 -0
  91. /package/types/ProgressBar/{props.d.ts → v1/props.d.ts} +0 -0
  92. /package/types/ProgressBar/{styles.d.ts → v1/styles.d.ts} +0 -0
  93. /package/types/ProgressBar/{theme.d.ts → v1/theme.d.ts} +0 -0
  94. /package/types/ProgressCircle/{index.d.ts → v1/index.d.ts} +0 -0
  95. /package/types/ProgressCircle/{props.d.ts → v1/props.d.ts} +0 -0
  96. /package/types/ProgressCircle/{styles.d.ts → v1/styles.d.ts} +0 -0
  97. /package/types/ProgressCircle/{theme.d.ts → v1/theme.d.ts} +0 -0
@@ -0,0 +1,243 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ /*
8
+ * The MIT License (MIT)
9
+ *
10
+ * Copyright (c) 2015 - present Instructure, Inc.
11
+ *
12
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ * of this software and associated documentation files (the "Software"), to deal
14
+ * in the Software without restriction, including without limitation the rights
15
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ * copies of the Software, and to permit persons to whom the Software is
17
+ * furnished to do so, subject to the following conditions:
18
+ *
19
+ * The above copyright notice and this permission notice shall be included in all
20
+ * copies or substantial portions of the Software.
21
+ *
22
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ * SOFTWARE.
29
+ */
30
+
31
+ /**
32
+ * ---
33
+ * private: true
34
+ * ---
35
+ * Generates the style object from the theme and provided additional information
36
+ * @param {Object} componentTheme The theme variable object.
37
+ * @param {Object} props the props of the component, the style is applied to
38
+ * @param {Object} sharedTokens Shared token object that stores common values for the theme.
39
+ * @return {Object} The final style object, which will be used in the component
40
+ */
41
+ const generateStyle = (componentTheme, props, _sharedTokens) => {
42
+ const _props$valueNow = props.valueNow,
43
+ valueNow = _props$valueNow === void 0 ? 0 : _props$valueNow,
44
+ _props$valueMax = props.valueMax,
45
+ valueMax = _props$valueMax === void 0 ? 100 : _props$valueMax,
46
+ size = props.size,
47
+ color = props.color,
48
+ meterColor = props.meterColor,
49
+ shouldAnimate = props.shouldAnimate;
50
+ const meterColorClassName = typeof meterColor === 'function' ? meterColor({
51
+ valueNow,
52
+ valueMax
53
+ }) : meterColor;
54
+ const currentValue = valueNow > valueMax ? valueMax : valueNow < 0 ? 0 : valueNow;
55
+ const currentValuePercent = `${currentValue / valueMax * 100}%`;
56
+ const sizeVariants = {
57
+ 'x-small': {
58
+ track: {
59
+ height: componentTheme.xSmallHeight
60
+ },
61
+ value: {
62
+ fontSize: componentTheme.xSmallValueFontSize
63
+ }
64
+ },
65
+ small: {
66
+ track: {
67
+ height: componentTheme.smallHeight
68
+ },
69
+ // product design wants = 18px
70
+ value: {
71
+ fontSize: componentTheme.smallValueFontSize
72
+ }
73
+ },
74
+ medium: {
75
+ track: {
76
+ height: componentTheme.mediumHeight
77
+ },
78
+ value: {
79
+ fontSize: componentTheme.mediumValueFontSize
80
+ }
81
+ },
82
+ large: {
83
+ track: {
84
+ height: componentTheme.largeHeight
85
+ },
86
+ value: {
87
+ fontSize: componentTheme.largeValueFontSize
88
+ }
89
+ }
90
+ };
91
+ const colorVariants = {
92
+ primary: {
93
+ trackLayout: {
94
+ background: componentTheme.trackColor,
95
+ borderWidth: componentTheme.trackBottomBorderWidth,
96
+ borderStyle: 'solid',
97
+ borderColor: componentTheme.borderColor
98
+ },
99
+ trackBorder: {
100
+ borderBottomColor: componentTheme.trackBottomBorderColor
101
+ },
102
+ value: {
103
+ color: componentTheme.textColor
104
+ },
105
+ htmlProgress: {
106
+ borderColor: componentTheme.borderColor
107
+ }
108
+ },
109
+ 'primary-inverse': {
110
+ trackLayout: {
111
+ background: componentTheme.trackColorInverse,
112
+ borderWidth: componentTheme.trackBottomBorderWidth,
113
+ borderStyle: 'solid',
114
+ borderColor: componentTheme.borderColorInverse
115
+ },
116
+ trackBorder: {
117
+ borderBottomColor: componentTheme.trackBottomBorderColorInverse
118
+ },
119
+ value: {
120
+ color: componentTheme.textColorInverse
121
+ },
122
+ htmlProgress: {
123
+ borderColor: componentTheme.borderColorInverse
124
+ }
125
+ }
126
+ };
127
+ const trackBackgroundVariants = {
128
+ primary: {
129
+ brand: {
130
+ background: componentTheme.meterColorBrand
131
+ },
132
+ info: {
133
+ background: componentTheme.meterColorInfo
134
+ },
135
+ success: {
136
+ background: componentTheme.meterColorSuccess
137
+ },
138
+ danger: {
139
+ background: componentTheme.meterColorDanger
140
+ },
141
+ warning: {
142
+ background: componentTheme.meterColorWarning
143
+ },
144
+ alert: {
145
+ background: componentTheme.meterColorAlert
146
+ }
147
+ },
148
+ 'primary-inverse': {
149
+ brand: {
150
+ background: componentTheme.meterColorBrandInverse
151
+ },
152
+ info: {
153
+ background: componentTheme.meterColorInfoInverse
154
+ },
155
+ success: {
156
+ background: componentTheme.meterColorSuccessInverse
157
+ },
158
+ danger: {
159
+ background: componentTheme.meterColorDangerInverse
160
+ },
161
+ warning: {
162
+ background: componentTheme.meterColorWarningInverse
163
+ },
164
+ alert: {
165
+ background: componentTheme.meterColorAlertInverse
166
+ }
167
+ }
168
+ };
169
+ return {
170
+ progressBar: {
171
+ label: 'progressBar',
172
+ display: 'flex',
173
+ alignItems: 'center',
174
+ fontFamily: componentTheme.fontFamily,
175
+ fontWeight: componentTheme.fontWeight,
176
+ lineHeight: componentTheme.lineHeight,
177
+ fontSize: componentTheme.fontSize,
178
+ borderRadius: componentTheme.borderRadius
179
+ },
180
+ trackLayout: {
181
+ label: 'progressBar__trackLayout',
182
+ position: 'relative',
183
+ flex: 1,
184
+ borderRadius: 'inherit',
185
+ ...colorVariants[color].trackLayout
186
+ },
187
+ track: {
188
+ label: 'progressBar__track',
189
+ display: 'block',
190
+ boxSizing: 'border-box',
191
+ width: '100%',
192
+ borderBottomWidth: componentTheme.trackBottomBorderWidth,
193
+ borderBottomStyle: 'solid',
194
+ background: 'transparent',
195
+ // Inner border-radius must be smaller than outer to avoid geometric gaps with nested rounded borders
196
+ // Formula: inner radius = outer radius - border width
197
+ borderTopLeftRadius: `calc(${componentTheme.borderRadius} - ${componentTheme.trackBottomBorderWidth})`,
198
+ borderBottomLeftRadius: `calc(${componentTheme.borderRadius} - ${componentTheme.trackBottomBorderWidth})`,
199
+ // Negative margin pulls track down so trackLayout's full border overlaps and hides track's bottom border.
200
+ // When trackLayout border is visible (light/dark themes), it creates a clean full border appearance.
201
+ // When trackLayout border is transparent (legacy Canvas), track's bottom border remains visible.
202
+ marginBottom: `calc(-1 * ${componentTheme.trackBottomBorderWidth})`,
203
+ ...sizeVariants[size].track,
204
+ ...colorVariants[color].trackBorder
205
+ },
206
+ trackValue: {
207
+ label: 'progressBar__trackValue',
208
+ display: 'block',
209
+ boxSizing: 'border-box',
210
+ height: '100%',
211
+ width: currentValuePercent,
212
+ maxWidth: '100%',
213
+ borderRadius: 'inherit',
214
+ ...(shouldAnimate && {
215
+ transition: 'all 0.5s'
216
+ }),
217
+ ...(meterColorClassName && trackBackgroundVariants[color][meterColorClassName])
218
+ },
219
+ value: {
220
+ label: 'progressBar__value',
221
+ lineHeight: 1,
222
+ boxSizing: 'border-box',
223
+ paddingInlineStart: componentTheme.valuePadding,
224
+ flex: '0 0 5.625rem',
225
+ ...sizeVariants[size].value,
226
+ ...colorVariants[color].value
227
+ },
228
+ htmlProgress: {
229
+ label: 'progressBar__htmlProgress',
230
+ display: 'block',
231
+ position: 'absolute',
232
+ top: '0',
233
+ left: '0',
234
+ width: '100%',
235
+ height: '100%',
236
+ boxSizing: 'border-box',
237
+ zIndex: -1,
238
+ opacity: 0,
239
+ ...colorVariants[color].htmlProgress
240
+ }
241
+ };
242
+ };
243
+ var _default = exports.default = generateStyle;
@@ -8,7 +8,7 @@ exports.default = exports.ProgressCircle = void 0;
8
8
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
9
9
  var _react = require("react");
10
10
  var _ScreenReaderContent = require("@instructure/ui-a11y-content/lib/ScreenReaderContent");
11
- var _View = require("@instructure/ui-view/lib/View");
11
+ var _v11_ = require("@instructure/ui-view/v11_6");
12
12
  var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
13
13
  var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
14
14
  var _emotion = require("@instructure/emotion");
@@ -46,7 +46,7 @@ var _dec, _class, _ProgressCircle;
46
46
  category: components
47
47
  ---
48
48
  **/
49
- let ProgressCircle = exports.ProgressCircle = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_ProgressCircle = class ProgressCircle extends _react.Component {
49
+ let ProgressCircle = exports.ProgressCircle = (_dec = (0, _emotion.withStyleLegacy)(_styles.default, _theme.default), _dec(_class = (_ProgressCircle = class ProgressCircle extends _react.Component {
50
50
  constructor(props) {
51
51
  super(props);
52
52
  this._timeouts = [];
@@ -113,7 +113,7 @@ let ProgressCircle = exports.ProgressCircle = (_dec = (0, _emotion.withStyle)(_s
113
113
  const style = {
114
114
  strokeDashoffset: `${styles === null || styles === void 0 ? void 0 : styles.dashOffset}em`
115
115
  };
116
- return (0, _jsxRuntime.jsxs)(_View.View, {
116
+ return (0, _jsxRuntime.jsxs)(_v11_.View, {
117
117
  ...(0, _passthroughProps.passthroughProps)(props),
118
118
  as: this.props.as,
119
119
  elementRef: this.handleRef,
@@ -0,0 +1,179 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = exports.ProgressCircle = void 0;
8
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
9
+ var _react = require("react");
10
+ var _ScreenReaderContent = require("@instructure/ui-a11y-content/lib/ScreenReaderContent");
11
+ var _latest = require("@instructure/ui-view/latest");
12
+ var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
13
+ var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
14
+ var _emotion = require("@instructure/emotion");
15
+ var _styles = _interopRequireDefault(require("./styles"));
16
+ var _props = require("./props");
17
+ var _jsxRuntime = require("@emotion/react/jsx-runtime");
18
+ const _excluded = ["color", "renderValue", "formatScreenReaderValue", "meterColor", "valueNow", "valueMax", "screenReaderLabel", "size", "styles"];
19
+ var _dec, _class, _ProgressCircle;
20
+ /*
21
+ * The MIT License (MIT)
22
+ *
23
+ * Copyright (c) 2015 - present Instructure, Inc.
24
+ *
25
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
26
+ * of this software and associated documentation files (the "Software"), to deal
27
+ * in the Software without restriction, including without limitation the rights
28
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
29
+ * copies of the Software, and to permit persons to whom the Software is
30
+ * furnished to do so, subject to the following conditions:
31
+ *
32
+ * The above copyright notice and this permission notice shall be included in all
33
+ * copies or substantial portions of the Software.
34
+ *
35
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
36
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
37
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
38
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
39
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
40
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
41
+ * SOFTWARE.
42
+ */
43
+ /**
44
+ ---
45
+ category: components
46
+ ---
47
+ **/
48
+ let ProgressCircle = exports.ProgressCircle = (_dec = (0, _emotion.withStyle)(_styles.default), _dec(_class = (_ProgressCircle = class ProgressCircle extends _react.Component {
49
+ constructor(props) {
50
+ super(props);
51
+ this._timeouts = [];
52
+ this.ref = null;
53
+ this.handleRef = el => {
54
+ const elementRef = this.props.elementRef;
55
+ this.ref = el;
56
+ if (typeof elementRef === 'function') {
57
+ elementRef(el);
58
+ }
59
+ };
60
+ this.state = {
61
+ shouldAnimateOnMount: props.shouldAnimateOnMount
62
+ };
63
+ }
64
+ get makeStylesVariables() {
65
+ return {
66
+ shouldAnimateOnMount: this.state.shouldAnimateOnMount
67
+ };
68
+ }
69
+ componentDidMount() {
70
+ var _this$props$makeStyle, _this$props;
71
+ if (this.state.shouldAnimateOnMount) {
72
+ this._timeouts.push(setTimeout(() => {
73
+ this.setState({
74
+ shouldAnimateOnMount: false
75
+ });
76
+ }, this.props.animationDelay || 500));
77
+ }
78
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, this.makeStylesVariables);
79
+ }
80
+ componentDidUpdate() {
81
+ var _this$props$makeStyle2, _this$props2;
82
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, this.makeStylesVariables);
83
+ }
84
+ componentWillUnmount() {
85
+ this._timeouts.forEach(timeout => clearTimeout(timeout));
86
+ }
87
+ render() {
88
+ var _styles$radii, _styles$radii2, _styles$radii3;
89
+ const _this$props3 = this.props,
90
+ color = _this$props3.color,
91
+ renderValue = _this$props3.renderValue,
92
+ formatScreenReaderValue = _this$props3.formatScreenReaderValue,
93
+ meterColor = _this$props3.meterColor,
94
+ valueNow = _this$props3.valueNow,
95
+ valueMax = _this$props3.valueMax,
96
+ screenReaderLabel = _this$props3.screenReaderLabel,
97
+ size = _this$props3.size,
98
+ styles = _this$props3.styles,
99
+ props = (0, _objectWithoutProperties2.default)(_this$props3, _excluded);
100
+ const valueText = typeof formatScreenReaderValue === 'function' ? formatScreenReaderValue({
101
+ valueNow: valueNow,
102
+ valueMax: valueMax
103
+ }) : void 0;
104
+ // consolidating the label and aria-valuetext to put in aria-label because
105
+ // NVDA does not read aria-valuetext: https://github.com/nvaccess/nvda/issues/913
106
+ // But leaving aria-valuetext because JAWS ignores aria-label
107
+ const labelAndValueText = `${screenReaderLabel} ${valueText}`;
108
+ const value = (0, _callRenderProp.callRenderProp)(renderValue, {
109
+ valueNow: valueNow,
110
+ valueMax: valueMax
111
+ });
112
+ const style = {
113
+ strokeDashoffset: `${styles === null || styles === void 0 ? void 0 : styles.dashOffset}em`
114
+ };
115
+ return (0, _jsxRuntime.jsxs)(_latest.View, {
116
+ ...(0, _passthroughProps.passthroughProps)(props),
117
+ as: this.props.as,
118
+ elementRef: this.handleRef,
119
+ css: styles === null || styles === void 0 ? void 0 : styles.progressCircle,
120
+ margin: this.props.margin,
121
+ "data-cid": "ProgressCircle",
122
+ children: [(0, _jsxRuntime.jsx)(_ScreenReaderContent.ScreenReaderContent, {
123
+ children: (0, _jsxRuntime.jsx)("progress", {
124
+ max: valueMax,
125
+ value: valueNow,
126
+ "aria-valuetext": labelAndValueText
127
+ })
128
+ }), value && (0, _jsxRuntime.jsx)("span", {
129
+ css: styles === null || styles === void 0 ? void 0 : styles.center,
130
+ "aria-hidden": "true",
131
+ children: (0, _jsxRuntime.jsx)("span", {
132
+ css: styles === null || styles === void 0 ? void 0 : styles.value,
133
+ children: value
134
+ })
135
+ }), (0, _jsxRuntime.jsxs)("svg", {
136
+ css: styles === null || styles === void 0 ? void 0 : styles.circle,
137
+ role: "presentation",
138
+ focusable: "false",
139
+ children: [(0, _jsxRuntime.jsx)("circle", {
140
+ css: styles === null || styles === void 0 ? void 0 : styles.track,
141
+ role: "presentation",
142
+ cx: "50%",
143
+ cy: "50%",
144
+ r: styles === null || styles === void 0 ? void 0 : (_styles$radii = styles.radii) === null || _styles$radii === void 0 ? void 0 : _styles$radii.radius
145
+ }), (0, _jsxRuntime.jsx)("circle", {
146
+ css: styles === null || styles === void 0 ? void 0 : styles.border,
147
+ role: "presentation",
148
+ cx: "50%",
149
+ cy: "50%",
150
+ r: styles === null || styles === void 0 ? void 0 : (_styles$radii2 = styles.radii) === null || _styles$radii2 === void 0 ? void 0 : _styles$radii2.borderOffsetRadius
151
+ }), (0, _jsxRuntime.jsx)("circle", {
152
+ css: styles === null || styles === void 0 ? void 0 : styles.meter,
153
+ role: "presentation",
154
+ style: style,
155
+ cx: "50%",
156
+ cy: "50%",
157
+ r: styles === null || styles === void 0 ? void 0 : (_styles$radii3 = styles.radii) === null || _styles$radii3 === void 0 ? void 0 : _styles$radii3.radius
158
+ })]
159
+ })]
160
+ });
161
+ }
162
+ }, _ProgressCircle.displayName = "ProgressCircle", _ProgressCircle.componentId = 'ProgressCircle', _ProgressCircle.allowedProps = _props.allowedProps, _ProgressCircle.defaultProps = {
163
+ formatScreenReaderValue: ({
164
+ valueNow,
165
+ valueMax
166
+ }) => `${valueNow} / ${valueMax}`,
167
+ size: 'medium',
168
+ valueMax: 100,
169
+ valueNow: 0,
170
+ as: 'div',
171
+ color: 'primary',
172
+ shouldAnimateOnMount: false,
173
+ // default to showing `success` color on completion
174
+ meterColor: ({
175
+ valueNow,
176
+ valueMax
177
+ }) => valueNow / valueMax >= 1 ? 'success' : 'brand'
178
+ }, _ProgressCircle)) || _class);
179
+ var _default = exports.default = ProgressCircle;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.allowedProps = void 0;
7
+ /*
8
+ * The MIT License (MIT)
9
+ *
10
+ * Copyright (c) 2015 - present Instructure, Inc.
11
+ *
12
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ * of this software and associated documentation files (the "Software"), to deal
14
+ * in the Software without restriction, including without limitation the rights
15
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ * copies of the Software, and to permit persons to whom the Software is
17
+ * furnished to do so, subject to the following conditions:
18
+ *
19
+ * The above copyright notice and this permission notice shall be included in all
20
+ * copies or substantial portions of the Software.
21
+ *
22
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ * SOFTWARE.
29
+ */
30
+
31
+ const allowedProps = exports.allowedProps = ['screenReaderLabel', 'size', 'valueMax', 'valueNow', 'formatScreenReaderValue', 'renderValue', 'color', 'meterColor', 'margin', 'elementRef', 'as', 'shouldAnimateOnMount', 'animationDelay'];