@instructure/ui-rating 8.10.1 → 8.10.2-snapshot.22

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.
@@ -41,6 +41,11 @@ category: components
41
41
  **/
42
42
 
43
43
  let Rating = (_dec = withStyle(generateStyle, null), _dec2 = testable(), _dec(_class = _dec2(_class = (_temp = _class2 = class Rating extends Component {
44
+ constructor(...args) {
45
+ super(...args);
46
+ this.ref = null;
47
+ }
48
+
44
49
  componentDidMount() {
45
50
  var _this$props$makeStyle, _this$props;
46
51
 
@@ -88,7 +93,10 @@ let Rating = (_dec = withStyle(generateStyle, null), _dec2 = testable(), _dec(_c
88
93
  return jsx(View, Object.assign({}, passthroughProps, {
89
94
  css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.rating,
90
95
  margin: margin,
91
- display: "inline-block"
96
+ display: "inline-block",
97
+ elementRef: el => {
98
+ this.ref = el;
99
+ }
92
100
  }), jsx(ScreenReaderContent, null, valueText), [...Array(this.filled)].map((x, i) => jsx(RatingIcon, {
93
101
  key: i + 1,
94
102
  filled: true,
@@ -43,6 +43,7 @@ id: Rating.Icon
43
43
  let RatingIcon = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = class RatingIcon extends Component {
44
44
  constructor(props) {
45
45
  super();
46
+ this.ref = null;
46
47
  this._timeouts = [];
47
48
  this._animation = void 0;
48
49
 
@@ -97,7 +98,10 @@ let RatingIcon = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(
97
98
  const animateFill = this.props.animateFill;
98
99
  const Icon = this.state.filled ? IconStarSolid : IconStarLightSolid;
99
100
  return jsx("span", {
100
- css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.ratingIcon
101
+ css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.ratingIcon,
102
+ ref: el => {
103
+ this.ref = el;
104
+ }
101
105
  }, jsx("span", null, this.state.filled && animateFill ? jsx(Transition, {
102
106
  in: true,
103
107
  transitionOnMount: true,
@@ -33,6 +33,11 @@ category: components
33
33
  ---
34
34
  **/
35
35
  let Rating = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = (_temp = _class2 = class Rating extends _react.Component {
36
+ constructor(...args) {
37
+ super(...args);
38
+ this.ref = null;
39
+ }
40
+
36
41
  componentDidMount() {
37
42
  var _this$props$makeStyle, _this$props;
38
43
 
@@ -82,7 +87,10 @@ let Rating = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec2 = (0,
82
87
  return (0, _emotion.jsx)(_View.View, Object.assign({}, passthroughProps, {
83
88
  css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.rating,
84
89
  margin: margin,
85
- display: "inline-block"
90
+ display: "inline-block",
91
+ elementRef: el => {
92
+ this.ref = el;
93
+ }
86
94
  }), (0, _emotion.jsx)(_ScreenReaderContent.ScreenReaderContent, null, valueText), [...Array(this.filled)].map((x, i) => (0, _emotion.jsx)(_RatingIcon.RatingIcon, {
87
95
  key: i + 1,
88
96
  filled: true,
@@ -36,6 +36,7 @@ id: Rating.Icon
36
36
  let RatingIcon = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_temp = _class2 = class RatingIcon extends _react.Component {
37
37
  constructor(props) {
38
38
  super();
39
+ this.ref = null;
39
40
  this._timeouts = [];
40
41
  this._animation = void 0;
41
42
 
@@ -90,7 +91,10 @@ let RatingIcon = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
90
91
  const animateFill = this.props.animateFill;
91
92
  const Icon = this.state.filled ? _IconStarSolid.IconStarSolid : _IconStarLightSolid.IconStarLightSolid;
92
93
  return (0, _emotion.jsx)("span", {
93
- css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.ratingIcon
94
+ css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.ratingIcon,
95
+ ref: el => {
96
+ this.ref = el;
97
+ }
94
98
  }, (0, _emotion.jsx)("span", null, this.state.filled && animateFill ? (0, _emotion.jsx)(_Transition.Transition, {
95
99
  in: true,
96
100
  transitionOnMount: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-rating",
3
- "version": "8.10.1",
3
+ "version": "8.10.2-snapshot.22+b84160eff",
4
4
  "description": "A static rating component",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "type": "commonjs",
@@ -25,23 +25,23 @@
25
25
  "license": "MIT",
26
26
  "dependencies": {
27
27
  "@babel/runtime": "^7.13.10",
28
- "@instructure/console": "8.10.1",
29
- "@instructure/emotion": "8.10.1",
30
- "@instructure/shared-types": "8.10.1",
31
- "@instructure/ui-a11y-content": "8.10.1",
32
- "@instructure/ui-dom-utils": "8.10.1",
33
- "@instructure/ui-icons": "8.10.1",
34
- "@instructure/ui-motion": "8.10.1",
35
- "@instructure/ui-react-utils": "8.10.1",
36
- "@instructure/ui-testable": "8.10.1",
37
- "@instructure/ui-view": "8.10.1",
28
+ "@instructure/console": "8.10.2-snapshot.22+b84160eff",
29
+ "@instructure/emotion": "8.10.2-snapshot.22+b84160eff",
30
+ "@instructure/shared-types": "8.10.2-snapshot.22+b84160eff",
31
+ "@instructure/ui-a11y-content": "8.10.2-snapshot.22+b84160eff",
32
+ "@instructure/ui-dom-utils": "8.10.2-snapshot.22+b84160eff",
33
+ "@instructure/ui-icons": "8.10.2-snapshot.22+b84160eff",
34
+ "@instructure/ui-motion": "8.10.2-snapshot.22+b84160eff",
35
+ "@instructure/ui-react-utils": "8.10.2-snapshot.22+b84160eff",
36
+ "@instructure/ui-testable": "8.10.2-snapshot.22+b84160eff",
37
+ "@instructure/ui-view": "8.10.2-snapshot.22+b84160eff",
38
38
  "prop-types": "^15"
39
39
  },
40
40
  "devDependencies": {
41
- "@instructure/ui-babel-preset": "8.10.1",
42
- "@instructure/ui-test-locator": "8.10.1",
43
- "@instructure/ui-test-utils": "8.10.1",
44
- "@instructure/ui-themes": "8.10.1"
41
+ "@instructure/ui-babel-preset": "8.10.2-snapshot.22+b84160eff",
42
+ "@instructure/ui-test-locator": "8.10.2-snapshot.22+b84160eff",
43
+ "@instructure/ui-test-utils": "8.10.2-snapshot.22+b84160eff",
44
+ "@instructure/ui-themes": "8.10.2-snapshot.22+b84160eff"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "react": ">=16.8 <=17"
@@ -49,5 +49,6 @@
49
49
  "publishConfig": {
50
50
  "access": "public"
51
51
  },
52
- "sideEffects": false
52
+ "sideEffects": false,
53
+ "gitHead": "b84160effefb01aeb94b754f0b7a64f8dad1b7f2"
53
54
  }
@@ -59,6 +59,8 @@ class Rating extends Component<RatingProps> {
59
59
 
60
60
  static Icon = RatingIcon
61
61
 
62
+ ref: Element | null = null
63
+
62
64
  componentDidMount() {
63
65
  this.props.makeStyles?.()
64
66
  }
@@ -115,6 +117,9 @@ class Rating extends Component<RatingProps> {
115
117
  css={this.props.styles?.rating}
116
118
  margin={margin}
117
119
  display="inline-block"
120
+ elementRef={(el) => {
121
+ this.ref = el
122
+ }}
118
123
  >
119
124
  <ScreenReaderContent>{valueText}</ScreenReaderContent>
120
125
  {/* @ts-expect-error ts-migrate(6133) FIXME: 'x' is declared but its value is never read. */}
@@ -56,6 +56,8 @@ class RatingIcon extends Component<RatingIconProps, RatingIconState> {
56
56
  size: 'medium'
57
57
  }
58
58
 
59
+ ref: Element | null = null
60
+
59
61
  // @ts-expect-error ts-migrate(7006) FIXME: Parameter 'props' implicitly has an 'any' type.
60
62
  constructor(props) {
61
63
  // @ts-expect-error ts-migrate(2554) FIXME: Expected 1-2 arguments, but got 0.
@@ -110,7 +112,12 @@ class RatingIcon extends Component<RatingIconProps, RatingIconState> {
110
112
  const Icon = this.state.filled ? IconStarSolid : IconStarLightSolid
111
113
 
112
114
  return (
113
- <span css={this.props.styles?.ratingIcon}>
115
+ <span
116
+ css={this.props.styles?.ratingIcon}
117
+ ref={(el) => {
118
+ this.ref = el
119
+ }}
120
+ >
114
121
  <span>
115
122
  {this.state.filled && animateFill ? (
116
123
  <Transition in transitionOnMount type="scale">
@@ -38,6 +38,7 @@ declare class Rating extends Component<RatingProps> {
38
38
  valueNow: number;
39
39
  };
40
40
  static Icon: typeof RatingIcon;
41
+ ref: Element | null;
41
42
  componentDidMount(): void;
42
43
  componentDidUpdate(): void;
43
44
  get filled(): number | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src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AG,IAAI,CAAO;IAE1B,iBAAiB;IAIjB,kBAAkB;IAIlB,IAAI,MAAM,uBAiBT;IAED,IAAI,KAAK,WAGR;IAED,MAAM;CA+CP;AAED,eAAe,MAAM,CAAA;AACrB,OAAO,EAAE,MAAM,EAAE,CAAA"}
@@ -29,6 +29,7 @@ declare class RatingIcon extends Component<RatingIconProps, RatingIconState> {
29
29
  filled: boolean;
30
30
  size: string;
31
31
  };
32
+ ref: Element | null;
32
33
  constructor(props: any);
33
34
  _timeouts: never[];
34
35
  _animation: RequestAnimationFrameType | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/RatingIcon/index.tsx"],"names":[],"mappings":"AAwBA,eAAe;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAIjC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAA;AAG1E,OAAO,EAAa,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAGrD,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAG/D;;;;;GAKG;AACH,cACM,UAAW,SAAQ,SAAS,CAAC,eAAe,EAAE,eAAe,CAAC;IAClE,MAAM,CAAC,QAAQ,CAAC,WAAW,iBAAgB;IAE3C,MAAM,CAAC,YAAY;;;;;SAAe;IAClC,MAAM,CAAC,SAAS;;;;;OAAY;IAE5B,MAAM,CAAC,YAAY;;;;;MAKlB;gBAGW,KAAK,KAAA;IASjB,SAAS,UAAK;IACd,UAAU,EAAE,yBAAyB,GAAG,SAAS,CAAA;IAEjD,iBAAiB;IAQjB,kBAAkB,CAAC,SAAS,EAAE,eAAe;IAW7C,oBAAoB;IAKpB,cAAc;;MAEb;IAED,IAAI,aAMH;IAED,MAAM;CAkBP;AAED,eAAe,UAAU,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/RatingIcon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