@atlaskit/teams-avatar 2.2.0 → 2.3.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/CHANGELOG.md +8 -0
- package/dist/cjs/ui/teams-avatar/teams-avatar-image/index.js +9 -2
- package/dist/cjs/ui/teams-avatar/teams-avatar-image/teams-avatar-image-next/fallback/index.compiled.css +5 -0
- package/dist/cjs/ui/teams-avatar/teams-avatar-image/teams-avatar-image-next/fallback/index.js +57 -0
- package/dist/cjs/ui/teams-avatar/teams-avatar-image/teams-avatar-image-next/index.compiled.css +12 -0
- package/dist/cjs/ui/teams-avatar/teams-avatar-image/teams-avatar-image-next/index.js +76 -0
- package/dist/es2019/ui/teams-avatar/teams-avatar-image/index.js +8 -1
- package/dist/es2019/ui/teams-avatar/teams-avatar-image/teams-avatar-image-next/fallback/index.compiled.css +5 -0
- package/dist/es2019/ui/teams-avatar/teams-avatar-image/teams-avatar-image-next/fallback/index.js +50 -0
- package/dist/es2019/ui/teams-avatar/teams-avatar-image/teams-avatar-image-next/index.compiled.css +12 -0
- package/dist/es2019/ui/teams-avatar/teams-avatar-image/teams-avatar-image-next/index.js +60 -0
- package/dist/esm/ui/teams-avatar/teams-avatar-image/index.js +8 -1
- package/dist/esm/ui/teams-avatar/teams-avatar-image/teams-avatar-image-next/fallback/index.compiled.css +5 -0
- package/dist/esm/ui/teams-avatar/teams-avatar-image/teams-avatar-image-next/fallback/index.js +50 -0
- package/dist/esm/ui/teams-avatar/teams-avatar-image/teams-avatar-image-next/index.compiled.css +12 -0
- package/dist/esm/ui/teams-avatar/teams-avatar-image/teams-avatar-image-next/index.js +66 -0
- package/dist/types/ui/teams-avatar/teams-avatar-image/index.d.ts +2 -1
- package/dist/types/ui/teams-avatar/teams-avatar-image/teams-avatar-image-next/fallback/index.d.ts +2 -0
- package/dist/types/ui/teams-avatar/teams-avatar-image/teams-avatar-image-next/index.d.ts +19 -0
- package/dist/types-ts4.5/ui/teams-avatar/teams-avatar-image/index.d.ts +2 -1
- package/dist/types-ts4.5/ui/teams-avatar/teams-avatar-image/teams-avatar-image-next/fallback/index.d.ts +2 -0
- package/dist/types-ts4.5/ui/teams-avatar/teams-avatar-image/teams-avatar-image-next/index.d.ts +19 -0
- package/package.json +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/teams-avatar
|
|
2
2
|
|
|
3
|
+
## 2.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#127906](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/127906)
|
|
8
|
+
[`194a6a52208e2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/194a6a52208e2) -
|
|
9
|
+
Update border radius
|
|
10
|
+
|
|
3
11
|
## 2.2.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.TeamAvatarImage = void 0;
|
|
7
|
+
exports.TeamAvatarImageLegacy = exports.TeamAvatarImage = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _react = require("react");
|
|
@@ -15,6 +15,7 @@ var _people = _interopRequireDefault(require("@atlaskit/icon/glyph/people"));
|
|
|
15
15
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
16
|
var _colors = require("@atlaskit/theme/colors");
|
|
17
17
|
var _fallback = require("./fallback");
|
|
18
|
+
var _teamsAvatarImageNext = require("./teams-avatar-image-next");
|
|
18
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; }
|
|
19
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; } /**
|
|
20
21
|
* @jsxRuntime classic
|
|
@@ -71,7 +72,7 @@ var avatarImageStyles = (0, _react2.css)({
|
|
|
71
72
|
*
|
|
72
73
|
* An avatar image is an internal component used to control the rendering phases of an image.
|
|
73
74
|
*/
|
|
74
|
-
var
|
|
75
|
+
var TeamAvatarImageLegacy = exports.TeamAvatarImageLegacy = function TeamAvatarImageLegacy(_ref3) {
|
|
75
76
|
var _ref3$alt = _ref3.alt,
|
|
76
77
|
alt = _ref3$alt === void 0 ? '' : _ref3$alt,
|
|
77
78
|
src = _ref3.src,
|
|
@@ -115,4 +116,10 @@ var TeamAvatarImage = exports.TeamAvatarImage = function TeamAvatarImage(_ref3)
|
|
|
115
116
|
return setHasImageErrored(true);
|
|
116
117
|
}
|
|
117
118
|
}));
|
|
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);
|
|
118
125
|
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/* index.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.FallbackAvatar = FallbackAvatar;
|
|
9
|
+
require("./index.compiled.css");
|
|
10
|
+
var _runtime = require("@compiled/react/runtime");
|
|
11
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
|
+
var _compiled = require("@atlaskit/primitives/compiled");
|
|
14
|
+
var styles = {
|
|
15
|
+
wrapper: "_1e0c1txw _19pkv77o _2hwxv77o _otyrv77o _18u0v77o"
|
|
16
|
+
};
|
|
17
|
+
function FallbackAvatar(props) {
|
|
18
|
+
return /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
19
|
+
xcss: styles.wrapper
|
|
20
|
+
}, /*#__PURE__*/_react.default.createElement("svg", (0, _extends2.default)({
|
|
21
|
+
width: "32",
|
|
22
|
+
height: "32",
|
|
23
|
+
viewBox: "0 0 32 32",
|
|
24
|
+
fill: "none",
|
|
25
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
26
|
+
}, props), /*#__PURE__*/_react.default.createElement("g", {
|
|
27
|
+
clipPath: "url(#clip0_2032_552)"
|
|
28
|
+
}, /*#__PURE__*/_react.default.createElement("rect", {
|
|
29
|
+
width: "32",
|
|
30
|
+
height: "32",
|
|
31
|
+
rx: "4",
|
|
32
|
+
fill: "#DCDFE4"
|
|
33
|
+
}), /*#__PURE__*/_react.default.createElement("path", {
|
|
34
|
+
fillRule: "evenodd",
|
|
35
|
+
clipRule: "evenodd",
|
|
36
|
+
d: "M10.6666 12.6666C11.7712 12.6666 12.6666 11.7712 12.6666 10.6666C12.6666 9.56206 11.7712 8.66663 10.6666 8.66663C9.56202 8.66663 8.66658 9.56206 8.66658 10.6666C8.66658 11.7712 9.56202 12.6666 10.6666 12.6666ZM10.6666 14.6666C12.8757 14.6666 14.6666 12.8758 14.6666 10.6666C14.6666 8.45749 12.8757 6.66663 10.6666 6.66663C8.45745 6.66663 6.66658 8.45749 6.66658 10.6666C6.66658 12.8758 8.45745 14.6666 10.6666 14.6666Z",
|
|
37
|
+
fill: "#44546F"
|
|
38
|
+
}), /*#__PURE__*/_react.default.createElement("path", {
|
|
39
|
+
fillRule: "evenodd",
|
|
40
|
+
clipRule: "evenodd",
|
|
41
|
+
d: "M21.3333 12.6666C22.4378 12.6666 23.3333 11.7712 23.3333 10.6666C23.3333 9.56206 22.4378 8.66663 21.3333 8.66663C20.2287 8.66663 19.3333 9.56206 19.3333 10.6666C19.3333 11.7712 20.2287 12.6666 21.3333 12.6666ZM21.3333 14.6666C23.5424 14.6666 25.3333 12.8758 25.3333 10.6666C25.3333 8.45749 23.5424 6.66663 21.3333 6.66663C19.1241 6.66663 17.3333 8.45749 17.3333 10.6666C17.3333 12.8758 19.1241 14.6666 21.3333 14.6666Z",
|
|
42
|
+
fill: "#44546F"
|
|
43
|
+
}), /*#__PURE__*/_react.default.createElement("path", {
|
|
44
|
+
d: "M21.6666 16C24.4273 16.0004 26.6666 18.2385 26.6666 21V22.6666C26.6666 24.1394 25.4727 25.3333 23.9999 25.3333H20.135C18.0324 25.3333 16.1545 24.018 15.436 22.042L14.6843 19.9747C14.2531 18.7892 13.1264 18 11.8649 18H10.3333C8.6764 18 7.33325 19.3431 7.33325 21V22.6666C7.33325 23.0348 7.63173 23.3333 7.99992 23.3333H13.3333V25.3333H7.99992C6.52716 25.3333 5.33325 24.1394 5.33325 22.6666V21C5.33325 18.2385 7.57183 16 10.3333 16H11.8649C13.9674 16 15.8453 17.3153 16.5638 19.2913L17.3156 21.3585C17.7467 22.5441 18.8734 23.3333 20.135 23.3333H23.9999C24.3681 23.3333 24.6666 23.0348 24.6666 22.6666V21C24.6666 19.3437 23.3233 18.0004 21.6666 18H20.135V16H21.6666Z",
|
|
45
|
+
fill: "#44546F"
|
|
46
|
+
}), /*#__PURE__*/_react.default.createElement("path", {
|
|
47
|
+
d: "M20.135 16C19.5972 16 18.7183 16.1407 18.0518 16.4564L18.908 18.2639C19.064 18.19 19.288 18.1205 19.537 18.0703C19.785 18.0203 20.0045 18 20.135 18V16Z",
|
|
48
|
+
fill: "#44546F"
|
|
49
|
+
})), /*#__PURE__*/_react.default.createElement("defs", null, /*#__PURE__*/_react.default.createElement("clipPath", {
|
|
50
|
+
id: "clip0_2032_552"
|
|
51
|
+
}, /*#__PURE__*/_react.default.createElement("rect", {
|
|
52
|
+
width: "32",
|
|
53
|
+
height: "32",
|
|
54
|
+
rx: "4",
|
|
55
|
+
fill: "white"
|
|
56
|
+
})))));
|
|
57
|
+
}
|
package/dist/cjs/ui/teams-avatar/teams-avatar-image/teams-avatar-image-next/index.compiled.css
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
|
|
2
|
+
._2rko19bv{border-radius:10px}
|
|
3
|
+
._2rko1tcg{border-radius:24px}
|
|
4
|
+
._2rko1y44{border-radius:4px}
|
|
5
|
+
._2rkoftgi{border-radius:8px}
|
|
6
|
+
._2rkoi2wt{border-radius:6px}
|
|
7
|
+
._2rkozwfg{border-radius:2pc}._16jlkb7n{flex-grow:1}
|
|
8
|
+
._1bsb1osq{width:100%}
|
|
9
|
+
._1e0c1txw{display:flex}
|
|
10
|
+
._1o9zkb7n{flex-shrink:1}
|
|
11
|
+
._4t3i1osq{height:100%}
|
|
12
|
+
._i0dl1osq{flex-basis:100%}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/* index.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
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");
|
|
14
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
|
+
var _avatar = require("@atlaskit/avatar");
|
|
16
|
+
var _fallback = require("./fallback");
|
|
17
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
18
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
19
|
+
var avatarImageStyles = {
|
|
20
|
+
image: "_16jlkb7n _1o9zkb7n _i0dl1osq _1e0c1txw _1bsb1osq _4t3i1osq"
|
|
21
|
+
};
|
|
22
|
+
var SIZES = {
|
|
23
|
+
xsmall: 16,
|
|
24
|
+
small: 24,
|
|
25
|
+
medium: 32,
|
|
26
|
+
large: 40,
|
|
27
|
+
xlarge: 96,
|
|
28
|
+
xxlarge: 128
|
|
29
|
+
};
|
|
30
|
+
var borderRadiusMap = {
|
|
31
|
+
xsmall: "_2rko1y44",
|
|
32
|
+
small: "_2rkoi2wt",
|
|
33
|
+
medium: "_2rkoftgi",
|
|
34
|
+
large: "_2rko19bv",
|
|
35
|
+
xlarge: "_2rko1tcg",
|
|
36
|
+
xxlarge: "_2rkozwfg"
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* __Avatar image__
|
|
41
|
+
*
|
|
42
|
+
* An avatar image is an internal component used to control the rendering phases of an image.
|
|
43
|
+
*/
|
|
44
|
+
var TeamAvatarImage = exports.TeamAvatarImage = function TeamAvatarImage(_ref) {
|
|
45
|
+
var _ref$alt = _ref.alt,
|
|
46
|
+
alt = _ref$alt === void 0 ? '' : _ref$alt,
|
|
47
|
+
src = _ref.src,
|
|
48
|
+
size = _ref.size,
|
|
49
|
+
testId = _ref.testId;
|
|
50
|
+
var _useState = (0, _react.useState)(false),
|
|
51
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
52
|
+
hasImageErrored = _useState2[0],
|
|
53
|
+
setHasImageErrored = _useState2[1];
|
|
54
|
+
|
|
55
|
+
// If src changes, reset state
|
|
56
|
+
(0, _react.useEffect)(function () {
|
|
57
|
+
setHasImageErrored(false);
|
|
58
|
+
}, [src]);
|
|
59
|
+
if (!src || hasImageErrored) {
|
|
60
|
+
return /*#__PURE__*/React.createElement(_fallback.FallbackAvatar, {
|
|
61
|
+
"aria-label": alt,
|
|
62
|
+
width: SIZES[size],
|
|
63
|
+
height: SIZES[size],
|
|
64
|
+
"data-testid": testId
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
return /*#__PURE__*/React.createElement(_avatar.AvatarContent, null, /*#__PURE__*/React.createElement("img", {
|
|
68
|
+
src: src,
|
|
69
|
+
alt: alt,
|
|
70
|
+
"data-testId": testId && "".concat(testId, "--image"),
|
|
71
|
+
onError: function onError() {
|
|
72
|
+
return setHasImageErrored(true);
|
|
73
|
+
},
|
|
74
|
+
className: (0, _runtime.ax)([avatarImageStyles.image, borderRadiusMap[size]])
|
|
75
|
+
}));
|
|
76
|
+
};
|
|
@@ -12,6 +12,7 @@ import TeamIcon from '@atlaskit/icon/glyph/people';
|
|
|
12
12
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
13
|
import { N0, N90 } from '@atlaskit/theme/colors';
|
|
14
14
|
import { FallbackAvatar } from './fallback';
|
|
15
|
+
import { TeamAvatarImage as TeamAvatarImageNext } from './teams-avatar-image-next';
|
|
15
16
|
const ICON_BACKGROUND = `var(--ds-icon-inverse, ${N0})`;
|
|
16
17
|
const ICON_COLOR = `var(--ds-icon-subtle, ${N90})`;
|
|
17
18
|
// used in a size calculation so can't be a token. Without this the avatar looks very squished
|
|
@@ -63,7 +64,7 @@ const avatarImageStyles = css({
|
|
|
63
64
|
*
|
|
64
65
|
* An avatar image is an internal component used to control the rendering phases of an image.
|
|
65
66
|
*/
|
|
66
|
-
export const
|
|
67
|
+
export const TeamAvatarImageLegacy = ({
|
|
67
68
|
alt = '',
|
|
68
69
|
src,
|
|
69
70
|
size,
|
|
@@ -102,4 +103,10 @@ export const TeamAvatarImage = ({
|
|
|
102
103
|
css: avatarImageStyles,
|
|
103
104
|
onError: () => setHasImageErrored(true)
|
|
104
105
|
}));
|
|
106
|
+
};
|
|
107
|
+
export const TeamAvatarImage = props => {
|
|
108
|
+
if (fg('team-avatar-radii')) {
|
|
109
|
+
return jsx(TeamAvatarImageNext, props);
|
|
110
|
+
}
|
|
111
|
+
return jsx(TeamAvatarImageLegacy, props);
|
|
105
112
|
};
|
package/dist/es2019/ui/teams-avatar/teams-avatar-image/teams-avatar-image-next/fallback/index.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/* index.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import "./index.compiled.css";
|
|
4
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { Box } from '@atlaskit/primitives/compiled';
|
|
7
|
+
const styles = {
|
|
8
|
+
wrapper: "_1e0c1txw _19pkv77o _2hwxv77o _otyrv77o _18u0v77o"
|
|
9
|
+
};
|
|
10
|
+
export function FallbackAvatar(props) {
|
|
11
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
12
|
+
xcss: styles.wrapper
|
|
13
|
+
}, /*#__PURE__*/React.createElement("svg", _extends({
|
|
14
|
+
width: "32",
|
|
15
|
+
height: "32",
|
|
16
|
+
viewBox: "0 0 32 32",
|
|
17
|
+
fill: "none",
|
|
18
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
19
|
+
}, props), /*#__PURE__*/React.createElement("g", {
|
|
20
|
+
clipPath: "url(#clip0_2032_552)"
|
|
21
|
+
}, /*#__PURE__*/React.createElement("rect", {
|
|
22
|
+
width: "32",
|
|
23
|
+
height: "32",
|
|
24
|
+
rx: "4",
|
|
25
|
+
fill: "#DCDFE4"
|
|
26
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
27
|
+
fillRule: "evenodd",
|
|
28
|
+
clipRule: "evenodd",
|
|
29
|
+
d: "M10.6666 12.6666C11.7712 12.6666 12.6666 11.7712 12.6666 10.6666C12.6666 9.56206 11.7712 8.66663 10.6666 8.66663C9.56202 8.66663 8.66658 9.56206 8.66658 10.6666C8.66658 11.7712 9.56202 12.6666 10.6666 12.6666ZM10.6666 14.6666C12.8757 14.6666 14.6666 12.8758 14.6666 10.6666C14.6666 8.45749 12.8757 6.66663 10.6666 6.66663C8.45745 6.66663 6.66658 8.45749 6.66658 10.6666C6.66658 12.8758 8.45745 14.6666 10.6666 14.6666Z",
|
|
30
|
+
fill: "#44546F"
|
|
31
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
32
|
+
fillRule: "evenodd",
|
|
33
|
+
clipRule: "evenodd",
|
|
34
|
+
d: "M21.3333 12.6666C22.4378 12.6666 23.3333 11.7712 23.3333 10.6666C23.3333 9.56206 22.4378 8.66663 21.3333 8.66663C20.2287 8.66663 19.3333 9.56206 19.3333 10.6666C19.3333 11.7712 20.2287 12.6666 21.3333 12.6666ZM21.3333 14.6666C23.5424 14.6666 25.3333 12.8758 25.3333 10.6666C25.3333 8.45749 23.5424 6.66663 21.3333 6.66663C19.1241 6.66663 17.3333 8.45749 17.3333 10.6666C17.3333 12.8758 19.1241 14.6666 21.3333 14.6666Z",
|
|
35
|
+
fill: "#44546F"
|
|
36
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
37
|
+
d: "M21.6666 16C24.4273 16.0004 26.6666 18.2385 26.6666 21V22.6666C26.6666 24.1394 25.4727 25.3333 23.9999 25.3333H20.135C18.0324 25.3333 16.1545 24.018 15.436 22.042L14.6843 19.9747C14.2531 18.7892 13.1264 18 11.8649 18H10.3333C8.6764 18 7.33325 19.3431 7.33325 21V22.6666C7.33325 23.0348 7.63173 23.3333 7.99992 23.3333H13.3333V25.3333H7.99992C6.52716 25.3333 5.33325 24.1394 5.33325 22.6666V21C5.33325 18.2385 7.57183 16 10.3333 16H11.8649C13.9674 16 15.8453 17.3153 16.5638 19.2913L17.3156 21.3585C17.7467 22.5441 18.8734 23.3333 20.135 23.3333H23.9999C24.3681 23.3333 24.6666 23.0348 24.6666 22.6666V21C24.6666 19.3437 23.3233 18.0004 21.6666 18H20.135V16H21.6666Z",
|
|
38
|
+
fill: "#44546F"
|
|
39
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
40
|
+
d: "M20.135 16C19.5972 16 18.7183 16.1407 18.0518 16.4564L18.908 18.2639C19.064 18.19 19.288 18.1205 19.537 18.0703C19.785 18.0203 20.0045 18 20.135 18V16Z",
|
|
41
|
+
fill: "#44546F"
|
|
42
|
+
})), /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("clipPath", {
|
|
43
|
+
id: "clip0_2032_552"
|
|
44
|
+
}, /*#__PURE__*/React.createElement("rect", {
|
|
45
|
+
width: "32",
|
|
46
|
+
height: "32",
|
|
47
|
+
rx: "4",
|
|
48
|
+
fill: "white"
|
|
49
|
+
})))));
|
|
50
|
+
}
|
package/dist/es2019/ui/teams-avatar/teams-avatar-image/teams-avatar-image-next/index.compiled.css
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
|
|
2
|
+
._2rko19bv{border-radius:10px}
|
|
3
|
+
._2rko1tcg{border-radius:24px}
|
|
4
|
+
._2rko1y44{border-radius:4px}
|
|
5
|
+
._2rkoftgi{border-radius:8px}
|
|
6
|
+
._2rkoi2wt{border-radius:6px}
|
|
7
|
+
._2rkozwfg{border-radius:2pc}._16jlkb7n{flex-grow:1}
|
|
8
|
+
._1bsb1osq{width:100%}
|
|
9
|
+
._1e0c1txw{display:flex}
|
|
10
|
+
._1o9zkb7n{flex-shrink:1}
|
|
11
|
+
._4t3i1osq{height:100%}
|
|
12
|
+
._i0dl1osq{flex-basis:100%}
|
|
@@ -0,0 +1,60 @@
|
|
|
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
|
+
import { useEffect, useState } from 'react';
|
|
6
|
+
import { AvatarContent } from '@atlaskit/avatar';
|
|
7
|
+
import { FallbackAvatar } from './fallback';
|
|
8
|
+
const avatarImageStyles = {
|
|
9
|
+
image: "_16jlkb7n _1o9zkb7n _i0dl1osq _1e0c1txw _1bsb1osq _4t3i1osq"
|
|
10
|
+
};
|
|
11
|
+
const SIZES = {
|
|
12
|
+
xsmall: 16,
|
|
13
|
+
small: 24,
|
|
14
|
+
medium: 32,
|
|
15
|
+
large: 40,
|
|
16
|
+
xlarge: 96,
|
|
17
|
+
xxlarge: 128
|
|
18
|
+
};
|
|
19
|
+
const borderRadiusMap = {
|
|
20
|
+
xsmall: "_2rko1y44",
|
|
21
|
+
small: "_2rkoi2wt",
|
|
22
|
+
medium: "_2rkoftgi",
|
|
23
|
+
large: "_2rko19bv",
|
|
24
|
+
xlarge: "_2rko1tcg",
|
|
25
|
+
xxlarge: "_2rkozwfg"
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* __Avatar image__
|
|
30
|
+
*
|
|
31
|
+
* An avatar image is an internal component used to control the rendering phases of an image.
|
|
32
|
+
*/
|
|
33
|
+
export const TeamAvatarImage = ({
|
|
34
|
+
alt = '',
|
|
35
|
+
src,
|
|
36
|
+
size,
|
|
37
|
+
testId
|
|
38
|
+
}) => {
|
|
39
|
+
const [hasImageErrored, setHasImageErrored] = useState(false);
|
|
40
|
+
|
|
41
|
+
// If src changes, reset state
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
setHasImageErrored(false);
|
|
44
|
+
}, [src]);
|
|
45
|
+
if (!src || hasImageErrored) {
|
|
46
|
+
return /*#__PURE__*/React.createElement(FallbackAvatar, {
|
|
47
|
+
"aria-label": alt,
|
|
48
|
+
width: SIZES[size],
|
|
49
|
+
height: SIZES[size],
|
|
50
|
+
"data-testid": testId
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
return /*#__PURE__*/React.createElement(AvatarContent, null, /*#__PURE__*/React.createElement("img", {
|
|
54
|
+
src: src,
|
|
55
|
+
alt: alt,
|
|
56
|
+
"data-testId": testId && `${testId}--image`,
|
|
57
|
+
onError: () => setHasImageErrored(true),
|
|
58
|
+
className: ax([avatarImageStyles.image, borderRadiusMap[size]])
|
|
59
|
+
}));
|
|
60
|
+
};
|
|
@@ -16,6 +16,7 @@ import TeamIcon from '@atlaskit/icon/glyph/people';
|
|
|
16
16
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
17
17
|
import { N0, N90 } from '@atlaskit/theme/colors';
|
|
18
18
|
import { FallbackAvatar } from './fallback';
|
|
19
|
+
import { TeamAvatarImage as TeamAvatarImageNext } from './teams-avatar-image-next';
|
|
19
20
|
var ICON_BACKGROUND = "var(--ds-icon-inverse, ".concat(N0, ")");
|
|
20
21
|
var ICON_COLOR = "var(--ds-icon-subtle, ".concat(N90, ")");
|
|
21
22
|
// used in a size calculation so can't be a token. Without this the avatar looks very squished
|
|
@@ -67,7 +68,7 @@ var avatarImageStyles = css({
|
|
|
67
68
|
*
|
|
68
69
|
* An avatar image is an internal component used to control the rendering phases of an image.
|
|
69
70
|
*/
|
|
70
|
-
export var
|
|
71
|
+
export var TeamAvatarImageLegacy = function TeamAvatarImageLegacy(_ref3) {
|
|
71
72
|
var _ref3$alt = _ref3.alt,
|
|
72
73
|
alt = _ref3$alt === void 0 ? '' : _ref3$alt,
|
|
73
74
|
src = _ref3.src,
|
|
@@ -111,4 +112,10 @@ export var TeamAvatarImage = function TeamAvatarImage(_ref3) {
|
|
|
111
112
|
return setHasImageErrored(true);
|
|
112
113
|
}
|
|
113
114
|
}));
|
|
115
|
+
};
|
|
116
|
+
export var TeamAvatarImage = function TeamAvatarImage(props) {
|
|
117
|
+
if (fg('team-avatar-radii')) {
|
|
118
|
+
return jsx(TeamAvatarImageNext, props);
|
|
119
|
+
}
|
|
120
|
+
return jsx(TeamAvatarImageLegacy, props);
|
|
114
121
|
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/* index.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import "./index.compiled.css";
|
|
4
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { Box } from '@atlaskit/primitives/compiled';
|
|
7
|
+
var styles = {
|
|
8
|
+
wrapper: "_1e0c1txw _19pkv77o _2hwxv77o _otyrv77o _18u0v77o"
|
|
9
|
+
};
|
|
10
|
+
export function FallbackAvatar(props) {
|
|
11
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
12
|
+
xcss: styles.wrapper
|
|
13
|
+
}, /*#__PURE__*/React.createElement("svg", _extends({
|
|
14
|
+
width: "32",
|
|
15
|
+
height: "32",
|
|
16
|
+
viewBox: "0 0 32 32",
|
|
17
|
+
fill: "none",
|
|
18
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
19
|
+
}, props), /*#__PURE__*/React.createElement("g", {
|
|
20
|
+
clipPath: "url(#clip0_2032_552)"
|
|
21
|
+
}, /*#__PURE__*/React.createElement("rect", {
|
|
22
|
+
width: "32",
|
|
23
|
+
height: "32",
|
|
24
|
+
rx: "4",
|
|
25
|
+
fill: "#DCDFE4"
|
|
26
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
27
|
+
fillRule: "evenodd",
|
|
28
|
+
clipRule: "evenodd",
|
|
29
|
+
d: "M10.6666 12.6666C11.7712 12.6666 12.6666 11.7712 12.6666 10.6666C12.6666 9.56206 11.7712 8.66663 10.6666 8.66663C9.56202 8.66663 8.66658 9.56206 8.66658 10.6666C8.66658 11.7712 9.56202 12.6666 10.6666 12.6666ZM10.6666 14.6666C12.8757 14.6666 14.6666 12.8758 14.6666 10.6666C14.6666 8.45749 12.8757 6.66663 10.6666 6.66663C8.45745 6.66663 6.66658 8.45749 6.66658 10.6666C6.66658 12.8758 8.45745 14.6666 10.6666 14.6666Z",
|
|
30
|
+
fill: "#44546F"
|
|
31
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
32
|
+
fillRule: "evenodd",
|
|
33
|
+
clipRule: "evenodd",
|
|
34
|
+
d: "M21.3333 12.6666C22.4378 12.6666 23.3333 11.7712 23.3333 10.6666C23.3333 9.56206 22.4378 8.66663 21.3333 8.66663C20.2287 8.66663 19.3333 9.56206 19.3333 10.6666C19.3333 11.7712 20.2287 12.6666 21.3333 12.6666ZM21.3333 14.6666C23.5424 14.6666 25.3333 12.8758 25.3333 10.6666C25.3333 8.45749 23.5424 6.66663 21.3333 6.66663C19.1241 6.66663 17.3333 8.45749 17.3333 10.6666C17.3333 12.8758 19.1241 14.6666 21.3333 14.6666Z",
|
|
35
|
+
fill: "#44546F"
|
|
36
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
37
|
+
d: "M21.6666 16C24.4273 16.0004 26.6666 18.2385 26.6666 21V22.6666C26.6666 24.1394 25.4727 25.3333 23.9999 25.3333H20.135C18.0324 25.3333 16.1545 24.018 15.436 22.042L14.6843 19.9747C14.2531 18.7892 13.1264 18 11.8649 18H10.3333C8.6764 18 7.33325 19.3431 7.33325 21V22.6666C7.33325 23.0348 7.63173 23.3333 7.99992 23.3333H13.3333V25.3333H7.99992C6.52716 25.3333 5.33325 24.1394 5.33325 22.6666V21C5.33325 18.2385 7.57183 16 10.3333 16H11.8649C13.9674 16 15.8453 17.3153 16.5638 19.2913L17.3156 21.3585C17.7467 22.5441 18.8734 23.3333 20.135 23.3333H23.9999C24.3681 23.3333 24.6666 23.0348 24.6666 22.6666V21C24.6666 19.3437 23.3233 18.0004 21.6666 18H20.135V16H21.6666Z",
|
|
38
|
+
fill: "#44546F"
|
|
39
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
40
|
+
d: "M20.135 16C19.5972 16 18.7183 16.1407 18.0518 16.4564L18.908 18.2639C19.064 18.19 19.288 18.1205 19.537 18.0703C19.785 18.0203 20.0045 18 20.135 18V16Z",
|
|
41
|
+
fill: "#44546F"
|
|
42
|
+
})), /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("clipPath", {
|
|
43
|
+
id: "clip0_2032_552"
|
|
44
|
+
}, /*#__PURE__*/React.createElement("rect", {
|
|
45
|
+
width: "32",
|
|
46
|
+
height: "32",
|
|
47
|
+
rx: "4",
|
|
48
|
+
fill: "white"
|
|
49
|
+
})))));
|
|
50
|
+
}
|
package/dist/esm/ui/teams-avatar/teams-avatar-image/teams-avatar-image-next/index.compiled.css
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
|
|
2
|
+
._2rko19bv{border-radius:10px}
|
|
3
|
+
._2rko1tcg{border-radius:24px}
|
|
4
|
+
._2rko1y44{border-radius:4px}
|
|
5
|
+
._2rkoftgi{border-radius:8px}
|
|
6
|
+
._2rkoi2wt{border-radius:6px}
|
|
7
|
+
._2rkozwfg{border-radius:2pc}._16jlkb7n{flex-grow:1}
|
|
8
|
+
._1bsb1osq{width:100%}
|
|
9
|
+
._1e0c1txw{display:flex}
|
|
10
|
+
._1o9zkb7n{flex-shrink:1}
|
|
11
|
+
._4t3i1osq{height:100%}
|
|
12
|
+
._i0dl1osq{flex-basis:100%}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/* index.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
import "./index.compiled.css";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
6
|
+
import { useEffect, useState } from 'react';
|
|
7
|
+
import { AvatarContent } from '@atlaskit/avatar';
|
|
8
|
+
import { FallbackAvatar } from './fallback';
|
|
9
|
+
var avatarImageStyles = {
|
|
10
|
+
image: "_16jlkb7n _1o9zkb7n _i0dl1osq _1e0c1txw _1bsb1osq _4t3i1osq"
|
|
11
|
+
};
|
|
12
|
+
var SIZES = {
|
|
13
|
+
xsmall: 16,
|
|
14
|
+
small: 24,
|
|
15
|
+
medium: 32,
|
|
16
|
+
large: 40,
|
|
17
|
+
xlarge: 96,
|
|
18
|
+
xxlarge: 128
|
|
19
|
+
};
|
|
20
|
+
var borderRadiusMap = {
|
|
21
|
+
xsmall: "_2rko1y44",
|
|
22
|
+
small: "_2rkoi2wt",
|
|
23
|
+
medium: "_2rkoftgi",
|
|
24
|
+
large: "_2rko19bv",
|
|
25
|
+
xlarge: "_2rko1tcg",
|
|
26
|
+
xxlarge: "_2rkozwfg"
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* __Avatar image__
|
|
31
|
+
*
|
|
32
|
+
* An avatar image is an internal component used to control the rendering phases of an image.
|
|
33
|
+
*/
|
|
34
|
+
export var TeamAvatarImage = function TeamAvatarImage(_ref) {
|
|
35
|
+
var _ref$alt = _ref.alt,
|
|
36
|
+
alt = _ref$alt === void 0 ? '' : _ref$alt,
|
|
37
|
+
src = _ref.src,
|
|
38
|
+
size = _ref.size,
|
|
39
|
+
testId = _ref.testId;
|
|
40
|
+
var _useState = useState(false),
|
|
41
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
42
|
+
hasImageErrored = _useState2[0],
|
|
43
|
+
setHasImageErrored = _useState2[1];
|
|
44
|
+
|
|
45
|
+
// If src changes, reset state
|
|
46
|
+
useEffect(function () {
|
|
47
|
+
setHasImageErrored(false);
|
|
48
|
+
}, [src]);
|
|
49
|
+
if (!src || hasImageErrored) {
|
|
50
|
+
return /*#__PURE__*/React.createElement(FallbackAvatar, {
|
|
51
|
+
"aria-label": alt,
|
|
52
|
+
width: SIZES[size],
|
|
53
|
+
height: SIZES[size],
|
|
54
|
+
"data-testid": testId
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return /*#__PURE__*/React.createElement(AvatarContent, null, /*#__PURE__*/React.createElement("img", {
|
|
58
|
+
src: src,
|
|
59
|
+
alt: alt,
|
|
60
|
+
"data-testId": testId && "".concat(testId, "--image"),
|
|
61
|
+
onError: function onError() {
|
|
62
|
+
return setHasImageErrored(true);
|
|
63
|
+
},
|
|
64
|
+
className: ax([avatarImageStyles.image, borderRadiusMap[size]])
|
|
65
|
+
}));
|
|
66
|
+
};
|
|
@@ -11,5 +11,6 @@ type AvatarImageProps = {
|
|
|
11
11
|
*
|
|
12
12
|
* An avatar image is an internal component used to control the rendering phases of an image.
|
|
13
13
|
*/
|
|
14
|
-
export declare const
|
|
14
|
+
export declare const TeamAvatarImageLegacy: ({ alt, src, size, testId }: AvatarImageProps) => jsx.JSX.Element;
|
|
15
|
+
export declare const TeamAvatarImage: (props: AvatarImageProps) => jsx.JSX.Element;
|
|
15
16
|
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
/// <reference types="react" />
|
|
6
|
+
import { type SizeType } from '@atlaskit/avatar';
|
|
7
|
+
type AvatarImageProps = {
|
|
8
|
+
size: SizeType;
|
|
9
|
+
alt?: string;
|
|
10
|
+
src?: string;
|
|
11
|
+
testId?: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* __Avatar image__
|
|
15
|
+
*
|
|
16
|
+
* An avatar image is an internal component used to control the rendering phases of an image.
|
|
17
|
+
*/
|
|
18
|
+
export declare const TeamAvatarImage: ({ alt, src, size, testId }: AvatarImageProps) => JSX.Element;
|
|
19
|
+
export {};
|
|
@@ -11,5 +11,6 @@ type AvatarImageProps = {
|
|
|
11
11
|
*
|
|
12
12
|
* An avatar image is an internal component used to control the rendering phases of an image.
|
|
13
13
|
*/
|
|
14
|
-
export declare const
|
|
14
|
+
export declare const TeamAvatarImageLegacy: ({ alt, src, size, testId }: AvatarImageProps) => jsx.JSX.Element;
|
|
15
|
+
export declare const TeamAvatarImage: (props: AvatarImageProps) => jsx.JSX.Element;
|
|
15
16
|
export {};
|
package/dist/types-ts4.5/ui/teams-avatar/teams-avatar-image/teams-avatar-image-next/index.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/**
|
|
3
|
+
* @jsxRuntime classic
|
|
4
|
+
* @jsx jsx
|
|
5
|
+
*/
|
|
6
|
+
import { type SizeType } from '@atlaskit/avatar';
|
|
7
|
+
type AvatarImageProps = {
|
|
8
|
+
size: SizeType;
|
|
9
|
+
alt?: string;
|
|
10
|
+
src?: string;
|
|
11
|
+
testId?: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* __Avatar image__
|
|
15
|
+
*
|
|
16
|
+
* An avatar image is an internal component used to control the rendering phases of an image.
|
|
17
|
+
*/
|
|
18
|
+
export declare const TeamAvatarImage: ({ alt, src, size, testId }: AvatarImageProps) => JSX.Element;
|
|
19
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/teams-avatar",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
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",
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"@atlaskit/theme": "^18.0.0",
|
|
44
44
|
"@atlaskit/tokens": "^4.5.0",
|
|
45
45
|
"@babel/runtime": "^7.0.0",
|
|
46
|
+
"@compiled/react": "^0.18.2",
|
|
46
47
|
"@emotion/react": "^11.7.1"
|
|
47
48
|
},
|
|
48
49
|
"peerDependencies": {
|
|
@@ -100,6 +101,9 @@
|
|
|
100
101
|
"platform-feature-flags": {
|
|
101
102
|
"enable-team-avatar-switch": {
|
|
102
103
|
"type": "boolean"
|
|
104
|
+
},
|
|
105
|
+
"team-avatar-radii": {
|
|
106
|
+
"type": "boolean"
|
|
103
107
|
}
|
|
104
108
|
}
|
|
105
109
|
}
|