@atlaskit/avatar-group 9.0.2 → 9.0.4

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,18 @@
1
1
  # @atlaskit/avatar-group
2
2
 
3
+ ## 9.0.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`8cc2f888c83`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8cc2f888c83) - Upgrade Typescript from `4.3.5` to `4.5.5`
8
+
9
+ ## 9.0.3
10
+
11
+ ### Patch Changes
12
+
13
+ - [`4bc286406f2`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4bc286406f2) - [ux] Update more indicator icon to use new design tokens and remove the unnecessary use of the :after element with regards to the consumption of the Avatar component.
14
+ - Updated dependencies
15
+
3
16
  ## 9.0.2
4
17
 
5
18
  ### Patch Changes
@@ -41,7 +41,15 @@ var buttonActiveStyles = (0, _core.css)({
41
41
  backgroundColor: "var(--ds-background-selected, ".concat(_colors.B50, ")"),
42
42
  boxShadow: "0 0 0 ".concat(_avatar.BORDER_WIDTH, "px ", "var(--ds-border-selected, ".concat(_colors.B300, ")")),
43
43
  color: "var(--ds-text-selected, ".concat(_colors.B400, ")"),
44
- transform: "scale(".concat(_avatar.ACTIVE_SCALE_FACTOR, ")")
44
+ transform: "scale(".concat(_avatar.ACTIVE_SCALE_FACTOR, ")"),
45
+ '&:hover': {
46
+ backgroundColor: "var(--ds-background-selected-hovered, ".concat(_colors.N30, ")"),
47
+ color: "var(--ds-text-selected, ".concat(_colors.N500, ")")
48
+ },
49
+ '&:active': {
50
+ backgroundColor: "var(--ds-background-selected-pressed, ".concat(_colors.B50, ")"),
51
+ color: "var(--ds-text-selected, ".concat(_colors.B400, ")")
52
+ }
45
53
  }
46
54
  });
47
55
  var buttonStyles = (0, _core.css)({
@@ -53,18 +61,14 @@ var buttonStyles = (0, _core.css)({
53
61
  fontWeight: 500,
54
62
  '&:hover': {
55
63
  backgroundColor: "var(--ds-background-neutral-hovered, ".concat(_colors.N30, ")"),
56
- color: "var(--ds-text, ".concat(_colors.N500, ")"),
57
- '&:after': {
58
- backgroundColor: "var(--ds-background-neutral-hovered, ".concat(_colors.N30A, ")"),
59
- opacity: 1
60
- }
64
+ color: "var(--ds-text, ".concat(_colors.N500, ")")
61
65
  },
62
66
  '&:active': {
63
67
  backgroundColor: "var(--ds-background-neutral-pressed, ".concat(_colors.B50, ")"),
64
- color: "var(--ds-text, ".concat(_colors.B400, ")"),
65
- '&:after': {
66
- backgroundColor: 'transparent'
67
- }
68
+ color: "var(--ds-text, ".concat(_colors.B400, ")")
69
+ },
70
+ '&:after': {
71
+ display: 'none'
68
72
  }
69
73
  }
70
74
  });
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/avatar-group",
3
- "version": "9.0.2",
3
+ "version": "9.0.4",
4
4
  "sideEffects": false
5
5
  }
@@ -4,7 +4,7 @@ import _extends from "@babel/runtime/helpers/extends";
4
4
  import { forwardRef, useCallback } from 'react';
5
5
  import { css, jsx } from '@emotion/core';
6
6
  import Avatar, { ACTIVE_SCALE_FACTOR, BORDER_WIDTH } from '@atlaskit/avatar';
7
- import { B300, B400, B50, N0, N20, N30, N30A, N500 } from '@atlaskit/theme/colors';
7
+ import { B300, B400, B50, N0, N20, N30, N500 } from '@atlaskit/theme/colors';
8
8
  const FONT_SIZE = {
9
9
  xsmall: '10px',
10
10
  small: '10px',
@@ -19,7 +19,15 @@ const buttonActiveStyles = css({
19
19
  backgroundColor: `var(--ds-background-selected, ${B50})`,
20
20
  boxShadow: `0 0 0 ${BORDER_WIDTH}px ${`var(--ds-border-selected, ${B300})`}`,
21
21
  color: `var(--ds-text-selected, ${B400})`,
22
- transform: `scale(${ACTIVE_SCALE_FACTOR})`
22
+ transform: `scale(${ACTIVE_SCALE_FACTOR})`,
23
+ '&:hover': {
24
+ backgroundColor: `var(--ds-background-selected-hovered, ${N30})`,
25
+ color: `var(--ds-text-selected, ${N500})`
26
+ },
27
+ '&:active': {
28
+ backgroundColor: `var(--ds-background-selected-pressed, ${B50})`,
29
+ color: `var(--ds-text-selected, ${B400})`
30
+ }
23
31
  }
24
32
  });
