@instructure/ui-progress 10.16.1-pr-snapshot-1744893671793 → 10.16.1-snapshot-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 +1 -1
- package/es/ProgressBar/__examples__/ProgressBar.examples.js +2 -4
- package/es/ProgressBar/__new-tests__/ProgressBar.test.js +10 -10
- package/es/ProgressBar/index.js +21 -27
- package/es/ProgressCircle/__examples__/ProgressCircle.examples.js +2 -4
- package/es/ProgressCircle/__new-tests__/ProgressCircle.test.js +6 -6
- package/es/ProgressCircle/index.js +37 -44
- package/lib/ProgressBar/__examples__/ProgressBar.examples.js +3 -4
- package/lib/ProgressBar/__new-tests__/ProgressBar.test.js +12 -11
- package/lib/ProgressBar/index.js +20 -26
- package/lib/ProgressCircle/__examples__/ProgressCircle.examples.js +3 -4
- package/lib/ProgressCircle/__new-tests__/ProgressCircle.test.js +8 -7
- package/lib/ProgressCircle/index.js +36 -43
- package/package.json +13 -13
- package/src/ProgressBar/__examples__/ProgressBar.examples.tsx +2 -0
- package/src/ProgressBar/__new-tests__/ProgressBar.test.tsx +4 -7
- package/src/ProgressBar/index.tsx +2 -1
- package/src/ProgressCircle/__examples__/ProgressCircle.examples.tsx +2 -0
- package/src/ProgressCircle/__new-tests__/ProgressCircle.test.tsx +2 -1
- package/src/ProgressCircle/index.tsx +2 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/ProgressBar/__examples__/ProgressBar.examples.d.ts.map +1 -1
- package/types/ProgressBar/__new-tests__/ProgressBar.test.d.ts.map +1 -1
- package/types/ProgressBar/index.d.ts +3 -1
- package/types/ProgressBar/index.d.ts.map +1 -1
- package/types/ProgressCircle/__examples__/ProgressCircle.examples.d.ts.map +1 -1
- package/types/ProgressCircle/__new-tests__/ProgressCircle.test.d.ts.map +1 -1
- package/types/ProgressCircle/index.d.ts +3 -1
- package/types/ProgressCircle/index.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
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
|
-
## [10.16.1-
|
|
6
|
+
## [10.16.1-snapshot-0](https://github.com/instructure/instructure-ui/compare/v10.16.0...v10.16.1-snapshot-0) (2025-04-15)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @instructure/ui-progress
|
|
9
9
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
2
1
|
/*
|
|
3
2
|
* The MIT License (MIT)
|
|
4
3
|
*
|
|
@@ -23,6 +22,7 @@ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
|
23
22
|
* SOFTWARE.
|
|
24
23
|
*/
|
|
25
24
|
|
|
25
|
+
import React from 'react';
|
|
26
26
|
const valueMax = 100;
|
|
27
27
|
export default {
|
|
28
28
|
sectionProp: 'color',
|
|
@@ -32,9 +32,7 @@ export default {
|
|
|
32
32
|
renderValue: [null, ({
|
|
33
33
|
valueNow,
|
|
34
34
|
valueMax
|
|
35
|
-
}) =>
|
|
36
|
-
children: Math.round(valueNow / valueMax * 100)
|
|
37
|
-
})]
|
|
35
|
+
}) => /*#__PURE__*/React.createElement("span", null, Math.round(valueNow / valueMax * 100))]
|
|
38
36
|
},
|
|
39
37
|
getComponentProps: () => {
|
|
40
38
|
return {
|
|
@@ -23,14 +23,14 @@ var _ProgressBar, _ProgressBar2, _ProgressBar3;
|
|
|
23
23
|
* SOFTWARE.
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
+
import React from 'react';
|
|
26
27
|
import { render } from '@testing-library/react';
|
|
27
28
|
import '@testing-library/jest-dom';
|
|
28
29
|
import { runAxeCheck } from '@instructure/ui-axe-check';
|
|
29
30
|
import { ProgressBar } from '../index';
|
|
30
|
-
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
31
31
|
describe('<ProgressBar />', () => {
|
|
32
32
|
it('should render', async () => {
|
|
33
|
-
const _render = render(_ProgressBar || (_ProgressBar =
|
|
33
|
+
const _render = render(_ProgressBar || (_ProgressBar = /*#__PURE__*/React.createElement(ProgressBar, {
|
|
34
34
|
screenReaderLabel: "Chapters read",
|
|
35
35
|
valueMax: 60,
|
|
36
36
|
valueNow: 30
|
|
@@ -40,7 +40,7 @@ describe('<ProgressBar />', () => {
|
|
|
40
40
|
expect(progress).toBeInTheDocument();
|
|
41
41
|
});
|
|
42
42
|
it('should render a progress element with correct aria attributes', async () => {
|
|
43
|
-
const _render2 = render(_ProgressBar2 || (_ProgressBar2 =
|
|
43
|
+
const _render2 = render(_ProgressBar2 || (_ProgressBar2 = /*#__PURE__*/React.createElement(ProgressBar, {
|
|
44
44
|
screenReaderLabel: "Chapters read",
|
|
45
45
|
valueMax: 60,
|
|
46
46
|
valueNow: 30
|
|
@@ -52,7 +52,7 @@ describe('<ProgressBar />', () => {
|
|
|
52
52
|
it('should format the displayed text', async () => {
|
|
53
53
|
const current = 30;
|
|
54
54
|
const max = 60;
|
|
55
|
-
const _render3 = render(
|
|
55
|
+
const _render3 = render(/*#__PURE__*/React.createElement(ProgressBar, {
|
|
56
56
|
screenReaderLabel: "Chapters read",
|
|
57
57
|
valueMax: max,
|
|
58
58
|
valueNow: current,
|
|
@@ -62,11 +62,11 @@ describe('<ProgressBar />', () => {
|
|
|
62
62
|
}) => `${valueNow} of ${valueMax}`
|
|
63
63
|
})),
|
|
64
64
|
container = _render3.container;
|
|
65
|
-
const progress = container.querySelector('[class
|
|
65
|
+
const progress = container.querySelector('[class$="-progressBar"]');
|
|
66
66
|
expect(progress).toHaveTextContent(`${current} of ${max}`);
|
|
67
67
|
});
|
|
68
68
|
it('should meet a11y standards', async () => {
|
|
69
|
-
const _render4 = render(_ProgressBar3 || (_ProgressBar3 =
|
|
69
|
+
const _render4 = render(_ProgressBar3 || (_ProgressBar3 = /*#__PURE__*/React.createElement(ProgressBar, {
|
|
70
70
|
screenReaderLabel: "Chapters read",
|
|
71
71
|
valueMax: 60,
|
|
72
72
|
valueNow: 30
|
|
@@ -77,7 +77,7 @@ describe('<ProgressBar />', () => {
|
|
|
77
77
|
});
|
|
78
78
|
it('should not render the value inside when the prop is set to false', () => {
|
|
79
79
|
const valueNow = 33;
|
|
80
|
-
const _render5 = render(
|
|
80
|
+
const _render5 = render(/*#__PURE__*/React.createElement(ProgressBar, {
|
|
81
81
|
screenReaderLabel: "Chapters read",
|
|
82
82
|
valueMax: 100,
|
|
83
83
|
valueNow: valueNow,
|
|
@@ -85,12 +85,12 @@ describe('<ProgressBar />', () => {
|
|
|
85
85
|
renderValue: `${valueNow}%`
|
|
86
86
|
})),
|
|
87
87
|
container = _render5.container;
|
|
88
|
-
const progressMeter = container.querySelector('[class
|
|
88
|
+
const progressMeter = container.querySelector('[class$="-progressBar__trackValue"]');
|
|
89
89
|
expect(progressMeter).not.toHaveTextContent('33%');
|
|
90
90
|
});
|
|
91
91
|
it('should render the value inside when the prop is set', () => {
|
|
92
92
|
const valueNow = 33;
|
|
93
|
-
const _render6 = render(
|
|
93
|
+
const _render6 = render(/*#__PURE__*/React.createElement(ProgressBar, {
|
|
94
94
|
screenReaderLabel: "Chapters read",
|
|
95
95
|
valueMax: 100,
|
|
96
96
|
valueNow: valueNow,
|
|
@@ -98,7 +98,7 @@ describe('<ProgressBar />', () => {
|
|
|
98
98
|
renderValue: `${valueNow}%`
|
|
99
99
|
})),
|
|
100
100
|
container = _render6.container;
|
|
101
|
-
const progressMeter = container.querySelector('[class
|
|
101
|
+
const progressMeter = container.querySelector('[class$="-progressBar__trackValue"]');
|
|
102
102
|
expect(progressMeter).toHaveTextContent('33%');
|
|
103
103
|
});
|
|
104
104
|
});
|
package/es/ProgressBar/index.js
CHANGED
|
@@ -25,11 +25,12 @@ var _dec, _dec2, _class, _ProgressBar;
|
|
|
25
25
|
* SOFTWARE.
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
|
+
/** @jsx jsx */
|
|
28
29
|
import { Component } from 'react';
|
|
29
30
|
import { View } from '@instructure/ui-view';
|
|
30
31
|
import { callRenderProp, passthroughProps } from '@instructure/ui-react-utils';
|
|
31
32
|
import { testable } from '@instructure/ui-testable';
|
|
32
|
-
import { withStyle } from '@instructure/emotion';
|
|
33
|
+
import { withStyle, jsx } from '@instructure/emotion';
|
|
33
34
|
import generateStyle from './styles';
|
|
34
35
|
import generateComponentTheme from './theme';
|
|
35
36
|
import { allowedProps, propTypes } from './props';
|
|
@@ -39,7 +40,6 @@ import { allowedProps, propTypes } from './props';
|
|
|
39
40
|
category: components
|
|
40
41
|
---
|
|
41
42
|
**/
|
|
42
|
-
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
43
43
|
let ProgressBar = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = (_ProgressBar = class ProgressBar extends Component {
|
|
44
44
|
constructor(...args) {
|
|
45
45
|
super(...args);
|
|
@@ -85,34 +85,28 @@ let ProgressBar = (_dec = withStyle(generateStyle, generateComponentTheme), _dec
|
|
|
85
85
|
valueNow: valueNow,
|
|
86
86
|
valueMax: valueMax
|
|
87
87
|
});
|
|
88
|
-
return
|
|
89
|
-
...passthroughProps(props),
|
|
88
|
+
return jsx(View, Object.assign({}, passthroughProps(props), {
|
|
90
89
|
as: this.props.as,
|
|
91
90
|
css: styles === null || styles === void 0 ? void 0 : styles.progressBar,
|
|
92
91
|
margin: this.props.margin,
|
|
93
|
-
elementRef: this.handleRef
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
css: styles === null || styles === void 0 ? void 0 : styles.value,
|
|
112
|
-
"aria-hidden": "true",
|
|
113
|
-
children: value
|
|
114
|
-
})]
|
|
115
|
-
});
|
|
92
|
+
elementRef: this.handleRef
|
|
93
|
+
}), jsx("span", {
|
|
94
|
+
css: styles === null || styles === void 0 ? void 0 : styles.trackLayout
|
|
95
|
+
}, jsx("progress", {
|
|
96
|
+
css: styles === null || styles === void 0 ? void 0 : styles.htmlProgress,
|
|
97
|
+
max: valueMax,
|
|
98
|
+
value: valueNow,
|
|
99
|
+
"aria-valuetext": labelAndValueText
|
|
100
|
+
}), jsx("span", {
|
|
101
|
+
css: styles === null || styles === void 0 ? void 0 : styles.track,
|
|
102
|
+
role: "presentation",
|
|
103
|
+
"aria-hidden": "true"
|
|
104
|
+
}, jsx("span", {
|
|
105
|
+
css: styles === null || styles === void 0 ? void 0 : styles.trackValue
|
|
106
|
+
}, renderValueInside && value))), value && !renderValueInside && jsx("span", {
|
|
107
|
+
css: styles === null || styles === void 0 ? void 0 : styles.value,
|
|
108
|
+
"aria-hidden": "true"
|
|
109
|
+
}, value));
|
|
116
110
|
}
|
|
117
111
|
}, _ProgressBar.displayName = "ProgressBar", _ProgressBar.componentId = 'ProgressBar', _ProgressBar.allowedProps = allowedProps, _ProgressBar.propTypes = propTypes, _ProgressBar.defaultProps = {
|
|
118
112
|
formatScreenReaderValue: ({
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
2
1
|
/*
|
|
3
2
|
* The MIT License (MIT)
|
|
4
3
|
*
|
|
@@ -23,6 +22,7 @@ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
|
23
22
|
* SOFTWARE.
|
|
24
23
|
*/
|
|
25
24
|
|
|
25
|
+
import React from 'react';
|
|
26
26
|
const valueMax = 100;
|
|
27
27
|
export default {
|
|
28
28
|
sectionProp: 'color',
|
|
@@ -31,9 +31,7 @@ export default {
|
|
|
31
31
|
renderValue: [null, ({
|
|
32
32
|
valueNow,
|
|
33
33
|
valueMax
|
|
34
|
-
}) =>
|
|
35
|
-
children: Math.round(valueNow / valueMax * 100)
|
|
36
|
-
})]
|
|
34
|
+
}) => /*#__PURE__*/React.createElement("span", null, Math.round(valueNow / valueMax * 100))]
|
|
37
35
|
},
|
|
38
36
|
getComponentProps: () => {
|
|
39
37
|
return {
|
|
@@ -23,14 +23,14 @@ var _ProgressCircle, _ProgressCircle2, _ProgressCircle3;
|
|
|
23
23
|
* SOFTWARE.
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
+
import React from 'react';
|
|
26
27
|
import { render } from '@testing-library/react';
|
|
27
28
|
import '@testing-library/jest-dom';
|
|
28
29
|
import { runAxeCheck } from '@instructure/ui-axe-check';
|
|
29
30
|
import { ProgressCircle } from '../index';
|
|
30
|
-
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
31
31
|
describe('<ProgressCircle />', () => {
|
|
32
32
|
it('should render', async () => {
|
|
33
|
-
const _render = render(_ProgressCircle || (_ProgressCircle =
|
|
33
|
+
const _render = render(_ProgressCircle || (_ProgressCircle = /*#__PURE__*/React.createElement(ProgressCircle, {
|
|
34
34
|
screenReaderLabel: "Chapters read",
|
|
35
35
|
valueMax: 60,
|
|
36
36
|
valueNow: 30
|
|
@@ -40,7 +40,7 @@ describe('<ProgressCircle />', () => {
|
|
|
40
40
|
expect(progress).toBeInTheDocument();
|
|
41
41
|
});
|
|
42
42
|
it('should render a progress element with correct aria attributes', async () => {
|
|
43
|
-
const _render2 = render(_ProgressCircle2 || (_ProgressCircle2 =
|
|
43
|
+
const _render2 = render(_ProgressCircle2 || (_ProgressCircle2 = /*#__PURE__*/React.createElement(ProgressCircle, {
|
|
44
44
|
screenReaderLabel: "Chapters read",
|
|
45
45
|
valueMax: 60,
|
|
46
46
|
valueNow: 30
|
|
@@ -52,7 +52,7 @@ describe('<ProgressCircle />', () => {
|
|
|
52
52
|
it('should format the displayed text', async () => {
|
|
53
53
|
const current = 30;
|
|
54
54
|
const max = 60;
|
|
55
|
-
const _render3 = render(
|
|
55
|
+
const _render3 = render(/*#__PURE__*/React.createElement(ProgressCircle, {
|
|
56
56
|
screenReaderLabel: "Chapters read",
|
|
57
57
|
valueMax: max,
|
|
58
58
|
valueNow: current,
|
|
@@ -62,11 +62,11 @@ describe('<ProgressCircle />', () => {
|
|
|
62
62
|
}) => `${valueNow} of ${valueMax}`
|
|
63
63
|
})),
|
|
64
64
|
container = _render3.container;
|
|
65
|
-
const progress = container.querySelector('[class
|
|
65
|
+
const progress = container.querySelector('[class$="-progressCircle"]');
|
|
66
66
|
expect(progress).toHaveTextContent(`${current} of ${max}`);
|
|
67
67
|
});
|
|
68
68
|
it('should meet a11y standards', async () => {
|
|
69
|
-
const _render4 = render(_ProgressCircle3 || (_ProgressCircle3 =
|
|
69
|
+
const _render4 = render(_ProgressCircle3 || (_ProgressCircle3 = /*#__PURE__*/React.createElement(ProgressCircle, {
|
|
70
70
|
screenReaderLabel: "Chapters read",
|
|
71
71
|
valueMax: 60,
|
|
72
72
|
valueNow: 30
|
|
@@ -25,12 +25,13 @@ var _dec, _dec2, _class, _ProgressCircle;
|
|
|
25
25
|
* SOFTWARE.
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
|
+
/** @jsx jsx */
|
|
28
29
|
import { Component } from 'react';
|
|
29
30
|
import { ScreenReaderContent } from '@instructure/ui-a11y-content';
|
|
30
31
|
import { View } from '@instructure/ui-view';
|
|
31
32
|
import { callRenderProp, passthroughProps } from '@instructure/ui-react-utils';
|
|
32
33
|
import { testable } from '@instructure/ui-testable';
|
|
33
|
-
import { withStyle } from '@instructure/emotion';
|
|
34
|
+
import { withStyle, jsx } from '@instructure/emotion';
|
|
34
35
|
import generateStyle from './styles';
|
|
35
36
|
import generateComponentTheme from './theme';
|
|
36
37
|
import { allowedProps, propTypes } from './props';
|
|
@@ -40,7 +41,6 @@ import { allowedProps, propTypes } from './props';
|
|
|
40
41
|
category: components
|
|
41
42
|
---
|
|
42
43
|
**/
|
|
43
|
-
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
44
44
|
let ProgressCircle = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = (_ProgressCircle = class ProgressCircle extends Component {
|
|
45
45
|
constructor(props) {
|
|
46
46
|
super(props);
|
|
@@ -108,51 +108,44 @@ let ProgressCircle = (_dec = withStyle(generateStyle, generateComponentTheme), _
|
|
|
108
108
|
const style = {
|
|
109
109
|
strokeDashoffset: `${styles === null || styles === void 0 ? void 0 : styles.dashOffset}em`
|
|
110
110
|
};
|
|
111
|
-
return
|
|
112
|
-
...passthroughProps(props),
|
|
111
|
+
return jsx(View, Object.assign({}, passthroughProps(props), {
|
|
113
112
|
as: this.props.as,
|
|
114
113
|
elementRef: this.handleRef,
|
|
115
114
|
css: styles === null || styles === void 0 ? void 0 : styles.progressCircle,
|
|
116
|
-
margin: this.props.margin
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
cx: "50%",
|
|
151
|
-
cy: "50%",
|
|
152
|
-
r: styles === null || styles === void 0 ? void 0 : (_styles$radii3 = styles.radii) === null || _styles$radii3 === void 0 ? void 0 : _styles$radii3.radius
|
|
153
|
-
})]
|
|
154
|
-
})]
|
|
155
|
-
});
|
|
115
|
+
margin: this.props.margin
|
|
116
|
+
}), jsx(ScreenReaderContent, null, jsx("progress", {
|
|
117
|
+
max: valueMax,
|
|
118
|
+
value: valueNow,
|
|
119
|
+
"aria-valuetext": labelAndValueText
|
|
120
|
+
})), value && jsx("span", {
|
|
121
|
+
css: styles === null || styles === void 0 ? void 0 : styles.center,
|
|
122
|
+
"aria-hidden": "true"
|
|
123
|
+
}, jsx("span", {
|
|
124
|
+
css: styles === null || styles === void 0 ? void 0 : styles.value
|
|
125
|
+
}, value)), jsx("svg", {
|
|
126
|
+
css: styles === null || styles === void 0 ? void 0 : styles.circle,
|
|
127
|
+
role: "presentation",
|
|
128
|
+
focusable: "false"
|
|
129
|
+
}, jsx("circle", {
|
|
130
|
+
css: styles === null || styles === void 0 ? void 0 : styles.track,
|
|
131
|
+
role: "presentation",
|
|
132
|
+
cx: "50%",
|
|
133
|
+
cy: "50%",
|
|
134
|
+
r: styles === null || styles === void 0 ? void 0 : (_styles$radii = styles.radii) === null || _styles$radii === void 0 ? void 0 : _styles$radii.radius
|
|
135
|
+
}), jsx("circle", {
|
|
136
|
+
css: styles === null || styles === void 0 ? void 0 : styles.border,
|
|
137
|
+
role: "presentation",
|
|
138
|
+
cx: "50%",
|
|
139
|
+
cy: "50%",
|
|
140
|
+
r: styles === null || styles === void 0 ? void 0 : (_styles$radii2 = styles.radii) === null || _styles$radii2 === void 0 ? void 0 : _styles$radii2.borderOffsetRadius
|
|
141
|
+
}), jsx("circle", {
|
|
142
|
+
css: styles === null || styles === void 0 ? void 0 : styles.meter,
|
|
143
|
+
role: "presentation",
|
|
144
|
+
style: style,
|
|
145
|
+
cx: "50%",
|
|
146
|
+
cy: "50%",
|
|
147
|
+
r: styles === null || styles === void 0 ? void 0 : (_styles$radii3 = styles.radii) === null || _styles$radii3 === void 0 ? void 0 : _styles$radii3.radius
|
|
148
|
+
})));
|
|
156
149
|
}
|
|
157
150
|
}, _ProgressCircle.displayName = "ProgressCircle", _ProgressCircle.componentId = 'ProgressCircle', _ProgressCircle.allowedProps = allowedProps, _ProgressCircle.propTypes = propTypes, _ProgressCircle.defaultProps = {
|
|
158
151
|
formatScreenReaderValue: ({
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.default = void 0;
|
|
7
|
-
var
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
9
|
/*
|
|
9
10
|
* The MIT License (MIT)
|
|
10
11
|
*
|
|
@@ -38,9 +39,7 @@ var _default = exports.default = {
|
|
|
38
39
|
renderValue: [null, ({
|
|
39
40
|
valueNow,
|
|
40
41
|
valueMax
|
|
41
|
-
}) =>
|
|
42
|
-
children: Math.round(valueNow / valueMax * 100)
|
|
43
|
-
})]
|
|
42
|
+
}) => /*#__PURE__*/_react.default.createElement("span", null, Math.round(valueNow / valueMax * 100))]
|
|
44
43
|
},
|
|
45
44
|
getComponentProps: () => {
|
|
46
45
|
return {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _react = _interopRequireDefault(require("react"));
|
|
5
|
+
var _react2 = require("@testing-library/react");
|
|
4
6
|
require("@testing-library/jest-dom");
|
|
5
7
|
var _runAxeCheck = require("@instructure/ui-axe-check/lib/runAxeCheck.js");
|
|
6
8
|
var _index = require("../index");
|
|
7
|
-
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
8
9
|
var _ProgressBar, _ProgressBar2, _ProgressBar3;
|
|
9
10
|
/*
|
|
10
11
|
* The MIT License (MIT)
|
|
@@ -31,7 +32,7 @@ var _ProgressBar, _ProgressBar2, _ProgressBar3;
|
|
|
31
32
|
*/
|
|
32
33
|
describe('<ProgressBar />', () => {
|
|
33
34
|
it('should render', async () => {
|
|
34
|
-
const _render = (0,
|
|
35
|
+
const _render = (0, _react2.render)(_ProgressBar || (_ProgressBar = /*#__PURE__*/_react.default.createElement(_index.ProgressBar, {
|
|
35
36
|
screenReaderLabel: "Chapters read",
|
|
36
37
|
valueMax: 60,
|
|
37
38
|
valueNow: 30
|
|
@@ -41,7 +42,7 @@ describe('<ProgressBar />', () => {
|
|
|
41
42
|
expect(progress).toBeInTheDocument();
|
|
42
43
|
});
|
|
43
44
|
it('should render a progress element with correct aria attributes', async () => {
|
|
44
|
-
const _render2 = (0,
|
|
45
|
+
const _render2 = (0, _react2.render)(_ProgressBar2 || (_ProgressBar2 = /*#__PURE__*/_react.default.createElement(_index.ProgressBar, {
|
|
45
46
|
screenReaderLabel: "Chapters read",
|
|
46
47
|
valueMax: 60,
|
|
47
48
|
valueNow: 30
|
|
@@ -53,7 +54,7 @@ describe('<ProgressBar />', () => {
|
|
|
53
54
|
it('should format the displayed text', async () => {
|
|
54
55
|
const current = 30;
|
|
55
56
|
const max = 60;
|
|
56
|
-
const _render3 = (0,
|
|
57
|
+
const _render3 = (0, _react2.render)(/*#__PURE__*/_react.default.createElement(_index.ProgressBar, {
|
|
57
58
|
screenReaderLabel: "Chapters read",
|
|
58
59
|
valueMax: max,
|
|
59
60
|
valueNow: current,
|
|
@@ -63,11 +64,11 @@ describe('<ProgressBar />', () => {
|
|
|
63
64
|
}) => `${valueNow} of ${valueMax}`
|
|
64
65
|
})),
|
|
65
66
|
container = _render3.container;
|
|
66
|
-
const progress = container.querySelector('[class
|
|
67
|
+
const progress = container.querySelector('[class$="-progressBar"]');
|
|
67
68
|
expect(progress).toHaveTextContent(`${current} of ${max}`);
|
|
68
69
|
});
|
|
69
70
|
it('should meet a11y standards', async () => {
|
|
70
|
-
const _render4 = (0,
|
|
71
|
+
const _render4 = (0, _react2.render)(_ProgressBar3 || (_ProgressBar3 = /*#__PURE__*/_react.default.createElement(_index.ProgressBar, {
|
|
71
72
|
screenReaderLabel: "Chapters read",
|
|
72
73
|
valueMax: 60,
|
|
73
74
|
valueNow: 30
|
|
@@ -78,7 +79,7 @@ describe('<ProgressBar />', () => {
|
|
|
78
79
|
});
|
|
79
80
|
it('should not render the value inside when the prop is set to false', () => {
|
|
80
81
|
const valueNow = 33;
|
|
81
|
-
const _render5 = (0,
|
|
82
|
+
const _render5 = (0, _react2.render)(/*#__PURE__*/_react.default.createElement(_index.ProgressBar, {
|
|
82
83
|
screenReaderLabel: "Chapters read",
|
|
83
84
|
valueMax: 100,
|
|
84
85
|
valueNow: valueNow,
|
|
@@ -86,12 +87,12 @@ describe('<ProgressBar />', () => {
|
|
|
86
87
|
renderValue: `${valueNow}%`
|
|
87
88
|
})),
|
|
88
89
|
container = _render5.container;
|
|
89
|
-
const progressMeter = container.querySelector('[class
|
|
90
|
+
const progressMeter = container.querySelector('[class$="-progressBar__trackValue"]');
|
|
90
91
|
expect(progressMeter).not.toHaveTextContent('33%');
|
|
91
92
|
});
|
|
92
93
|
it('should render the value inside when the prop is set', () => {
|
|
93
94
|
const valueNow = 33;
|
|
94
|
-
const _render6 = (0,
|
|
95
|
+
const _render6 = (0, _react2.render)(/*#__PURE__*/_react.default.createElement(_index.ProgressBar, {
|
|
95
96
|
screenReaderLabel: "Chapters read",
|
|
96
97
|
valueMax: 100,
|
|
97
98
|
valueNow: valueNow,
|
|
@@ -99,7 +100,7 @@ describe('<ProgressBar />', () => {
|
|
|
99
100
|
renderValue: `${valueNow}%`
|
|
100
101
|
})),
|
|
101
102
|
container = _render6.container;
|
|
102
|
-
const progressMeter = container.querySelector('[class
|
|
103
|
+
const progressMeter = container.querySelector('[class$="-progressBar__trackValue"]');
|
|
103
104
|
expect(progressMeter).toHaveTextContent('33%');
|
|
104
105
|
});
|
|
105
106
|
});
|
package/lib/ProgressBar/index.js
CHANGED
|
@@ -15,7 +15,6 @@ var _emotion = require("@instructure/emotion");
|
|
|
15
15
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
16
16
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
17
17
|
var _props = require("./props");
|
|
18
|
-
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
19
18
|
const _excluded = ["renderValue", "formatScreenReaderValue", "valueNow", "valueMax", "screenReaderLabel", "size", "color", "meterColor", "renderValueInside", "styles"];
|
|
20
19
|
var _dec, _dec2, _class, _ProgressBar;
|
|
21
20
|
/*
|
|
@@ -41,6 +40,7 @@ var _dec, _dec2, _class, _ProgressBar;
|
|
|
41
40
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
42
41
|
* SOFTWARE.
|
|
43
42
|
*/
|
|
43
|
+
/** @jsx jsx */
|
|
44
44
|
/**
|
|
45
45
|
---
|
|
46
46
|
category: components
|
|
@@ -91,34 +91,28 @@ let ProgressBar = exports.ProgressBar = (_dec = (0, _emotion.withStyle)(_styles.
|
|
|
91
91
|
valueNow: valueNow,
|
|
92
92
|
valueMax: valueMax
|
|
93
93
|
});
|
|
94
|
-
return (0,
|
|
95
|
-
...(0, _passthroughProps.passthroughProps)(props),
|
|
94
|
+
return (0, _emotion.jsx)(_View.View, Object.assign({}, (0, _passthroughProps.passthroughProps)(props), {
|
|
96
95
|
as: this.props.as,
|
|
97
96
|
css: styles === null || styles === void 0 ? void 0 : styles.progressBar,
|
|
98
97
|
margin: this.props.margin,
|
|
99
|
-
elementRef: this.handleRef
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
css: styles === null || styles === void 0 ? void 0 : styles.value,
|
|
118
|
-
"aria-hidden": "true",
|
|
119
|
-
children: value
|
|
120
|
-
})]
|
|
121
|
-
});
|
|
98
|
+
elementRef: this.handleRef
|
|
99
|
+
}), (0, _emotion.jsx)("span", {
|
|
100
|
+
css: styles === null || styles === void 0 ? void 0 : styles.trackLayout
|
|
101
|
+
}, (0, _emotion.jsx)("progress", {
|
|
102
|
+
css: styles === null || styles === void 0 ? void 0 : styles.htmlProgress,
|
|
103
|
+
max: valueMax,
|
|
104
|
+
value: valueNow,
|
|
105
|
+
"aria-valuetext": labelAndValueText
|
|
106
|
+
}), (0, _emotion.jsx)("span", {
|
|
107
|
+
css: styles === null || styles === void 0 ? void 0 : styles.track,
|
|
108
|
+
role: "presentation",
|
|
109
|
+
"aria-hidden": "true"
|
|
110
|
+
}, (0, _emotion.jsx)("span", {
|
|
111
|
+
css: styles === null || styles === void 0 ? void 0 : styles.trackValue
|
|
112
|
+
}, renderValueInside && value))), value && !renderValueInside && (0, _emotion.jsx)("span", {
|
|
113
|
+
css: styles === null || styles === void 0 ? void 0 : styles.value,
|
|
114
|
+
"aria-hidden": "true"
|
|
115
|
+
}, value));
|
|
122
116
|
}
|
|
123
117
|
}, _ProgressBar.displayName = "ProgressBar", _ProgressBar.componentId = 'ProgressBar', _ProgressBar.allowedProps = _props.allowedProps, _ProgressBar.propTypes = _props.propTypes, _ProgressBar.defaultProps = {
|
|
124
118
|
formatScreenReaderValue: ({
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.default = void 0;
|
|
7
|
-
var
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
9
|
/*
|
|
9
10
|
* The MIT License (MIT)
|
|
10
11
|
*
|
|
@@ -37,9 +38,7 @@ var _default = exports.default = {
|
|
|
37
38
|
renderValue: [null, ({
|
|
38
39
|
valueNow,
|
|
39
40
|
valueMax
|
|
40
|
-
}) =>
|
|
41
|
-
children: Math.round(valueNow / valueMax * 100)
|
|
42
|
-
})]
|
|
41
|
+
}) => /*#__PURE__*/_react.default.createElement("span", null, Math.round(valueNow / valueMax * 100))]
|
|
43
42
|
},
|
|
44
43
|
getComponentProps: () => {
|
|
45
44
|
return {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _react = _interopRequireDefault(require("react"));
|
|
5
|
+
var _react2 = require("@testing-library/react");
|
|
4
6
|
require("@testing-library/jest-dom");
|
|
5
7
|
var _runAxeCheck = require("@instructure/ui-axe-check/lib/runAxeCheck.js");
|
|
6
8
|
var _index = require("../index");
|
|
7
|
-
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
8
9
|
var _ProgressCircle, _ProgressCircle2, _ProgressCircle3;
|
|
9
10
|
/*
|
|
10
11
|
* The MIT License (MIT)
|
|
@@ -31,7 +32,7 @@ var _ProgressCircle, _ProgressCircle2, _ProgressCircle3;
|
|
|
31
32
|
*/
|
|
32
33
|
describe('<ProgressCircle />', () => {
|
|
33
34
|
it('should render', async () => {
|
|
34
|
-
const _render = (0,
|
|
35
|
+
const _render = (0, _react2.render)(_ProgressCircle || (_ProgressCircle = /*#__PURE__*/_react.default.createElement(_index.ProgressCircle, {
|
|
35
36
|
screenReaderLabel: "Chapters read",
|
|
36
37
|
valueMax: 60,
|
|
37
38
|
valueNow: 30
|
|
@@ -41,7 +42,7 @@ describe('<ProgressCircle />', () => {
|
|
|
41
42
|
expect(progress).toBeInTheDocument();
|
|
42
43
|
});
|
|
43
44
|
it('should render a progress element with correct aria attributes', async () => {
|
|
44
|
-
const _render2 = (0,
|
|
45
|
+
const _render2 = (0, _react2.render)(_ProgressCircle2 || (_ProgressCircle2 = /*#__PURE__*/_react.default.createElement(_index.ProgressCircle, {
|
|
45
46
|
screenReaderLabel: "Chapters read",
|
|
46
47
|
valueMax: 60,
|
|
47
48
|
valueNow: 30
|
|
@@ -53,7 +54,7 @@ describe('<ProgressCircle />', () => {
|
|
|
53
54
|
it('should format the displayed text', async () => {
|
|
54
55
|
const current = 30;
|
|
55
56
|
const max = 60;
|
|
56
|
-
const _render3 = (0,
|
|
57
|
+
const _render3 = (0, _react2.render)(/*#__PURE__*/_react.default.createElement(_index.ProgressCircle, {
|
|
57
58
|
screenReaderLabel: "Chapters read",
|
|
58
59
|
valueMax: max,
|
|
59
60
|
valueNow: current,
|
|
@@ -63,11 +64,11 @@ describe('<ProgressCircle />', () => {
|
|
|
63
64
|
}) => `${valueNow} of ${valueMax}`
|
|
64
65
|
})),
|
|
65
66
|
container = _render3.container;
|
|
66
|
-
const progress = container.querySelector('[class
|
|
67
|
+
const progress = container.querySelector('[class$="-progressCircle"]');
|
|
67
68
|
expect(progress).toHaveTextContent(`${current} of ${max}`);
|
|
68
69
|
});
|
|
69
70
|
it('should meet a11y standards', async () => {
|
|
70
|
-
const _render4 = (0,
|
|
71
|
+
const _render4 = (0, _react2.render)(_ProgressCircle3 || (_ProgressCircle3 = /*#__PURE__*/_react.default.createElement(_index.ProgressCircle, {
|
|
71
72
|
screenReaderLabel: "Chapters read",
|
|
72
73
|
valueMax: 60,
|
|
73
74
|
valueNow: 30
|