@atlaskit/teams-avatar 2.3.13 → 2.3.15

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.
Files changed (36) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/cjs/ui/teams-avatar/index.js +1 -2
  3. package/dist/{es2019/ui/teams-avatar/teams-avatar-image/teams-avatar-image-next → cjs/ui/teams-avatar/teams-avatar-image}/index.compiled.css +3 -3
  4. package/dist/cjs/ui/teams-avatar/teams-avatar-image/index.js +70 -89
  5. package/dist/cjs/ui/teams-avatar/utils.js +3 -22
  6. package/dist/es2019/ui/teams-avatar/index.js +1 -2
  7. package/dist/{esm/ui/teams-avatar/teams-avatar-image/teams-avatar-image-next → es2019/ui/teams-avatar/teams-avatar-image}/index.compiled.css +3 -3
  8. package/dist/es2019/ui/teams-avatar/teams-avatar-image/index.js +62 -83
  9. package/dist/es2019/ui/teams-avatar/utils.js +3 -22
  10. package/dist/esm/ui/teams-avatar/index.js +1 -2
  11. package/dist/{cjs/ui/teams-avatar/teams-avatar-image/teams-avatar-image-next → esm/ui/teams-avatar/teams-avatar-image}/index.compiled.css +3 -3
  12. package/dist/esm/ui/teams-avatar/teams-avatar-image/index.js +66 -90
  13. package/dist/esm/ui/teams-avatar/utils.js +3 -22
  14. package/dist/types/ui/teams-avatar/teams-avatar-image/index.d.ts +5 -3
  15. package/dist/types/ui/teams-avatar/utils.d.ts +2 -7
  16. package/dist/types-ts4.5/ui/teams-avatar/teams-avatar-image/index.d.ts +5 -3
  17. package/dist/types-ts4.5/ui/teams-avatar/utils.d.ts +2 -7
  18. package/package.json +1 -14
  19. package/dist/cjs/ui/teams-avatar/teams-avatar-image/teams-avatar-image-next/fallback/index.compiled.css +0 -5
  20. package/dist/cjs/ui/teams-avatar/teams-avatar-image/teams-avatar-image-next/fallback/index.js +0 -57
  21. package/dist/cjs/ui/teams-avatar/teams-avatar-image/teams-avatar-image-next/index.js +0 -106
  22. package/dist/es2019/ui/teams-avatar/teams-avatar-image/teams-avatar-image-next/fallback/index.compiled.css +0 -5
  23. package/dist/es2019/ui/teams-avatar/teams-avatar-image/teams-avatar-image-next/fallback/index.js +0 -50
  24. package/dist/es2019/ui/teams-avatar/teams-avatar-image/teams-avatar-image-next/index.js +0 -91
  25. package/dist/esm/ui/teams-avatar/teams-avatar-image/teams-avatar-image-next/fallback/index.compiled.css +0 -5
  26. package/dist/esm/ui/teams-avatar/teams-avatar-image/teams-avatar-image-next/fallback/index.js +0 -50
  27. package/dist/esm/ui/teams-avatar/teams-avatar-image/teams-avatar-image-next/index.js +0 -97
  28. package/dist/types/ui/teams-avatar/teams-avatar-image/teams-avatar-image-next/fallback/index.d.ts +0 -2
  29. package/dist/types/ui/teams-avatar/teams-avatar-image/teams-avatar-image-next/index.d.ts +0 -19
  30. package/dist/types-ts4.5/ui/teams-avatar/teams-avatar-image/teams-avatar-image-next/fallback/index.d.ts +0 -2
  31. package/dist/types-ts4.5/ui/teams-avatar/teams-avatar-image/teams-avatar-image-next/index.d.ts +0 -19
  32. /package/dist/cjs/ui/teams-avatar/teams-avatar-image/{teams-avatar-image-next/utils.js → utils.js} +0 -0
  33. /package/dist/es2019/ui/teams-avatar/teams-avatar-image/{teams-avatar-image-next/utils.js → utils.js} +0 -0
  34. /package/dist/esm/ui/teams-avatar/teams-avatar-image/{teams-avatar-image-next/utils.js → utils.js} +0 -0
  35. /package/dist/types/ui/teams-avatar/teams-avatar-image/{teams-avatar-image-next/utils.d.ts → utils.d.ts} +0 -0
  36. /package/dist/types-ts4.5/ui/teams-avatar/teams-avatar-image/{teams-avatar-image-next/utils.d.ts → utils.d.ts} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @atlaskit/teams-avatar
