@atlaskit/mention 30.5.2 → 30.7.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.
Files changed (24) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/dist/cjs/components/MentionDescriptionByline/getMentionDescriptionByline.js +45 -0
  3. package/dist/cjs/components/MentionItem/MentionItemLayout.js +32 -0
  4. package/dist/cjs/components/MentionItem/MentionItemLayoutLegacy.js +31 -0
  5. package/dist/cjs/components/MentionItem/MentionItemPlaceholder.js +17 -10
  6. package/dist/cjs/components/MentionItem/index.js +11 -16
  7. package/dist/cjs/util/package-version.js +1 -1
  8. package/dist/es2019/components/MentionDescriptionByline/getMentionDescriptionByline.js +43 -0
  9. package/dist/es2019/components/MentionItem/MentionItemLayout.js +26 -0
  10. package/dist/es2019/components/MentionItem/MentionItemLayoutLegacy.js +25 -0
  11. package/dist/es2019/components/MentionItem/MentionItemPlaceholder.js +17 -10
  12. package/dist/es2019/components/MentionItem/index.js +12 -17
  13. package/dist/es2019/util/package-version.js +1 -1
  14. package/dist/esm/components/MentionDescriptionByline/getMentionDescriptionByline.js +39 -0
  15. package/dist/esm/components/MentionItem/MentionItemLayout.js +25 -0
  16. package/dist/esm/components/MentionItem/MentionItemLayoutLegacy.js +24 -0
  17. package/dist/esm/components/MentionItem/MentionItemPlaceholder.js +17 -10
  18. package/dist/esm/components/MentionItem/index.js +12 -17
  19. package/dist/esm/util/package-version.js +1 -1
  20. package/dist/types/components/MentionDescriptionByline/getMentionDescriptionByline.d.ts +5 -0
  21. package/dist/types/components/MentionDescriptionByline/styles.d.ts +1 -1
  22. package/dist/types/components/MentionItem/MentionItemLayout.d.ts +8 -0
  23. package/dist/types/components/MentionItem/MentionItemLayoutLegacy.d.ts +10 -0
  24. package/package.json +5 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # @atlaskit/mention
2
2
 
3
+ ## 30.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`69008f6bdcb98`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/69008f6bdcb98) -
8
+ Adjust all mention picker rows and emoji results to use 6px vertical padding, 8px between rows,
9
+ and 2px between primary and secondary text behind platform_editor_mentions_email_search.
10
+
11
+ Center the avatar and text within the 50px selection row and reserve the 8px gap outside the
12
+ selection and focus backgrounds.
13
+
14
+ Share the presentational picker row between mentions and emoji through
15
+ `@atlaskit/user-picker/picker-item-content`.
16
+
17
+ Apply the same gated preview spacing to the emoji picker footer, and use 12px horizontal padding
18
+ and avatar-to-text spacing for both mentions and emoji.
19
+
20
+ Consolidate byline formatting within the email-search layout, keeping the original byline
21
+ components in the legacy path and subtext presentation internal to each layout.
22
+
23
+ ### Patch Changes
24
+
25
+ - Updated dependencies
26
+
27
+ ## 30.6.0
28
+
29
+ ### Minor Changes
30
+
31
+ - [`6dfebc2196fe9`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6dfebc2196fe9) -
32
+ Update i18n NPM package versions for editor,editor-extensions,activity-platform,media,elements
33
+ (Group 3)
34
+
3
35
  ## 30.5.2
4
36
 
