@instructure/ui-badge 8.10.3-snapshot.2 → 8.10.3-snapshot.25

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/es/Badge/index.js CHANGED
@@ -48,41 +48,43 @@ let Badge = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = te
48
48
  this.ref = null;
49
49
 
50
50
  this.handleRef = el => {
51
- var _this$props$elementRe, _this$props;
52
-
51
+ const elementRef = this.props.elementRef;
53
52
  this.ref = el;
54
- (_this$props$elementRe = (_this$props = this.props).elementRef) === null || _this$props$elementRe === void 0 ? void 0 : _this$props$elementRe.call(_this$props, el);
53
+
54
+ if (typeof elementRef === 'function') {
55
+ elementRef(el);
56
+ }
55
57
  };
56
58
 
57
59
  this._defaultId = uid('Badge');
58
60
  }
59
61
 
60
62
  componentDidMount() {
61
- var _this$props$makeStyle, _this$props2;
63
+ var _this$props$makeStyle, _this$props;
62
64
 
63
- (_this$props$makeStyle = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props2);
65
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
64
66
  }
65
67
 
66
68
  componentDidUpdate() {
67
- var _this$props$makeStyle2, _this$props3;
69
+ var _this$props$makeStyle2, _this$props2;
68
70
 
69
- (_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3);
71
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
70
72
  }
71
73
 
72
74
  countOverflow() {
73
- const _this$props4 = this.props,
74
- count = _this$props4.count,
75
- countUntil = _this$props4.countUntil;
75
+ const _this$props3 = this.props,
76
+ count = _this$props3.count,
77
+ countUntil = _this$props3.countUntil;
76
78
  return countUntil && count && countUntil > 1 && count >= countUntil;
77
79
  }
78
80
 
79
81
  renderOutput() {
80
- const _this$props5 = this.props,
81
- count = _this$props5.count,
82
- countUntil = _this$props5.countUntil,
83
- formatOverflowText = _this$props5.formatOverflowText,
84
- formatOutput = _this$props5.formatOutput,
85
- type = _this$props5.type; // If the badge count is >= than the countUntil limit, format the badge text
82
+ const _this$props4 = this.props,
83
+ count = _this$props4.count,
84
+ countUntil = _this$props4.countUntil,
85
+ formatOverflowText = _this$props4.formatOverflowText,
86
+ formatOutput = _this$props4.formatOutput,
87
+ type = _this$props4.type; // If the badge count is >= than the countUntil limit, format the badge text
86
88
  // via the formatOverflowText function prop
87
89
 
88
90
  let formattedCount = (count || '').toString();
@@ -99,12 +101,12 @@ let Badge = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = te
99
101
  }
100
102
 
