@instructure/ui-badge 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 +27 -0
- package/es/Badge/index.js +29 -25
- package/es/Badge/theme.js +12 -12
- package/lib/Badge/index.js +29 -25
- package/lib/Badge/theme.js +12 -12
- package/package.json +16 -15
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.
|
package/es/Badge/index.js
CHANGED
|
@@ -59,27 +59,31 @@ let Badge = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, gene
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
componentDidMount() {
|
|
62
|
-
|
|
62
|
+
var _this$props$makeStyle, _this$props;
|
|
63
|
+
|
|
64
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
63
65
|
}
|
|
64
66
|
|
|
65
67
|
componentDidUpdate() {
|
|
66
|
-
|
|
68
|
+
var _this$props$makeStyle2, _this$props2;
|
|
69
|
+
|
|
70
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
67
71
|
}
|
|
68
72
|
|
|
69
73
|
countOverflow() {
|
|
70
|
-
const _this$
|
|
71
|
-
count = _this$
|
|
72
|
-
countUntil = _this$
|
|
74
|
+
const _this$props3 = this.props,
|
|
75
|
+
count = _this$props3.count,
|
|
76
|
+
countUntil = _this$props3.countUntil;
|
|
73
77
|
return countUntil && count && countUntil > 1 && count >= countUntil;
|
|
74
78
|
}
|
|
75
79
|
|
|
76
80
|
renderOutput() {
|
|
77
|
-
const _this$
|
|
78
|
-
count = _this$
|
|
79
|
-
countUntil = _this$
|
|
80
|
-
formatOverflowText = _this$
|
|
81
|
-
formatOutput = _this$
|
|
82
|
-
type = _this$
|
|
81
|
+
const _this$props4 = this.props,
|
|
82
|
+
count = _this$props4.count,
|
|
83
|
+
countUntil = _this$props4.countUntil,
|
|
84
|
+
formatOverflowText = _this$props4.formatOverflowText,
|
|
85
|
+
formatOutput = _this$props4.formatOutput,
|
|
86
|
+
type = _this$props4.type; // If the badge count is >= than the countUntil limit, format the badge text
|
|
83
87
|
// via the formatOverflowText function prop
|
|
84
88
|
|
|
85
89
|
let formattedCount = (count || '').toString();
|
|
@@ -96,16 +100,16 @@ let Badge = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, gene
|
|
|
96
100
|
}
|
|
97
101
|
|
|
98
102
|
renderBadge() {
|
|
99
|
-
const _this$
|
|
100
|
-
count = _this$
|
|
101
|
-
margin = _this$
|
|
102
|
-
standalone = _this$
|
|
103
|
-
type = _this$
|
|
104
|
-
styles = _this$
|
|
103
|
+
const _this$props5 = this.props,
|
|
104
|
+
count = _this$props5.count,
|
|
105
|
+
margin = _this$props5.margin,
|
|
106
|
+
standalone = _this$props5.standalone,
|
|
107
|
+
type = _this$props5.type,
|
|
108
|
+
styles = _this$props5.styles;
|
|
105
109
|
return jsx(View, Object.assign({
|
|
106
110
|
margin: standalone ? margin : 'none',
|
|
107
|
-
css: styles
|
|
108
|
-
title: type === 'count' && this.countOverflow() ? count
|
|
111
|
+
css: styles === null || styles === void 0 ? void 0 : styles.badge,
|
|
112
|
+
title: type === 'count' && this.countOverflow() ? count === null || count === void 0 ? void 0 : count.toString() : '',
|
|
109
113
|
id: !standalone ? this._defaultId : void 0,
|
|
110
114
|
display: standalone ? 'inline-block' : 'block'
|
|
111
115
|
}, standalone && {
|
|
@@ -122,11 +126,11 @@ let Badge = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, gene
|
|
|
122
126
|
}
|
|
123
127
|
|
|
124
128
|
render() {
|
|
125
|
-
const _this$
|
|
126
|
-
margin = _this$
|
|
127
|
-
standalone = _this$
|
|
128
|
-
as = _this$
|
|
129
|
-
styles = _this$
|
|
129
|
+
const _this$props6 = this.props,
|
|
130
|
+
margin = _this$props6.margin,
|
|
131
|
+
standalone = _this$props6.standalone,
|
|
132
|
+
as = _this$props6.as,
|
|
133
|
+
styles = _this$props6.styles;
|
|
130
134
|
|
|
131
135
|
if (standalone) {
|
|
132
136
|
return this.renderBadge();
|
|
@@ -135,7 +139,7 @@ let Badge = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, gene
|
|
|
135
139
|
as: as,
|
|
136
140
|
margin: margin,
|
|
137
141
|
elementRef: this.handleRef,
|
|
138
|
-
css: styles
|
|
142
|
+
css: styles === null || styles === void 0 ? void 0 : styles.wrapper,
|
|
139
143
|
display: "inline-block"
|
|
140
144
|
}, this.renderChildren(), this.renderBadge());
|
|
141
145
|
}
|
package/es/Badge/theme.js
CHANGED
|
@@ -40,22 +40,22 @@ const generateComponentTheme = theme => {
|
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
42
|
const componentVariables = {
|
|
43
|
-
fontFamily: typography
|
|
44
|
-
fontWeight: typography
|
|
45
|
-
color: colors
|
|
46
|
-
fontSize: typography
|
|
47
|
-
colorDanger: colors
|
|
48
|
-
colorSuccess: colors
|
|
49
|
-
colorPrimary: colors
|
|
50
|
-
colorInverse: colors
|
|
43
|
+
fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamily,
|
|
44
|
+
fontWeight: typography === null || typography === void 0 ? void 0 : typography.fontWeightNormal,
|
|
45
|
+
color: colors === null || colors === void 0 ? void 0 : colors.textLightest,
|
|
46
|
+
fontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeXSmall,
|
|
47
|
+
colorDanger: colors === null || colors === void 0 ? void 0 : colors.textDanger,
|
|
48
|
+
colorSuccess: colors === null || colors === void 0 ? void 0 : colors.textSuccess,
|
|
49
|
+
colorPrimary: colors === null || colors === void 0 ? void 0 : colors.textBrand,
|
|
50
|
+
colorInverse: colors === null || colors === void 0 ? void 0 : colors.textDarkest,
|
|
51
51
|
size: '1.25rem',
|
|
52
52
|
countOffset: '0.5rem',
|
|
53
53
|
notificationOffset: '0.125rem',
|
|
54
|
-
notificationZIndex: stacking
|
|
55
|
-
sizeNotification: spacing
|
|
54
|
+
notificationZIndex: stacking === null || stacking === void 0 ? void 0 : stacking.above,
|
|
55
|
+
sizeNotification: spacing === null || spacing === void 0 ? void 0 : spacing.small,
|
|
56
56
|
borderRadius: '999rem',
|
|
57
|
-
padding: spacing
|
|
58
|
-
pulseBorderThickness: borders
|
|
57
|
+
padding: spacing === null || spacing === void 0 ? void 0 : spacing.xxSmall,
|
|
58
|
+
pulseBorderThickness: borders === null || borders === void 0 ? void 0 : borders.widthMedium
|
|
59
59
|
};
|
|
60
60
|
return { ...componentVariables,
|
|
61
61
|
...themeSpecificStyle[themeName]
|
package/lib/Badge/index.js
CHANGED
|
@@ -52,27 +52,31 @@ let Badge = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0,
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
componentDidMount() {
|
|
55
|
-
|
|
55
|
+
var _this$props$makeStyle, _this$props;
|
|
56
|
+
|
|
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
|
-
|
|
61
|
+
var _this$props$makeStyle2, _this$props2;
|
|
62
|
+
|
|
63
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
60
64
|
}
|
|
61
65
|
|
|
62
66
|
countOverflow() {
|
|
63
|
-
const _this$
|
|
64
|
-
count = _this$
|
|
65
|
-
countUntil = _this$
|
|
67
|
+
const _this$props3 = this.props,
|
|
68
|
+
count = _this$props3.count,
|
|
69
|
+
countUntil = _this$props3.countUntil;
|
|
66
70
|
return countUntil && count && countUntil > 1 && count >= countUntil;
|
|
67
71
|
}
|
|
68
72
|
|
|
69
73
|
renderOutput() {
|
|
70
|
-
const _this$
|
|
71
|
-
count = _this$
|
|
72
|
-
countUntil = _this$
|
|
73
|
-
formatOverflowText = _this$
|
|
74
|
-
formatOutput = _this$
|
|
75
|
-
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
|
|
76
80
|
// via the formatOverflowText function prop
|
|
77
81
|
|
|
78
82
|
let formattedCount = (count || '').toString();
|
|
@@ -89,16 +93,16 @@ let Badge = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0,
|
|
|
89
93
|
}
|
|
90
94
|
|
|
91
95
|
renderBadge() {
|
|
92
|
-
const _this$
|
|
93
|
-
count = _this$
|
|
94
|
-
margin = _this$
|
|
95
|
-
standalone = _this$
|
|
96
|
-
type = _this$
|
|
97
|
-
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;
|
|
98
102
|
return (0, _emotion.jsx)(_View.View, Object.assign({
|
|
99
103
|
margin: standalone ? margin : 'none',
|
|
100
|
-
css: styles
|
|
101
|
-
title: type === 'count' && this.countOverflow() ? count
|
|
104
|
+
css: styles === null || styles === void 0 ? void 0 : styles.badge,
|
|
105
|
+
title: type === 'count' && this.countOverflow() ? count === null || count === void 0 ? void 0 : count.toString() : '',
|
|
102
106
|
id: !standalone ? this._defaultId : void 0,
|
|
103
107
|
display: standalone ? 'inline-block' : 'block'
|
|
104
108
|
}, standalone && {
|
|
@@ -115,11 +119,11 @@ let Badge = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0,
|
|
|
115
119
|
}
|
|
116
120
|
|
|
117
121
|
render() {
|
|
118
|
-
const _this$
|
|
119
|
-
margin = _this$
|
|
120
|
-
standalone = _this$
|
|
121
|
-
as = _this$
|
|
122
|
-
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;
|
|
123
127
|
|
|
124
128
|
if (standalone) {
|
|
125
129
|
return this.renderBadge();
|
|
@@ -128,7 +132,7 @@ let Badge = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0,
|
|
|
128
132
|
as: as,
|
|
129
133
|
margin: margin,
|
|
130
134
|
elementRef: this.handleRef,
|
|
131
|
-
css: styles
|
|
135
|
+
css: styles === null || styles === void 0 ? void 0 : styles.wrapper,
|
|
132
136
|
display: "inline-block"
|
|
133
137
|
}, this.renderChildren(), this.renderBadge());
|
|
134
138
|
}
|
package/lib/Badge/theme.js
CHANGED
|
@@ -47,22 +47,22 @@ const generateComponentTheme = theme => {
|
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
49
|
const componentVariables = {
|
|
50
|
-
fontFamily: typography
|
|
51
|
-
fontWeight: typography
|
|
52
|
-
color: colors
|
|
53
|
-
fontSize: typography
|
|
54
|
-
colorDanger: colors
|
|
55
|
-
colorSuccess: colors
|
|
56
|
-
colorPrimary: colors
|
|
57
|
-
colorInverse: colors
|
|
50
|
+
fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamily,
|
|
51
|
+
fontWeight: typography === null || typography === void 0 ? void 0 : typography.fontWeightNormal,
|
|
52
|
+
color: colors === null || colors === void 0 ? void 0 : colors.textLightest,
|
|
53
|
+
fontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeXSmall,
|
|
54
|
+
colorDanger: colors === null || colors === void 0 ? void 0 : colors.textDanger,
|
|
55
|
+
colorSuccess: colors === null || colors === void 0 ? void 0 : colors.textSuccess,
|
|
56
|
+
colorPrimary: colors === null || colors === void 0 ? void 0 : colors.textBrand,
|
|
57
|
+
colorInverse: colors === null || colors === void 0 ? void 0 : colors.textDarkest,
|
|
58
58
|
size: '1.25rem',
|
|
59
59
|
countOffset: '0.5rem',
|
|
60
60
|
notificationOffset: '0.125rem',
|
|
61
|
-
notificationZIndex: stacking
|
|
62
|
-
sizeNotification: spacing
|
|
61
|
+
notificationZIndex: stacking === null || stacking === void 0 ? void 0 : stacking.above,
|
|
62
|
+
sizeNotification: spacing === null || spacing === void 0 ? void 0 : spacing.small,
|
|
63
63
|
borderRadius: '999rem',
|
|
64
|
-
padding: spacing
|
|
65
|
-
pulseBorderThickness: borders
|
|
64
|
+
padding: spacing === null || spacing === void 0 ? void 0 : spacing.xxSmall,
|
|
65
|
+
pulseBorderThickness: borders === null || borders === void 0 ? void 0 : borders.widthMedium
|
|
66
66
|
};
|
|
67
67
|
return { ...componentVariables,
|
|
68
68
|
...themeSpecificStyle[themeName]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-badge",
|
|
3
|
-
"version": "8.18.0",
|
|
3
|
+
"version": "8.18.1-snapshot.0+435c9ae79",
|
|
4
4
|
"description": "A badge 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.13.10",
|
|
27
|
-
"@instructure/console": "8.18.0",
|
|
28
|
-
"@instructure/emotion": "8.18.0",
|
|
29
|
-
"@instructure/shared-types": "8.18.0",
|
|
30
|
-
"@instructure/ui-color-utils": "8.18.0",
|
|
31
|
-
"@instructure/ui-position": "8.18.0",
|
|
32
|
-
"@instructure/ui-react-utils": "8.18.0",
|
|
33
|
-
"@instructure/ui-testable": "8.18.0",
|
|
34
|
-
"@instructure/ui-utils": "8.18.0",
|
|
35
|
-
"@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-color-utils": "8.18.1-snapshot.0+435c9ae79",
|
|
31
|
+
"@instructure/ui-position": "8.18.1-snapshot.0+435c9ae79",
|
|
32
|
+
"@instructure/ui-react-utils": "8.18.1-snapshot.0+435c9ae79",
|
|
33
|
+
"@instructure/ui-testable": "8.18.1-snapshot.0+435c9ae79",
|
|
34
|
+
"@instructure/ui-utils": "8.18.1-snapshot.0+435c9ae79",
|
|
35
|
+
"@instructure/ui-view": "8.18.1-snapshot.0+435c9ae79",
|
|
36
36
|
"prop-types": "^15"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@instructure/ui-babel-preset": "8.18.0",
|
|
40
|
-
"@instructure/ui-test-locator": "8.18.0",
|
|
41
|
-
"@instructure/ui-test-utils": "8.18.0",
|
|
42
|
-
"@instructure/ui-themes": "8.18.0"
|
|
39
|
+
"@instructure/ui-babel-preset": "8.18.1-snapshot.0+435c9ae79",
|
|
40
|
+
"@instructure/ui-test-locator": "8.18.1-snapshot.0+435c9ae79",
|
|
41
|
+
"@instructure/ui-test-utils": "8.18.1-snapshot.0+435c9ae79",
|
|
42
|
+
"@instructure/ui-themes": "8.18.1-snapshot.0+435c9ae79"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"react": ">=16.8 <=17"
|
|
@@ -47,5 +47,6 @@
|
|
|
47
47
|
"publishConfig": {
|
|
48
48
|
"access": "public"
|
|
49
49
|
},
|
|
50
|
-
"sideEffects": false
|
|
50
|
+
"sideEffects": false,
|
|
51
|
+
"gitHead": "435c9ae794c15e2bd103f700f8c4e946d91c1b59"
|
|
51
52
|
}
|