5
37
  ### Patch Changes
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.getMentionDescriptionByline = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _types = require("../../types");
10
+ var _i18n = require("../i18n");
11
+ var _MentionHighlightHelpers = require("../MentionItem/MentionHighlightHelpers");
12
+ /** Content for MentionItemLayoutNext, selected by the email-search experiment. */
13
+ var getMentionDescriptionByline = exports.getMentionDescriptionByline = function getMentionDescriptionByline(mention, intl) {
14
+ var _highlight$nickname;
15
+ var context = mention.context,
16
+ email = mention.email,
17
+ highlight = mention.highlight,
18
+ isXProductUser = mention.isXProductUser,
19
+ name = mention.name,
20
+ nickname = mention.nickname,
21
+ userType = mention.userType;
22
+ if (isXProductUser) {
23
+ return intl.formatMessage(_i18n.messages.xProductMentionDescription);
24
+ }
25
+ if (userType === _types.UserType[_types.UserType.TEAM]) {
26
+ if (!context) {
27
+ return null;
28
+ }
29
+ var includesYou = context.includesYou,
30
+ memberCount = context.memberCount;
31
+ if (memberCount > 50) {
32
+ return intl.formatMessage(includesYou ? _i18n.messages.plus50MembersWithYou : _i18n.messages.plus50MembersWithoutYou);
33
+ }
34
+ return intl.formatMessage(includesYou ? _i18n.messages.memberCountWithYou : _i18n.messages.memberCountWithoutYou, {
35
+ 0: memberCount
36
+ });
37
+ }
38
+ if (email && (!nickname || name === nickname)) {
39
+ return email;
40
+ }
41
+ if (!nickname || name === nickname) {
42
+ return null;
43
+ }
44
+ return highlight !== null && highlight !== void 0 && (_highlight$nickname = highlight.nickname) !== null && _highlight$nickname !== void 0 && _highlight$nickname.length ? (0, _MentionHighlightHelpers.renderHighlight)(_react.default.Fragment, nickname, highlight.nickname, '@') : "@".concat(nickname);
45
+ };
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.MentionItemLayoutNext = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _reactIntl = require("react-intl");
10
+ var _pickerItemContent = require("@atlaskit/user-picker/picker-item-content");
11
+ var _isRestricted = require("../../is-restricted");
12
+ var _MentionAvatar = require("../MentionAvatar");
13
+ var _getMentionDescriptionByline = require("../MentionDescriptionByline/getMentionDescriptionByline");
14
+ var _MentionHighlightHelpers = require("./MentionHighlightHelpers");
15
+ var _styles = require("./styles");
16
+ var MentionItemLayoutNext = exports.MentionItemLayoutNext = function MentionItemLayoutNext(_ref) {
17
+ var _mention$highlight;
18
+ var mention = _ref.mention,
19
+ selected = _ref.selected,
20
+ children = _ref.children;
21
+ var intl = (0, _reactIntl.useIntl)();
22
+ return /*#__PURE__*/_react.default.createElement(_pickerItemContent.PickerItemContent, {
23
+ avatar: /*#__PURE__*/_react.default.createElement(_MentionAvatar.MentionAvatar, {
24
+ selected: selected,
25
+ mention: mention
26
+ }),
27
+ title: (0, _MentionHighlightHelpers.renderHighlight)(_styles.FullNameStyle, mention.name, (_mention$highlight = mention.highlight) === null || _mention$highlight === void 0 ? void 0 : _mention$highlight.name),
28
+ subtext: (0, _getMentionDescriptionByline.getMentionDescriptionByline)(mention, intl),
29
+ after: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children),
30
+ isMuted: (0, _isRestricted.isRestricted)(mention.accessLevel)
31
+ });
32
+ };
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.MentionItemLayoutLegacy = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _isRestricted = require("../../is-restricted");
10
+ var _MentionAvatar = require("../MentionAvatar");
11
+ var _MentionDescriptionByline = _interopRequireDefault(require("../MentionDescriptionByline"));
12
+ var _MentionHighlightHelpers = require("./MentionHighlightHelpers");
13
+ var _styles = require("./styles");
14
+ var MentionItemLayoutLegacy = exports.MentionItemLayoutLegacy = function MentionItemLayoutLegacy(_ref) {
15
+ var _mention$highlight;
16
+ var mention = _ref.mention,
17
+ selected = _ref.selected,
18
+ LegacyRow = _ref.legacyRow,
19
+ children = _ref.children;
20
+ var restricted = (0, _isRestricted.isRestricted)(mention.accessLevel);
21
+ return /*#__PURE__*/_react.default.createElement(LegacyRow, null, /*#__PURE__*/_react.default.createElement(_styles.AvatarStyle, {
22
+ restricted: restricted
23
+ }, /*#__PURE__*/_react.default.createElement(_MentionAvatar.MentionAvatar, {
24
+ selected: selected,
25
+ mention: mention
26
+ })), /*#__PURE__*/_react.default.createElement(_styles.NameSectionStyle, {
27
+ restricted: restricted
28
+ }, (0, _MentionHighlightHelpers.renderHighlight)(_styles.FullNameStyle, mention.name, (_mention$highlight = mention.highlight) === null || _mention$highlight === void 0 ? void 0 : _mention$highlight.name), /*#__PURE__*/_react.default.createElement(_MentionDescriptionByline.default, {
29
+ mention: mention
30
+ })), children);
31
+ };
@@ -7,7 +7,9 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = MentionItemPlaceholder;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _reactIntl = require("react-intl");
10
+ var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
10
11
  var _skeleton = _interopRequireDefault(require("@atlaskit/skeleton"));
12
+ var _pickerItemContent = require("@atlaskit/user-picker/picker-item-content");
11
13
  var _i18n = require("../i18n");
12
14
  var _styles = require("./styles");
13
15
  /**
@@ -29,6 +31,17 @@ function MentionItemPlaceholder(_ref) {
29
31
  var _useIntl = (0, _reactIntl.useIntl)(),
30
32
  formatMessage = _useIntl.formatMessage;
31
33
  var label = formatMessage(_i18n.messages.loadingPlaceholder);
34
+ var avatar = /*#__PURE__*/_react.default.createElement(_styles.AvatarSkeletonWrapper, null, /*#__PURE__*/_react.default.createElement(_skeleton.default, {
35
+ width: 32,
36
+ height: 32,
37
+ borderRadius: "var(--ds-radius-full, 9999px)",
38
+ isShimmering: true
39
+ }));
40
+ var name = /*#__PURE__*/_react.default.createElement(_skeleton.default, {
41
+ width: 140,
42
+ height: 12,
43
+ isShimmering: true
44
+ });
32
45
  return /*#__PURE__*/_react.default.createElement(_styles.MentionItemStyle, {
33
46
  height: height,
34
47
  "data-mention-item": true,
@@ -37,14 +50,8 @@ function MentionItemPlaceholder(_ref) {
37
50
  ref: forwardedRef,
38
51
  role: "status",
39
52
  "aria-label": label
40
- }, /*#__PURE__*/_react.default.createElement(_styles.RowStyle, null, /*#__PURE__*/_react.default.createElement(_styles.AvatarStyle, null, /*#__PURE__*/_react.default.createElement(_styles.AvatarSkeletonWrapper, null, /*#__PURE__*/_react.default.createElement(_skeleton.default, {
41
- width: 32,
42
- height: 32,
43
- borderRadius: "var(--ds-radius-full, 9999px)",
44
- isShimmering: true
45
- }))), /*#__PURE__*/_react.default.createElement(_styles.NameSectionStyle, null, /*#__PURE__*/_react.default.createElement(_skeleton.default, {
46
- width: 140,
47
- height: 12,
48
- isShimmering: true
49
- }))));
53
+ }, (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_mentions_email_search') ? /*#__PURE__*/_react.default.createElement(_pickerItemContent.PickerItemContent, {
54
+ avatar: avatar,
55
+ title: name
56
+ }) : /*#__PURE__*/_react.default.createElement(_styles.RowStyle, null, /*#__PURE__*/_react.default.createElement(_styles.AvatarStyle, null, avatar), /*#__PURE__*/_react.default.createElement(_styles.NameSectionStyle, null, name)));
50
57
  }
