@atlaskit/avatar 25.3.0 → 25.3.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.
- package/CHANGELOG.md +7 -0
- package/dist/cjs/avatar.js +6 -3
- package/dist/es2019/avatar.js +6 -3
- package/dist/esm/avatar.js +6 -3
- package/dist/types/avatar.d.ts +9 -0
- package/dist/types-ts4.5/avatar.d.ts +9 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @atlaskit/avatar
|
|
2
2
|
|
|
3
|
+
## 25.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`42beb385671cf`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/42beb385671cf) -
|
|
8
|
+
[ux] Add a new prop to set the container element for avatar content"
|
|
9
|
+
|
|
3
10
|
## 25.3.0
|
|
4
11
|
|
|
5
12
|
### Minor Changes
|
package/dist/cjs/avatar.js
CHANGED
|
@@ -24,7 +24,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
24
24
|
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; }
|
|
25
25
|
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; }
|
|
26
26
|
var packageName = "@atlaskit/avatar";
|
|
27
|
-
var packageVersion = "
|
|
27
|
+
var packageVersion = "0.0.0-development";
|
|
28
28
|
var containerStyles = null;
|
|
29
29
|
|
|
30
30
|
// eslint-disable-next-line @repo/internal/react/consistent-types-definitions
|
|
@@ -58,6 +58,8 @@ var Avatar = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
58
58
|
testId = _ref.testId,
|
|
59
59
|
_ref$as = _ref.as,
|
|
60
60
|
AvatarContainer = _ref$as === void 0 ? 'div' : _ref$as,
|
|
61
|
+
contentAs = _ref.contentAs,
|
|
62
|
+
containerRole = _ref.containerRole,
|
|
61
63
|
_ref$isDecorative = _ref.isDecorative,
|
|
62
64
|
isDecorative = _ref$isDecorative === void 0 ? false : _ref$isDecorative,
|
|
63
65
|
imgLoading = _ref.imgLoading;
|
|
@@ -115,11 +117,12 @@ var Avatar = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
115
117
|
var defaultLabel = [name, isStatus && !customStatusNode && "(".concat(status, ")"), isPresence && !customPresenceNode && "(".concat(presence, ")")].filter(Boolean).join(' ');
|
|
116
118
|
var isInteractive = onClick || href || isDisabled;
|
|
117
119
|
var containerShouldBeImage = Boolean(!isInteractive && defaultLabel);
|
|
120
|
+
var avatarContainerRole = containerRole || (containerShouldBeImage ? 'img' : undefined);
|
|
118
121
|
return /*#__PURE__*/React.createElement(_context.EnsureIsInsideAvatarContext.Provider, {
|
|
119
122
|
value: true
|
|
120
123
|
}, /*#__PURE__*/React.createElement(AvatarContainer, {
|
|
121
124
|
"data-testid": testId,
|
|
122
|
-
role:
|
|
125
|
+
role: avatarContainerRole,
|
|
123
126
|
"aria-labelledby": containerShouldBeImage && !isDecorative ? labelId : undefined,
|
|
124
127
|
style: {
|
|
125
128
|
zIndex: stackIndex
|
|
@@ -127,7 +130,7 @@ var Avatar = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
127
130
|
className: (0, _runtime.ax)(["_12ji1r31 _1qu2glyw _12y3idpf _1e0c1o8l _kqswh2mm"])
|
|
128
131
|
}, /*#__PURE__*/React.createElement(_context.AvatarContentContext.Provider, {
|
|
129
132
|
value: {
|
|
130
|
-
as: (0, _utilities.getCustomElement)(isDisabled, href, onClick),
|
|
133
|
+
as: contentAs || (0, _utilities.getCustomElement)(isDisabled, href, onClick),
|
|
131
134
|
appearance: appearance,
|
|
132
135
|
borderColor: borderColor,
|
|
133
136
|
href: href,
|
package/dist/es2019/avatar.js
CHANGED
|
@@ -12,7 +12,7 @@ import { PresenceWrapper } from './presence';
|
|
|
12
12
|
import { StatusWrapper } from './status';
|
|
13
13
|
import { getCustomElement } from './utilities';
|
|
14
14
|
const packageName = "@atlaskit/avatar";
|
|
15
|
-
const packageVersion = "
|
|
15
|
+
const packageVersion = "0.0.0-development";
|
|
16
16
|
const containerStyles = null;
|
|
17
17
|
|
|
18
18
|
// eslint-disable-next-line @repo/internal/react/consistent-types-definitions
|
|
@@ -44,6 +44,8 @@ const Avatar = /*#__PURE__*/forwardRef(({
|
|
|
44
44
|
target,
|
|
45
45
|
testId,
|
|
46
46
|
as: AvatarContainer = 'div',
|
|
47
|
+
contentAs,
|
|
48
|
+
containerRole,
|
|
47
49
|
isDecorative = false,
|
|
48
50
|
imgLoading
|
|
49
51
|
}, ref) => {
|
|
@@ -103,11 +105,12 @@ const Avatar = /*#__PURE__*/forwardRef(({
|
|
|
103
105
|
const defaultLabel = [name, isStatus && !customStatusNode && `(${status})`, isPresence && !customPresenceNode && `(${presence})`].filter(Boolean).join(' ');
|
|
104
106
|
const isInteractive = onClick || href || isDisabled;
|
|
105
107
|
const containerShouldBeImage = Boolean(!isInteractive && defaultLabel);
|
|
108
|
+
const avatarContainerRole = containerRole || (containerShouldBeImage ? 'img' : undefined);
|
|
106
109
|
return /*#__PURE__*/React.createElement(EnsureIsInsideAvatarContext.Provider, {
|
|
107
110
|
value: true
|
|
108
111
|
}, /*#__PURE__*/React.createElement(AvatarContainer, {
|
|
109
112
|
"data-testid": testId,
|
|
110
|
-
role:
|
|
113
|
+
role: avatarContainerRole,
|
|
111
114
|
"aria-labelledby": containerShouldBeImage && !isDecorative ? labelId : undefined,
|
|
112
115
|
style: {
|
|
113
116
|
zIndex: stackIndex
|
|
@@ -115,7 +118,7 @@ const Avatar = /*#__PURE__*/forwardRef(({
|
|
|
115
118
|
className: ax(["_12ji1r31 _1qu2glyw _12y3idpf _1e0c1o8l _kqswh2mm"])
|
|
116
119
|
}, /*#__PURE__*/React.createElement(AvatarContentContext.Provider, {
|
|
117
120
|
value: {
|
|
118
|
-
as: getCustomElement(isDisabled, href, onClick),
|
|
121
|
+
as: contentAs || getCustomElement(isDisabled, href, onClick),
|
|
119
122
|
appearance,
|
|
120
123
|
borderColor,
|
|
121
124
|
href,
|
package/dist/esm/avatar.js
CHANGED
|
@@ -15,7 +15,7 @@ import { PresenceWrapper } from './presence';
|
|
|
15
15
|
import { StatusWrapper } from './status';
|
|
16
16
|
import { getCustomElement } from './utilities';
|
|
17
17
|
var packageName = "@atlaskit/avatar";
|
|
18
|
-
var packageVersion = "
|
|
18
|
+
var packageVersion = "0.0.0-development";
|
|
19
19
|
var containerStyles = null;
|
|
20
20
|
|
|
21
21
|
// eslint-disable-next-line @repo/internal/react/consistent-types-definitions
|
|
@@ -49,6 +49,8 @@ var Avatar = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
49
49
|
testId = _ref.testId,
|
|
50
50
|
_ref$as = _ref.as,
|
|
51
51
|
AvatarContainer = _ref$as === void 0 ? 'div' : _ref$as,
|
|
52
|
+
contentAs = _ref.contentAs,
|
|
53
|
+
containerRole = _ref.containerRole,
|
|
52
54
|
_ref$isDecorative = _ref.isDecorative,
|
|
53
55
|
isDecorative = _ref$isDecorative === void 0 ? false : _ref$isDecorative,
|
|
54
56
|
imgLoading = _ref.imgLoading;
|
|
@@ -106,11 +108,12 @@ var Avatar = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
106
108
|
var defaultLabel = [name, isStatus && !customStatusNode && "(".concat(status, ")"), isPresence && !customPresenceNode && "(".concat(presence, ")")].filter(Boolean).join(' ');
|
|
107
109
|
var isInteractive = onClick || href || isDisabled;
|
|
108
110
|
var containerShouldBeImage = Boolean(!isInteractive && defaultLabel);
|
|
111
|
+
var avatarContainerRole = containerRole || (containerShouldBeImage ? 'img' : undefined);
|
|
109
112
|
return /*#__PURE__*/React.createElement(EnsureIsInsideAvatarContext.Provider, {
|
|
110
113
|
value: true
|
|
111
114
|
}, /*#__PURE__*/React.createElement(AvatarContainer, {
|
|
112
115
|
"data-testid": testId,
|
|
113
|
-
role:
|
|
116
|
+
role: avatarContainerRole,
|
|
114
117
|
"aria-labelledby": containerShouldBeImage && !isDecorative ? labelId : undefined,
|
|
115
118
|
style: {
|
|
116
119
|
zIndex: stackIndex
|
|
@@ -118,7 +121,7 @@ var Avatar = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
118
121
|
className: ax(["_12ji1r31 _1qu2glyw _12y3idpf _1e0c1o8l _kqswh2mm"])
|
|
119
122
|
}, /*#__PURE__*/React.createElement(AvatarContentContext.Provider, {
|
|
120
123
|
value: {
|
|
121
|
-
as: getCustomElement(isDisabled, href, onClick),
|
|
124
|
+
as: contentAs || getCustomElement(isDisabled, href, onClick),
|
|
122
125
|
appearance: appearance,
|
|
123
126
|
borderColor: borderColor,
|
|
124
127
|
href: href,
|
package/dist/types/avatar.d.ts
CHANGED
|
@@ -90,6 +90,15 @@ export interface AvatarPropTypes {
|
|
|
90
90
|
* be used to wrap the element.
|
|
91
91
|
*/
|
|
92
92
|
as?: keyof JSX.IntrinsicElements | React.ComponentType<React.AllHTMLAttributes<HTMLElement>>;
|
|
93
|
+
/**
|
|
94
|
+
* Replace the wrapper of the content element. This accepts the name of a html tag which will
|
|
95
|
+
* be used to wrap the content element.
|
|
96
|
+
*/
|
|
97
|
+
contentAs?: 'a' | 'button' | 'span';
|
|
98
|
+
/**
|
|
99
|
+
* Set the role of the container element
|
|
100
|
+
*/
|
|
101
|
+
containerRole?: 'presentation' | 'img';
|
|
93
102
|
/**
|
|
94
103
|
* whether disable aria-labelledby for avatar img
|
|
95
104
|
*/
|
|
@@ -90,6 +90,15 @@ export interface AvatarPropTypes {
|
|
|
90
90
|
* be used to wrap the element.
|
|
91
91
|
*/
|
|
92
92
|
as?: keyof JSX.IntrinsicElements | React.ComponentType<React.AllHTMLAttributes<HTMLElement>>;
|
|
93
|
+
/**
|
|
94
|
+
* Replace the wrapper of the content element. This accepts the name of a html tag which will
|
|
95
|
+
* be used to wrap the content element.
|
|
96
|
+
*/
|
|
97
|
+
contentAs?: 'a' | 'button' | 'span';
|
|
98
|
+
/**
|
|
99
|
+
* Set the role of the container element
|
|
100
|
+
*/
|
|
101
|
+
containerRole?: 'presentation' | 'img';
|
|
93
102
|
/**
|
|
94
103
|
* whether disable aria-labelledby for avatar img
|
|
95
104
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/avatar",
|
|
3
|
-
"version": "25.3.
|
|
3
|
+
"version": "25.3.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/"
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@atlaskit/css": "^0.14.0",
|
|
37
37
|
"@atlaskit/ds-lib": "^5.1.0",
|
|
38
38
|
"@atlaskit/focus-ring": "^3.0.0",
|
|
39
|
-
"@atlaskit/icon": "^28.
|
|
39
|
+
"@atlaskit/icon": "^28.5.0",
|
|
40
40
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
41
41
|
"@atlaskit/primitives": "^14.15.0",
|
|
42
42
|
"@atlaskit/theme": "^21.0.0",
|