@instructure/ui-progress 11.7.10 → 11.7.11-pr-snapshot-1794841957152

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 (49) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/es/ProgressBar/v1/index.js +87 -123
  3. package/es/ProgressBar/v1/props.js +15 -26
  4. package/es/ProgressBar/v1/styles.js +167 -209
  5. package/es/ProgressBar/v1/theme.js +55 -93
  6. package/es/ProgressBar/v2/index.js +87 -123
  7. package/es/ProgressBar/v2/props.js +15 -26
  8. package/es/ProgressBar/v2/styles.js +188 -235
  9. package/es/ProgressCircle/v1/index.js +125 -165
  10. package/es/ProgressCircle/v1/props.js +16 -26
  11. package/es/ProgressCircle/v1/styles.js +291 -348
  12. package/es/ProgressCircle/v1/theme.js +88 -128
  13. package/es/ProgressCircle/v2/index.js +125 -165
  14. package/es/ProgressCircle/v2/props.js +16 -26
  15. package/es/ProgressCircle/v2/styles.js +291 -348
  16. package/es/exports/a.js +1 -25
  17. package/es/exports/b.js +1 -25
  18. package/package.json +13 -19
  19. package/src/ProgressBar/v1/index.tsx +7 -2
  20. package/src/ProgressBar/v2/index.tsx +4 -2
  21. package/src/ProgressCircle/v1/index.tsx +7 -2
  22. package/src/ProgressCircle/v2/index.tsx +4 -2
  23. package/tsconfig.build.json +0 -1
  24. package/tsconfig.build.tsbuildinfo +1 -1
  25. package/types/ProgressBar/v1/index.d.ts +3 -1
  26. package/types/ProgressBar/v1/index.d.ts.map +1 -1
  27. package/types/ProgressBar/v2/index.d.ts +3 -1
  28. package/types/ProgressBar/v2/index.d.ts.map +1 -1
  29. package/types/ProgressCircle/v1/index.d.ts +3 -1
  30. package/types/ProgressCircle/v1/index.d.ts.map +1 -1
  31. package/types/ProgressCircle/v2/index.d.ts +3 -1
  32. package/types/ProgressCircle/v2/index.d.ts.map +1 -1
  33. package/lib/ProgressBar/v1/index.js +0 -136
  34. package/lib/ProgressBar/v1/props.js +0 -31
  35. package/lib/ProgressBar/v1/styles.js +0 -216
  36. package/lib/ProgressBar/v1/theme.js +0 -100
  37. package/lib/ProgressBar/v2/index.js +0 -135
  38. package/lib/ProgressBar/v2/props.js +0 -31
  39. package/lib/ProgressBar/v2/styles.js +0 -242
  40. package/lib/ProgressCircle/v1/index.js +0 -181
  41. package/lib/ProgressCircle/v1/props.js +0 -31
  42. package/lib/ProgressCircle/v1/styles.js +0 -357
  43. package/lib/ProgressCircle/v1/theme.js +0 -146
  44. package/lib/ProgressCircle/v2/index.js +0 -180
  45. package/lib/ProgressCircle/v2/props.js +0 -31
  46. package/lib/ProgressCircle/v2/styles.js +0 -357
  47. package/lib/exports/a.js +0 -19
  48. package/lib/exports/b.js +0 -19
  49. package/lib/package.json +0 -1
