@atlaskit/avatar-group 10.0.2 → 10.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,21 @@
1
1
  # @atlaskit/avatar-group
2
2
 
3
+ ## 10.0.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#165798](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/165798)
8
+ [`d0ba9d90d42e5`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d0ba9d90d42e5) -
9
+ Adds side-effect config to support Compiled css extraction in third-party apps
10
+
11
+ ## 10.0.3
12
+
13
+ ### Patch Changes
14
+
15
+ - [#161302](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/161302)
16
+ [`e005ceaf960e2`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/e005ceaf960e2) -
17
+ Make some spread props explicit in internal functions and components.
18
+
3
19
  ## 10.0.2
4
20
 
5
21
  ### Patch Changes
@@ -13,35 +13,86 @@ var _avatar = _interopRequireDefault(require("@atlaskit/avatar"));
13
13
  var _mergeRefs = _interopRequireDefault(require("@atlaskit/ds-lib/merge-refs"));
14
14
  var _menu = require("@atlaskit/menu");
15
15
  var _useRegisterItemWithFocusManager = _interopRequireDefault(require("./internal/hooks/use-register-item-with-focus-manager"));
16
- var _excluded = ["href", "onClick"],
17
- _excluded2 = ["children"];
16
+ var _excluded = ["analyticsContext", "appearance", "as", "borderColor", "children", "href", "isDisabled", "key", "label", "name", "onClick", "presence", "size", "src", "stackIndex", "status", "tabIndex", "target", "testId"],
17
+ _excluded2 = ["children", "className", "disabled", "draggable", "onClick", "onDragStart", "onMouseDown", "ref", "tabIndex", "data-testid"];
18
18
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
19
19
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
20
20
  var AvatarGroupItem = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
21
21
  var avatar = props.avatar,
22
+ index = props.index,
22
23
  onAvatarClick = props.onAvatarClick,
23
- testId = props.testId,
24
- index = props.index;
25
- var href = avatar.href,
24
+ testId = props.testId;
25
+ var analyticsContext = avatar.analyticsContext,
26
+ appearance = avatar.appearance,
27
+ as = avatar.as,
28
+ borderColor = avatar.borderColor,
29
+ children = avatar.children,
30
+ href = avatar.href,
31
+ isDisabled = avatar.isDisabled,
32
+ key = avatar.key,
33
+ label = avatar.label,
34
+ name = avatar.name,
26
35
  onClick = avatar.onClick,
36
+ presence = avatar.presence,
37
+ size = avatar.size,
38
+ src = avatar.src,
39
+ stackIndex = avatar.stackIndex,
40
+ status = avatar.status,
41
+ tabIndex = avatar.tabIndex,
42
+ target = avatar.target,
43
+ groupItemTestId = avatar.testId,
27
44
  rest = (0, _objectWithoutProperties2.default)(avatar, _excluded);
28
45
  var itemRef = (0, _useRegisterItemWithFocusManager.default)();
29
46
  var CustomComponent = function CustomComponent(_ref) {
30
47
  var children = _ref.children,
48
+ className = _ref.className,
49
+ disabled = _ref.disabled,
50
+ draggable = _ref.draggable,
51
+ onClick = _ref.onClick,
52
+ onDragStart = _ref.onDragStart,
53
+ onMouseDown = _ref.onMouseDown,
54
+ ref = _ref.ref,
55
+ tabIndex = _ref.tabIndex,
56
+ testId = _ref['data-testid'],
31
57
  props = (0, _objectWithoutProperties2.default)(_ref, _excluded2);
32
58
  return (
33
59
  /*#__PURE__*/
34
60
  // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
35
61
  _react.default.createElement("button", (0, _extends2.default)({
36
62
  type: "button"
63
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
64
+ ,
65
+ className: className,
66
+ disabled: disabled,
67
+ draggable: draggable,
68
+ onClick: onClick
69
+ // eslint-disable-next-line @atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop
70
+ ,
71
+ onDragStart: onDragStart,
72
+ onMouseDown: onMouseDown,
73
+ ref: ref,
74
+ tabIndex: tabIndex,
75
+ "data-testid": testId
76
+ // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
37
77
  }, props), children)
38
78
  );
39
79
  };
40
80
  var AvatarIcon = /*#__PURE__*/_react.default.createElement(_avatar.default, (0, _extends2.default)({}, rest, {
41
- testId: testId && "".concat(testId, "--avatar"),
81
+ analyticsContext: analyticsContext,
82
+ appearance: appearance,
83
+ as: as,
42
84
  borderColor: "transparent",
85
+ children: children,
86
+ isDisabled: isDisabled,
87
+ label: label,
88
+ name: "",
89
+ presence: presence,
43
90
  size: "small",
44
- name: ""
91
+ src: src,
92
+ stackIndex: stackIndex,
93
+ status: status,
94
+ tabIndex: tabIndex,
95
+ testId: testId && "".concat(testId, "--avatar")
45
96
  }));
46
97
 
47
98
  // onClick handler provided with avatar data takes precedence, same as with the normal avatar item
@@ -50,14 +101,14 @@ var AvatarGroupItem = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
50
101
  return /*#__PURE__*/_react.default.createElement(_menu.LinkItem, {
51
102
  ref: (0, _mergeRefs.default)([ref, itemRef]),
52
103
  href: href,
53
- target: avatar.target,
54
- rel: avatar.target === '_blank' ? 'noopener noreferrer' : undefined,
104
+ target: target,
105
+ rel: target === '_blank' ? 'noopener noreferrer' : undefined,
55
106
  iconBefore: AvatarIcon,
56
107
  testId: testId,
57
108
  onClick: function onClick(event) {
58
109
  return callback && callback(event, undefined, index);
59
110
  }
60
- }, avatar.name);
111
+ }, name);
61
112
  }