2
2
 
3
+ ## 2.3.15
4
+
5
+ ### Patch Changes
6
+
7
+ - [`765759f2ef1a6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/765759f2ef1a6) -
8
+ Clean up of FGs
9
+
10
+ ## 2.3.14
11
+
12
+ ### Patch Changes
13
+
14
+ - [`ef3b2dfa2f8a8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ef3b2dfa2f8a8) -
15
+ Internal changes to use radius tokens. No visual changes.
16
+ - Updated dependencies
17
+
3
18
  ## 2.3.13
4
19
 
5
20
  ### Patch Changes
@@ -12,7 +12,6 @@ var _react = _interopRequireDefault(require("react"));
12
12
  var _avatar = _interopRequireDefault(require("@atlaskit/avatar"));
13
13
  var _colors = require("@atlaskit/theme/colors");
14
14
  var _teamsAvatarImage = require("./teams-avatar-image");
15
- var _utils = require("./utils");
16
15
  var _excluded = ["testId", "src", "size", "teamId"];
17
16
  /*
18
17
  * The component accepts src and teamId as input params. Order of preference:
@@ -34,7 +33,7 @@ function TeamAvatar(_ref) {
34
33
  // Strip ARI in case the teamId was given in that format
35
34
  teamId = teamId.replace('ari:cloud:identity::team/', '');
36
35
  return /*#__PURE__*/_react.default.createElement(_avatar.default, (0, _extends2.default)({
37
- appearance: (0, _utils.isSquareIcon)(src) ? 'square' : 'circle'
36
+ appearance: "square"
38
37
  }, props, {
39
38
  size: size,
40
39
  src: src,
@@ -1,12 +1,12 @@
1
1
 
2
2
  ._14mj1q5u:after{border-radius:var(--ds-border-radius-circle,50%)}
3
3
  ._19itglyw{border:none}
4
+ ._2rko12b0{border-radius:var(--ds-radius-small,4px)}
4
5
  ._2rko19bv{border-radius:10px}
6
+ ._2rko1mok{border-radius:var(--ds-radius-large,8px)}
5
7
  ._2rko1q5u{border-radius:var(--ds-border-radius-circle,50%)}
8
+ ._2rko1qi0{border-radius:var(--ds-radius-medium,6px)}
6
9
  ._2rko1tcg{border-radius:24px}
7
- ._2rko1y44{border-radius:4px}
8
- ._2rkoi2wt{border-radius:6px}
9
- ._2rkopd34{border-radius:var(--ds-border-radius-200,8px)}
10
10
  ._2rkozwfg{border-radius:2pc}
11
11
  ._9v7aze3t:after{inset:var(--ds-space-0,0)}
12
12
  ._qc5o1p41:after{transition:opacity .2s}
@@ -1,39 +1,40 @@
1
+ /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
2
  "use strict";
2
3
 
3
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
4
6
  Object.defineProperty(exports, "__esModule", {
5
7
  value: true
6
8
  });
7
- exports.TeamAvatarImageLegacy = exports.TeamAvatarImage = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
+ exports.TeamAvatarImage = void 0;
10
+ require("./index.compiled.css");
11
+ var _react = _interopRequireWildcard(require("react"));
12
+ var React = _react;
13
+ var _runtime = require("@compiled/react/runtime");
9
14
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
- var _react = require("react");
11
- var _react2 = require("@emotion/react");
12
- var _avatar = require("@atlaskit/avatar");
13
- var _peopleGroup = _interopRequireDefault(require("@atlaskit/icon/core/people-group"));
14
- var _people = _interopRequireDefault(require("@atlaskit/icon/glyph/people"));
15
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
16
- var _colors = require("@atlaskit/theme/colors");
17
15
  var _fallback = require("./fallback");
18
- var _teamsAvatarImageNext = require("./teams-avatar-image-next");
19
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
20
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /**
21
- * @jsxRuntime classic
22
- * @jsx jsx
23
- */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
24
- var ICON_BACKGROUND = "var(--ds-icon-inverse, ".concat(_colors.N0, ")");
25
- var ICON_COLOR = "var(--ds-icon-subtle, ".concat(_colors.N90, ")");
26
- // used in a size calculation so can't be a token. Without this the avatar looks very squished
27
- var ICON_PADDING = 4;
28
- var avatarDefaultIconStyles = (0, _react2.css)({
29
- display: 'flex',
30
- backgroundColor: ICON_COLOR,
31
- borderRadius: '50%',
32
- width: '100%',
33
- height: '100%',
34
- justifyContent: 'center',
35
- alignItems: 'center'
36
- });
16
+ var _utils = require("./utils");
17
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
18
+ var boxShadowCssVar = '--avatar-box-shadow';
19
+ var bgColorCssVar = '--avatar-bg-color';
20
+
21
+ /**
22
+ * We need to maintan the container styles manually until Avatar provides the correct border radius.
23
+ * After that we can return to wrapping in <AvatarContent> rather than span
24
+ */
25
+ var containerStyles = {
26
+ root: "_19itglyw _12ji1r31 _1qu2glyw _12y31o36 _1reo15vq _18m915vq _v564ieh6 _1e0c1txw _kqswpfqs _4cvr1fhb _1bah1h6o _2lx21bp4 _80om1kw7 _6rthv77o _1pfhv77o _12l2v77o _ahbqv77o _85i5ze3t _1q51ze3t _y4tize3t _bozgze3t _t9ec1aqe _9v7aze3t _qc5o1p41 _z0ai1osq _18postnw _1hfk1j28 _aetrf705 _1peqidpf _11fnglyw",
27
+ circle: "_2rko1q5u _14mj1q5u",
28
+ positionRelative: "_kqswh2mm",
29
+ disabled: "_80om13gf _1hfkvuon _1peqs237"
30
+ };
31
+ var unboundStyles = {
32
+ root: "_vchh1ntv _bfhkcxp3 _16qs1nhn",
33
+ interactive: "_80omtlke _4tpu1g4v _ez1ykb7n _gcm1182g _eeh8kb7n _jlxit94y"
34
+ };
35
+ var avatarImageStyles = {
36
+ image: "_16jlkb7n _1o9zkb7n _i0dl1osq _1e0c1txw _1bsb1osq _4t3i1osq"
37
+ };
37
38
  var SIZES = {
38
39
  xsmall: 16,
39
40
  small: 24,
@@ -42,84 +43,64 @@ var SIZES = {
42
43
  xlarge: 96,
43
44
  xxlarge: 128
44
45
  };
45
- var nestedAvatarStyles = Object.entries(_avatar.AVATAR_SIZES).reduce(function (styles, _ref) {
46
- var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
47
- key = _ref2[0],
48
- size = _ref2[1];
49
- return _objectSpread(_objectSpread({}, styles), {}, (0, _defineProperty2.default)({}, key, (0, _react2.css)({
50
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
51
- width: "".concat(size, "px"),
52
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
53
- height: "".concat(size, "px"),
54
- // eslint-disable-next-line @atlaskit/design-system/no-nested-styles, @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
55
- '& svg': {
56
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
57
- width: "".concat(size - ICON_PADDING, "px"),
58
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
59
- height: "".concat(size - ICON_PADDING, "px")
60
- }
61
- })));
62
- }, {});
63
- var avatarImageStyles = (0, _react2.css)({
64
- display: 'flex',
65
- flex: '1 1 100%',
66
- width: '100%',
67
- height: '100%'
68
- });
46
+ var borderRadiusMap = {
47
+ xsmall: "_2rko12b0",
48
+ small: "_2rko1qi0",
49
+ medium: "_2rko1mok",
50
+ large: "_2rko19bv",
51
+ xlarge: "_2rko1tcg",
52
+ xxlarge: "_2rkozwfg"
53
+ };
54
+ var widthHeightMap = {
55
+ xsmall: "_1bsb7vkz _4t3i7vkz",
56
+ small: "_1bsb1tcg _4t3i1tcg",
57
+ medium: "_1bsbzwfg _4t3izwfg",
58
+ large: "_1bsb1ylp _4t3i1ylp",
59
+ xlarge: "_1bsb16xz _4t3i16xz",
60
+ xxlarge: "_1bsb1qr7 _4t3i1qr7"
61
+ };
69
62
 
70
63
  /**
71
64
  * __Avatar image__
72
65
  *
73
66
  * An avatar image is an internal component used to control the rendering phases of an image.
74
67
  */
75
- var TeamAvatarImageLegacy = exports.TeamAvatarImageLegacy = function TeamAvatarImageLegacy(_ref3) {
76
- var _ref3$alt = _ref3.alt,
77
- alt = _ref3$alt === void 0 ? '' : _ref3$alt,
78
- src = _ref3.src,
79
- size = _ref3.size,
80
- testId = _ref3.testId;
68
+ var TeamAvatarImage = exports.TeamAvatarImage = function TeamAvatarImage(_ref) {
69
+ var _ref$alt = _ref.alt,
70
+ alt = _ref$alt === void 0 ? '' : _ref$alt,
71
+ src = _ref.src,
72
+ size = _ref.size,
73
+ testId = _ref.testId,
74
+ teamId = _ref.teamId;
81
75
  var _useState = (0, _react.useState)(false),
82
76
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
83
77
  hasImageErrored = _useState2[0],
84
78
  setHasImageErrored = _useState2[1];
79
+ var avatarSrc = (0, _utils.getTeamAvatarSrc)(src, teamId);
85
80
 
86
81
  // If src changes, reset state
87
82
  (0, _react.useEffect)(function () {
88
83
  setHasImageErrored(false);
89
- }, [src]);
90
- if (!src || hasImageErrored) {
91
- if ((0, _platformFeatureFlags.fg)('enable-team-avatar-switch')) {
92
- return (0, _react2.jsx)(_fallback.FallbackAvatar, {
93
- "aria-label": alt,
94
- width: SIZES[size],
95
- height: SIZES[size],
96
- "data-testid": testId
97
- });
98
- }
99
- return (0, _react2.jsx)("span", {
100
- css: [avatarDefaultIconStyles, nestedAvatarStyles[size]]
101
- }, (0, _react2.jsx)(_peopleGroup.default, {
102
- label: alt,
103
- color: ICON_BACKGROUND,
104
- LEGACY_secondaryColor: ICON_COLOR,
105
- testId: testId && "".concat(testId, "--team"),
106
- spacing: "spacious",
107
- LEGACY_fallbackIcon: _people.default
108
- }));
84
+ }, [avatarSrc]);
85
+ if (!avatarSrc || hasImageErrored) {
86
+ return /*#__PURE__*/React.createElement(_fallback.FallbackAvatar, {
87
+ "aria-label": alt,
88
+ width: SIZES[size],
89
+ height: SIZES[size],
90
+ "data-testid": testId
91
+ });
109
92
  }
110
- return (0, _react2.jsx)(_avatar.AvatarContent, null, (0, _react2.jsx)("img", {
111
- src: src,
93
+ return /*#__PURE__*/React.createElement("span", {
94
+ "data-testid": testId,
95
+ "aria-label": alt,
96
+ className: (0, _runtime.ax)([unboundStyles.root, containerStyles.root, borderRadiusMap[size], widthHeightMap[size]])
97
+ }, /*#__PURE__*/React.createElement("img", {
98
+ src: avatarSrc,
112
99
  alt: alt,
113
- "data-testid": testId && "".concat(testId, "--image"),
114
- css: avatarImageStyles,
100
+ "data-testId": testId && "".concat(testId, "--image"),
115
101
  onError: function onError() {
116
102
  return setHasImageErrored(true);
117
- }
103
+ },
104
+ className: (0, _runtime.ax)([avatarImageStyles.image])
118
105
  }));
119
- };
120
- var TeamAvatarImage = exports.TeamAvatarImage = function TeamAvatarImage(props) {
121
- if ((0, _platformFeatureFlags.fg)('team-avatar-radii')) {
122
- return (0, _react2.jsx)(_teamsAvatarImageNext.TeamAvatarImage, props);
123
- }
124
- return (0, _react2.jsx)(TeamAvatarImageLegacy, props);
125
106
  };
@@ -4,28 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.isSquareIcon = isSquareIcon;
7
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
8
7
  /**
9
- * This is a hack to toggle between square and circle icons based on the
10
- * network response as we want to FG the change in the BE.
11
- * This func will be removed once the BE is rolled out.
12
- * Square icon URLs:
13
- * - https://ptc-directory-sited-static.us-east-1.prod.public.atl-paas.net/teams/avatars/v4/blue_4.svg
14
- * - https://teams-directory-frontend.stg-east.frontend.public.atl-paas.net/assets/teams/avatars/v4/blue_1.svg
8
+ * @deprecated teams avatar is now always square
15
9
  */
16
- function isSquareIcon(src) {
17
- if (!src) {
18
- return false;
19
- }
20
- try {
21
- var url = new URL(src);
22
- var host = url.host;
23
- var path = url.pathname;
24
- if ((host.startsWith('ptc-directory-sited-static') || host.startsWith('teams-directory-frontend')) && path.includes('teams/avatars/v4') && (0, _platformFeatureFlags.fg)('enable-team-avatar-switch')) {
25
- return true;
26
- }
27
- } catch (_unused) {
28
- // The src wasn't a URL, so it's obviously not the refreshed avatar.
29
- }
30
- return false;
10
+ function isSquareIcon(_src) {
11
+ return true;
31
12
  }
@@ -3,7 +3,6 @@ import React from 'react';
3
3
  import Avatar from '@atlaskit/avatar';
4
4
  import { N0, N90 } from '@atlaskit/theme/colors';
5
5
  import { TeamAvatarImage } from './teams-avatar-image';
6
- import { isSquareIcon } from './utils';
7
6
 
8
7
  /*
9
8
  * The component accepts src and teamId as input params. Order of preference:
@@ -24,7 +23,7 @@ export default function TeamAvatar({
24
23
  // Strip ARI in case the teamId was given in that format
25
24
  teamId = teamId.replace('ari:cloud:identity::team/', '');
26
25
  return /*#__PURE__*/React.createElement(Avatar, _extends({
27
- appearance: isSquareIcon(src) ? 'square' : 'circle'
26
+ appearance: "square"
28
27
  }, props, {
29
28
  size: size,
30
29
  src: src,
@@ -1,12 +1,12 @@
1
1
 
2
2
  ._14mj1q5u:after{border-radius:var(--ds-border-radius-circle,50%)}
3
3
  ._19itglyw{border:none}
4
+ ._2rko12b0{border-radius:var(--ds-radius-small,4px)}
4
5
  ._2rko19bv{border-radius:10px}
6
+ ._2rko1mok{border-radius:var(--ds-radius-large,8px)}
5
7
  ._2rko1q5u{border-radius:var(--ds-border-radius-circle,50%)}
8
+ ._2rko1qi0{border-radius:var(--ds-radius-medium,6px)}
6
9
  ._2rko1tcg{border-radius:24px}
7
- ._2rko1y44{border-radius:4px}
8
- ._2rkoi2wt{border-radius:6px}
9
- ._2rkopd34{border-radius:var(--ds-border-radius-200,8px)}
10
10
  ._2rkozwfg{border-radius:2pc}
11
11
  ._9v7aze3t:after{inset:var(--ds-space-0,0)}
12
12
  ._qc5o1p41:after{transition:opacity .2s}
@@ -1,31 +1,30 @@
1
- /**
2
- * @jsxRuntime classic
3
- * @jsx jsx
4
- */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
2
+ import "./index.compiled.css";
3
+ import * as React from 'react';
4
+ import { ax, ix } from "@compiled/react/runtime";
5
5
  import { useEffect, useState } from 'react';
6
-
7
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
8
- import { css, jsx } from '@emotion/react';
9
- import { AVATAR_SIZES, AvatarContent } from '@atlaskit/avatar';
10
- import PeopleGroupIcon from '@atlaskit/icon/core/people-group';
11
- import TeamIcon from '@atlaskit/icon/glyph/people';
12
- import { fg } from '@atlaskit/platform-feature-flags';
13
- import { N0, N90 } from '@atlaskit/theme/colors';
14
6
  import { FallbackAvatar } from './fallback';
15
- import { TeamAvatarImage as TeamAvatarImageNext } from './teams-avatar-image-next';
16
- const ICON_BACKGROUND = `var(--ds-icon-inverse, ${N0})`;
17
- const ICON_COLOR = `var(--ds-icon-subtle, ${N90})`;
18
- // used in a size calculation so can't be a token. Without this the avatar looks very squished
19
- const ICON_PADDING = 4;
20
- const avatarDefaultIconStyles = css({
21
- display: 'flex',
22
- backgroundColor: ICON_COLOR,
23
- borderRadius: '50%',
24
- width: '100%',
25
- height: '100%',
26
- justifyContent: 'center',
27
- alignItems: 'center'
28
- });
7
+ import { getTeamAvatarSrc } from './utils';
8
+ const boxShadowCssVar = '--avatar-box-shadow';
9
+ const bgColorCssVar = '--avatar-bg-color';
10
+
11
+ /**
12
+ * We need to maintan the container styles manually until Avatar provides the correct border radius.
13
+ * After that we can return to wrapping in <AvatarContent> rather than span
14
+ */
15
+ const containerStyles = {
16
+ root: "_19itglyw _12ji1r31 _1qu2glyw _12y31o36 _1reo15vq _18m915vq _v564ieh6 _1e0c1txw _kqswpfqs _4cvr1fhb _1bah1h6o _2lx21bp4 _80om1kw7 _6rthv77o _1pfhv77o _12l2v77o _ahbqv77o _85i5ze3t _1q51ze3t _y4tize3t _bozgze3t _t9ec1aqe _9v7aze3t _qc5o1p41 _z0ai1osq _18postnw _1hfk1j28 _aetrf705 _1peqidpf _11fnglyw",
17
+ circle: "_2rko1q5u _14mj1q5u",
18
+ positionRelative: "_kqswh2mm",
19
+ disabled: "_80om13gf _1hfkvuon _1peqs237"
20
+ };
21
+ const unboundStyles = {
22
+ root: "_vchh1ntv _bfhkcxp3 _16qs1nhn",
23
+ interactive: "_80omtlke _4tpu1g4v _ez1ykb7n _gcm1182g _eeh8kb7n _jlxit94y"
24
+ };
25
+ const avatarImageStyles = {
26
+ image: "_16jlkb7n _1o9zkb7n _i0dl1osq _1e0c1txw _1bsb1osq _4t3i1osq"
27
+ };
29
28
  const SIZES = {
30
29
  xsmall: 16,
31
30
  small: 24,
@@ -34,79 +33,59 @@ const SIZES = {
34
33
  xlarge: 96,
35
34
  xxlarge: 128
36
35
  };
37
- const nestedAvatarStyles = Object.entries(AVATAR_SIZES).reduce((styles, [key, size]) => {
38
- return {
39
- ...styles,
40
- [key]: css({
41
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
42
- width: `${size}px`,
43
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
44
- height: `${size}px`,
45
- // eslint-disable-next-line @atlaskit/design-system/no-nested-styles, @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
46
- '& svg': {
47
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
48
- width: `${size - ICON_PADDING}px`,
49
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
50
- height: `${size - ICON_PADDING}px`
51
- }
52
- })
53
- };
54
- }, {});
55
- const avatarImageStyles = css({
56
- display: 'flex',
57
- flex: '1 1 100%',
58
- width: '100%',
59
- height: '100%'
60
- });
36
+ const borderRadiusMap = {
37
+ xsmall: "_2rko12b0",
38
+ small: "_2rko1qi0",
39
+ medium: "_2rko1mok",
40
+ large: "_2rko19bv",
41
+ xlarge: "_2rko1tcg",
42
+ xxlarge: "_2rkozwfg"
43
+ };
44
+ const widthHeightMap = {
45
+ xsmall: "_1bsb7vkz _4t3i7vkz",
46
+ small: "_1bsb1tcg _4t3i1tcg",
47
+ medium: "_1bsbzwfg _4t3izwfg",
48
+ large: "_1bsb1ylp _4t3i1ylp",
49
+ xlarge: "_1bsb16xz _4t3i16xz",
50
+ xxlarge: "_1bsb1qr7 _4t3i1qr7"
51
+ };
61
52
 
62
53
  /**
63
54
  * __Avatar image__
64
55
  *
65
56
  * An avatar image is an internal component used to control the rendering phases of an image.
66
57
  */
67
- export const TeamAvatarImageLegacy = ({
58
+ export const TeamAvatarImage = ({
68
59
  alt = '',
69
60
  src,
70
61
  size,
71
- testId
62
+ testId,
63
+ teamId
72
64
  }) => {
73
65
  const [hasImageErrored, setHasImageErrored] = useState(false);
66
+ const avatarSrc = getTeamAvatarSrc(src, teamId);
74
67
 
75
68
  // If src changes, reset state
76
69
  useEffect(() => {
77
70
  setHasImageErrored(false);
78
- }, [src]);
79
- if (!src || hasImageErrored) {
80
- if (fg('enable-team-avatar-switch')) {
81
- return jsx(FallbackAvatar, {
82
- "aria-label": alt,
83
- width: SIZES[size],
84
- height: SIZES[size],
85
- "data-testid": testId
86
- });
87
- }
88
- return jsx("span", {
89
- css: [avatarDefaultIconStyles, nestedAvatarStyles[size]]
90
- }, jsx(PeopleGroupIcon, {
91
- label: alt,
92
- color: ICON_BACKGROUND,
93
- LEGACY_secondaryColor: ICON_COLOR,
94
- testId: testId && `${testId}--team`,
95
- spacing: "spacious",
96
- LEGACY_fallbackIcon: TeamIcon
97
- }));
71
+ }, [avatarSrc]);
72
+ if (!avatarSrc || hasImageErrored) {
73
+ return /*#__PURE__*/React.createElement(FallbackAvatar, {
74
+ "aria-label": alt,
75
+ width: SIZES[size],
76
+ height: SIZES[size],
77
+ "data-testid": testId
78
+ });
98
79
  }
99
- return jsx(AvatarContent, null, jsx("img", {
100
- src: src,
80
+ return /*#__PURE__*/React.createElement("span", {
81
+ "data-testid": testId,
82
+ "aria-label": alt,
83
+ className: ax([unboundStyles.root, containerStyles.root, borderRadiusMap[size], widthHeightMap[size]])
84
+ }, /*#__PURE__*/React.createElement("img", {
85
+ src: avatarSrc,
101
86
  alt: alt,
102
- "data-testid": testId && `${testId}--image`,
103
- css: avatarImageStyles,
104
- onError: () => setHasImageErrored(true)
87
+ "data-testId": testId && `${testId}--image`,
88
+ onError: () => setHasImageErrored(true),
89
+ className: ax([avatarImageStyles.image])
105
90
  }));
106
- };
107
- export const TeamAvatarImage = props => {
108
- if (fg('team-avatar-radii')) {
109
- return jsx(TeamAvatarImageNext, props);
110
- }
111
- return jsx(TeamAvatarImageLegacy, props);
112
91
  };
@@ -1,25 +1,6 @@
1
- import { fg } from '@atlaskit/platform-feature-flags';
2
1
  /**
3
- * This is a hack to toggle between square and circle icons based on the
4
- * network response as we want to FG the change in the BE.
5
- * This func will be removed once the BE is rolled out.
6
- * Square icon URLs:
7
- * - https://ptc-directory-sited-static.us-east-1.prod.public.atl-paas.net/teams/avatars/v4/blue_4.svg
8
- * - https://teams-directory-frontend.stg-east.frontend.public.atl-paas.net/assets/teams/avatars/v4/blue_1.svg
2
+ * @deprecated teams avatar is now always square
9
3
  */
10
- export function isSquareIcon(src) {
11
- if (!src) {
12
- return false;
13
- }
14
- try {
15
- const url = new URL(src);
16
- const host = url.host;
17
- const path = url.pathname;
18
- if ((host.startsWith('ptc-directory-sited-static') || host.startsWith('teams-directory-frontend')) && path.includes('teams/avatars/v4') && fg('enable-team-avatar-switch')) {
19
- return true;
20
- }
21
- } catch {
22
- // The src wasn't a URL, so it's obviously not the refreshed avatar.
23
- }
24
- return false;
4
+ export function isSquareIcon(_src) {
5
+ return true;
25
6
  }
@@ -5,7 +5,6 @@ import React from 'react';
5
5
  import Avatar from '@atlaskit/avatar';
6
6
  import { N0, N90 } from '@atlaskit/theme/colors';
7
7
  import { TeamAvatarImage } from './teams-avatar-image';
8
- import { isSquareIcon } from './utils';
9
8
 
10
9
  /*
11
10
  * The component accepts src and teamId as input params. Order of preference:
@@ -27,7 +26,7 @@ export default function TeamAvatar(_ref) {
27
26
  // Strip ARI in case the teamId was given in that format
28
27
  teamId = teamId.replace('ari:cloud:identity::team/', '');
29
28
  return /*#__PURE__*/React.createElement(Avatar, _extends({
30
- appearance: isSquareIcon(src) ? 'square' : 'circle'
29
+ appearance: "square"
31
30
  }, props, {
32
31
  size: size,
33
32
  src: src,
@@ -1,12 +1,12 @@
1
1
 
2
2
  ._14mj1q5u:after{border-radius:var(--ds-border-radius-circle,50%)}
3
3
  ._19itglyw{border:none}
4
+ ._2rko12b0{border-radius:var(--ds-radius-small,4px)}
4
5
  ._2rko19bv{border-radius:10px}
6
+ ._2rko1mok{border-radius:var(--ds-radius-large,8px)}
5
7
  ._2rko1q5u{border-radius:var(--ds-border-radius-circle,50%)}
8
+ ._2rko1qi0{border-radius:var(--ds-radius-medium,6px)}
6
9
  ._2rko1tcg{border-radius:24px}
7
- ._2rko1y44{border-radius:4px}
8
- ._2rkoi2wt{border-radius:6px}
9
- ._2rkopd34{border-radius:var(--ds-border-radius-200,8px)}
10
10
  ._2rkozwfg{border-radius:2pc}
11
11
  ._9v7aze3t:after{inset:var(--ds-space-0,0)}
12
12
  ._qc5o1p41:after{transition:opacity .2s}