@atlaskit/mention 23.9.0 → 23.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 +8 -0
- package/dist/cjs/api/MentionResource.js +0 -1
- package/dist/cjs/components/Mention/PrimitiveMention.js +1 -0
- package/dist/cjs/components/Mention/index.js +6 -2
- package/dist/cjs/components/MentionDescriptionByline/index.js +9 -1
- package/dist/cjs/components/MentionItem/index.js +12 -3
- package/dist/cjs/components/i18n.js +5 -0
- package/dist/cjs/util/analytics.js +1 -1
- package/dist/es2019/api/MentionResource.js +0 -1
- package/dist/es2019/components/Mention/PrimitiveMention.js +1 -0
- package/dist/es2019/components/Mention/index.js +6 -2
- package/dist/es2019/components/MentionDescriptionByline/index.js +8 -1
- package/dist/es2019/components/MentionItem/index.js +12 -3
- package/dist/es2019/components/i18n.js +5 -0
- package/dist/es2019/util/analytics.js +1 -1
- package/dist/esm/api/MentionResource.js +0 -1
- package/dist/esm/components/Mention/PrimitiveMention.js +1 -0
- package/dist/esm/components/Mention/index.js +6 -2
- package/dist/esm/components/MentionDescriptionByline/index.js +9 -1
- package/dist/esm/components/MentionItem/index.js +12 -3
- package/dist/esm/components/i18n.js +5 -0
- package/dist/esm/util/analytics.js +1 -1
- package/dist/types/api/MentionResource.d.ts +0 -1
- package/dist/types/components/i18n.d.ts +5 -0
- package/dist/types/types.d.ts +0 -2
- package/dist/types-ts4.5/api/MentionResource.d.ts +0 -1
- package/dist/types-ts4.5/components/i18n.d.ts +5 -0
- package/dist/types-ts4.5/types.d.ts +0 -2
- package/package.json +46 -44
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/mention
|
|
2
2
|
|
|
3
|
+
## 23.10.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#105029](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/105029)
|
|
8
|
+
[`d32ea9117bf88`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d32ea9117bf88) -
|
|
9
|
+
Add support for React 18
|
|
10
|
+
|
|
3
11
|
## 23.9.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
|
@@ -187,7 +187,6 @@ var MentionResource = exports.MentionResource = /*#__PURE__*/function (_Abstract
|
|
|
187
187
|
_this.productName = config.productName;
|
|
188
188
|
_this.shouldEnableInvite = !!config.shouldEnableInvite;
|
|
189
189
|
_this.onInviteItemClick = config.onInviteItemClick;
|
|
190
|
-
_this.isEligibleXProductUserInvite = config.isEligibleXProductUserInvite;
|
|
191
190
|
_this.inviteXProductUser = config.inviteXProductUser;
|
|
192
191
|
_this.userRole = config.userRole || 'basic';
|
|
193
192
|
if (_this.config.debounceTime) {
|
|
@@ -124,12 +124,16 @@ var MentionInternal = exports.MentionInternal = /*#__PURE__*/function (_React$Pu
|
|
|
124
124
|
localId = props.localId;
|
|
125
125
|
var mentionType = this.getMentionType();
|
|
126
126
|
var failedMention = text === "@".concat(UNKNOWN_USER_ID);
|
|
127
|
+
var showTooltip = mentionType === _types.MentionType.RESTRICTED;
|
|
127
128
|
var mentionComponent = /*#__PURE__*/_react.default.createElement(_focusRing.default, null, /*#__PURE__*/_react.default.createElement(_PrimitiveMention.default, {
|
|
128
129
|
mentionType: mentionType,
|
|
129
130
|
onClick: handleOnClick,
|
|
130
131
|
onMouseEnter: handleOnMouseEnter,
|
|
131
132
|
onMouseLeave: handleOnMouseLeave,
|
|
132
|
-
spellCheck: false
|
|
133
|
+
spellCheck: false,
|
|
134
|
+
"data-testid": "mention-".concat(id),
|
|
135
|
+
"data-mention-type": mentionType,
|
|
136
|
+
"data-mention-tooltip": showTooltip
|
|
133
137
|
}, failedMention ? this.renderUnknownUserError(id) : text || '@...'));
|
|
134
138
|
return /*#__PURE__*/_react.default.createElement(_ufoExperiences.UfoErrorBoundary, {
|
|
135
139
|
id: id
|
|
@@ -139,7 +143,7 @@ var MentionInternal = exports.MentionInternal = /*#__PURE__*/function (_React$Pu
|
|
|
139
143
|
"data-local-id": localId,
|
|
140
144
|
"data-access-level": accessLevel,
|
|
141
145
|
spellCheck: false
|
|
142
|
-
}, /*#__PURE__*/_react.default.createElement(_MessagesIntlProvider.default, null,
|
|
146
|
+
}, /*#__PURE__*/_react.default.createElement(_MessagesIntlProvider.default, null, showTooltip ? /*#__PURE__*/_react.default.createElement(_react.default.Suspense, {
|
|
143
147
|
fallback: mentionComponent
|
|
144
148
|
}, /*#__PURE__*/_react.default.createElement(_NoAccessTooltip.default, {
|
|
145
149
|
name: text
|
|
@@ -11,9 +11,12 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
|
|
|
11
11
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
12
12
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
13
13
|
var _react = _interopRequireDefault(require("react"));
|
|
14
|
+
var _reactIntlNext = require("react-intl-next");
|
|
14
15
|
var _types = require("../../types");
|
|
15
16
|
var _UserMentionDescriptionByline = _interopRequireDefault(require("./UserMentionDescriptionByline"));
|
|
16
17
|
var _TeamMentionDescriptionByline = _interopRequireDefault(require("./TeamMentionDescriptionByline"));
|
|
18
|
+
var _styles = require("./styles");
|
|
19
|
+
var _i18n = require("../i18n");
|
|
17
20
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
18
21
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
19
22
|
var MentionDescriptionByline = exports.default = /*#__PURE__*/function (_React$PureComponent) {
|
|
@@ -25,7 +28,12 @@ var MentionDescriptionByline = exports.default = /*#__PURE__*/function (_React$P
|
|
|
25
28
|
return (0, _createClass2.default)(MentionDescriptionByline, [{
|
|
26
29
|
key: "render",
|
|
27
30
|
value: function render() {
|
|
28
|
-
var
|
|
31
|
+
var _this$props$mention = this.props.mention,
|
|
32
|
+
userType = _this$props$mention.userType,
|
|
33
|
+
isXProductUser = _this$props$mention.isXProductUser;
|
|
34
|
+
if (isXProductUser) {
|
|
35
|
+
return /*#__PURE__*/_react.default.createElement(_styles.DescriptionBylineStyle, null, /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _i18n.messages.xProductMentionDescription));
|
|
36
|
+
}
|
|
29
37
|
switch (userType) {
|
|
30
38
|
case _types.UserType[_types.UserType.TEAM]:
|
|
31
39
|
{
|
|
@@ -22,6 +22,7 @@ var _avatar = _interopRequireDefault(require("@atlaskit/avatar"));
|
|
|
22
22
|
var _lozenge = _interopRequireDefault(require("@atlaskit/lozenge"));
|
|
23
23
|
var _colors = require("@atlaskit/theme/colors");
|
|
24
24
|
var _react = _interopRequireDefault(require("react"));
|
|
25
|
+
var _informationEditorPanel = _interopRequireDefault(require("@atlaskit/icon/core/migration/information--editor-panel"));
|
|
25
26
|
var _types = require("../../types");
|
|
26
27
|
var _i18n = require("../../util/i18n");
|
|
27
28
|
var _mouse = require("../../util/mouse");
|
|
@@ -93,20 +94,25 @@ var MentionItem = exports.default = /*#__PURE__*/function (_React$PureComponent)
|
|
|
93
94
|
name = mention.name,
|
|
94
95
|
mentionName = mention.mentionName,
|
|
95
96
|
lozenge = mention.lozenge,
|
|
96
|
-
accessLevel = mention.accessLevel
|
|
97
|
+
accessLevel = mention.accessLevel,
|
|
98
|
+
isXProductUser = mention.isXProductUser;
|
|
97
99
|
var _ref = presence || {},
|
|
98
100
|
status = _ref.status,
|
|
99
101
|
time = _ref.time;
|
|
100
102
|
var restricted = (0, _types.isRestricted)(accessLevel);
|
|
101
103
|
var nameHighlights = highlight && highlight.name;
|
|
102
104
|
var borderColor = selected ? "var(--ds-border, ".concat(_colors.N30, ")") : undefined;
|
|
105
|
+
var xProductUserInfoIconColor = selected ? "var(--ds-icon-selected, #0C66E4)" : "var(--ds-icon, #44546F)";
|
|
103
106
|
return /*#__PURE__*/_react.default.createElement(_MessagesIntlProvider.default, null, /*#__PURE__*/_react.default.createElement(_styles.MentionItemStyle, {
|
|
104
107
|
selected: selected,
|
|
105
108
|
onMouseDown: this.onMentionSelected,
|
|
106
109
|
onMouseMove: this.onMentionMenuItemMouseMove,
|
|
107
110
|
onMouseEnter: this.onMentionMenuItemMouseEnter,
|
|
111
|
+
"data-mention-item": true,
|
|
112
|
+
"data-testid": "mention-item-".concat(id),
|
|
108
113
|
"data-mention-id": id,
|
|
109
|
-
"data-mention-name": mentionName
|
|
114
|
+
"data-mention-name": mentionName,
|
|
115
|
+
"data-selected": selected
|
|
110
116
|
}, /*#__PURE__*/_react.default.createElement(_styles.RowStyle, null, /*#__PURE__*/_react.default.createElement(_styles.AvatarStyle, {
|
|
111
117
|
restricted: restricted
|
|
112
118
|
}, /*#__PURE__*/_react.default.createElement(_avatar.default, {
|
|
@@ -128,7 +134,10 @@ var MentionItem = exports.default = /*#__PURE__*/function (_React$PureComponent)
|
|
|
128
134
|
return /*#__PURE__*/_react.default.createElement(_LockCircleIcon.default, {
|
|
129
135
|
label: text
|
|
130
136
|
});
|
|
131
|
-
} /* safe to cast to string given there is no value binding */)))) : null
|
|
137
|
+
} /* safe to cast to string given there is no value binding */)))) : null, isXProductUser && /*#__PURE__*/_react.default.createElement(_informationEditorPanel.default, {
|
|
138
|
+
color: xProductUserInfoIconColor,
|
|
139
|
+
label: ''
|
|
140
|
+
}))));
|
|
132
141
|
}
|
|
133
142
|
}]);
|
|
134
143
|
}(_react.default.PureComponent);
|
|
@@ -60,5 +60,10 @@ var messages = exports.messages = (0, _reactIntlNext.defineMessages)({
|
|
|
60
60
|
id: 'fabric.elements.mentions.team.member.50plus.including.you',
|
|
61
61
|
defaultMessage: 'Team • 50+ members, including you',
|
|
62
62
|
description: 'Byline to show the number of members in the team when the number exceeds 50 and also includes the current user'
|
|
63
|
+
},
|
|
64
|
+
xProductMentionDescription: {
|
|
65
|
+
id: 'fabric.elements.mentions.xproduct.mention.description',
|
|
66
|
+
defaultMessage: 'Needs access to Confluence',
|
|
67
|
+
description: 'Description for a x-product mention item in the mention list in Confluence'
|
|
63
68
|
}
|
|
64
69
|
});
|
|
@@ -12,7 +12,7 @@ var _types = require("../types");
|
|
|
12
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
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
14
|
var packageName = "@atlaskit/mention";
|
|
15
|
-
var packageVersion = "23.
|
|
15
|
+
var packageVersion = "23.10.0";
|
|
16
16
|
var SLI_EVENT_TYPE = exports.SLI_EVENT_TYPE = 'sli';
|
|
17
17
|
var SMART_EVENT_TYPE = exports.SMART_EVENT_TYPE = 'smart';
|
|
18
18
|
var fireAnalyticsMentionTypeaheadEvent = exports.fireAnalyticsMentionTypeaheadEvent = function fireAnalyticsMentionTypeaheadEvent(props) {
|
|
@@ -137,7 +137,6 @@ export class MentionResource extends AbstractMentionResource {
|
|
|
137
137
|
this.productName = config.productName;
|
|
138
138
|
this.shouldEnableInvite = !!config.shouldEnableInvite;
|
|
139
139
|
this.onInviteItemClick = config.onInviteItemClick;
|
|
140
|
-
this.isEligibleXProductUserInvite = config.isEligibleXProductUserInvite;
|
|
141
140
|
this.inviteXProductUser = config.inviteXProductUser;
|
|
142
141
|
this.userRole = config.userRole || 'basic';
|
|
143
142
|
if (this.config.debounceTime) {
|
|
@@ -104,12 +104,16 @@ export class MentionInternal extends React.PureComponent {
|
|
|
104
104
|
} = props;
|
|
105
105
|
const mentionType = this.getMentionType();
|
|
106
106
|
const failedMention = text === `@${UNKNOWN_USER_ID}`;
|
|
107
|
+
const showTooltip = mentionType === MentionType.RESTRICTED;
|
|
107
108
|
const mentionComponent = /*#__PURE__*/React.createElement(FocusRing, null, /*#__PURE__*/React.createElement(PrimitiveMention, {
|
|
108
109
|
mentionType: mentionType,
|
|
109
110
|
onClick: handleOnClick,
|
|
110
111
|
onMouseEnter: handleOnMouseEnter,
|
|
111
112
|
onMouseLeave: handleOnMouseLeave,
|
|
112
|
-
spellCheck: false
|
|
113
|
+
spellCheck: false,
|
|
114
|
+
"data-testid": `mention-${id}`,
|
|
115
|
+
"data-mention-type": mentionType,
|
|
116
|
+
"data-mention-tooltip": showTooltip
|
|
113
117
|
}, failedMention ? this.renderUnknownUserError(id) : text || '@...'));
|
|
114
118
|
return /*#__PURE__*/React.createElement(UfoErrorBoundary, {
|
|
115
119
|
id: id
|
|
@@ -119,7 +123,7 @@ export class MentionInternal extends React.PureComponent {
|
|
|
119
123
|
"data-local-id": localId,
|
|
120
124
|
"data-access-level": accessLevel,
|
|
121
125
|
spellCheck: false
|
|
122
|
-
}, /*#__PURE__*/React.createElement(MessagesIntlProvider, null,
|
|
126
|
+
}, /*#__PURE__*/React.createElement(MessagesIntlProvider, null, showTooltip ? /*#__PURE__*/React.createElement(React.Suspense, {
|
|
123
127
|
fallback: mentionComponent
|
|
124
128
|
}, /*#__PURE__*/React.createElement(AsyncNoAccessTooltip, {
|
|
125
129
|
name: text
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { FormattedMessage } from 'react-intl-next';
|
|
2
3
|
import { UserType } from '../../types';
|
|
3
4
|
import UserMentionDescriptionByline from './UserMentionDescriptionByline';
|
|
4
5
|
import TeamMentionDescriptionByline from './TeamMentionDescriptionByline';
|
|
6
|
+
import { DescriptionBylineStyle } from './styles';
|
|
7
|
+
import { messages } from '../i18n';
|
|
5
8
|
export default class MentionDescriptionByline extends React.PureComponent {
|
|
6
9
|
render() {
|
|
7
10
|
const {
|
|
8
|
-
userType
|
|
11
|
+
userType,
|
|
12
|
+
isXProductUser
|
|
9
13
|
} = this.props.mention;
|
|
14
|
+
if (isXProductUser) {
|
|
15
|
+
return /*#__PURE__*/React.createElement(DescriptionBylineStyle, null, /*#__PURE__*/React.createElement(FormattedMessage, messages.xProductMentionDescription));
|
|
16
|
+
}
|
|
10
17
|
switch (userType) {
|
|
11
18
|
case UserType[UserType.TEAM]:
|
|
12
19
|
{
|
|
@@ -3,6 +3,7 @@ import Avatar from '@atlaskit/avatar';
|
|
|
3
3
|
import Lozenge from '@atlaskit/lozenge';
|
|
4
4
|
import { N30 } from '@atlaskit/theme/colors';
|
|
5
5
|
import React from 'react';
|
|
6
|
+
import EditorPanelIcon from '@atlaskit/icon/core/migration/information--editor-panel';
|
|
6
7
|
import { isRestricted } from '../../types';
|
|
7
8
|
import { NoAccessLabel } from '../../util/i18n';
|
|
8
9
|
import { leftClick } from '../../util/mouse';
|
|
@@ -68,7 +69,8 @@ export default class MentionItem extends React.PureComponent {
|
|
|
68
69
|
name,
|
|
69
70
|
mentionName,
|
|
70
71
|
lozenge,
|
|
71
|
-
accessLevel
|
|
72
|
+
accessLevel,
|
|
73
|
+
isXProductUser
|
|
72
74
|
} = mention;
|
|
73
75
|
const {
|
|
74
76
|
status,
|
|
@@ -77,13 +79,17 @@ export default class MentionItem extends React.PureComponent {
|
|
|
77
79
|
const restricted = isRestricted(accessLevel);
|
|
78
80
|
const nameHighlights = highlight && highlight.name;
|
|
79
81
|
const borderColor = selected ? `var(--ds-border, ${N30})` : undefined;
|
|
82
|
+
const xProductUserInfoIconColor = selected ? "var(--ds-icon-selected, #0C66E4)" : "var(--ds-icon, #44546F)";
|
|
80
83
|
return /*#__PURE__*/React.createElement(MessagesIntlProvider, null, /*#__PURE__*/React.createElement(MentionItemStyle, {
|
|
81
84
|
selected: selected,
|
|
82
85
|
onMouseDown: this.onMentionSelected,
|
|
83
86
|
onMouseMove: this.onMentionMenuItemMouseMove,
|
|
84
87
|
onMouseEnter: this.onMentionMenuItemMouseEnter,
|
|
88
|
+
"data-mention-item": true,
|
|
89
|
+
"data-testid": `mention-item-${id}`,
|
|
85
90
|
"data-mention-id": id,
|
|
86
|
-
"data-mention-name": mentionName
|
|
91
|
+
"data-mention-name": mentionName,
|
|
92
|
+
"data-selected": selected
|
|
87
93
|
}, /*#__PURE__*/React.createElement(RowStyle, null, /*#__PURE__*/React.createElement(AvatarStyle, {
|
|
88
94
|
restricted: restricted
|
|
89
95
|
}, /*#__PURE__*/React.createElement(Avatar, {
|
|
@@ -103,6 +109,9 @@ export default class MentionItem extends React.PureComponent {
|
|
|
103
109
|
name: name
|
|
104
110
|
}, /*#__PURE__*/React.createElement(AccessSectionStyle, null, /*#__PURE__*/React.createElement(NoAccessLabel, null, text => /*#__PURE__*/React.createElement(AsyncLockCircleIcon, {
|
|
105
111
|
label: text
|
|
106
|
-
}) /* safe to cast to string given there is no value binding */)))) : null
|
|
112
|
+
}) /* safe to cast to string given there is no value binding */)))) : null, isXProductUser && /*#__PURE__*/React.createElement(EditorPanelIcon, {
|
|
113
|
+
color: xProductUserInfoIconColor,
|
|
114
|
+
label: ''
|
|
115
|
+
}))));
|
|
107
116
|
}
|
|
108
117
|
}
|
|
@@ -54,5 +54,10 @@ export const messages = defineMessages({
|
|
|
54
54
|
id: 'fabric.elements.mentions.team.member.50plus.including.you',
|
|
55
55
|
defaultMessage: 'Team • 50+ members, including you',
|
|
56
56
|
description: 'Byline to show the number of members in the team when the number exceeds 50 and also includes the current user'
|
|
57
|
+
},
|
|
58
|
+
xProductMentionDescription: {
|
|
59
|
+
id: 'fabric.elements.mentions.xproduct.mention.description',
|
|
60
|
+
defaultMessage: 'Needs access to Confluence',
|
|
61
|
+
description: 'Description for a x-product mention item in the mention list in Confluence'
|
|
57
62
|
}
|
|
58
63
|
});
|
|
@@ -2,7 +2,7 @@ import { OPERATIONAL_EVENT_TYPE, UI_EVENT_TYPE } from '@atlaskit/analytics-gas-t
|
|
|
2
2
|
import { ELEMENTS_CHANNEL } from '../_constants';
|
|
3
3
|
import { ComponentNames, isSpecialMentionText } from '../types';
|
|
4
4
|
const packageName = "@atlaskit/mention";
|
|
5
|
-
const packageVersion = "23.
|
|
5
|
+
const packageVersion = "23.10.0";
|
|
6
6
|
export const SLI_EVENT_TYPE = 'sli';
|
|
7
7
|
export const SMART_EVENT_TYPE = 'smart';
|
|
8
8
|
export const fireAnalyticsMentionTypeaheadEvent = props => (action, duration, userIds = [], query) => {
|
|
@@ -180,7 +180,6 @@ export var MentionResource = /*#__PURE__*/function (_AbstractMentionResou) {
|
|
|
180
180
|
_this.productName = config.productName;
|
|
181
181
|
_this.shouldEnableInvite = !!config.shouldEnableInvite;
|
|
182
182
|
_this.onInviteItemClick = config.onInviteItemClick;
|
|
183
|
-
_this.isEligibleXProductUserInvite = config.isEligibleXProductUserInvite;
|
|
184
183
|
_this.inviteXProductUser = config.inviteXProductUser;
|
|
185
184
|
_this.userRole = config.userRole || 'basic';
|
|
186
185
|
if (_this.config.debounceTime) {
|
|
@@ -4,6 +4,7 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
|
|
|
4
4
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
5
5
|
var _templateObject;
|
|
6
6
|
var _excluded = ["mentionType"];
|
|
7
|
+
/* eslint-disable @atlaskit/design-system/no-html-button */
|
|
7
8
|
/**
|
|
8
9
|
* @jsxRuntime classic
|
|
9
10
|
* @jsx jsx
|
|
@@ -117,12 +117,16 @@ export var MentionInternal = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
117
117
|
localId = props.localId;
|
|
118
118
|
var mentionType = this.getMentionType();
|
|
119
119
|
var failedMention = text === "@".concat(UNKNOWN_USER_ID);
|
|
120
|
+
var showTooltip = mentionType === MentionType.RESTRICTED;
|
|
120
121
|
var mentionComponent = /*#__PURE__*/React.createElement(FocusRing, null, /*#__PURE__*/React.createElement(PrimitiveMention, {
|
|
121
122
|
mentionType: mentionType,
|
|
122
123
|
onClick: handleOnClick,
|
|
123
124
|
onMouseEnter: handleOnMouseEnter,
|
|
124
125
|
onMouseLeave: handleOnMouseLeave,
|
|
125
|
-
spellCheck: false
|
|
126
|
+
spellCheck: false,
|
|
127
|
+
"data-testid": "mention-".concat(id),
|
|
128
|
+
"data-mention-type": mentionType,
|
|
129
|
+
"data-mention-tooltip": showTooltip
|
|
126
130
|
}, failedMention ? this.renderUnknownUserError(id) : text || '@...'));
|
|
127
131
|
return /*#__PURE__*/React.createElement(UfoErrorBoundary, {
|
|
128
132
|
id: id
|
|
@@ -132,7 +136,7 @@ export var MentionInternal = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
132
136
|
"data-local-id": localId,
|
|
133
137
|
"data-access-level": accessLevel,
|
|
134
138
|
spellCheck: false
|
|
135
|
-
}, /*#__PURE__*/React.createElement(MessagesIntlProvider, null,
|
|
139
|
+
}, /*#__PURE__*/React.createElement(MessagesIntlProvider, null, showTooltip ? /*#__PURE__*/React.createElement(React.Suspense, {
|
|
136
140
|
fallback: mentionComponent
|
|
137
141
|
}, /*#__PURE__*/React.createElement(AsyncNoAccessTooltip, {
|
|
138
142
|
name: text
|
|
@@ -6,9 +6,12 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
6
6
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
7
7
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
8
8
|
import React from 'react';
|
|
9
|
+
import { FormattedMessage } from 'react-intl-next';
|
|
9
10
|
import { UserType } from '../../types';
|
|
10
11
|
import UserMentionDescriptionByline from './UserMentionDescriptionByline';
|
|
11
12
|
import TeamMentionDescriptionByline from './TeamMentionDescriptionByline';
|
|
13
|
+
import { DescriptionBylineStyle } from './styles';
|
|
14
|
+
import { messages } from '../i18n';
|
|
12
15
|
var MentionDescriptionByline = /*#__PURE__*/function (_React$PureComponent) {
|
|
13
16
|
function MentionDescriptionByline() {
|
|
14
17
|
_classCallCheck(this, MentionDescriptionByline);
|
|
@@ -18,7 +21,12 @@ var MentionDescriptionByline = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
18
21
|
return _createClass(MentionDescriptionByline, [{
|
|
19
22
|
key: "render",
|
|
20
23
|
value: function render() {
|
|
21
|
-
var
|
|
24
|
+
var _this$props$mention = this.props.mention,
|
|
25
|
+
userType = _this$props$mention.userType,
|
|
26
|
+
isXProductUser = _this$props$mention.isXProductUser;
|
|
27
|
+
if (isXProductUser) {
|
|
28
|
+
return /*#__PURE__*/React.createElement(DescriptionBylineStyle, null, /*#__PURE__*/React.createElement(FormattedMessage, messages.xProductMentionDescription));
|
|
29
|
+
}
|
|
22
30
|
switch (userType) {
|
|
23
31
|
case UserType[UserType.TEAM]:
|
|
24
32
|
{
|
|
@@ -11,6 +11,7 @@ import Avatar from '@atlaskit/avatar';
|
|
|
11
11
|
import Lozenge from '@atlaskit/lozenge';
|
|
12
12
|
import { N30 } from '@atlaskit/theme/colors';
|
|
13
13
|
import React from 'react';
|
|
14
|
+
import EditorPanelIcon from '@atlaskit/icon/core/migration/information--editor-panel';
|
|
14
15
|
import { isRestricted } from '../../types';
|
|
15
16
|
import { NoAccessLabel } from '../../util/i18n';
|
|
16
17
|
import { leftClick } from '../../util/mouse';
|
|
@@ -81,20 +82,25 @@ var MentionItem = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
81
82
|
name = mention.name,
|
|
82
83
|
mentionName = mention.mentionName,
|
|
83
84
|
lozenge = mention.lozenge,
|
|
84
|
-
accessLevel = mention.accessLevel
|
|
85
|
+
accessLevel = mention.accessLevel,
|
|
86
|
+
isXProductUser = mention.isXProductUser;
|
|
85
87
|
var _ref = presence || {},
|
|
86
88
|
status = _ref.status,
|
|
87
89
|
time = _ref.time;
|
|
88
90
|
var restricted = isRestricted(accessLevel);
|
|
89
91
|
var nameHighlights = highlight && highlight.name;
|
|
90
92
|
var borderColor = selected ? "var(--ds-border, ".concat(N30, ")") : undefined;
|
|
93
|
+
var xProductUserInfoIconColor = selected ? "var(--ds-icon-selected, #0C66E4)" : "var(--ds-icon, #44546F)";
|
|
91
94
|
return /*#__PURE__*/React.createElement(MessagesIntlProvider, null, /*#__PURE__*/React.createElement(MentionItemStyle, {
|
|
92
95
|
selected: selected,
|
|
93
96
|
onMouseDown: this.onMentionSelected,
|
|
94
97
|
onMouseMove: this.onMentionMenuItemMouseMove,
|
|
95
98
|
onMouseEnter: this.onMentionMenuItemMouseEnter,
|
|
99
|
+
"data-mention-item": true,
|
|
100
|
+
"data-testid": "mention-item-".concat(id),
|
|
96
101
|
"data-mention-id": id,
|
|
97
|
-
"data-mention-name": mentionName
|
|
102
|
+
"data-mention-name": mentionName,
|
|
103
|
+
"data-selected": selected
|
|
98
104
|
}, /*#__PURE__*/React.createElement(RowStyle, null, /*#__PURE__*/React.createElement(AvatarStyle, {
|
|
99
105
|
restricted: restricted
|
|
100
106
|
}, /*#__PURE__*/React.createElement(Avatar, {
|
|
@@ -116,7 +122,10 @@ var MentionItem = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
116
122
|
return /*#__PURE__*/React.createElement(AsyncLockCircleIcon, {
|
|
117
123
|
label: text
|
|
118
124
|
});
|
|
119
|
-
} /* safe to cast to string given there is no value binding */)))) : null
|
|
125
|
+
} /* safe to cast to string given there is no value binding */)))) : null, isXProductUser && /*#__PURE__*/React.createElement(EditorPanelIcon, {
|
|
126
|
+
color: xProductUserInfoIconColor,
|
|
127
|
+
label: ''
|
|
128
|
+
}))));
|
|
120
129
|
}
|
|
121
130
|
}]);
|
|
122
131
|
}(React.PureComponent);
|
|
@@ -54,5 +54,10 @@ export var messages = defineMessages({
|
|
|
54
54
|
id: 'fabric.elements.mentions.team.member.50plus.including.you',
|
|
55
55
|
defaultMessage: 'Team • 50+ members, including you',
|
|
56
56
|
description: 'Byline to show the number of members in the team when the number exceeds 50 and also includes the current user'
|
|
57
|
+
},
|
|
58
|
+
xProductMentionDescription: {
|
|
59
|
+
id: 'fabric.elements.mentions.xproduct.mention.description',
|
|
60
|
+
defaultMessage: 'Needs access to Confluence',
|
|
61
|
+
description: 'Description for a x-product mention item in the mention list in Confluence'
|
|
57
62
|
}
|
|
58
63
|
});
|
|
@@ -5,7 +5,7 @@ import { OPERATIONAL_EVENT_TYPE, UI_EVENT_TYPE } from '@atlaskit/analytics-gas-t
|
|
|
5
5
|
import { ELEMENTS_CHANNEL } from '../_constants';
|
|
6
6
|
import { ComponentNames, isSpecialMentionText } from '../types';
|
|
7
7
|
var packageName = "@atlaskit/mention";
|
|
8
|
-
var packageVersion = "23.
|
|
8
|
+
var packageVersion = "23.10.0";
|
|
9
9
|
export var SLI_EVENT_TYPE = 'sli';
|
|
10
10
|
export var SMART_EVENT_TYPE = 'smart';
|
|
11
11
|
export var fireAnalyticsMentionTypeaheadEvent = function fireAnalyticsMentionTypeaheadEvent(props) {
|
|
@@ -45,7 +45,6 @@ export declare class MentionResource extends AbstractMentionResource implements
|
|
|
45
45
|
shouldEnableInvite: boolean;
|
|
46
46
|
userRole: UserRole;
|
|
47
47
|
onInviteItemClick?: (flow: InviteFlow) => void;
|
|
48
|
-
isEligibleXProductUserInvite?: boolean;
|
|
49
48
|
inviteXProductUser?: (userId: string, mentionName: string) => Promise<void>;
|
|
50
49
|
constructor(config: MentionResourceConfig);
|
|
51
50
|
shouldHighlightMention(mention: MentionDescription): boolean;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -31,7 +31,6 @@ export interface MentionResourceConfig extends ServiceConfig {
|
|
|
31
31
|
userRole?: UserRole;
|
|
32
32
|
productName?: string;
|
|
33
33
|
debounceTime?: number;
|
|
34
|
-
isEligibleXProductUserInvite?: boolean;
|
|
35
34
|
inviteXProductUser?: (userId: string, mentionName: string) => Promise<void>;
|
|
36
35
|
}
|
|
37
36
|
export interface ResourceProvider<Result> {
|
|
@@ -185,6 +184,5 @@ export interface InviteFromMentionProvider {
|
|
|
185
184
|
userRole?: UserRole;
|
|
186
185
|
}
|
|
187
186
|
export interface XProductInviteMentionProvider {
|
|
188
|
-
isEligibleXProductUserInvite?: boolean;
|
|
189
187
|
inviteXProductUser?: (userId: string, mentionName: string) => Promise<void>;
|
|
190
188
|
}
|
|
@@ -45,7 +45,6 @@ export declare class MentionResource extends AbstractMentionResource implements
|
|
|
45
45
|
shouldEnableInvite: boolean;
|
|
46
46
|
userRole: UserRole;
|
|
47
47
|
onInviteItemClick?: (flow: InviteFlow) => void;
|
|
48
|
-
isEligibleXProductUserInvite?: boolean;
|
|
49
48
|
inviteXProductUser?: (userId: string, mentionName: string) => Promise<void>;
|
|
50
49
|
constructor(config: MentionResourceConfig);
|
|
51
50
|
shouldHighlightMention(mention: MentionDescription): boolean;
|
|
@@ -31,7 +31,6 @@ export interface MentionResourceConfig extends ServiceConfig {
|
|
|
31
31
|
userRole?: UserRole;
|
|
32
32
|
productName?: string;
|
|
33
33
|
debounceTime?: number;
|
|
34
|
-
isEligibleXProductUserInvite?: boolean;
|
|
35
34
|
inviteXProductUser?: (userId: string, mentionName: string) => Promise<void>;
|
|
36
35
|
}
|
|
37
36
|
export interface ResourceProvider<Result> {
|
|
@@ -185,6 +184,5 @@ export interface InviteFromMentionProvider {
|
|
|
185
184
|
userRole?: UserRole;
|
|
186
185
|
}
|
|
187
186
|
export interface XProductInviteMentionProvider {
|
|
188
|
-
isEligibleXProductUserInvite?: boolean;
|
|
189
187
|
inviteXProductUser?: (userId: string, mentionName: string) => Promise<void>;
|
|
190
188
|
}
|
package/package.json
CHANGED
|
@@ -1,29 +1,19 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"module": "dist/esm/index.js",
|
|
13
|
-
"module:es2019": "dist/es2019/index.js",
|
|
14
|
-
"types": "dist/types/index.d.ts",
|
|
15
|
-
"typesVersions": {
|
|
16
|
-
">=4.5 <4.9": {
|
|
17
|
-
"*": [
|
|
18
|
-
"dist/types-ts4.5/*",
|
|
19
|
-
"dist/types-ts4.5/index.d.ts"
|
|
20
|
-
]
|
|
21
|
-
}
|
|
2
|
+
"af:exports": {
|
|
3
|
+
".": "./src/index.ts",
|
|
4
|
+
"./element": "./src/element.ts",
|
|
5
|
+
"./i18n": "./src/i18n.ts",
|
|
6
|
+
"./item": "./src/item.ts",
|
|
7
|
+
"./resource": "./src/resource.ts",
|
|
8
|
+
"./shared-styles": "./src/shared-styles.ts",
|
|
9
|
+
"./team-resource": "./src/team-resource.ts",
|
|
10
|
+
"./typeahead": "./src/typeahead.ts",
|
|
11
|
+
"./types": "./src/types.ts"
|
|
22
12
|
},
|
|
23
|
-
"sideEffects": false,
|
|
24
13
|
"atlaskit:src": "src/index.ts",
|
|
25
14
|
"atlassian": {
|
|
26
15
|
"team": "Search Platform: Search Experience",
|
|
16
|
+
"runReact18": false,
|
|
27
17
|
"slack": {
|
|
28
18
|
"channel": "#search-plex-prs",
|
|
29
19
|
"notifications": {
|
|
@@ -36,6 +26,7 @@
|
|
|
36
26
|
"name": "Mention"
|
|
37
27
|
}
|
|
38
28
|
},
|
|
29
|
+
"author": "Atlassian Pty Ltd",
|
|
39
30
|
"config": {
|
|
40
31
|
"access": "public"
|
|
41
32
|
},
|
|
@@ -50,7 +41,7 @@
|
|
|
50
41
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
51
42
|
"@atlaskit/primitives": "^13.3.0",
|
|
52
43
|
"@atlaskit/theme": "^14.0.0",
|
|
53
|
-
"@atlaskit/tokens": "^3.
|
|
44
|
+
"@atlaskit/tokens": "^3.2.0",
|
|
54
45
|
"@atlaskit/tooltip": "^19.0.0",
|
|
55
46
|
"@atlaskit/ufo": "^0.3.0",
|
|
56
47
|
"@atlaskit/util-service-support": "^6.2.0",
|
|
@@ -60,16 +51,13 @@
|
|
|
60
51
|
"lodash": "^4.17.21",
|
|
61
52
|
"uuid": "^3.1.0"
|
|
62
53
|
},
|
|
63
|
-
"
|
|
64
|
-
"react": "^16.8.0",
|
|
65
|
-
"react-dom": "^16.8.0",
|
|
66
|
-
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
67
|
-
},
|
|
54
|
+
"description": "A React component used to display user profiles in a list for 'Mention' functionality",
|
|
68
55
|
"devDependencies": {
|
|
69
56
|
"@atlaskit/elements-test-helpers": "^0.7.0",
|
|
70
57
|
"@atlaskit/visual-regression": "*",
|
|
71
58
|
"@atlassian/feature-flags-test-utils": "*",
|
|
72
59
|
"@testing-library/react": "^12.1.5",
|
|
60
|
+
"@testing-library/user-event": "^14.4.3",
|
|
73
61
|
"@types/query-string": "^4.3.1",
|
|
74
62
|
"@types/serialize-javascript": "^5.0.0",
|
|
75
63
|
"enzyme": "^3.10.0",
|
|
@@ -90,29 +78,43 @@
|
|
|
90
78
|
"fabric",
|
|
91
79
|
"teams"
|
|
92
80
|
],
|
|
81
|
+
"license": "Apache-2.0",
|
|
82
|
+
"main": "dist/cjs/index.js",
|
|
83
|
+
"module": "dist/esm/index.js",
|
|
84
|
+
"module:es2019": "dist/es2019/index.js",
|
|
85
|
+
"name": "@atlaskit/mention",
|
|
86
|
+
"peerDependencies": {
|
|
87
|
+
"react": "^16.8.0 || ^17.0.0 || ^18.2.0",
|
|
88
|
+
"react-dom": "^16.8.0 || ^17.0.0 || ^18.2.0",
|
|
89
|
+
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
90
|
+
},
|
|
91
|
+
"platform-feature-flags": {
|
|
92
|
+
"platform_editor_ai_remove_mentions_record": {
|
|
93
|
+
"type": "boolean"
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"publishConfig": {
|
|
97
|
+
"registry": "https://registry.npmjs.org/"
|
|
98
|
+
},
|
|
99
|
+
"repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
|
|
100
|
+
"sideEffects": false,
|
|
93
101
|
"techstack": {
|
|
94
102
|
"@repo/internal": {
|
|
95
103
|
"deprecation": "no-deprecated-imports",
|
|
96
|
-
"styling": "emotion",
|
|
97
104
|
"design-tokens": [
|
|
98
105
|
"color"
|
|
99
|
-
]
|
|
106
|
+
],
|
|
107
|
+
"styling": "emotion"
|
|
100
108
|
}
|
|
101
109
|
},
|
|
102
|
-
"
|
|
103
|
-
|
|
104
|
-
"
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
"./team-resource": "./src/team-resource.ts",
|
|
110
|
-
"./typeahead": "./src/typeahead.ts",
|
|
111
|
-
"./types": "./src/types.ts"
|
|
112
|
-
},
|
|
113
|
-
"platform-feature-flags": {
|
|
114
|
-
"platform_editor_ai_remove_mentions_record": {
|
|
115
|
-
"type": "boolean"
|
|
110
|
+
"types": "dist/types/index.d.ts",
|
|
111
|
+
"typesVersions": {
|
|
112
|
+
">=4.5 <4.9": {
|
|
113
|
+
"*": [
|
|
114
|
+
"dist/types-ts4.5/*",
|
|
115
|
+
"dist/types-ts4.5/index.d.ts"
|
|
116
|
+
]
|
|
116
117
|
}
|
|
117
|
-
}
|
|
118
|
+
},
|
|
119
|
+
"version": "23.10.0"
|
|
118
120
|
}
|