62
113
  if (typeof callback === 'function') {
63
114
  return /*#__PURE__*/_react.default.createElement(_menu.ButtonItem, {
@@ -67,13 +118,13 @@ var AvatarGroupItem = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
67
118
  },
68
119
  iconBefore: AvatarIcon,
69
120
  testId: testId
70
- }, avatar.name);
121
+ }, name);
71
122
  }
72
123
  return /*#__PURE__*/_react.default.createElement(_menu.CustomItem, {
73
124
  iconBefore: AvatarIcon,
74
125
  component: CustomComponent,
75
126
  testId: testId
76
- }, avatar.name);
127
+ }, name);
77
128
  });
78
129
 
79
130
  // eslint-disable-next-line @repo/internal/react/require-jsdoc
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
8
9
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
11
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
@@ -26,6 +27,7 @@ var _popupAvatarGroup = _interopRequireDefault(require("./internal/components/po
26
27
  var _moreIndicator = _interopRequireDefault(require("./more-indicator"));
27
28
  var _stack = _interopRequireDefault(require("./stack"));
28
29
  var _utils = require("./utils");
30
+ var _excluded = ["aria-controls", "aria-expanded", "aria-haspopup", "onClick"];
29
31
  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; }
30
32
  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; } /**
31
33
  * @jsxRuntime classic
@@ -161,7 +163,12 @@ var AvatarGroup = function AvatarGroup(_ref) {
161
163
  if (total <= max) {
162
164
  return null;
163
165
  }
164
- var renderMoreButton = function renderMoreButton(props) {
166
+ var renderMoreButton = function renderMoreButton(_ref3) {
167
+ var ariaControls = _ref3['aria-controls'],
168
+ ariaExpanded = _ref3['aria-expanded'],
169
+ ariaHasPopup = _ref3['aria-haspopup'],
170
+ onClick = _ref3.onClick,
171
+ props = (0, _objectWithoutProperties2.default)(_ref3, _excluded);
165
172
  return (0, _react2.jsx)(_moreIndicator.default, (0, _extends2.default)({
166
173
  buttonProps: showMoreButtonProps,
167
174
  borderColor: borderColor,
@@ -169,7 +176,13 @@ var AvatarGroup = function AvatarGroup(_ref) {
169
176
  size: size,
170
177
  testId: testId && "".concat(testId, "--overflow-menu--trigger"),
171
178
  isActive: isOpen
172
- }, props));
179
+ // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
180
+ }, props, {
181
+ "aria-controls": ariaControls,
182
+ "aria-expanded": ariaExpanded,
183
+ "aria-haspopup": ariaHasPopup,
184
+ onClick: onClick
185
+ }));
173
186
  };
174
187
 
175
188
  // bail if the consumer wants to handle onClick
@@ -196,8 +209,8 @@ var AvatarGroup = function AvatarGroup(_ref) {
196
209
  shouldFlip: true,
197
210
  zIndex: _constants.layers.modal(),
198
211
  shouldRenderToParent: shouldPopupRenderToParent,
199
- content: function content(_ref3) {
200
- var setInitialFocusRef = _ref3.setInitialFocusRef;
212
+ content: function content(_ref4) {
213
+ var setInitialFocusRef = _ref4.setInitialFocusRef;
201
214
  return (0, _react2.jsx)(_focusManager.default, null, (0, _react2.jsx)(_popupAvatarGroup.default, {
202
215
  onClick: function onClick(e) {
203
216
  return e.stopPropagation();
@@ -11,7 +11,7 @@ var _react = require("react");
11
11
  var _react2 = require("@emotion/react");
12
12
  var _menu = require("@atlaskit/menu");
13
13
  var _focusManager = require("./focus-manager");
14
- var _excluded = ["maxWidth", "minWidth", "setInitialFocusRef"];
14
+ var _excluded = ["children", "isLoading", "maxHeight", "maxWidth", "minHeight", "minWidth", "onClick", "role", "setInitialFocusRef", "spacing", "testId"];
15
15
  /**
16
16
  * @jsxRuntime classic
17
17
  * @jsx jsx
@@ -20,23 +20,36 @@ var _excluded = ["maxWidth", "minWidth", "setInitialFocusRef"];
20
20
  * It sets focus to the first avatar when popup is open.
21
21
  */
