@instructure/ui-rating 8.18.0 → 8.18.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/LICENSE.md ADDED
@@ -0,0 +1,27 @@
1
+ ---
2
+ title: The MIT License (MIT)
3
+ category: Getting Started
4
+ order: 9
5
+ ---
6
+
7
+ # The MIT License (MIT)
8
+
9
+ Copyright (c) 2015 Instructure, Inc.
10
+
11
+ **Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ of this software and associated documentation files (the "Software"), to deal
13
+ in the Software without restriction, including without limitation the rights
14
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ copies of the Software, and to permit persons to whom the Software is
16
+ furnished to do so, subject to the following conditions.**
17
+
18
+ The above copyright notice and this permission notice shall be included in all
19
+ copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ SOFTWARE.
@@ -51,18 +51,22 @@ let Rating = (_dec = withStyle(generateStyle, null), _dec2 = testable(), _dec(_c
51
51
  }
52
52
 
53
53
  componentDidMount() {
54
- this.props.makeStyles?.();
54
+ var _this$props$makeStyle, _this$props;
55
+
56
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
55
57
  }
56
58
 
57
59
  componentDidUpdate() {
58
- this.props.makeStyles?.();
60
+ var _this$props$makeStyle2, _this$props2;
61
+
62
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
59
63
  }
60
64
 
61
65
  get filled() {
62
- const _this$props = this.props,
63
- valueNow = _this$props.valueNow,
64
- iconCount = _this$props.iconCount,
65
- valueMax = _this$props.valueMax; // prevent divide by zero errors
66
+ const _this$props3 = this.props,
67
+ valueNow = _this$props3.valueNow,
68
+ iconCount = _this$props3.iconCount,
69
+ valueMax = _this$props3.valueMax; // prevent divide by zero errors
66
70
 
67
71
  const max = valueMax > 0 ? valueMax : iconCount;
68
72
  const filledIcons = Math.round(valueNow * iconCount / max); // Handle edge case where valueNow is greater than valueMax
@@ -79,17 +83,19 @@ let Rating = (_dec = withStyle(generateStyle, null), _dec2 = testable(), _dec(_c
79
83
  }
80
84
 
81
85
  render() {
82
- const _this$props2 = this.props,
83
- iconCount = _this$props2.iconCount,
84
- animateFill = _this$props2.animateFill,
85
- size = _this$props2.size,
86
- margin = _this$props2.margin,
87
- label = _this$props2.label,
88
- formatValueText = _this$props2.formatValueText;
86
+ var _this$props$styles;
87
+
88
+ const _this$props4 = this.props,
89
+ iconCount = _this$props4.iconCount,
90
+ animateFill = _this$props4.animateFill,
91
+ size = _this$props4.size,
92
+ margin = _this$props4.margin,
93
+ label = _this$props4.label,
94
+ formatValueText = _this$props4.formatValueText;
89
95
  const valueText = label + ' ' + formatValueText(this.filled, iconCount);
90
96
  const passthroughProps = View.omitViewProps(omitProps(this.props, Rating.allowedProps), Rating);
91
97
  return jsx(View, Object.assign({}, passthroughProps, {
92
- css: this.props.styles?.rating,
98
+ css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.rating,
93
99
  margin: margin,
94
100
  display: "inline-block",
95
101
  elementRef: this.handleRef
@@ -67,7 +67,9 @@ let RatingIcon = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(
67
67
  }
68
68
 
69
69
  componentDidMount() {
70
- this.props.makeStyles?.(this.makeStyleProps());
70
+ var _this$props$makeStyle, _this$props;
71
+
72
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, this.makeStyleProps());
71
73
 
72
74
  if (this.props.animateFill) {
73
75
  this._timeouts.push(setTimeout(this.fill, this.props.animationDelay));
@@ -75,11 +77,13 @@ let RatingIcon = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(
75
77
  }
76
78
 
77
79
  componentDidUpdate(prevProps) {
80
+ var _this$props$makeStyle2, _this$props2;
81
+
78
82
  if (this.props.animateFill && this.props.filled && this.props.filled !== prevProps.filled) {
79
83
  this.fill();
80
84
  }
81
85
 
82
- this.props.makeStyles?.(this.makeStyleProps());
86
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, this.makeStyleProps());
83
87
  }
84
88
 
85
89
  componentWillUnmount() {
@@ -89,10 +93,12 @@ let RatingIcon = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(
89
93
  }
90
94
 
91
95
  render() {
96
+ var _this$props$styles, _this$props$styles2, _this$props$styles3;
97
+
92
98
  const animateFill = this.props.animateFill;
93
99
  const Icon = this.state.filled ? IconStarSolid : IconStarLightSolid;
94
100
  return jsx("span", {
95
- css: this.props.styles?.ratingIcon,
101
+ css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.ratingIcon,
96
102
  ref: el => {
97
103
  this.ref = el;
98
104
  }
@@ -101,9 +107,9 @@ let RatingIcon = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(
101
107
  transitionOnMount: true,
102
108
  type: "scale"
103
109
  }, jsx(Icon, {
104
- css: this.props.styles?.icon
110
+ css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.icon
105
111
  })) : jsx(Icon, {
106
- css: this.props.styles?.icon
112
+ css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.icon
107
113
  })));
108
114
  }
109
115
 
@@ -39,12 +39,12 @@ const generateComponentTheme = theme => {
39
39
  }
40
40
  };
41
41
  const componentVariables = {
42
- iconMargin: spacing?.xxxSmall,
43
- iconEmptyColor: colors?.textBrand,
44
- iconFilledColor: colors?.textBrand,
45
- smallIconFontSize: typography?.fontSizeMedium,
46
- mediumIconFontSize: typography?.fontSizeLarge,
47
- largeIconFontSize: typography?.fontSizeXXLarge
42
+ iconMargin: spacing === null || spacing === void 0 ? void 0 : spacing.xxxSmall,
43
+ iconEmptyColor: colors === null || colors === void 0 ? void 0 : colors.textBrand,
44
+ iconFilledColor: colors === null || colors === void 0 ? void 0 : colors.textBrand,
45
+ smallIconFontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeMedium,
46
+ mediumIconFontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeLarge,
47
+ largeIconFontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeXXLarge
48
48
  };
49
49
  return { ...componentVariables,
50
50
  ...themeSpecificStyle[themeName]
@@ -43,18 +43,22 @@ let Rating = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec2 = (0,
43
43
  }
44
44
 
45
45
  componentDidMount() {
46
- this.props.makeStyles?.();
46
+ var _this$props$makeStyle, _this$props;
47
+
48
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
47
49
  }
48
50
 
49
51
  componentDidUpdate() {
50
- this.props.makeStyles?.();
52
+ var _this$props$makeStyle2, _this$props2;
53
+
54
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
51
55
  }
52
56
 
53
57
  get filled() {
54
- const _this$props = this.props,
55
- valueNow = _this$props.valueNow,
56
- iconCount = _this$props.iconCount,
57
- valueMax = _this$props.valueMax; // prevent divide by zero errors
58
+ const _this$props3 = this.props,
59
+ valueNow = _this$props3.valueNow,
60
+ iconCount = _this$props3.iconCount,
61
+ valueMax = _this$props3.valueMax; // prevent divide by zero errors
58
62
 
59
63
  const max = valueMax > 0 ? valueMax : iconCount;
60
64
  const filledIcons = Math.round(valueNow * iconCount / max); // Handle edge case where valueNow is greater than valueMax
@@ -71,19 +75,21 @@ let Rating = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec2 = (0,
71
75
  }
72
76
 
73
77
  render() {
74
- const _this$props2 = this.props,
75
- iconCount = _this$props2.iconCount,
76
- animateFill = _this$props2.animateFill,
77
- size = _this$props2.size,
78
- margin = _this$props2.margin,
79
- label = _this$props2.label,
80
- formatValueText = _this$props2.formatValueText;
78
+ var _this$props$styles;
79
+
80
+ const _this$props4 = this.props,
81
+ iconCount = _this$props4.iconCount,
82
+ animateFill = _this$props4.animateFill,
83
+ size = _this$props4.size,
84
+ margin = _this$props4.margin,
85
+ label = _this$props4.label,
86
+ formatValueText = _this$props4.formatValueText;
81
87
  const valueText = label + ' ' + formatValueText(this.filled, iconCount);
82
88
 
83
89
  const passthroughProps = _View.View.omitViewProps((0, _omitProps.omitProps)(this.props, Rating.allowedProps), Rating);
84
90
 
85
91
  return (0, _emotion.jsx)(_View.View, Object.assign({}, passthroughProps, {
86
- css: this.props.styles?.rating,
92
+ css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.rating,
87
93
  margin: margin,
88
94
  display: "inline-block",
89
95
  elementRef: this.handleRef
@@ -60,7 +60,9 @@ let RatingIcon = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
60
60
  }
61
61
 
62
62
  componentDidMount() {
63
- this.props.makeStyles?.(this.makeStyleProps());
63
+ var _this$props$makeStyle, _this$props;
64
+
65
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, this.makeStyleProps());
64
66
 
65
67
  if (this.props.animateFill) {
66
68
  this._timeouts.push(setTimeout(this.fill, this.props.animationDelay));
@@ -68,11 +70,13 @@ let RatingIcon = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
68
70
  }
69
71
 
70
72
  componentDidUpdate(prevProps) {
73
+ var _this$props$makeStyle2, _this$props2;
74
+
71
75
  if (this.props.animateFill && this.props.filled && this.props.filled !== prevProps.filled) {
72
76
  this.fill();
73
77
  }
74
78
 
75
- this.props.makeStyles?.(this.makeStyleProps());
79
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, this.makeStyleProps());
76
80
  }
77
81
 
78
82
  componentWillUnmount() {
@@ -82,10 +86,12 @@ let RatingIcon = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
82
86
  }
83
87
 
84
88
  render() {
89
+ var _this$props$styles, _this$props$styles2, _this$props$styles3;
90
+
85
91
  const animateFill = this.props.animateFill;
86
92
  const Icon = this.state.filled ? _IconStarSolid.IconStarSolid : _IconStarLightSolid.IconStarLightSolid;
87
93
  return (0, _emotion.jsx)("span", {
88
- css: this.props.styles?.ratingIcon,
94
+ css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.ratingIcon,
89
95
  ref: el => {
90
96
  this.ref = el;
91
97
  }
@@ -94,9 +100,9 @@ let RatingIcon = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
94
100
  transitionOnMount: true,
95
101
  type: "scale"
96
102
  }, (0, _emotion.jsx)(Icon, {
97
- css: this.props.styles?.icon
103
+ css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.icon
98
104
  })) : (0, _emotion.jsx)(Icon, {
99
- css: this.props.styles?.icon
105
+ css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.icon
100
106
  })));
101
107
  }
102
108
 
@@ -46,12 +46,12 @@ const generateComponentTheme = theme => {
46
46
  }
47
47
  };
48
48
  const componentVariables = {
49
- iconMargin: spacing?.xxxSmall,
50
- iconEmptyColor: colors?.textBrand,
51
- iconFilledColor: colors?.textBrand,
52
- smallIconFontSize: typography?.fontSizeMedium,
53
- mediumIconFontSize: typography?.fontSizeLarge,
54
- largeIconFontSize: typography?.fontSizeXXLarge
49
+ iconMargin: spacing === null || spacing === void 0 ? void 0 : spacing.xxxSmall,
50
+ iconEmptyColor: colors === null || colors === void 0 ? void 0 : colors.textBrand,
51
+ iconFilledColor: colors === null || colors === void 0 ? void 0 : colors.textBrand,
52
+ smallIconFontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeMedium,
53
+ mediumIconFontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeLarge,
54
+ largeIconFontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeXXLarge
55
55
  };
56
56
  return { ...componentVariables,
57
57
  ...themeSpecificStyle[themeName]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-rating",
3
- "version": "8.18.0",
3
+ "version": "8.18.1-snapshot.0+435c9ae79",
4
4
  "description": "A static rating component",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "module": "./es/index.js",
@@ -24,23 +24,23 @@
24
24
  "license": "MIT",
25
25
  "dependencies": {
26
26
  "@babel/runtime": "^7.13.10",
27
- "@instructure/console": "8.18.0",
28
- "@instructure/emotion": "8.18.0",
29
- "@instructure/shared-types": "8.18.0",
30
- "@instructure/ui-a11y-content": "8.18.0",
31
- "@instructure/ui-dom-utils": "8.18.0",
32
- "@instructure/ui-icons": "8.18.0",
33
- "@instructure/ui-motion": "8.18.0",
34
- "@instructure/ui-react-utils": "8.18.0",
35
- "@instructure/ui-testable": "8.18.0",
36
- "@instructure/ui-view": "8.18.0",
27
+ "@instructure/console": "8.18.1-snapshot.0+435c9ae79",
28
+ "@instructure/emotion": "8.18.1-snapshot.0+435c9ae79",
29
+ "@instructure/shared-types": "8.18.1-snapshot.0+435c9ae79",
30
+ "@instructure/ui-a11y-content": "8.18.1-snapshot.0+435c9ae79",
31
+ "@instructure/ui-dom-utils": "8.18.1-snapshot.0+435c9ae79",
32
+ "@instructure/ui-icons": "8.18.1-snapshot.0+435c9ae79",
33
+ "@instructure/ui-motion": "8.18.1-snapshot.0+435c9ae79",
34
+ "@instructure/ui-react-utils": "8.18.1-snapshot.0+435c9ae79",
35
+ "@instructure/ui-testable": "8.18.1-snapshot.0+435c9ae79",
36
+ "@instructure/ui-view": "8.18.1-snapshot.0+435c9ae79",
37
37
  "prop-types": "^15"
38
38
  },
39
39
  "devDependencies": {
40
- "@instructure/ui-babel-preset": "8.18.0",
41
- "@instructure/ui-test-locator": "8.18.0",
42
- "@instructure/ui-test-utils": "8.18.0",
43
- "@instructure/ui-themes": "8.18.0"
40
+ "@instructure/ui-babel-preset": "8.18.1-snapshot.0+435c9ae79",
41
+ "@instructure/ui-test-locator": "8.18.1-snapshot.0+435c9ae79",
42
+ "@instructure/ui-test-utils": "8.18.1-snapshot.0+435c9ae79",
43
+ "@instructure/ui-themes": "8.18.1-snapshot.0+435c9ae79"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "react": ">=16.8 <=17"
@@ -48,5 +48,6 @@
48
48
  "publishConfig": {
49
49
  "access": "public"
50
50
  },
51
- "sideEffects": false
51
+ "sideEffects": false,
52
+ "gitHead": "435c9ae794c15e2bd103f700f8c4e946d91c1b59"
52
53
  }