@atlaskit/avatar 21.4.4 → 21.4.6

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/avatar
2
2
 
3
+ ## 21.4.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [#70213](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/70213) [`31068e587071`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/31068e587071) - [ux] Removes decorative images of presence and status from view of assistive technologies. The presence and status are announced as part of the labeling of the parent component and therefore no longer necessary.
8
+
9
+ ## 21.4.5
10
+
11
+ ### Patch Changes
12
+
13
+ - [#67339](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/67339) [`33c37b4c2c1e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/33c37b4c2c1e) - [ux] Remove nested images introduced in 21.4.3
14
+
3
15
  ## 21.4.4
4
16
 
5
17
  ### Patch Changes
@@ -23,7 +23,7 @@ var _templateObject;
23
23
  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; }
24
24
  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; }
25
25
  var packageName = "@atlaskit/avatar";
26
- var packageVersion = "21.4.4";
26
+ var packageVersion = "21.4.6";
27
27
 
28
28
  // eslint-disable-next-line @repo/internal/react/consistent-types-definitions
29
29
 
@@ -42,13 +42,11 @@ var getStyles = function getStyles(css, _ref) {
42
42
  };
43
43
 
44
44
  /**
45
- * __Avatar__
46
- *
47
45
  * An avatar is a visual representation of a user or entity.
48
46
  *
49
47
  * - [Examples](https://atlassian.design/components/avatar/examples)
50
48
  * - [Code](https://atlassian.design/components/avatar/code)
51
- * - [Usage](https://atlassian.design/components/avatar/usage)
49
+ * - [Usage](https://atlassian.design/components/avatar/usage).
52
50
  */
53
51
  var Avatar = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
54
52
  var analyticsContext = _ref2.analyticsContext,
@@ -107,7 +105,7 @@ var Avatar = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
107
105
  analyticsEvent.context.push(context);
108
106
 
109
107
  /**
110
- * Replicating the logic in the `withAnalyticsEvents` HOC
108
+ * Replicating the logic in the `withAnalyticsEvents` HOC.
111
109
  */
112
110
  var clone = analyticsEvent.clone();
113
111
  if (clone) {
@@ -141,10 +139,11 @@ var Avatar = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
141
139
  // if status or presence are nodes this is not added to the label by default
142
140
  var defaultLabel = [name, isStatus && !customStatusNode && "(".concat(status, ")"), isPresence && !customPresenceNode && "(".concat(presence, ")")].filter(Boolean).join(' ');
143
141
  var isInteractive = onClick || href || isDisabled;
142
+ var containerShouldBeImage = Boolean(!isInteractive && defaultLabel);
144
143
  return (0, _react2.jsx)(AvatarContainer, {
145
144
  "data-testid": testId,
146
- role: isInteractive || !defaultLabel ? undefined : 'img',
147
- "aria-labelledby": isInteractive || !defaultLabel ? undefined : "".concat(uuid, "-label"),
145
+ role: containerShouldBeImage ? 'img' : undefined,
146
+ "aria-labelledby": containerShouldBeImage ? "".concat(uuid, "-label") : undefined,
148
147
  style: {
149
148
  display: 'inline-block',
150
149
  position: 'relative',
@@ -167,10 +166,10 @@ var Avatar = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
167
166
  'aria-label': label || defaultLabel
168
167
  }), {}, {
169
168
  children: (0, _react2.jsx)(_AvatarImage.default
170
- // Only pass the name if there is an image provided. We want the
171
- // icons to be presentational if they don't show anything important.
169
+ // Only pass in the name if an image is provded and the
170
+ // container is not being used as an `img` role
172
171
  , {
173
- alt: src ? name : undefined,
172
+ alt: !containerShouldBeImage && src ? name : undefined,
174
173
  appearance: appearance,
175
174
  size: size,
176
175
  src: src,
@@ -190,7 +189,7 @@ var Avatar = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
190
189
  borderColor: borderColor,
191
190
  status: typeof status === 'string' ? status : undefined,
192
191
  testId: testId
193
- }, customStatusNode), !isInteractive && defaultLabel ? (0, _react2.jsx)("span", {
192
+ }, customStatusNode), containerShouldBeImage ? (0, _react2.jsx)("span", {
194
193
  id: "".concat(uuid, "-label"),
195
194
  hidden: true
196
195
  }, defaultLabel) : undefined);
@@ -59,6 +59,7 @@ var AvatarImage = function AvatarImage(_ref3) {
59
59
  hasImageErrored = _useState2[0],
60
60
  setHasImageErrored = _useState2[1];
61
61
  var borderRadius = appearance === 'circle' ? '50%' : "".concat(_constants.AVATAR_RADIUS[size], "px");
62
+ var isHidden = !alt ? true : undefined;
62
63
 
63
64
  // If src changes, reset state
64
65
  (0, _react.useEffect)(function () {
@@ -71,12 +72,14 @@ var AvatarImage = function AvatarImage(_ref3) {
71
72
  label: alt,
72
73
  primaryColor: ICON_BACKGROUND,
73
74
  secondaryColor: ICON_COLOR,
74
- testId: testId && "".concat(testId, "--person")
75
+ testId: testId && "".concat(testId, "--person"),
76
+ "aria-hidden": isHidden
75
77
  }) : (0, _react2.jsx)(_ship.default, {
76
78
  label: alt,
77
79
  primaryColor: ICON_BACKGROUND,
78
80
  secondaryColor: ICON_COLOR,
79
- testId: testId && "".concat(testId, "--ship")
81
+ testId: testId && "".concat(testId, "--ship"),
82
+ "aria-hidden": isHidden
80
83
  }));
81
84
  }
82
85
  return (0, _react2.jsx)("img", {
@@ -89,7 +92,8 @@ var AvatarImage = function AvatarImage(_ref3) {
89
92
  },
90
93
  onError: function onError() {
91
94
  return setHasImageErrored(true);
92
- }
95
+ },
96
+ "aria-hidden": isHidden
93
97
  });
94
98
  };
