@atlaskit/avatar 21.5.2 → 21.6.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 +1083 -698
- package/dist/cjs/Avatar.js +5 -2
- package/dist/cjs/context.js +24 -0
- package/dist/cjs/index.js +13 -0
- package/dist/es2019/Avatar.js +5 -2
- package/dist/es2019/context.js +16 -0
- package/dist/es2019/index.js +1 -0
- package/dist/esm/Avatar.js +5 -2
- package/dist/esm/context.js +18 -0
- package/dist/esm/index.js +1 -0
- package/dist/types/Avatar.d.ts +2 -2
- package/dist/types/context.d.ts +20 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types-ts4.5/Avatar.d.ts +2 -2
- package/dist/types-ts4.5/context.d.ts +20 -0
- package/dist/types-ts4.5/index.d.ts +1 -0
- package/package.json +6 -6
package/dist/cjs/Avatar.js
CHANGED
|
@@ -14,6 +14,7 @@ var _analyticsNext = require("@atlaskit/analytics-next");
|
|
|
14
14
|
var _colors = require("@atlaskit/theme/colors");
|
|
15
15
|
var _AvatarImage = _interopRequireDefault(require("./AvatarImage"));
|
|
16
16
|
var _constants = require("./constants");
|
|
17
|
+
var _context = require("./context");
|
|
17
18
|
var _Presence = require("./Presence");
|
|
18
19
|
var _Status = require("./Status");
|
|
19
20
|
var _utilities = require("./utilities");
|
|
@@ -23,7 +24,7 @@ var _templateObject;
|
|
|
23
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; }
|
|
24
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; }
|
|
25
26
|
var packageName = "@atlaskit/avatar";
|
|
26
|
-
var packageVersion = "21.
|
|
27
|
+
var packageVersion = "21.6.1";
|
|
27
28
|
|
|
28
29
|
// eslint-disable-next-line @repo/internal/react/consistent-types-definitions
|
|
29
30
|
|
|
@@ -63,7 +64,7 @@ var Avatar = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
|
|
|
63
64
|
onClick = _ref2.onClick,
|
|
64
65
|
presence = _ref2.presence,
|
|
65
66
|
_ref2$size = _ref2.size,
|
|
66
|
-
|
|
67
|
+
sizeProp = _ref2$size === void 0 ? 'medium' : _ref2$size,
|
|
67
68
|
src = _ref2.src,
|
|
68
69
|
stackIndex = _ref2.stackIndex,
|
|
69
70
|
status = _ref2.status,
|
|
@@ -73,6 +74,8 @@ var Avatar = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
|
|
|
73
74
|
AvatarContainer = _ref2$as === void 0 ? 'div' : _ref2$as;
|
|
74
75
|
var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
|
|
75
76
|
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
77
|
+
var context = (0, _context.useAvatarContext)();
|
|
78
|
+
var size = (context === null || context === void 0 ? void 0 : context.size) || sizeProp;
|
|
76
79
|
var customPresenceNode = /*#__PURE__*/(0, _react.isValidElement)(presence) ? presence : null;
|
|
77
80
|
var customStatusNode = /*#__PURE__*/(0, _react.isValidElement)(status) ? status : null;
|
|
78
81
|
var isValidIconSize = size !== 'xxlarge' && size !== 'xsmall';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useAvatarContext = exports.AvatarContext = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
/**
|
|
9
|
+
* __Avatar context__
|
|
10
|
+
*
|
|
11
|
+
* This allows setting the size of all avatars under a context provider.
|
|
12
|
+
*
|
|
13
|
+
* ```tsx
|
|
14
|
+
* <AvatarContext.Provider value={{ size: 'small' }}>
|
|
15
|
+
* <Avatar
|
|
16
|
+
* // ...props
|
|
17
|
+
* />
|
|
18
|
+
* </AvatarContext.Provider>
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
var AvatarContext = exports.AvatarContext = /*#__PURE__*/(0, _react.createContext)(undefined);
|
|
22
|
+
var useAvatarContext = exports.useAvatarContext = function useAvatarContext() {
|
|
23
|
+
return (0, _react.useContext)(AvatarContext);
|
|
24
|
+
};
|
package/dist/cjs/index.js
CHANGED
|
@@ -22,6 +22,12 @@ Object.defineProperty(exports, "AVATAR_SIZES", {
|
|
|
22
22
|
return _constants.AVATAR_SIZES;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
|
+
Object.defineProperty(exports, "AvatarContext", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function get() {
|
|
28
|
+
return _context.AvatarContext;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
25
31
|
Object.defineProperty(exports, "AvatarItem", {
|
|
26
32
|
enumerable: true,
|
|
27
33
|
get: function get() {
|
|
@@ -58,9 +64,16 @@ Object.defineProperty(exports, "default", {
|
|
|
58
64
|
return _Avatar.default;
|
|
59
65
|
}
|
|
60
66
|
});
|
|
67
|
+
Object.defineProperty(exports, "useAvatarContext", {
|
|
68
|
+
enumerable: true,
|
|
69
|
+
get: function get() {
|
|
70
|
+
return _context.useAvatarContext;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
61
73
|
var _Avatar = _interopRequireDefault(require("./Avatar"));
|
|
62
74
|
var _AvatarItem = _interopRequireDefault(require("./AvatarItem"));
|
|
63
75
|
var _Presence = _interopRequireDefault(require("./Presence"));
|
|
64
76
|
var _Status = _interopRequireDefault(require("./Status"));
|
|
65
77
|
var _Skeleton = _interopRequireDefault(require("./Skeleton"));
|
|
78
|
+
var _context = require("./context");
|
|
66
79
|
var _constants = require("./constants");
|
package/dist/es2019/Avatar.js
CHANGED
|
@@ -7,11 +7,12 @@ import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
|
7
7
|
import { B300, N0, N70A } from '@atlaskit/theme/colors';
|
|
8
8
|
import AvatarImage from './AvatarImage';
|
|
9
9
|
import { ACTIVE_SCALE_FACTOR, AVATAR_RADIUS, AVATAR_SIZES, BORDER_WIDTH } from './constants';
|
|
10
|
+
import { useAvatarContext } from './context';
|
|
10
11
|
import { PresenceWrapper } from './Presence';
|
|
11
12
|
import { StatusWrapper } from './Status';
|
|
12
13
|
import { getButtonProps, getCustomElement, getLinkProps } from './utilities';
|
|
13
14
|
const packageName = "@atlaskit/avatar";
|
|
14
|
-
const packageVersion = "21.
|
|
15
|
+
const packageVersion = "21.6.1";
|
|
15
16
|
|
|
16
17
|
// eslint-disable-next-line @repo/internal/react/consistent-types-definitions
|
|
17
18
|
|
|
@@ -136,7 +137,7 @@ const Avatar = /*#__PURE__*/forwardRef(({
|
|
|
136
137
|
name,
|
|
137
138
|
onClick,
|
|
138
139
|
presence,
|
|
139
|
-
size = 'medium',
|
|
140
|
+
size: sizeProp = 'medium',
|
|
140
141
|
src,
|
|
141
142
|
stackIndex,
|
|
142
143
|
status,
|
|
@@ -147,6 +148,8 @@ const Avatar = /*#__PURE__*/forwardRef(({
|
|
|
147
148
|
const {
|
|
148
149
|
createAnalyticsEvent
|
|
149
150
|
} = useAnalyticsEvents();
|
|
151
|
+
const context = useAvatarContext();
|
|
152
|
+
const size = (context === null || context === void 0 ? void 0 : context.size) || sizeProp;
|
|
150
153
|
const customPresenceNode = /*#__PURE__*/isValidElement(presence) ? presence : null;
|
|
151
154
|
const customStatusNode = /*#__PURE__*/isValidElement(status) ? status : null;
|
|
152
155
|
const isValidIconSize = size !== 'xxlarge' && size !== 'xsmall';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* __Avatar context__
|
|
4
|
+
*
|
|
5
|
+
* This allows setting the size of all avatars under a context provider.
|
|
6
|
+
*
|
|
7
|
+
* ```tsx
|
|
8
|
+
* <AvatarContext.Provider value={{ size: 'small' }}>
|
|
9
|
+
* <Avatar
|
|
10
|
+
* // ...props
|
|
11
|
+
* />
|
|
12
|
+
* </AvatarContext.Provider>
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export const AvatarContext = /*#__PURE__*/createContext(undefined);
|
|
16
|
+
export const useAvatarContext = () => useContext(AvatarContext);
|
package/dist/es2019/index.js
CHANGED
|
@@ -4,4 +4,5 @@ export { default as AvatarItem } from './AvatarItem';
|
|
|
4
4
|
export { default as Presence } from './Presence';
|
|
5
5
|
export { default as Status } from './Status';
|
|
6
6
|
export { default as Skeleton } from './Skeleton';
|
|
7
|
+
export { AvatarContext, useAvatarContext } from './context';
|
|
7
8
|
export { AVATAR_SIZES, BORDER_WIDTH, AVATAR_RADIUS, ACTIVE_SCALE_FACTOR } from './constants';
|
package/dist/esm/Avatar.js
CHANGED
|
@@ -12,11 +12,12 @@ import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
|
12
12
|
import { B300, N0, N70A } from '@atlaskit/theme/colors';
|
|
13
13
|
import AvatarImage from './AvatarImage';
|
|
14
14
|
import { ACTIVE_SCALE_FACTOR, AVATAR_RADIUS, AVATAR_SIZES, BORDER_WIDTH } from './constants';
|
|
15
|
+
import { useAvatarContext } from './context';
|
|
15
16
|
import { PresenceWrapper } from './Presence';
|
|
16
17
|
import { StatusWrapper } from './Status';
|
|
17
18
|
import { getButtonProps, getCustomElement, getLinkProps } from './utilities';
|
|
18
19
|
var packageName = "@atlaskit/avatar";
|
|
19
|
-
var packageVersion = "21.
|
|
20
|
+
var packageVersion = "21.6.1";
|
|
20
21
|
|
|
21
22
|
// eslint-disable-next-line @repo/internal/react/consistent-types-definitions
|
|
22
23
|
|
|
@@ -56,7 +57,7 @@ var Avatar = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
56
57
|
onClick = _ref2.onClick,
|
|
57
58
|
presence = _ref2.presence,
|
|
58
59
|
_ref2$size = _ref2.size,
|
|
59
|
-
|
|
60
|
+
sizeProp = _ref2$size === void 0 ? 'medium' : _ref2$size,
|
|
60
61
|
src = _ref2.src,
|
|
61
62
|
stackIndex = _ref2.stackIndex,
|
|
62
63
|
status = _ref2.status,
|
|
@@ -66,6 +67,8 @@ var Avatar = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
66
67
|
AvatarContainer = _ref2$as === void 0 ? 'div' : _ref2$as;
|
|
67
68
|
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
68
69
|
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
70
|
+
var context = useAvatarContext();
|
|
71
|
+
var size = (context === null || context === void 0 ? void 0 : context.size) || sizeProp;
|
|
69
72
|
var customPresenceNode = /*#__PURE__*/isValidElement(presence) ? presence : null;
|
|
70
73
|
var customStatusNode = /*#__PURE__*/isValidElement(status) ? status : null;
|
|
71
74
|
var isValidIconSize = size !== 'xxlarge' && size !== 'xsmall';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* __Avatar context__
|
|
4
|
+
*
|
|
5
|
+
* This allows setting the size of all avatars under a context provider.
|
|
6
|
+
*
|
|
7
|
+
* ```tsx
|
|
8
|
+
* <AvatarContext.Provider value={{ size: 'small' }}>
|
|
9
|
+
* <Avatar
|
|
10
|
+
* // ...props
|
|
11
|
+
* />
|
|
12
|
+
* </AvatarContext.Provider>
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export var AvatarContext = /*#__PURE__*/createContext(undefined);
|
|
16
|
+
export var useAvatarContext = function useAvatarContext() {
|
|
17
|
+
return useContext(AvatarContext);
|
|
18
|
+
};
|
package/dist/esm/index.js
CHANGED
|
@@ -4,4 +4,5 @@ export { default as AvatarItem } from './AvatarItem';
|
|
|
4
4
|
export { default as Presence } from './Presence';
|
|
5
5
|
export { default as Status } from './Status';
|
|
6
6
|
export { default as Skeleton } from './Skeleton';
|
|
7
|
+
export { AvatarContext, useAvatarContext } from './context';
|
|
7
8
|
export { AVATAR_SIZES, BORDER_WIDTH, AVATAR_RADIUS, ACTIVE_SCALE_FACTOR } from './constants';
|
package/dist/types/Avatar.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import { MouseEventHandler, ReactNode, Ref } from 'react';
|
|
3
|
-
import { AppearanceType, AvatarClickEventHandler, Presence, SizeType, Status } from './types';
|
|
2
|
+
import { type MouseEventHandler, type ReactNode, type Ref } from 'react';
|
|
3
|
+
import { type AppearanceType, type AvatarClickEventHandler, type Presence, type SizeType, type Status } from './types';
|
|
4
4
|
export interface CustomAvatarProps {
|
|
5
5
|
/**
|
|
6
6
|
* This is used in render props so is okay to be defined.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type SizeType } from './types';
|
|
3
|
+
export type AvatarContextProps = {
|
|
4
|
+
size: SizeType;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* __Avatar context__
|
|
8
|
+
*
|
|
9
|
+
* This allows setting the size of all avatars under a context provider.
|
|
10
|
+
*
|
|
11
|
+
* ```tsx
|
|
12
|
+
* <AvatarContext.Provider value={{ size: 'small' }}>
|
|
13
|
+
* <Avatar
|
|
14
|
+
* // ...props
|
|
15
|
+
* />
|
|
16
|
+
* </AvatarContext.Provider>
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare const AvatarContext: import("react").Context<AvatarContextProps | undefined>;
|
|
20
|
+
export declare const useAvatarContext: () => AvatarContextProps | undefined;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -8,5 +8,6 @@ export { default as Status } from './Status';
|
|
|
8
8
|
export type { StatusProps } from './Status';
|
|
9
9
|
export { default as Skeleton } from './Skeleton';
|
|
10
10
|
export type { SkeletonProps } from './Skeleton';
|
|
11
|
+
export { AvatarContext, type AvatarContextProps, useAvatarContext, } from './context';
|
|
11
12
|
export { AVATAR_SIZES, BORDER_WIDTH, AVATAR_RADIUS, ACTIVE_SCALE_FACTOR, } from './constants';
|
|
12
13
|
export type { AvatarClickEventHandler, AppearanceType, SizeType, Presence as PresenceType, Status as StatusType, IndicatorSizeType, } from './types';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import { MouseEventHandler, ReactNode, Ref } from 'react';
|
|
3
|
-
import { AppearanceType, AvatarClickEventHandler, Presence, SizeType, Status } from './types';
|
|
2
|
+
import { type MouseEventHandler, type ReactNode, type Ref } from 'react';
|
|
3
|
+
import { type AppearanceType, type AvatarClickEventHandler, type Presence, type SizeType, type Status } from './types';
|
|
4
4
|
export interface CustomAvatarProps {
|
|
5
5
|
/**
|
|
6
6
|
* This is used in render props so is okay to be defined.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type SizeType } from './types';
|
|
3
|
+
export type AvatarContextProps = {
|
|
4
|
+
size: SizeType;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* __Avatar context__
|
|
8
|
+
*
|
|
9
|
+
* This allows setting the size of all avatars under a context provider.
|
|
10
|
+
*
|
|
11
|
+
* ```tsx
|
|
12
|
+
* <AvatarContext.Provider value={{ size: 'small' }}>
|
|
13
|
+
* <Avatar
|
|
14
|
+
* // ...props
|
|
15
|
+
* />
|
|
16
|
+
* </AvatarContext.Provider>
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare const AvatarContext: import("react").Context<AvatarContextProps | undefined>;
|
|
20
|
+
export declare const useAvatarContext: () => AvatarContextProps | undefined;
|
|
@@ -8,5 +8,6 @@ export { default as Status } from './Status';
|
|
|
8
8
|
export type { StatusProps } from './Status';
|
|
9
9
|
export { default as Skeleton } from './Skeleton';
|
|
10
10
|
export type { SkeletonProps } from './Skeleton';
|
|
11
|
+
export { AvatarContext, type AvatarContextProps, useAvatarContext, } from './context';
|
|
11
12
|
export { AVATAR_SIZES, BORDER_WIDTH, AVATAR_RADIUS, ACTIVE_SCALE_FACTOR, } from './constants';
|
|
12
13
|
export type { AvatarClickEventHandler, AppearanceType, SizeType, Presence as PresenceType, Status as StatusType, IndicatorSizeType, } from './types';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/avatar",
|
|
3
|
-
"version": "21.
|
|
3
|
+
"version": "21.6.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/"
|
|
@@ -43,10 +43,10 @@
|
|
|
43
43
|
".": "./src/index.ts"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@atlaskit/analytics-next": "^9.
|
|
46
|
+
"@atlaskit/analytics-next": "^9.3.0",
|
|
47
47
|
"@atlaskit/icon": "^22.1.0",
|
|
48
|
-
"@atlaskit/theme": "^12.
|
|
49
|
-
"@atlaskit/tokens": "^1.
|
|
48
|
+
"@atlaskit/theme": "^12.7.0",
|
|
49
|
+
"@atlaskit/tokens": "^1.45.0",
|
|
50
50
|
"@babel/runtime": "^7.0.0",
|
|
51
51
|
"@emotion/react": "^11.7.1",
|
|
52
52
|
"@emotion/serialize": "^1.1.0",
|
|
@@ -58,9 +58,9 @@
|
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@af/accessibility-testing": "*",
|
|
60
60
|
"@af/visual-regression": "*",
|
|
61
|
-
"@atlaskit/ds-lib": "^2.
|
|
61
|
+
"@atlaskit/ds-lib": "^2.3.0",
|
|
62
62
|
"@atlaskit/ssr": "*",
|
|
63
|
-
"@atlaskit/tooltip": "^18.
|
|
63
|
+
"@atlaskit/tooltip": "^18.3.0",
|
|
64
64
|
"@atlaskit/visual-regression": "*",
|
|
65
65
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
66
66
|
"@emotion/styled": "^11.0.0",
|