22
22
  var PopupAvatarGroup = function PopupAvatarGroup(_ref) {
23
- var _ref$maxWidth = _ref.maxWidth,
23
+ var children = _ref.children,
24
+ isLoading = _ref.isLoading,
25
+ maxHeight = _ref.maxHeight,
26
+ _ref$maxWidth = _ref.maxWidth,
24
27
  maxWidth = _ref$maxWidth === void 0 ? 800 : _ref$maxWidth,
28
+ minHeight = _ref.minHeight,
25
29
  _ref$minWidth = _ref.minWidth,
26
30
  minWidth = _ref$minWidth === void 0 ? 320 : _ref$minWidth,
31
+ onClick = _ref.onClick,
32
+ role = _ref.role,
27
33
  setInitialFocusRef = _ref.setInitialFocusRef,
34
+ spacing = _ref.spacing,
35
+ testId = _ref.testId,
28
36
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
29
37
  var _useContext = (0, _react.useContext)(_focusManager.FocusManagerContext),
30
38
  menuItemRefs = _useContext.menuItemRefs;
31
39
  (0, _react.useEffect)(function () {
32
40
  setInitialFocusRef === null || setInitialFocusRef === void 0 || setInitialFocusRef(menuItemRefs[0]);
33
41
  }, [menuItemRefs, setInitialFocusRef]);
34
- return (
42
+ return (0, _react2.jsx)(_menu.MenuGroup, (0, _extends2.default)({
43
+ isLoading: isLoading,
44
+ maxHeight: maxHeight,
45
+ maxWidth: maxWidth,
46
+ minHeight: minHeight,
47
+ minWidth: minWidth,
48
+ onClick: onClick,
49
+ role: role,
50
+ spacing: spacing,
51
+ testId: testId
35
52
  // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
36
- (0, _react2.jsx)(_menu.MenuGroup, (0, _extends2.default)({
37
- maxWidth: maxWidth,
38
- minWidth: minWidth
39
- }, rest))
40
- );
53
+ }, rest), children);
41
54
  };
42
55
  var _default = exports.default = PopupAvatarGroup;