@@ -28,19 +28,20 @@ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
28
28
  var _react = _interopRequireDefault(require("react"));
29
29
  var _statusInformation = _interopRequireDefault(require("@atlaskit/icon/core/status-information"));
30
30
  var _lozenge = _interopRequireDefault(require("@atlaskit/lozenge/new/lozenge"));
31
+ var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
31
32
  var _fg = require("@atlaskit/platform-feature-flags/fg");
32
33
  var _removableTag = _interopRequireDefault(require("@atlaskit/tag/removable-tag"));
33
34
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
35
+ var _pickerItemContent = require("@atlaskit/user-picker/picker-item-content");
34
36
  var _isAgentMention = require("../../is-agent-mention");
35
37
  var _isRestricted = require("../../is-restricted");
36
38
  var _i18n = require("../../util/i18n");
37
39
  var _leftClick = require("../../util/left-click");
38
40
  var _LockCircleIcon = _interopRequireDefault(require("../LockCircleIcon"));
39
- var _MentionAvatar = require("../MentionAvatar");
40
- var _MentionDescriptionByline = _interopRequireDefault(require("../MentionDescriptionByline"));
41
41
  var _MessagesIntlProvider = _interopRequireDefault(require("../MessagesIntlProvider"));
42
42
  var _NoAccessTooltip = _interopRequireDefault(require("../NoAccessTooltip"));
43
- var _MentionHighlightHelpers = require("./MentionHighlightHelpers");
43
+ var _MentionItemLayout = require("./MentionItemLayout");
44
+ var _MentionItemLayoutLegacy = require("./MentionItemLayoutLegacy");
44
45
  var _styles = require("./styles");
45
46
  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)); }
46
47
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
@@ -141,10 +142,9 @@ var MentionItem = exports.default = /*#__PURE__*/function (_React$PureComponent)
141
142
  var _this$props = this.props,
142
143
  mention = _this$props.mention,
143
144
  selected = _this$props.selected,
144
- forwardedRef = _this$props.forwardedRef,
145
- height = _this$props.height;
145
+ forwardedRef = _this$props.forwardedRef;
146
+ var height = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_mentions_email_search') ? _pickerItemContent.PICKER_ITEM_HEIGHT : this.props.height;
146
147
  var id = mention.id,
147
- highlight = mention.highlight,
148
148
  presence = mention.presence,
149
149
  name = mention.name,
150
150
  mentionName = mention.mentionName,
@@ -166,7 +166,6 @@ var MentionItem = exports.default = /*#__PURE__*/function (_React$PureComponent)
166
166
  var _ref = presence || {},
167
167
  time = _ref.time;
168
168
  var restricted = (0, _isRestricted.isRestricted)(accessLevel);
169
- var nameHighlights = highlight && highlight.name;
170
169
  var xProductUserInfoIconColor = selected ? "var(--ds-icon-selected, #1868DB)" : "var(--ds-icon, #292A2E)";
171
170
  var RowStyle = _styles.RowStyle;
172
171
  var isAgent = false;
@@ -174,6 +173,7 @@ var MentionItem = exports.default = /*#__PURE__*/function (_React$PureComponent)
174
173
  RowStyle = _styles.RowStyleNext;
175
174
  isAgent = (0, _isAgentMention.isAgentMention)(mention);
176
175
  }