25
33
  const buttonStyles = css({
@@ -31,18 +39,14 @@ const buttonStyles = css({
31
39
  fontWeight: 500,
32
40
  '&:hover': {
33
41
  backgroundColor: `var(--ds-background-neutral-hovered, ${N30})`,
34
- color: `var(--ds-text, ${N500})`,
35
- '&:after': {
36
- backgroundColor: `var(--ds-background-neutral-hovered, ${N30A})`,
37
- opacity: 1
38
- }
42
+ color: `var(--ds-text, ${N500})`
39
43
  },
40
44
  '&:active': {
41
45
  backgroundColor: `var(--ds-background-neutral-pressed, ${B50})`,
42
- color: `var(--ds-text, ${B400})`,
43
- '&:after': {
44
- backgroundColor: 'transparent'
45
- }
46
+ color: `var(--ds-text, ${B400})`
47
+ },
48
+ '&:after': {
49
+ display: 'none'
46
50
  }
47
51
  }
48
52
  });
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/avatar-group",
3
- "version": "9.0.2",
3
+ "version": "9.0.4",
4
4
  "sideEffects": false
5
5
  }
@@ -6,7 +6,7 @@ var _excluded = ["testId", "className", "ref"];
6
6
  import { forwardRef, useCallback } from 'react';
7
7
  import { css, jsx } from '@emotion/core';
8
8
  import Avatar, { ACTIVE_SCALE_FACTOR, BORDER_WIDTH } from '@atlaskit/avatar';
9
- import { B300, B400, B50, N0, N20, N30, N30A, N500 } from '@atlaskit/theme/colors';
9
+ import { B300, B400, B50, N0, N20, N30, N500 } from '@atlaskit/theme/colors';
10
10
  var FONT_SIZE = {
11
11
  xsmall: '10px',
12
12
  small: '10px',
@@ -21,7 +21,15 @@ var buttonActiveStyles = css({
21
21
  backgroundColor: "var(--ds-background-selected, ".concat(B50, ")"),
22
22
  boxShadow: "0 0 0 ".concat(BORDER_WIDTH, "px ", "var(--ds-border-selected, ".concat(B300, ")")),
23
23
  color: "var(--ds-text-selected, ".concat(B400, ")"),
24
- transform: "scale(".concat(ACTIVE_SCALE_FACTOR, ")")
24
+ transform: "scale(".concat(ACTIVE_SCALE_FACTOR, ")"),
25
+ '&:hover': {
26
+ backgroundColor: "var(--ds-background-selected-hovered, ".concat(N30, ")"),
27
+ color: "var(--ds-text-selected, ".concat(N500, ")")
28
+ },
29
+ '&:active': {
30
+ backgroundColor: "var(--ds-background-selected-pressed, ".concat(B50, ")"),
31
+ color: "var(--ds-text-selected, ".concat(B400, ")")
32
+ }
25
33
  }
26
34
  });
