@atlaskit/profilecard 19.10.0 → 19.11.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 +10 -0
- package/dist/cjs/client/getTeamFromAGG.js +1 -1
- package/dist/cjs/components/User/ProfileCard.js +1 -7
- package/dist/cjs/components/User/ProfileCardTriggerNext.js +9 -4
- package/dist/cjs/internal/getLabelMessage.js +28 -0
- package/dist/cjs/util/analytics.js +1 -1
- package/dist/es2019/client/getTeamFromAGG.js +1 -1
- package/dist/es2019/components/User/ProfileCard.js +2 -8
- package/dist/es2019/components/User/ProfileCardTriggerNext.js +10 -4
- package/dist/es2019/internal/getLabelMessage.js +22 -0
- package/dist/es2019/util/analytics.js +1 -1
- package/dist/esm/client/getTeamFromAGG.js +1 -1
- package/dist/esm/components/User/ProfileCard.js +2 -8
- package/dist/esm/components/User/ProfileCardTriggerNext.js +9 -4
- package/dist/esm/internal/getLabelMessage.js +22 -0
- package/dist/esm/util/analytics.js +1 -1
- package/dist/types/components/User/ProfileCardTriggerNext.d.ts +1 -1
- package/dist/types/internal/getLabelMessage.d.ts +3 -0
- package/dist/types/types.d.ts +5 -0
- package/dist/types-ts4.5/components/User/ProfileCardTriggerNext.d.ts +1 -1
- package/dist/types-ts4.5/internal/getLabelMessage.d.ts +3 -0
- package/dist/types-ts4.5/types.d.ts +5 -0
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @atlaskit/profilecard
|
|
2
2
|
|
|
3
|
+
## 19.11.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#72021](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/72021) [`bfb147303ac8`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/bfb147303ac8) - Pass fullName props to ProfileCardTrigger, and update aria-label message
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
3
13
|
## 19.10.0
|
|
4
14
|
|
|
5
15
|
### Minor Changes
|
|
@@ -57,7 +57,7 @@ var addHeaders = exports.addHeaders = function addHeaders(headers) {
|
|
|
57
57
|
headers.append('X-ExperimentalApi', 'teams-beta');
|
|
58
58
|
headers.append('X-ExperimentalApi', 'team-members-beta');
|
|
59
59
|
headers.append('atl-client-name', "@atlaskit/profilecard");
|
|
60
|
-
headers.append('atl-client-version', "19.
|
|
60
|
+
headers.append('atl-client-version', "19.11.0");
|
|
61
61
|
return headers;
|
|
62
62
|
};
|
|
63
63
|
function getTeamFromAGG(_x, _x2, _x3) {
|
|
@@ -154,12 +154,6 @@ var Actions = function Actions(_ref) {
|
|
|
154
154
|
action.callback.apply(action, [event].concat((0, _toConsumableArray2.default)(args)));
|
|
155
155
|
}
|
|
156
156
|
}, [fireAnalyticsWithDuration]);
|
|
157
|
-
var buttonRef = (0, _react.useRef)(null);
|
|
158
|
-
(0, _react.useEffect)(function () {
|
|
159
|
-
if (actions.length > 0 && buttonRef.current && isTriggeredUsingKeyboard) {
|
|
160
|
-
buttonRef.current.focus();
|
|
161
|
-
}
|
|
162
|
-
}, [isTriggeredUsingKeyboard, actions.length]);
|
|
163
157
|
if (!actions || actions.length === 0) {
|
|
164
158
|
return null;
|
|
165
159
|
}
|
|
@@ -182,7 +176,7 @@ var Actions = function Actions(_ref) {
|
|
|
182
176
|
return onActionClick(action, args, event, index);
|
|
183
177
|
},
|
|
184
178
|
href: action.link,
|
|
185
|
-
|
|
179
|
+
autoFocus: index === 0 && isTriggeredUsingKeyboard
|
|
186
180
|
}, action.label, isKudos && /*#__PURE__*/_react.default.createElement(_Card.AnimationWrapper, null, /*#__PURE__*/_react.default.createElement(_Card.KudosBlobAnimation, null))));
|
|
187
181
|
if (isKudos) {
|
|
188
182
|
return /*#__PURE__*/_react.default.createElement(_Card.AnimatedKudosButton, {
|
|
@@ -14,11 +14,13 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
|
|
|
14
14
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
15
15
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
16
16
|
var _react = _interopRequireWildcard(require("react"));
|
|
17
|
+
var _reactIntlNext = require("react-intl-next");
|
|
17
18
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
18
19
|
var _giveKudos = require("@atlaskit/give-kudos");
|
|
19
20
|
var _popup = _interopRequireDefault(require("@atlaskit/popup"));
|
|
20
21
|
var _constants = require("@atlaskit/theme/constants");
|
|
21
22
|
var _filterActions = _interopRequireDefault(require("../../internal/filterActions"));
|
|
23
|
+
var _getLabelMessage = _interopRequireDefault(require("../../internal/getLabelMessage"));
|
|
22
24
|
var _Card = require("../../styled/Card");
|
|
23
25
|
var _analytics = require("../../util/analytics");
|
|
24
26
|
var _config = require("../../util/config");
|
|
@@ -44,9 +46,12 @@ function ProfilecardTriggerNext(_ref) {
|
|
|
44
46
|
addFlag = _ref.addFlag,
|
|
45
47
|
onReportingLinesClick = _ref.onReportingLinesClick,
|
|
46
48
|
ariaLabel = _ref.ariaLabel,
|
|
47
|
-
ariaLabelledBy = _ref.ariaLabelledBy
|
|
49
|
+
ariaLabelledBy = _ref.ariaLabelledBy,
|
|
50
|
+
prepopulatedData = _ref.prepopulatedData;
|
|
48
51
|
var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
|
|
49
52
|
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
53
|
+
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
54
|
+
formatMessage = _useIntl.formatMessage;
|
|
50
55
|
var _useState = (0, _react.useState)(false),
|
|
51
56
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
52
57
|
isMounted = _useState2[0],
|
|
@@ -136,10 +141,9 @@ function ProfilecardTriggerNext(_ref) {
|
|
|
136
141
|
setVisible(false);
|
|
137
142
|
}, hideDelay));
|
|
138
143
|
}
|
|
139
|
-
setTriggeredUsingKeyboard(false);
|
|
140
144
|
}, [hideDelay, hideTimer, showTimer, isTriggeredUsingKeyboard]);
|
|
141
145
|
var handleKeyboardClose = (0, _react.useCallback)(function (event) {
|
|
142
|
-
if (event.key !== 'Escape') {
|
|
146
|
+
if (event.key && event.key !== 'Escape') {
|
|
143
147
|
return;
|
|
144
148
|
}
|
|
145
149
|
if (triggerRef.current) {
|
|
@@ -271,6 +275,7 @@ function ProfilecardTriggerNext(_ref) {
|
|
|
271
275
|
}, [hideProfilecard, onFocus, onMouseEnter, trigger]);
|
|
272
276
|
var profilecardProps = _objectSpread(_objectSpread({
|
|
273
277
|
userId: userId,
|
|
278
|
+
fullName: prepopulatedData === null || prepopulatedData === void 0 ? void 0 : prepopulatedData.fullName,
|
|
274
279
|
isCurrentUser: data === null || data === void 0 ? void 0 : data.isCurrentUser,
|
|
275
280
|
clientFetchProfile: clientFetchProfile
|
|
276
281
|
}, data), {}, {
|
|
@@ -315,7 +320,7 @@ function ProfilecardTriggerNext(_ref) {
|
|
|
315
320
|
"data-testid": testId,
|
|
316
321
|
role: "button",
|
|
317
322
|
tabIndex: 0,
|
|
318
|
-
"aria-label": ariaLabel,
|
|
323
|
+
"aria-label": (0, _getLabelMessage.default)(ariaLabel, profilecardProps.fullName, formatMessage),
|
|
319
324
|
"aria-labelledby": ariaLabelledBy
|
|
320
325
|
}), children);
|
|
321
326
|
},
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _reactIntlNext = require("react-intl-next");
|
|
8
|
+
var getLabelMessage = function getLabelMessage(ariaLabelProp, fullName, formatMessage) {
|
|
9
|
+
if (ariaLabelProp) {
|
|
10
|
+
return ariaLabelProp;
|
|
11
|
+
}
|
|
12
|
+
return fullName ? formatMessage(messages.label, {
|
|
13
|
+
fullName: fullName
|
|
14
|
+
}) : formatMessage(messages.fallbackLabel);
|
|
15
|
+
};
|
|
16
|
+
var messages = (0, _reactIntlNext.defineMessages)({
|
|
17
|
+
fallbackLabel: {
|
|
18
|
+
id: 'profilecard.user.trigger.fallback-aria-label',
|
|
19
|
+
defaultMessage: 'More information about this user',
|
|
20
|
+
description: 'Label for profile card trigger when we do not have user name'
|
|
21
|
+
},
|
|
22
|
+
label: {
|
|
23
|
+
id: 'profilecard.user.trigger.aria-label',
|
|
24
|
+
defaultMessage: 'More information about {fullName}',
|
|
25
|
+
description: 'Label for profile card trigger'
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
var _default = exports.default = getLabelMessage;
|
|
@@ -44,7 +44,7 @@ var createEvent = function createEvent(eventType, action, actionSubject, actionS
|
|
|
44
44
|
actionSubjectId: actionSubjectId,
|
|
45
45
|
attributes: _objectSpread(_objectSpread({
|
|
46
46
|
packageName: "@atlaskit/profilecard",
|
|
47
|
-
packageVersion: "19.
|
|
47
|
+
packageVersion: "19.11.0"
|
|
48
48
|
}, attributes), {}, {
|
|
49
49
|
firedAt: Math.round((0, _performance.getPageTime)())
|
|
50
50
|
})
|
|
@@ -67,7 +67,7 @@ export const addHeaders = headers => {
|
|
|
67
67
|
headers.append('X-ExperimentalApi', 'teams-beta');
|
|
68
68
|
headers.append('X-ExperimentalApi', 'team-members-beta');
|
|
69
69
|
headers.append('atl-client-name', "@atlaskit/profilecard");
|
|
70
|
-
headers.append('atl-client-version', "19.
|
|
70
|
+
headers.append('atl-client-version', "19.11.0");
|
|
71
71
|
return headers;
|
|
72
72
|
};
|
|
73
73
|
export async function getTeamFromAGG(url, teamId, siteId) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import React, { useCallback, useEffect, useMemo,
|
|
2
|
+
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
3
3
|
import { FormattedMessage } from 'react-intl-next';
|
|
4
4
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
5
5
|
import Avatar from '@atlaskit/avatar';
|
|
@@ -140,12 +140,6 @@ const Actions = ({
|
|
|
140
140
|
action.callback(event, ...args);
|
|
141
141
|
}
|
|
142
142
|
}, [fireAnalyticsWithDuration]);
|
|
143
|
-
const buttonRef = useRef(null);
|
|
144
|
-
useEffect(() => {
|
|
145
|
-
if (actions.length > 0 && buttonRef.current && isTriggeredUsingKeyboard) {
|
|
146
|
-
buttonRef.current.focus();
|
|
147
|
-
}
|
|
148
|
-
}, [isTriggeredUsingKeyboard, actions.length]);
|
|
149
143
|
if (!actions || actions.length === 0) {
|
|
150
144
|
return null;
|
|
151
145
|
}
|
|
@@ -163,7 +157,7 @@ const Actions = ({
|
|
|
163
157
|
key: action.id || index,
|
|
164
158
|
onClick: (event, ...args) => onActionClick(action, args, event, index),
|
|
165
159
|
href: action.link,
|
|
166
|
-
|
|
160
|
+
autoFocus: index === 0 && isTriggeredUsingKeyboard
|
|
167
161
|
}, action.label, isKudos && /*#__PURE__*/React.createElement(AnimationWrapper, null, /*#__PURE__*/React.createElement(KudosBlobAnimation, null))));
|
|
168
162
|
if (isKudos) {
|
|
169
163
|
return /*#__PURE__*/React.createElement(AnimatedKudosButton, {
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { Suspense, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
+
import { useIntl } from 'react-intl-next';
|
|
3
4
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
4
5
|
import { GiveKudosLauncherLazy, KudosType } from '@atlaskit/give-kudos';
|
|
5
6
|
import Popup from '@atlaskit/popup';
|
|
6
7
|
import { layers } from '@atlaskit/theme/constants';
|
|
7
8
|
import filterActionsInner from '../../internal/filterActions';
|
|
9
|
+
import getLabelMessage from '../../internal/getLabelMessage';
|
|
8
10
|
import { CardWrapper } from '../../styled/Card';
|
|
9
11
|
import { cardTriggered, fireEvent } from '../../util/analytics';
|
|
10
12
|
import { DELAY_MS_HIDE, DELAY_MS_SHOW } from '../../util/config';
|
|
@@ -22,11 +24,15 @@ export default function ProfilecardTriggerNext({
|
|
|
22
24
|
addFlag,
|
|
23
25
|
onReportingLinesClick,
|
|
24
26
|
ariaLabel,
|
|
25
|
-
ariaLabelledBy
|
|
27
|
+
ariaLabelledBy,
|
|
28
|
+
prepopulatedData
|
|
26
29
|
}) {
|
|
27
30
|
const {
|
|
28
31
|
createAnalyticsEvent
|
|
29
32
|
} = useAnalyticsEvents();
|
|
33
|
+
const {
|
|
34
|
+
formatMessage
|
|
35
|
+
} = useIntl();
|
|
30
36
|
const [isMounted, setIsMounted] = useState(false);
|
|
31
37
|
const showDelay = trigger === 'click' ? 0 : DELAY_MS_SHOW;
|
|
32
38
|
const hideDelay = trigger === 'click' ? 0 : DELAY_MS_HIDE;
|
|
@@ -77,10 +83,9 @@ export default function ProfilecardTriggerNext({
|
|
|
77
83
|
setVisible(false);
|
|
78
84
|
}, hideDelay));
|
|
79
85
|
}
|
|
80
|
-
setTriggeredUsingKeyboard(false);
|
|
81
86
|
}, [hideDelay, hideTimer, showTimer, isTriggeredUsingKeyboard]);
|
|
82
87
|
const handleKeyboardClose = useCallback(event => {
|
|
83
|
-
if (event.key !== 'Escape') {
|
|
88
|
+
if (event.key && event.key !== 'Escape') {
|
|
84
89
|
return;
|
|
85
90
|
}
|
|
86
91
|
if (triggerRef.current) {
|
|
@@ -191,6 +196,7 @@ export default function ProfilecardTriggerNext({
|
|
|
191
196
|
} : {}, [hideProfilecard, onFocus, onMouseEnter, trigger]);
|
|
192
197
|
const profilecardProps = {
|
|
193
198
|
userId: userId,
|
|
199
|
+
fullName: prepopulatedData === null || prepopulatedData === void 0 ? void 0 : prepopulatedData.fullName,
|
|
194
200
|
isCurrentUser: data === null || data === void 0 ? void 0 : data.isCurrentUser,
|
|
195
201
|
clientFetchProfile: clientFetchProfile,
|
|
196
202
|
...data,
|
|
@@ -235,7 +241,7 @@ export default function ProfilecardTriggerNext({
|
|
|
235
241
|
"data-testid": testId,
|
|
236
242
|
role: "button",
|
|
237
243
|
tabIndex: 0,
|
|
238
|
-
"aria-label": ariaLabel,
|
|
244
|
+
"aria-label": getLabelMessage(ariaLabel, profilecardProps.fullName, formatMessage),
|
|
239
245
|
"aria-labelledby": ariaLabelledBy
|
|
240
246
|
}), children);
|
|
241
247
|
},
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { defineMessages } from 'react-intl-next';
|
|
2
|
+
const getLabelMessage = (ariaLabelProp, fullName, formatMessage) => {
|
|
3
|
+
if (ariaLabelProp) {
|
|
4
|
+
return ariaLabelProp;
|
|
5
|
+
}
|
|
6
|
+
return fullName ? formatMessage(messages.label, {
|
|
7
|
+
fullName
|
|
8
|
+
}) : formatMessage(messages.fallbackLabel);
|
|
9
|
+
};
|
|
10
|
+
const messages = defineMessages({
|
|
11
|
+
fallbackLabel: {
|
|
12
|
+
id: 'profilecard.user.trigger.fallback-aria-label',
|
|
13
|
+
defaultMessage: 'More information about this user',
|
|
14
|
+
description: 'Label for profile card trigger when we do not have user name'
|
|
15
|
+
},
|
|
16
|
+
label: {
|
|
17
|
+
id: 'profilecard.user.trigger.aria-label',
|
|
18
|
+
defaultMessage: 'More information about {fullName}',
|
|
19
|
+
description: 'Label for profile card trigger'
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
export default getLabelMessage;
|
|
@@ -31,7 +31,7 @@ const createEvent = (eventType, action, actionSubject, actionSubjectId, attribut
|
|
|
31
31
|
actionSubjectId,
|
|
32
32
|
attributes: {
|
|
33
33
|
packageName: "@atlaskit/profilecard",
|
|
34
|
-
packageVersion: "19.
|
|
34
|
+
packageVersion: "19.11.0",
|
|
35
35
|
...attributes,
|
|
36
36
|
firedAt: Math.round(getPageTime())
|
|
37
37
|
}
|
|
@@ -48,7 +48,7 @@ export var addHeaders = function addHeaders(headers) {
|
|
|
48
48
|
headers.append('X-ExperimentalApi', 'teams-beta');
|
|
49
49
|
headers.append('X-ExperimentalApi', 'team-members-beta');
|
|
50
50
|
headers.append('atl-client-name', "@atlaskit/profilecard");
|
|
51
|
-
headers.append('atl-client-version', "19.
|
|
51
|
+
headers.append('atl-client-version', "19.11.0");
|
|
52
52
|
return headers;
|
|
53
53
|
};
|
|
54
54
|
export function getTeamFromAGG(_x, _x2, _x3) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
|
-
import React, { useCallback, useEffect, useMemo,
|
|
4
|
+
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
5
5
|
import { FormattedMessage } from 'react-intl-next';
|
|
6
6
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
7
7
|
import Avatar from '@atlaskit/avatar';
|
|
@@ -144,12 +144,6 @@ var Actions = function Actions(_ref) {
|
|
|
144
144
|
action.callback.apply(action, [event].concat(_toConsumableArray(args)));
|
|
145
145
|
}
|
|
146
146
|
}, [fireAnalyticsWithDuration]);
|
|
147
|
-
var buttonRef = useRef(null);
|
|
148
|
-
useEffect(function () {
|
|
149
|
-
if (actions.length > 0 && buttonRef.current && isTriggeredUsingKeyboard) {
|
|
150
|
-
buttonRef.current.focus();
|
|
151
|
-
}
|
|
152
|
-
}, [isTriggeredUsingKeyboard, actions.length]);
|
|
153
147
|
if (!actions || actions.length === 0) {
|
|
154
148
|
return null;
|
|
155
149
|
}
|
|
@@ -172,7 +166,7 @@ var Actions = function Actions(_ref) {
|
|
|
172
166
|
return onActionClick(action, args, event, index);
|
|
173
167
|
},
|
|
174
168
|
href: action.link,
|
|
175
|
-
|
|
169
|
+
autoFocus: index === 0 && isTriggeredUsingKeyboard
|
|
176
170
|
}, action.label, isKudos && /*#__PURE__*/React.createElement(AnimationWrapper, null, /*#__PURE__*/React.createElement(KudosBlobAnimation, null))));
|
|
177
171
|
if (isKudos) {
|
|
178
172
|
return /*#__PURE__*/React.createElement(AnimatedKudosButton, {
|
|
@@ -9,11 +9,13 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
9
9
|
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; }
|
|
10
10
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
11
11
|
import React, { Suspense, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
12
|
+
import { useIntl } from 'react-intl-next';
|
|
12
13
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
13
14
|
import { GiveKudosLauncherLazy, KudosType } from '@atlaskit/give-kudos';
|
|
14
15
|
import Popup from '@atlaskit/popup';
|
|
15
16
|
import { layers } from '@atlaskit/theme/constants';
|
|
16
17
|
import filterActionsInner from '../../internal/filterActions';
|
|
18
|
+
import getLabelMessage from '../../internal/getLabelMessage';
|
|
17
19
|
import { CardWrapper } from '../../styled/Card';
|
|
18
20
|
import { cardTriggered, fireEvent } from '../../util/analytics';
|
|
19
21
|
import { DELAY_MS_HIDE, DELAY_MS_SHOW } from '../../util/config';
|
|
@@ -34,9 +36,12 @@ export default function ProfilecardTriggerNext(_ref) {
|
|
|
34
36
|
addFlag = _ref.addFlag,
|
|
35
37
|
onReportingLinesClick = _ref.onReportingLinesClick,
|
|
36
38
|
ariaLabel = _ref.ariaLabel,
|
|
37
|
-
ariaLabelledBy = _ref.ariaLabelledBy
|
|
39
|
+
ariaLabelledBy = _ref.ariaLabelledBy,
|
|
40
|
+
prepopulatedData = _ref.prepopulatedData;
|
|
38
41
|
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
39
42
|
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
43
|
+
var _useIntl = useIntl(),
|
|
44
|
+
formatMessage = _useIntl.formatMessage;
|
|
40
45
|
var _useState = useState(false),
|
|
41
46
|
_useState2 = _slicedToArray(_useState, 2),
|
|
42
47
|
isMounted = _useState2[0],
|
|
@@ -126,10 +131,9 @@ export default function ProfilecardTriggerNext(_ref) {
|
|
|
126
131
|
setVisible(false);
|
|
127
132
|
}, hideDelay));
|
|
128
133
|
}
|
|
129
|
-
setTriggeredUsingKeyboard(false);
|
|
130
134
|
}, [hideDelay, hideTimer, showTimer, isTriggeredUsingKeyboard]);
|
|
131
135
|
var handleKeyboardClose = useCallback(function (event) {
|
|
132
|
-
if (event.key !== 'Escape') {
|
|
136
|
+
if (event.key && event.key !== 'Escape') {
|
|
133
137
|
return;
|
|
134
138
|
}
|
|
135
139
|
if (triggerRef.current) {
|
|
@@ -261,6 +265,7 @@ export default function ProfilecardTriggerNext(_ref) {
|
|
|
261
265
|
}, [hideProfilecard, onFocus, onMouseEnter, trigger]);
|
|
262
266
|
var profilecardProps = _objectSpread(_objectSpread({
|
|
263
267
|
userId: userId,
|
|
268
|
+
fullName: prepopulatedData === null || prepopulatedData === void 0 ? void 0 : prepopulatedData.fullName,
|
|
264
269
|
isCurrentUser: data === null || data === void 0 ? void 0 : data.isCurrentUser,
|
|
265
270
|
clientFetchProfile: clientFetchProfile
|
|
266
271
|
}, data), {}, {
|
|
@@ -305,7 +310,7 @@ export default function ProfilecardTriggerNext(_ref) {
|
|
|
305
310
|
"data-testid": testId,
|
|
306
311
|
role: "button",
|
|
307
312
|
tabIndex: 0,
|
|
308
|
-
"aria-label": ariaLabel,
|
|
313
|
+
"aria-label": getLabelMessage(ariaLabel, profilecardProps.fullName, formatMessage),
|
|
309
314
|
"aria-labelledby": ariaLabelledBy
|
|
310
315
|
}), children);
|
|
311
316
|
},
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { defineMessages } from 'react-intl-next';
|
|
2
|
+
var getLabelMessage = function getLabelMessage(ariaLabelProp, fullName, formatMessage) {
|
|
3
|
+
if (ariaLabelProp) {
|
|
4
|
+
return ariaLabelProp;
|
|
5
|
+
}
|
|
6
|
+
return fullName ? formatMessage(messages.label, {
|
|
7
|
+
fullName: fullName
|
|
8
|
+
}) : formatMessage(messages.fallbackLabel);
|
|
9
|
+
};
|
|
10
|
+
var messages = defineMessages({
|
|
11
|
+
fallbackLabel: {
|
|
12
|
+
id: 'profilecard.user.trigger.fallback-aria-label',
|
|
13
|
+
defaultMessage: 'More information about this user',
|
|
14
|
+
description: 'Label for profile card trigger when we do not have user name'
|
|
15
|
+
},
|
|
16
|
+
label: {
|
|
17
|
+
id: 'profilecard.user.trigger.aria-label',
|
|
18
|
+
defaultMessage: 'More information about {fullName}',
|
|
19
|
+
description: 'Label for profile card trigger'
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
export default getLabelMessage;
|
|
@@ -38,7 +38,7 @@ var createEvent = function createEvent(eventType, action, actionSubject, actionS
|
|
|
38
38
|
actionSubjectId: actionSubjectId,
|
|
39
39
|
attributes: _objectSpread(_objectSpread({
|
|
40
40
|
packageName: "@atlaskit/profilecard",
|
|
41
|
-
packageVersion: "19.
|
|
41
|
+
packageVersion: "19.11.0"
|
|
42
42
|
}, attributes), {}, {
|
|
43
43
|
firedAt: Math.round(getPageTime())
|
|
44
44
|
})
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ProfileCardTriggerProps } from '../../types';
|
|
3
|
-
export default function ProfilecardTriggerNext({ trigger, userId, cloudId, resourceClient, actions, position, children, testId, addFlag, onReportingLinesClick, ariaLabel, ariaLabelledBy, }: ProfileCardTriggerProps): JSX.Element;
|
|
3
|
+
export default function ProfilecardTriggerNext({ trigger, userId, cloudId, resourceClient, actions, position, children, testId, addFlag, onReportingLinesClick, ariaLabel, ariaLabelledBy, prepopulatedData, }: ProfileCardTriggerProps): JSX.Element;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { MessageDescriptor } from 'react-intl-next';
|
|
2
|
+
declare const getLabelMessage: (ariaLabelProp: string | undefined, fullName: string | undefined, formatMessage: (message: MessageDescriptor, values?: Record<string, string>) => string) => string;
|
|
3
|
+
export default getLabelMessage;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -115,6 +115,7 @@ export interface ProfileCardTriggerProps {
|
|
|
115
115
|
addFlag?: (flag: any) => void;
|
|
116
116
|
ariaLabel?: string;
|
|
117
117
|
ariaLabelledBy?: string;
|
|
118
|
+
prepopulatedData?: PrepopulatedData;
|
|
118
119
|
}
|
|
119
120
|
export interface ProfileCardTriggerState {
|
|
120
121
|
visible?: boolean;
|
|
@@ -362,3 +363,7 @@ export interface ClientOverrides {
|
|
|
362
363
|
teamClient?: TeamProfileCardClient;
|
|
363
364
|
teamCentralClient?: TeamCentralCardClient;
|
|
364
365
|
}
|
|
366
|
+
/** This interface represents the data that is prepopulated in the profile card. **/
|
|
367
|
+
export interface PrepopulatedData {
|
|
368
|
+
fullName?: string;
|
|
369
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ProfileCardTriggerProps } from '../../types';
|
|
3
|
-
export default function ProfilecardTriggerNext({ trigger, userId, cloudId, resourceClient, actions, position, children, testId, addFlag, onReportingLinesClick, ariaLabel, ariaLabelledBy, }: ProfileCardTriggerProps): JSX.Element;
|
|
3
|
+
export default function ProfilecardTriggerNext({ trigger, userId, cloudId, resourceClient, actions, position, children, testId, addFlag, onReportingLinesClick, ariaLabel, ariaLabelledBy, prepopulatedData, }: ProfileCardTriggerProps): JSX.Element;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { MessageDescriptor } from 'react-intl-next';
|
|
2
|
+
declare const getLabelMessage: (ariaLabelProp: string | undefined, fullName: string | undefined, formatMessage: (message: MessageDescriptor, values?: Record<string, string>) => string) => string;
|
|
3
|
+
export default getLabelMessage;
|
|
@@ -115,6 +115,7 @@ export interface ProfileCardTriggerProps {
|
|
|
115
115
|
addFlag?: (flag: any) => void;
|
|
116
116
|
ariaLabel?: string;
|
|
117
117
|
ariaLabelledBy?: string;
|
|
118
|
+
prepopulatedData?: PrepopulatedData;
|
|
118
119
|
}
|
|
119
120
|
export interface ProfileCardTriggerState {
|
|
120
121
|
visible?: boolean;
|
|
@@ -362,3 +363,7 @@ export interface ClientOverrides {
|
|
|
362
363
|
teamClient?: TeamProfileCardClient;
|
|
363
364
|
teamCentralClient?: TeamCentralCardClient;
|
|
364
365
|
}
|
|
366
|
+
/** This interface represents the data that is prepopulated in the profile card. **/
|
|
367
|
+
export interface PrepopulatedData {
|
|
368
|
+
fullName?: string;
|
|
369
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/profilecard",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.11.0",
|
|
4
4
|
"description": "A React component to display a card with user information.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -55,9 +55,9 @@
|
|
|
55
55
|
"@atlaskit/analytics-next": "^9.2.0",
|
|
56
56
|
"@atlaskit/avatar": "^21.4.0",
|
|
57
57
|
"@atlaskit/avatar-group": "^9.5.0",
|
|
58
|
-
"@atlaskit/button": "^17.
|
|
58
|
+
"@atlaskit/button": "^17.4.0",
|
|
59
59
|
"@atlaskit/dropdown-menu": "^12.5.0",
|
|
60
|
-
"@atlaskit/empty-state": "^7.
|
|
60
|
+
"@atlaskit/empty-state": "^7.7.0",
|
|
61
61
|
"@atlaskit/focus-ring": "^1.3.4",
|
|
62
62
|
"@atlaskit/give-kudos": "^2.1.0",
|
|
63
63
|
"@atlaskit/icon": "^22.0.0",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"@atlaskit/popup": "^1.12.0",
|
|
68
68
|
"@atlaskit/spinner": "^16.0.0",
|
|
69
69
|
"@atlaskit/theme": "^12.6.0",
|
|
70
|
-
"@atlaskit/tokens": "^1.
|
|
70
|
+
"@atlaskit/tokens": "^1.37.0",
|
|
71
71
|
"@atlaskit/tooltip": "^18.1.0",
|
|
72
72
|
"@babel/runtime": "^7.0.0",
|
|
73
73
|
"@emotion/react": "^11.7.1",
|