@atlaskit/avatar 21.4.3 → 21.4.4

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,10 +1,16 @@
1
1
  # @atlaskit/avatar
2
2
 
3
+ ## 21.4.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#64854](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/64854) [`61b09a38c764`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/61b09a38c764) - [ux] Adds label to custom avatars using the render prop API.
8
+
3
9
  ## 21.4.3
4
10
 
5
11
  ### Patch Changes
6
12
 
7
- - [#63807](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/63807) [`538c46e739b6`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/538c46e739b6) - [ux] Add accessible name to non-interactive avatars.
13
+ - [#63807](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/63807) [`538c46e739b6`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/538c46e739b6) - [ux] Add accessible name to non-interactive avatars. If you are a making a test that relies on there being only a single element containing the avatar's expected text, skipping any elements with a `hidden` attribute will narrow down your search to only the visible element; this will make the test act the same as it would before this change.
8
14
 
9
15
  ## 21.4.2
10
16
 
@@ -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.3";
26
+ var packageVersion = "21.4.4";
27
27
 
28
28
  // eslint-disable-next-line @repo/internal/react/consistent-types-definitions
29
29
 
@@ -139,7 +139,7 @@ var Avatar = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
139
139
 
140
140
  // add presence or status to the label by default if presence and status are passed as a string
141
141
  // if status or presence are nodes this is not added to the label by default
142
- var defaultLabel = "".concat(name || '', " ").concat(isStatus && !customStatusNode ? "(".concat(status, ")") : '', " ").concat(isPresence && !customPresenceNode ? "(".concat(presence, ")") : '').trim();
142
+ var defaultLabel = [name, isStatus && !customStatusNode && "(".concat(status, ")"), isPresence && !customPresenceNode && "(".concat(presence, ")")].filter(Boolean).join(' ');
143
143
  var isInteractive = onClick || href || isDisabled;
144
144
  return (0, _react2.jsx)(AvatarContainer, {
145
145
  "data-testid": testId,
@@ -163,7 +163,7 @@ var Avatar = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
163
163
  isInteractive: Boolean(href || onClick) && !isDisabled,
164
164
  isDisabled: isDisabled
165
165
  })
166
- }, componentProps()), testId && getTestId(testId, children)), isInteractive && {
166
+ }, componentProps()), testId && getTestId(testId, children)), (isInteractive || children) && {
167
167
  'aria-label': label || defaultLabel
168
168
  }), {}, {
169
169
  children: (0, _react2.jsx)(_AvatarImage.default
@@ -74,7 +74,7 @@ var AvatarPresence = function AvatarPresence(_ref) {
74
74
  viewBox: "0 0 8 8",
75
75
  width: "100%",
76
76
  xmlns: "http://www.w3.org/2000/svg"
77
- }, /*#__PURE__*/_react.default.createElement("title", null, "(".concat(presence, ")")), getPresence(presence)) : children);
77
+ }, getPresence(presence)) : children);
78
78
  };
79
79
  var _default = exports.default = AvatarPresence;
80
80
  /**
@@ -72,7 +72,7 @@ var AvatarStatus = function AvatarStatus(_ref) {
72
72
  viewBox: "0 0 8 8",
73
73
  width: "100%",
74
74
  xmlns: "http://www.w3.org/2000/svg"
75
- }, /*#__PURE__*/_react.default.createElement("title", null, "(".concat(status, ")")), getStatus(status)) : children);
75
+ }, getStatus(status)) : children);
76
76
  };
77
77
  var _default = exports.default = AvatarStatus;
