@instructure/ui-avatar 8.33.2-snapshot-0 → 8.33.2
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/CHANGELOG.md +1 -5
- package/es/Avatar/AvatarLocator.js +3 -1
- package/es/Avatar/__examples__/Avatar.examples.js +1 -4
- package/es/Avatar/index.js +7 -30
- package/es/Avatar/locator.js +1 -0
- package/es/Avatar/props.js +1 -0
- package/es/Avatar/styles.js +4 -5
- package/es/Avatar/theme.js +11 -11
- package/lib/Avatar/AvatarLocator.js +1 -3
- package/lib/Avatar/__examples__/Avatar.examples.js +0 -8
- package/lib/Avatar/index.js +7 -40
- package/lib/Avatar/locator.js +0 -2
- package/lib/Avatar/props.js +1 -4
- package/lib/Avatar/styles.js +4 -6
- package/lib/Avatar/theme.js +10 -12
- package/lib/index.js +0 -1
- package/package.json +13 -13
- package/tsconfig.build.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,14 +3,10 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [8.33.2
|
|
6
|
+
## [8.33.2](https://github.com/instructure/instructure-ui/compare/v8.33.1...v8.33.2) (2023-01-25)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @instructure/ui-avatar
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
10
|
## [8.33.1](https://github.com/instructure/instructure-ui/compare/v8.33.0...v8.33.1) (2023-01-06)
|
|
15
11
|
|
|
16
12
|
**Note:** Version bump only for package @instructure/ui-avatar
|
|
@@ -21,7 +21,9 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
|
+
|
|
24
25
|
import { locator } from '@instructure/ui-test-locator';
|
|
25
|
-
import { Avatar } from './index';
|
|
26
|
+
import { Avatar } from './index';
|
|
26
27
|
|
|
28
|
+
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
27
29
|
export const AvatarLocator = locator(Avatar.selector);
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
|
+
|
|
24
25
|
import React from 'react';
|
|
25
26
|
import { IconGroupLine } from '@instructure/ui-icons';
|
|
26
27
|
export default {
|
|
@@ -35,19 +36,15 @@ export default {
|
|
|
35
36
|
if (props.color !== 'default' && props.size !== 'medium') {
|
|
36
37
|
return true;
|
|
37
38
|
}
|
|
38
|
-
|
|
39
39
|
if (props.renderIcon && props.src) {
|
|
40
40
|
return true;
|
|
41
41
|
}
|
|
42
|
-
|
|
43
42
|
if (props.src && props.color !== 'default') {
|
|
44
43
|
return true;
|
|
45
44
|
}
|
|
46
|
-
|
|
47
45
|
if (props.hasInverseColor && (props.size !== 'medium' || props.display !== 'block')) {
|
|
48
46
|
return true;
|
|
49
47
|
}
|
|
50
|
-
|
|
51
48
|
return false;
|
|
52
49
|
},
|
|
53
50
|
getComponentProps: () => {
|
package/es/Avatar/index.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
2
|
const _excluded = ["onImageLoaded", "styles"];
|
|
3
|
-
|
|
4
3
|
var _dec, _dec2, _class, _class2;
|
|
5
|
-
|
|
6
4
|
/*
|
|
7
5
|
* The MIT License (MIT)
|
|
8
6
|
*
|
|
@@ -36,7 +34,6 @@ import { withStyle, jsx } from '@instructure/emotion';
|
|
|
36
34
|
import generateStyle from './styles';
|
|
37
35
|
import generateComponentTheme from './theme';
|
|
38
36
|
import { propTypes, allowedProps } from './props';
|
|
39
|
-
|
|
40
37
|
/**
|
|
41
38
|
---
|
|
42
39
|
category: components
|
|
@@ -50,16 +47,13 @@ let Avatar = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = t
|
|
|
50
47
|
loaded: false
|
|
51
48
|
};
|
|
52
49
|
this.ref = null;
|
|
53
|
-
|
|
54
50
|
this.handleRef = el => {
|
|
55
51
|
const elementRef = this.props.elementRef;
|
|
56
52
|
this.ref = el;
|
|
57
|
-
|
|
58
53
|
if (typeof elementRef === 'function') {
|
|
59
54
|
elementRef(el);
|
|
60
55
|
}
|
|
61
56
|
};
|
|
62
|
-
|
|
63
57
|
this.handleImageLoaded = event => {
|
|
64
58
|
this.setState({
|
|
65
59
|
loaded: true
|
|
@@ -67,38 +61,30 @@ let Avatar = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = t
|
|
|
67
61
|
this.props.onImageLoaded(event);
|
|
68
62
|
};
|
|
69
63
|
}
|
|
70
|
-
|
|
71
64
|
componentDidMount() {
|
|
72
65
|
var _this$props$makeStyle, _this$props;
|
|
73
|
-
|
|
74
66
|
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, this.state);
|
|
75
67
|
}
|
|
76
|
-
|
|
77
68
|
componentDidUpdate() {
|
|
78
69
|
var _this$props$makeStyle2, _this$props2;
|
|
70
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, this.state);
|
|
79
71
|
|
|
80
|
-
|
|
81
|
-
|
|
72
|
+
// in case the image is unset in an update, show icons/initials again
|
|
82
73
|
if (this.state.loaded && !this.props.src) {
|
|
83
74
|
this.setState({
|
|
84
75
|
loaded: false
|
|
85
76
|
});
|
|
86
77
|
}
|
|
87
78
|
}
|
|
88
|
-
|
|
89
79
|
makeInitialsFromName() {
|
|
90
80
|
let name = this.props.name;
|
|
91
|
-
|
|
92
81
|
if (!name || typeof name !== 'string') {
|
|
93
82
|
return;
|
|
94
83
|
}
|
|
95
|
-
|
|
96
84
|
name = name.trim();
|
|
97
|
-
|
|
98
85
|
if (name.length === 0) {
|
|
99
86
|
return;
|
|
100
87
|
}
|
|
101
|
-
|
|
102
88
|
if (name.match(/\s+/)) {
|
|
103
89
|
const names = name.split(/\s+/);
|
|
104
90
|
return (names[0][0] + names[names.length - 1][0]).toUpperCase();
|
|
@@ -106,38 +92,30 @@ let Avatar = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = t
|
|
|
106
92
|
return name[0].toUpperCase();
|
|
107
93
|
}
|
|
108
94
|
}
|
|
109
|
-
|
|
110
95
|
renderInitials() {
|
|
111
96
|
var _this$props$styles;
|
|
112
|
-
|
|
113
97
|
return jsx("span", {
|
|
114
98
|
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.initials,
|
|
115
99
|
"aria-hidden": "true"
|
|
116
100
|
}, this.makeInitialsFromName());
|
|
117
101
|
}
|
|
118
|
-
|
|
119
102
|
renderContent() {
|
|
120
103
|
const _this$props3 = this.props,
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
104
|
+
renderIcon = _this$props3.renderIcon,
|
|
105
|
+
styles = _this$props3.styles;
|
|
124
106
|
if (!renderIcon) {
|
|
125
107
|
return this.renderInitials();
|
|
126
108
|
}
|
|
127
|
-
|
|
128
109
|
return jsx("span", {
|
|
129
110
|
css: styles === null || styles === void 0 ? void 0 : styles.iconSVG
|
|
130
111
|
}, callRenderProp(renderIcon));
|
|
131
112
|
}
|
|
132
|
-
|
|
133
113
|
render() {
|
|
134
114
|
var _this$props$styles2;
|
|
135
|
-
|
|
136
115
|
const _this$props4 = this.props,
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
116
|
+
onImageLoaded = _this$props4.onImageLoaded,
|
|
117
|
+
styles = _this$props4.styles,
|
|
118
|
+
props = _objectWithoutProperties(_this$props4, _excluded);
|
|
141
119
|
return jsx(View, Object.assign({}, passthroughProps(props), {
|
|
142
120
|
"aria-label": this.props.alt ? this.props.alt : void 0,
|
|
143
121
|
role: this.props.alt ? 'img' : void 0,
|
|
@@ -155,7 +133,6 @@ let Avatar = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = t
|
|
|
155
133
|
"aria-hidden": "true"
|
|
156
134
|
}), !this.state.loaded && this.renderContent());
|
|
157
135
|
}
|
|
158
|
-
|
|
159
136
|
}, _class2.displayName = "Avatar", _class2.componentId = 'Avatar', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
160
137
|
size: 'medium',
|
|
161
138
|
color: 'default',
|
package/es/Avatar/locator.js
CHANGED
package/es/Avatar/props.js
CHANGED
package/es/Avatar/styles.js
CHANGED
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
*/
|
|
35
35
|
const generateStyle = (componentTheme, props, state) => {
|
|
36
36
|
const size = props.size,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
color = props.color,
|
|
38
|
+
hasInverseColor = props.hasInverseColor,
|
|
39
|
+
shape = props.shape,
|
|
40
|
+
src = props.src;
|
|
41
41
|
const loaded = state.loaded;
|
|
42
42
|
const sizeStyles = {
|
|
43
43
|
auto: {
|
|
@@ -153,5 +153,4 @@ const generateStyle = (componentTheme, props, state) => {
|
|
|
153
153
|
}
|
|
154
154
|
};
|
|
155
155
|
};
|
|
156
|
-
|
|
157
156
|
export default generateStyle;
|
package/es/Avatar/theme.js
CHANGED
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
|
-
import { alpha } from '@instructure/ui-color-utils';
|
|
25
24
|
|
|
25
|
+
import { alpha } from '@instructure/ui-color-utils';
|
|
26
26
|
/**
|
|
27
27
|
* Generates the theme object for the component from the theme and provided additional information
|
|
28
28
|
* @param {Object} theme The actual theme object.
|
|
@@ -30,15 +30,15 @@ import { alpha } from '@instructure/ui-color-utils';
|
|
|
30
30
|
*/
|
|
31
31
|
const generateComponentTheme = theme => {
|
|
32
32
|
const colors = theme.colors,
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
borders = theme.borders,
|
|
34
|
+
typography = theme.typography;
|
|
35
35
|
const brand = colors.brand,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
shamrock = colors.shamrock,
|
|
37
|
+
barney = colors.barney,
|
|
38
|
+
crimson = colors.crimson,
|
|
39
|
+
fire = colors.fire,
|
|
40
|
+
licorice = colors.licorice,
|
|
41
|
+
ash = colors.ash;
|
|
42
42
|
const componentVariables = {
|
|
43
43
|
background: colors === null || colors === void 0 ? void 0 : colors.backgroundLightest,
|
|
44
44
|
borderWidthSmall: borders === null || borders === void 0 ? void 0 : borders.widthSmall,
|
|
@@ -58,8 +58,8 @@ const generateComponentTheme = theme => {
|
|
|
58
58
|
colorLicorice: licorice,
|
|
59
59
|
colorAsh: ash
|
|
60
60
|
};
|
|
61
|
-
return {
|
|
61
|
+
return {
|
|
62
|
+
...componentVariables
|
|
62
63
|
};
|
|
63
64
|
};
|
|
64
|
-
|
|
65
65
|
export default generateComponentTheme;
|
|
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.AvatarLocator = void 0;
|
|
7
|
-
|
|
8
7
|
var _locator = require("@instructure/ui-test-locator/lib/utils/locator.js");
|
|
9
|
-
|
|
10
8
|
var _index = require("./index");
|
|
11
|
-
|
|
12
9
|
/*
|
|
13
10
|
* The MIT License (MIT)
|
|
14
11
|
*
|
|
@@ -32,6 +29,7 @@ var _index = require("./index");
|
|
|
32
29
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
33
30
|
* SOFTWARE.
|
|
34
31
|
*/
|
|
32
|
+
|
|
35
33
|
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
36
34
|
const AvatarLocator = (0, _locator.locator)(_index.Avatar.selector);
|
|
37
35
|
exports.AvatarLocator = AvatarLocator;
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
9
|
var _IconGroupLine = require("@instructure/ui-icons/lib/IconGroupLine.js");
|
|
13
|
-
|
|
14
10
|
/*
|
|
15
11
|
* The MIT License (MIT)
|
|
16
12
|
*
|
|
@@ -46,19 +42,15 @@ var _default = {
|
|
|
46
42
|
if (props.color !== 'default' && props.size !== 'medium') {
|
|
47
43
|
return true;
|
|
48
44
|
}
|
|
49
|
-
|
|
50
45
|
if (props.renderIcon && props.src) {
|
|
51
46
|
return true;
|
|
52
47
|
}
|
|
53
|
-
|
|
54
48
|
if (props.src && props.color !== 'default') {
|
|
55
49
|
return true;
|
|
56
50
|
}
|
|
57
|
-
|
|
58
51
|
if (props.hasInverseColor && (props.size !== 'medium' || props.display !== 'block')) {
|
|
59
52
|
return true;
|
|
60
53
|
}
|
|
61
|
-
|
|
62
54
|
return false;
|
|
63
55
|
},
|
|
64
56
|
getComponentProps: () => {
|
package/lib/Avatar/index.js
CHANGED
|
@@ -1,36 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = exports.Avatar = void 0;
|
|
9
|
-
|
|
10
8
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
|
-
|
|
12
9
|
var _react = require("react");
|
|
13
|
-
|
|
14
10
|
var _View = require("@instructure/ui-view/lib/View");
|
|
15
|
-
|
|
16
11
|
var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
|
|
17
|
-
|
|
18
12
|
var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
|
|
19
|
-
|
|
20
13
|
var _testable = require("@instructure/ui-testable/lib/testable.js");
|
|
21
|
-
|
|
22
14
|
var _emotion = require("@instructure/emotion");
|
|
23
|
-
|
|
24
15
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
25
|
-
|
|
26
16
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
27
|
-
|
|
28
17
|
var _props = require("./props");
|
|
29
|
-
|
|
30
18
|
const _excluded = ["onImageLoaded", "styles"];
|
|
31
|
-
|
|
32
19
|
var _dec, _dec2, _class, _class2;
|
|
33
|
-
|
|
34
20
|
/**
|
|
35
21
|
---
|
|
36
22
|
category: components
|
|
@@ -44,16 +30,13 @@ let Avatar = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _
|
|
|
44
30
|
loaded: false
|
|
45
31
|
};
|
|
46
32
|
this.ref = null;
|
|
47
|
-
|
|
48
33
|
this.handleRef = el => {
|
|
49
34
|
const elementRef = this.props.elementRef;
|
|
50
35
|
this.ref = el;
|
|
51
|
-
|
|
52
36
|
if (typeof elementRef === 'function') {
|
|
53
37
|
elementRef(el);
|
|
54
38
|
}
|
|
55
39
|
};
|
|
56
|
-
|
|
57
40
|
this.handleImageLoaded = event => {
|
|
58
41
|
this.setState({
|
|
59
42
|
loaded: true
|
|
@@ -61,38 +44,30 @@ let Avatar = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _
|
|
|
61
44
|
this.props.onImageLoaded(event);
|
|
62
45
|
};
|
|
63
46
|
}
|
|
64
|
-
|
|
65
47
|
componentDidMount() {
|
|
66
48
|
var _this$props$makeStyle, _this$props;
|
|
67
|
-
|
|
68
49
|
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, this.state);
|
|
69
50
|
}
|
|
70
|
-
|
|
71
51
|
componentDidUpdate() {
|
|
72
52
|
var _this$props$makeStyle2, _this$props2;
|
|
53
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, this.state);
|
|
73
54
|
|
|
74
|
-
|
|
75
|
-
|
|
55
|
+
// in case the image is unset in an update, show icons/initials again
|
|
76
56
|
if (this.state.loaded && !this.props.src) {
|
|
77
57
|
this.setState({
|
|
78
58
|
loaded: false
|
|
79
59
|
});
|
|
80
60
|
}
|
|
81
61
|
}
|
|
82
|
-
|
|
83
62
|
makeInitialsFromName() {
|
|
84
63
|
let name = this.props.name;
|
|
85
|
-
|
|
86
64
|
if (!name || typeof name !== 'string') {
|
|
87
65
|
return;
|
|
88
66
|
}
|
|
89
|
-
|
|
90
67
|
name = name.trim();
|
|
91
|
-
|
|
92
68
|
if (name.length === 0) {
|
|
93
69
|
return;
|
|
94
70
|
}
|
|
95
|
-
|
|
96
71
|
if (name.match(/\s+/)) {
|
|
97
72
|
const names = name.split(/\s+/);
|
|
98
73
|
return (names[0][0] + names[names.length - 1][0]).toUpperCase();
|
|
@@ -100,37 +75,30 @@ let Avatar = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _
|
|
|
100
75
|
return name[0].toUpperCase();
|
|
101
76
|
}
|
|
102
77
|
}
|
|
103
|
-
|
|
104
78
|
renderInitials() {
|
|
105
79
|
var _this$props$styles;
|
|
106
|
-
|
|
107
80
|
return (0, _emotion.jsx)("span", {
|
|
108
81
|
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.initials,
|
|
109
82
|
"aria-hidden": "true"
|
|
110
83
|
}, this.makeInitialsFromName());
|
|
111
84
|
}
|
|
112
|
-
|
|
113
85
|
renderContent() {
|
|
114
86
|
const _this$props3 = this.props,
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
87
|
+
renderIcon = _this$props3.renderIcon,
|
|
88
|
+
styles = _this$props3.styles;
|
|
118
89
|
if (!renderIcon) {
|
|
119
90
|
return this.renderInitials();
|
|
120
91
|
}
|
|
121
|
-
|
|
122
92
|
return (0, _emotion.jsx)("span", {
|
|
123
93
|
css: styles === null || styles === void 0 ? void 0 : styles.iconSVG
|
|
124
94
|
}, (0, _callRenderProp.callRenderProp)(renderIcon));
|
|
125
95
|
}
|
|
126
|
-
|
|
127
96
|
render() {
|
|
128
97
|
var _this$props$styles2;
|
|
129
|
-
|
|
130
98
|
const _this$props4 = this.props,
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
99
|
+
onImageLoaded = _this$props4.onImageLoaded,
|
|
100
|
+
styles = _this$props4.styles,
|
|
101
|
+
props = (0, _objectWithoutProperties2.default)(_this$props4, _excluded);
|
|
134
102
|
return (0, _emotion.jsx)(_View.View, Object.assign({}, (0, _passthroughProps.passthroughProps)(props), {
|
|
135
103
|
"aria-label": this.props.alt ? this.props.alt : void 0,
|
|
136
104
|
role: this.props.alt ? 'img' : void 0,
|
|
@@ -148,7 +116,6 @@ let Avatar = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _
|
|
|
148
116
|
"aria-hidden": "true"
|
|
149
117
|
}), !this.state.loaded && this.renderContent());
|
|
150
118
|
}
|
|
151
|
-
|
|
152
119
|
}, _class2.displayName = "Avatar", _class2.componentId = 'Avatar', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
|
|
153
120
|
size: 'medium',
|
|
154
121
|
color: 'default',
|
package/lib/Avatar/locator.js
CHANGED
package/lib/Avatar/props.js
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.propTypes = exports.allowedProps = void 0;
|
|
9
|
-
|
|
10
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
9
|
var _emotion = require("@instructure/emotion");
|
|
13
|
-
|
|
14
10
|
/*
|
|
15
11
|
* The MIT License (MIT)
|
|
16
12
|
*
|
|
@@ -34,6 +30,7 @@ var _emotion = require("@instructure/emotion");
|
|
|
34
30
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
35
31
|
* SOFTWARE.
|
|
36
32
|
*/
|
|
33
|
+
|
|
37
34
|
const propTypes = {
|
|
38
35
|
name: _propTypes.default.string.isRequired,
|
|
39
36
|
src: _propTypes.default.string,
|
package/lib/Avatar/styles.js
CHANGED
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
/*
|
|
9
8
|
* The MIT License (MIT)
|
|
10
9
|
*
|
|
@@ -41,10 +40,10 @@ exports.default = void 0;
|
|
|
41
40
|
*/
|
|
42
41
|
const generateStyle = (componentTheme, props, state) => {
|
|
43
42
|
const size = props.size,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
color = props.color,
|
|
44
|
+
hasInverseColor = props.hasInverseColor,
|
|
45
|
+
shape = props.shape,
|
|
46
|
+
src = props.src;
|
|
48
47
|
const loaded = state.loaded;
|
|
49
48
|
const sizeStyles = {
|
|
50
49
|
auto: {
|
|
@@ -160,6 +159,5 @@ const generateStyle = (componentTheme, props, state) => {
|
|
|
160
159
|
}
|
|
161
160
|
};
|
|
162
161
|
};
|
|
163
|
-
|
|
164
162
|
var _default = generateStyle;
|
|
165
163
|
exports.default = _default;
|
package/lib/Avatar/theme.js
CHANGED
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _alpha = require("@instructure/ui-color-utils/lib/alpha.js");
|
|
9
|
-
|
|
10
8
|
/*
|
|
11
9
|
* The MIT License (MIT)
|
|
12
10
|
*
|
|
@@ -38,15 +36,15 @@ var _alpha = require("@instructure/ui-color-utils/lib/alpha.js");
|
|
|
38
36
|
*/
|
|
39
37
|
const generateComponentTheme = theme => {
|
|
40
38
|
const colors = theme.colors,
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
borders = theme.borders,
|
|
40
|
+
typography = theme.typography;
|
|
43
41
|
const brand = colors.brand,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
42
|
+
shamrock = colors.shamrock,
|
|
43
|
+
barney = colors.barney,
|
|
44
|
+
crimson = colors.crimson,
|
|
45
|
+
fire = colors.fire,
|
|
46
|
+
licorice = colors.licorice,
|
|
47
|
+
ash = colors.ash;
|
|
50
48
|
const componentVariables = {
|
|
51
49
|
background: colors === null || colors === void 0 ? void 0 : colors.backgroundLightest,
|
|
52
50
|
borderWidthSmall: borders === null || borders === void 0 ? void 0 : borders.widthSmall,
|
|
@@ -66,9 +64,9 @@ const generateComponentTheme = theme => {
|
|
|
66
64
|
colorLicorice: licorice,
|
|
67
65
|
colorAsh: ash
|
|
68
66
|
};
|
|
69
|
-
return {
|
|
67
|
+
return {
|
|
68
|
+
...componentVariables
|
|
70
69
|
};
|
|
71
70
|
};
|
|
72
|
-
|
|
73
71
|
var _default = generateComponentTheme;
|
|
74
72
|
exports.default = _default;
|
package/lib/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-avatar",
|
|
3
|
-
"version": "8.33.2
|
|
3
|
+
"version": "8.33.2",
|
|
4
4
|
"description": "An image or letters that represents a user.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -24,21 +24,21 @@
|
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@babel/runtime": "^7.13.10",
|
|
27
|
-
"@instructure/console": "8.33.2
|
|
28
|
-
"@instructure/emotion": "8.33.2
|
|
29
|
-
"@instructure/shared-types": "8.33.2
|
|
30
|
-
"@instructure/ui-icons": "8.33.2
|
|
31
|
-
"@instructure/ui-react-utils": "8.33.2
|
|
32
|
-
"@instructure/ui-testable": "8.33.2
|
|
33
|
-
"@instructure/ui-view": "8.33.2
|
|
27
|
+
"@instructure/console": "8.33.2",
|
|
28
|
+
"@instructure/emotion": "8.33.2",
|
|
29
|
+
"@instructure/shared-types": "8.33.2",
|
|
30
|
+
"@instructure/ui-icons": "8.33.2",
|
|
31
|
+
"@instructure/ui-react-utils": "8.33.2",
|
|
32
|
+
"@instructure/ui-testable": "8.33.2",
|
|
33
|
+
"@instructure/ui-view": "8.33.2",
|
|
34
34
|
"prop-types": "^15"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@instructure/ui-babel-preset": "8.33.2
|
|
38
|
-
"@instructure/ui-color-utils": "8.33.2
|
|
39
|
-
"@instructure/ui-test-locator": "8.33.2
|
|
40
|
-
"@instructure/ui-test-utils": "8.33.2
|
|
41
|
-
"@instructure/ui-themes": "8.33.2
|
|
37
|
+
"@instructure/ui-babel-preset": "8.33.2",
|
|
38
|
+
"@instructure/ui-color-utils": "8.33.2",
|
|
39
|
+
"@instructure/ui-test-locator": "8.33.2",
|
|
40
|
+
"@instructure/ui-test-utils": "8.33.2",
|
|
41
|
+
"@instructure/ui-themes": "8.33.2"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"react": ">=16.8 <=18"
|