@atlaskit/avatar-group 9.4.4 → 9.4.6
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 +12 -0
- package/dist/types-ts4.5/components/avatar-group-item.d.ts +12 -0
- package/dist/types-ts4.5/components/avatar-group.d.ts +110 -0
- package/dist/types-ts4.5/components/grid.d.ts +8 -0
- package/dist/types-ts4.5/components/internal/components/focus-manager.d.ts +21 -0
- package/dist/types-ts4.5/components/internal/components/popup-avatar-group.d.ts +7 -0
- package/dist/types-ts4.5/components/internal/hooks/use-register-item-with-focus-manager.d.ts +4 -0
- package/dist/types-ts4.5/components/internal/utiles/handle-focus.d.ts +2 -0
- package/dist/types-ts4.5/components/more-indicator.d.ts +13 -0
- package/dist/types-ts4.5/components/stack.d.ts +8 -0
- package/dist/types-ts4.5/components/types.d.ts +27 -0
- package/dist/types-ts4.5/components/utils.d.ts +2 -0
- package/dist/types-ts4.5/index.d.ts +3 -0
- package/package.json +8 -5
- package/tmp/api-report-tmp.d.ts +80 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/avatar-group
|
|
2
2
|
|
|
3
|
+
## 9.4.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 9.4.5
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#42577](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/42577) [`d51b45b02fb`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d51b45b02fb) - Add component to push model consumption in JFE
|
|
14
|
+
|
|
3
15
|
## 9.4.4
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AvatarProps, onAvatarClickHandler } from './types';
|
|
3
|
+
export interface AvatarGroupItemProps {
|
|
4
|
+
avatar: AvatarProps;
|
|
5
|
+
isActive?: boolean;
|
|
6
|
+
isHover?: boolean;
|
|
7
|
+
index: number;
|
|
8
|
+
onAvatarClick?: onAvatarClickHandler;
|
|
9
|
+
testId?: string;
|
|
10
|
+
}
|
|
11
|
+
declare const AvatarGroupItem: React.ForwardRefExoticComponent<AvatarGroupItemProps & React.RefAttributes<HTMLElement>>;
|
|
12
|
+
export default AvatarGroupItem;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { ElementType, MouseEventHandler } from 'react';
|
|
3
|
+
import { jsx } from '@emotion/react';
|
|
4
|
+
import Avatar, { SizeType } from '@atlaskit/avatar';
|
|
5
|
+
import { PositionType } from '@atlaskit/tooltip';
|
|
6
|
+
import { AvatarGroupOverrides, AvatarProps, onAvatarClickHandler } from './types';
|
|
7
|
+
export interface AvatarGroupProps {
|
|
8
|
+
/**
|
|
9
|
+
* Indicates the layout of the avatar-group.
|
|
10
|
+
* Avatars will either be overlapped in a stack, or
|
|
11
|
+
* laid out in an even grid formation
|
|
12
|
+
* Defaults to "stack".
|
|
13
|
+
*/
|
|
14
|
+
appearance?: 'grid' | 'stack';
|
|
15
|
+
/**
|
|
16
|
+
* Component used to render each avatar
|
|
17
|
+
*/
|
|
18
|
+
avatar?: typeof Avatar | ElementType<AvatarProps>;
|
|
19
|
+
/**
|
|
20
|
+
* The maximum number of avatars allowed in the list.
|
|
21
|
+
* Defaults to 5 when displayed as a stack,
|
|
22
|
+
* and 11 when displayed as a grid.
|
|
23
|
+
*/
|
|
24
|
+
maxCount?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Defines the size of the avatar.
|
|
27
|
+
* Defaults to "medium".
|
|
28
|
+
*/
|
|
29
|
+
size?: SizeType;
|
|
30
|
+
/**
|
|
31
|
+
* Typically the background color that the avatar is presented on.
|
|
32
|
+
* Accepts any color argument that the CSS border-color property accepts.
|
|
33
|
+
*/
|
|
34
|
+
borderColor?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Array of avatar data passed to each `avatar` component.
|
|
37
|
+
* These props will be spread on to the component passed into avatar.
|
|
38
|
+
*/
|
|
39
|
+
data: Array<AvatarProps>;
|
|
40
|
+
/**
|
|
41
|
+
* Handle the click event on the avatar item.
|
|
42
|
+
* Note that if an onClick prop is provided as part of avatar data, it will take precedence over onAvatarClick.
|
|
43
|
+
*/
|
|
44
|
+
onAvatarClick?: onAvatarClickHandler;
|
|
45
|
+
/**
|
|
46
|
+
* Take control of the click event on the more indicator.
|
|
47
|
+
* This will cancel the default dropdown behavior.
|
|
48
|
+
*/
|
|
49
|
+
onMoreClick?: MouseEventHandler;
|
|
50
|
+
/**
|
|
51
|
+
* Provide additional props to the MoreButton.
|
|
52
|
+
* Example use cases: altering tab order by providing tabIndex;
|
|
53
|
+
* adding onClick behaviour without losing the default dropdown
|
|
54
|
+
*/
|
|
55
|
+
showMoreButtonProps?: Partial<React.HTMLAttributes<HTMLElement>>;
|
|
56
|
+
/**
|
|
57
|
+
* Element the overflow popup should be attached to.
|
|
58
|
+
* Defaults to "viewport".
|
|
59
|
+
*/
|
|
60
|
+
boundariesElement?: 'viewport' | 'window' | 'scrollParent';
|
|
61
|
+
/**
|
|
62
|
+
* A `testId` prop is provided for specified elements,
|
|
63
|
+
* which is a unique string that appears as a data attribute `data-testid` in the rendered code,
|
|
64
|
+
* serving as a hook for automated tests.
|
|
65
|
+
*/
|
|
66
|
+
/**
|
|
67
|
+
* Will set these elements when defined:
|
|
68
|
+
* - Container element - `{testId}--avatar-group`
|
|
69
|
+
* - Avatar items - `{testId}--avatar-{index}`
|
|
70
|
+
* - Overflow menu button - `{testId}--overflow-menu--trigger`
|
|
71
|
+
* - Overflow menu content - `{testId}--overflow-menu--content`
|
|
72
|
+
*/
|
|
73
|
+
testId?: string;
|
|
74
|
+
/**
|
|
75
|
+
* Custom overrides for the composed components.
|
|
76
|
+
*/
|
|
77
|
+
overrides?: AvatarGroupOverrides;
|
|
78
|
+
/**
|
|
79
|
+
*
|
|
80
|
+
* Where the tooltip should appear relative to its target.
|
|
81
|
+
* Defaults to tooltip position "bottom".
|
|
82
|
+
*/
|
|
83
|
+
tooltipPosition?: Extract<PositionType, 'bottom' | 'top'>;
|
|
84
|
+
/**
|
|
85
|
+
* Disables tooltips
|
|
86
|
+
*/
|
|
87
|
+
isTooltipDisabled?: boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Text to be used as aria-label for the list of avatars.
|
|
90
|
+
* Screen reader announcement with default label, which is `avatar group`, is `list, avatar group, X items`.
|
|
91
|
+
*
|
|
92
|
+
* The label should describe the `AvatarGroup`'s entities, for instance:
|
|
93
|
+
* - `label="team members"`, screen reader announcement would be `list team members, X items`
|
|
94
|
+
* - `label="reviewers"` screen reader announcement would be `list reviewers, X items`
|
|
95
|
+
*
|
|
96
|
+
* When there are several AvatarGroups on the page you should use a unique label to let users distinguish different lists.
|
|
97
|
+
*/
|
|
98
|
+
label?: string;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* __Avatar group__
|
|
102
|
+
*
|
|
103
|
+
* An avatar group displays a number of avatars grouped together in a stack or grid.
|
|
104
|
+
*
|
|
105
|
+
* - [Examples](https://atlassian.design/components/avatar-group/examples)
|
|
106
|
+
* - [Code](https://atlassian.design/components/avatar-group/code)
|
|
107
|
+
* - [Usage](https://atlassian.design/components/avatar-group/usage)
|
|
108
|
+
*/
|
|
109
|
+
declare const AvatarGroup: ({ appearance, avatar, borderColor, boundariesElement, data, isTooltipDisabled, maxCount, onAvatarClick, onMoreClick, overrides, showMoreButtonProps, size, testId, label, tooltipPosition, }: AvatarGroupProps) => jsx.JSX.Element;
|
|
110
|
+
export default AvatarGroup;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React, { FC, ReactNode } from 'react';
|
|
2
|
+
import { FocusableElement } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
* Context provider which maintains the list of focusable elements and a method to
|
|
7
|
+
* register new menu items.
|
|
8
|
+
* This list drives the keyboard navgation of the menu.
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
export declare const FocusManagerContext: React.Context<{
|
|
12
|
+
menuItemRefs: FocusableElement[];
|
|
13
|
+
registerRef: (ref: FocusableElement) => void;
|
|
14
|
+
}>;
|
|
15
|
+
/**
|
|
16
|
+
* Focus manager logic
|
|
17
|
+
*/
|
|
18
|
+
declare const FocusManager: FC<{
|
|
19
|
+
children: ReactNode;
|
|
20
|
+
}>;
|
|
21
|
+
export default FocusManager;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx } from '@emotion/react';
|
|
2
|
+
import { PopupAvatarGroupProps } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* It sets focus to the first avatar when popup is open.
|
|
5
|
+
*/
|
|
6
|
+
declare const PopupAvatarGroup: ({ maxWidth, minWidth, setInitialFocusRef, ...rest }: PopupAvatarGroupProps) => jsx.JSX.Element;
|
|
7
|
+
export default PopupAvatarGroup;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { AvatarClickEventHandler, AvatarPropTypes } from '@atlaskit/avatar';
|
|
3
|
+
export interface MoreIndicatorProps extends AvatarPropTypes {
|
|
4
|
+
count: number;
|
|
5
|
+
'aria-controls'?: string;
|
|
6
|
+
'aria-expanded'?: boolean;
|
|
7
|
+
'aria-haspopup'?: boolean;
|
|
8
|
+
buttonProps: Partial<React.HTMLAttributes<HTMLElement>>;
|
|
9
|
+
onClick: AvatarClickEventHandler;
|
|
10
|
+
isActive: boolean;
|
|
11
|
+
}
|
|
12
|
+
declare const MoreIndicator: import("react").ForwardRefExoticComponent<MoreIndicatorProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
13
|
+
export default MoreIndicator;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ElementType, ReactNode } from 'react';
|
|
2
|
+
import type { AnalyticsEvent } from '@atlaskit/analytics-next';
|
|
3
|
+
import { default as Avatar, type AvatarPropTypes } from '@atlaskit/avatar';
|
|
4
|
+
import { MenuGroupProps } from '@atlaskit/menu';
|
|
5
|
+
import { ContentProps } from '@atlaskit/popup';
|
|
6
|
+
import type { AvatarGroupItemProps } from './avatar-group-item';
|
|
7
|
+
export type DeepRequired<T> = {
|
|
8
|
+
[P in keyof T]-?: Required<T[P]>;
|
|
9
|
+
};
|
|
10
|
+
export type AvatarProps = AvatarPropTypes & {
|
|
11
|
+
name: string;
|
|
12
|
+
key?: string | number;
|
|
13
|
+
};
|
|
14
|
+
export interface AvatarGroupOverrides {
|
|
15
|
+
AvatarGroupItem?: {
|
|
16
|
+
render?: (Component: ElementType<AvatarGroupItemProps>, props: AvatarGroupItemProps, index: number) => ReactNode;
|
|
17
|
+
};
|
|
18
|
+
Avatar?: {
|
|
19
|
+
render?: (Component: typeof Avatar | ElementType<AvatarProps>, props: AvatarProps, index: number) => ReactNode;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export type onAvatarClickHandler = (event: React.MouseEvent, analyticsEvent: AnalyticsEvent | undefined, index: number) => void;
|
|
23
|
+
export type FocusableElement = HTMLAnchorElement | HTMLButtonElement;
|
|
24
|
+
export type Action = 'next' | 'prev' | 'first' | 'last';
|
|
25
|
+
export interface PopupAvatarGroupProps extends MenuGroupProps {
|
|
26
|
+
setInitialFocusRef?: ContentProps['setInitialFocusRef'];
|
|
27
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/avatar-group",
|
|
3
|
-
"version": "9.4.
|
|
3
|
+
"version": "9.4.6",
|
|
4
4
|
"description": "An avatar group displays a number of avatars grouped together in a stack or grid.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -16,6 +16,9 @@
|
|
|
16
16
|
"atlaskit:src": "src/index.tsx",
|
|
17
17
|
"atlassian": {
|
|
18
18
|
"team": "Design System Team",
|
|
19
|
+
"productPushConsumption": [
|
|
20
|
+
"jira"
|
|
21
|
+
],
|
|
19
22
|
"releaseModel": "continuous",
|
|
20
23
|
"website": {
|
|
21
24
|
"name": "Avatar group",
|
|
@@ -25,11 +28,11 @@
|
|
|
25
28
|
"dependencies": {
|
|
26
29
|
"@atlaskit/avatar": "^21.4.0",
|
|
27
30
|
"@atlaskit/ds-lib": "^2.1.0",
|
|
28
|
-
"@atlaskit/menu": "^2.
|
|
29
|
-
"@atlaskit/popup": "^1.
|
|
31
|
+
"@atlaskit/menu": "^2.1.0",
|
|
32
|
+
"@atlaskit/popup": "^1.11.0",
|
|
30
33
|
"@atlaskit/theme": "^12.6.0",
|
|
31
|
-
"@atlaskit/tokens": "^1.
|
|
32
|
-
"@atlaskit/tooltip": "^
|
|
34
|
+
"@atlaskit/tokens": "^1.28.0",
|
|
35
|
+
"@atlaskit/tooltip": "^18.0.0",
|
|
33
36
|
"@babel/runtime": "^7.0.0",
|
|
34
37
|
"@emotion/react": "^11.7.1",
|
|
35
38
|
"bind-event-listener": "^2.1.1"
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
## API Report File for "@atlaskit/avatar-group"
|
|
2
|
+
|
|
3
|
+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
|
|
7
|
+
import type { AnalyticsEvent } from '@atlaskit/analytics-next';
|
|
8
|
+
import Avatar from '@atlaskit/avatar';
|
|
9
|
+
import { AvatarPropTypes } from '@atlaskit/avatar';
|
|
10
|
+
import { default as default_2 } from '@atlaskit/avatar';
|
|
11
|
+
import { ElementType } from 'react';
|
|
12
|
+
import { jsx } from '@emotion/react';
|
|
13
|
+
import { MouseEventHandler } from 'react';
|
|
14
|
+
import { PositionType } from '@atlaskit/tooltip';
|
|
15
|
+
import type { ReactNode } from 'react';
|
|
16
|
+
import { SizeType } from '@atlaskit/avatar';
|
|
17
|
+
|
|
18
|
+
// @public
|
|
19
|
+
const AvatarGroup: ({ appearance, avatar, borderColor, boundariesElement, data, isTooltipDisabled, maxCount, onAvatarClick, onMoreClick, overrides, showMoreButtonProps, size, testId, label, tooltipPosition, }: AvatarGroupProps) => jsx.JSX.Element;
|
|
20
|
+
export default AvatarGroup;
|
|
21
|
+
|
|
22
|
+
// @public (undocumented)
|
|
23
|
+
interface AvatarGroupItemProps {
|
|
24
|
+
// (undocumented)
|
|
25
|
+
avatar: AvatarProps;
|
|
26
|
+
// (undocumented)
|
|
27
|
+
index: number;
|
|
28
|
+
// (undocumented)
|
|
29
|
+
isActive?: boolean;
|
|
30
|
+
// (undocumented)
|
|
31
|
+
isHover?: boolean;
|
|
32
|
+
// (undocumented)
|
|
33
|
+
onAvatarClick?: onAvatarClickHandler;
|
|
34
|
+
// (undocumented)
|
|
35
|
+
testId?: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// @public (undocumented)
|
|
39
|
+
interface AvatarGroupOverrides {
|
|
40
|
+
// (undocumented)
|
|
41
|
+
Avatar?: {
|
|
42
|
+
render?: (Component: ElementType<AvatarProps> | typeof default_2, props: AvatarProps, index: number) => ReactNode;
|
|
43
|
+
};
|
|
44
|
+
// (undocumented)
|
|
45
|
+
AvatarGroupItem?: {
|
|
46
|
+
render?: (Component: ElementType<AvatarGroupItemProps>, props: AvatarGroupItemProps, index: number) => ReactNode;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// @public (undocumented)
|
|
51
|
+
export interface AvatarGroupProps {
|
|
52
|
+
appearance?: 'grid' | 'stack';
|
|
53
|
+
avatar?: ElementType<AvatarProps> | typeof Avatar;
|
|
54
|
+
borderColor?: string;
|
|
55
|
+
boundariesElement?: 'scrollParent' | 'viewport' | 'window';
|
|
56
|
+
data: Array<AvatarProps>;
|
|
57
|
+
isTooltipDisabled?: boolean;
|
|
58
|
+
label?: string;
|
|
59
|
+
maxCount?: number;
|
|
60
|
+
onAvatarClick?: onAvatarClickHandler;
|
|
61
|
+
onMoreClick?: MouseEventHandler;
|
|
62
|
+
overrides?: AvatarGroupOverrides;
|
|
63
|
+
showMoreButtonProps?: Partial<React.HTMLAttributes<HTMLElement>>;
|
|
64
|
+
size?: SizeType;
|
|
65
|
+
testId?: string;
|
|
66
|
+
tooltipPosition?: Extract<PositionType, 'bottom' | 'top'>;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// @public (undocumented)
|
|
70
|
+
export type AvatarProps = AvatarPropTypes & {
|
|
71
|
+
name: string;
|
|
72
|
+
key?: number | string;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
// @public (undocumented)
|
|
76
|
+
type onAvatarClickHandler = (event: React.MouseEvent, analyticsEvent: AnalyticsEvent | undefined, index: number) => void;
|
|
77
|
+
|
|
78
|
+
// (No @packageDocumentation comment for this package)
|
|
79
|
+
|
|
80
|
+
```
|