@@ -53,27 +53,27 @@ function handleFocus(refs) {
53
53
  if (currentFocusedIdx < refs.length - 1) {
54
54
  e.preventDefault();
55
55
  var _nextFocusableElement = getNextFocusableElement(refs, currentFocusedIdx);
56
- _nextFocusableElement && _nextFocusableElement.focus();
56
+ _nextFocusableElement === null || _nextFocusableElement === void 0 || _nextFocusableElement.focus();
57
57
  }
58
58
  break;
59
59
  case 'prev':
60
60
  if (currentFocusedIdx > 0) {
61
61
  e.preventDefault();
62
62
  var _prevFocusableElement = getPrevFocusableElement(refs, currentFocusedIdx);
63
- _prevFocusableElement && _prevFocusableElement.focus();
63
+ _prevFocusableElement === null || _prevFocusableElement === void 0 || _prevFocusableElement.focus();
64
64
  }
65
65
  break;
66
66
  case 'first':
67
67
  e.preventDefault();
68
68
  // Search for first non-disabled element if first element is disabled
69
69
  var nextFocusableElement = getNextFocusableElement(refs, -1);
70
- nextFocusableElement && nextFocusableElement.focus();
70
+ nextFocusableElement === null || nextFocusableElement === void 0 || nextFocusableElement.focus();
71
71
  break;
72
72
  case 'last':
73
73
  e.preventDefault();
74
74
  // Search for last non-disabled element if last element is disabled
75
75
  var prevFocusableElement = getPrevFocusableElement(refs, refs.length);
76
- prevFocusableElement && prevFocusableElement.focus();
76
+ prevFocusableElement === null || prevFocusableElement === void 0 || prevFocusableElement.focus();
77
77
  break;
78
78
  default:
79
79
  return;
@@ -7,18 +7,44 @@ import useRegisterItemWithFocusManager from './internal/hooks/use-register-item-
7
7
  const AvatarGroupItem = /*#__PURE__*/forwardRef((props, ref) => {
8
8
  const {
9
9
  avatar,
10
+ index,
10
11
  onAvatarClick,
11
- testId,
12
- index
12
+ testId
13
13
  } = props;
14
14
  const {
15
+ analyticsContext,
16
+ appearance,
17
+ as,
18
+ borderColor,
19
+ children,
15
20
  href,
21
+ isDisabled,
22
+ key,
23
+ label,
24
+ name,
16
25
  onClick,
26
+ presence,
27
+ size,
28
+ src,
29
+ stackIndex,
30
+ status,
31
+ tabIndex,
32
+ target,
33
+ testId: groupItemTestId,
17
34
  ...rest
18
35
  } = avatar;
19
36
  const itemRef = useRegisterItemWithFocusManager();
20
37
  const CustomComponent = ({
21
38
  children,
39
+ className,
40
+ disabled,
41
+ draggable,
42
+ onClick,
43
+ onDragStart,
44
+ onMouseDown,
45
+ ref,
46
+ tabIndex,
47
+ 'data-testid': testId,
22
48
  ...props
23
49
  }) => {
24
50
  return (
@@ -26,14 +52,39 @@ const AvatarGroupItem = /*#__PURE__*/forwardRef((props, ref) => {
26
52
  // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
27
53
  React.createElement("button", _extends({
28
54
  type: "button"
55
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
56
+ ,
57
+ className: className,
58
+ disabled: disabled,
59
+ draggable: draggable,
60
+ onClick: onClick
61
+ // eslint-disable-next-line @atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop
62
+ ,
63
+ onDragStart: onDragStart,
64
+ onMouseDown: onMouseDown,
65
+ ref: ref,
66
+ tabIndex: tabIndex,
67
+ "data-testid": testId
68
+ // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
29
69
  }, props), children)
30
70
  );
31
71
  };
32
72
  const AvatarIcon = /*#__PURE__*/React.createElement(Avatar, _extends({}, rest, {
33
- testId: testId && `${testId}--avatar`,
73
+ analyticsContext: analyticsContext,
74
+ appearance: appearance,
75
+ as: as,
34
76
  borderColor: "transparent",
77
+ children: children,
78
+ isDisabled: isDisabled,
79
+ label: label,
80
+ name: "",
81
+ presence: presence,
35
82
  size: "small",
36
- name: ""
83
+ src: src,
84
+ stackIndex: stackIndex,
85
+ status: status,
86
+ tabIndex: tabIndex,
87
+ testId: testId && `${testId}--avatar`
37
88
  }));
38
89
 
39
90
  // onClick handler provided with avatar data takes precedence, same as with the normal avatar item
@@ -42,12 +93,12 @@ const AvatarGroupItem = /*#__PURE__*/forwardRef((props, ref) => {
42
93
  return /*#__PURE__*/React.createElement(LinkItem, {
43
94
  ref: mergeRefs([ref, itemRef]),
44
95
  href: href,
45
- target: avatar.target,
46
- rel: avatar.target === '_blank' ? 'noopener noreferrer' : undefined,
96
+ target: target,
97
+ rel: target === '_blank' ? 'noopener noreferrer' : undefined,
47
98
  iconBefore: AvatarIcon,
48
99
  testId: testId,
49
100
  onClick: event => callback && callback(event, undefined, index)
50
- }, avatar.name);
101
+ }, name);
51
102
  }
52
103
  if (typeof callback === 'function') {
53
104
  return /*#__PURE__*/React.createElement(ButtonItem, {
@@ -55,13 +106,13 @@ const AvatarGroupItem = /*#__PURE__*/forwardRef((props, ref) => {
55
106
  onClick: event => callback && callback(event, undefined, index),
56
107
  iconBefore: AvatarIcon,
57
108
  testId: testId
58
- }, avatar.name);
109
+ }, name);
59
110
  }
60
111
  return /*#__PURE__*/React.createElement(CustomItem, {
61
112
  iconBefore: AvatarIcon,
62
113
  component: CustomComponent,
63
114
  testId: testId
64
- }, avatar.name);
115
+ }, name);
65
116
  });
66
117
 
67
118
  // eslint-disable-next-line @repo/internal/react/require-jsdoc
