@atlaskit/teams-avatar 2.5.0 → 2.6.1
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 +16 -0
- package/dist/cjs/ui/teams-avatar/index.js +1 -0
- package/dist/cjs/ui/teams-avatar/teams-avatar-image/index.js +9 -6
- package/dist/es2019/ui/teams-avatar/index.js +1 -0
- package/dist/es2019/ui/teams-avatar/teams-avatar-image/index.js +9 -6
- package/dist/esm/ui/teams-avatar/index.js +1 -0
- package/dist/esm/ui/teams-avatar/teams-avatar-image/index.js +9 -6
- package/package.json +10 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/teams-avatar
|
|
2
2
|
|
|
3
|
+
## 2.6.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`7fb5bfbafb83e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7fb5bfbafb83e) -
|
|
8
|
+
Enrol people-and-teams packages into the React Compiler with platform gating via
|
|
9
|
+
isReactCompilerActivePlatform
|
|
10
|
+
|
|
11
|
+
## 2.6.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [`e993a197e2357`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e993a197e2357) -
|
|
16
|
+
Fix stale avatar and error state when teamId changes by keying TeamAvatarImage on teamId in the
|
|
17
|
+
T26 branch
|
|
18
|
+
|
|
3
19
|
## 2.5.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
|
@@ -42,6 +42,7 @@ function TeamAvatar(_ref) {
|
|
|
42
42
|
size: size,
|
|
43
43
|
testId: "".concat(testId, "-team-avatar")
|
|
44
44
|
}), /*#__PURE__*/_react.default.createElement(_avatar.AvatarContent, null, /*#__PURE__*/_react.default.createElement(_teamsAvatarImage.TeamAvatarImage, {
|
|
45
|
+
key: teamId,
|
|
45
46
|
src: src,
|
|
46
47
|
size: size,
|
|
47
48
|
testId: testId,
|
|
@@ -13,6 +13,7 @@ var React = _react;
|
|
|
13
13
|
var _runtime = require("@compiled/react/runtime");
|
|
14
14
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
15
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
|
+
var _compiled = require("@atlaskit/primitives/compiled");
|
|
16
17
|
var _fallback = require("./fallback");
|
|
17
18
|
var _constants = require("./fallback/constants");
|
|
18
19
|
var _utils = require("./utils");
|
|
@@ -83,9 +84,10 @@ var TeamAvatarImage = exports.TeamAvatarImage = function TeamAvatarImage(_ref) {
|
|
|
83
84
|
hasImageErrored = _useState2[0],
|
|
84
85
|
setHasImageErrored = _useState2[1];
|
|
85
86
|
var avatarSrc = (0, _utils.getTeamAvatarSrc)(src, teamId);
|
|
86
|
-
|
|
87
|
-
// If src changes, reset state
|
|
88
87
|
(0, _react.useEffect)(function () {
|
|
88
|
+
if ((0, _platformFeatureFlags.fg)('enable_teams_t26_design_drop_core_experiences')) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
89
91
|
setHasImageErrored(false);
|
|
90
92
|
}, [avatarSrc]);
|
|
91
93
|
if ((!avatarSrc || hasImageErrored) && !(0, _platformFeatureFlags.fg)('enable_teams_t26_design_drop_core_experiences')) {
|
|
@@ -99,14 +101,15 @@ var TeamAvatarImage = exports.TeamAvatarImage = function TeamAvatarImage(_ref) {
|
|
|
99
101
|
}
|
|
100
102
|
if ((0, _platformFeatureFlags.fg)('enable_teams_t26_design_drop_core_experiences')) {
|
|
101
103
|
var resolvedSrc = hasImageErrored ? _constants.TEAM_FALLBACK_AVATAR_DATA_URI : avatarSrc;
|
|
102
|
-
return /*#__PURE__*/React.createElement(
|
|
104
|
+
return /*#__PURE__*/React.createElement(_compiled.Box, {
|
|
105
|
+
as: "img",
|
|
103
106
|
src: resolvedSrc,
|
|
104
107
|
alt: alt,
|
|
105
|
-
|
|
108
|
+
testId: testId && "".concat(testId, "--image"),
|
|
109
|
+
xcss: avatarImageStyles.image,
|
|
106
110
|
onError: function onError() {
|
|
107
111
|
return setHasImageErrored(true);
|
|
108
|
-
}
|
|
109
|
-
className: (0, _runtime.ax)([avatarImageStyles.image])
|
|
112
|
+
}
|
|
110
113
|
});
|
|
111
114
|
}
|
|
112
115
|
return /*#__PURE__*/React.createElement("span", {
|
|
@@ -29,6 +29,7 @@ export default function TeamAvatar({
|
|
|
29
29
|
size: size,
|
|
30
30
|
testId: `${testId}-team-avatar`
|
|
31
31
|
}), /*#__PURE__*/React.createElement(AvatarContent, null, /*#__PURE__*/React.createElement(TeamAvatarImage, {
|
|
32
|
+
key: teamId,
|
|
32
33
|
src: src,
|
|
33
34
|
size: size,
|
|
34
35
|
testId: testId,
|
|
@@ -4,6 +4,7 @@ import * as React from 'react';
|
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
5
|
import { useEffect, useState } from 'react';
|
|
6
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
|
+
import { Box } from '@atlaskit/primitives/compiled';
|
|
7
8
|
import { FallbackAvatar } from './fallback';
|
|
8
9
|
import { TEAM_FALLBACK_AVATAR_DATA_URI } from './fallback/constants';
|
|
9
10
|
import { getTeamAvatarSrc } from './utils';
|
|
@@ -69,9 +70,10 @@ export const TeamAvatarImage = ({
|
|
|
69
70
|
}) => {
|
|
70
71
|
const [hasImageErrored, setHasImageErrored] = useState(false);
|
|
71
72
|
const avatarSrc = getTeamAvatarSrc(src, teamId);
|
|
72
|
-
|
|
73
|
-
// If src changes, reset state
|
|
74
73
|
useEffect(() => {
|
|
74
|
+
if (fg('enable_teams_t26_design_drop_core_experiences')) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
75
77
|
setHasImageErrored(false);
|
|
76
78
|
}, [avatarSrc]);
|
|
77
79
|
if ((!avatarSrc || hasImageErrored) && !fg('enable_teams_t26_design_drop_core_experiences')) {
|
|
@@ -85,12 +87,13 @@ export const TeamAvatarImage = ({
|
|
|
85
87
|
}
|
|
86
88
|
if (fg('enable_teams_t26_design_drop_core_experiences')) {
|
|
87
89
|
const resolvedSrc = hasImageErrored ? TEAM_FALLBACK_AVATAR_DATA_URI : avatarSrc;
|
|
88
|
-
return /*#__PURE__*/React.createElement(
|
|
90
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
91
|
+
as: "img",
|
|
89
92
|
src: resolvedSrc,
|
|
90
93
|
alt: alt,
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
+
testId: testId && `${testId}--image`,
|
|
95
|
+
xcss: avatarImageStyles.image,
|
|
96
|
+
onError: () => setHasImageErrored(true)
|
|
94
97
|
});
|
|
95
98
|
}
|
|
96
99
|
return /*#__PURE__*/React.createElement("span", {
|
|
@@ -33,6 +33,7 @@ export default function TeamAvatar(_ref) {
|
|
|
33
33
|
size: size,
|
|
34
34
|
testId: "".concat(testId, "-team-avatar")
|
|
35
35
|
}), /*#__PURE__*/React.createElement(AvatarContent, null, /*#__PURE__*/React.createElement(TeamAvatarImage, {
|
|
36
|
+
key: teamId,
|
|
36
37
|
src: src,
|
|
37
38
|
size: size,
|
|
38
39
|
testId: testId,
|
|
@@ -5,6 +5,7 @@ import * as React from 'react';
|
|
|
5
5
|
import { ax, ix } from "@compiled/react/runtime";
|
|
6
6
|
import { useEffect, useState } from 'react';
|
|
7
7
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
|
+
import { Box } from '@atlaskit/primitives/compiled';
|
|
8
9
|
import { FallbackAvatar } from './fallback';
|
|
9
10
|
import { TEAM_FALLBACK_AVATAR_DATA_URI } from './fallback/constants';
|
|
10
11
|
import { getTeamAvatarSrc } from './utils';
|
|
@@ -74,9 +75,10 @@ export var TeamAvatarImage = function TeamAvatarImage(_ref) {
|
|
|
74
75
|
hasImageErrored = _useState2[0],
|
|
75
76
|
setHasImageErrored = _useState2[1];
|
|
76
77
|
var avatarSrc = getTeamAvatarSrc(src, teamId);
|
|
77
|
-
|
|
78
|
-
// If src changes, reset state
|
|
79
78
|
useEffect(function () {
|
|
79
|
+
if (fg('enable_teams_t26_design_drop_core_experiences')) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
80
82
|
setHasImageErrored(false);
|
|
81
83
|
}, [avatarSrc]);
|
|
82
84
|
if ((!avatarSrc || hasImageErrored) && !fg('enable_teams_t26_design_drop_core_experiences')) {
|
|
@@ -90,14 +92,15 @@ export var TeamAvatarImage = function TeamAvatarImage(_ref) {
|
|
|
90
92
|
}
|
|
91
93
|
if (fg('enable_teams_t26_design_drop_core_experiences')) {
|
|
92
94
|
var resolvedSrc = hasImageErrored ? TEAM_FALLBACK_AVATAR_DATA_URI : avatarSrc;
|
|
93
|
-
return /*#__PURE__*/React.createElement(
|
|
95
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
96
|
+
as: "img",
|
|
94
97
|
src: resolvedSrc,
|
|
95
98
|
alt: alt,
|
|
96
|
-
|
|
99
|
+
testId: testId && "".concat(testId, "--image"),
|
|
100
|
+
xcss: avatarImageStyles.image,
|
|
97
101
|
onError: function onError() {
|
|
98
102
|
return setHasImageErrored(true);
|
|
99
|
-
}
|
|
100
|
-
className: ax([avatarImageStyles.image])
|
|
103
|
+
}
|
|
101
104
|
});
|
|
102
105
|
}
|
|
103
106
|
return /*#__PURE__*/React.createElement("span", {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/teams-avatar",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.1",
|
|
4
4
|
"description": "A team avatar is a visual representation of a team.",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -8,6 +8,13 @@
|
|
|
8
8
|
"registry": "https://registry.npmjs.org/"
|
|
9
9
|
},
|
|
10
10
|
"atlassian": {
|
|
11
|
+
"react-compiler": {
|
|
12
|
+
"enabled": true,
|
|
13
|
+
"gating": {
|
|
14
|
+
"source": "@atlassian/react-compiler-gating",
|
|
15
|
+
"importSpecifierName": "isReactCompilerActivePlatform"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
11
18
|
"team": "People and Teams Collective",
|
|
12
19
|
"website": {
|
|
13
20
|
"name": "TeamsAvatar",
|
|
@@ -50,7 +57,8 @@
|
|
|
50
57
|
"@af/integration-testing": "workspace:^",
|
|
51
58
|
"@af/visual-regression": "workspace:^",
|
|
52
59
|
"@atlaskit/ssr": "workspace:^",
|
|
53
|
-
"@atlassian/
|
|
60
|
+
"@atlassian/react-compiler-gating": "workspace:^",
|
|
61
|
+
"@atlassian/teams-app-internal-playground": "^2.1.0",
|
|
54
62
|
"@testing-library/react": "^16.3.0",
|
|
55
63
|
"react-dom": "^18.2.0",
|
|
56
64
|
"wait-for-expect": "^1.2.0"
|