@atlaskit/avatar-group 10.0.1 → 10.0.3
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 +16 -0
- package/dist/cjs/components/avatar-group-item.js +63 -12
- package/dist/cjs/components/avatar-group.js +18 -5
- package/dist/cjs/components/grid.js +0 -2
- package/dist/cjs/components/internal/components/popup-avatar-group.js +21 -9
- package/dist/cjs/components/internal/utiles/handle-focus.js +4 -4
- package/dist/cjs/components/more-indicator.js +0 -1
- package/dist/cjs/components/stack.js +0 -2
- package/dist/es2019/components/avatar-group-item.js +60 -9
- package/dist/es2019/components/avatar-group.js +14 -4
- package/dist/es2019/components/grid.js +0 -2
- package/dist/es2019/components/internal/components/popup-avatar-group.js +19 -8
- package/dist/es2019/components/internal/utiles/handle-focus.js +4 -4
- package/dist/es2019/components/more-indicator.js +1 -2
- package/dist/es2019/components/stack.js +0 -2
- package/dist/esm/components/avatar-group-item.js +63 -12
- package/dist/esm/components/avatar-group.js +17 -6
- package/dist/esm/components/grid.js +0 -2
- package/dist/esm/components/internal/components/popup-avatar-group.js +21 -10
- package/dist/esm/components/internal/utiles/handle-focus.js +4 -4
- package/dist/esm/components/more-indicator.js +0 -2
- package/dist/esm/components/stack.js +0 -2
- package/dist/types/components/internal/components/popup-avatar-group.d.ts +1 -1
- package/dist/types/components/more-indicator.d.ts +1 -1
- package/dist/types-ts4.5/components/internal/components/popup-avatar-group.d.ts +1 -1
- package/dist/types-ts4.5/components/more-indicator.d.ts +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/avatar-group
|
|
2
2
|
|
|
3
|
+
## 10.0.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#161302](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/161302)
|
|
8
|
+
[`e005ceaf960e2`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/e005ceaf960e2) -
|
|
9
|
+
Make some spread props explicit in internal functions and components.
|
|
10
|
+
|
|
11
|
+
## 10.0.2
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#161368](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/161368)
|
|
16
|
+
[`870668ea63139`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/870668ea63139) -
|
|
17
|
+
Refactoring internals to make spread props more explicit and resolve ESLint disables.
|
|
18
|
+
|
|
3
19
|
## 10.0.1
|
|
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
|
-
|
|
25
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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:
|
|
54
|
-
rel:
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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,11 +27,12 @@ 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
|
|
32
34
|
* @jsx jsx
|
|
33
|
-
*/
|
|
35
|
+
*/
|
|
34
36
|
var MAX_COUNT = {
|
|
35
37
|
grid: 11,
|
|
36
38
|
stack: 5
|
|
@@ -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(
|
|
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
|
-
|
|
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(
|
|
200
|
-
var 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,8 +11,6 @@ var _react2 = require("@emotion/react");
|
|
|
11
11
|
* @jsx jsx
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
15
|
-
|
|
16
14
|
var gutter = "var(--ds-space-negative-050, -4px)";
|
|
17
15
|
var listStyles = (0, _react2.css)({
|
|
18
16
|
display: 'flex',
|
|
@@ -11,33 +11,45 @@ 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
|
|
18
18
|
*/
|
|
19
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
20
19
|
/**
|
|
21
20
|
* It sets focus to the first avatar when popup is open.
|
|
22
21
|
*/
|
|
23
22
|
var PopupAvatarGroup = function PopupAvatarGroup(_ref) {
|
|
24
|
-
var
|
|
23
|
+
var children = _ref.children,
|
|
24
|
+
isLoading = _ref.isLoading,
|
|
25
|
+
maxHeight = _ref.maxHeight,
|
|
26
|
+
_ref$maxWidth = _ref.maxWidth,
|
|
25
27
|
maxWidth = _ref$maxWidth === void 0 ? 800 : _ref$maxWidth,
|
|
28
|
+
minHeight = _ref.minHeight,
|
|
26
29
|
_ref$minWidth = _ref.minWidth,
|
|
27
30
|
minWidth = _ref$minWidth === void 0 ? 320 : _ref$minWidth,
|
|
31
|
+
onClick = _ref.onClick,
|
|
32
|
+
role = _ref.role,
|
|
28
33
|
setInitialFocusRef = _ref.setInitialFocusRef,
|
|
34
|
+
spacing = _ref.spacing,
|
|
35
|
+
testId = _ref.testId,
|
|
29
36
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
30
37
|
var _useContext = (0, _react.useContext)(_focusManager.FocusManagerContext),
|
|
31
38
|
menuItemRefs = _useContext.menuItemRefs;
|
|
32
39
|
(0, _react.useEffect)(function () {
|
|
33
40
|
setInitialFocusRef === null || setInitialFocusRef === void 0 || setInitialFocusRef(menuItemRefs[0]);
|
|
34
41
|
}, [menuItemRefs, setInitialFocusRef]);
|
|
35
|
-
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
|
|
36
52
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
37
|
-
|
|
38
|
-
maxWidth: maxWidth,
|
|
39
|
-
minWidth: minWidth
|
|
40
|
-
}, rest))
|
|
41
|
-
);
|
|
53
|
+
}, rest), children);
|
|
42
54
|
};
|
|
43
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
|
|
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
|
|
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
|
|
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
|
|
76
|
+
prevFocusableElement === null || prevFocusableElement === void 0 || prevFocusableElement.focus();
|
|
77
77
|
break;
|
|
78
78
|
default:
|
|
79
79
|
return;
|
|
@@ -18,7 +18,6 @@ var _excluded = ["testId", "className", "ref"];
|
|
|
18
18
|
* @jsxRuntime classic
|
|
19
19
|
* @jsx jsx
|
|
20
20
|
*/
|
|
21
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
22
21
|
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); }
|
|
23
22
|
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; }
|
|
24
23
|
var buttonSizes = {
|
|
@@ -13,8 +13,6 @@ var _constants = require("@atlaskit/theme/constants");
|
|
|
13
13
|
* @jsx jsx
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
17
|
-
|
|
18
16
|
// eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
|
|
19
17
|
|
|
20
18
|
var gutter = _avatar.BORDER_WIDTH * 2 + (0, _constants.gridSize)() / 2;
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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:
|
|
46
|
-
rel:
|
|
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
|
-
},
|
|
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
|
-
},
|
|
109
|
+
}, name);
|
|
59
110
|
}
|
|
60
111
|
return /*#__PURE__*/React.createElement(CustomItem, {
|
|
61
112
|
iconBefore: AvatarIcon,
|
|
62
113
|
component: CustomComponent,
|
|
63
114
|
testId: testId
|
|
64
|
-
},
|
|
115
|
+
}, name);
|
|
65
116
|
});
|
|
66
117
|
|
|
67
118
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
@@ -4,8 +4,6 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
4
4
|
* @jsx jsx
|
|
5
5
|
*/
|
|
6
6
|
import { useCallback, useEffect, useState } from 'react';
|
|
7
|
-
|
|
8
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
7
|
import { jsx } from '@emotion/react';
|
|
10
8
|
import { bind } from 'bind-event-listener';
|
|
11
9
|
import Avatar from '@atlaskit/avatar';
|
|
@@ -137,14 +135,26 @@ const AvatarGroup = ({
|
|
|
137
135
|
if (total <= max) {
|
|
138
136
|
return null;
|
|
139
137
|
}
|
|
140
|
-
const renderMoreButton =
|
|
138
|
+
const renderMoreButton = ({
|
|
139
|
+
'aria-controls': ariaControls,
|
|
140
|
+
'aria-expanded': ariaExpanded,
|
|
141
|
+
'aria-haspopup': ariaHasPopup,
|
|
142
|
+
onClick,
|
|
143
|
+
...props
|
|
144
|
+
}) => jsx(MoreIndicator, _extends({
|
|
141
145
|
buttonProps: showMoreButtonProps,
|
|
142
146
|
borderColor: borderColor,
|
|
143
147
|
count: total - max,
|
|
144
148
|
size: size,
|
|
145
149
|
testId: testId && `${testId}--overflow-menu--trigger`,
|
|
146
150
|
isActive: isOpen
|
|
147
|
-
|
|
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
|
+
}));
|
|
148
158
|
|
|
149
159
|
// bail if the consumer wants to handle onClick
|
|
150
160
|
if (typeof onMoreClick === 'function') {
|
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
5
|
import { Children } from 'react';
|
|
6
|
-
|
|
7
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
6
|
import { css, jsx } from '@emotion/react';
|
|
9
7
|
const gutter = "var(--ds-space-negative-050, -4px)";
|
|
10
8
|
const listStyles = css({
|
|
@@ -4,8 +4,6 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
4
4
|
* @jsx jsx
|
|
5
5
|
*/
|
|
6
6
|
import { useContext, useEffect } from 'react';
|
|
7
|
-
|
|
8
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
7
|
import { jsx } from '@emotion/react';
|
|
10
8
|
import { MenuGroup } from '@atlaskit/menu';
|
|
11
9
|
import { FocusManagerContext } from './focus-manager';
|
|
@@ -14,9 +12,17 @@ import { FocusManagerContext } from './focus-manager';
|
|
|
14
12
|
* It sets focus to the first avatar when popup is open.
|
|
15
13
|
*/
|
|
16
14
|
const PopupAvatarGroup = ({
|
|
15
|
+
children,
|
|
16
|
+
isLoading,
|
|
17
|
+
maxHeight,
|
|
17
18
|
maxWidth = 800,
|
|
19
|
+
minHeight,
|
|
18
20
|
minWidth = 320,
|
|
21
|
+
onClick,
|
|
22
|
+
role,
|
|
19
23
|
setInitialFocusRef,
|
|
24
|
+
spacing,
|
|
25
|
+
testId,
|
|
20
26
|
...rest
|
|
21
27
|
}) => {
|
|
22
28
|
const {
|
|
@@ -25,12 +31,17 @@ const PopupAvatarGroup = ({
|
|
|
25
31
|
useEffect(() => {
|
|
26
32
|
setInitialFocusRef === null || setInitialFocusRef === void 0 ? void 0 : setInitialFocusRef(menuItemRefs[0]);
|
|
27
33
|
}, [menuItemRefs, setInitialFocusRef]);
|
|
28
|
-
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
|
|
29
44
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
30
|
-
|
|
31
|
-
maxWidth: maxWidth,
|
|
32
|
-
minWidth: minWidth
|
|
33
|
-
}, rest))
|
|
34
|
-
);
|
|
45
|
+
}, rest), children);
|
|
35
46
|
};
|
|
36
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
|
|
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
|
|
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
|
|
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
|
|
72
|
+
prevFocusableElement === null || prevFocusableElement === void 0 ? void 0 : prevFocusableElement.focus();
|
|
73
73
|
break;
|
|
74
74
|
default:
|
|
75
75
|
return;
|
|
@@ -4,8 +4,6 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
4
4
|
* @jsx jsx
|
|
5
5
|
*/
|
|
6
6
|
import { forwardRef, useCallback } from 'react';
|
|
7
|
-
|
|
8
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
7
|
import { css, jsx } from '@emotion/react';
|
|
10
8
|
import Avatar, { ACTIVE_SCALE_FACTOR, BORDER_WIDTH } from '@atlaskit/avatar';
|
|
11
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -58,6 +56,7 @@ const buttonStyles = css({
|
|
|
58
56
|
const MAX_DISPLAY_COUNT = 99;
|
|
59
57
|
const MoreIndicator = /*#__PURE__*/forwardRef(({
|
|
60
58
|
appearance = 'circle',
|
|
59
|
+
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
61
60
|
borderColor = fg('platform-component-visual-refresh') ? "var(--ds-surface, #FFFFFF)" : `var(--ds-border-inverse, ${N0})`,
|
|
62
61
|
size = 'medium',
|
|
63
62
|
count = 0,
|
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
5
|
import { Children } from 'react';
|
|
6
|
-
|
|
7
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
6
|
import { css, jsx } from '@emotion/react';
|
|
9
7
|
import { BORDER_WIDTH } from '@atlaskit/avatar';
|
|
10
8
|
// eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
|
|
@@ -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
|
-
|
|
15
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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:
|
|
44
|
-
rel:
|
|
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
|
-
},
|
|
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
|
-
},
|
|
111
|
+
}, name);
|
|
61
112
|
}
|
|
62
113
|
return /*#__PURE__*/React.createElement(CustomItem, {
|
|
63
114
|
iconBefore: AvatarIcon,
|
|
64
115
|
component: CustomComponent,
|
|
65
116
|
testId: testId
|
|
66
|
-
},
|
|
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
|
/**
|
|
@@ -8,8 +10,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
8
10
|
* @jsx jsx
|
|
9
11
|
*/
|
|
10
12
|
import { useCallback, useEffect, useState } from 'react';
|
|
11
|
-
|
|
12
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
13
13
|
import { jsx } from '@emotion/react';
|
|
14
14
|
import { bind } from 'bind-event-listener';
|
|
15
15
|
import Avatar from '@atlaskit/avatar';
|
|
@@ -157,7 +157,12 @@ var AvatarGroup = function AvatarGroup(_ref) {
|
|
|
157
157
|
if (total <= max) {
|
|
158
158
|
return null;
|
|
159
159
|
}
|
|
160
|
-
var renderMoreButton = function renderMoreButton(
|
|
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);
|
|
161
166
|
return jsx(MoreIndicator, _extends({
|
|
162
167
|
buttonProps: showMoreButtonProps,
|
|
163
168
|
borderColor: borderColor,
|
|
@@ -165,7 +170,13 @@ var AvatarGroup = function AvatarGroup(_ref) {
|
|
|
165
170
|
size: size,
|
|
166
171
|
testId: testId && "".concat(testId, "--overflow-menu--trigger"),
|
|
167
172
|
isActive: isOpen
|
|
168
|
-
|
|
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
|
+
}));
|
|
169
180
|
};
|
|
170
181
|
|
|
171
182
|
// bail if the consumer wants to handle onClick
|
|
@@ -192,8 +203,8 @@ var AvatarGroup = function AvatarGroup(_ref) {
|
|
|
192
203
|
shouldFlip: true,
|
|
193
204
|
zIndex: layers.modal(),
|
|
194
205
|
shouldRenderToParent: shouldPopupRenderToParent,
|
|
195
|
-
content: function content(
|
|
196
|
-
var setInitialFocusRef =
|
|
206
|
+
content: function content(_ref4) {
|
|
207
|
+
var setInitialFocusRef = _ref4.setInitialFocusRef;
|
|
197
208
|
return jsx(FocusManager, null, jsx(PopupAvatarGroup, {
|
|
198
209
|
onClick: function onClick(e) {
|
|
199
210
|
return e.stopPropagation();
|
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
5
|
import { Children } from 'react';
|
|
6
|
-
|
|
7
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
6
|
import { css, jsx } from '@emotion/react';
|
|
9
7
|
var gutter = "var(--ds-space-negative-050, -4px)";
|
|
10
8
|
var listStyles = css({
|
|
@@ -1,13 +1,11 @@
|
|
|
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
|
|
7
7
|
*/
|
|
8
8
|
import { useContext, useEffect } from 'react';
|
|
9
|
-
|
|
10
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
11
9
|
import { jsx } from '@emotion/react';
|
|
12
10
|
import { MenuGroup } from '@atlaskit/menu';
|
|
13
11
|
import { FocusManagerContext } from './focus-manager';
|
|
@@ -16,23 +14,36 @@ import { FocusManagerContext } from './focus-manager';
|
|
|
16
14
|
* It sets focus to the first avatar when popup is open.
|
|
17
15
|
*/
|
|
18
16
|
var PopupAvatarGroup = function PopupAvatarGroup(_ref) {
|
|
19
|
-
var
|
|
17
|
+
var children = _ref.children,
|
|
18
|
+
isLoading = _ref.isLoading,
|
|
19
|
+
maxHeight = _ref.maxHeight,
|
|
20
|
+
_ref$maxWidth = _ref.maxWidth,
|
|
20
21
|
maxWidth = _ref$maxWidth === void 0 ? 800 : _ref$maxWidth,
|
|
22
|
+
minHeight = _ref.minHeight,
|
|
21
23
|
_ref$minWidth = _ref.minWidth,
|
|
22
24
|
minWidth = _ref$minWidth === void 0 ? 320 : _ref$minWidth,
|
|
25
|
+
onClick = _ref.onClick,
|
|
26
|
+
role = _ref.role,
|
|
23
27
|
setInitialFocusRef = _ref.setInitialFocusRef,
|
|
28
|
+
spacing = _ref.spacing,
|
|
29
|
+
testId = _ref.testId,
|
|
24
30
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
25
31
|
var _useContext = useContext(FocusManagerContext),
|
|
26
32
|
menuItemRefs = _useContext.menuItemRefs;
|
|
27
33
|
useEffect(function () {
|
|
28
34
|
setInitialFocusRef === null || setInitialFocusRef === void 0 || setInitialFocusRef(menuItemRefs[0]);
|
|
29
35
|
}, [menuItemRefs, setInitialFocusRef]);
|
|
30
|
-
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
|
|
31
46
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
32
|
-
|
|
33
|
-
maxWidth: maxWidth,
|
|
34
|
-
minWidth: minWidth
|
|
35
|
-
}, rest))
|
|
36
|
-
);
|
|
47
|
+
}, rest), children);
|
|
37
48
|
};
|
|
38
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
|
|
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
|
|
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
|
|
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
|
|
69
|
+
prevFocusableElement === null || prevFocusableElement === void 0 || prevFocusableElement.focus();
|
|
70
70
|
break;
|
|
71
71
|
default:
|
|
72
72
|
return;
|
|
@@ -6,8 +6,6 @@ var _excluded = ["testId", "className", "ref"];
|
|
|
6
6
|
* @jsx jsx
|
|
7
7
|
*/
|
|
8
8
|
import { forwardRef, useCallback } from 'react';
|
|
9
|
-
|
|
10
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
11
9
|
import { css, jsx } from '@emotion/react';
|
|
12
10
|
import Avatar, { ACTIVE_SCALE_FACTOR, BORDER_WIDTH } from '@atlaskit/avatar';
|
|
13
11
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
5
|
import { Children } from 'react';
|
|
6
|
-
|
|
7
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
6
|
import { css, jsx } from '@emotion/react';
|
|
9
7
|
import { BORDER_WIDTH } from '@atlaskit/avatar';
|
|
10
8
|
// eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
|
|
@@ -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.
|
|
3
|
+
"version": "10.0.3",
|
|
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/"
|
|
@@ -23,13 +23,13 @@
|
|
|
23
23
|
"runReact18": true
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@atlaskit/avatar": "^21.
|
|
26
|
+
"@atlaskit/avatar": "^21.17.0",
|
|
27
27
|
"@atlaskit/ds-lib": "^3.1.0",
|
|
28
28
|
"@atlaskit/menu": "^2.13.0",
|
|
29
29
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
30
|
-
"@atlaskit/popup": "^1.
|
|
30
|
+
"@atlaskit/popup": "^1.29.0",
|
|
31
31
|
"@atlaskit/theme": "^14.0.0",
|
|
32
|
-
"@atlaskit/tokens": "^2.
|
|
32
|
+
"@atlaskit/tokens": "^2.2.0",
|
|
33
33
|
"@atlaskit/tooltip": "^18.8.0",
|
|
34
34
|
"@babel/runtime": "^7.0.0",
|
|
35
35
|
"@emotion/react": "^11.7.1",
|