@@ -135,14 +135,26 @@ const AvatarGroup = ({
135
135
  if (total <= max) {
136
136
  return null;
137
137
  }
138
- const renderMoreButton = props => jsx(MoreIndicator, _extends({
138
+ const renderMoreButton = ({
139
+ 'aria-controls': ariaControls,
140
+ 'aria-expanded': ariaExpanded,
141
+ 'aria-haspopup': ariaHasPopup,
142
+ onClick,
143
+ ...props
144
+ }) => jsx(MoreIndicator, _extends({
139
145
  buttonProps: showMoreButtonProps,
140
146
  borderColor: borderColor,
141
147
  count: total - max,
142
148
  size: size,
143
149
  testId: testId && `${testId}--overflow-menu--trigger`,
144
150
  isActive: isOpen
145
- }, props));
151
+ // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
152
+ }, props, {
153
+ "aria-controls": ariaControls,
154
+ "aria-expanded": ariaExpanded,
155
+ "aria-haspopup": ariaHasPopup,
156
+ onClick: onClick
157
+ }));
146
158
 
147
159
  // bail if the consumer wants to handle onClick
148
160
  if (typeof onMoreClick === 'function') {
@@ -12,9 +12,17 @@ import { FocusManagerContext } from './focus-manager';
12
12
  * It sets focus to the first avatar when popup is open.
13
13
  */
14
14
  const PopupAvatarGroup = ({
15
+ children,
16
+ isLoading,
17
+ maxHeight,
15
18
  maxWidth = 800,
19
+ minHeight,
16
20
  minWidth = 320,
21
+ onClick,
22
+ role,
17
23
  setInitialFocusRef,
24
+ spacing,
25
+ testId,
18
26
  ...rest
19
27
  }) => {
20
28
  const {
@@ -23,12 +31,17 @@ const PopupAvatarGroup = ({
23
31
  useEffect(() => {
24
32
  setInitialFocusRef === null || setInitialFocusRef === void 0 ? void 0 : setInitialFocusRef(menuItemRefs[0]);
25
33
  }, [menuItemRefs, setInitialFocusRef]);
26
- return (
34
+ return jsx(MenuGroup, _extends({
35
+ isLoading: isLoading,
36
+ maxHeight: maxHeight,
37
+ maxWidth: maxWidth,
38
+ minHeight: minHeight,
39
+ minWidth: minWidth,
40
+ onClick: onClick,
41
+ role: role,
42
+ spacing: spacing,
43
+ testId: testId
27
44
  // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
28
- jsx(MenuGroup, _extends({
29
- maxWidth: maxWidth,
30
- minWidth: minWidth
31
- }, rest))
32
- );
45
+ }, rest), children);
33
46
  };
34
47
  export default PopupAvatarGroup;
@@ -49,27 +49,27 @@ export default function handleFocus(refs) {
49
49
  if (currentFocusedIdx < refs.length - 1) {
50
50
  e.preventDefault();
51
51
  const nextFocusableElement = getNextFocusableElement(refs, currentFocusedIdx);
52
- nextFocusableElement && nextFocusableElement.focus();
52
+ nextFocusableElement === null || nextFocusableElement === void 0 ? void 0 : nextFocusableElement.focus();
53
53
  }
54
54
  break;
55
55
  case 'prev':
56
56
  if (currentFocusedIdx > 0) {
57
57
  e.preventDefault();
58
58
  const prevFocusableElement = getPrevFocusableElement(refs, currentFocusedIdx);
59
- prevFocusableElement && prevFocusableElement.focus();
59
+ prevFocusableElement === null || prevFocusableElement === void 0 ? void 0 : prevFocusableElement.focus();
60
60
  }
61
61
  break;
62
62
  case 'first':
63
63
  e.preventDefault();
64
64
  // Search for first non-disabled element if first element is disabled
65
65
  const nextFocusableElement = getNextFocusableElement(refs, -1);
66
- nextFocusableElement && nextFocusableElement.focus();
66
+ nextFocusableElement === null || nextFocusableElement === void 0 ? void 0 : nextFocusableElement.focus();
67
67
  break;
68
68
  case 'last':
69
69
  e.preventDefault();
70
70
  // Search for last non-disabled element if last element is disabled
71
71
  const prevFocusableElement = getPrevFocusableElement(refs, refs.length);
72
- prevFocusableElement && prevFocusableElement.focus();
72
+ prevFocusableElement === null || prevFocusableElement === void 0 ? void 0 : prevFocusableElement.focus();
73
73
  break;
74
74
  default:
75
75
  return;
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["href", "onClick"],
4
- _excluded2 = ["children"];
3
+ var _excluded = ["analyticsContext", "appearance", "as", "borderColor", "children", "href", "isDisabled", "key", "label", "name", "onClick", "presence", "size", "src", "stackIndex", "status", "tabIndex", "target", "testId"],
4
+ _excluded2 = ["children", "className", "disabled", "draggable", "onClick", "onDragStart", "onMouseDown", "ref", "tabIndex", "data-testid"];
5
5
  import React, { forwardRef } from 'react';
6
6
  import Avatar from '@atlaskit/avatar';
7
7
  import mergeRefs from '@atlaskit/ds-lib/merge-refs';
@@ -9,29 +9,80 @@ import { ButtonItem, CustomItem, LinkItem } from '@atlaskit/menu';
9
9
  import useRegisterItemWithFocusManager from './internal/hooks/use-register-item-with-focus-manager';
10
10
  var AvatarGroupItem = /*#__PURE__*/forwardRef(function (props, ref) {
11
11
  var avatar = props.avatar,
12
+ index = props.index,
12
13
  onAvatarClick = props.onAvatarClick,
13
- testId = props.testId,
14
- index = props.index;
15
- var href = avatar.href,
14
+ testId = props.testId;
15
+ var analyticsContext = avatar.analyticsContext,
16
+ appearance = avatar.appearance,
17
+ as = avatar.as,
18
+ borderColor = avatar.borderColor,
19
+ children = avatar.children,
20
+ href = avatar.href,
21
+ isDisabled = avatar.isDisabled,
22
+ key = avatar.key,
23
+ label = avatar.label,
24
+ name = avatar.name,
16
25
  onClick = avatar.onClick,
26
+ presence = avatar.presence,
27
+ size = avatar.size,
28
+ src = avatar.src,
29
+ stackIndex = avatar.stackIndex,
30
+ status = avatar.status,
31
+ tabIndex = avatar.tabIndex,
32
+ target = avatar.target,
33
+ groupItemTestId = avatar.testId,
17
34
  rest = _objectWithoutProperties(avatar, _excluded);
18
35
  var itemRef = useRegisterItemWithFocusManager();
19
36
  var CustomComponent = function CustomComponent(_ref) {
20
37
  var children = _ref.children,
38
+ className = _ref.className,
39
+ disabled = _ref.disabled,
40
+ draggable = _ref.draggable,
41
+ onClick = _ref.onClick,
42
+ onDragStart = _ref.onDragStart,
43
+ onMouseDown = _ref.onMouseDown,
44
+ ref = _ref.ref,
45
+ tabIndex = _ref.tabIndex,
46
+ testId = _ref['data-testid'],
21
47
  props = _objectWithoutProperties(_ref, _excluded2);
22
48
  return (
23
49
  /*#__PURE__*/
24
50
  // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
25
51
  React.createElement("button", _extends({
26
52
  type: "button"
53
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
54
+ ,
55
+ className: className,
56
+ disabled: disabled,
57
+ draggable: draggable,
58
+ onClick: onClick
59
+ // eslint-disable-next-line @atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop
60
+ ,
61
+ onDragStart: onDragStart,
62
+ onMouseDown: onMouseDown,
63
+ ref: ref,
64
+ tabIndex: tabIndex,
65
+ "data-testid": testId
66
+ // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
27
67
  }, props), children)
28
68
  );
29
69
  };
30
70
  var AvatarIcon = /*#__PURE__*/React.createElement(Avatar, _extends({}, rest, {
31
- testId: testId && "".concat(testId, "--avatar"),
71
+ analyticsContext: analyticsContext,
72
+ appearance: appearance,
73
+ as: as,
32
74
  borderColor: "transparent",
75
+ children: children,
76
+ isDisabled: isDisabled,
77
+ label: label,
78
+ name: "",
79
+ presence: presence,
33
80
  size: "small",
34
- name: ""
81
+ src: src,
82
+ stackIndex: stackIndex,
83
+ status: status,
84
+ tabIndex: tabIndex,
85
+ testId: testId && "".concat(testId, "--avatar")
35
86
  }));
36
87
 
37
88
  // onClick handler provided with avatar data takes precedence, same as with the normal avatar item
@@ -40,14 +91,14 @@ var AvatarGroupItem = /*#__PURE__*/forwardRef(function (props, ref) {
40
91
  return /*#__PURE__*/React.createElement(LinkItem, {
41
92
  ref: mergeRefs([ref, itemRef]),
42
93
  href: href,
43
- target: avatar.target,
44
- rel: avatar.target === '_blank' ? 'noopener noreferrer' : undefined,
94
+ target: target,
95
+ rel: target === '_blank' ? 'noopener noreferrer' : undefined,
45
96
  iconBefore: AvatarIcon,
46
97
  testId: testId,
47
98
  onClick: function onClick(event) {
48
99
  return callback && callback(event, undefined, index);
49
100
  }
50
- }, avatar.name);
101
+ }, name);
51
102
  }
52
103
  if (typeof callback === 'function') {
53
104
  return /*#__PURE__*/React.createElement(ButtonItem, {
@@ -57,13 +108,13 @@ var AvatarGroupItem = /*#__PURE__*/forwardRef(function (props, ref) {
57
108
  },
58
109
  iconBefore: AvatarIcon,
59
110
  testId: testId
60
- }, avatar.name);
111
+ }, name);
61
112
  }
62
113
  return /*#__PURE__*/React.createElement(CustomItem, {
63
114
  iconBefore: AvatarIcon,
64
115
  component: CustomComponent,
65
116
  testId: testId
66
- }, avatar.name);
117
+ }, name);
67
118
  });
68
119
 
69
120
  // eslint-disable-next-line @repo/internal/react/require-jsdoc
@@ -1,6 +1,8 @@
1
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
1
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
3
  import _extends from "@babel/runtime/helpers/extends";
3
4
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
5
+ var _excluded = ["aria-controls", "aria-expanded", "aria-haspopup", "onClick"];
4
6
  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; }
5
7
  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) { _defineProperty(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; }
6
8
  /**
@@ -155,7 +157,12 @@ var AvatarGroup = function AvatarGroup(_ref) {
155
157
  if (total <= max) {
156
158
  return null;
157
159
  }
158
- var renderMoreButton = function renderMoreButton(props) {
160
+ var renderMoreButton = function renderMoreButton(_ref3) {
161
+ var ariaControls = _ref3['aria-controls'],
162
+ ariaExpanded = _ref3['aria-expanded'],
163
+ ariaHasPopup = _ref3['aria-haspopup'],
164
+ onClick = _ref3.onClick,
165
+ props = _objectWithoutProperties(_ref3, _excluded);
159
166
  return jsx(MoreIndicator, _extends({
160
167
  buttonProps: showMoreButtonProps,
161
168
  borderColor: borderColor,
@@ -163,7 +170,13 @@ var AvatarGroup = function AvatarGroup(_ref) {
163
170
  size: size,
164
171
  testId: testId && "".concat(testId, "--overflow-menu--trigger"),
165
172
  isActive: isOpen
166
- }, props));
173
+ // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
174
+ }, props, {
175
+ "aria-controls": ariaControls,
176
+ "aria-expanded": ariaExpanded,
177
+ "aria-haspopup": ariaHasPopup,
178
+ onClick: onClick
179
+ }));
167
180
  };
168
181
 
169
182
  // bail if the consumer wants to handle onClick
@@ -190,8 +203,8 @@ var AvatarGroup = function AvatarGroup(_ref) {
190
203
  shouldFlip: true,
191
204
  zIndex: layers.modal(),
192
205
  shouldRenderToParent: shouldPopupRenderToParent,
193
- content: function content(_ref3) {
194
- var setInitialFocusRef = _ref3.setInitialFocusRef;
206
+ content: function content(_ref4) {
207
+ var setInitialFocusRef = _ref4.setInitialFocusRef;
195
208
  return jsx(FocusManager, null, jsx(PopupAvatarGroup, {
196
209
  onClick: function onClick(e) {
197
210
  return e.stopPropagation();
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["maxWidth", "minWidth", "setInitialFocusRef"];
3
+ var _excluded = ["children", "isLoading", "maxHeight", "maxWidth", "minHeight", "minWidth", "onClick", "role", "setInitialFocusRef", "spacing", "testId"];
4
4
  /**
5
5
  * @jsxRuntime classic
6
6
  * @jsx jsx
@@ -14,23 +14,36 @@ import { FocusManagerContext } from './focus-manager';
14
14
  * It sets focus to the first avatar when popup is open.
15
15
  */
16
16
  var PopupAvatarGroup = function PopupAvatarGroup(_ref) {
17
- var _ref$maxWidth = _ref.maxWidth,
17
+ var children = _ref.children,
18
+ isLoading = _ref.isLoading,
19
+ maxHeight = _ref.maxHeight,
20
+ _ref$maxWidth = _ref.maxWidth,
18
21
  maxWidth = _ref$maxWidth === void 0 ? 800 : _ref$maxWidth,
22
+ minHeight = _ref.minHeight,
19
23
  _ref$minWidth = _ref.minWidth,
20
24
  minWidth = _ref$minWidth === void 0 ? 320 : _ref$minWidth,
25
+ onClick = _ref.onClick,
26
+ role = _ref.role,
21
27
  setInitialFocusRef = _ref.setInitialFocusRef,
28
+ spacing = _ref.spacing,
29
+ testId = _ref.testId,
22
30
  rest = _objectWithoutProperties(_ref, _excluded);
23
31
  var _useContext = useContext(FocusManagerContext),
24
32
  menuItemRefs = _useContext.menuItemRefs;
25
33
  useEffect(function () {
26
34
  setInitialFocusRef === null || setInitialFocusRef === void 0 || setInitialFocusRef(menuItemRefs[0]);
27
35
  }, [menuItemRefs, setInitialFocusRef]);
28
- return (
36
+ return jsx(MenuGroup, _extends({
37
+ isLoading: isLoading,
38
+ maxHeight: maxHeight,
39
+ maxWidth: maxWidth,
40
+ minHeight: minHeight,
41
+ minWidth: minWidth,
42
+ onClick: onClick,
43
+ role: role,
44
+ spacing: spacing,
45
+ testId: testId
29
46
  // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
30
- jsx(MenuGroup, _extends({
31
- maxWidth: maxWidth,
32
- minWidth: minWidth
33
- }, rest))
34
- );
47
+ }, rest), children);
35
48
  };
36
49
  export default PopupAvatarGroup;
@@ -46,27 +46,27 @@ export default function handleFocus(refs) {
46
46
  if (currentFocusedIdx < refs.length - 1) {
47
47
  e.preventDefault();
48
48
  var _nextFocusableElement = getNextFocusableElement(refs, currentFocusedIdx);
49
- _nextFocusableElement && _nextFocusableElement.focus();
49
+ _nextFocusableElement === null || _nextFocusableElement === void 0 || _nextFocusableElement.focus();
50
50
  }
51
51
  break;
52
52
  case 'prev':
53
53
  if (currentFocusedIdx > 0) {
54
54
  e.preventDefault();
55
55
  var _prevFocusableElement = getPrevFocusableElement(refs, currentFocusedIdx);
56
- _prevFocusableElement && _prevFocusableElement.focus();
56
+ _prevFocusableElement === null || _prevFocusableElement === void 0 || _prevFocusableElement.focus();
57
57
  }
58
58
  break;
59
59
  case 'first':
60
60
  e.preventDefault();
61
61
  // Search for first non-disabled element if first element is disabled
62
62
  var nextFocusableElement = getNextFocusableElement(refs, -1);
63
- nextFocusableElement && nextFocusableElement.focus();
63
+ nextFocusableElement === null || nextFocusableElement === void 0 || nextFocusableElement.focus();
64
64
  break;
65
65
  case 'last':
66
66
  e.preventDefault();
67
67
  // Search for last non-disabled element if last element is disabled
68
68
  var prevFocusableElement = getPrevFocusableElement(refs, refs.length);
69
- prevFocusableElement && prevFocusableElement.focus();
69
+ prevFocusableElement === null || prevFocusableElement === void 0 || prevFocusableElement.focus();
70
70
  break;
71
71
  default:
72
72
  return;
@@ -3,5 +3,5 @@ import { type PopupAvatarGroupProps } from '../../types';
3
3
  /**
4
4
  * It sets focus to the first avatar when popup is open.
5
5
  */
6
- declare const PopupAvatarGroup: ({ maxWidth, minWidth, setInitialFocusRef, ...rest }: PopupAvatarGroupProps) => jsx.JSX.Element;
6
+ declare const PopupAvatarGroup: ({ children, isLoading, maxHeight, maxWidth, minHeight, minWidth, onClick, role, setInitialFocusRef, spacing, testId, ...rest }: PopupAvatarGroupProps) => jsx.JSX.Element;
7
7
  export default PopupAvatarGroup;
@@ -5,7 +5,7 @@ export interface MoreIndicatorProps extends AvatarPropTypes {
5
5
  count: number;
6
6
  'aria-controls'?: string;
7
7
  'aria-expanded'?: boolean;
8
- 'aria-haspopup'?: boolean;
8
+ 'aria-haspopup'?: boolean | 'dialog';
9
9
  buttonProps: Partial<React.HTMLAttributes<HTMLElement>>;
10
10
  onClick: AvatarClickEventHandler;
11
11
  isActive: boolean;
@@ -3,5 +3,5 @@ import { type PopupAvatarGroupProps } from '../../types';
3
3
  /**
4
4
  * It sets focus to the first avatar when popup is open.
5
5
  */
6
- declare const PopupAvatarGroup: ({ maxWidth, minWidth, setInitialFocusRef, ...rest }: PopupAvatarGroupProps) => jsx.JSX.Element;
6
+ declare const PopupAvatarGroup: ({ children, isLoading, maxHeight, maxWidth, minHeight, minWidth, onClick, role, setInitialFocusRef, spacing, testId, ...rest }: PopupAvatarGroupProps) => jsx.JSX.Element;
7
7
  export default PopupAvatarGroup;
@@ -5,7 +5,7 @@ export interface MoreIndicatorProps extends AvatarPropTypes {
5
5
  count: number;
6
6
  'aria-controls'?: string;
7
7
  'aria-expanded'?: boolean;
8
- 'aria-haspopup'?: boolean;
8
+ 'aria-haspopup'?: boolean | 'dialog';
9
9
  buttonProps: Partial<React.HTMLAttributes<HTMLElement>>;
10
10
  onClick: AvatarClickEventHandler;
11
11
  isActive: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/avatar-group",
3
- "version": "10.0.2",
3
+ "version": "10.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,7 +12,9 @@
12
12
  "module": "dist/esm/index.js",
13
13
  "module:es2019": "dist/es2019/index.js",
14
14
  "types": "dist/types/index.d.ts",
15
- "sideEffects": false,
15
+ "sideEffects": [
16
+ "**/*.compiled.css"
17
+ ],
16
18
  "atlaskit:src": "src/index.tsx",
17
19
  "atlassian": {
18
20
  "team": "Design System Team",
@@ -24,13 +26,13 @@
24
26
  },
25
27
  "dependencies": {
26
28
  "@atlaskit/avatar": "^21.17.0",
27
- "@atlaskit/ds-lib": "^3.1.0",
29
+ "@atlaskit/ds-lib": "^3.2.0",
28
30
  "@atlaskit/menu": "^2.13.0",
29
31
  "@atlaskit/platform-feature-flags": "^0.3.0",
30
32
  "@atlaskit/popup": "^1.29.0",
31
33
  "@atlaskit/theme": "^14.0.0",
32
34
  "@atlaskit/tokens": "^2.2.0",
33
- "@atlaskit/tooltip": "^18.8.0",
35
+ "@atlaskit/tooltip": "^18.9.0",
34
36
  "@babel/runtime": "^7.0.0",
35
37
  "@emotion/react": "^11.7.1",
36
38
  "bind-event-listener": "^3.0.0"