@instructure/ui-rating 8.56.0 → 8.56.2-pr-snapshot-1721749364069
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
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
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
|
+
## [8.56.2-pr-snapshot-1721749364069](https://github.com/instructure/instructure-ui/compare/v8.56.1...v8.56.2-pr-snapshot-1721749364069) (2024-07-23)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-rating
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [8.56.1](https://github.com/instructure/instructure-ui/compare/v8.56.0...v8.56.1) (2024-06-13)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @instructure/ui-rating
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
# [8.56.0](https://github.com/instructure/instructure-ui/compare/v8.55.1...v8.56.0) (2024-05-06)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @instructure/ui-rating
|
|
@@ -4,8 +4,8 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
var _react = _interopRequireDefault(require("react"));
|
|
5
5
|
var _react2 = require("@testing-library/react");
|
|
6
6
|
require("@testing-library/jest-dom");
|
|
7
|
-
var
|
|
8
|
-
var
|
|
7
|
+
var _uiAxeCheck = require("@instructure/ui-axe-check");
|
|
8
|
+
var _uiView = require("@instructure/ui-view");
|
|
9
9
|
var _index = require("../index");
|
|
10
10
|
var _Rating, _Rating2, _Rating3, _Rating4, _Rating5;
|
|
11
11
|
/*
|
|
@@ -89,14 +89,14 @@ describe('<Rating />', () => {
|
|
|
89
89
|
iconCount: 5
|
|
90
90
|
}))),
|
|
91
91
|
container = _render6.container;
|
|
92
|
-
const axeCheck = await (0,
|
|
92
|
+
const axeCheck = await (0, _uiAxeCheck.runAxeCheck)(container);
|
|
93
93
|
expect(axeCheck).toBe(true);
|
|
94
94
|
});
|
|
95
95
|
describe('when passing down props to View', () => {
|
|
96
96
|
const allowedProps = {
|
|
97
97
|
margin: 'small'
|
|
98
98
|
};
|
|
99
|
-
|
|
99
|
+
_uiView.View.allowedProps.filter(prop => prop !== 'children').forEach(prop => {
|
|
100
100
|
if (Object.keys(allowedProps).indexOf(prop) < 0) {
|
|
101
101
|
it(`should NOT allow the '${prop}' prop`, () => {
|
|
102
102
|
const consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
|
package/lib/Rating/index.js
CHANGED
|
@@ -6,10 +6,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = exports.Rating = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
9
|
+
var _uiView = require("@instructure/ui-view");
|
|
10
|
+
var _uiA11yContent = require("@instructure/ui-a11y-content");
|
|
11
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
12
|
+
var _uiTestable = require("@instructure/ui-testable");
|
|
13
13
|
var _RatingIcon = require("../RatingIcon");
|
|
14
14
|
var _emotion = require("@instructure/emotion");
|
|
15
15
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
@@ -44,7 +44,7 @@ var _dec, _dec2, _class, _class2;
|
|
|
44
44
|
category: components
|
|
45
45
|
---
|
|
46
46
|
**/
|
|
47
|
-
let Rating = exports.Rating = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec2 = (0,
|
|
47
|
+
let Rating = exports.Rating = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec2 = (0, _uiTestable.testable)(), _dec(_class = _dec2(_class = (_class2 = class Rating extends _react.Component {
|
|
48
48
|
constructor(...args) {
|
|
49
49
|
super(...args);
|
|
50
50
|
this.ref = null;
|
|
@@ -90,13 +90,13 @@ let Rating = exports.Rating = (_dec = (0, _emotion.withStyle)(_styles.default, n
|
|
|
90
90
|
label = _this$props4.label,
|
|
91
91
|
formatValueText = _this$props4.formatValueText;
|
|
92
92
|
const valueText = label + ' ' + (formatValueText === null || formatValueText === void 0 ? void 0 : formatValueText(this.filled, iconCount));
|
|
93
|
-
const passthroughProps =
|
|
94
|
-
return (0, _emotion.jsx)(
|
|
93
|
+
const passthroughProps = _uiView.View.omitViewProps((0, _uiReactUtils.omitProps)(this.props, Rating.allowedProps), Rating);
|
|
94
|
+
return (0, _emotion.jsx)(_uiView.View, Object.assign({}, passthroughProps, {
|
|
95
95
|
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.rating,
|
|
96
96
|
margin: margin,
|
|
97
97
|
display: "inline-block",
|
|
98
98
|
elementRef: this.handleRef
|
|
99
|
-
}), (0, _emotion.jsx)(
|
|
99
|
+
}), (0, _emotion.jsx)(_uiA11yContent.ScreenReaderContent, null, valueText), [...Array(this.filled)].map((_x, i) => (0, _emotion.jsx)(_RatingIcon.RatingIcon, {
|
|
100
100
|
key: i + 1,
|
|
101
101
|
filled: true,
|
|
102
102
|
animateFill: animateFill,
|
|
@@ -5,7 +5,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
5
5
|
var _react2 = require("@testing-library/react");
|
|
6
6
|
require("@testing-library/jest-dom");
|
|
7
7
|
var _emotion = require("@instructure/emotion");
|
|
8
|
-
var
|
|
8
|
+
var _uiAxeCheck = require("@instructure/ui-axe-check");
|
|
9
9
|
var _index = require("../index");
|
|
10
10
|
var _RatingIcon, _RatingIcon2, _RatingIcon3, _RatingIcon4;
|
|
11
11
|
/*
|
|
@@ -105,7 +105,7 @@ describe('<RatingIcon />', () => {
|
|
|
105
105
|
animateFill: true
|
|
106
106
|
}))),
|
|
107
107
|
container = _render3.container;
|
|
108
|
-
const axeCheck = await (0,
|
|
108
|
+
const axeCheck = await (0, _uiAxeCheck.runAxeCheck)(container);
|
|
109
109
|
expect(axeCheck).toBe(true);
|
|
110
110
|
});
|
|
111
111
|
});
|
package/lib/RatingIcon/index.js
CHANGED
|
@@ -6,10 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = exports.RatingIcon = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var _Transition = require("@instructure/ui-motion/lib/Transition");
|
|
9
|
+
var _uiIcons = require("@instructure/ui-icons");
|
|
10
|
+
var _uiDomUtils = require("@instructure/ui-dom-utils");
|
|
11
|
+
var _uiMotion = require("@instructure/ui-motion");
|
|
13
12
|
var _emotion = require("@instructure/emotion");
|
|
14
13
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
15
14
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
@@ -57,7 +56,7 @@ let RatingIcon = exports.RatingIcon = (_dec = (0, _emotion.withStyle)(_styles.de
|
|
|
57
56
|
};
|
|
58
57
|
};
|
|
59
58
|
this.fill = () => {
|
|
60
|
-
this._animation = (0,
|
|
59
|
+
this._animation = (0, _uiDomUtils.requestAnimationFrame)(() => {
|
|
61
60
|
this.setState({
|
|
62
61
|
filled: true
|
|
63
62
|
});
|
|
@@ -88,13 +87,13 @@ let RatingIcon = exports.RatingIcon = (_dec = (0, _emotion.withStyle)(_styles.de
|
|
|
88
87
|
render() {
|
|
89
88
|
var _this$props$styles, _this$props$styles2, _this$props$styles3;
|
|
90
89
|
const animateFill = this.props.animateFill;
|
|
91
|
-
const Icon = this.state.filled ?
|
|
90
|
+
const Icon = this.state.filled ? _uiIcons.IconStarSolid : _uiIcons.IconStarLightSolid;
|
|
92
91
|
return (0, _emotion.jsx)("span", {
|
|
93
92
|
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.ratingIcon,
|
|
94
93
|
ref: el => {
|
|
95
94
|
this.ref = el;
|
|
96
95
|
}
|
|
97
|
-
}, (0, _emotion.jsx)("span", null, this.state.filled && animateFill ? (0, _emotion.jsx)(
|
|
96
|
+
}, (0, _emotion.jsx)("span", null, this.state.filled && animateFill ? (0, _emotion.jsx)(_uiMotion.Transition, {
|
|
98
97
|
in: true,
|
|
99
98
|
transitionOnMount: true,
|
|
100
99
|
type: "scale"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-rating",
|
|
3
|
-
"version": "8.56.
|
|
3
|
+
"version": "8.56.2-pr-snapshot-1721749364069",
|
|
4
4
|
"description": "A static rating component",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -24,22 +24,22 @@
|
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@babel/runtime": "^7.23.2",
|
|
27
|
-
"@instructure/console": "8.56.
|
|
28
|
-
"@instructure/emotion": "8.56.
|
|
29
|
-
"@instructure/shared-types": "8.56.
|
|
30
|
-
"@instructure/ui-a11y-content": "8.56.
|
|
31
|
-
"@instructure/ui-dom-utils": "8.56.
|
|
32
|
-
"@instructure/ui-icons": "8.56.
|
|
33
|
-
"@instructure/ui-motion": "8.56.
|
|
34
|
-
"@instructure/ui-react-utils": "8.56.
|
|
35
|
-
"@instructure/ui-testable": "8.56.
|
|
36
|
-
"@instructure/ui-view": "8.56.
|
|
27
|
+
"@instructure/console": "8.56.2-pr-snapshot-1721749364069",
|
|
28
|
+
"@instructure/emotion": "8.56.2-pr-snapshot-1721749364069",
|
|
29
|
+
"@instructure/shared-types": "8.56.2-pr-snapshot-1721749364069",
|
|
30
|
+
"@instructure/ui-a11y-content": "8.56.2-pr-snapshot-1721749364069",
|
|
31
|
+
"@instructure/ui-dom-utils": "8.56.2-pr-snapshot-1721749364069",
|
|
32
|
+
"@instructure/ui-icons": "8.56.2-pr-snapshot-1721749364069",
|
|
33
|
+
"@instructure/ui-motion": "8.56.2-pr-snapshot-1721749364069",
|
|
34
|
+
"@instructure/ui-react-utils": "8.56.2-pr-snapshot-1721749364069",
|
|
35
|
+
"@instructure/ui-testable": "8.56.2-pr-snapshot-1721749364069",
|
|
36
|
+
"@instructure/ui-view": "8.56.2-pr-snapshot-1721749364069",
|
|
37
37
|
"prop-types": "^15.8.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@instructure/ui-axe-check": "8.56.
|
|
41
|
-
"@instructure/ui-babel-preset": "8.56.
|
|
42
|
-
"@instructure/ui-themes": "8.56.
|
|
40
|
+
"@instructure/ui-axe-check": "8.56.2-pr-snapshot-1721749364069",
|
|
41
|
+
"@instructure/ui-babel-preset": "8.56.2-pr-snapshot-1721749364069",
|
|
42
|
+
"@instructure/ui-themes": "8.56.2-pr-snapshot-1721749364069",
|
|
43
43
|
"@testing-library/jest-dom": "^6.1.4",
|
|
44
44
|
"@testing-library/react": "^14.0.0"
|
|
45
45
|
},
|