@atlaskit/avatar 20.5.9 → 21.0.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.
@@ -3,5 +3,6 @@
3
3
  "main": "../dist/cjs/entry-points/avatar.js",
4
4
  "module": "../dist/esm/entry-points/avatar.js",
5
5
  "module:es2019": "../dist/es2019/entry-points/avatar.js",
6
+ "sideEffects": false,
6
7
  "types": "../dist/types/entry-points/avatar.d.ts"
7
8
  }
@@ -3,5 +3,6 @@
3
3
  "main": "../dist/cjs/entry-points/avatar-item.js",
4
4
  "module": "../dist/esm/entry-points/avatar-item.js",
5
5
  "module:es2019": "../dist/es2019/entry-points/avatar-item.js",
6
+ "sideEffects": false,
6
7
  "types": "../dist/types/entry-points/avatar-item.d.ts"
7
8
  }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # @atlaskit/avatar
2
2
 
3
+ ## 21.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`8d4228767b0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8d4228767b0) - Upgrade Typescript from `4.2.4` to `4.3.5`.
8
+
9
+ ## 21.0.0
10
+
11
+ ### Major Changes
12
+
13
+ - [`92bb02bc46b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/92bb02bc46b) - [ux] There are **no code changes required** to consume this major, but you should be aware that internal changes have been made to how `@atlaskit/avatar` loads images.
14
+
15
+ Before, the image loading behaviour was written in JS. Now, it leans on a standard HTML `img` tag if you provide a `src` prop, allowing it to rely on the browser to optimise the loading. These changes should result in faster image loading and an improved server-side rendering story.
16
+
17
+ In this version, the **breaking change is that you will no longer see a fallback icon while the image is loading**. We have intentionally removed this loading behaviour as it is no longer consistent with our native `img` behaviour-first approach, and was a source of SSR bugs. Avatar images will load either instantly from the cache, or very fast from a CDN. In the edge cases where there is an error with the image src provided, we will still fall back to a default icon.
18
+
19
+ ### Patch Changes
20
+
21
+ - [`be23a6d8ee1`](https://bitbucket.org/atlassian/atlassian-frontend/commits/be23a6d8ee1) - [ux] Updates color tokens used to be more semantically accurate
22
+
23
+ ## 20.5.10
24
+
25
+ ### Patch Changes
26
+
27
+ - Updated dependencies
28
+
3
29
  ## 20.5.9
4
30
 
5
31
  ### Patch Changes
@@ -3,5 +3,6 @@
3
3
  "main": "../dist/cjs/entry-points/presence.js",
4
4
  "module": "../dist/esm/entry-points/presence.js",
5
5
  "module:es2019": "../dist/es2019/entry-points/presence.js",
6
+ "sideEffects": false,
6
7
  "types": "../dist/types/entry-points/presence.d.ts"
7
8
  }
@@ -3,5 +3,6 @@
3
3
  "main": "../dist/cjs/entry-points/skeleton.js",
4
4
  "module": "../dist/esm/entry-points/skeleton.js",
5
5
  "module:es2019": "../dist/es2019/entry-points/skeleton.js",
6
+ "sideEffects": false,
6
7
  "types": "../dist/types/entry-points/skeleton.d.ts"
7
8
  }
@@ -3,5 +3,6 @@
3
3
  "main": "../dist/cjs/entry-points/status.js",
4
4
  "module": "../dist/esm/entry-points/status.js",
5
5
  "module:es2019": "../dist/es2019/entry-points/status.js",
6
+ "sideEffects": false,
6
7
  "types": "../dist/types/entry-points/status.d.ts"
7
8
  }
@@ -38,7 +38,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
38
38
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
39
39
 
40
40
  var packageName = "@atlaskit/avatar";
41
- var packageVersion = "20.5.9";
41
+ var packageVersion = "21.0.1";
42
42
 
43
43
  var getStyles = function getStyles(css, _ref) {
44
44
  var size = _ref.size,
@@ -50,7 +50,7 @@ var getStyles = function getStyles(css, _ref) {
50
50
  isInteractive = _ref.isInteractive,
51
51
  isDisabled = _ref.isDisabled;
52
52
  return (//eslint-disable-next-line @repo/internal/react/no-css-string-literals
53
- css(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n height: ", "px;\n width: ", "px;\n align-items: stretch;\n background-color: ", ";\n border-radius: ", ";\n box-sizing: content-box;\n cursor: inherit;\n display: flex;\n flex-direction: column;\n justify-content: center;\n outline: none;\n overflow: hidden;\n position: static;\n transform: translateZ(0);\n transition: transform 200ms, opacity 200ms;\n box-shadow: 0 0 0 ", "px ", ";\n border: none;\n margin: ", "px;\n padding: 0;\n\n /* Added font-size and font-family styles to fix alignment issue in firefox for interactive button avatar */\n font-size: inherit;\n font-family: inherit;\n\n &::-moz-focus-inner {\n border: 0;\n margin: 0;\n padding: 0;\n }\n\n &::after {\n background-color: transparent;\n bottom: 0px;\n\n /* Added border-radius style to fix hover issue in safari */\n border-radius: ", ";\n content: ' ';\n left: 0px;\n opacity: 0;\n pointer-events: none;\n position: absolute;\n right: 0px;\n top: 0px;\n transition: opacity 200ms;\n width: 100%;\n }\n\n ", "\n\n ", "\n\n ", "\n "])), size, size, borderColor, appearance === 'circle' ? '50%' : "".concat(radius, "px"), _constants.BORDER_WIDTH, borderColor, _constants.BORDER_WIDTH, appearance === 'circle' ? '50%' : "".concat(radius, "px"), stackIndex && "position: relative;", isInteractive && "\n cursor: pointer;\n\n :focus {\n outline: none;\n box-shadow: 0 0 0 ".concat(_constants.BORDER_WIDTH, "px ").concat("var(--ds-border-focused, ".concat(_colors.B300, ")"), "\n }\n\n :hover {\n &::after {\n background-color: ").concat("var(--ds-interaction-hovered, ".concat(_colors.N70A, ")"), ";\n opacity: 1;\n }\n }\n\n :active {\n &::after {\n background-color: ").concat("var(--ds-interaction-pressed, ".concat(_colors.N70A, ")"), ";\n opacity: 1;\n }\n }\n\n :active {\n transform: scale(").concat(_constants.ACTIVE_SCALE_FACTOR, ");\n }\n\n @media screen and (forced-colors: active) {\n &:focus-visible {\n outline: 1px solid\n }\n }\n "), isDisabled && "\n cursor: not-allowed;\n\n &::after {\n opacity: 0.7;\n pointer-events: none;\n background-color: ".concat("var(--ds-surface, ".concat(_colors.N0, ")"), ";\n }\n "))
53
+ css(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n height: ", "px;\n width: ", "px;\n align-items: stretch;\n background-color: ", ";\n border-radius: ", ";\n box-sizing: content-box;\n cursor: inherit;\n display: flex;\n flex-direction: column;\n justify-content: center;\n outline: none;\n overflow: hidden;\n position: static;\n transform: translateZ(0);\n transition: transform 200ms, opacity 200ms;\n box-shadow: 0 0 0 ", "px ", ";\n border: none;\n margin: ", "px;\n padding: 0;\n\n /* Added font-size and font-family styles to fix alignment issue in firefox for interactive button avatar */\n font-size: inherit;\n font-family: inherit;\n\n &::-moz-focus-inner {\n border: 0;\n margin: 0;\n padding: 0;\n }\n\n &::after {\n background-color: transparent;\n bottom: 0px;\n\n /* Added border-radius style to fix hover issue in safari */\n border-radius: ", ";\n content: ' ';\n left: 0px;\n opacity: 0;\n pointer-events: none;\n position: absolute;\n right: 0px;\n top: 0px;\n transition: opacity 200ms;\n width: 100%;\n }\n\n ", "\n\n ", "\n\n ", "\n "])), size, size, borderColor, appearance === 'circle' ? '50%' : "".concat(radius, "px"), _constants.BORDER_WIDTH, borderColor, _constants.BORDER_WIDTH, appearance === 'circle' ? '50%' : "".concat(radius, "px"), stackIndex && "position: relative;", isInteractive && "\n cursor: pointer;\n\n :focus {\n outline: none;\n box-shadow: 0 0 0 ".concat(_constants.BORDER_WIDTH, "px ", "var(--ds-border-focused, ".concat(_colors.B300, ")"), "\n }\n\n :hover {\n &::after {\n background-color: ", "var(--ds-interaction-hovered, ".concat(_colors.N70A, ")"), ";\n opacity: 1;\n }\n }\n\n :active {\n &::after {\n background-color: ", "var(--ds-interaction-pressed, ".concat(_colors.N70A, ")"), ";\n opacity: 1;\n }\n }\n\n :active {\n transform: scale(").concat(_constants.ACTIVE_SCALE_FACTOR, ");\n }\n\n @media screen and (forced-colors: active) {\n &:focus-visible {\n outline: 1px solid\n }\n }\n "), isDisabled && "\n cursor: not-allowed;\n\n &::after {\n opacity: 0.7;\n pointer-events: none;\n background-color: ".concat("var(--ds-surface, ".concat(_colors.N0, ")"), ";\n }\n "))
54
54
  );
55
55
  };
56
56
  /**
@@ -23,25 +23,21 @@ var _constants = require("./constants");
23
23
 
24
24
  /** @jsx jsx */
25
25
  // eslint-disable-next-line @repo/internal/fs/filename-pattern-match
26
- var ICON_BACKGROUND = "var(--ds-text-inverse, ".concat((0, _colors.background)(), ")");
26
+ var ICON_BACKGROUND = "var(--ds-icon-inverse, ".concat((0, _colors.background)(), ")");
27
27
  exports.ICON_BACKGROUND = ICON_BACKGROUND;
28
- var ICON_COLOR = "var(--ds-text-subtlest, ".concat(_colors.N90, ")");
28
+ var ICON_COLOR = "var(--ds-icon-subtle, ".concat(_colors.N90, ")");
29
29
  exports.ICON_COLOR = ICON_COLOR;
30
- var avatarImageStyles = (0, _core.css)({
30
+ var avatarDefaultIconStyles = (0, _core.css)({
31
31
  display: 'block',
32
32
  width: '100%',
33
33
  height: '100%',
34
34
  backgroundColor: ICON_COLOR
35
35
  });
36
- var loadingImageStyles = (0, _core.css)({
36
+ var avatarImageStyles = (0, _core.css)({
37
37
  display: 'flex',
38
38
  width: '100%',
39
39
  height: '100%',
40
- flex: '1 1 100%',
41
- backgroundColor: 'transparent',
42
- backgroundPosition: 'center',
43
- backgroundRepeat: 'no-repeat',
44
- backgroundSize: 'cover'
40
+ flex: '1 1 100%'
45
41
  });
46
42
  /**
47
43
  * __Avatar image__
@@ -57,47 +53,20 @@ var AvatarImage = function AvatarImage(_ref) {
57
53
  size = _ref.size,
58
54
  testId = _ref.testId;
59
55
 
60
- var _useState = (0, _react.useState)('initial'),
56
+ var _useState = (0, _react.useState)(false),
61
57
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
62
- phase = _useState2[0],
63
- setPhase = _useState2[1];
64
-
65
- var borderRadius = appearance === 'circle' ? '50%' : "".concat(_constants.AVATAR_RADIUS[size], "px");
66
- var image = (0, _react.useMemo)(function () {
67
- if (src) {
68
- setPhase('loading');
69
- var img = new Image();
70
-
71
- img.onload = function () {
72
- return setPhase('loaded');
73
- };
74
-
75
- img.onerror = function () {
76
- return setPhase('error');
77
- };
58
+ hasImageErrored = _useState2[0],
59
+ setHasImageErrored = _useState2[1];
78
60
 
79
- img.src = src;
80
- return img;
81
- }
61
+ var borderRadius = appearance === 'circle' ? '50%' : "".concat(_constants.AVATAR_RADIUS[size], "px"); // If src changes, reset state
82
62
 
83
- return null;
84
- }, [src]);
85
63
  (0, _react.useEffect)(function () {
86
- return function () {
87
- if (image) {
88
- image.onload = function () {};
89
-
90
- image.onerror = function () {};
91
- }
92
- };
93
- }, [image]);
94
- var imageHasLoadedAsync = src && phase !== 'loading' && phase !== 'error';
95
- var imageHasLoadedSync = src && phase === 'loading' && (image === null || image === void 0 ? void 0 : image.complete);
96
- var imageHasLoaded = imageHasLoadedAsync || imageHasLoadedSync;
97
-
98
- if (!imageHasLoaded) {
64
+ setHasImageErrored(false);
65
+ }, [src]);
66
+
67
+ if (!src || hasImageErrored) {
99
68
  return (0, _core.jsx)("span", {
100
- css: [avatarImageStyles, // TODO: These dynamic SVG styles can't be set in 'style'. On a refactor, use a css custom property to pass down the size
69
+ css: [avatarDefaultIconStyles, // TODO: These dynamic SVG styles can't be set in 'style'. On a refactor, use a css custom property to pass down the size
101
70
  // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
102
71
  {
103
72
  '& svg': {
@@ -118,15 +87,17 @@ var AvatarImage = function AvatarImage(_ref) {
118
87
  }));
119
88
  }
120
89
 
121
- return (0, _core.jsx)("span", {
122
- css: loadingImageStyles,
90
+ return (0, _core.jsx)("img", {
91
+ src: src,
92
+ alt: alt,
93
+ "data-testid": testId && "".concat(testId, "--image"),
94
+ css: avatarImageStyles,
123
95
  style: {
124
- backgroundImage: "url(\"".concat(src, "\")"),
125
96
  borderRadius: borderRadius
126
97
  },
127
- role: alt ? 'img' : undefined,
128
- "aria-label": alt || undefined,
129
- "data-testid": testId && "".concat(testId, "--image")
98
+ onError: function onError() {
99
+ return setHasImageErrored(true);
100
+ }
130
101
  });
131
102
  };
132
103
 
@@ -44,7 +44,7 @@ var getStyles = function getStyles(css, _ref) {
44
44
  isInteractive = _ref.isInteractive,
45
45
  isDisabled = _ref.isDisabled;
46
46
  return (//eslint-disable-next-line @repo/internal/react/no-css-string-literals
47
- css(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n align-items: center;\n background-color: ", ";\n border-radius: ", "px;\n border: ", "px solid transparent;\n box-sizing: border-box;\n color: inherit;\n display: flex;\n font-size: inherit;\n font-style: normal;\n font-weight: normal;\n line-height: 1;\n outline: none;\n margin: 0;\n padding: ", "px;\n text-align: left;\n text-decoration: none;\n width: 100%;\n\n ", "\n\n ", "\n "])), backgroundColor, (0, _constants.borderRadius)(), _constants2.BORDER_WIDTH, (0, _constants.gridSize)() / 2, isInteractive && "\n :hover {\n background-color: ".concat("var(--ds-background-neutral-subtle-hovered, ".concat((0, _colors.backgroundHover)(), ")"), ";\n cursor: pointer;\n text-decoration: none;\n }\n\n :focus {\n outline: none;\n border-color: ").concat("var(--ds-border-focused, ".concat(_colors.B200, ")"), ";\n }\n\n :active {\n background-color: ").concat("var(--ds-background-neutral-subtle-pressed, ".concat((0, _colors.backgroundActive)(), ")"), ";\n }\n "), isDisabled && "\n cursor: not-allowed;\n opacity: 0.5;\n pointer-events: none;\n ")
47
+ css(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n align-items: center;\n background-color: ", ";\n border-radius: ", "px;\n border: ", "px solid transparent;\n box-sizing: border-box;\n color: inherit;\n display: flex;\n font-size: inherit;\n font-style: normal;\n font-weight: normal;\n line-height: 1;\n outline: none;\n margin: 0;\n padding: ", "px;\n text-align: left;\n text-decoration: none;\n width: 100%;\n\n ", "\n\n ", "\n "])), backgroundColor, (0, _constants.borderRadius)(), _constants2.BORDER_WIDTH, (0, _constants.gridSize)() / 2, isInteractive && "\n :hover {\n background-color: ".concat("var(--ds-background-neutral-subtle-hovered, ".concat((0, _colors.backgroundHover)(), ")"), ";\n cursor: pointer;\n text-decoration: none;\n }\n\n :focus {\n outline: none;\n border-color: ", "var(--ds-border-focused, ".concat(_colors.B200, ")"), ";\n }\n\n :active {\n background-color: ", "var(--ds-background-neutral-subtle-pressed, ".concat((0, _colors.backgroundActive)(), ")"), ";\n }\n "), isDisabled && "\n cursor: not-allowed;\n opacity: 0.5;\n pointer-events: none;\n ")
48
48
  );
49
49
  };
50
50
  /**
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/avatar",
3
- "version": "20.5.9",
3
+ "version": "21.0.1",
4
4
  "sideEffects": false
5
5
  }
@@ -10,7 +10,7 @@ import { PresenceWrapper } from './Presence';
10
10
  import { StatusWrapper } from './Status';
11
11
  import { getButtonProps, getCustomElement, getLinkProps } from './utilities';
12
12
  const packageName = "@atlaskit/avatar";
13
- const packageVersion = "20.5.9";
13
+ const packageVersion = "21.0.1";
14
14
 
15
15
  const getStyles = (css, {
16
16
  size,
@@ -1,28 +1,24 @@
1
1
  /** @jsx jsx */
2
2
  // eslint-disable-next-line @repo/internal/fs/filename-pattern-match
3
- import { useEffect, useMemo, useState } from 'react';
3
+ import { useEffect, useState } from 'react';
4
4
  import { css, jsx } from '@emotion/core';
5
5
  import PersonIcon from '@atlaskit/icon/glyph/person';
6
6
  import ShipIcon from '@atlaskit/icon/glyph/ship';
7
7
  import { background, N90 } from '@atlaskit/theme/colors';
8
8
  import { AVATAR_RADIUS, AVATAR_SIZES } from './constants';
9
- export const ICON_BACKGROUND = `var(--ds-text-inverse, ${background()})`;
10
- export const ICON_COLOR = `var(--ds-text-subtlest, ${N90})`;
11
- const avatarImageStyles = css({
9
+ export const ICON_BACKGROUND = `var(--ds-icon-inverse, ${background()})`;
10
+ export const ICON_COLOR = `var(--ds-icon-subtle, ${N90})`;
11
+ const avatarDefaultIconStyles = css({
12
12
  display: 'block',
13
13
  width: '100%',
14
14
  height: '100%',
15
15
  backgroundColor: ICON_COLOR
16
16
  });
17
- const loadingImageStyles = css({
17
+ const avatarImageStyles = css({
18
18
  display: 'flex',
19
19
  width: '100%',
20
20
  height: '100%',
21
- flex: '1 1 100%',
22
- backgroundColor: 'transparent',
23
- backgroundPosition: 'center',
24
- backgroundRepeat: 'no-repeat',
25
- backgroundSize: 'cover'
21
+ flex: '1 1 100%'
26
22
  });
27
23
  /**
28
24
  * __Avatar image__
@@ -37,39 +33,16 @@ const AvatarImage = ({
37
33
  size,
38
34
  testId
39
35
  }) => {
40
- const [phase, setPhase] = useState('initial');
41
- const borderRadius = appearance === 'circle' ? '50%' : `${AVATAR_RADIUS[size]}px`;
42
- const image = useMemo(() => {
43
- if (src) {
44
- setPhase('loading');
45
- const img = new Image();
46
-
47
- img.onload = () => setPhase('loaded');
48
-
49
- img.onerror = () => setPhase('error');
36
+ const [hasImageErrored, setHasImageErrored] = useState(false);
37
+ const borderRadius = appearance === 'circle' ? '50%' : `${AVATAR_RADIUS[size]}px`; // If src changes, reset state
50
38
 
51
- img.src = src;
52
- return img;
53
- }
54
-
55
- return null;
56
- }, [src]);
57
39
  useEffect(() => {
58
- return () => {
59
- if (image) {
60
- image.onload = () => {};
61
-
62
- image.onerror = () => {};
63
- }
64
- };
65
- }, [image]);
66
- const imageHasLoadedAsync = src && phase !== 'loading' && phase !== 'error';
67
- const imageHasLoadedSync = src && phase === 'loading' && (image === null || image === void 0 ? void 0 : image.complete);
68
- const imageHasLoaded = imageHasLoadedAsync || imageHasLoadedSync;
40
+ setHasImageErrored(false);
41
+ }, [src]);
69
42
 
70
- if (!imageHasLoaded) {
43
+ if (!src || hasImageErrored) {
71
44
  return jsx("span", {
72
- css: [avatarImageStyles, // TODO: These dynamic SVG styles can't be set in 'style'. On a refactor, use a css custom property to pass down the size
45
+ css: [avatarDefaultIconStyles, // TODO: These dynamic SVG styles can't be set in 'style'. On a refactor, use a css custom property to pass down the size
73
46
  // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
74
47
  {
75
48
  '& svg': {
@@ -90,15 +63,15 @@ const AvatarImage = ({
90
63
  }));
91
64
  }
92
65
 
93
- return jsx("span", {
94
- css: loadingImageStyles,
66
+ return jsx("img", {
67
+ src: src,
68
+ alt: alt,
69
+ "data-testid": testId && `${testId}--image`,
70
+ css: avatarImageStyles,
95
71
  style: {
96
- backgroundImage: `url("${src}")`,
97
72
  borderRadius: borderRadius
98
73
  },
99
- role: alt ? 'img' : undefined,
100
- "aria-label": alt || undefined,
101
- "data-testid": testId && `${testId}--image`
74
+ onError: () => setHasImageErrored(true)
102
75
  });
103
76
  };
104
77
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/avatar",
3
- "version": "20.5.9",
3
+ "version": "21.0.1",
4
4
  "sideEffects": false
5
5
  }
@@ -20,7 +20,7 @@ import { PresenceWrapper } from './Presence';
20
20
  import { StatusWrapper } from './Status';
21
21
  import { getButtonProps, getCustomElement, getLinkProps } from './utilities';
22
22
  var packageName = "@atlaskit/avatar";
23
- var packageVersion = "20.5.9";
23
+ var packageVersion = "21.0.1";
24
24
 
25
25
  var getStyles = function getStyles(css, _ref) {
26
26
  var size = _ref.size,
@@ -32,7 +32,7 @@ var getStyles = function getStyles(css, _ref) {
32
32
  isInteractive = _ref.isInteractive,
33
33
  isDisabled = _ref.isDisabled;
34
34
  return (//eslint-disable-next-line @repo/internal/react/no-css-string-literals
35
- css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n height: ", "px;\n width: ", "px;\n align-items: stretch;\n background-color: ", ";\n border-radius: ", ";\n box-sizing: content-box;\n cursor: inherit;\n display: flex;\n flex-direction: column;\n justify-content: center;\n outline: none;\n overflow: hidden;\n position: static;\n transform: translateZ(0);\n transition: transform 200ms, opacity 200ms;\n box-shadow: 0 0 0 ", "px ", ";\n border: none;\n margin: ", "px;\n padding: 0;\n\n /* Added font-size and font-family styles to fix alignment issue in firefox for interactive button avatar */\n font-size: inherit;\n font-family: inherit;\n\n &::-moz-focus-inner {\n border: 0;\n margin: 0;\n padding: 0;\n }\n\n &::after {\n background-color: transparent;\n bottom: 0px;\n\n /* Added border-radius style to fix hover issue in safari */\n border-radius: ", ";\n content: ' ';\n left: 0px;\n opacity: 0;\n pointer-events: none;\n position: absolute;\n right: 0px;\n top: 0px;\n transition: opacity 200ms;\n width: 100%;\n }\n\n ", "\n\n ", "\n\n ", "\n "])), size, size, borderColor, appearance === 'circle' ? '50%' : "".concat(radius, "px"), BORDER_WIDTH, borderColor, BORDER_WIDTH, appearance === 'circle' ? '50%' : "".concat(radius, "px"), stackIndex && "position: relative;", isInteractive && "\n cursor: pointer;\n\n :focus {\n outline: none;\n box-shadow: 0 0 0 ".concat(BORDER_WIDTH, "px ").concat("var(--ds-border-focused, ".concat(B300, ")"), "\n }\n\n :hover {\n &::after {\n background-color: ").concat("var(--ds-interaction-hovered, ".concat(N70A, ")"), ";\n opacity: 1;\n }\n }\n\n :active {\n &::after {\n background-color: ").concat("var(--ds-interaction-pressed, ".concat(N70A, ")"), ";\n opacity: 1;\n }\n }\n\n :active {\n transform: scale(").concat(ACTIVE_SCALE_FACTOR, ");\n }\n\n @media screen and (forced-colors: active) {\n &:focus-visible {\n outline: 1px solid\n }\n }\n "), isDisabled && "\n cursor: not-allowed;\n\n &::after {\n opacity: 0.7;\n pointer-events: none;\n background-color: ".concat("var(--ds-surface, ".concat(N0, ")"), ";\n }\n "))
35
+ css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n height: ", "px;\n width: ", "px;\n align-items: stretch;\n background-color: ", ";\n border-radius: ", ";\n box-sizing: content-box;\n cursor: inherit;\n display: flex;\n flex-direction: column;\n justify-content: center;\n outline: none;\n overflow: hidden;\n position: static;\n transform: translateZ(0);\n transition: transform 200ms, opacity 200ms;\n box-shadow: 0 0 0 ", "px ", ";\n border: none;\n margin: ", "px;\n padding: 0;\n\n /* Added font-size and font-family styles to fix alignment issue in firefox for interactive button avatar */\n font-size: inherit;\n font-family: inherit;\n\n &::-moz-focus-inner {\n border: 0;\n margin: 0;\n padding: 0;\n }\n\n &::after {\n background-color: transparent;\n bottom: 0px;\n\n /* Added border-radius style to fix hover issue in safari */\n border-radius: ", ";\n content: ' ';\n left: 0px;\n opacity: 0;\n pointer-events: none;\n position: absolute;\n right: 0px;\n top: 0px;\n transition: opacity 200ms;\n width: 100%;\n }\n\n ", "\n\n ", "\n\n ", "\n "])), size, size, borderColor, appearance === 'circle' ? '50%' : "".concat(radius, "px"), BORDER_WIDTH, borderColor, BORDER_WIDTH, appearance === 'circle' ? '50%' : "".concat(radius, "px"), stackIndex && "position: relative;", isInteractive && "\n cursor: pointer;\n\n :focus {\n outline: none;\n box-shadow: 0 0 0 ".concat(BORDER_WIDTH, "px ", "var(--ds-border-focused, ".concat(B300, ")"), "\n }\n\n :hover {\n &::after {\n background-color: ", "var(--ds-interaction-hovered, ".concat(N70A, ")"), ";\n opacity: 1;\n }\n }\n\n :active {\n &::after {\n background-color: ", "var(--ds-interaction-pressed, ".concat(N70A, ")"), ";\n opacity: 1;\n }\n }\n\n :active {\n transform: scale(").concat(ACTIVE_SCALE_FACTOR, ");\n }\n\n @media screen and (forced-colors: active) {\n &:focus-visible {\n outline: 1px solid\n }\n }\n "), isDisabled && "\n cursor: not-allowed;\n\n &::after {\n opacity: 0.7;\n pointer-events: none;\n background-color: ".concat("var(--ds-surface, ".concat(N0, ")"), ";\n }\n "))
36
36
  );
37
37
  };
38
38
  /**
@@ -2,29 +2,25 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
 
3
3
  /** @jsx jsx */
4
4
  // eslint-disable-next-line @repo/internal/fs/filename-pattern-match
5
- import { useEffect, useMemo, useState } from 'react';
5
+ import { useEffect, useState } from 'react';
6
6
  import { css, jsx } from '@emotion/core';
7
7
  import PersonIcon from '@atlaskit/icon/glyph/person';
8
8
  import ShipIcon from '@atlaskit/icon/glyph/ship';
9
9
  import { background, N90 } from '@atlaskit/theme/colors';
10
10
  import { AVATAR_RADIUS, AVATAR_SIZES } from './constants';
11
- export var ICON_BACKGROUND = "var(--ds-text-inverse, ".concat(background(), ")");
12
- export var ICON_COLOR = "var(--ds-text-subtlest, ".concat(N90, ")");
13
- var avatarImageStyles = css({
11
+ export var ICON_BACKGROUND = "var(--ds-icon-inverse, ".concat(background(), ")");
12
+ export var ICON_COLOR = "var(--ds-icon-subtle, ".concat(N90, ")");
13
+ var avatarDefaultIconStyles = css({
14
14
  display: 'block',
15
15
  width: '100%',
16
16
  height: '100%',
17
17
  backgroundColor: ICON_COLOR
18
18
  });
19
- var loadingImageStyles = css({
19
+ var avatarImageStyles = css({
20
20
  display: 'flex',
21
21
  width: '100%',
22
22
  height: '100%',
23
- flex: '1 1 100%',
24
- backgroundColor: 'transparent',
25
- backgroundPosition: 'center',
26
- backgroundRepeat: 'no-repeat',
27
- backgroundSize: 'cover'
23
+ flex: '1 1 100%'
28
24
  });
29
25
  /**
30
26
  * __Avatar image__
@@ -40,47 +36,20 @@ var AvatarImage = function AvatarImage(_ref) {
40
36
  size = _ref.size,
41
37
  testId = _ref.testId;
42
38
 
43
- var _useState = useState('initial'),
39
+ var _useState = useState(false),
44
40
  _useState2 = _slicedToArray(_useState, 2),
45
- phase = _useState2[0],
46
- setPhase = _useState2[1];
47
-
48
- var borderRadius = appearance === 'circle' ? '50%' : "".concat(AVATAR_RADIUS[size], "px");
49
- var image = useMemo(function () {
50
- if (src) {
51
- setPhase('loading');
52
- var img = new Image();
53
-
54
- img.onload = function () {
55
- return setPhase('loaded');
56
- };
57
-
58
- img.onerror = function () {
59
- return setPhase('error');
60
- };
41
+ hasImageErrored = _useState2[0],
42
+ setHasImageErrored = _useState2[1];
61
43
 
62
- img.src = src;
63
- return img;
64
- }
44
+ var borderRadius = appearance === 'circle' ? '50%' : "".concat(AVATAR_RADIUS[size], "px"); // If src changes, reset state
65
45
 
66
- return null;
67
- }, [src]);
68
46
  useEffect(function () {
69
- return function () {
70
- if (image) {
71
- image.onload = function () {};
72
-
73
- image.onerror = function () {};
74
- }
75
- };
76
- }, [image]);
77
- var imageHasLoadedAsync = src && phase !== 'loading' && phase !== 'error';
78
- var imageHasLoadedSync = src && phase === 'loading' && (image === null || image === void 0 ? void 0 : image.complete);
79
- var imageHasLoaded = imageHasLoadedAsync || imageHasLoadedSync;
47
+ setHasImageErrored(false);
48
+ }, [src]);
80
49
 
81
- if (!imageHasLoaded) {
50
+ if (!src || hasImageErrored) {
82
51
  return jsx("span", {
83
- css: [avatarImageStyles, // TODO: These dynamic SVG styles can't be set in 'style'. On a refactor, use a css custom property to pass down the size
52
+ css: [avatarDefaultIconStyles, // TODO: These dynamic SVG styles can't be set in 'style'. On a refactor, use a css custom property to pass down the size
84
53
  // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
85
54
  {
86
55
  '& svg': {
@@ -101,15 +70,17 @@ var AvatarImage = function AvatarImage(_ref) {
101
70
  }));
102
71
  }
103
72
 
104
- return jsx("span", {
105
- css: loadingImageStyles,
73
+ return jsx("img", {
74
+ src: src,
75
+ alt: alt,
76
+ "data-testid": testId && "".concat(testId, "--image"),
77
+ css: avatarImageStyles,
106
78
  style: {
107
- backgroundImage: "url(\"".concat(src, "\")"),
108
79
  borderRadius: borderRadius
109
80
  },
110
- role: alt ? 'img' : undefined,
111
- "aria-label": alt || undefined,
112
- "data-testid": testId && "".concat(testId, "--image")
81
+ onError: function onError() {
82
+ return setHasImageErrored(true);
83
+ }
113
84
  });
114
85
  };
115
86
 
@@ -29,7 +29,7 @@ var getStyles = function getStyles(css, _ref) {
29
29
  isInteractive = _ref.isInteractive,
30
30
  isDisabled = _ref.isDisabled;
31
31
  return (//eslint-disable-next-line @repo/internal/react/no-css-string-literals
32
- css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n align-items: center;\n background-color: ", ";\n border-radius: ", "px;\n border: ", "px solid transparent;\n box-sizing: border-box;\n color: inherit;\n display: flex;\n font-size: inherit;\n font-style: normal;\n font-weight: normal;\n line-height: 1;\n outline: none;\n margin: 0;\n padding: ", "px;\n text-align: left;\n text-decoration: none;\n width: 100%;\n\n ", "\n\n ", "\n "])), backgroundColor, borderRadius(), BORDER_WIDTH, gridSize() / 2, isInteractive && "\n :hover {\n background-color: ".concat("var(--ds-background-neutral-subtle-hovered, ".concat(backgroundHover(), ")"), ";\n cursor: pointer;\n text-decoration: none;\n }\n\n :focus {\n outline: none;\n border-color: ").concat("var(--ds-border-focused, ".concat(B200, ")"), ";\n }\n\n :active {\n background-color: ").concat("var(--ds-background-neutral-subtle-pressed, ".concat(backgroundActive(), ")"), ";\n }\n "), isDisabled && "\n cursor: not-allowed;\n opacity: 0.5;\n pointer-events: none;\n ")
32
+ css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n align-items: center;\n background-color: ", ";\n border-radius: ", "px;\n border: ", "px solid transparent;\n box-sizing: border-box;\n color: inherit;\n display: flex;\n font-size: inherit;\n font-style: normal;\n font-weight: normal;\n line-height: 1;\n outline: none;\n margin: 0;\n padding: ", "px;\n text-align: left;\n text-decoration: none;\n width: 100%;\n\n ", "\n\n ", "\n "])), backgroundColor, borderRadius(), BORDER_WIDTH, gridSize() / 2, isInteractive && "\n :hover {\n background-color: ".concat("var(--ds-background-neutral-subtle-hovered, ".concat(backgroundHover(), ")"), ";\n cursor: pointer;\n text-decoration: none;\n }\n\n :focus {\n outline: none;\n border-color: ", "var(--ds-border-focused, ".concat(B200, ")"), ";\n }\n\n :active {\n background-color: ", "var(--ds-background-neutral-subtle-pressed, ".concat(backgroundActive(), ")"), ";\n }\n "), isDisabled && "\n cursor: not-allowed;\n opacity: 0.5;\n pointer-events: none;\n ")
33
33
  );
34
34
  };
35
35
  /**
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/avatar",
3
- "version": "20.5.9",
3
+ "version": "21.0.1",
4
4
  "sideEffects": false
5
5
  }
@@ -23,7 +23,7 @@ export interface AvatarPropTypes {
23
23
  appearance?: AppearanceType;
24
24
  /**
25
25
  * Used to provide better content to screen readers when using presence/status. Rather
26
- * than a screen reader speaking "online, approved, John Smith", passing in an label
26
+ * than a screen reader speaking "online, approved, John Smith", passing in a label
27
27
  * allows a custom message like "John Smith (approved and online)".
28
28
  */
29
29
  label?: string;
@@ -45,8 +45,7 @@ export interface AvatarPropTypes {
45
45
  */
46
46
  isDisabled?: boolean;
47
47
  /**
48
- * Name will be displayed in a tooltip, also used by screen readers as fallback
49
- * content if the image fails to load.
48
+ * Provides alt text for the avatar image.
50
49
  */
51
50
  name?: string;
52
51
  /**
@@ -8,8 +8,8 @@ interface AvatarImageProps {
8
8
  src?: string;
9
9
  testId?: string;
10
10
  }
11
- export declare const ICON_BACKGROUND: "var(--ds-text-inverse)";
12
- export declare const ICON_COLOR: "var(--ds-text-subtlest)";
11
+ export declare const ICON_BACKGROUND: "var(--ds-icon-inverse)";
12
+ export declare const ICON_COLOR: "var(--ds-icon-subtle)";
13
13
  /**
14
14
  * __Avatar image__
15
15
  *
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@atlaskit/avatar",
3
- "version": "20.5.9",
3
+ "version": "21.0.1",
4
4
  "description": "An avatar is a visual representation of a user or entity.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
7
7
  },
8
- "repository": "https://bitbucket.org/atlassian/atlassian-frontend",
8
+ "repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
9
9
  "author": "Atlassian Pty Ltd",
10
10
  "license": "Apache-2.0",
11
11
  "main": "dist/cjs/index.js",
@@ -18,7 +18,8 @@
18
18
  "team": "Design System Team",
19
19
  "releaseModel": "scheduled",
20
20
  "website": {
21
- "name": "Avatar"
21
+ "name": "Avatar",
22
+ "category": "Components"
22
23
  }
23
24
  },
24
25
  "af:exports": {
@@ -34,7 +35,7 @@
34
35
  "@atlaskit/analytics-next": "^8.0.0",
35
36
  "@atlaskit/icon": "^21.10.0",
36
37
  "@atlaskit/theme": "^12.1.0",
37
- "@atlaskit/tokens": "^0.9.0",
38
+ "@atlaskit/tokens": "^0.10.0",
38
39
  "@babel/runtime": "^7.0.0",
39
40
  "@emotion/core": "^10.0.9"
40
41
  },
@@ -59,7 +60,7 @@
59
60
  "color-contrast-checker": "^1.5.0",
60
61
  "jscodeshift": "^0.13.0",
61
62
  "react-dom": "^16.8.0",
62
- "typescript": "4.2.4",
63
+ "typescript": "4.3.5",
63
64
  "wait-for-expect": "^1.2.0"
64
65
  },
65
66
  "keywords": [
@@ -72,6 +73,7 @@
72
73
  "import-structure": "atlassian-conventions"
73
74
  },
74
75
  "@repo/internal": {
76
+ "dom-events": "use-bind-event-listener",
75
77
  "design-system": "v1",
76
78
  "ui-components": "lite-mode",
77
79
  "analytics": "analytics-next",
package/report.api.md ADDED
@@ -0,0 +1,320 @@
1
+ ## API Report File for "@atlaskit/avatar"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+ /// <reference types="react" />
7
+
8
+ import { FC } from 'react';
9
+ import { ForwardRefExoticComponent } from 'react';
10
+ import { MouseEventHandler } from 'react';
11
+ import { ReactNode } from 'react';
12
+ import { Ref } from 'react';
13
+ import { RefAttributes } from 'react';
14
+ import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
15
+
16
+ export declare const ACTIVE_SCALE_FACTOR = 0.9;
17
+
18
+ export declare type AppearanceType = 'circle' | 'square';
19
+
20
+ /**
21
+ * __Avatar__
22
+ *
23
+ * An avatar is a visual representation of a user or entity.
24
+ *
25
+ * - [Examples](https://atlassian.design/components/avatar/examples)
26
+ * - [Code](https://atlassian.design/components/avatar/code)
27
+ * - [Usage](https://atlassian.design/components/avatar/usage)
28
+ */
29
+ declare const Avatar: ForwardRefExoticComponent<
30
+ AvatarPropTypes & RefAttributes<HTMLElement>
31
+ >;
32
+ export default Avatar;
33
+
34
+ export declare const AVATAR_RADIUS: AvatarSizeMap;
35
+
36
+ export declare const AVATAR_SIZES: AvatarSizeMap;
37
+
38
+ export declare type AvatarClickEventHandler = (
39
+ event: React.MouseEvent,
40
+ analyticsEvent?: UIAnalyticsEvent,
41
+ ) => void;
42
+
43
+ /**
44
+ * __Avatar item__
45
+ *
46
+ * An avatar item is a wrapper that goes around an avatar when it's displayed alongside text, such as a name or status.
47
+ *
48
+ * - [Examples](https://atlassian.design/components/avatar/avatar-item/examples)
49
+ * - [Code](https://atlassian.design/components/avatar/avatar-item/code)
50
+ */
51
+ export declare const AvatarItem: ForwardRefExoticComponent<
52
+ AvatarItemProps & RefAttributes<HTMLElement>
53
+ >;
54
+
55
+ export declare interface AvatarItemProps {
56
+ /**
57
+ * Used to provide better content to screen readers when using presence/status. Rather
58
+ * than a screen reader speaking "online, approved, John Smith", passing in an label
59
+ * allows a custom message like "John Smith (approved and online)".
60
+ */
61
+ label?: string;
62
+ /**
63
+ * Slot to place an avatar element. Use @atlaskit/avatar.
64
+ */
65
+ avatar: ReactNode;
66
+ /**
67
+ * Change background color.
68
+ */
69
+ backgroundColor?: string;
70
+ /**
71
+ * Use a custom component instead of the default span.
72
+ */
73
+ children?: (props: CustomAvatarItemProps) => ReactNode;
74
+ /**
75
+ * URL for avatars being used as a link.
76
+ */
77
+ href?: string;
78
+ /**
79
+ * Disable the item from being interactive
80
+ */
81
+ isDisabled?: boolean;
82
+ /**
83
+ * Handler to be called on click.
84
+ */
85
+ onClick?: AvatarClickEventHandler;
86
+ /**
87
+ * PrimaryText text.
88
+ */
89
+ primaryText?: ReactNode;
90
+ /**
91
+ * SecondaryText text.
92
+ */
93
+ secondaryText?: ReactNode;
94
+ /**
95
+ * Pass target down to the anchor, if href is provided.
96
+ */
97
+ target?: '_blank' | '_self' | '_top' | '_parent';
98
+ /**
99
+ * By default, overflowing text is truncated if it exceeds the container width. Use this prop to disable this.
100
+ */
101
+ isTruncationDisabled?: boolean;
102
+ /**
103
+ * A `testId` prop is provided for specified elements, which is a unique string that appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests
104
+ */
105
+ testId?: string;
106
+ }
107
+
108
+ export declare interface AvatarPropTypes {
109
+ /**
110
+ * Indicates the shape of the avatar. Most avatars are circular, but square avatars
111
+ * can be used for 'container' objects.
112
+ */
113
+ appearance?: AppearanceType;
114
+ /**
115
+ * Used to provide better content to screen readers when using presence/status. Rather
116
+ * than a screen reader speaking "online, approved, John Smith", passing in a label
117
+ * allows a custom message like "John Smith (approved and online)".
118
+ */
119
+ label?: string;
120
+ /**
121
+ * Used to override the default border color around the avatar body.
122
+ * Accepts any color argument that the border-color CSS property accepts.
123
+ */
124
+ borderColor?: string;
125
+ /**
126
+ * Supply a custom avatar component instead of the default
127
+ */
128
+ children?: (props: CustomAvatarProps) => ReactNode;
129
+ /**
130
+ * Provides a url for avatars being used as a link.
131
+ */
132
+ href?: string;
133
+ /**
134
+ * Change the style to indicate the avatar is disabled.
135
+ */
136
+ isDisabled?: boolean;
137
+ /**
138
+ * Provides alt text for the avatar image.
139
+ */
140
+ name?: string;
141
+ /**
142
+ * Indicates a user's online status by showing a small icon on the avatar.
143
+ * Refer to presence values on the Presence component.
144
+ * Alternatively accepts any React element. For best results, it is recommended to
145
+ * use square content with height and width of 100%.
146
+ */
147
+ presence?: ('online' | 'busy' | 'focus' | 'offline') | ReactNode;
148
+ /**
149
+ * Defines the size of the avatar
150
+ */
151
+ size?: SizeType;
152
+ /**
153
+ * A url to load an image from (this can also be a base64 encoded image).
154
+ */
155
+ src?: string;
156
+ /**
157
+ * Indicates contextual information by showing a small icon on the avatar.
158
+ * Refer to status values on the Status component.
159
+ */
160
+ status?: ('approved' | 'declined' | 'locked') | ReactNode;
161
+ /**
162
+ * The index of where this avatar is in the group `stack`.
163
+ */
164
+ stackIndex?: number;
165
+ /**
166
+ * Assign specific tabIndex order to the underlying node.
167
+ */
168
+ tabIndex?: number;
169
+ /**
170
+ * Pass target down to the anchor, if href is provided.
171
+ */
172
+ target?: '_blank' | '_self' | '_top' | '_parent';
173
+ /**
174
+ * Handler to be called on click.
175
+ */
176
+ onClick?: AvatarClickEventHandler;
177
+ /**
178
+ * A `testId` prop is provided for specified elements, which is a unique string that appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests
179
+ */
180
+ testId?: string;
181
+ /**
182
+ * Analytics context meta data
183
+ */
184
+ analyticsContext?: Record<string, any>;
185
+ }
186
+
187
+ declare type AvatarSizeMap = Record<SizeType, number>;
188
+
189
+ export declare const BORDER_WIDTH = 2;
190
+
191
+ export declare interface CustomAvatarItemProps {
192
+ testId?: string;
193
+ onClick?: MouseEventHandler;
194
+ className?: string;
195
+ href?: string;
196
+ children: ReactNode;
197
+ ref: Ref<HTMLElement>;
198
+ /**
199
+ * This is used in render props so is okay to be defined.
200
+ * eslint-disable-next-line consistent-props-definitions
201
+ */
202
+ 'aria-label'?: string;
203
+ 'aria-disabled'?: boolean | 'false' | 'true' | undefined;
204
+ }
205
+
206
+ export declare interface CustomAvatarProps {
207
+ /**
208
+ * This is used in render props so is okay to be defined.
209
+ * eslint-disable-next-line consistent-props-definitions
210
+ */
211
+ 'aria-label'?: string;
212
+ tabIndex?: number;
213
+ testId?: string;
214
+ onClick?: MouseEventHandler;
215
+ className?: string;
216
+ href?: string;
217
+ children: ReactNode;
218
+ ref: Ref<HTMLElement>;
219
+ }
220
+
221
+ export declare type IndicatorSizeType = 'small' | 'medium' | 'large' | 'xlarge';
222
+
223
+ /**
224
+ * __Avatar presence__
225
+ *
226
+ * A presence shows an avatar’s availability.
227
+ *
228
+ * - [Examples](https://atlassian.design/components/avatar/avatar-presence/examples)
229
+ * - [Code](https://atlassian.design/components/avatar/avatar-presence/code)
230
+ * - [Usage](https://atlassian.design/components/avatar/avatar-presence/usage)
231
+ */
232
+ export declare const Presence: FC<PresenceProps>;
233
+
234
+ export declare interface PresenceProps {
235
+ /**
236
+ * Used to override the default border color of the presence indicator.
237
+ * Accepts any color argument that the border-color CSS property accepts.
238
+ */
239
+ borderColor?: string;
240
+ /**
241
+ * Content to use as a custom presence indicator (usually not required if
242
+ * consuming Presence separate to Avatar).
243
+ */
244
+ children?: ReactNode;
245
+ /**
246
+ * The type of presence indicator to show
247
+ */
248
+ presence?: PresenceType;
249
+ /**
250
+ * Test Id
251
+ */
252
+ testId?: string;
253
+ }
254
+
255
+ export declare type PresenceType =
256
+ | 'busy'
257
+ | 'focus'
258
+ | 'offline'
259
+ | 'online'
260
+ | ReactNode;
261
+
262
+ export declare type SizeType =
263
+ | 'xsmall'
264
+ | 'small'
265
+ | 'medium'
266
+ | 'large'
267
+ | 'xlarge'
268
+ | 'xxlarge';
269
+
270
+ /**
271
+ * __Skeleton__
272
+ *
273
+ * A skeleton is the loading state for the avatar component.
274
+ *
275
+ * - [Examples](https://atlassian.design/components/avatar/avatar-skeleton/examples)
276
+ * - [Code](https://atlassian.design/components/avatar/avatar-skeleton/code)
277
+ */
278
+ export declare const Skeleton: FC<SkeletonProps>;
279
+
280
+ export declare interface SkeletonProps {
281
+ appearance?: AppearanceType;
282
+ color?: string;
283
+ size?: SizeType;
284
+ weight?: 'normal' | 'strong';
285
+ }
286
+
287
+ /**
288
+ * __Avatar status__
289
+ *
290
+ * An avatar status shows contextual information, such as if someone approves or declines something.
291
+ *
292
+ * - [Examples](https://atlassian.design/components/avatar/avatar-status/examples)
293
+ * - [Code](https://atlassian.design/components/avatar/avatar-status/code)
294
+ */
295
+ export declare const Status: FC<StatusProps>;
296
+
297
+ export declare interface StatusProps {
298
+ /**
299
+ * Override the default border color of the status indicator. This accepts
300
+ * any color argument that the CSS property `border-color` accepts.
301
+ */
302
+ borderColor?: string;
303
+ /**
304
+ * Content to use as a custom status indicator. Not needed if consuming
305
+ * `Status` separate to `Avatar`.
306
+ */
307
+ children?: ReactNode;
308
+ /**
309
+ * Content to use as a custom status indicator. Not needed if consuming
310
+ * `Status` separate to `Avatar`.
311
+ */
312
+ status?: StatusType;
313
+ }
314
+
315
+ export declare type StatusType =
316
+ | ('approved' | 'declined' | 'locked')
317
+ | ReactNode;
318
+
319
+ export {};
320
+ ```
@@ -3,5 +3,6 @@
3
3
  "main": "../dist/cjs/entry-points/types.js",
4
4
  "module": "../dist/esm/entry-points/types.js",
5
5
  "module:es2019": "../dist/es2019/entry-points/types.js",
6
+ "sideEffects": false,
6
7
  "types": "../dist/types/entry-points/types.d.ts"
7
8
  }