@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.
Files changed (37) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/es/ProgressBar/v1/index.js +90 -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 +90 -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 +128 -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 +128 -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/tsconfig.build.json +0 -1
  20. package/tsconfig.build.tsbuildinfo +1 -1
  21. package/lib/ProgressBar/v1/index.js +0 -137
  22. package/lib/ProgressBar/v1/props.js +0 -31
  23. package/lib/ProgressBar/v1/styles.js +0 -216
  24. package/lib/ProgressBar/v1/theme.js +0 -100
  25. package/lib/ProgressBar/v2/index.js +0 -136
  26. package/lib/ProgressBar/v2/props.js +0 -31
  27. package/lib/ProgressBar/v2/styles.js +0 -242
  28. package/lib/ProgressCircle/v1/index.js +0 -182
  29. package/lib/ProgressCircle/v1/props.js +0 -31
  30. package/lib/ProgressCircle/v1/styles.js +0 -357
  31. package/lib/ProgressCircle/v1/theme.js +0 -146
  32. package/lib/ProgressCircle/v2/index.js +0 -181
  33. package/lib/ProgressCircle/v2/props.js +0 -31
  34. package/lib/ProgressCircle/v2/styles.js +0 -357
  35. package/lib/exports/a.js +0 -19
  36. package/lib/exports/b.js +0 -19
  37. package/lib/package.json +0 -1
@@ -1,28 +1,5 @@
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 { _ 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/v11_6';
@@ -31,147 +8,133 @@ import { withStyle } from '@instructure/emotion';
31
8
  import generateStyle from './styles.js';
32
9
  import generateComponentTheme from './theme.js';
33
10
  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);
11
+ class ProgressCircle extends Component {
12
+ static{
13
+ this.displayName = 'ProgressCircle';
14
+ }
15
+ static{
16
+ this.componentId = 'ProgressCircle';
17
+ }
18
+ static{
19
+ this.allowedProps = allowedProps;
20
+ }
21
+ static{
22
+ this.defaultProps = {
23
+ formatScreenReaderValue: ({ valueNow, valueMax })=>`${valueNow} / ${valueMax}`,
24
+ size: 'medium',
25
+ valueMax: 100,
26
+ valueNow: 0,
27
+ as: 'div',
28
+ color: 'primary',
29
+ shouldAnimateOnMount: false,
30
+ meterColor: ({ valueNow, valueMax })=>valueNow / valueMax >= 1 ? 'success' : 'brand'
31
+ };
32
+ }
33
+ constructor(props){
34
+ super(props), this._timeouts = [], this.ref = null, this.handleRef = (el)=>{
35
+ const { elementRef } = this.props;
36
+ this.ref = el;
37
+ if (typeof elementRef === 'function') {
38
+ elementRef(el);
39
+ }
40
+ };
41
+ this.state = {
42
+ shouldAnimateOnMount: props.shouldAnimateOnMount
43
+ };
77
44
  }
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
45
+ get makeStylesVariables() {
46
+ return {
47
+ shouldAnimateOnMount: this.state.shouldAnimateOnMount
48
+ };
49
+ }
50
+ componentDidMount() {
51
+ if (this.state.shouldAnimateOnMount) {
52
+ this._timeouts.push(setTimeout(()=>{
53
+ this.setState({
54
+ shouldAnimateOnMount: false
55
+ });
56
+ }, this.props.animationDelay || 500));
57
+ }
58
+ this.props.makeStyles?.(this.makeStylesVariables);
59
+ }
60
+ componentDidUpdate() {
61
+ this.props.makeStyles?.(this.makeStylesVariables);
62
+ }
63
+ componentWillUnmount() {
64
+ this._timeouts.forEach((timeout)=>clearTimeout(timeout));
65
+ }
66
+ render() {
67
+ const { color, renderValue, formatScreenReaderValue, meterColor, valueNow, valueMax, screenReaderLabel, size, styles, ...props } = this.props;
68
+ const valueText = typeof formatScreenReaderValue === 'function' ? formatScreenReaderValue({
69
+ valueNow: valueNow,
70
+ valueMax: valueMax
71
+ }) : undefined;
72
+ const labelAndValueText = `${screenReaderLabel} ${valueText}`;
73
+ const value = callRenderProp(renderValue, {
74
+ valueNow: valueNow,
75
+ valueMax: valueMax
76
+ });
77
+ const style = {
78
+ strokeDashoffset: `${styles?.dashOffset}em`
79
+ };
80
+ return /*#__PURE__*/ _jsxs(View, {
81
+ ...passthroughProps(props),
82
+ as: this.props.as,
83
+ elementRef: this.handleRef,
84
+ css: styles?.progressCircle,
85
+ margin: this.props.margin,
86
+ "data-cid": "ProgressCircle",
87
+ children: [
88
+ /*#__PURE__*/ _jsx(ScreenReaderContent, {
89
+ children: /*#__PURE__*/ _jsx("progress", {
90
+ max: valueMax,
91
+ value: valueNow,
92
+ "aria-valuetext": labelAndValueText
93
+ })
94
+ }),
95
+ value && /*#__PURE__*/ _jsx("span", {
96
+ css: styles?.center,
97
+ "aria-hidden": "true",
98
+ children: /*#__PURE__*/ _jsx("span", {
99
+ css: styles?.value,
100
+ children: value
101
+ })
102
+ }),
103
+ /*#__PURE__*/ _jsxs("svg", {
104
+ css: styles?.circle,
105
+ role: "presentation",
106
+ focusable: "false",
107
+ children: [
108
+ /*#__PURE__*/ _jsx("circle", {
109
+ css: styles?.track,
110
+ role: "presentation",
111
+ cx: "50%",
112
+ cy: "50%",
113
+ r: styles?.radii?.radius
114
+ }),
115
+ /*#__PURE__*/ _jsx("circle", {
116
+ css: styles?.border,
117
+ role: "presentation",
118
+ cx: "50%",
119
+ cy: "50%",
120
+ r: styles?.radii?.borderOffsetRadius
121
+ }),
122
+ /*#__PURE__*/ _jsx("circle", {
123
+ css: styles?.meter,
124
+ role: "presentation",
125
+ style: style,
126
+ cx: "50%",
127
+ cy: "50%",
128
+ r: styles?.radii?.radius
129
+ })
130
+ ]
131
+ })
132
+ ]
89
133
  });
90
- }, this.props.animationDelay || 500));
91
134
  }
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);
135
+ }
136
+ ProgressCircle = _ts_decorate([
137
+ withStyle(generateStyle, generateComponentTheme)
138
+ ], ProgressCircle);
176
139
  export default ProgressCircle;
177
- export { ProgressCircle };
140
+ 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 };