@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 +29 -27
- package/lib/Badge/index.js +29 -27
- package/package.json +15 -15
- package/src/Badge/index.tsx +6 -1
- package/types/Badge/index.d.ts.map +1 -1
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
|
-
|
|
52
|
-
|
|
51
|
+
const elementRef = this.props.elementRef;
|
|
53
52
|
this.ref = el;
|
|
54
|
-
|
|
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$
|
|
63
|
+
var _this$props$makeStyle, _this$props;
|
|
62
64
|
|
|
63
|
-
(_this$props$makeStyle = (_this$
|
|
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$
|
|
69
|
+
var _this$props$makeStyle2, _this$props2;
|
|
68
70
|
|
|
69
|
-
(_this$props$makeStyle2 = (_this$
|
|
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$
|
|
74
|
-
count = _this$
|
|
75
|
-
countUntil = _this$
|
|
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$
|
|
81
|
-
count = _this$
|
|
82
|
-
countUntil = _this$
|
|
83
|
-
formatOverflowText = _this$
|
|
84
|
-
formatOutput = _this$
|
|
85
|
-
type = _this$
|
|
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$
|
|
103
|
-
count = _this$
|
|
104
|
-
margin = _this$
|
|
105
|
-
standalone = _this$
|
|
106
|
-
type = _this$
|
|
107
|
-
styles = _this$
|
|
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$
|
|
129
|
-
margin = _this$
|
|
130
|
-
standalone = _this$
|
|
131
|
-
as = _this$
|
|
132
|
-
styles = _this$
|
|
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();
|
package/lib/Badge/index.js
CHANGED
|
@@ -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
|
-
|
|
44
|
-
|
|
43
|
+
const elementRef = this.props.elementRef;
|
|
45
44
|
this.ref = el;
|
|
46
|
-
|
|
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$
|
|
55
|
+
var _this$props$makeStyle, _this$props;
|
|
54
56
|
|
|
55
|
-
(_this$props$makeStyle = (_this$
|
|
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$
|
|
61
|
+
var _this$props$makeStyle2, _this$props2;
|
|
60
62
|
|
|
61
|
-
(_this$props$makeStyle2 = (_this$
|
|
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$
|
|
66
|
-
count = _this$
|
|
67
|
-
countUntil = _this$
|
|
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$
|
|
73
|
-
count = _this$
|
|
74
|
-
countUntil = _this$
|
|
75
|
-
formatOverflowText = _this$
|
|
76
|
-
formatOutput = _this$
|
|
77
|
-
type = _this$
|
|
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$
|
|
95
|
-
count = _this$
|
|
96
|
-
margin = _this$
|
|
97
|
-
standalone = _this$
|
|
98
|
-
type = _this$
|
|
99
|
-
styles = _this$
|
|
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$
|
|
121
|
-
margin = _this$
|
|
122
|
-
standalone = _this$
|
|
123
|
-
as = _this$
|
|
124
|
-
styles = _this$
|
|
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.
|
|
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.
|
|
29
|
-
"@instructure/emotion": "8.10.3-snapshot.
|
|
30
|
-
"@instructure/shared-types": "8.10.3-snapshot.
|
|
31
|
-
"@instructure/ui-color-utils": "8.10.3-snapshot.
|
|
32
|
-
"@instructure/ui-position": "8.10.3-snapshot.
|
|
33
|
-
"@instructure/ui-react-utils": "8.10.3-snapshot.
|
|
34
|
-
"@instructure/ui-testable": "8.10.3-snapshot.
|
|
35
|
-
"@instructure/ui-view": "8.10.3-snapshot.
|
|
36
|
-
"@instructure/uid": "8.10.3-snapshot.
|
|
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.
|
|
41
|
-
"@instructure/ui-test-locator": "8.10.3-snapshot.
|
|
42
|
-
"@instructure/ui-test-utils": "8.10.3-snapshot.
|
|
43
|
-
"@instructure/ui-themes": "8.10.3-snapshot.
|
|
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": "
|
|
52
|
+
"gitHead": "ed32a6c3b14ddb7fbbb5b543d9871a296f06e4c0"
|
|
53
53
|
}
|
package/src/Badge/index.tsx
CHANGED
|
@@ -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
|
-
|
|
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,OAAO,GAAG,IAAI,CAAO;IAE1B,SAAS,OAAQ,OAAO,GAAG,IAAI,
|
|
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,OAAO,GAAG,IAAI,CAAO;IAE1B,SAAS,OAAQ,OAAO,GAAG,IAAI,UAQ9B;IAED,iBAAiB;IAGjB,kBAAkB;IAIlB,aAAa;IAMb,YAAY;IA6BZ,WAAW;IAmBX,cAAc;IAQd,MAAM;CAoBP;AAED,eAAe,KAAK,CAAA;AACpB,OAAO,EAAE,KAAK,EAAE,CAAA"}
|