@atlaskit/avatar 21.18.4 → 23.0.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 +61 -0
- package/dist/cjs/avatar-content.js +217 -0
- package/dist/cjs/avatar.js +55 -103
- package/dist/cjs/context.js +31 -1
- package/dist/cjs/index.js +7 -0
- package/dist/cjs/{avatar-image.js → internal/avatar-image.js} +1 -1
- package/dist/cjs/{icon-wrapper.js → internal/icon-wrapper.js} +1 -1
- package/dist/cjs/presence.js +1 -1
- package/dist/cjs/status.js +1 -1
- package/dist/es2019/avatar-content.js +213 -0
- package/dist/es2019/avatar.js +38 -169
- package/dist/es2019/context.js +29 -1
- package/dist/es2019/index.js +1 -0
- package/dist/es2019/{avatar-image.js → internal/avatar-image.js} +1 -1
- package/dist/es2019/{icon-wrapper.js → internal/icon-wrapper.js} +1 -1
- package/dist/es2019/presence.js +1 -1
- package/dist/es2019/status.js +1 -1
- package/dist/esm/avatar-content.js +209 -0
- package/dist/esm/avatar.js +58 -103
- package/dist/esm/context.js +30 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/{avatar-image.js → internal/avatar-image.js} +1 -1
- package/dist/esm/{icon-wrapper.js → internal/icon-wrapper.js} +1 -1
- package/dist/esm/presence.js +1 -1
- package/dist/esm/status.js +1 -1
- package/dist/types/avatar-content.d.ts +21 -0
- package/dist/types/avatar.d.ts +2 -15
- package/dist/types/context.d.ts +33 -2
- package/dist/types/index.d.ts +2 -1
- package/dist/types/{avatar-image.d.ts → internal/avatar-image.d.ts} +1 -1
- package/dist/types/utilities.d.ts +1 -1
- package/dist/types-ts4.5/avatar-content.d.ts +21 -0
- package/dist/types-ts4.5/avatar.d.ts +2 -15
- package/dist/types-ts4.5/context.d.ts +33 -2
- package/dist/types-ts4.5/index.d.ts +2 -1
- package/dist/types-ts4.5/{avatar-image.d.ts → internal/avatar-image.d.ts} +1 -1
- package/dist/types-ts4.5/utilities.d.ts +1 -1
- package/package.json +16 -16
- /package/dist/types/{icon-wrapper.d.ts → internal/icon-wrapper.d.ts} +0 -0
- /package/dist/types-ts4.5/{icon-wrapper.d.ts → internal/icon-wrapper.d.ts} +0 -0
|
@@ -2,21 +2,8 @@
|
|
|
2
2
|
* @jsxRuntime classic
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
|
-
import { type
|
|
5
|
+
import { type ReactNode } from 'react';
|
|
6
6
|
import { type AppearanceType, type AvatarClickEventHandler, type Presence, type SizeType, type Status } from './types';
|
|
7
|
-
export interface CustomAvatarProps {
|
|
8
|
-
/**
|
|
9
|
-
* This is used in render props so is okay to be defined.
|
|
10
|
-
*/
|
|
11
|
-
'aria-label'?: string;
|
|
12
|
-
tabIndex?: number;
|
|
13
|
-
testId?: string;
|
|
14
|
-
onClick?: MouseEventHandler;
|
|
15
|
-
className?: string;
|
|
16
|
-
href?: string;
|
|
17
|
-
children: ReactNode;
|
|
18
|
-
ref: Ref<HTMLElement>;
|
|
19
|
-
}
|
|
20
7
|
export interface AvatarPropTypes {
|
|
21
8
|
/**
|
|
22
9
|
* Indicates the shape of the avatar. Most avatars are circular, but square avatars
|
|
@@ -37,7 +24,7 @@ export interface AvatarPropTypes {
|
|
|
37
24
|
/**
|
|
38
25
|
* Supply a custom avatar component instead of the default.
|
|
39
26
|
*/
|
|
40
|
-
children?:
|
|
27
|
+
children?: ReactNode;
|
|
41
28
|
/**
|
|
42
29
|
* Provides a url for avatars being used as a link.
|
|
43
30
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import { type SizeType } from './types';
|
|
1
|
+
import { type ForwardedRef, type MouseEventHandler, type ReactNode } from 'react';
|
|
2
|
+
import { type AppearanceType, type SizeType } from './types';
|
|
3
3
|
export type AvatarContextProps = {
|
|
4
4
|
size: SizeType;
|
|
5
5
|
};
|
|
@@ -18,3 +18,34 @@ export type AvatarContextProps = {
|
|
|
18
18
|
*/
|
|
19
19
|
export declare const AvatarContext: import("react").Context<AvatarContextProps | undefined>;
|
|
20
20
|
export declare const useAvatarContext: () => AvatarContextProps | undefined;
|
|
21
|
+
type AvatarContentContextProps = {
|
|
22
|
+
as: 'a' | 'button' | 'span';
|
|
23
|
+
appearance: AppearanceType;
|
|
24
|
+
avatarImage: ReactNode;
|
|
25
|
+
borderColor?: string;
|
|
26
|
+
href?: string;
|
|
27
|
+
isDisabled?: boolean;
|
|
28
|
+
label?: string;
|
|
29
|
+
onClick?: MouseEventHandler;
|
|
30
|
+
ref: ForwardedRef<HTMLElement>;
|
|
31
|
+
tabIndex?: number;
|
|
32
|
+
target?: '_blank' | '_self' | '_top' | '_parent';
|
|
33
|
+
testId?: string;
|
|
34
|
+
size: SizeType;
|
|
35
|
+
stackIndex?: number;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* __Avatar content context__
|
|
39
|
+
*
|
|
40
|
+
* This context provides the props for the AvatarContent component, enabling
|
|
41
|
+
* consumers to compose the AvatarContent with the Avatar component.
|
|
42
|
+
*/
|
|
43
|
+
export declare const AvatarContentContext: import("react").Context<AvatarContentContextProps>;
|
|
44
|
+
export declare const useAvatarContent: () => AvatarContentContextProps;
|
|
45
|
+
/**
|
|
46
|
+
* Used to ensure Avatar sub-components are used within a Avatar component,
|
|
47
|
+
* and provide a useful error message if not.
|
|
48
|
+
*/
|
|
49
|
+
export declare const EnsureIsInsideAvatarContext: import("react").Context<boolean>;
|
|
50
|
+
export declare const useEnsureIsInsideAvatar: () => void;
|
|
51
|
+
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { default } from './avatar';
|
|
2
|
-
export type { AvatarPropTypes
|
|
2
|
+
export type { AvatarPropTypes } from './avatar';
|
|
3
|
+
export { AvatarContent } from './avatar-content';
|
|
3
4
|
export { default as AvatarItem } from './avatar-item';
|
|
4
5
|
export type { AvatarItemProps, CustomAvatarItemProps } from './avatar-item';
|
|
5
6
|
export { default as Presence } from './presence';
|
|
@@ -8,4 +8,4 @@ export declare const getButtonProps: (onClick: MouseEventHandler) => {
|
|
|
8
8
|
type: string;
|
|
9
9
|
onClick: MouseEventHandler;
|
|
10
10
|
};
|
|
11
|
-
export declare const getCustomElement: (isDisabled?: boolean, href?: string, onClick?: MouseEventHandler) => "
|
|
11
|
+
export declare const getCustomElement: (isDisabled?: boolean, href?: string, onClick?: MouseEventHandler) => "a" | "button" | "span";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/avatar",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "23.0.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/"
|
|
@@ -42,36 +42,36 @@
|
|
|
42
42
|
".": "./src/index.tsx"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@atlaskit/analytics-next": "^
|
|
46
|
-
"@atlaskit/ds-lib": "^
|
|
47
|
-
"@atlaskit/focus-ring": "^
|
|
48
|
-
"@atlaskit/icon": "^
|
|
45
|
+
"@atlaskit/analytics-next": "^11.0.0",
|
|
46
|
+
"@atlaskit/ds-lib": "^4.0.0",
|
|
47
|
+
"@atlaskit/focus-ring": "^3.0.0",
|
|
48
|
+
"@atlaskit/icon": "^24.0.0",
|
|
49
49
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
50
|
-
"@atlaskit/primitives": "^
|
|
51
|
-
"@atlaskit/theme": "^
|
|
52
|
-
"@atlaskit/tokens": "^
|
|
50
|
+
"@atlaskit/primitives": "^14.0.0",
|
|
51
|
+
"@atlaskit/theme": "^17.0.0",
|
|
52
|
+
"@atlaskit/tokens": "^4.1.0",
|
|
53
53
|
"@babel/runtime": "^7.0.0",
|
|
54
54
|
"@emotion/react": "^11.7.1",
|
|
55
55
|
"@emotion/serialize": "^1.1.0"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
|
-
"react": "^
|
|
58
|
+
"react": "^18.2.0"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@af/accessibility-testing": "*",
|
|
62
62
|
"@af/integration-testing": "*",
|
|
63
63
|
"@af/visual-regression": "*",
|
|
64
|
-
"@atlaskit/button": "^
|
|
65
|
-
"@atlaskit/code": "^
|
|
64
|
+
"@atlaskit/button": "^21.1.0",
|
|
65
|
+
"@atlaskit/code": "^16.0.0",
|
|
66
66
|
"@atlaskit/docs": "*",
|
|
67
|
-
"@atlaskit/form": "^
|
|
68
|
-
"@atlaskit/heading": "^
|
|
67
|
+
"@atlaskit/form": "^12.0.0",
|
|
68
|
+
"@atlaskit/heading": "^5.0.0",
|
|
69
69
|
"@atlaskit/link": "*",
|
|
70
|
-
"@atlaskit/range": "^
|
|
70
|
+
"@atlaskit/range": "^9.0.0",
|
|
71
71
|
"@atlaskit/section-message": "*",
|
|
72
72
|
"@atlaskit/ssr": "*",
|
|
73
|
-
"@atlaskit/textfield": "^
|
|
74
|
-
"@atlaskit/tooltip": "^
|
|
73
|
+
"@atlaskit/textfield": "^8.0.0",
|
|
74
|
+
"@atlaskit/tooltip": "^20.0.0",
|
|
75
75
|
"@atlassian/feature-flags-test-utils": "*",
|
|
76
76
|
"@emotion/styled": "^11.0.0",
|
|
77
77
|
"@testing-library/react": "^13.4.0",
|
|
File without changes
|
|
File without changes
|