27
35
  var buttonStyles = css({
@@ -33,18 +41,14 @@ var buttonStyles = css({
33
41
  fontWeight: 500,
34
42
  '&:hover': {
35
43
  backgroundColor: "var(--ds-background-neutral-hovered, ".concat(N30, ")"),
36
- color: "var(--ds-text, ".concat(N500, ")"),
37
- '&:after': {
38
- backgroundColor: "var(--ds-background-neutral-hovered, ".concat(N30A, ")"),
39
- opacity: 1
40
- }
44
+ color: "var(--ds-text, ".concat(N500, ")")
41
45
  },
42
46
  '&:active': {
43
47
  backgroundColor: "var(--ds-background-neutral-pressed, ".concat(B50, ")"),
44
- color: "var(--ds-text, ".concat(B400, ")"),
45
- '&:after': {
46
- backgroundColor: 'transparent'
47
- }
48
+ color: "var(--ds-text, ".concat(B400, ")")
49
+ },
50
+ '&:after': {
51
+ display: 'none'
48
52
  }
49
53
  }
50
54
  });
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/avatar-group",
3
- "version": "9.0.2",
3
+ "version": "9.0.4",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1,12 @@
1
+ import { FC } 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: FC<AvatarGroupItemProps>;
12
+ export default AvatarGroupItem;
@@ -0,0 +1,102 @@
1
+ /** @jsx jsx */
2
+ import { ElementType, MouseEventHandler } from 'react';
3
+ import { SizeType } from '@atlaskit/avatar';
4
+ import { AvatarGroupOverrides, AvatarProps, onAvatarClickHandler } from './types';
5
+ export interface AvatarGroupProps {
6
+ /**
7
+ * Indicates the layout of the avatar-group.
8
+ * Avatars will either be overlapped in a stack, or
9
+ * laid out in an even grid formation
10
+ * Defaults to "stack".
11
+ */
12
+ appearance?: 'grid' | 'stack';
13
+ /**
14
+ * Component used to render each avatar
15
+ */
16
+ avatar?: ElementType<AvatarProps>;
17
+ /**
18
+ * The maximum number of avatars allowed in the list.
19
+ * Defaults to 5 when displayed as a stack,
20
+ * and 11 when displayed as a grid.
21
+ */
22
+ maxCount?: number;
23
+ /**
24
+ * Defines the size of the avatar.
25
+ * Defaults to "medium".
26
+ */
27
+ size?: SizeType;
28
+ /**
29
+ * Typically the background color that the avatar is presented on.
30
+ * Accepts any color argument that the CSS border-color property accepts.
31
+ */
32
+ borderColor?: string;
33
+ /**
34
+ * Array of avatar data passed to each `avatar` component.
35
+ * These props will be spread on to the component passed into avatar.
36
+ */
37
+ data: Array<AvatarProps>;
38
+ /**
39
+ * Handle the click event on the avatar item.
40
+ * Note that if an onClick prop is provided as part of avatar data, it will take precedence over onAvatarClick.
41
+ */
42
+ onAvatarClick?: onAvatarClickHandler;
43
+ /**
44
+ * Take control of the click event on the more indicator.
45
+ * This will cancel the default dropdown behavior.
46
+ */
47
+ onMoreClick?: MouseEventHandler;
48
+ /**
49
+ * Provide additional props to the MoreButton.
50
+ * Example use cases: altering tab order by providing tabIndex;
51
+ * adding onClick behaviour without losing the default dropdown
52
+ */
53
+ showMoreButtonProps?: Partial<React.HTMLAttributes<HTMLElement>>;
54
+ /**
55
+ * Element the overflow popup should be attached to.
56
+ * Defaults to "viewport".
57
+ */
58
+ boundariesElement?: 'viewport' | 'window' | 'scrollParent';
59
+ /**
60
+ * A `testId` prop is provided for specified elements,
61
+ * which is a unique string that appears as a data attribute `data-testid` in the rendered code,
62
+ * serving as a hook for automated tests.
63
+ */
64
+ /**
65
+ * Will set these elements when defined:
66
+ * - Container element - `{testId}--avatar-group`
67
+ * - Avatar items - `{testId}--avatar-{index}`
68
+ * - Overflow menu button - `{testId}--overflow-menu--trigger`
69
+ * - Overflow menu content - `{testId}--overflow-menu--content`
70
+ */
71
+ testId?: string;
72
+ /**
73
+ * Custom overrides for the composed components.
74
+ */
75
+ overrides?: AvatarGroupOverrides;
76
+ /**
77
+ * Disables tooltips
78
+ */
79
+ isTooltipDisabled?: boolean;
80
+ /**
81
+ Text to be used as aria-label for the list of avatars.
82
+ Screen reader announcement with default label, which is `avatar group`, is `list, avatar group, X items`.
83
+
84
+ The label should describe the `AvatarGroup`'s entities, for instance:
85
+ - `label="team members"`, screen reader announcement would be `list team members, X items`
86
+ - `label="reviewers"` screen reader announcement would be `list reviewers, X items`
87
+
88
+ When there are several AvatarGroups on the page you should use a unique label to let users distinguish different lists.
89
+ */
90
+ label?: string;
91
+ }
92
+ /**
93
+ * __Avatar group__
94
+ *
95
+ * An avatar group displays a number of avatars grouped together in a stack or grid.
96
+ *
97
+ * - [Examples](https://atlassian.design/components/avatar-group/examples)
98
+ * - [Code](https://atlassian.design/components/avatar-group/code)
99
+ * - [Usage](https://atlassian.design/components/avatar-group/usage)
100
+ */
101
+ declare const AvatarGroup: ({ appearance, avatar, borderColor, boundariesElement, data, isTooltipDisabled, maxCount, onAvatarClick, onMoreClick, overrides, showMoreButtonProps, size, testId, label, }: AvatarGroupProps) => JSX.Element;
102
+ export default AvatarGroup;
@@ -0,0 +1,8 @@
1
+ /** @jsx jsx */
2
+ import { FC, ReactNode } from 'react';
3
+ declare const Grid: FC<{
4
+ children: ReactNode;
5
+ testId?: string;
6
+ 'aria-label': string;
7
+ }>;
8
+ export default Grid;
@@ -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,8 @@
1
+ /** @jsx jsx */
2
+ import { FC, ReactNode } from 'react';
3
+ declare const Stack: FC<{
4
+ children: ReactNode;
5
+ testId?: string;
6
+ 'aria-label': string;
7
+ }>;
8
+ export default Stack;
@@ -0,0 +1,23 @@
1
+ import type { ElementType, ReactNode } from 'react';
2
+ import type { Interpolation } from '@emotion/core';
3
+ import type { AnalyticsEvent } from '@atlaskit/analytics-next';
4
+ import type { AvatarPropTypes } from '@atlaskit/avatar';
5
+ import type { AvatarGroupItemProps } from './avatar-group-item';
6
+ export declare type DeepRequired<T> = {
7
+ [P in keyof T]-?: Required<T[P]>;
8
+ };
9
+ export declare type AvatarProps = AvatarPropTypes & {
10
+ name: string;
11
+ enableTooltip?: boolean;
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: ElementType<AvatarProps>, props: AvatarProps, index: number) => ReactNode;
20
+ };
21
+ }
22
+ export declare type onAvatarClickHandler = (event: React.MouseEvent, analyticsEvent: AnalyticsEvent | undefined, index: number) => void;
23
+ export declare type CssCallback = (template: TemplateStringsArray, ...args: Array<Interpolation>) => string;
@@ -0,0 +1,2 @@
1
+ import { AvatarProps } from './types';
2
+ export declare const composeUniqueKey: (props: AvatarProps, index: number) => string | number;
@@ -0,0 +1,3 @@
1
+ export { default } from './components/avatar-group';
2
+ export type { AvatarGroupProps } from './components/avatar-group';
3
+ export type { AvatarProps } from './components/types';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/avatar-group",
3
- "version": "9.0.2",
3
+ "version": "9.0.4",
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/"
@@ -12,6 +12,13 @@
12
12
  "module": "dist/esm/index.js",