176
+ var ItemLayout = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_mentions_email_search') ? _MentionItemLayout.MentionItemLayoutNext : _MentionItemLayoutLegacy.MentionItemLayoutLegacy;
177
177
  return /*#__PURE__*/_react.default.createElement(_MessagesIntlProvider.default, null, /*#__PURE__*/_react.default.createElement(_styles.MentionItemStyle, {
178
178
  selected: selected,
179
179
  height: height,
@@ -187,16 +187,11 @@ var MentionItem = exports.default = /*#__PURE__*/function (_React$PureComponent)
187
187
  "data-mention-is-agent": isAgent ? 'true' : undefined,
188
188
  "data-selected": selected,
189
189
  ref: forwardedRef
190
- }, /*#__PURE__*/_react.default.createElement(RowStyle, null, /*#__PURE__*/_react.default.createElement(_styles.AvatarStyle, {
191
- restricted: restricted
192
- }, /*#__PURE__*/_react.default.createElement(_MentionAvatar.MentionAvatar, {
190
+ }, /*#__PURE__*/_react.default.createElement(ItemLayout, {
191
+ mention: mention,
193
192
  selected: selected,
194
- mention: mention
195
- })), /*#__PURE__*/_react.default.createElement(_styles.NameSectionStyle, {
196
- restricted: restricted
197
- }, (0, _MentionHighlightHelpers.renderHighlight)(_styles.FullNameStyle, name, nameHighlights), /*#__PURE__*/_react.default.createElement(_MentionDescriptionByline.default, {
198
- mention: mention
199
- })), /*#__PURE__*/_react.default.createElement(_styles.InfoSectionStyle, {
193
+ legacyRow: RowStyle
194
+ }, /*#__PURE__*/_react.default.createElement(_styles.InfoSectionStyle, {
200
195
  restricted: restricted
201
196
  }, (0, _fg.fg)('platform-dst-lozenge-tag-badge-visual-uplifts') ? renderTag(lozenge) : renderLozenge(lozenge), renderTime(time)), restricted ? /*#__PURE__*/_react.default.createElement(_react.default.Suspense, {
202
197
  fallback: null
@@ -4,4 +4,4 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.packageVersion = void 0;
7
- var packageVersion = exports.packageVersion = "30.5.1";
7
+ var packageVersion = exports.packageVersion = "30.6.0";
@@ -0,0 +1,43 @@
1
+ import React from 'react';
2
+ import { UserType } from '../../types';
3
+ import { messages } from '../i18n';
4
+ import { renderHighlight } from '../MentionItem/MentionHighlightHelpers';
5
+
6
+ /** Content for MentionItemLayoutNext, selected by the email-search experiment. */
7
+ export const getMentionDescriptionByline = (mention, intl) => {
8
+ var _highlight$nickname;
9
+ const {
10
+ context,
11
+ email,
12
+ highlight,
13
+ isXProductUser,
14
+ name,
15
+ nickname,
16
+ userType
17
+ } = mention;
18
+ if (isXProductUser) {
19
+ return intl.formatMessage(messages.xProductMentionDescription);
20
+ }
21
+ if (userType === UserType[UserType.TEAM]) {
22
+ if (!context) {
23
+ return null;
24
+ }
25
+ const {
26
+ includesYou,
27
+ memberCount
28
+ } = context;
29
+ if (memberCount > 50) {
30
+ return intl.formatMessage(includesYou ? messages.plus50MembersWithYou : messages.plus50MembersWithoutYou);
31
+ }
32
+ return intl.formatMessage(includesYou ? messages.memberCountWithYou : messages.memberCountWithoutYou, {
33
+ 0: memberCount
34
+ });
35
+ }
36
+ if (email && (!nickname || name === nickname)) {
37
+ return email;
38
+ }
39
+ if (!nickname || name === nickname) {
40
+ return null;
41
+ }
42
+ return highlight !== null && highlight !== void 0 && (_highlight$nickname = highlight.nickname) !== null && _highlight$nickname !== void 0 && _highlight$nickname.length ? renderHighlight(React.Fragment, nickname, highlight.nickname, '@') : `@${nickname}`;
43
+ };
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ import { useIntl } from 'react-intl';
3
+ import { PickerItemContent } from '@atlaskit/user-picker/picker-item-content';
4
+ import { isRestricted } from '../../is-restricted';
5
+ import { MentionAvatar } from '../MentionAvatar';
6
+ import { getMentionDescriptionByline } from '../MentionDescriptionByline/getMentionDescriptionByline';
7
+ import { renderHighlight } from './MentionHighlightHelpers';
8
+ import { FullNameStyle } from './styles';
9
+ export const MentionItemLayoutNext = ({
10
+ mention,
11
+ selected,
12
+ children
13
+ }) => {
14
+ var _mention$highlight;
15
+ const intl = useIntl();
16
+ return /*#__PURE__*/React.createElement(PickerItemContent, {
17
+ avatar: /*#__PURE__*/React.createElement(MentionAvatar, {
18
+ selected: selected,
19
+ mention: mention
20
+ }),
21
+ title: renderHighlight(FullNameStyle, mention.name, (_mention$highlight = mention.highlight) === null || _mention$highlight === void 0 ? void 0 : _mention$highlight.name),
22
+ subtext: getMentionDescriptionByline(mention, intl),
23
+ after: /*#__PURE__*/React.createElement(React.Fragment, null, children),
24
+ isMuted: isRestricted(mention.accessLevel)
25
+ });
26
+ };
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import { isRestricted } from '../../is-restricted';
3
+ import { MentionAvatar } from '../MentionAvatar';
4
+ import MentionDescriptionByline from '../MentionDescriptionByline';
5
+ import { renderHighlight } from './MentionHighlightHelpers';
6
+ import { AvatarStyle, FullNameStyle, NameSectionStyle } from './styles';
7
+ export const MentionItemLayoutLegacy = ({
8
+ mention,
9
+ selected,
10
+ legacyRow: LegacyRow,
11
+ children
12
+ }) => {
13
+ var _mention$highlight;
14
+ const restricted = isRestricted(mention.accessLevel);
15
+ return /*#__PURE__*/React.createElement(LegacyRow, null, /*#__PURE__*/React.createElement(AvatarStyle, {
16
+ restricted: restricted
17
+ }, /*#__PURE__*/React.createElement(MentionAvatar, {
18
+ selected: selected,
19
+ mention: mention
20
+ })), /*#__PURE__*/React.createElement(NameSectionStyle, {
21
+ restricted: restricted
22
+ }, renderHighlight(FullNameStyle, mention.name, (_mention$highlight = mention.highlight) === null || _mention$highlight === void 0 ? void 0 : _mention$highlight.name), /*#__PURE__*/React.createElement(MentionDescriptionByline, {
23
+ mention: mention
24
+ })), children);
25
+ };
@@ -1,6 +1,8 @@
1
1
  import React from 'react';
2
2
  import { useIntl } from 'react-intl';
3
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
3
4
  import Skeleton from '@atlaskit/skeleton';
5
+ import { PickerItemContent } from '@atlaskit/user-picker/picker-item-content';
4
6
  import { messages } from '../i18n';
5
7
  import { AvatarSkeletonWrapper, AvatarStyle, MentionItemStyle, NameSectionStyle, RowStyle } from './styles';
6
8
  /**
@@ -24,6 +26,17 @@ export default function MentionItemPlaceholder({
24
26
  formatMessage
25
27
  } = useIntl();
26
28
  const label = formatMessage(messages.loadingPlaceholder);
29
+ const avatar = /*#__PURE__*/React.createElement(AvatarSkeletonWrapper, null, /*#__PURE__*/React.createElement(Skeleton, {
30
+ width: 32,
31
+ height: 32,
32
+ borderRadius: "var(--ds-radius-full, 9999px)",
33
+ isShimmering: true
34
+ }));
35
+ const name = /*#__PURE__*/React.createElement(Skeleton, {
36
+ width: 140,
37
+ height: 12,
38
+ isShimmering: true
39
+ });
27
40
  return /*#__PURE__*/React.createElement(MentionItemStyle, {
28
41
  height: height,
29
42
  "data-mention-item": true,
@@ -32,14 +45,8 @@ export default function MentionItemPlaceholder({
32
45
  ref: forwardedRef,
33
46
  role: "status",
34
47
  "aria-label": label
35
- }, /*#__PURE__*/React.createElement(RowStyle, null, /*#__PURE__*/React.createElement(AvatarStyle, null, /*#__PURE__*/React.createElement(AvatarSkeletonWrapper, null, /*#__PURE__*/React.createElement(Skeleton, {
36
- width: 32,
37
- height: 32,
38
- borderRadius: "var(--ds-radius-full, 9999px)",
39
- isShimmering: true
40
- }))), /*#__PURE__*/React.createElement(NameSectionStyle, null, /*#__PURE__*/React.createElement(Skeleton, {
41
- width: 140,
42
- height: 12,
43
- isShimmering: true
44
- }))));
48
+ }, isExperimentEnabled('platform_editor_mentions_email_search') ? /*#__PURE__*/React.createElement(PickerItemContent, {
49
+ avatar: avatar,
50
+ title: name
51
+ }) : /*#__PURE__*/React.createElement(RowStyle, null, /*#__PURE__*/React.createElement(AvatarStyle, null, avatar), /*#__PURE__*/React.createElement(NameSectionStyle, null, name)));
45
52
  }
@@ -5,20 +5,21 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
5
5
  import React from 'react';
6
6
  import EditorPanelIcon from '@atlaskit/icon/core/status-information';
7
7
  import Lozenge from '@atlaskit/lozenge/new/lozenge';
8
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
8
9
  import { fg } from '@atlaskit/platform-feature-flags/fg';
9
10
  import Tag from '@atlaskit/tag/removable-tag';
10
11
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
12
+ import { PICKER_ITEM_HEIGHT } from '@atlaskit/user-picker/picker-item-content';
11
13
  import { isAgentMention } from '../../is-agent-mention';
12
14
  import { isRestricted } from '../../is-restricted';
13
15
  import { NoAccessLabel } from '../../util/i18n';
14
16
  import { leftClick } from '../../util/left-click';
15
17
  import AsyncLockCircleIcon from '../LockCircleIcon';
16
- import { MentionAvatar } from '../MentionAvatar';
17
- import MentionDescriptionByline from '../MentionDescriptionByline';
18
18
  import MessagesIntlProvider from '../MessagesIntlProvider';
19
19
  import AsyncNoAccessTooltip from '../NoAccessTooltip';
20
- import { renderHighlight } from './MentionHighlightHelpers';
21
- import { AccessSectionStyle, AvatarStyle, FullNameStyle, InfoSectionStyle, MentionItemStyle, NameSectionStyle, RowStyle as RowStyleLegacy, RowStyleNext, TimeStyle } from './styles';
20
+ import { MentionItemLayoutNext } from './MentionItemLayout';
21
+ import { MentionItemLayoutLegacy } from './MentionItemLayoutLegacy';
22
+ import { AccessSectionStyle, InfoSectionStyle, MentionItemStyle, RowStyle as RowStyleLegacy, RowStyleNext, TimeStyle } from './styles';
22
23
 
23
24
  // Lazy-loaded so `@atlaskit/skeleton` (only needed for the loading
24
25
  // placeholder) doesn't enter the bundle for every `@atlaskit/mention`
@@ -107,12 +108,11 @@ export default class MentionItem extends React.PureComponent {
107
108
  const {
108
109
  mention,
109
110
  selected,
110
- forwardedRef,
111
- height
111
+ forwardedRef
112
112
  } = this.props;
113
+ const height = isExperimentEnabled('platform_editor_mentions_email_search') ? PICKER_ITEM_HEIGHT : this.props.height;
113
114
  const {
114
115
  id,
115
- highlight,
116
116
  presence,
117
117
  name,
118
118
  mentionName,
@@ -136,7 +136,6 @@ export default class MentionItem extends React.PureComponent {
136
136
  time
137
137
  } = presence || {};
138
138
  const restricted = isRestricted(accessLevel);
139
- const nameHighlights = highlight && highlight.name;
140
139
  const xProductUserInfoIconColor = selected ? "var(--ds-icon-selected, #1868DB)" : "var(--ds-icon, #292A2E)";
141
140
  let RowStyle = RowStyleLegacy;
142
141
  let isAgent = false;
@@ -144,6 +143,7 @@ export default class MentionItem extends React.PureComponent {
144
143
  RowStyle = RowStyleNext;
145
144
  isAgent = isAgentMention(mention);
146
145
  }
146
+ const ItemLayout = isExperimentEnabled('platform_editor_mentions_email_search') ? MentionItemLayoutNext : MentionItemLayoutLegacy;
147
147
  return /*#__PURE__*/React.createElement(MessagesIntlProvider, null, /*#__PURE__*/React.createElement(MentionItemStyle, {
148
148
  selected: selected,
149
149
  height: height,
@@ -157,16 +157,11 @@ export default class MentionItem extends React.PureComponent {
157
157
  "data-mention-is-agent": isAgent ? 'true' : undefined,
158
158
  "data-selected": selected,
159
159
  ref: forwardedRef
160
- }, /*#__PURE__*/React.createElement(RowStyle, null, /*#__PURE__*/React.createElement(AvatarStyle, {
161
- restricted: restricted
162
- }, /*#__PURE__*/React.createElement(MentionAvatar, {
160
+ }, /*#__PURE__*/React.createElement(ItemLayout, {
161
+ mention: mention,
163
162
  selected: selected,
164
- mention: mention
165
- })), /*#__PURE__*/React.createElement(NameSectionStyle, {
166
- restricted: restricted
167
- }, renderHighlight(FullNameStyle, name, nameHighlights), /*#__PURE__*/React.createElement(MentionDescriptionByline, {
168
- mention: mention
169
- })), /*#__PURE__*/React.createElement(InfoSectionStyle, {
163
+ legacyRow: RowStyle
164
+ }, /*#__PURE__*/React.createElement(InfoSectionStyle, {
170
165
  restricted: restricted
171
166
  }, fg('platform-dst-lozenge-tag-badge-visual-uplifts') ? renderTag(lozenge) : renderLozenge(lozenge), renderTime(time)), restricted ? /*#__PURE__*/React.createElement(React.Suspense, {
172
167
  fallback: null
@@ -1 +1 @@
1
- export const packageVersion = "30.5.1";
1
+ export const packageVersion = "30.6.0";
@@ -0,0 +1,39 @@
1
+ import React from 'react';
2
+ import { UserType } from '../../types';
3
+ import { messages } from '../i18n';
4
+ import { renderHighlight } from '../MentionItem/MentionHighlightHelpers';
5
+
6
+ /** Content for MentionItemLayoutNext, selected by the email-search experiment. */
7
+ export var getMentionDescriptionByline = function getMentionDescriptionByline(mention, intl) {
8
+ var _highlight$nickname;
9
+ var context = mention.context,
10
+ email = mention.email,
11
+ highlight = mention.highlight,
12
+ isXProductUser = mention.isXProductUser,
13
+ name = mention.name,
14
+ nickname = mention.nickname,
15
+ userType = mention.userType;
16
+ if (isXProductUser) {
17
+ return intl.formatMessage(messages.xProductMentionDescription);
18
+ }
19
+ if (userType === UserType[UserType.TEAM]) {
20
+ if (!context) {
21
+ return null;
22
+ }
23
+ var includesYou = context.includesYou,
24
+ memberCount = context.memberCount;
25
+ if (memberCount > 50) {
26
+ return intl.formatMessage(includesYou ? messages.plus50MembersWithYou : messages.plus50MembersWithoutYou);
27
+ }
28
+ return intl.formatMessage(includesYou ? messages.memberCountWithYou : messages.memberCountWithoutYou, {
29
+ 0: memberCount
30
+ });
31
+ }
32
+ if (email && (!nickname || name === nickname)) {
33
+ return email;
34
+ }
35
+ if (!nickname || name === nickname) {
36
+ return null;
37
+ }
38
+ return highlight !== null && highlight !== void 0 && (_highlight$nickname = highlight.nickname) !== null && _highlight$nickname !== void 0 && _highlight$nickname.length ? renderHighlight(React.Fragment, nickname, highlight.nickname, '@') : "@".concat(nickname);
39
+ };
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import { useIntl } from 'react-intl';
3
+ import { PickerItemContent } from '@atlaskit/user-picker/picker-item-content';
4
+ import { isRestricted } from '../../is-restricted';
5
+ import { MentionAvatar } from '../MentionAvatar';
6
+ import { getMentionDescriptionByline } from '../MentionDescriptionByline/getMentionDescriptionByline';
7
+ import { renderHighlight } from './MentionHighlightHelpers';
8
+ import { FullNameStyle } from './styles';
9
+ export var MentionItemLayoutNext = function MentionItemLayoutNext(_ref) {
10
+ var _mention$highlight;
11
+ var mention = _ref.mention,
12
+ selected = _ref.selected,
13
+ children = _ref.children;
14
+ var intl = useIntl();
15
+ return /*#__PURE__*/React.createElement(PickerItemContent, {
16
+ avatar: /*#__PURE__*/React.createElement(MentionAvatar, {
17
+ selected: selected,
18
+ mention: mention
19
+ }),
20
+ title: renderHighlight(FullNameStyle, mention.name, (_mention$highlight = mention.highlight) === null || _mention$highlight === void 0 ? void 0 : _mention$highlight.name),
21
+ subtext: getMentionDescriptionByline(mention, intl),
22
+ after: /*#__PURE__*/React.createElement(React.Fragment, null, children),
23
+ isMuted: isRestricted(mention.accessLevel)
24
+ });
25
+ };
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import { isRestricted } from '../../is-restricted';
3
+ import { MentionAvatar } from '../MentionAvatar';
4
+ import MentionDescriptionByline from '../MentionDescriptionByline';
5
+ import { renderHighlight } from './MentionHighlightHelpers';
6
+ import { AvatarStyle, FullNameStyle, NameSectionStyle } from './styles';
7
+ export var MentionItemLayoutLegacy = function MentionItemLayoutLegacy(_ref) {
8
+ var _mention$highlight;
9
+ var mention = _ref.mention,
10
+ selected = _ref.selected,
11
+ LegacyRow = _ref.legacyRow,
12
+ children = _ref.children;
13
+ var restricted = isRestricted(mention.accessLevel);
14
+ return /*#__PURE__*/React.createElement(LegacyRow, null, /*#__PURE__*/React.createElement(AvatarStyle, {
15
+ restricted: restricted
16
+ }, /*#__PURE__*/React.createElement(MentionAvatar, {
17
+ selected: selected,
18
+ mention: mention
19
+ })), /*#__PURE__*/React.createElement(NameSectionStyle, {
20
+ restricted: restricted
21
+ }, renderHighlight(FullNameStyle, mention.name, (_mention$highlight = mention.highlight) === null || _mention$highlight === void 0 ? void 0 : _mention$highlight.name), /*#__PURE__*/React.createElement(MentionDescriptionByline, {
22
+ mention: mention
23
+ })), children);
24
+ };
@@ -1,6 +1,8 @@
1
1
  import React from 'react';
2
2
  import { useIntl } from 'react-intl';
3
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
3
4
  import Skeleton from '@atlaskit/skeleton';
5
+ import { PickerItemContent } from '@atlaskit/user-picker/picker-item-content';
4
6
  import { messages } from '../i18n';
5
7
  import { AvatarSkeletonWrapper, AvatarStyle, MentionItemStyle, NameSectionStyle, RowStyle } from './styles';
6
8
  /**
@@ -22,6 +24,17 @@ export default function MentionItemPlaceholder(_ref) {
22
24
  var _useIntl = useIntl(),
23
25
  formatMessage = _useIntl.formatMessage;
24
26
  var label = formatMessage(messages.loadingPlaceholder);
27
+ var avatar = /*#__PURE__*/React.createElement(AvatarSkeletonWrapper, null, /*#__PURE__*/React.createElement(Skeleton, {
28
+ width: 32,
29
+ height: 32,
30
+ borderRadius: "var(--ds-radius-full, 9999px)",
31
+ isShimmering: true
32
+ }));
33
+ var name = /*#__PURE__*/React.createElement(Skeleton, {
34
+ width: 140,
35
+ height: 12,
36
+ isShimmering: true
37
+ });
25
38
  return /*#__PURE__*/React.createElement(MentionItemStyle, {
26
39
  height: height,
27
40
  "data-mention-item": true,
@@ -30,14 +43,8 @@ export default function MentionItemPlaceholder(_ref) {
30
43
  ref: forwardedRef,
31
44
  role: "status",
32
45
  "aria-label": label
33
- }, /*#__PURE__*/React.createElement(RowStyle, null, /*#__PURE__*/React.createElement(AvatarStyle, null, /*#__PURE__*/React.createElement(AvatarSkeletonWrapper, null, /*#__PURE__*/React.createElement(Skeleton, {
34
- width: 32,
35
- height: 32,
36
- borderRadius: "var(--ds-radius-full, 9999px)",
37
- isShimmering: true
38
- }))), /*#__PURE__*/React.createElement(NameSectionStyle, null, /*#__PURE__*/React.createElement(Skeleton, {
39
- width: 140,
40
- height: 12,
41
- isShimmering: true
42
- }))));
46
+ }, isExperimentEnabled('platform_editor_mentions_email_search') ? /*#__PURE__*/React.createElement(PickerItemContent, {
47
+ avatar: avatar,
48
+ title: name
49
+ }) : /*#__PURE__*/React.createElement(RowStyle, null, /*#__PURE__*/React.createElement(AvatarStyle, null, avatar), /*#__PURE__*/React.createElement(NameSectionStyle, null, name)));
43
50
  }
@@ -13,20 +13,21 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
13
13
  import React from 'react';
14
14
  import EditorPanelIcon from '@atlaskit/icon/core/status-information';
15
15
  import Lozenge from '@atlaskit/lozenge/new/lozenge';
16
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
16
17
  import { fg } from '@atlaskit/platform-feature-flags/fg';
17
18
  import Tag from '@atlaskit/tag/removable-tag';
18
19
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
20
+ import { PICKER_ITEM_HEIGHT } from '@atlaskit/user-picker/picker-item-content';
19
21
  import { isAgentMention } from '../../is-agent-mention';
20
22
  import { isRestricted } from '../../is-restricted';
21
23
  import { NoAccessLabel } from '../../util/i18n';
22
24
  import { leftClick } from '../../util/left-click';
23
25
  import AsyncLockCircleIcon from '../LockCircleIcon';
24
- import { MentionAvatar } from '../MentionAvatar';
25
- import MentionDescriptionByline from '../MentionDescriptionByline';
26
26
  import MessagesIntlProvider from '../MessagesIntlProvider';
27
27
  import AsyncNoAccessTooltip from '../NoAccessTooltip';
28
- import { renderHighlight } from './MentionHighlightHelpers';
29
- import { AccessSectionStyle, AvatarStyle, FullNameStyle, InfoSectionStyle, MentionItemStyle, NameSectionStyle, RowStyle as RowStyleLegacy, RowStyleNext, TimeStyle } from './styles';
28
+ import { MentionItemLayoutNext } from './MentionItemLayout';
29
+ import { MentionItemLayoutLegacy } from './MentionItemLayoutLegacy';
30
+ import { AccessSectionStyle, InfoSectionStyle, MentionItemStyle, RowStyle as RowStyleLegacy, RowStyleNext, TimeStyle } from './styles';
30
31
 
31
32
  // Lazy-loaded so `@atlaskit/skeleton` (only needed for the loading
32
33
  // placeholder) doesn't enter the bundle for every `@atlaskit/mention`
@@ -122,10 +123,9 @@ var MentionItem = /*#__PURE__*/function (_React$PureComponent) {
122
123
  var _this$props = this.props,
123
124
  mention = _this$props.mention,
124
125
  selected = _this$props.selected,
125
- forwardedRef = _this$props.forwardedRef,
126
- height = _this$props.height;
126
+ forwardedRef = _this$props.forwardedRef;
127
+ var height = isExperimentEnabled('platform_editor_mentions_email_search') ? PICKER_ITEM_HEIGHT : this.props.height;
127
128
  var id = mention.id,
128
- highlight = mention.highlight,
129
129
  presence = mention.presence,
130
130
  name = mention.name,
131
131
  mentionName = mention.mentionName,
@@ -147,7 +147,6 @@ var MentionItem = /*#__PURE__*/function (_React$PureComponent) {
147
147
  var _ref = presence || {},
148
148
  time = _ref.time;
149
149
  var restricted = isRestricted(accessLevel);
150
- var nameHighlights = highlight && highlight.name;
151
150
  var xProductUserInfoIconColor = selected ? "var(--ds-icon-selected, #1868DB)" : "var(--ds-icon, #292A2E)";
152
151
  var RowStyle = RowStyleLegacy;
153
152
  var isAgent = false;
@@ -155,6 +154,7 @@ var MentionItem = /*#__PURE__*/function (_React$PureComponent) {
155
154
  RowStyle = RowStyleNext;
156
155
  isAgent = isAgentMention(mention);
157
156
  }
157
+ var ItemLayout = isExperimentEnabled('platform_editor_mentions_email_search') ? MentionItemLayoutNext : MentionItemLayoutLegacy;
158
158
  return /*#__PURE__*/React.createElement(MessagesIntlProvider, null, /*#__PURE__*/React.createElement(MentionItemStyle, {
159
159
  selected: selected,
160
160
  height: height,
@@ -168,16 +168,11 @@ var MentionItem = /*#__PURE__*/function (_React$PureComponent) {
168
168
  "data-mention-is-agent": isAgent ? 'true' : undefined,
169
169
  "data-selected": selected,
170
170
  ref: forwardedRef
171
- }, /*#__PURE__*/React.createElement(RowStyle, null, /*#__PURE__*/React.createElement(AvatarStyle, {
172
- restricted: restricted
173
- }, /*#__PURE__*/React.createElement(MentionAvatar, {
171
+ }, /*#__PURE__*/React.createElement(ItemLayout, {
172
+ mention: mention,
174
173
  selected: selected,
175
- mention: mention
176
- })), /*#__PURE__*/React.createElement(NameSectionStyle, {
177
- restricted: restricted
178
- }, renderHighlight(FullNameStyle, name, nameHighlights), /*#__PURE__*/React.createElement(MentionDescriptionByline, {
179
- mention: mention
180
- })), /*#__PURE__*/React.createElement(InfoSectionStyle, {
174
+ legacyRow: RowStyle
175
+ }, /*#__PURE__*/React.createElement(InfoSectionStyle, {
181
176
  restricted: restricted
182
177
  }, fg('platform-dst-lozenge-tag-badge-visual-uplifts') ? renderTag(lozenge) : renderLozenge(lozenge), renderTime(time)), restricted ? /*#__PURE__*/React.createElement(React.Suspense, {
183
178
  fallback: null
@@ -1 +1 @@
1
- export var packageVersion = "30.5.1";
1
+ export var packageVersion = "30.6.0";
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import type { IntlShape } from 'react-intl';
3
+ import { type MentionDescription } from '../../types';
4
+ /** Content for MentionItemLayoutNext, selected by the email-search experiment. */
5
+ export declare const getMentionDescriptionByline: (mention: MentionDescription, intl: IntlShape) => string | React.JSX.Element | null;
@@ -2,6 +2,6 @@ import type { DetailedHTMLProps, HTMLAttributes } from 'react';
2
2
  import type { Theme } from '@emotion/react';
3
3
  import { type StyledComponent } from '@emotion/styled';
4
4
  export declare const DescriptionBylineStyle: StyledComponent<{
5
- theme?: Theme;
6
5
  as?: React.ElementType;
6
+ theme?: Theme;
7
7
  }, DetailedHTMLProps<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import type { MentionDescription } from '../../types';
3
+ type Props = React.PropsWithChildren<{
4
+ mention: MentionDescription;
5
+ selected?: boolean;
6
+ }>;
7
+ export declare const MentionItemLayoutNext: ({ mention, selected, children, }: Props) => React.JSX.Element;
8
+ export {};
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import type { MentionDescription } from '../../types';
3
+ import { type RowStyle } from './styles';
4
+ type Props = React.PropsWithChildren<{
5
+ legacyRow: typeof RowStyle;
6
+ mention: MentionDescription;
7
+ selected?: boolean;
8
+ }>;
9
+ export declare const MentionItemLayoutLegacy: ({ mention, selected, legacyRow: LegacyRow, children, }: Props) => React.JSX.Element;
10
+ export {};
package/package.json CHANGED
@@ -29,7 +29,7 @@
29
29
  "access": "public"
30
30
  },
31
31
  "dependencies": {
32
- "@atlaskit/afm-i18n-platform-elements-mention": "2.287.0",
32
+ "@atlaskit/afm-i18n-platform-elements-mention": "2.294.0",
33
33
  "@atlaskit/analytics-gas-types": "^6.2.0",
34
34
  "@atlaskit/analytics-next": "^12.6.0",
35
35
  "@atlaskit/avatar": "^30.0.0",
@@ -45,10 +45,11 @@
45
45
  "@atlaskit/skeleton": "^4.4.0",
46
46
  "@atlaskit/tag": "^17.0.0",
47
47
  "@atlaskit/teams-avatar": "^4.2.0",
48
- "@atlaskit/tmp-editor-statsig": "^248.0.0",
48
+ "@atlaskit/tmp-editor-statsig": "^248.1.0",
49
49
  "@atlaskit/tokens": "^20.8.0",
50
50
  "@atlaskit/tooltip": "^24.4.0",
51
51
  "@atlaskit/ufo": "^2.0.0",
52
+ "@atlaskit/user-picker": "^14.5.0",
52
53
  "@atlaskit/util-service-support": "^7.4.0",
53
54
  "@babel/runtime": "^7.0.0",
54
55
  "@compiled/react": "^1.0.2",
@@ -64,7 +65,7 @@
64
65
  "@af/visual-regression": "workspace:^",
65
66
  "@atlaskit/docs": "^12.3.0",
66
67
  "@atlaskit/editor-plugins": "^16.2.0",
67
- "@atlaskit/feature-gate-js-client": "^7.0.0",
68
+ "@atlaskit/feature-gate-js-client": "^7.1.0",
68
69
  "@atlaskit/link": "^5.1.0",
69
70
  "@atlaskit/theme": "^28.2.0",
70
71
  "@atlaskit/util-data-test": "^19.1.0",
@@ -129,5 +130,5 @@
129
130
  "*.compiled.css"
130
131
  ],
131
132
  "types": "dist/types/index.d.ts",
132
- "version": "30.5.2"
133
+ "version": "30.7.0"
133
134
  }