101
103
  renderBadge() {
102
- const _this$props6 = this.props,
103
- count = _this$props6.count,
104
- margin = _this$props6.margin,
105
- standalone = _this$props6.standalone,
106
- type = _this$props6.type,
107
- styles = _this$props6.styles;
104
+ const _this$props5 = this.props,
105
+ count = _this$props5.count,
106
+ margin = _this$props5.margin,
107
+ standalone = _this$props5.standalone,
108
+ type = _this$props5.type,
109
+ styles = _this$props5.styles;
108
110
  return jsx(View, Object.assign({
109
111
  margin: standalone ? margin : 'none',
110
112
  css: styles === null || styles === void 0 ? void 0 : styles.badge,
@@ -125,11 +127,11 @@ let Badge = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = te
125
127
  }
126
128
 
127
129
  render() {
128
- const _this$props7 = this.props,
129
- margin = _this$props7.margin,
130
- standalone = _this$props7.standalone,
131
- as = _this$props7.as,
132
- styles = _this$props7.styles;
130
+ const _this$props6 = this.props,
131
+ margin = _this$props6.margin,
132
+ standalone = _this$props6.standalone,
133
+ as = _this$props6.as,
134
+ styles = _this$props6.styles;
133
135
 
134
136
  if (standalone) {
135
137
  return this.renderBadge();
@@ -40,41 +40,43 @@ let Badge = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _d
40
40
  this.ref = null;
41
41
 
42
42
  this.handleRef = el => {
43
- var _this$props$elementRe, _this$props;
44
-
43
+ const elementRef = this.props.elementRef;
45
44
  this.ref = el;
46
- (_this$props$elementRe = (_this$props = this.props).elementRef) === null || _this$props$elementRe === void 0 ? void 0 : _this$props$elementRe.call(_this$props, el);
45
+
46
+ if (typeof elementRef === 'function') {
47
+ elementRef(el);
48
+ }
47
49
  };
48
50
 
49
51
  this._defaultId = (0, _uid.uid)('Badge');
50
52
  }
51
53
 
52
54
  componentDidMount() {
53
- var _this$props$makeStyle, _this$props2;
55
+ var _this$props$makeStyle, _this$props;
54
56
 
55
- (_this$props$makeStyle = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props2);
57
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
56
58
  }
57
59
 
58
60
  componentDidUpdate() {
59
- var _this$props$makeStyle2, _this$props3;
61
+ var _this$props$makeStyle2, _this$props2;
60
62
 
61
- (_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3);
63
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
62
64
  }
63
65
 
64
66
  countOverflow() {
65
- const _this$props4 = this.props,
66
- count = _this$props4.count,
67
- countUntil = _this$props4.countUntil;
67
+ const _this$props3 = this.props,
68
+ count = _this$props3.count,
69
+ countUntil = _this$props3.countUntil;
68
70
  return countUntil && count && countUntil > 1 && count >= countUntil;
69
71
  }
70
72
 
71
73
  renderOutput() {
72
- const _this$props5 = this.props,
73
- count = _this$props5.count,
74
- countUntil = _this$props5.countUntil,
75
- formatOverflowText = _this$props5.formatOverflowText,
76
- formatOutput = _this$props5.formatOutput,
77
- type = _this$props5.type; // If the badge count is >= than the countUntil limit, format the badge text
74
+ const _this$props4 = this.props,
75
+ count = _this$props4.count,
76
+ countUntil = _this$props4.countUntil,
77
+ formatOverflowText = _this$props4.formatOverflowText,
78
+ formatOutput = _this$props4.formatOutput,
79
+ type = _this$props4.type; // If the badge count is >= than the countUntil limit, format the badge text
78
80
  // via the formatOverflowText function prop
79
81
 
80
82
  let formattedCount = (count || '').toString();
@@ -91,12 +93,12 @@ let Badge = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _d
91
93
  }
92
94
 
93
95
  renderBadge() {
94
- const _this$props6 = this.props,
95
- count = _this$props6.count,
96
- margin = _this$props6.margin,
97
- standalone = _this$props6.standalone,
98
- type = _this$props6.type,
99
- styles = _this$props6.styles;
96
+ const _this$props5 = this.props,
97
+ count = _this$props5.count,
98
+ margin = _this$props5.margin,
99
+ standalone = _this$props5.standalone,
100
+ type = _this$props5.type,
101
+ styles = _this$props5.styles;
100
102
  return (0, _emotion.jsx)(_View.View, Object.assign({
101
103
  margin: standalone ? margin : 'none',
102
104
  css: styles === null || styles === void 0 ? void 0 : styles.badge,
@@ -117,11 +119,11 @@ let Badge = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _d
117
119
  }
118
120
 
119
121
  render() {
120
- const _this$props7 = this.props,
121
- margin = _this$props7.margin,
122
- standalone = _this$props7.standalone,
123
- as = _this$props7.as,
124
- styles = _this$props7.styles;
122
+ const _this$props6 = this.props,
123
+ margin = _this$props6.margin,
124
+ standalone = _this$props6.standalone,
125
+ as = _this$props6.as,
126
+ styles = _this$props6.styles;
125
127
 
126
128
  if (standalone) {
127
129
  return this.renderBadge();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-badge",
3
- "version": "8.10.3-snapshot.2+ccdf8f43b",
3
+ "version": "8.10.3-snapshot.25+ed32a6c3b",
4
4
  "description": "A badge component",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "type": "commonjs",
@@ -25,22 +25,22 @@
25
25
  "license": "MIT",
26
26
  "dependencies": {
27
27
  "@babel/runtime": "^7.13.10",
28
- "@instructure/console": "8.10.3-snapshot.2+ccdf8f43b",
29
- "@instructure/emotion": "8.10.3-snapshot.2+ccdf8f43b",
30
- "@instructure/shared-types": "8.10.3-snapshot.2+ccdf8f43b",
31
- "@instructure/ui-color-utils": "8.10.3-snapshot.2+ccdf8f43b",
32
- "@instructure/ui-position": "8.10.3-snapshot.2+ccdf8f43b",
33
- "@instructure/ui-react-utils": "8.10.3-snapshot.2+ccdf8f43b",
34
- "@instructure/ui-testable": "8.10.3-snapshot.2+ccdf8f43b",
35
- "@instructure/ui-view": "8.10.3-snapshot.2+ccdf8f43b",
36
- "@instructure/uid": "8.10.3-snapshot.2+ccdf8f43b",
28
+ "@instructure/console": "8.10.3-snapshot.25+ed32a6c3b",
29
+ "@instructure/emotion": "8.10.3-snapshot.25+ed32a6c3b",
30
+ "@instructure/shared-types": "8.10.3-snapshot.25+ed32a6c3b",
31
+ "@instructure/ui-color-utils": "8.10.3-snapshot.25+ed32a6c3b",
32
+ "@instructure/ui-position": "8.10.3-snapshot.25+ed32a6c3b",
33
+ "@instructure/ui-react-utils": "8.10.3-snapshot.25+ed32a6c3b",
34
+ "@instructure/ui-testable": "8.10.3-snapshot.25+ed32a6c3b",
35
+ "@instructure/ui-view": "8.10.3-snapshot.25+ed32a6c3b",
36
+ "@instructure/uid": "8.10.3-snapshot.25+ed32a6c3b",
37
37
  "prop-types": "^15"
38
38
  },
39
39
  "devDependencies": {
40
- "@instructure/ui-babel-preset": "8.10.3-snapshot.2+ccdf8f43b",
41
- "@instructure/ui-test-locator": "8.10.3-snapshot.2+ccdf8f43b",
42
- "@instructure/ui-test-utils": "8.10.3-snapshot.2+ccdf8f43b",
43
- "@instructure/ui-themes": "8.10.3-snapshot.2+ccdf8f43b"
40
+ "@instructure/ui-babel-preset": "8.10.3-snapshot.25+ed32a6c3b",
41
+ "@instructure/ui-test-locator": "8.10.3-snapshot.25+ed32a6c3b",
42
+ "@instructure/ui-test-utils": "8.10.3-snapshot.25+ed32a6c3b",
43
+ "@instructure/ui-themes": "8.10.3-snapshot.25+ed32a6c3b"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "react": ">=16.8 <=17"
@@ -49,5 +49,5 @@
49
49
  "access": "public"
50
50
  },
51
51
  "sideEffects": false,
52
- "gitHead": "ccdf8f43b56a8edef32600281692dfeb436d5a01"
52
+ "gitHead": "ed32a6c3b14ddb7fbbb5b543d9871a296f06e4c0"
53
53
  }
@@ -78,8 +78,13 @@ class Badge extends Component<BadgeProps> {
78
78
  ref: Element | null = null
79
79
 
80
80
  handleRef = (el: Element | null) => {
81
+ const { elementRef } = this.props
82
+
81
83
  this.ref = el
82
- this.props.elementRef?.(el)
84
+
85
+ if (typeof elementRef === 'function') {
86
+ elementRef(el)
87
+ }
83
88
  }
84
89
 
85
90
  componentDidMount() {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Badge/index.tsx"],"names":[],"mappings":"AAwBA,eAAe;AACf,OAAO,EAAE,SAAS,EAAY,YAAY,EAAE,MAAM,OAAO,CAAA;AAOzD,OAAO,EAAa,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAMrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAEzC;;;;;GAKG;AAEH,cAEM,KAAM,SAAQ,SAAS,CAAC,UAAU,CAAC;IACvC,MAAM,CAAC,QAAQ,CAAC,WAAW,WAAU;IAErC,MAAM,CAAC,SAAS;;;;;;;;;;;;;;OAAY;IAC5B,MAAM,CAAC,YAAY;;;;;;;;;;;;;;SAAe;IAClC,MAAM,CAAC,YAAY;;;;;;;;;;;;qCAYY,MAAM,cAAc,MAAM;MAExD;gBAEW,KAAK,EAAE,UAAU;IAK7B,UAAU,EAAE,MAAM,CAAA;IAElB,GAAG,EAAE,OA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