78
78
  /**
@@ -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.3";
14
+ const packageVersion = "21.4.4";
15
15
 
16
16
  // eslint-disable-next-line @repo/internal/react/consistent-types-definitions
17
17
 
@@ -215,7 +215,7 @@ const Avatar = /*#__PURE__*/forwardRef(({
215
215
 
216
216
  // add presence or status to the label by default if presence and status are passed as a string
217
217
  // if status or presence are nodes this is not added to the label by default
218
- const defaultLabel = `${name || ''} ${isStatus && !customStatusNode ? `(${status})` : ''} ${isPresence && !customPresenceNode ? `(${presence})` : ''}`.trim();
218
+ const defaultLabel = [name, isStatus && !customStatusNode && `(${status})`, isPresence && !customPresenceNode && `(${presence})`].filter(Boolean).join(' ');
219
219
  const isInteractive = onClick || href || isDisabled;
220
220
  return jsx(AvatarContainer, {
221
221
  "data-testid": testId,
@@ -242,7 +242,7 @@ const Avatar = /*#__PURE__*/forwardRef(({
242
242
  }),
243
243
  ...componentProps(),
244
244
  ...(testId && getTestId(testId, children)),
245
- ...(isInteractive && {
245
+ ...((isInteractive || children) && {
246
246
  'aria-label': label || defaultLabel
247
247
  }),
248
248
  children: jsx(AvatarImage
@@ -63,7 +63,7 @@ const AvatarPresence = ({
63
63
  viewBox: "0 0 8 8",
64
64
  width: "100%",
65
65
  xmlns: "http://www.w3.org/2000/svg"
66
- }, /*#__PURE__*/React.createElement("title", null, `(${presence})`), getPresence(presence)) : children);
66
+ }, getPresence(presence)) : children);
67
67
  export default AvatarPresence;
68
68
  /**
69
69
  * __Presence wrapper__
@@ -61,7 +61,7 @@ const AvatarStatus = ({
61
61
  viewBox: "0 0 8 8",
62
62
  width: "100%",
63
63
  xmlns: "http://www.w3.org/2000/svg"
64
- }, /*#__PURE__*/React.createElement("title", null, `(${status})`), getStatus(status)) : children);
64
+ }, getStatus(status)) : children);
65
65
  export default AvatarStatus;
66
66
  /**
67
67
  * Status wrapper**
@@ -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.3";
19
+ var packageVersion = "21.4.4";
20
20
 
21
21
  // eslint-disable-next-line @repo/internal/react/consistent-types-definitions
22
22
 
@@ -132,7 +132,7 @@ var Avatar = /*#__PURE__*/forwardRef(function (_ref2, ref) {
132
132
 
133
133
  // add presence or status to the label by default if presence and status are passed as a string
134
134
  // if status or presence are nodes this is not added to the label by default
135
- var defaultLabel = "".concat(name || '', " ").concat(isStatus && !customStatusNode ? "(".concat(status, ")") : '', " ").concat(isPresence && !customPresenceNode ? "(".concat(presence, ")") : '').trim();
135
+ var defaultLabel = [name, isStatus && !customStatusNode && "(".concat(status, ")"), isPresence && !customPresenceNode && "(".concat(presence, ")")].filter(Boolean).join(' ');
136
136
  var isInteractive = onClick || href || isDisabled;
137
137
  return jsx(AvatarContainer, {
138
138
  "data-testid": testId,
@@ -156,7 +156,7 @@ var Avatar = /*#__PURE__*/forwardRef(function (_ref2, ref) {
156
156
  isInteractive: Boolean(href || onClick) && !isDisabled,
157
157
  isDisabled: isDisabled
158
158
  })
159
- }, componentProps()), testId && getTestId(testId, children)), isInteractive && {
159
+ }, componentProps()), testId && getTestId(testId, children)), (isInteractive || children) && {
160
160
  'aria-label': label || defaultLabel
161
161
  }), {}, {
162
162
  children: jsx(AvatarImage
@@ -63,7 +63,7 @@ var AvatarPresence = function AvatarPresence(_ref) {
63
63
  viewBox: "0 0 8 8",
64
64
  width: "100%",
65
65
  xmlns: "http://www.w3.org/2000/svg"
66
- }, /*#__PURE__*/React.createElement("title", null, "(".concat(presence, ")")), getPresence(presence)) : children);
66
+ }, getPresence(presence)) : children);
67
67
  };
68
68
  export default AvatarPresence;
69
69
  /**
@@ -61,7 +61,7 @@ var AvatarStatus = function AvatarStatus(_ref) {
61
61
  viewBox: "0 0 8 8",
62
62
  width: "100%",
63
63
  xmlns: "http://www.w3.org/2000/svg"
64
- }, /*#__PURE__*/React.createElement("title", null, "(".concat(status, ")")), getStatus(status)) : children);
64
+ }, getStatus(status)) : children);
65
65
  };
66
66
  export default AvatarStatus;
67
67
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/avatar",
3
- "version": "21.4.3",
3
+ "version": "21.4.4",
4
4
  "description": "An avatar is a visual representation of a user or entity.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"