@instructure/ui-avatar 8.10.3-snapshot.9 → 8.11.2-snapshot.10
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 +8 -0
- package/es/Avatar/index.js +9 -7
- package/lib/Avatar/index.js +9 -7
- package/package.json +13 -13
- package/src/Avatar/index.tsx +6 -1
- package/src/Avatar/props.ts +5 -2
- package/types/Avatar/index.d.ts +12 -0
- package/types/Avatar/index.d.ts.map +1 -1
- package/types/Avatar/props.d.ts +3 -3
- package/types/Avatar/props.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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.11.1](https://github.com/instructure/instructure-ui/compare/v8.11.0...v8.11.1) (2021-10-19)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-avatar
|
|
9
|
+
|
|
10
|
+
# [8.11.0](https://github.com/instructure/instructure-ui/compare/v8.10.2...v8.11.0) (2021-10-15)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @instructure/ui-avatar
|
|
13
|
+
|
|
6
14
|
## [8.10.2](https://github.com/instructure/instructure-ui/compare/v8.10.1...v8.10.2) (2021-10-01)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @instructure/ui-avatar
|
package/es/Avatar/index.js
CHANGED
|
@@ -52,10 +52,12 @@ let Avatar = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = t
|
|
|
52
52
|
this.ref = null;
|
|
53
53
|
|
|
54
54
|
this.handleRef = el => {
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
const elementRef = this.props.elementRef;
|
|
57
56
|
this.ref = el;
|
|
58
|
-
|
|
57
|
+
|
|
58
|
+
if (typeof elementRef === 'function') {
|
|
59
|
+
elementRef(el);
|
|
60
|
+
}
|
|
59
61
|
};
|
|
60
62
|
|
|
61
63
|
this.handleImageLoaded = event => {
|
|
@@ -109,10 +111,10 @@ let Avatar = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = t
|
|
|
109
111
|
render() {
|
|
110
112
|
var _this$props$styles2;
|
|
111
113
|
|
|
112
|
-
const _this$
|
|
113
|
-
onImageLoaded = _this$
|
|
114
|
-
styles = _this$
|
|
115
|
-
props = _objectWithoutProperties(_this$
|
|
114
|
+
const _this$props = this.props,
|
|
115
|
+
onImageLoaded = _this$props.onImageLoaded,
|
|
116
|
+
styles = _this$props.styles,
|
|
117
|
+
props = _objectWithoutProperties(_this$props, _excluded);
|
|
116
118
|
|
|
117
119
|
return jsx(View, Object.assign({}, passthroughProps(props), {
|
|
118
120
|
"aria-label": this.props.alt ? this.props.alt : void 0,
|
package/lib/Avatar/index.js
CHANGED
|
@@ -44,10 +44,12 @@ let Avatar = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _
|
|
|
44
44
|
this.ref = null;
|
|
45
45
|
|
|
46
46
|
this.handleRef = el => {
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
const elementRef = this.props.elementRef;
|
|
49
48
|
this.ref = el;
|
|
50
|
-
|
|
49
|
+
|
|
50
|
+
if (typeof elementRef === 'function') {
|
|
51
|
+
elementRef(el);
|
|
52
|
+
}
|
|
51
53
|
};
|
|
52
54
|
|
|
53
55
|
this.handleImageLoaded = event => {
|
|
@@ -101,10 +103,10 @@ let Avatar = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _
|
|
|
101
103
|
render() {
|
|
102
104
|
var _this$props$styles2;
|
|
103
105
|
|
|
104
|
-
const _this$
|
|
105
|
-
onImageLoaded = _this$
|
|
106
|
-
styles = _this$
|
|
107
|
-
props = (0, _objectWithoutProperties2.default)(_this$
|
|
106
|
+
const _this$props = this.props,
|
|
107
|
+
onImageLoaded = _this$props.onImageLoaded,
|
|
108
|
+
styles = _this$props.styles,
|
|
109
|
+
props = (0, _objectWithoutProperties2.default)(_this$props, _excluded);
|
|
108
110
|
return (0, _emotion.jsx)(_View.View, Object.assign({}, (0, _passthroughProps.passthroughProps)(props), {
|
|
109
111
|
"aria-label": this.props.alt ? this.props.alt : void 0,
|
|
110
112
|
role: this.props.alt ? 'img' : void 0,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-avatar",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.11.2-snapshot.10+162c2a15c",
|
|
4
4
|
"description": "An image or letters that represents a user.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -25,20 +25,20 @@
|
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@babel/runtime": "^7.13.10",
|
|
28
|
-
"@instructure/console": "8.
|
|
29
|
-
"@instructure/emotion": "8.
|
|
30
|
-
"@instructure/shared-types": "8.
|
|
31
|
-
"@instructure/ui-react-utils": "8.
|
|
32
|
-
"@instructure/ui-testable": "8.
|
|
33
|
-
"@instructure/ui-view": "8.
|
|
28
|
+
"@instructure/console": "8.11.2-snapshot.10+162c2a15c",
|
|
29
|
+
"@instructure/emotion": "8.11.2-snapshot.10+162c2a15c",
|
|
30
|
+
"@instructure/shared-types": "8.11.2-snapshot.10+162c2a15c",
|
|
31
|
+
"@instructure/ui-react-utils": "8.11.2-snapshot.10+162c2a15c",
|
|
32
|
+
"@instructure/ui-testable": "8.11.2-snapshot.10+162c2a15c",
|
|
33
|
+
"@instructure/ui-view": "8.11.2-snapshot.10+162c2a15c",
|
|
34
34
|
"prop-types": "^15"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@instructure/ui-babel-preset": "8.
|
|
38
|
-
"@instructure/ui-color-utils": "8.
|
|
39
|
-
"@instructure/ui-test-locator": "8.
|
|
40
|
-
"@instructure/ui-test-utils": "8.
|
|
41
|
-
"@instructure/ui-themes": "8.
|
|
37
|
+
"@instructure/ui-babel-preset": "8.11.2-snapshot.10+162c2a15c",
|
|
38
|
+
"@instructure/ui-color-utils": "8.11.2-snapshot.10+162c2a15c",
|
|
39
|
+
"@instructure/ui-test-locator": "8.11.2-snapshot.10+162c2a15c",
|
|
40
|
+
"@instructure/ui-test-utils": "8.11.2-snapshot.10+162c2a15c",
|
|
41
|
+
"@instructure/ui-themes": "8.11.2-snapshot.10+162c2a15c"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"react": ">=16.8 <=17"
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"access": "public"
|
|
48
48
|
},
|
|
49
49
|
"sideEffects": false,
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "162c2a15c78f0c641fb71cffd17bc97d6b5c6e0e"
|
|
51
51
|
}
|
package/src/Avatar/index.tsx
CHANGED
|
@@ -63,8 +63,13 @@ class Avatar extends Component<AvatarProps, AvatarState> {
|
|
|
63
63
|
ref: Element | null = null
|
|
64
64
|
|
|
65
65
|
handleRef = (el: Element | null) => {
|
|
66
|
+
const { elementRef } = this.props
|
|
67
|
+
|
|
66
68
|
this.ref = el
|
|
67
|
-
|
|
69
|
+
|
|
70
|
+
if (typeof elementRef === 'function') {
|
|
71
|
+
elementRef(el)
|
|
72
|
+
}
|
|
68
73
|
}
|
|
69
74
|
|
|
70
75
|
componentDidMount() {
|
package/src/Avatar/props.ts
CHANGED
|
@@ -35,6 +35,7 @@ import type {
|
|
|
35
35
|
import type {
|
|
36
36
|
AsElementType,
|
|
37
37
|
AvatarTheme,
|
|
38
|
+
OtherHTMLAttributes,
|
|
38
39
|
PropValidators
|
|
39
40
|
} from '@instructure/shared-types'
|
|
40
41
|
|
|
@@ -85,7 +86,7 @@ type AvatarOwnProps = {
|
|
|
85
86
|
*/
|
|
86
87
|
as?: AsElementType
|
|
87
88
|
/**
|
|
88
|
-
*
|
|
89
|
+
* provides a reference to the underlying html root element
|
|
89
90
|
*/
|
|
90
91
|
elementRef?: (element: Element | null) => void
|
|
91
92
|
}
|
|
@@ -98,7 +99,9 @@ type PropKeys = keyof AvatarOwnProps
|
|
|
98
99
|
|
|
99
100
|
type AllowedPropKeys = Readonly<Array<PropKeys>>
|
|
100
101
|
|
|
101
|
-
type AvatarProps = AvatarOwnProps &
|
|
102
|
+
type AvatarProps = AvatarOwnProps &
|
|
103
|
+
WithStyleProps<AvatarTheme, AvatarStyle> &
|
|
104
|
+
OtherHTMLAttributes<AvatarOwnProps>
|
|
102
105
|
|
|
103
106
|
type AvatarStyle = ComponentStyle<'avatar' | 'initials' | 'loadImage'>
|
|
104
107
|
|
package/types/Avatar/index.d.ts
CHANGED
|
@@ -12,6 +12,12 @@ declare class Avatar extends Component<AvatarProps, AvatarState> {
|
|
|
12
12
|
static readonly componentId = "Avatar";
|
|
13
13
|
static propTypes: import("@instructure/shared-types/types/UtilityTypes").PropValidators<keyof {
|
|
14
14
|
name: string;
|
|
15
|
+
/**
|
|
16
|
+
---
|
|
17
|
+
category: components
|
|
18
|
+
---
|
|
19
|
+
@tsProps
|
|
20
|
+
**/
|
|
15
21
|
src?: string | undefined;
|
|
16
22
|
alt?: string | undefined;
|
|
17
23
|
size: "auto" | "xx-small" | "x-small" | "small" | "medium" | "large" | "x-large" | "xx-large";
|
|
@@ -25,6 +31,12 @@ declare class Avatar extends Component<AvatarProps, AvatarState> {
|
|
|
25
31
|
}>;
|
|
26
32
|
static allowedProps: readonly (keyof {
|
|
27
33
|
name: string;
|
|
34
|
+
/**
|
|
35
|
+
---
|
|
36
|
+
category: components
|
|
37
|
+
---
|
|
38
|
+
@tsProps
|
|
39
|
+
**/
|
|
28
40
|
src?: string | undefined;
|
|
29
41
|
alt?: string | undefined;
|
|
30
42
|
size: "auto" | "xx-small" | "x-small" | "small" | "medium" | "large" | "x-large" | "xx-large";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Avatar/index.tsx"],"names":[],"mappings":"AAwBA,eAAe;AACf,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAMjD,OAAO,EAAa,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAMrD,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAEvD;;;;;GAKG;AACH,cAEM,MAAO,SAAQ,SAAS,CAAC,WAAW,EAAE,WAAW,CAAC;IACtD,MAAM,CAAC,QAAQ,CAAC,WAAW,YAAW;IAEtC,MAAM,CAAC,SAAS
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Avatar/index.tsx"],"names":[],"mappings":"AAwBA,eAAe;AACf,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAMjD,OAAO,EAAa,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAMrD,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAEvD;;;;;GAKG;AACH,cAEM,MAAO,SAAQ,SAAS,CAAC,WAAW,EAAE,WAAW,CAAC;IACtD,MAAM,CAAC,QAAQ,CAAC,WAAW,YAAW;IAEtC,MAAM,CAAC,SAAS;;QAXlB;;;;;WAKG;;;;;;;;;;;OAM2B;IAC5B,MAAM,CAAC,YAAY;;QAZrB;;;;;WAKG;;;;;;;;;;;SAOiC;IAClC,MAAM,CAAC,YAAY;;;;;yCAKO,cAAc;MAC9B;IAEV,KAAK;;MAAoB;IAEzB,GAAG,EAAE,OAAO,GAAG,IAAI,CAAO;IAE1B,SAAS,OAAQ,OAAO,GAAG,IAAI,UAQ9B;IAED,iBAAiB;IAKjB,kBAAkB;IAKlB,oBAAoB;IAmBpB,iBAAiB,UAAW,cAAc,UAGzC;IAED,cAAc;IAQd,MAAM;CAyBP;AAED,eAAe,MAAM,CAAA;AACrB,OAAO,EAAE,MAAM,EAAE,CAAA"}
|
package/types/Avatar/props.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SyntheticEvent } from 'react';
|
|
2
2
|
import type { Spacing, WithStyleProps, ComponentStyle } from '@instructure/emotion';
|
|
3
|
-
import type { AsElementType, AvatarTheme, PropValidators } from '@instructure/shared-types';
|
|
3
|
+
import type { AsElementType, AvatarTheme, OtherHTMLAttributes, PropValidators } from '@instructure/shared-types';
|
|
4
4
|
declare type AvatarOwnProps = {
|
|
5
5
|
/**
|
|
6
6
|
* The name to display. It will be automatically converted to initials.
|
|
@@ -33,7 +33,7 @@ declare type AvatarOwnProps = {
|
|
|
33
33
|
*/
|
|
34
34
|
as?: AsElementType;
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
36
|
+
* provides a reference to the underlying html root element
|
|
37
37
|
*/
|
|
38
38
|
elementRef?: (element: Element | null) => void;
|
|
39
39
|
};
|
|
@@ -42,7 +42,7 @@ export declare type AvatarState = {
|
|
|
42
42
|
};
|
|
43
43
|
declare type PropKeys = keyof AvatarOwnProps;
|
|
44
44
|
declare type AllowedPropKeys = Readonly<Array<PropKeys>>;
|
|
45
|
-
declare type AvatarProps = AvatarOwnProps & WithStyleProps<AvatarTheme, AvatarStyle>;
|
|
45
|
+
declare type AvatarProps = AvatarOwnProps & WithStyleProps<AvatarTheme, AvatarStyle> & OtherHTMLAttributes<AvatarOwnProps>;
|
|
46
46
|
declare type AvatarStyle = ComponentStyle<'avatar' | 'initials' | 'loadImage'>;
|
|
47
47
|
declare const propTypes: PropValidators<PropKeys>;
|
|
48
48
|
declare const allowedProps: AllowedPropKeys;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/Avatar/props.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAKtC,OAAO,KAAK,EACV,OAAO,EACP,cAAc,EACd,cAAc,EACf,MAAM,sBAAsB,CAAA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