95
99
  var _default = exports.default = AvatarImage;
@@ -54,13 +54,11 @@ function getPresence(presence) {
54
54
  }
55
55
 
56
56
  /**
57
- * __Avatar presence__
58
- *
59
57
  * A presence shows an avatar’s availability.
60
58
  *
61
59
  * - [Examples](https://atlassian.design/components/avatar/avatar-presence/examples)
62
60
  * - [Code](https://atlassian.design/components/avatar/avatar-presence/code)
63
- * - [Usage](https://atlassian.design/components/avatar/avatar-presence/usage)
61
+ * - [Usage](https://atlassian.design/components/avatar/avatar-presence/usage).
64
62
  */
65
63
  var AvatarPresence = function AvatarPresence(_ref) {
66
64
  var borderColor = _ref.borderColor,
@@ -78,8 +76,6 @@ var AvatarPresence = function AvatarPresence(_ref) {
78
76
  };
79
77
  var _default = exports.default = AvatarPresence;
80
78
  /**
81
- * __Presence wrapper__
82
- *
83
79
  * A presence wrapper is used internally to position presence ontop of the avatar.
84
80
  */
85
81
  var PresenceWrapper = exports.PresenceWrapper = function PresenceWrapper(_ref2) {
@@ -91,6 +87,7 @@ var PresenceWrapper = exports.PresenceWrapper = function PresenceWrapper(_ref2)
91
87
  testId = _ref2.testId;
92
88
  var position = appearance === 'square' ? -4 : _constants.ICON_OFFSET[size];
93
89
  return /*#__PURE__*/_react.default.createElement("span", {
90
+ "aria-hidden": "true",
94
91
  "data-testid": testId && "".concat(testId, "--presence"),
95
92
  style: {
96
93
  pointerEvents: 'none',
@@ -53,12 +53,10 @@ function getStatus(status) {
53
53
  }
54
54
 
55
55
  /**
56
- * __Avatar status__
57
- *
58
56
  * An avatar status shows contextual information, such as if someone approves or declines something.
59
57
  *
60
58
  * - [Examples](https://atlassian.design/components/avatar/avatar-status/examples)
61
- * - [Code](https://atlassian.design/components/avatar/avatar-status/code)
59
+ * - [Code](https://atlassian.design/components/avatar/avatar-status/code).
62
60
  */
63
61
  var AvatarStatus = function AvatarStatus(_ref) {
64
62
  var borderColor = _ref.borderColor,
@@ -76,9 +74,7 @@ var AvatarStatus = function AvatarStatus(_ref) {
76
74
  };
77
75
  var _default = exports.default = AvatarStatus;
78
76
  /**
79
- * Status wrapper**
80
- *
81
- * A status wrapper is used internally to position status ontop of the avatar.
77
+ * A status wrapper is used internally to position status on top of the avatar.
82
78
  */
83
79
  var StatusWrapper = exports.StatusWrapper = function StatusWrapper(_ref2) {
84
80
  var size = _ref2.size,
@@ -89,6 +85,7 @@ var StatusWrapper = exports.StatusWrapper = function StatusWrapper(_ref2) {
89
85
  testId = _ref2.testId;
90
86
  var position = appearance === 'square' ? 0 : _constants.ICON_OFFSET[size];
91
87
  return /*#__PURE__*/_react.default.createElement("span", {
88
+ "aria-hidden": "true",
92
89
  "data-testid": testId && "".concat(testId, "--status"),
93
90
  style: {
94
91
  position: 'absolute',
@@ -11,7 +11,7 @@ import { PresenceWrapper } from './Presence';
11
11
  import { StatusWrapper } from './Status';
12
12
  import { getButtonProps, getCustomElement, getLinkProps } from './utilities';
13
13
  const packageName = "@atlaskit/avatar";
14
- const packageVersion = "21.4.4";
14
+ const packageVersion = "21.4.6";
15
15
 
16
16
  // eslint-disable-next-line @repo/internal/react/consistent-types-definitions
17
17
 
@@ -117,13 +117,11 @@ css`
117
117
  `;
118
118
 
119
119
  /**
120
- * __Avatar__
121
- *
122
120
  * An avatar is a visual representation of a user or entity.
123
121
  *
124
122
  * - [Examples](https://atlassian.design/components/avatar/examples)
125
123
  * - [Code](https://atlassian.design/components/avatar/code)
126
- * - [Usage](https://atlassian.design/components/avatar/usage)
124
+ * - [Usage](https://atlassian.design/components/avatar/usage).
127
125
  */
128
126
  const Avatar = /*#__PURE__*/forwardRef(({
129
127
  analyticsContext,
@@ -182,7 +180,7 @@ const Avatar = /*#__PURE__*/forwardRef(({
182
180
  analyticsEvent.context.push(context);
183
181
 
184
182
  /**
185
- * Replicating the logic in the `withAnalyticsEvents` HOC
183
+ * Replicating the logic in the `withAnalyticsEvents` HOC.
186
184
  */
187
185
  const clone = analyticsEvent.clone();
188
186
  if (clone) {
@@ -217,10 +215,11 @@ const Avatar = /*#__PURE__*/forwardRef(({
217
215
  // if status or presence are nodes this is not added to the label by default
218
216
  const defaultLabel = [name, isStatus && !customStatusNode && `(${status})`, isPresence && !customPresenceNode && `(${presence})`].filter(Boolean).join(' ');
219
217
  const isInteractive = onClick || href || isDisabled;
218
+ const containerShouldBeImage = Boolean(!isInteractive && defaultLabel);
220
219
  return jsx(AvatarContainer, {
221
220
  "data-testid": testId,
222
- role: isInteractive || !defaultLabel ? undefined : 'img',
223
- "aria-labelledby": isInteractive || !defaultLabel ? undefined : `${uuid}-label`,
221
+ role: containerShouldBeImage ? 'img' : undefined,
222
+ "aria-labelledby": containerShouldBeImage ? `${uuid}-label` : undefined,
224
223
  style: {
225
224
  display: 'inline-block',
226
225
  position: 'relative',
@@ -246,10 +245,10 @@ const Avatar = /*#__PURE__*/forwardRef(({
246
245
  'aria-label': label || defaultLabel
247
246
  }),
248
247
  children: jsx(AvatarImage
249
- // Only pass the name if there is an image provided. We want the
250
- // icons to be presentational if they don't show anything important.
248
+ // Only pass in the name if an image is provded and the
249
+ // container is not being used as an `img` role
251
250
  , {
252
- alt: src ? name : undefined,
251
+ alt: !containerShouldBeImage && src ? name : undefined,
253
252
  appearance: appearance,
254
253
  size: size,
255
254
  src: src,
@@ -269,7 +268,7 @@ const Avatar = /*#__PURE__*/forwardRef(({
269
268
  borderColor: borderColor,
270
269
  status: typeof status === 'string' ? status : undefined,
271
270
  testId: testId
272
- }, customStatusNode), !isInteractive && defaultLabel ? jsx("span", {
271
+ }, customStatusNode), containerShouldBeImage ? jsx("span", {
273
272
  id: `${uuid}-label`,
274
273
  hidden: true
275
274
  }, defaultLabel) : undefined);
@@ -47,6 +47,7 @@ const AvatarImage = ({
47
47
  }) => {
48
48
  const [hasImageErrored, setHasImageErrored] = useState(false);
49
49
  const borderRadius = appearance === 'circle' ? '50%' : `${AVATAR_RADIUS[size]}px`;
50
+ const isHidden = !alt ? true : undefined;
50
51
 
51
52
  // If src changes, reset state
52
53
  useEffect(() => {
@@ -59,12 +60,14 @@ const AvatarImage = ({
59
60
  label: alt,
60
61
  primaryColor: ICON_BACKGROUND,
61
62
  secondaryColor: ICON_COLOR,
62
- testId: testId && `${testId}--person`
63
+ testId: testId && `${testId}--person`,
64
+ "aria-hidden": isHidden
63
65
  }) : jsx(ShipIcon, {
64
66
  label: alt,
65
67
  primaryColor: ICON_BACKGROUND,
66
68
  secondaryColor: ICON_COLOR,
67
- testId: testId && `${testId}--ship`
69
+ testId: testId && `${testId}--ship`,
70
+ "aria-hidden": isHidden
68
71
  }));
69
72
  }
70
73
  return jsx("img", {
@@ -75,7 +78,8 @@ const AvatarImage = ({
75
78
  style: {
76
79
  borderRadius: borderRadius
77
80
  },
78
- onError: () => setHasImageErrored(true)
81
+ onError: () => setHasImageErrored(true),
82
+ "aria-hidden": isHidden
79
83
  });
80
84
  };
81
85
  export default AvatarImage;
@@ -43,13 +43,11 @@ function getPresence(presence) {
43
43
  }
44
44
 
45
45
  /**
46
- * __Avatar presence__
47
- *
48
46
  * A presence shows an avatar’s availability.
49
47
  *
50
48
  * - [Examples](https://atlassian.design/components/avatar/avatar-presence/examples)
51
49
  * - [Code](https://atlassian.design/components/avatar/avatar-presence/code)
52
- * - [Usage](https://atlassian.design/components/avatar/avatar-presence/usage)
50
+ * - [Usage](https://atlassian.design/components/avatar/avatar-presence/usage).
53
51
  */
54
52
  const AvatarPresence = ({
55
53
  borderColor,
@@ -66,8 +64,6 @@ const AvatarPresence = ({
66
64
  }, getPresence(presence)) : children);
67
65
  export default AvatarPresence;
68
66
  /**
69
- * __Presence wrapper__
70
- *
71
67
  * A presence wrapper is used internally to position presence ontop of the avatar.
72
68
  */
73
69
  export const PresenceWrapper = ({
@@ -80,6 +76,7 @@ export const PresenceWrapper = ({
80
76
  }) => {
81
77
  const position = appearance === 'square' ? -4 : ICON_OFFSET[size];
82
78
  return /*#__PURE__*/React.createElement("span", {
79
+ "aria-hidden": "true",
83
80
  "data-testid": testId && `${testId}--presence`,
84
81
  style: {
85
82
  pointerEvents: 'none',
@@ -42,12 +42,10 @@ function getStatus(status) {
42
42
  }
43
43
 
44
44
  /**
45
- * __Avatar status__
46
- *
47
45
  * An avatar status shows contextual information, such as if someone approves or declines something.
48
46
  *
49
47
  * - [Examples](https://atlassian.design/components/avatar/avatar-status/examples)
50
- * - [Code](https://atlassian.design/components/avatar/avatar-status/code)
48
+ * - [Code](https://atlassian.design/components/avatar/avatar-status/code).
51
49
  */
52
50
  const AvatarStatus = ({
53
51
  borderColor,
@@ -64,9 +62,7 @@ const AvatarStatus = ({
64
62
  }, getStatus(status)) : children);
65
63
  export default AvatarStatus;
66
64
  /**
67
- * Status wrapper**
68
- *
69
- * A status wrapper is used internally to position status ontop of the avatar.
65
+ * A status wrapper is used internally to position status on top of the avatar.
70
66
  */
71
67
  export const StatusWrapper = ({
72
68
  size,
@@ -78,6 +74,7 @@ export const StatusWrapper = ({
78
74
  }) => {
79
75
  const position = appearance === 'square' ? 0 : ICON_OFFSET[size];
80
76
  return /*#__PURE__*/React.createElement("span", {
77
+ "aria-hidden": "true",
81
78
  "data-testid": testId && `${testId}--status`,
82
79
  style: {
83
80
  position: 'absolute',
@@ -16,7 +16,7 @@ import { PresenceWrapper } from './Presence';
16
16
  import { StatusWrapper } from './Status';
17
17
  import { getButtonProps, getCustomElement, getLinkProps } from './utilities';
18
18
  var packageName = "@atlaskit/avatar";
19
- var packageVersion = "21.4.4";
19
+ var packageVersion = "21.4.6";
20
20
 
21
21
  // eslint-disable-next-line @repo/internal/react/consistent-types-definitions
22
22
 
@@ -35,13 +35,11 @@ var getStyles = function getStyles(css, _ref) {
35
35
  };
36
36
 
37
37
  /**
38
- * __Avatar__
39
- *
40
38
  * An avatar is a visual representation of a user or entity.
41
39
  *
42
40
  * - [Examples](https://atlassian.design/components/avatar/examples)
43
41
  * - [Code](https://atlassian.design/components/avatar/code)
44
- * - [Usage](https://atlassian.design/components/avatar/usage)
42
+ * - [Usage](https://atlassian.design/components/avatar/usage).
45
43
  */
46
44
  var Avatar = /*#__PURE__*/forwardRef(function (_ref2, ref) {
47
45
  var analyticsContext = _ref2.analyticsContext,
@@ -100,7 +98,7 @@ var Avatar = /*#__PURE__*/forwardRef(function (_ref2, ref) {
100
98
  analyticsEvent.context.push(context);
101
99
 
102
100
  /**
103
- * Replicating the logic in the `withAnalyticsEvents` HOC
101
+ * Replicating the logic in the `withAnalyticsEvents` HOC.
104
102
  */
105
103
  var clone = analyticsEvent.clone();
106
104
  if (clone) {
@@ -134,10 +132,11 @@ var Avatar = /*#__PURE__*/forwardRef(function (_ref2, ref) {
134
132
  // if status or presence are nodes this is not added to the label by default
135
133
  var defaultLabel = [name, isStatus && !customStatusNode && "(".concat(status, ")"), isPresence && !customPresenceNode && "(".concat(presence, ")")].filter(Boolean).join(' ');
136
134
  var isInteractive = onClick || href || isDisabled;
135
+ var containerShouldBeImage = Boolean(!isInteractive && defaultLabel);
137
136
  return jsx(AvatarContainer, {
138
137
  "data-testid": testId,
139
- role: isInteractive || !defaultLabel ? undefined : 'img',
140
- "aria-labelledby": isInteractive || !defaultLabel ? undefined : "".concat(uuid, "-label"),
138
+ role: containerShouldBeImage ? 'img' : undefined,
139
+ "aria-labelledby": containerShouldBeImage ? "".concat(uuid, "-label") : undefined,
141
140
  style: {
142
141
  display: 'inline-block',
143
142
  position: 'relative',
@@ -160,10 +159,10 @@ var Avatar = /*#__PURE__*/forwardRef(function (_ref2, ref) {
160
159
  'aria-label': label || defaultLabel
161
160
  }), {}, {
162
161
  children: jsx(AvatarImage
163
- // Only pass the name if there is an image provided. We want the
164
- // icons to be presentational if they don't show anything important.
162
+ // Only pass in the name if an image is provded and the
163
+ // container is not being used as an `img` role
165
164
  , {
166
- alt: src ? name : undefined,
165
+ alt: !containerShouldBeImage && src ? name : undefined,
167
166
  appearance: appearance,
168
167
  size: size,
169
168
  src: src,
@@ -183,7 +182,7 @@ var Avatar = /*#__PURE__*/forwardRef(function (_ref2, ref) {
183
182
  borderColor: borderColor,
184
183
  status: typeof status === 'string' ? status : undefined,
185
184
  testId: testId
186
- }, customStatusNode), !isInteractive && defaultLabel ? jsx("span", {
185
+ }, customStatusNode), containerShouldBeImage ? jsx("span", {
187
186
  id: "".concat(uuid, "-label"),
188
187
  hidden: true
189
188
  }, defaultLabel) : undefined);
@@ -54,6 +54,7 @@ var AvatarImage = function AvatarImage(_ref3) {
54
54
  hasImageErrored = _useState2[0],
55
55
  setHasImageErrored = _useState2[1];
56
56
  var borderRadius = appearance === 'circle' ? '50%' : "".concat(AVATAR_RADIUS[size], "px");
57
+ var isHidden = !alt ? true : undefined;
57
58
 
58
59
  // If src changes, reset state
59
60
  useEffect(function () {
@@ -66,12 +67,14 @@ var AvatarImage = function AvatarImage(_ref3) {
66
67
  label: alt,
67
68
  primaryColor: ICON_BACKGROUND,
68
69
  secondaryColor: ICON_COLOR,
69
- testId: testId && "".concat(testId, "--person")
70
+ testId: testId && "".concat(testId, "--person"),
71
+ "aria-hidden": isHidden
70
72
  }) : jsx(ShipIcon, {
71
73
  label: alt,
72
74
  primaryColor: ICON_BACKGROUND,
73
75
  secondaryColor: ICON_COLOR,
74
- testId: testId && "".concat(testId, "--ship")
76
+ testId: testId && "".concat(testId, "--ship"),
77
+ "aria-hidden": isHidden
75
78
  }));
76
79
  }
77
80
  return jsx("img", {
@@ -84,7 +87,8 @@ var AvatarImage = function AvatarImage(_ref3) {
84
87
  },
85
88
  onError: function onError() {
86
89
  return setHasImageErrored(true);
87
- }
90
+ },
91
+ "aria-hidden": isHidden
88
92
  });
89
93
  };
90
94
  export default AvatarImage;
@@ -43,13 +43,11 @@ function getPresence(presence) {
43
43
  }
44
44
 
45
45
  /**
46
- * __Avatar presence__
47
- *
48
46
  * A presence shows an avatar’s availability.
49
47
  *
50
48
  * - [Examples](https://atlassian.design/components/avatar/avatar-presence/examples)
51
49
  * - [Code](https://atlassian.design/components/avatar/avatar-presence/code)
52
- * - [Usage](https://atlassian.design/components/avatar/avatar-presence/usage)
50
+ * - [Usage](https://atlassian.design/components/avatar/avatar-presence/usage).
53
51
  */
54
52
  var AvatarPresence = function AvatarPresence(_ref) {
55
53
  var borderColor = _ref.borderColor,
@@ -67,8 +65,6 @@ var AvatarPresence = function AvatarPresence(_ref) {
67
65
  };
68
66
  export default AvatarPresence;
69
67
  /**
70
- * __Presence wrapper__
71
- *
72
68
  * A presence wrapper is used internally to position presence ontop of the avatar.
73
69
  */
74
70
  export var PresenceWrapper = function PresenceWrapper(_ref2) {
@@ -80,6 +76,7 @@ export var PresenceWrapper = function PresenceWrapper(_ref2) {
80
76
  testId = _ref2.testId;
81
77
  var position = appearance === 'square' ? -4 : ICON_OFFSET[size];
82
78
  return /*#__PURE__*/React.createElement("span", {
79
+ "aria-hidden": "true",
83
80
  "data-testid": testId && "".concat(testId, "--presence"),
84
81
  style: {
85
82
  pointerEvents: 'none',
@@ -42,12 +42,10 @@ function getStatus(status) {
42
42
  }
43
43
 
44
44
  /**
45
- * __Avatar status__
46
- *
47
45
  * An avatar status shows contextual information, such as if someone approves or declines something.
48
46
  *
49
47
  * - [Examples](https://atlassian.design/components/avatar/avatar-status/examples)
50
- * - [Code](https://atlassian.design/components/avatar/avatar-status/code)
48
+ * - [Code](https://atlassian.design/components/avatar/avatar-status/code).
51
49
  */
52
50
  var AvatarStatus = function AvatarStatus(_ref) {
53
51
  var borderColor = _ref.borderColor,
@@ -65,9 +63,7 @@ var AvatarStatus = function AvatarStatus(_ref) {
65
63
  };
66
64
  export default AvatarStatus;
67
65
  /**
68
- * Status wrapper**
69
- *
70
- * A status wrapper is used internally to position status ontop of the avatar.
66
+ * A status wrapper is used internally to position status on top of the avatar.
71
67
  */
72
68
  export var StatusWrapper = function StatusWrapper(_ref2) {
73
69
  var size = _ref2.size,
@@ -78,6 +74,7 @@ export var StatusWrapper = function StatusWrapper(_ref2) {
78
74
  testId = _ref2.testId;
79
75
  var position = appearance === 'square' ? 0 : ICON_OFFSET[size];
80
76
  return /*#__PURE__*/React.createElement("span", {
77
+ "aria-hidden": "true",
81
78
  "data-testid": testId && "".concat(testId, "--status"),
82
79
  style: {
83
80
  position: 'absolute',
@@ -4,7 +4,6 @@ import { AppearanceType, AvatarClickEventHandler, Presence, SizeType, Status } f
4
4
  export interface CustomAvatarProps {
5
5
  /**
6
6
  * This is used in render props so is okay to be defined.
7
- * eslint-disable-next-line consistent-props-definitions
8
7
  */
9
8
  'aria-label'?: string;
10
9
  tabIndex?: number;
@@ -99,13 +98,11 @@ export interface AvatarPropTypes {
99
98
  as?: keyof JSX.IntrinsicElements | React.ComponentType<React.AllHTMLAttributes<HTMLElement>>;
100
99
  }
101
100
  /**
102
- * __Avatar__
103
- *
104
101
  * An avatar is a visual representation of a user or entity.
105
102
  *
106
103
  * - [Examples](https://atlassian.design/components/avatar/examples)
107
104
  * - [Code](https://atlassian.design/components/avatar/code)
108
- * - [Usage](https://atlassian.design/components/avatar/usage)
105
+ * - [Usage](https://atlassian.design/components/avatar/usage).
109
106
  */
110
107
  declare const Avatar: import("react").ForwardRefExoticComponent<AvatarPropTypes & import("react").RefAttributes<HTMLElement>>;
111
108
  export default Avatar;
@@ -12,22 +12,16 @@ export interface PresenceProps {
12
12
  */
13
13
  children?: ReactNode;
14
14
  /**
15
- * The type of presence indicator to show
15
+ * The type of presence indicator to show.
16
16
  */
17
17
  presence?: Presence;
18
- /**
19
- * Test Id
20
- */
21
- testId?: string;
22
18
  }
23
19
  /**
24
- * __Avatar presence__
25
- *
26
20
  * A presence shows an avatar’s availability.
27
21
  *
28
22
  * - [Examples](https://atlassian.design/components/avatar/avatar-presence/examples)
29
23
  * - [Code](https://atlassian.design/components/avatar/avatar-presence/code)
30
- * - [Usage](https://atlassian.design/components/avatar/avatar-presence/usage)
24
+ * - [Usage](https://atlassian.design/components/avatar/avatar-presence/usage).
31
25
  */
32
26
  declare const AvatarPresence: FC<PresenceProps>;
33
27
  export default AvatarPresence;
@@ -37,8 +31,6 @@ export interface PresenceWrapperProps extends PresenceProps {
37
31
  testId?: string;
38
32
  }
39
33
  /**
40
- * __Presence wrapper__
41
- *
42
34
  * A presence wrapper is used internally to position presence ontop of the avatar.
43
35
  */
44
36
  export declare const PresenceWrapper: FC<PresenceWrapperProps>;
@@ -2,9 +2,21 @@
2
2
  import { FC } from 'react';
3
3
  import { AppearanceType, SizeType } from './types';
4
4
  export interface SkeletonProps {
5
+ /**
6
+ * Indicates the shape of the avatar skeleton. Most avatars are circular, but square avatars can be used for container objects.
7
+ */
5
8
  appearance?: AppearanceType;
9
+ /**
10
+ * Color of the skeleton. By default, it will inherit the current text color.
11
+ */
6
12
  color?: string;
13
+ /**
14
+ * Defines the size of the avatar skeleton.
15
+ */
7
16
  size?: SizeType;
17
+ /**
18
+ * Defines the opacity of the avatar skeleton. Use `weight="normal"` for the default opacity, or `weight="strong"` for a bolder opacity.
19
+ */
8
20
  weight?: 'normal' | 'strong';
9
21
  }
10
22
  /**
@@ -12,30 +12,24 @@ export interface StatusProps {
12
12
  */
13
13
  children?: ReactNode;
14
14
  /**
15
- * Content to use as a custom status indicator. Not needed if consuming
16
- * `Status` separate to `Avatar`.
15
+ * The type of status indicator to show.
17
16
  */
18
17
  status?: Status;
19
18
  }
20
19
  /**
21
- * __Avatar status__
22
- *
23
20
  * An avatar status shows contextual information, such as if someone approves or declines something.
24
21
  *
25
22
  * - [Examples](https://atlassian.design/components/avatar/avatar-status/examples)
26
- * - [Code](https://atlassian.design/components/avatar/avatar-status/code)
23
+ * - [Code](https://atlassian.design/components/avatar/avatar-status/code).
27
24
  */
28
25
  declare const AvatarStatus: FC<StatusProps>;
29
26
  export default AvatarStatus;
30
27
  interface StatusWrapperProps extends StatusProps {
31
28
  appearance: AppearanceType;
32
29
  size: IndicatorSizeType;
33
- children: ReactNode;
34
30
  testId?: string;
35
31
  }
36
32
  /**
37
- * Status wrapper**
38
- *
39
- * A status wrapper is used internally to position status ontop of the avatar.
33
+ * A status wrapper is used internally to position status on top of the avatar.
40
34
  */
41
35
  export declare const StatusWrapper: FC<StatusWrapperProps>;
@@ -4,7 +4,6 @@ import { AppearanceType, AvatarClickEventHandler, Presence, SizeType, Status } f
4
4
  export interface CustomAvatarProps {
5
5
  /**
6
6
  * This is used in render props so is okay to be defined.
7
- * eslint-disable-next-line consistent-props-definitions
8
7
  */
9
8
  'aria-label'?: string;
10
9
  tabIndex?: number;
@@ -99,13 +98,11 @@ export interface AvatarPropTypes {
99
98
  as?: keyof JSX.IntrinsicElements | React.ComponentType<React.AllHTMLAttributes<HTMLElement>>;
100
99
  }
101
100
  /**
102
- * __Avatar__
103
- *
104
101
  * An avatar is a visual representation of a user or entity.
105
102
  *
106
103
  * - [Examples](https://atlassian.design/components/avatar/examples)
107
104
  * - [Code](https://atlassian.design/components/avatar/code)
108
- * - [Usage](https://atlassian.design/components/avatar/usage)
105
+ * - [Usage](https://atlassian.design/components/avatar/usage).
109
106
  */
110
107
  declare const Avatar: import("react").ForwardRefExoticComponent<AvatarPropTypes & import("react").RefAttributes<HTMLElement>>;
111
108
  export default Avatar;
@@ -12,22 +12,16 @@ export interface PresenceProps {
12
12
  */
13
13
  children?: ReactNode;
14
14
  /**
15
- * The type of presence indicator to show
15
+ * The type of presence indicator to show.
16
16
  */
17
17
  presence?: Presence;
18
- /**
19
- * Test Id
20
- */
21
- testId?: string;
22
18
  }
23
19
  /**
24
- * __Avatar presence__
25
- *
26
20
  * A presence shows an avatar’s availability.
27
21
  *
28
22
  * - [Examples](https://atlassian.design/components/avatar/avatar-presence/examples)
29
23
  * - [Code](https://atlassian.design/components/avatar/avatar-presence/code)
30
- * - [Usage](https://atlassian.design/components/avatar/avatar-presence/usage)
24
+ * - [Usage](https://atlassian.design/components/avatar/avatar-presence/usage).
31
25
  */
32
26
  declare const AvatarPresence: FC<PresenceProps>;
33
27
  export default AvatarPresence;
@@ -37,8 +31,6 @@ export interface PresenceWrapperProps extends PresenceProps {
37
31
  testId?: string;
38
32
  }
39
33
  /**
40
- * __Presence wrapper__
41
- *
42
34
  * A presence wrapper is used internally to position presence ontop of the avatar.
43
35
  */
44
36
  export declare const PresenceWrapper: FC<PresenceWrapperProps>;
@@ -2,9 +2,21 @@
2
2
  import { FC } from 'react';
3
3
  import { AppearanceType, SizeType } from './types';
4
4
  export interface SkeletonProps {
5
+ /**
6
+ * Indicates the shape of the avatar skeleton. Most avatars are circular, but square avatars can be used for container objects.
7
+ */
5
8
  appearance?: AppearanceType;
9
+ /**
10
+ * Color of the skeleton. By default, it will inherit the current text color.
11
+ */
6
12
  color?: string;
13
+ /**
14
+ * Defines the size of the avatar skeleton.
15
+ */
7
16
  size?: SizeType;
17
+ /**
18
+ * Defines the opacity of the avatar skeleton. Use `weight="normal"` for the default opacity, or `weight="strong"` for a bolder opacity.
19
+ */
8
20
  weight?: 'normal' | 'strong';
9
21
  }
10
22
  /**
@@ -12,30 +12,24 @@ export interface StatusProps {
12
12
  */
13
13
  children?: ReactNode;
14
14
  /**
15
- * Content to use as a custom status indicator. Not needed if consuming
16
- * `Status` separate to `Avatar`.
15
+ * The type of status indicator to show.
17
16
  */
18
17
  status?: Status;
19
18
  }
20
19
  /**
21
- * __Avatar status__
22
- *
23
20
  * An avatar status shows contextual information, such as if someone approves or declines something.
24
21
  *
25
22
  * - [Examples](https://atlassian.design/components/avatar/avatar-status/examples)
26
- * - [Code](https://atlassian.design/components/avatar/avatar-status/code)
23
+ * - [Code](https://atlassian.design/components/avatar/avatar-status/code).
27
24
  */
28
25
  declare const AvatarStatus: FC<StatusProps>;
29
26
  export default AvatarStatus;
30
27
  interface StatusWrapperProps extends StatusProps {
31
28
  appearance: AppearanceType;
32
29
  size: IndicatorSizeType;
33
- children: ReactNode;
34
30
  testId?: string;
35
31
  }
36
32
  /**
37
- * Status wrapper**
38
- *
39
- * A status wrapper is used internally to position status ontop of the avatar.
33
+ * A status wrapper is used internally to position status on top of the avatar.
40
34
  */
41
35
  export declare const StatusWrapper: FC<StatusWrapperProps>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/avatar",
3
- "version": "21.4.4",
3
+ "version": "21.4.6",
4
4
  "description": "An avatar is a visual representation of a user or entity.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -46,7 +46,7 @@
46
46
  "@atlaskit/analytics-next": "^9.1.0",
47
47
  "@atlaskit/icon": "^22.0.0",
48
48
  "@atlaskit/theme": "^12.6.0",
49
- "@atlaskit/tokens": "^1.33.0",
49
+ "@atlaskit/tokens": "^1.35.0",
50
50
  "@babel/runtime": "^7.0.0",
51
51
  "@emotion/react": "^11.7.1",
52
52
  "@emotion/serialize": "^1.1.0",
@@ -67,6 +67,7 @@
67
67
  "@testing-library/react": "^12.1.5",
68
68
  "@types/jscodeshift": "^0.11.0",
69
69
  "color-contrast-checker": "^1.5.0",
70
+ "jest-in-case": "^1.0.2",
70
71
  "jscodeshift": "^0.13.0",
71
72
  "react-dom": "^16.8.0",
72
73
  "typescript": "~4.9.5",