13
13
  "module:es2019": "dist/es2019/index.js",
14
14
  "types": "dist/types/index.d.ts",
15
+ "typesVersions": {
16
+ ">=4.0 <4.5": {
17
+ "*": [
18
+ "dist/types-ts4.0/*"
19
+ ]
20
+ }
21
+ },
15
22
  "sideEffects": false,
16
23
  "atlaskit:src": "src/index.tsx",
17
24
  "atlassian": {
@@ -29,7 +36,7 @@
29
36
  "@atlaskit/avatar": "^21.0.0",
30
37
  "@atlaskit/menu": "^1.3.0",
31
38
  "@atlaskit/popup": "^1.4.0",
32
- "@atlaskit/theme": "^12.1.0",
39
+ "@atlaskit/theme": "^12.2.0",
33
40
  "@atlaskit/tokens": "^0.10.0",
34
41
  "@atlaskit/tooltip": "^17.5.0",
35
42
  "@babel/runtime": "^7.0.0",
@@ -43,20 +50,21 @@
43
50
  "@atlaskit/button": "^16.3.0",
44
51
  "@atlaskit/code": "^14.3.0",
45
52
  "@atlaskit/docs": "*",
53
+ "@atlaskit/ds-lib": "^2.1.1",
46
54
  "@atlaskit/form": "^8.4.5",
47
55
  "@atlaskit/icon": "^21.10.0",
48
- "@atlaskit/modal-dialog": "^12.2.0",
49
- "@atlaskit/section-message": "^6.1.0",
56
+ "@atlaskit/modal-dialog": "^12.3.0",
57
+ "@atlaskit/section-message": "^6.2.0",
50
58
  "@atlaskit/ssr": "*",
51
- "@atlaskit/toggle": "^12.4.0",
59
+ "@atlaskit/toggle": "^12.5.0",
52
60
  "@atlaskit/visual-regression": "*",
53
61
  "@atlaskit/webdriver-runner": "*",
54
62
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
55
- "@emotion/styled": "^10.0.7",
56
- "@testing-library/react": "^8.0.1",
63
+ "@emotion/styled": "^11.0.0",
64
+ "@testing-library/react": "^12.1.5",
57
65
  "lodash": "^4.17.21",
58
66
  "react-dom": "^16.8.0",
59
- "typescript": "4.3.5",
67
+ "typescript": "4.5.5",
60
68
  "wait-for-expect": "^1.2.0"
61
69
  },
62
70
  "keywords": [