@atlaskit/avatar 25.0.4 → 25.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/avatar
2
2
 
3
+ ## 25.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#152706](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/152706)
8
+ [`72f35bd8c908c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/72f35bd8c908c) -
9
+ Add prop to control lazy loading behaviour for avatar
10
+
11
+ ## 25.0.5
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 25.0.4
4
18
 
5
19
  ### Patch Changes
@@ -25,7 +25,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
25
25
  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; }
26
26
  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; }
27
27
  var packageName = "@atlaskit/avatar";
28
- var packageVersion = "25.0.4";
28
+ var packageVersion = "25.1.0";
29
29
  var containerStyles = null;
30
30
 
31
31
  // eslint-disable-next-line @repo/internal/react/consistent-types-definitions
@@ -60,7 +60,8 @@ var Avatar = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
60
60
  _ref$as = _ref.as,
61
61
  AvatarContainer = _ref$as === void 0 ? 'div' : _ref$as,
62
62
  _ref$isDecorative = _ref.isDecorative,
63
- isDecorative = _ref$isDecorative === void 0 ? false : _ref$isDecorative;
63
+ isDecorative = _ref$isDecorative === void 0 ? false : _ref$isDecorative,
64
+ imgLoading = _ref.imgLoading;
64
65
  var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
65
66
  createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
66
67
  var context = (0, _context.useAvatarContext)();
@@ -144,7 +145,8 @@ var Avatar = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
144
145
  src: src,
145
146
  appearance: appearance,
146
147
  size: size,
147
- testId: testId
148
+ testId: testId,
149
+ imgLoading: imgLoading
148
150
  })
149
151
  }
150
152
  }, children || /*#__PURE__*/React.createElement(_avatarContent.AvatarContent, null)), isPresence && /*#__PURE__*/React.createElement(_presence.PresenceWrapper, {
@@ -52,7 +52,8 @@ var AvatarImage = function AvatarImage(_ref) {
52
52
  src = _ref.src,
53
53
  appearance = _ref.appearance,
54
54
  size = _ref.size,
55
- testId = _ref.testId;
55
+ testId = _ref.testId,
56
+ imgLoading = _ref.imgLoading;
56
57
  var _useState = (0, _react.useState)(false),
57
58
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
58
59
  hasImageErrored = _useState2[0],
@@ -80,6 +81,7 @@ var AvatarImage = function AvatarImage(_ref) {
80
81
  }));
81
82
  }
82
83
  return /*#__PURE__*/React.createElement("img", {
84
+ loading: imgLoading,
83
85
  src: src,
84
86
  alt: alt,
85
87
  "data-testid": testId && "".concat(testId, "--image"),
@@ -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 = "25.0.4";
15
+ const packageVersion = "25.1.0";
16
16
  const containerStyles = null;
17
17
 
18
18
  // eslint-disable-next-line @repo/internal/react/consistent-types-definitions
@@ -44,7 +44,8 @@ const Avatar = /*#__PURE__*/forwardRef(({
44
44
  target,
45
45
  testId,
46
46
  as: AvatarContainer = 'div',
47
- isDecorative = false
47
+ isDecorative = false,
48
+ imgLoading
48
49
  }, ref) => {
49
50
  const {
50
51
  createAnalyticsEvent
@@ -131,7 +132,8 @@ const Avatar = /*#__PURE__*/forwardRef(({
131
132
  src: src,
132
133
  appearance: appearance,
133
134
  size: size,
134
- testId: testId
135
+ testId: testId,
136
+ imgLoading: imgLoading
135
137
  })
136
138
  }
137
139
  }, children || /*#__PURE__*/React.createElement(AvatarContent, null)), isPresence && /*#__PURE__*/React.createElement(PresenceWrapper, {
@@ -40,7 +40,8 @@ const AvatarImage = ({
40
40
  src,
41
41
  appearance,
42
42
  size,
43
- testId
43
+ testId,
44
+ imgLoading
44
45
  }) => {
45
46
  const [hasImageErrored, setHasImageErrored] = useState(false);
46
47
 
@@ -66,6 +67,7 @@ const AvatarImage = ({
66
67
  }));
67
68
  }
68
69
  return /*#__PURE__*/React.createElement("img", {
70
+ loading: imgLoading,
69
71
  src: src,
70
72
  alt: alt,
71
73
  "data-testid": testId && `${testId}--image`,
@@ -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 = "25.0.4";
18
+ var packageVersion = "25.1.0";
19
19
  var containerStyles = null;
20
20
 
21
21
  // eslint-disable-next-line @repo/internal/react/consistent-types-definitions
@@ -50,7 +50,8 @@ var Avatar = /*#__PURE__*/forwardRef(function (_ref, ref) {
50
50
  _ref$as = _ref.as,
51
51
  AvatarContainer = _ref$as === void 0 ? 'div' : _ref$as,
52
52
  _ref$isDecorative = _ref.isDecorative,
53
- isDecorative = _ref$isDecorative === void 0 ? false : _ref$isDecorative;
53
+ isDecorative = _ref$isDecorative === void 0 ? false : _ref$isDecorative,
54
+ imgLoading = _ref.imgLoading;
54
55
  var _useAnalyticsEvents = useAnalyticsEvents(),
55
56
  createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
56
57
  var context = useAvatarContext();
@@ -134,7 +135,8 @@ var Avatar = /*#__PURE__*/forwardRef(function (_ref, ref) {
134
135
  src: src,
135
136
  appearance: appearance,
136
137
  size: size,
137
- testId: testId
138
+ testId: testId,
139
+ imgLoading: imgLoading
138
140
  })
139
141
  }
140
142
  }, children || /*#__PURE__*/React.createElement(AvatarContent, null)), isPresence && /*#__PURE__*/React.createElement(PresenceWrapper, {
@@ -42,7 +42,8 @@ var AvatarImage = function AvatarImage(_ref) {
42
42
  src = _ref.src,
43
43
  appearance = _ref.appearance,
44
44
  size = _ref.size,
45
- testId = _ref.testId;
45
+ testId = _ref.testId,
46
+ imgLoading = _ref.imgLoading;
46
47
  var _useState = useState(false),
47
48
  _useState2 = _slicedToArray(_useState, 2),
48
49
  hasImageErrored = _useState2[0],
@@ -70,6 +71,7 @@ var AvatarImage = function AvatarImage(_ref) {
70
71
  }));
71
72
  }
72
73
  return /*#__PURE__*/React.createElement("img", {
74
+ loading: imgLoading,
73
75
  src: src,
74
76
  alt: alt,
75
77
  "data-testid": testId && "".concat(testId, "--image"),
@@ -94,6 +94,10 @@ export interface AvatarPropTypes {
94
94
  * whether disable aria-labelledby for avatar img
95
95
  */
96
96
  isDecorative?: boolean;
97
+ /**
98
+ * Defines the loading behaviour of the avatar image. Default value is eager.
99
+ */
100
+ imgLoading?: 'lazy' | 'eager';
97
101
  }
98
102
  /**
99
103
  * __Avatar__
@@ -10,6 +10,7 @@ interface AvatarImageProps {
10
10
  alt?: string;
11
11
  src?: string;
12
12
  testId?: string;
13
+ imgLoading?: 'lazy' | 'eager';
13
14
  }
14
15
  /**
15
16
  * __Avatar image__
@@ -94,6 +94,10 @@ export interface AvatarPropTypes {
94
94
  * whether disable aria-labelledby for avatar img
95
95
  */
96
96
  isDecorative?: boolean;
97
+ /**
98
+ * Defines the loading behaviour of the avatar image. Default value is eager.
99
+ */
100
+ imgLoading?: 'lazy' | 'eager';
97
101
  }
98
102
  /**
99
103
  * __Avatar__
@@ -10,6 +10,7 @@ interface AvatarImageProps {
10
10
  alt?: string;
11
11
  src?: string;
12
12
  testId?: string;
13
+ imgLoading?: 'lazy' | 'eager';
13
14
  }
14
15
  /**
15
16
  * __Avatar image__
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/avatar",
3
- "version": "25.0.4",
3
+ "version": "25.1.0",
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,9 +46,9 @@
46
46
  "@atlaskit/css": "^0.10.0",
47
47
  "@atlaskit/ds-lib": "^4.0.0",
48
48
  "@atlaskit/focus-ring": "^3.0.0",
49
- "@atlaskit/icon": "^25.6.0",
49
+ "@atlaskit/icon": "^26.0.0",
50
50
  "@atlaskit/platform-feature-flags": "^1.1.0",
51
- "@atlaskit/primitives": "^14.4.0",
51
+ "@atlaskit/primitives": "^14.7.0",
52
52
  "@atlaskit/theme": "^18.0.0",
53
53
  "@atlaskit/tokens": "^4.8.0",
54
54
  "@babel/runtime": "^7.0.0",