@atlaskit/avatar-group 12.8.0 → 12.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +112 -0
- package/dist/cjs/components/avatar-group-item.js +24 -1
- package/dist/cjs/components/avatar-group.js +15 -36
- package/dist/cjs/components/get-overrides.js +40 -0
- package/dist/es2019/components/avatar-group-item.js +22 -1
- package/dist/es2019/components/avatar-group.js +14 -30
- package/dist/es2019/components/get-overrides.js +26 -0
- package/dist/esm/components/avatar-group-item.js +24 -1
- package/dist/esm/components/avatar-group.js +15 -36
- package/dist/esm/components/get-overrides.js +33 -0
- package/dist/types/components/avatar-group-item.d.ts +9 -1
- package/dist/types/components/get-overrides.d.ts +2 -0
- package/dist/types/components/utils.d.ts +1 -1
- package/dist/types-ts4.5/components/avatar-group-item.d.ts +9 -1
- package/dist/types-ts4.5/components/get-overrides.d.ts +2 -0
- package/dist/types-ts4.5/components/utils.d.ts +1 -1
- package/package.json +8 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,117 @@
|
|
|
1
1
|
# @atlaskit/avatar-group
|
|
2
2
|
|
|
3
|
+
## 12.10.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`a8dd7ae55feff`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a8dd7ae55feff) -
|
|
8
|
+
Passes the custom `avatar` component prop from AvatarGroup down to AvatarGroupItem in the overflow
|
|
9
|
+
dropdown menu, ensuring custom avatar components are used consistently for both visible and
|
|
10
|
+
overflowed avatars. This change is behind the `platform-avatar-group-pass-avatar-to-item` feature
|
|
11
|
+
flag.
|
|
12
|
+
|
|
13
|
+
## 12.9.0
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- [`7250582895c0b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7250582895c0b) -
|
|
18
|
+
Top-layer adoption work behind the `platform-dst-top-layer` feature flag. Public adopter APIs are
|
|
19
|
+
intentionally kept narrow while the top-layer API surface settles, with one exception called out
|
|
20
|
+
below.
|
|
21
|
+
|
|
22
|
+
Highlights:
|
|
23
|
+
- Pass the full `[along, away]` legacy popper offset through to the new top-layer
|
|
24
|
+
`placement.offset` API (via `fromLegacyPlacement`). Previously only the `away` axis was
|
|
25
|
+
forwarded, which dropped the `along` offset for consumers of `Popup`, `PopupSelect`,
|
|
26
|
+
`Spotlight`, and `Tooltip` when `platform-dst-top-layer` is enabled.
|
|
27
|
+
- Fix broken import of `dialogHeight` and `dialogWidth` from the removed utils module in
|
|
28
|
+
`@atlaskit/modal-dialog`.
|
|
29
|
+
|
|
30
|
+
Public API:
|
|
31
|
+
- **`@atlaskit/tooltip`** (`minor`): add an optional `testId?: string` field to `TriggerProps`.
|
|
32
|
+
This is additive (no existing prop changes shape). Required because `@atlaskit/button/new` (and
|
|
33
|
+
other `Pressable`-backed primitives) overwrite `data-testid` from spread, so the legacy
|
|
34
|
+
`(triggerProps as any)['data-testid']` workaround is silently absorbed by those consumers. A
|
|
35
|
+
typed `testId` field flows through their own `testId` destructure instead, restoring
|
|
36
|
+
`data-testid` propagation onto the rendered trigger element.
|
|
37
|
+
- **`@atlaskit/popup`**, **`@atlaskit/dropdown-menu`** (`patch`): no public type changes. Wider
|
|
38
|
+
`aria-haspopup` unions that the FF-on path produces are bridged at the package boundary into
|
|
39
|
+
`@atlaskit/top-layer` with localised `FUDGE(top-layer-api)` casts, documented in
|
|
40
|
+
`packages/design-system/top-layer/notes/decisions/migration-roadmap.md` ("Open API decisions
|
|
41
|
+
deferred to a follow-up PR"). They will be widened in a follow-up `minor` PR once the top-layer
|
|
42
|
+
API is committed.
|
|
43
|
+
- **`@atlaskit/modal-dialog`**, **`@atlaskit/select`**, **`@atlaskit/spotlight`**
|
|
44
|
+
(`patch`/`minor`): no public type changes; bug fixes only.
|
|
45
|
+
|
|
46
|
+
Merge-readiness fixes (FF-on test wiring + adopter behavior):
|
|
47
|
+
- **`@atlaskit/popup`** (`minor`): wire the compositional `PopupContent` to delegate to
|
|
48
|
+
`PopupContentTopLayer` when `platform-dst-top-layer` is enabled. Previously only the legacy
|
|
49
|
+
`Popup` component had the FF branch, leaving consumers of the compositional API on the legacy
|
|
50
|
+
popper path.
|
|
51
|
+
- **`@atlaskit/select`** (`minor`): add an `onClick` handler to the `PopupSelect` top-layer
|
|
52
|
+
trigger so clicks open/close the menu (mirrors the legacy global click handler in
|
|
53
|
+
`popup-select.tsx`). Add explicit Escape handling on the menu's `onKeyDown` so the menu closes
|
|
54
|
+
and focus returns to the trigger.
|
|
55
|
+
- **`@atlaskit/top-layer`** (`patch`): the `<dialog>` rendered by the Dialog primitive now sets
|
|
56
|
+
`aria-modal="true"` explicitly. Modern browsers infer modal semantics from `.showModal()` but
|
|
57
|
+
some assistive tech still keys off the explicit attribute.
|
|
58
|
+
- **`@atlaskit/top-layer`** (`patch`): guard `use-anchor-positioning` against environments where
|
|
59
|
+
`ResizeObserver` is not defined (e.g. jest's `node` environment, used by the post-office test
|
|
60
|
+
suite). The observer is used to wait for the popover's first valid layout before measuring;
|
|
61
|
+
consumers in non-DOM jest environments now get a no-op observer and the scroll/resize listeners
|
|
62
|
+
still apply if the host environment polyfills `showPopover`. Real browsers always have
|
|
63
|
+
`ResizeObserver`.
|
|
64
|
+
- **`@atlaskit/modal-dialog`** (`patch`): on the FF-on path, drop the `tabIndex={-1}` (and unused
|
|
65
|
+
`:focus-visible` outline) from the modal content wrapper. The native `<dialog>.showModal()`
|
|
66
|
+
focus-delegate algorithm picks the first focusable descendant (including `tabindex=-1`), and the
|
|
67
|
+
wrapper was hijacking initial focus from the close button. Also honor `shouldReturnFocus={ref}`
|
|
68
|
+
on the FF-on path (an unmount-cleanup focuses the ref after `dialog.close()` so it overrides the
|
|
69
|
+
browser's automatic return-to-trigger). Boolean `shouldReturnFocus={false}` is not yet honored
|
|
70
|
+
on the FF-on path — see `top-layer/notes/merge-blockers.md`.
|
|
71
|
+
- **`@atlaskit/datetime-picker`** (`patch`): on the FF-on path, set `mode="manual"` on the
|
|
72
|
+
`Popup.Content` rendered by both `internal/menu-top-layer.tsx` (date-picker calendar) and
|
|
73
|
+
`internal/fixed-layer-menu-top-layer.tsx` (time-picker menu). With the default `mode="auto"`,
|
|
74
|
+
the same click event that opens the menu (which targets the react-select combobox input —
|
|
75
|
+
outside the popover element) bubbles to the browser's native popover light-dismiss handler and
|
|
76
|
+
immediately closes the menu. react-select / DateTimePicker already own outside-click and Esc
|
|
77
|
+
dismissal via their own state, so opting out of the native auto-dismiss is the correct
|
|
78
|
+
integration. Also extend the existing Esc → trigger-focus restoration in
|
|
79
|
+
`components/date-picker.tsx` to the FF-on path (manual mode disables the browser's built-in
|
|
80
|
+
focus return, and the legacy code path was already handling this for itself behind an FF
|
|
81
|
+
negation).
|
|
82
|
+
- **`@atlaskit/popup`** (no public API change): no source changes — only FF-on Playwright
|
|
83
|
+
spec/example fixes drove the suite from 21/3/2 to 27/0/0. Notable: the two `test.fixme`'d
|
|
84
|
+
nested-popover cases were not browser limitations; `popover="auto"` chains correctly via DOM
|
|
85
|
+
ancestry (the original fixmes had the wrong testId selector). Added `testId` props to two
|
|
86
|
+
examples (`16-popup-with-a11y-props`, `18-should-fit-container`) so default-shape tests can
|
|
87
|
+
reach the trigger.
|
|
88
|
+
- Test alignment for FF-on Playwright suites across `popup`, `select`, `datetime-picker`,
|
|
89
|
+
`inline-dialog`, `inline-message`, and `modal-dialog`: selector updates to match the new
|
|
90
|
+
top-layer testId convention (`${testId}--content`, `[role="dialog"][aria-label="calendar"]`),
|
|
91
|
+
per-spec `skipAxeCheck()` for example-level color-contrast violations unrelated to the
|
|
92
|
+
migration, and focus assertions adjusted to match native `<dialog>` / `Popup.Content` auto-focus
|
|
93
|
+
semantics (focus lands on the first focusable child, not the dialog container itself).
|
|
94
|
+
- **`@atlassian/capacity-planning-capacity-graph`**, **`@atlaskit/color-picker`**,
|
|
95
|
+
**`@atlassian/timeline-table`**, **`@atlassian/global-side-navigation`** (`patch`): scope `fg`
|
|
96
|
+
mocks in unit tests so `platform-dst-top-layer` returns `false`. JSDOM does not implement the
|
|
97
|
+
native Popover API (`showPopover`/`hidePopover`/`toggle` events), so leaving the gate ON in unit
|
|
98
|
+
tests caused popover content to remain in the DOM after close and broke close-behaviour
|
|
99
|
+
assertions. Browser coverage for the FF-on path is provided by the Playwright suites listed
|
|
100
|
+
above.
|
|
101
|
+
- **`@atlaskit/dropdown-menu`** (no public API change): test/example-only fixes for the FF-on
|
|
102
|
+
Playwright suite. Added `role="menuitem"` to the nested-trigger `ButtonItem` in
|
|
103
|
+
`examples/93-testing-nested-keyboard-navigation-top-layer.tsx` to satisfy axe's
|
|
104
|
+
`aria-required-children` rule on the parent menu. Added a `test.beforeEach(skipAxeCheck)` to
|
|
105
|
+
`dropdown-menu.spec.tsx` (FF-on suite) for example-level `color-contrast` violations on the
|
|
106
|
+
pre-existing `color.text.selected`/`color.background.selected` token pair (3.91:1). Replaced a
|
|
107
|
+
deadlocking `await expect(moveItem).not.toBeFocused()` pre-open assertion (Playwright's
|
|
108
|
+
auto-wait blocks 5s on the absent element) with `await expect(moveItem).not.toBeVisible()`.
|
|
109
|
+
Suite result: 22/22 passing.
|
|
110
|
+
|
|
111
|
+
### Patch Changes
|
|
112
|
+
|
|
113
|
+
- Updated dependencies
|
|
114
|
+
|
|
3
115
|
## 12.8.0
|
|
4
116
|
|
|
5
117
|
### Minor Changes
|
|
@@ -6,21 +6,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
11
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
13
|
var _avatar = _interopRequireDefault(require("@atlaskit/avatar"));
|
|
13
14
|
var _mergeRefs = _interopRequireDefault(require("@atlaskit/ds-lib/merge-refs"));
|
|
14
15
|
var _menu = require("@atlaskit/menu");
|
|
16
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
15
17
|
var _useRegisterItemWithFocusManager = _interopRequireDefault(require("./internal/hooks/use-register-item-with-focus-manager"));
|
|
16
18
|
var _excluded = ["analyticsContext", "appearance", "as", "borderColor", "children", "href", "isDisabled", "key", "label", "name", "onClick", "presence", "size", "src", "stackIndex", "status", "tabIndex", "target", "testId"],
|
|
17
19
|
_excluded2 = ["children", "className", "disabled", "draggable", "onClick", "onDragStart", "onMouseDown", "ref", "tabIndex", "data-testid"];
|
|
18
20
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
21
|
+
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; }
|
|
22
|
+
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; }
|
|
19
23
|
var AvatarGroupItem = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
20
24
|
var avatar = props.avatar,
|
|
25
|
+
avatarComponent = props.avatarComponent,
|
|
21
26
|
index = props.index,
|
|
22
27
|
onAvatarClick = props.onAvatarClick,
|
|
23
28
|
testId = props.testId,
|
|
29
|
+
avatarOverrides = props.avatarOverrides,
|
|
24
30
|
role = props.role;
|
|
25
31
|
var analyticsContext = avatar.analyticsContext,
|
|
26
32
|
appearance = avatar.appearance,
|
|
@@ -74,7 +80,24 @@ var AvatarGroupItem = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
|
74
80
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
75
81
|
}, props), children);
|
|
76
82
|
};
|
|
77
|
-
var
|
|
83
|
+
var AvatarComponent = (0, _platformFeatureFlags.fg)('platform-avatar-group-pass-avatar-to-item') ? avatarComponent !== null && avatarComponent !== void 0 ? avatarComponent : _avatar.default : _avatar.default;
|
|
84
|
+
var AvatarIcon = avatarOverrides && (0, _platformFeatureFlags.fg)('platform-avatar-group-pass-avatar-to-item') ? avatarOverrides.render(AvatarComponent, _objectSpread(_objectSpread({}, rest), {}, {
|
|
85
|
+
analyticsContext: analyticsContext,
|
|
86
|
+
appearance: appearance,
|
|
87
|
+
as: as,
|
|
88
|
+
borderColor: 'transparent',
|
|
89
|
+
children: children,
|
|
90
|
+
isDisabled: isDisabled,
|
|
91
|
+
label: label,
|
|
92
|
+
name: '',
|
|
93
|
+
presence: presence,
|
|
94
|
+
size: 'small',
|
|
95
|
+
src: src,
|
|
96
|
+
stackIndex: stackIndex,
|
|
97
|
+
status: status,
|
|
98
|
+
tabIndex: tabIndex,
|
|
99
|
+
testId: testId && "".concat(testId, "--avatar")
|
|
100
|
+
}), 0) : /*#__PURE__*/_react.default.createElement(AvatarComponent, (0, _extends2.default)({}, rest, {
|
|
78
101
|
analyticsContext: analyticsContext,
|
|
79
102
|
appearance: appearance,
|
|
80
103
|
as: as,
|
|
@@ -6,10 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
11
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
12
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
14
13
|
var _bindEventListener = require("bind-event-listener");
|
|
15
14
|
var _avatar = _interopRequireDefault(require("@atlaskit/avatar"));
|
|
@@ -24,6 +23,7 @@ var _popup = _interopRequireDefault(require("@atlaskit/popup"));
|
|
|
24
23
|
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
25
24
|
var _avatarGroupItem = _interopRequireDefault(require("./avatar-group-item"));
|
|
26
25
|
var _avatarGroupTopLayer = require("./avatar-group-top-layer");
|
|
26
|
+
var _getOverrides2 = require("./get-overrides");
|
|
27
27
|
var _grid = _interopRequireDefault(require("./grid"));
|
|
28
28
|
var _focusManager = _interopRequireDefault(require("./internal/components/focus-manager"));
|
|
29
29
|
var _popupAvatarGroup = _interopRequireDefault(require("./internal/components/popup-avatar-group"));
|
|
@@ -38,34 +38,6 @@ var MAX_COUNT = {
|
|
|
38
38
|
grid: 11,
|
|
39
39
|
stack: 5
|
|
40
40
|
};
|
|
41
|
-
function getOverrides(overrides) {
|
|
42
|
-
return {
|
|
43
|
-
AvatarGroupItem: _objectSpread({
|
|
44
|
-
render: function render(Component, props, index) {
|
|
45
|
-
return /*#__PURE__*/_react.default.createElement(Component, (0, _extends2.default)({}, props, {
|
|
46
|
-
key: (0, _utils.composeUniqueKey)(props.avatar, index)
|
|
47
|
-
}));
|
|
48
|
-
}
|
|
49
|
-
}, overrides && overrides.AvatarGroupItem),
|
|
50
|
-
Avatar: _objectSpread({
|
|
51
|
-
render: function render(Component, props, index) {
|
|
52
|
-
return (
|
|
53
|
-
/*#__PURE__*/
|
|
54
|
-
//@ts-ignore - TS2604/TS2786: Component type union causing issues for help-center local consumption with TS 5.9.2
|
|
55
|
-
_react.default.createElement(Component, (0, _extends2.default)({}, props, {
|
|
56
|
-
key: (0, _utils.composeUniqueKey)(props, index)
|
|
57
|
-
}))
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
}, overrides && overrides.Avatar),
|
|
61
|
-
MoreIndicator: _objectSpread({
|
|
62
|
-
render: function render(Component, props) {
|
|
63
|
-
return /*#__PURE__*/_react.default.createElement(Component, props);
|
|
64
|
-
}
|
|
65
|
-
}, overrides && overrides.MoreIndicator)
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
|
|
69
41
|
/**
|
|
70
42
|
* __Avatar group__
|
|
71
43
|
*
|
|
@@ -128,6 +100,10 @@ var AvatarGroup = function AvatarGroup(_ref) {
|
|
|
128
100
|
var _useFocus = (0, _useFocusEvent.default)(),
|
|
129
101
|
isFocused = _useFocus.isFocused,
|
|
130
102
|
bindFocus = _useFocus.bindFocus;
|
|
103
|
+
var _getOverrides = (0, _getOverrides2.getOverrides)(overrides),
|
|
104
|
+
avatarGroupItemOverrides = _getOverrides.AvatarGroupItem,
|
|
105
|
+
avatarOverrides = _getOverrides.Avatar,
|
|
106
|
+
moreIndicatorOverrides = _getOverrides.MoreIndicator;
|
|
131
107
|
|
|
132
108
|
// When a trigger is focused, we want to open the popup
|
|
133
109
|
// the user presses the DownArrow.
|
|
@@ -189,7 +165,7 @@ var AvatarGroup = function AvatarGroup(_ref) {
|
|
|
189
165
|
ariaHasPopup = _ref3['aria-haspopup'],
|
|
190
166
|
onClick = _ref3.onClick,
|
|
191
167
|
props = (0, _objectWithoutProperties2.default)(_ref3, _excluded);
|
|
192
|
-
return
|
|
168
|
+
return moreIndicatorOverrides.render(_moreIndicator.default, _objectSpread(_objectSpread({
|
|
193
169
|
buttonProps: showMoreButtonProps,
|
|
194
170
|
borderColor: borderColor,
|
|
195
171
|
count: total - max,
|
|
@@ -239,6 +215,7 @@ var AvatarGroup = function AvatarGroup(_ref) {
|
|
|
239
215
|
}
|
|
240
216
|
return boundariesElement === 'window' ? 'document' : 'viewport';
|
|
241
217
|
}();
|
|
218
|
+
var avatarComponent = avatar && (0, _platformFeatureFlags.fg)('platform-avatar-group-pass-avatar-to-item') ? avatar : undefined;
|
|
242
219
|
return /*#__PURE__*/_react.default.createElement(_popup.default, {
|
|
243
220
|
isOpen: isOpen,
|
|
244
221
|
onClose: onClose,
|
|
@@ -260,10 +237,12 @@ var AvatarGroup = function AvatarGroup(_ref) {
|
|
|
260
237
|
}, /*#__PURE__*/_react.default.createElement(_menu.Section, {
|
|
261
238
|
titleId: labelId,
|
|
262
239
|
testId: "".concat(testId, "--section")
|
|
263
|
-
}, data.slice(max).map(function (
|
|
264
|
-
return
|
|
265
|
-
avatar:
|
|
240
|
+
}, data.slice(max).map(function (avatarData, index) {
|
|
241
|
+
return avatarGroupItemOverrides.render(_avatarGroupItem.default, {
|
|
242
|
+
avatar: avatarData,
|
|
243
|
+
avatarComponent: avatarComponent,
|
|
266
244
|
onAvatarClick: onAvatarClick,
|
|
245
|
+
avatarOverrides: avatarOverrides,
|
|
267
246
|
testId: testId && "".concat(testId, "--avatar-group-item-").concat(index + max),
|
|
268
247
|
index: index + max
|
|
269
248
|
},
|
|
@@ -296,7 +275,7 @@ var AvatarGroup = function AvatarGroup(_ref) {
|
|
|
296
275
|
size: size
|
|
297
276
|
}, data.slice(0, maxAvatar).map(function (avatarData, idx) {
|
|
298
277
|
var callback = avatarData.onClick || onAvatarClick;
|
|
299
|
-
var finalAvatar =
|
|
278
|
+
var finalAvatar = avatarOverrides.render(avatar, _objectSpread(_objectSpread({}, avatarData), {}, {
|
|
300
279
|
size: size,
|
|
301
280
|
borderColor: borderColor || avatarData.borderColor,
|
|
302
281
|
testId: testId && "".concat(testId, "--avatar-").concat(idx),
|
|
@@ -329,7 +308,7 @@ var AvatarGroup = function AvatarGroup(_ref) {
|
|
|
329
308
|
"aria-label": label
|
|
330
309
|
}, data.slice(0, maxAvatar).map(function (avatarData, idx) {
|
|
331
310
|
var callback = avatarData.onClick || onAvatarClick;
|
|
332
|
-
var finalAvatar =
|
|
311
|
+
var finalAvatar = avatarOverrides.render(avatar, _objectSpread(_objectSpread({}, avatarData), {}, {
|
|
333
312
|
size: size,
|
|
334
313
|
borderColor: borderColor || avatarData.borderColor,
|
|
335
314
|
testId: testId && "".concat(testId, "--avatar-").concat(idx),
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.getOverrides = getOverrides;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
var _utils = require("./utils");
|
|
12
|
+
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; }
|
|
13
|
+
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; }
|
|
14
|
+
function getOverrides(overrides) {
|
|
15
|
+
return {
|
|
16
|
+
AvatarGroupItem: _objectSpread({
|
|
17
|
+
render: function render(Component, props, index) {
|
|
18
|
+
return /*#__PURE__*/_react.default.createElement(Component, (0, _extends2.default)({}, props, {
|
|
19
|
+
key: (0, _utils.composeUniqueKey)(props.avatar, index)
|
|
20
|
+
}));
|
|
21
|
+
}
|
|
22
|
+
}, overrides && overrides.AvatarGroupItem),
|
|
23
|
+
Avatar: _objectSpread({
|
|
24
|
+
render: function render(Component, props, index) {
|
|
25
|
+
return (
|
|
26
|
+
/*#__PURE__*/
|
|
27
|
+
//@ts-ignore - TS2604/TS2786: Component type union causing issues for help-center local consumption with TS 5.9.2
|
|
28
|
+
_react.default.createElement(Component, (0, _extends2.default)({}, props, {
|
|
29
|
+
key: (0, _utils.composeUniqueKey)(props, index)
|
|
30
|
+
}))
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
}, overrides && overrides.Avatar),
|
|
34
|
+
MoreIndicator: _objectSpread({
|
|
35
|
+
render: function render(Component, props) {
|
|
36
|
+
return /*#__PURE__*/_react.default.createElement(Component, props);
|
|
37
|
+
}
|
|
38
|
+
}, overrides && overrides.MoreIndicator)
|
|
39
|
+
};
|
|
40
|
+
}
|
|
@@ -3,13 +3,16 @@ import React, { forwardRef } from 'react';
|
|
|
3
3
|
import Avatar from '@atlaskit/avatar';
|
|
4
4
|
import mergeRefs from '@atlaskit/ds-lib/merge-refs';
|
|
5
5
|
import { ButtonItem, CustomItem, LinkItem } from '@atlaskit/menu';
|
|
6
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
7
|
import useRegisterItemWithFocusManager from './internal/hooks/use-register-item-with-focus-manager';
|
|
7
8
|
const AvatarGroupItem = /*#__PURE__*/forwardRef((props, ref) => {
|
|
8
9
|
const {
|
|
9
10
|
avatar,
|
|
11
|
+
avatarComponent,
|
|
10
12
|
index,
|
|
11
13
|
onAvatarClick,
|
|
12
14
|
testId,
|
|
15
|
+
avatarOverrides,
|
|
13
16
|
role
|
|
14
17
|
} = props;
|
|
15
18
|
const {
|
|
@@ -67,7 +70,25 @@ const AvatarGroupItem = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
67
70
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
68
71
|
}, props), children);
|
|
69
72
|
};
|
|
70
|
-
const
|
|
73
|
+
const AvatarComponent = fg('platform-avatar-group-pass-avatar-to-item') ? avatarComponent !== null && avatarComponent !== void 0 ? avatarComponent : Avatar : Avatar;
|
|
74
|
+
const AvatarIcon = avatarOverrides && fg('platform-avatar-group-pass-avatar-to-item') ? avatarOverrides.render(AvatarComponent, {
|
|
75
|
+
...rest,
|
|
76
|
+
analyticsContext,
|
|
77
|
+
appearance,
|
|
78
|
+
as,
|
|
79
|
+
borderColor: 'transparent',
|
|
80
|
+
children,
|
|
81
|
+
isDisabled,
|
|
82
|
+
label,
|
|
83
|
+
name: '',
|
|
84
|
+
presence,
|
|
85
|
+
size: 'small',
|
|
86
|
+
src,
|
|
87
|
+
stackIndex,
|
|
88
|
+
status,
|
|
89
|
+
tabIndex,
|
|
90
|
+
testId: testId && `${testId}--avatar`
|
|
91
|
+
}, 0) : /*#__PURE__*/React.createElement(AvatarComponent, _extends({}, rest, {
|
|
71
92
|
analyticsContext: analyticsContext,
|
|
72
93
|
appearance: appearance,
|
|
73
94
|
as: as,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
1
|
import React, { useCallback, useEffect, useState } from 'react';
|
|
3
2
|
import { bind } from 'bind-event-listener';
|
|
4
3
|
import Avatar from '@atlaskit/avatar';
|
|
@@ -13,6 +12,7 @@ import Popup from '@atlaskit/popup';
|
|
|
13
12
|
import Tooltip from '@atlaskit/tooltip';
|
|
14
13
|
import AvatarGroupItem from './avatar-group-item';
|
|
15
14
|
import { MoreDropdownTopLayer } from './avatar-group-top-layer';
|
|
15
|
+
import { getOverrides } from './get-overrides';
|
|
16
16
|
import Grid from './grid';
|
|
17
17
|
import FocusManager from './internal/components/focus-manager';
|
|
18
18
|
import PopupAvatarGroup from './internal/components/popup-avatar-group';
|
|
@@ -23,30 +23,6 @@ const MAX_COUNT = {
|
|
|
23
23
|
grid: 11,
|
|
24
24
|
stack: 5
|
|
25
25
|
};
|
|
26
|
-
function getOverrides(overrides) {
|
|
27
|
-
return {
|
|
28
|
-
AvatarGroupItem: {
|
|
29
|
-
render: (Component, props, index) => /*#__PURE__*/React.createElement(Component, _extends({}, props, {
|
|
30
|
-
key: composeUniqueKey(props.avatar, index)
|
|
31
|
-
})),
|
|
32
|
-
...(overrides && overrides.AvatarGroupItem)
|
|
33
|
-
},
|
|
34
|
-
Avatar: {
|
|
35
|
-
render: (Component, props, index) =>
|
|
36
|
-
/*#__PURE__*/
|
|
37
|
-
//@ts-ignore - TS2604/TS2786: Component type union causing issues for help-center local consumption with TS 5.9.2
|
|
38
|
-
React.createElement(Component, _extends({}, props, {
|
|
39
|
-
key: composeUniqueKey(props, index)
|
|
40
|
-
})),
|
|
41
|
-
...(overrides && overrides.Avatar)
|
|
42
|
-
},
|
|
43
|
-
MoreIndicator: {
|
|
44
|
-
render: (Component, props) => /*#__PURE__*/React.createElement(Component, props),
|
|
45
|
-
...(overrides && overrides.MoreIndicator)
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
26
|
/**
|
|
51
27
|
* __Avatar group__
|
|
52
28
|
*
|
|
@@ -95,6 +71,11 @@ const AvatarGroup = ({
|
|
|
95
71
|
isFocused,
|
|
96
72
|
bindFocus
|
|
97
73
|
} = useFocus();
|
|
74
|
+
const {
|
|
75
|
+
AvatarGroupItem: avatarGroupItemOverrides,
|
|
76
|
+
Avatar: avatarOverrides,
|
|
77
|
+
MoreIndicator: moreIndicatorOverrides
|
|
78
|
+
} = getOverrides(overrides);
|
|
98
79
|
|
|
99
80
|
// When a trigger is focused, we want to open the popup
|
|
100
81
|
// the user presses the DownArrow.
|
|
@@ -156,7 +137,7 @@ const AvatarGroup = ({
|
|
|
156
137
|
'aria-haspopup': ariaHasPopup,
|
|
157
138
|
onClick,
|
|
158
139
|
...props
|
|
159
|
-
}) =>
|
|
140
|
+
}) => moreIndicatorOverrides.render(MoreIndicator, {
|
|
160
141
|
buttonProps: showMoreButtonProps,
|
|
161
142
|
borderColor: borderColor,
|
|
162
143
|
count: total - max,
|
|
@@ -207,6 +188,7 @@ const AvatarGroup = ({
|
|
|
207
188
|
}
|
|
208
189
|
return boundariesElement === 'window' ? 'document' : 'viewport';
|
|
209
190
|
})();
|
|
191
|
+
const avatarComponent = avatar && fg('platform-avatar-group-pass-avatar-to-item') ? avatar : undefined;
|
|
210
192
|
return /*#__PURE__*/React.createElement(Popup, {
|
|
211
193
|
isOpen: isOpen,
|
|
212
194
|
onClose: onClose,
|
|
@@ -226,9 +208,11 @@ const AvatarGroup = ({
|
|
|
226
208
|
}, /*#__PURE__*/React.createElement(Section, {
|
|
227
209
|
titleId: labelId,
|
|
228
210
|
testId: `${testId}--section`
|
|
229
|
-
}, data.slice(max).map((
|
|
230
|
-
avatar,
|
|
211
|
+
}, data.slice(max).map((avatarData, index) => avatarGroupItemOverrides.render(AvatarGroupItem, {
|
|
212
|
+
avatar: avatarData,
|
|
213
|
+
avatarComponent,
|
|
231
214
|
onAvatarClick,
|
|
215
|
+
avatarOverrides,
|
|
232
216
|
testId: testId && `${testId}--avatar-group-item-${index + max}`,
|
|
233
217
|
index: index + max
|
|
234
218
|
},
|
|
@@ -261,7 +245,7 @@ const AvatarGroup = ({
|
|
|
261
245
|
size: size
|
|
262
246
|
}, data.slice(0, maxAvatar).map((avatarData, idx) => {
|
|
263
247
|
const callback = avatarData.onClick || onAvatarClick;
|
|
264
|
-
const finalAvatar =
|
|
248
|
+
const finalAvatar = avatarOverrides.render(avatar, {
|
|
265
249
|
...avatarData,
|
|
266
250
|
size,
|
|
267
251
|
borderColor: borderColor || avatarData.borderColor,
|
|
@@ -295,7 +279,7 @@ const AvatarGroup = ({
|
|
|
295
279
|
"aria-label": label
|
|
296
280
|
}, data.slice(0, maxAvatar).map((avatarData, idx) => {
|
|
297
281
|
const callback = avatarData.onClick || onAvatarClick;
|
|
298
|
-
const finalAvatar =
|
|
282
|
+
const finalAvatar = avatarOverrides.render(avatar, {
|
|
299
283
|
...avatarData,
|
|
300
284
|
size,
|
|
301
285
|
borderColor: borderColor || avatarData.borderColor,
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { composeUniqueKey } from './utils';
|
|
4
|
+
export function getOverrides(overrides) {
|
|
5
|
+
return {
|
|
6
|
+
AvatarGroupItem: {
|
|
7
|
+
render: (Component, props, index) => /*#__PURE__*/React.createElement(Component, _extends({}, props, {
|
|
8
|
+
key: composeUniqueKey(props.avatar, index)
|
|
9
|
+
})),
|
|
10
|
+
...(overrides && overrides.AvatarGroupItem)
|
|
11
|
+
},
|
|
12
|
+
Avatar: {
|
|
13
|
+
render: (Component, props, index) =>
|
|
14
|
+
/*#__PURE__*/
|
|
15
|
+
//@ts-ignore - TS2604/TS2786: Component type union causing issues for help-center local consumption with TS 5.9.2
|
|
16
|
+
React.createElement(Component, _extends({}, props, {
|
|
17
|
+
key: composeUniqueKey(props, index)
|
|
18
|
+
})),
|
|
19
|
+
...(overrides && overrides.Avatar)
|
|
20
|
+
},
|
|
21
|
+
MoreIndicator: {
|
|
22
|
+
render: (Component, props) => /*#__PURE__*/React.createElement(Component, props),
|
|
23
|
+
...(overrides && overrides.MoreIndicator)
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
@@ -1,17 +1,23 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
1
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
4
|
var _excluded = ["analyticsContext", "appearance", "as", "borderColor", "children", "href", "isDisabled", "key", "label", "name", "onClick", "presence", "size", "src", "stackIndex", "status", "tabIndex", "target", "testId"],
|
|
4
5
|
_excluded2 = ["children", "className", "disabled", "draggable", "onClick", "onDragStart", "onMouseDown", "ref", "tabIndex", "data-testid"];
|
|
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; }
|
|
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; }
|
|
5
8
|
import React, { forwardRef } from 'react';
|
|
6
9
|
import Avatar from '@atlaskit/avatar';
|
|
7
10
|
import mergeRefs from '@atlaskit/ds-lib/merge-refs';
|
|
8
11
|
import { ButtonItem, CustomItem, LinkItem } from '@atlaskit/menu';
|
|
12
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
13
|
import useRegisterItemWithFocusManager from './internal/hooks/use-register-item-with-focus-manager';
|
|
10
14
|
var AvatarGroupItem = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
11
15
|
var avatar = props.avatar,
|
|
16
|
+
avatarComponent = props.avatarComponent,
|
|
12
17
|
index = props.index,
|
|
13
18
|
onAvatarClick = props.onAvatarClick,
|
|
14
19
|
testId = props.testId,
|
|
20
|
+
avatarOverrides = props.avatarOverrides,
|
|
15
21
|
role = props.role;
|
|
16
22
|
var analyticsContext = avatar.analyticsContext,
|
|
17
23
|
appearance = avatar.appearance,
|
|
@@ -65,7 +71,24 @@ var AvatarGroupItem = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
65
71
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
66
72
|
}, props), children);
|
|
67
73
|
};
|
|
68
|
-
var
|
|
74
|
+
var AvatarComponent = fg('platform-avatar-group-pass-avatar-to-item') ? avatarComponent !== null && avatarComponent !== void 0 ? avatarComponent : Avatar : Avatar;
|
|
75
|
+
var AvatarIcon = avatarOverrides && fg('platform-avatar-group-pass-avatar-to-item') ? avatarOverrides.render(AvatarComponent, _objectSpread(_objectSpread({}, rest), {}, {
|
|
76
|
+
analyticsContext: analyticsContext,
|
|
77
|
+
appearance: appearance,
|
|
78
|
+
as: as,
|
|
79
|
+
borderColor: 'transparent',
|
|
80
|
+
children: children,
|
|
81
|
+
isDisabled: isDisabled,
|
|
82
|
+
label: label,
|
|
83
|
+
name: '',
|
|
84
|
+
presence: presence,
|
|
85
|
+
size: 'small',
|
|
86
|
+
src: src,
|
|
87
|
+
stackIndex: stackIndex,
|
|
88
|
+
status: status,
|
|
89
|
+
tabIndex: tabIndex,
|
|
90
|
+
testId: testId && "".concat(testId, "--avatar")
|
|
91
|
+
}), 0) : /*#__PURE__*/React.createElement(AvatarComponent, _extends({}, rest, {
|
|
69
92
|
analyticsContext: analyticsContext,
|
|
70
93
|
appearance: appearance,
|
|
71
94
|
as: as,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
1
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
4
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
5
4
|
var _excluded = ["aria-controls", "aria-expanded", "aria-haspopup", "onClick"];
|
|
6
5
|
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; }
|
|
7
6
|
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; }
|
|
@@ -19,6 +18,7 @@ import Popup from '@atlaskit/popup';
|
|
|
19
18
|
import Tooltip from '@atlaskit/tooltip';
|
|
20
19
|
import AvatarGroupItem from './avatar-group-item';
|
|
21
20
|
import { MoreDropdownTopLayer } from './avatar-group-top-layer';
|
|
21
|
+
import { getOverrides } from './get-overrides';
|
|
22
22
|
import Grid from './grid';
|
|
23
23
|
import FocusManager from './internal/components/focus-manager';
|
|
24
24
|
import PopupAvatarGroup from './internal/components/popup-avatar-group';
|
|
@@ -29,34 +29,6 @@ var MAX_COUNT = {
|
|
|
29
29
|
grid: 11,
|
|
30
30
|
stack: 5
|
|
31
31
|
};
|
|
32
|
-
function getOverrides(overrides) {
|
|
33
|
-
return {
|
|
34
|
-
AvatarGroupItem: _objectSpread({
|
|
35
|
-
render: function render(Component, props, index) {
|
|
36
|
-
return /*#__PURE__*/React.createElement(Component, _extends({}, props, {
|
|
37
|
-
key: composeUniqueKey(props.avatar, index)
|
|
38
|
-
}));
|
|
39
|
-
}
|
|
40
|
-
}, overrides && overrides.AvatarGroupItem),
|
|
41
|
-
Avatar: _objectSpread({
|
|
42
|
-
render: function render(Component, props, index) {
|
|
43
|
-
return (
|
|
44
|
-
/*#__PURE__*/
|
|
45
|
-
//@ts-ignore - TS2604/TS2786: Component type union causing issues for help-center local consumption with TS 5.9.2
|
|
46
|
-
React.createElement(Component, _extends({}, props, {
|
|
47
|
-
key: composeUniqueKey(props, index)
|
|
48
|
-
}))
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
}, overrides && overrides.Avatar),
|
|
52
|
-
MoreIndicator: _objectSpread({
|
|
53
|
-
render: function render(Component, props) {
|
|
54
|
-
return /*#__PURE__*/React.createElement(Component, props);
|
|
55
|
-
}
|
|
56
|
-
}, overrides && overrides.MoreIndicator)
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
|
|
60
32
|
/**
|
|
61
33
|
* __Avatar group__
|
|
62
34
|
*
|
|
@@ -119,6 +91,10 @@ var AvatarGroup = function AvatarGroup(_ref) {
|
|
|
119
91
|
var _useFocus = useFocus(),
|
|
120
92
|
isFocused = _useFocus.isFocused,
|
|
121
93
|
bindFocus = _useFocus.bindFocus;
|
|
94
|
+
var _getOverrides = getOverrides(overrides),
|
|
95
|
+
avatarGroupItemOverrides = _getOverrides.AvatarGroupItem,
|
|
96
|
+
avatarOverrides = _getOverrides.Avatar,
|
|
97
|
+
moreIndicatorOverrides = _getOverrides.MoreIndicator;
|
|
122
98
|
|
|
123
99
|
// When a trigger is focused, we want to open the popup
|
|
124
100
|
// the user presses the DownArrow.
|
|
@@ -180,7 +156,7 @@ var AvatarGroup = function AvatarGroup(_ref) {
|
|
|
180
156
|
ariaHasPopup = _ref3['aria-haspopup'],
|
|
181
157
|
onClick = _ref3.onClick,
|
|
182
158
|
props = _objectWithoutProperties(_ref3, _excluded);
|
|
183
|
-
return
|
|
159
|
+
return moreIndicatorOverrides.render(MoreIndicator, _objectSpread(_objectSpread({
|
|
184
160
|
buttonProps: showMoreButtonProps,
|
|
185
161
|
borderColor: borderColor,
|
|
186
162
|
count: total - max,
|
|
@@ -230,6 +206,7 @@ var AvatarGroup = function AvatarGroup(_ref) {
|
|
|
230
206
|
}
|
|
231
207
|
return boundariesElement === 'window' ? 'document' : 'viewport';
|
|
232
208
|
}();
|
|
209
|
+
var avatarComponent = avatar && fg('platform-avatar-group-pass-avatar-to-item') ? avatar : undefined;
|
|
233
210
|
return /*#__PURE__*/React.createElement(Popup, {
|
|
234
211
|
isOpen: isOpen,
|
|
235
212
|
onClose: onClose,
|
|
@@ -251,10 +228,12 @@ var AvatarGroup = function AvatarGroup(_ref) {
|
|
|
251
228
|
}, /*#__PURE__*/React.createElement(Section, {
|
|
252
229
|
titleId: labelId,
|
|
253
230
|
testId: "".concat(testId, "--section")
|
|
254
|
-
}, data.slice(max).map(function (
|
|
255
|
-
return
|
|
256
|
-
avatar:
|
|
231
|
+
}, data.slice(max).map(function (avatarData, index) {
|
|
232
|
+
return avatarGroupItemOverrides.render(AvatarGroupItem, {
|
|
233
|
+
avatar: avatarData,
|
|
234
|
+
avatarComponent: avatarComponent,
|
|
257
235
|
onAvatarClick: onAvatarClick,
|
|
236
|
+
avatarOverrides: avatarOverrides,
|
|
258
237
|
testId: testId && "".concat(testId, "--avatar-group-item-").concat(index + max),
|
|
259
238
|
index: index + max
|
|
260
239
|
},
|
|
@@ -287,7 +266,7 @@ var AvatarGroup = function AvatarGroup(_ref) {
|
|
|
287
266
|
size: size
|
|
288
267
|
}, data.slice(0, maxAvatar).map(function (avatarData, idx) {
|
|
289
268
|
var callback = avatarData.onClick || onAvatarClick;
|
|
290
|
-
var finalAvatar =
|
|
269
|
+
var finalAvatar = avatarOverrides.render(avatar, _objectSpread(_objectSpread({}, avatarData), {}, {
|
|
291
270
|
size: size,
|
|
292
271
|
borderColor: borderColor || avatarData.borderColor,
|
|
293
272
|
testId: testId && "".concat(testId, "--avatar-").concat(idx),
|
|
@@ -320,7 +299,7 @@ var AvatarGroup = function AvatarGroup(_ref) {
|
|
|
320
299
|
"aria-label": label
|
|
321
300
|
}, data.slice(0, maxAvatar).map(function (avatarData, idx) {
|
|
322
301
|
var callback = avatarData.onClick || onAvatarClick;
|
|
323
|
-
var finalAvatar =
|
|
302
|
+
var finalAvatar = avatarOverrides.render(avatar, _objectSpread(_objectSpread({}, avatarData), {}, {
|
|
324
303
|
size: size,
|
|
325
304
|
borderColor: borderColor || avatarData.borderColor,
|
|
326
305
|
testId: testId && "".concat(testId, "--avatar-").concat(idx),
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { composeUniqueKey } from './utils';
|
|
7
|
+
export function getOverrides(overrides) {
|
|
8
|
+
return {
|
|
9
|
+
AvatarGroupItem: _objectSpread({
|
|
10
|
+
render: function render(Component, props, index) {
|
|
11
|
+
return /*#__PURE__*/React.createElement(Component, _extends({}, props, {
|
|
12
|
+
key: composeUniqueKey(props.avatar, index)
|
|
13
|
+
}));
|
|
14
|
+
}
|
|
15
|
+
}, overrides && overrides.AvatarGroupItem),
|
|
16
|
+
Avatar: _objectSpread({
|
|
17
|
+
render: function render(Component, props, index) {
|
|
18
|
+
return (
|
|
19
|
+
/*#__PURE__*/
|
|
20
|
+
//@ts-ignore - TS2604/TS2786: Component type union causing issues for help-center local consumption with TS 5.9.2
|
|
21
|
+
React.createElement(Component, _extends({}, props, {
|
|
22
|
+
key: composeUniqueKey(props, index)
|
|
23
|
+
}))
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
}, overrides && overrides.Avatar),
|
|
27
|
+
MoreIndicator: _objectSpread({
|
|
28
|
+
render: function render(Component, props) {
|
|
29
|
+
return /*#__PURE__*/React.createElement(Component, props);
|
|
30
|
+
}
|
|
31
|
+
}, overrides && overrides.MoreIndicator)
|
|
32
|
+
};
|
|
33
|
+
}
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { type ElementType } from 'react';
|
|
2
|
+
import Avatar from '@atlaskit/avatar';
|
|
3
|
+
import { type getOverrides } from './get-overrides';
|
|
2
4
|
import { type AvatarProps, type onAvatarClickHandler } from './types';
|
|
3
5
|
export interface AvatarGroupItemProps {
|
|
4
6
|
avatar: AvatarProps;
|
|
7
|
+
/**
|
|
8
|
+
* Custom component used to render the avatar inside the dropdown menu item.
|
|
9
|
+
* When not provided, defaults to the standard Avatar component.
|
|
10
|
+
*/
|
|
11
|
+
avatarComponent?: typeof Avatar | ElementType<AvatarProps>;
|
|
5
12
|
isActive?: boolean;
|
|
6
13
|
isHover?: boolean;
|
|
14
|
+
avatarOverrides?: ReturnType<typeof getOverrides>['Avatar'];
|
|
7
15
|
index: number;
|
|
8
16
|
onAvatarClick?: onAvatarClickHandler;
|
|
9
17
|
testId?: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { AvatarProps } from './types';
|
|
2
2
|
export declare const composeUniqueKey: (props: AvatarProps, index: number) => string | number;
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { type ElementType } from 'react';
|
|
2
|
+
import Avatar from '@atlaskit/avatar';
|
|
3
|
+
import { type getOverrides } from './get-overrides';
|
|
2
4
|
import { type AvatarProps, type onAvatarClickHandler } from './types';
|
|
3
5
|
export interface AvatarGroupItemProps {
|
|
4
6
|
avatar: AvatarProps;
|
|
7
|
+
/**
|
|
8
|
+
* Custom component used to render the avatar inside the dropdown menu item.
|
|
9
|
+
* When not provided, defaults to the standard Avatar component.
|
|
10
|
+
*/
|
|
11
|
+
avatarComponent?: typeof Avatar | ElementType<AvatarProps>;
|
|
5
12
|
isActive?: boolean;
|
|
6
13
|
isHover?: boolean;
|
|
14
|
+
avatarOverrides?: ReturnType<typeof getOverrides>['Avatar'];
|
|
7
15
|
index: number;
|
|
8
16
|
onAvatarClick?: onAvatarClickHandler;
|
|
9
17
|
testId?: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { AvatarProps } from './types';
|
|
2
2
|
export declare const composeUniqueKey: (props: AvatarProps, index: number) => string | number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/avatar-group",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.10.0",
|
|
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/"
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
"@atlaskit/menu": "^8.5.0",
|
|
38
38
|
"@atlaskit/motion": "^6.2.0",
|
|
39
39
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
40
|
-
"@atlaskit/popup": "^4.
|
|
40
|
+
"@atlaskit/popup": "^4.19.0",
|
|
41
41
|
"@atlaskit/tokens": "^13.0.0",
|
|
42
|
-
"@atlaskit/tooltip": "^22.
|
|
42
|
+
"@atlaskit/tooltip": "^22.2.0",
|
|
43
43
|
"@atlaskit/top-layer": "^0.6.0",
|
|
44
44
|
"@babel/runtime": "^7.0.0",
|
|
45
45
|
"@compiled/react": "^0.20.0",
|
|
@@ -62,9 +62,11 @@
|
|
|
62
62
|
"@atlaskit/primitives": "^19.0.0",
|
|
63
63
|
"@atlaskit/section-message": "^8.12.0",
|
|
64
64
|
"@atlaskit/toggle": "^15.6.0",
|
|
65
|
+
"@atlassian/feature-flags-test-utils": "^1.1.0",
|
|
65
66
|
"@atlassian/react-compiler-gating": "workspace:^",
|
|
66
67
|
"@atlassian/ssr-tests": "workspace:^",
|
|
67
68
|
"@atlassian/structured-docs-types": "workspace:^",
|
|
69
|
+
"@atlassian/testing-library": "^0.5.0",
|
|
68
70
|
"@testing-library/react": "^16.3.0",
|
|
69
71
|
"@testing-library/user-event": "^14.4.3",
|
|
70
72
|
"lodash": "^4.17.21",
|
|
@@ -119,6 +121,9 @@
|
|
|
119
121
|
},
|
|
120
122
|
"remove_scaling_from_avatar_stack": {
|
|
121
123
|
"type": "boolean"
|
|
124
|
+
},
|
|
125
|
+
"platform-avatar-group-pass-avatar-to-item": {
|
|
126
|
+
"type": "boolean"
|
|
122
127
|
}
|
|
123
128
|
}
|
|
124
129
|
}
|