@@ -1,28 +1,4 @@
1
- var _dec, _class;
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 { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
26
2
  import { Component } from 'react';
27
3
  import { ScreenReaderContent } from '@instructure/ui-a11y-content';
28
4
  import { View } from '@instructure/ui-view/v11_6';
@@ -31,147 +7,131 @@ import { withStyle } from '@instructure/emotion';
31
7
  import generateStyle from './styles.js';
32
8
  import generateComponentTheme from './theme.js';
33
9
  import { allowedProps } from './props.js';
34
-
35
- /**
36
- ---
37
- category: components
38
- ---
39
- **/
40
- import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
41
- let ProgressCircle = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = class ProgressCircle extends Component {
42
- static displayName = 'ProgressCircle';
43
- static componentId = 'ProgressCircle';
44
- static allowedProps = allowedProps;
45
- static defaultProps = {
46
- formatScreenReaderValue: ({
47
- valueNow,
48
- valueMax
49
- }) => `${valueNow} / ${valueMax}`,
50
- size: 'medium',
51
- valueMax: 100,
52
- valueNow: 0,
53
- as: 'div',
54
- color: 'primary',
55
- shouldAnimateOnMount: false,
56
- // default to showing `success` color on completion
57
- meterColor: ({
58
- valueNow,
59
- valueMax
60
- }) => valueNow / valueMax >= 1 ? 'success' : 'brand'
61
- };
62
- _timeouts = [];
63
- ref = null;
64
- constructor(props) {
65
- super(props);
66
- this.state = {
67
- shouldAnimateOnMount: props.shouldAnimateOnMount
68
- };
69
- }
70
- handleRef = el => {
71
- const {
72
- elementRef
73
- } = this.props;
74
- this.ref = el;
75
- if (typeof elementRef === 'function') {
76
- elementRef(el);
10
+ export class ProgressCircleBase 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
+ };
77
43
  }
78
- };
79
- get makeStylesVariables() {
80
- return {
81
- shouldAnimateOnMount: this.state.shouldAnimateOnMount
82
- };
83
- }
84
- componentDidMount() {
85
- if (this.state.shouldAnimateOnMount) {
86
- this._timeouts.push(setTimeout(() => {
87
- this.setState({
88
- shouldAnimateOnMount: false
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
+ ]
89
132
  });
90
- }, this.props.animationDelay || 500));
91
133
  }
92
- this.props.makeStyles?.(this.makeStylesVariables);
93
- }
94
- componentDidUpdate() {
95
- this.props.makeStyles?.(this.makeStylesVariables);
96
- }
97
- componentWillUnmount() {
98
- this._timeouts.forEach(timeout => clearTimeout(timeout));
99
- }
100
- render() {
101
- const {
102
- color,
103
- renderValue,
104
- formatScreenReaderValue,
105
- meterColor,
106
- valueNow,
107
- valueMax,
108
- screenReaderLabel,
109
- size,
110
- styles,
111
- ...props
112
- } = this.props;
113
- const valueText = typeof formatScreenReaderValue === 'function' ? formatScreenReaderValue({
114
- valueNow: valueNow,
115
- valueMax: valueMax
116
- }) : undefined;
117
- // consolidating the label and aria-valuetext to put in aria-label because
118
- // NVDA does not read aria-valuetext: https://github.com/nvaccess/nvda/issues/913
119
- // But leaving aria-valuetext because JAWS ignores aria-label
120
- const labelAndValueText = `${screenReaderLabel} ${valueText}`;
121
- const value = callRenderProp(renderValue, {
122
- valueNow: valueNow,
123
- valueMax: valueMax
124
- });
125
- const style = {
126
- strokeDashoffset: `${styles?.dashOffset}em`
127
- };
128
- return _jsxs(View, {
129
- ...passthroughProps(props),
130
- as: this.props.as,
131
- elementRef: this.handleRef,
132
- css: styles?.progressCircle,
133
- margin: this.props.margin,
134
- "data-cid": "ProgressCircle",
135
- children: [_jsx(ScreenReaderContent, {
136
- children: _jsx("progress", {
137
- max: valueMax,
138
- value: valueNow,
139
- "aria-valuetext": labelAndValueText
140
- })
141
- }), value && _jsx("span", {
142
- css: styles?.center,
143
- "aria-hidden": "true",
144
- children: _jsx("span", {
145
- css: styles?.value,
146
- children: value
147
- })
148
- }), _jsxs("svg", {
149
- css: styles?.circle,
150
- role: "presentation",
151
- focusable: "false",
152
- children: [_jsx("circle", {
153
- css: styles?.track,
154
- role: "presentation",
155
- cx: "50%",
156
- cy: "50%",
157
- r: styles?.radii?.radius
158
- }), _jsx("circle", {
159
- css: styles?.border,
160
- role: "presentation",
161
- cx: "50%",
162
- cy: "50%",
163
- r: styles?.radii?.borderOffsetRadius
164
- }), _jsx("circle", {
165
- css: styles?.meter,
166
- role: "presentation",
167
- style: style,
168
- cx: "50%",
169
- cy: "50%",
170
- r: styles?.radii?.radius
171
- })]
172
- })]
173
- });
174
- }
175
- }) || _class);
134
+ }
135
+ const ProgressCircle = withStyle(generateStyle, generateComponentTheme)(ProgressCircleBase);
176
136
  export default ProgressCircle;
177
- export { ProgressCircle };
137
+ export { ProgressCircle };
@@ -1,26 +1,16 @@
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
- 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 };