@atlaskit/mention 26.1.0 → 26.3.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 (147) hide show
  1. package/CHANGELOG.md +78 -0
  2. package/analytics/package.json +1 -8
  3. package/constants/package.json +1 -8
  4. package/context-mention-resource/package.json +1 -8
  5. package/dist/cjs/api/ContextMentionResource.js +14 -0
  6. package/dist/cjs/api/MentionResource.js +6 -0
  7. package/dist/cjs/components/DisabledMentionTooltip/index.js +20 -0
  8. package/dist/cjs/components/DisabledMentionTooltip/main.js +24 -0
  9. package/dist/cjs/components/Mention/PrimitiveMention.js +8 -1
  10. package/dist/cjs/components/Mention/index.js +51 -12
  11. package/dist/cjs/components/MentionAvatar/index.js +6 -1
  12. package/dist/cjs/types.js +10 -0
  13. package/dist/cjs/util/analytics.js +1 -1
  14. package/dist/es2019/api/ContextMentionResource.js +12 -0
  15. package/dist/es2019/api/MentionResource.js +4 -0
  16. package/dist/es2019/components/DisabledMentionTooltip/index.js +7 -0
  17. package/dist/es2019/components/DisabledMentionTooltip/main.js +14 -0
  18. package/dist/es2019/components/Mention/PrimitiveMention.js +8 -0
  19. package/dist/es2019/components/Mention/index.js +50 -12
  20. package/dist/es2019/components/MentionAvatar/index.js +7 -2
  21. package/dist/es2019/types.js +12 -0
  22. package/dist/es2019/util/analytics.js +1 -1
  23. package/dist/esm/api/ContextMentionResource.js +14 -0
  24. package/dist/esm/api/MentionResource.js +6 -0
  25. package/dist/esm/components/DisabledMentionTooltip/index.js +9 -0
  26. package/dist/esm/components/DisabledMentionTooltip/main.js +17 -0
  27. package/dist/esm/components/Mention/PrimitiveMention.js +8 -1
  28. package/dist/esm/components/Mention/index.js +51 -12
  29. package/dist/esm/components/MentionAvatar/index.js +7 -2
  30. package/dist/esm/types.js +12 -0
  31. package/dist/esm/util/analytics.js +1 -1
  32. package/dist/types/api/ContextMentionResource.d.ts +6 -1
  33. package/dist/types/api/MentionResource.d.ts +2 -1
  34. package/dist/types/components/DisabledMentionTooltip/index.d.ts +6 -0
  35. package/dist/types/components/DisabledMentionTooltip/main.d.ts +12 -0
  36. package/dist/types/components/Mention/index.d.ts +12 -0
  37. package/dist/types/types.d.ts +67 -1
  38. package/docs/0-intro.tsx +21 -0
  39. package/element/package.json +1 -8
  40. package/item/package.json +1 -8
  41. package/mention/package.json +1 -8
  42. package/mention-item/package.json +1 -8
  43. package/mention-item/styles/package.json +1 -8
  44. package/mention-list/package.json +1 -8
  45. package/mention-name-client/package.json +1 -8
  46. package/mention-name-resolver/package.json +1 -8
  47. package/mention-picker/package.json +1 -8
  48. package/mention-resource/package.json +1 -8
  49. package/package.json +10 -5
  50. package/presence-resource/package.json +1 -8
  51. package/resource/package.json +1 -8
  52. package/resourced-mention/package.json +1 -8
  53. package/resourced-mention-list/package.json +1 -8
  54. package/shared-styles/package.json +1 -8
  55. package/team-mention-resource/package.json +1 -8
  56. package/team-resource/package.json +1 -8
  57. package/typeahead/package.json +1 -8
  58. package/types/package.json +1 -8
  59. package/dist/types-ts4.5/_constants.d.ts +0 -1
  60. package/dist/types-ts4.5/api/ContextMentionResource.d.ts +0 -23
  61. package/dist/types-ts4.5/api/MentionNameClient.d.ts +0 -11
  62. package/dist/types-ts4.5/api/MentionNameResolver.d.ts +0 -38
  63. package/dist/types-ts4.5/api/MentionResource.d.ts +0 -105
  64. package/dist/types-ts4.5/api/PresenceResource.d.ts +0 -158
  65. package/dist/types-ts4.5/api/TeamMentionResource.d.ts +0 -33
  66. package/dist/types-ts4.5/api/analytics.d.ts +0 -17
  67. package/dist/types-ts4.5/components/LockCircleIcon/index.d.ts +0 -7
  68. package/dist/types-ts4.5/components/Mention/PrimitiveMention.d.ts +0 -7
  69. package/dist/types-ts4.5/components/Mention/ResourcedMention.d.ts +0 -29
  70. package/dist/types-ts4.5/components/Mention/index.d.ts +0 -33
  71. package/dist/types-ts4.5/components/Mention/ufoExperiences.d.ts +0 -9
  72. package/dist/types-ts4.5/components/MentionAvatar/index.d.ts +0 -8
  73. package/dist/types-ts4.5/components/MentionDescriptionByline/TeamMentionDescriptionByline.d.ts +0 -7
  74. package/dist/types-ts4.5/components/MentionDescriptionByline/UserMentionDescriptionByline.d.ts +0 -5
  75. package/dist/types-ts4.5/components/MentionDescriptionByline/index.d.ts +0 -5
  76. package/dist/types-ts4.5/components/MentionDescriptionByline/styles.d.ts +0 -7
  77. package/dist/types-ts4.5/components/MentionDescriptionByline/types.d.ts +0 -4
  78. package/dist/types-ts4.5/components/MentionItem/MentionHighlightHelpers.d.ts +0 -3
  79. package/dist/types-ts4.5/components/MentionItem/index.d.ts +0 -19
  80. package/dist/types-ts4.5/components/MentionItem/styles.d.ts +0 -50
  81. package/dist/types-ts4.5/components/MentionList/index.d.ts +0 -43
  82. package/dist/types-ts4.5/components/MentionList/styles.d.ts +0 -10
  83. package/dist/types-ts4.5/components/MentionListError/GenericErrorIllustration.d.ts +0 -7
  84. package/dist/types-ts4.5/components/MentionListError/index.d.ts +0 -13
  85. package/dist/types-ts4.5/components/MentionListError/styles.d.ts +0 -7
  86. package/dist/types-ts4.5/components/MentionPicker/index.d.ts +0 -77
  87. package/dist/types-ts4.5/components/MentionPicker/styles.d.ts +0 -14
  88. package/dist/types-ts4.5/components/MessagesIntlProvider/index.d.ts +0 -3
  89. package/dist/types-ts4.5/components/NoAccessTooltip/index.d.ts +0 -6
  90. package/dist/types-ts4.5/components/NoAccessTooltip/main.d.ts +0 -7
  91. package/dist/types-ts4.5/components/Popup/index.d.ts +0 -25
  92. package/dist/types-ts4.5/components/ResourcedMentionList/index.d.ts +0 -46
  93. package/dist/types-ts4.5/components/Scrollable/index.d.ts +0 -10
  94. package/dist/types-ts4.5/components/Scrollable/styles.d.ts +0 -7
  95. package/dist/types-ts4.5/components/i18n.d.ts +0 -62
  96. package/dist/types-ts4.5/config/index.d.ts +0 -5
  97. package/dist/types-ts4.5/element.d.ts +0 -3
  98. package/dist/types-ts4.5/i18n/cs.d.ts +0 -21
  99. package/dist/types-ts4.5/i18n/da.d.ts +0 -21
  100. package/dist/types-ts4.5/i18n/de.d.ts +0 -21
  101. package/dist/types-ts4.5/i18n/en.d.ts +0 -21
  102. package/dist/types-ts4.5/i18n/en_GB.d.ts +0 -21
  103. package/dist/types-ts4.5/i18n/en_ZZ.d.ts +0 -21
  104. package/dist/types-ts4.5/i18n/es.d.ts +0 -21
  105. package/dist/types-ts4.5/i18n/et.d.ts +0 -20
  106. package/dist/types-ts4.5/i18n/fi.d.ts +0 -21
  107. package/dist/types-ts4.5/i18n/fr.d.ts +0 -21
  108. package/dist/types-ts4.5/i18n/hr.d.ts +0 -21
  109. package/dist/types-ts4.5/i18n/hu.d.ts +0 -21
  110. package/dist/types-ts4.5/i18n/index.d.ts +0 -37
  111. package/dist/types-ts4.5/i18n/is.d.ts +0 -24
  112. package/dist/types-ts4.5/i18n/it.d.ts +0 -21
  113. package/dist/types-ts4.5/i18n/ja.d.ts +0 -21
  114. package/dist/types-ts4.5/i18n/ko.d.ts +0 -21
  115. package/dist/types-ts4.5/i18n/languages.d.ts +0 -34
  116. package/dist/types-ts4.5/i18n/nb.d.ts +0 -21
  117. package/dist/types-ts4.5/i18n/nl.d.ts +0 -21
  118. package/dist/types-ts4.5/i18n/pl.d.ts +0 -21
  119. package/dist/types-ts4.5/i18n/pt_BR.d.ts +0 -21
  120. package/dist/types-ts4.5/i18n/pt_PT.d.ts +0 -20
  121. package/dist/types-ts4.5/i18n/ro.d.ts +0 -24
  122. package/dist/types-ts4.5/i18n/ru.d.ts +0 -21
  123. package/dist/types-ts4.5/i18n/sk.d.ts +0 -20
  124. package/dist/types-ts4.5/i18n/sl.d.ts +0 -21
  125. package/dist/types-ts4.5/i18n/sr_RS.d.ts +0 -21
  126. package/dist/types-ts4.5/i18n/sr_YR.d.ts +0 -21
  127. package/dist/types-ts4.5/i18n/sv.d.ts +0 -21
  128. package/dist/types-ts4.5/i18n/th.d.ts +0 -21
  129. package/dist/types-ts4.5/i18n/tr.d.ts +0 -21
  130. package/dist/types-ts4.5/i18n/uk.d.ts +0 -21
  131. package/dist/types-ts4.5/i18n/vi.d.ts +0 -21
  132. package/dist/types-ts4.5/i18n/zh.d.ts +0 -21
  133. package/dist/types-ts4.5/i18n/zh_TW.d.ts +0 -21
  134. package/dist/types-ts4.5/index.d.ts +0 -17
  135. package/dist/types-ts4.5/item.d.ts +0 -2
  136. package/dist/types-ts4.5/resource.d.ts +0 -10
  137. package/dist/types-ts4.5/shared-styles.d.ts +0 -5
  138. package/dist/types-ts4.5/team-resource.d.ts +0 -8
  139. package/dist/types-ts4.5/typeahead.d.ts +0 -3
  140. package/dist/types-ts4.5/types.d.ts +0 -254
  141. package/dist/types-ts4.5/util/analytics.d.ts +0 -12
  142. package/dist/types-ts4.5/util/atl-attribution.d.ts +0 -8
  143. package/dist/types-ts4.5/util/i18n.d.ts +0 -29
  144. package/dist/types-ts4.5/util/id.d.ts +0 -2
  145. package/dist/types-ts4.5/util/index.d.ts +0 -1
  146. package/dist/types-ts4.5/util/logger.d.ts +0 -4
  147. package/dist/types-ts4.5/util/mouse.d.ts +0 -8
@@ -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 = "26.0.4";
5
+ const packageVersion = "26.3.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) => {
@@ -36,6 +36,20 @@ var ContextMentionResource = /*#__PURE__*/function () {
36
36
  _defineProperty(this, "filter", this.callWithContextIds('filter', 1));
37
37
  _defineProperty(this, "recordMentionSelection", this.callWithContextIds('recordMentionSelection', 1));
38
38
  _defineProperty(this, "shouldHighlightMention", this.callDefault('shouldHighlightMention'));
39
+ _defineProperty(this, "getMentionDisabledState", function (mention) {
40
+ var _this$mentionProvider3, _this$mentionProvider4;
41
+ return (_this$mentionProvider3 = (_this$mentionProvider4 = _this.mentionProvider).getMentionDisabledState) === null || _this$mentionProvider3 === void 0 ? void 0 : _this$mentionProvider3.call(_this$mentionProvider4, mention);
42
+ });
43
+ _defineProperty(this, "subscribeToDisabledStateChanges", function (listener) {
44
+ var _this$mentionProvider5, _this$mentionProvider6, _this$mentionProvider7;
45
+ return (_this$mentionProvider5 = (_this$mentionProvider6 = (_this$mentionProvider7 = _this.mentionProvider).subscribeToDisabledStateChanges) === null || _this$mentionProvider6 === void 0 ? void 0 : _this$mentionProvider6.call(_this$mentionProvider7, listener)) !== null && _this$mentionProvider5 !== void 0 ? _this$mentionProvider5 : function () {
46
+ return undefined;
47
+ };
48
+ });
49
+ _defineProperty(this, "notifyMentionDestroyed", function (mention) {
50
+ var _this$mentionProvider8, _this$mentionProvider9;
51
+ return (_this$mentionProvider8 = (_this$mentionProvider9 = _this.mentionProvider).notifyMentionDestroyed) === null || _this$mentionProvider8 === void 0 ? void 0 : _this$mentionProvider8.call(_this$mentionProvider9, mention);
52
+ });
39
53
  _defineProperty(this, "isFiltering", this.callDefault('isFiltering'));
40
54
  this.mentionProvider = mentionProvider;
41
55
  this.contextIdentifier = contextIdentifier;
@@ -203,6 +203,12 @@ export var MentionResource = /*#__PURE__*/function (_AbstractMentionResou) {
203
203
  }
204
204
  return false;
205
205
  }
206
+ }, {
207
+ key: "getMentionDisabledState",
208
+ value: function getMentionDisabledState(mention) {
209
+ var _this$config$getMenti, _this$config;
210
+ return (_this$config$getMenti = (_this$config = this.config).getMentionDisabledState) === null || _this$config$getMenti === void 0 ? void 0 : _this$config$getMenti.call(_this$config, mention);
211
+ }
206
212
  }, {
207
213
  key: "notify",
208
214
  value: function notify(searchTime, mentionResult, query) {
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ var AsyncDisabledMentionTooltip = /*#__PURE__*/React.lazy(function () {
3
+ return import( /* webpackChunkName: "@atlaskit-internal_@atlaskit/mention/disabled-mention-tooltip" */'./main').then(function (module) {
4
+ return {
5
+ default: module.DisabledMentionTooltip
6
+ };
7
+ });
8
+ });
9
+ export default AsyncDisabledMentionTooltip;
@@ -0,0 +1,17 @@
1
+ import Tooltip from '@atlaskit/tooltip';
2
+ import React from 'react';
3
+ /**
4
+ * Wraps a disabled `<Mention>` chip with a tooltip explaining why the chip
5
+ * is disabled. The chip itself remains non-interactive; the tooltip is the
6
+ * sole hover affordance.
7
+ */
8
+ export var DisabledMentionTooltip = function DisabledMentionTooltip(_ref) {
9
+ var tooltip = _ref.tooltip,
10
+ children = _ref.children;
11
+ return /*#__PURE__*/React.createElement(Tooltip, {
12
+ content: tooltip,
13
+ position: "top"
14
+ }, function (triggerProps) {
15
+ return /*#__PURE__*/React.createElement("span", triggerProps, children);
16
+ });
17
+ };
@@ -13,7 +13,7 @@ var _excluded = ["mentionType"];
13
13
  import { jsx, css } from '@emotion/react';
14
14
  import { MentionType } from '../../types';
15
15
  import { forwardRef } from 'react';
16
- var mentionStyle = _defineProperty(_defineProperty(_defineProperty({}, MentionType.SELF, {
16
+ var mentionStyle = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, MentionType.SELF, {
17
17
  background: "var(--ds-background-brand-bold, #1868DB)",
18
18
  borderColor: 'transparent',
19
19
  text: "var(--ds-text-inverse, #FFFFFF)",
@@ -31,6 +31,13 @@ var mentionStyle = _defineProperty(_defineProperty(_defineProperty({}, MentionTy
31
31
  text: "var(--ds-text-subtle, #505258)",
32
32
  hoveredBackground: "var(--ds-background-neutral-hovered, #0B120E24)",
33
33
  pressedBackground: "var(--ds-background-neutral-pressed, #080F214A)"
34
+ }), MentionType.DISABLED, {
35
+ background: "var(--ds-background-disabled, #0515240F)",
36
+ borderColor: 'transparent',
37
+ text: "var(--ds-text-disabled, #080F214A)",
38
+ // Disabled chips do not change on hover / press.
39
+ hoveredBackground: "var(--ds-background-disabled, #0515240F)",
40
+ pressedBackground: "var(--ds-background-disabled, #0515240F)"
34
41
  });
35
42
  var getStyle = function getStyle(_ref, property) {
36
43
  var mentionType = _ref.mentionType;
@@ -5,6 +5,8 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
5
5
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
6
  import _inherits from "@babel/runtime/helpers/inherits";
7
7
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
+ 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; }
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; }
8
10
  function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
9
11
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
10
12
  import React from 'react';
@@ -12,6 +14,7 @@ import FocusRing from '@atlaskit/focus-ring';
12
14
  import MessagesIntlProvider from '../MessagesIntlProvider';
13
15
  import PrimitiveMention from './PrimitiveMention';
14
16
  import AsyncNoAccessTooltip from '../NoAccessTooltip';
17
+ import AsyncDisabledMentionTooltip from '../DisabledMentionTooltip';
15
18
  import { isRestricted, MentionType } from '../../types';
16
19
  import { fireAnalyticsMentionEvent } from '../../util/analytics';
17
20
  import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
@@ -29,7 +32,12 @@ export var MentionInternal = /*#__PURE__*/function (_React$PureComponent) {
29
32
  var _this$props = _this.props,
30
33
  id = _this$props.id,
31
34
  text = _this$props.text,
32
- onClick = _this$props.onClick;
35
+ onClick = _this$props.onClick,
36
+ isDisabled = _this$props.isDisabled;
37
+ if (isDisabled) {
38
+ // Disabled chips do not invoke their click handler.
39
+ return;
40
+ }
33
41
  if (onClick) {
34
42
  onClick(id, text, e);
35
43
  }
@@ -65,7 +73,11 @@ export var MentionInternal = /*#__PURE__*/function (_React$PureComponent) {
65
73
  _defineProperty(_this, "getMentionType", function () {
66
74
  var _this$props4 = _this.props,
67
75
  accessLevel = _this$props4.accessLevel,
68
- isHighlighted = _this$props4.isHighlighted;
76
+ isHighlighted = _this$props4.isHighlighted,
77
+ isDisabled = _this$props4.isDisabled;
78
+ if (isDisabled) {
79
+ return MentionType.DISABLED;
80
+ }
69
81
  if (isHighlighted) {
70
82
  return MentionType.SELF;
71
83
  }
@@ -115,11 +127,25 @@ export var MentionInternal = /*#__PURE__*/function (_React$PureComponent) {
115
127
  var text = props.text,
116
128
  id = props.id,
117
129
  accessLevel = props.accessLevel,
118
- localId = props.localId;
130
+ localId = props.localId,
131
+ disabledTooltip = props.disabledTooltip;
119
132
  var mentionType = this.getMentionType();
120
133
  var failedMention = text === "@".concat(UNKNOWN_USER_ID);
121
- var showTooltip = mentionType === MentionType.RESTRICTED;
122
- var mentionComponent = /*#__PURE__*/React.createElement(FocusRing, null, /*#__PURE__*/React.createElement(PrimitiveMention, {
134
+ var showRestrictedTooltip = mentionType === MentionType.RESTRICTED;
135
+ var showDisabledTooltip = mentionType === MentionType.DISABLED && !!disabledTooltip;
136
+
137
+ // A11y: when the chip is in the disabled visual state, expose
138
+ // `aria-disabled` so assistive tech announces it as such. The
139
+ // disabled-tooltip text is mirrored into `aria-label` so the
140
+ // announcement carries the reason even without portal-id wiring for
141
+ // `aria-describedby`.
142
+ var isDisabledChip = mentionType === MentionType.DISABLED;
143
+ var disabledA11yProps = isDisabledChip ? _objectSpread({
144
+ 'aria-disabled': true
145
+ }, disabledTooltip ? {
146
+ 'aria-label': "".concat(text || '@...', " \u2014 ").concat(disabledTooltip)
147
+ } : {}) : {};
148
+ var mentionComponent = /*#__PURE__*/React.createElement(FocusRing, null, /*#__PURE__*/React.createElement(PrimitiveMention, _extends({
123
149
  mentionType: mentionType,
124
150
  onClick: handleOnClick,
125
151
  onMouseEnter: handleOnMouseEnter,
@@ -127,11 +153,28 @@ export var MentionInternal = /*#__PURE__*/function (_React$PureComponent) {
127
153
  spellCheck: false,
128
154
  "data-testid": "mention-".concat(id),
129
155
  "data-mention-type": mentionType,
130
- "data-mention-tooltip": showTooltip
131
- }, failedMention ? this.renderUnknownUserError(id) : text || '@...'));
156
+ "data-mention-tooltip": showRestrictedTooltip || showDisabledTooltip
157
+ }, disabledA11yProps), failedMention ? this.renderUnknownUserError(id) : text || '@...'));
132
158
  var ssrPlaceholderProp = props.ssrPlaceholderId ? {
133
159
  'data-ssr-placeholder': props.ssrPlaceholderId
134
160
  } : {};
161
+ var wrappedMention = function () {
162
+ if (showRestrictedTooltip) {
163
+ return /*#__PURE__*/React.createElement(React.Suspense, {
164
+ fallback: mentionComponent
165
+ }, /*#__PURE__*/React.createElement(AsyncNoAccessTooltip, {
166
+ name: text
167
+ }, mentionComponent));
168
+ }
169
+ if (showDisabledTooltip) {
170
+ return /*#__PURE__*/React.createElement(React.Suspense, {
171
+ fallback: mentionComponent
172
+ }, /*#__PURE__*/React.createElement(AsyncDisabledMentionTooltip, {
173
+ tooltip: disabledTooltip
174
+ }, mentionComponent));
175
+ }
176
+ return mentionComponent;
177
+ }();
135
178
  return /*#__PURE__*/React.createElement(UfoErrorBoundary, {
136
179
  id: id
137
180
  }, /*#__PURE__*/React.createElement("span", _extends({
@@ -140,11 +183,7 @@ export var MentionInternal = /*#__PURE__*/function (_React$PureComponent) {
140
183
  "data-local-id": localId,
141
184
  "data-access-level": accessLevel,
142
185
  spellCheck: false
143
- }, ssrPlaceholderProp), /*#__PURE__*/React.createElement(MessagesIntlProvider, null, showTooltip ? /*#__PURE__*/React.createElement(React.Suspense, {
144
- fallback: mentionComponent
145
- }, /*#__PURE__*/React.createElement(AsyncNoAccessTooltip, {
146
- name: text
147
- }, mentionComponent)) : mentionComponent)));
186
+ }, ssrPlaceholderProp), /*#__PURE__*/React.createElement(MessagesIntlProvider, null, wrappedMention)));
148
187
  }
149
188
  }]);
150
189
  }(React.PureComponent);
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import Avatar, { getAppearanceForAppType } from '@atlaskit/avatar';
3
3
  import TeamAvatar from '@atlaskit/teams-avatar';
4
4
  import { fg } from '@atlaskit/platform-feature-flags';
5
- import { isTeamMention } from '../../types';
5
+ import { isAppMention, isTeamMention } from '../../types';
6
6
  export var MentionAvatar = function MentionAvatar(_ref) {
7
7
  var mention = _ref.mention,
8
8
  selected = _ref.selected;
@@ -19,11 +19,16 @@ export var MentionAvatar = function MentionAvatar(_ref) {
19
19
  borderColor: borderColor
20
20
  });
21
21
  }
22
+
23
+ // Agent providers can request GraphQL `identityAccount { picture }` and pass it as
24
+ // `avatarUrl`; this component only applies the hexagon agent shape.
25
+ var shouldRenderAgentMentionAvatar = isAppMention(mention) && mention.appType === 'agent' && fg('rovo_chat_agent_selection');
26
+ var avatarAppearance = shouldRenderAgentMentionAvatar ? 'hexagon' : fg('jira_ai_agent_avatar_issue_view_comment_mentions') ? getAppearanceForAppType(appType) : undefined;
22
27
  return /*#__PURE__*/React.createElement(Avatar, {
23
28
  src: avatarUrl,
24
29
  size: "medium",
25
30
  presence: status,
26
31
  borderColor: borderColor,
27
- appearance: fg('jira_ai_agent_avatar_issue_view_comment_mentions') ? getAppearanceForAppType(appType) : undefined
32
+ appearance: avatarAppearance
28
33
  });
29
34
  };
package/dist/esm/types.js CHANGED
@@ -6,12 +6,24 @@
6
6
  * and `refreshedSecurityProvider` fields.
7
7
  */
8
8
 
9
+ /**
10
+ * Describes whether a mention should be rendered in its disabled visual
11
+ * state and what tooltip (if any) should be shown on hover.
12
+ */
13
+
14
+ /**
15
+ * The minimal input shape used by `getMentionDisabledState`. Kept as a named
16
+ * type so the config callback and the provider method share the same input
17
+ * surface, and so callers do not have to fabricate fields they do not have.
18
+ */
19
+
9
20
  // data is returned from team search service
10
21
 
11
22
  export var MentionType = /*#__PURE__*/function (MentionType) {
12
23
  MentionType[MentionType["SELF"] = 0] = "SELF";
13
24
  MentionType[MentionType["RESTRICTED"] = 1] = "RESTRICTED";
14
25
  MentionType[MentionType["DEFAULT"] = 2] = "DEFAULT";
26
+ MentionType[MentionType["DISABLED"] = 3] = "DISABLED";
15
27
  return MentionType;
16
28
  }({});
17
29
  export var UserAccessLevel = /*#__PURE__*/function (UserAccessLevel) {
@@ -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 = "26.0.4";
8
+ var packageVersion = "26.3.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) {
@@ -1,5 +1,5 @@
1
1
  import { type MentionProvider, type MentionContextIdentifier, ErrorCallback, InfoCallback, ResultCallback } from './MentionResource';
2
- import { type MentionDescription, type InviteFromMentionProvider, type XProductInviteMentionProvider, type AnalyticsCallback } from '../types';
2
+ import { type MentionDescription, type MentionDisabledState, type MentionDisabledStateInput, type InviteFromMentionProvider, type XProductInviteMentionProvider, type AnalyticsCallback } from '../types';
3
3
  export type { MentionDescription };
4
4
  export type MentionProviderFunctions = Omit<{
5
5
  [Key in keyof MentionProvider]: MentionProvider[Key] extends Function ? MentionProvider[Key] : never;
@@ -19,5 +19,10 @@ export default class ContextMentionResource implements MentionProvider {
19
19
  filter: (query?: string, contextIdentifier?: MentionContextIdentifier) => void;
20
20
  recordMentionSelection: (mention: MentionDescription, contextIdentifier?: MentionContextIdentifier) => void;
21
21
  shouldHighlightMention: (mention: MentionDescription) => boolean;
22
+ getMentionDisabledState: (mention: MentionDisabledStateInput) => MentionDisabledState | undefined;
23
+ subscribeToDisabledStateChanges: (listener: () => void) => (() => void);
24
+ notifyMentionDestroyed: (mention: {
25
+ id: string;
26
+ }) => void;
22
27
  isFiltering: (query: string) => boolean;
23
28
  }
@@ -1,4 +1,4 @@
1
- import { type AnalyticsCallback, type ErrorCallback, type InfoCallback, type InviteFlow, type MentionContextIdentifier, type MentionDescription, type MentionNameDetails, type MentionProvider, type MentionResourceConfig, type MentionsResult, type MentionStats, type ResourceProvider, type ResultCallback, type UserRole } from '../types';
1
+ import { type AnalyticsCallback, type ErrorCallback, type InfoCallback, type InviteFlow, type MentionContextIdentifier, type MentionDescription, type MentionDisabledState, type MentionDisabledStateInput, type MentionNameDetails, type MentionProvider, type MentionResourceConfig, type MentionsResult, type MentionStats, type ResourceProvider, type ResultCallback, type UserRole } from '../types';
2
2
  export type { MentionStats, ResultCallback, ErrorCallback, InfoCallback, MentionResourceConfig, ResourceProvider, MentionContextIdentifier, MentionProvider, } from '../types';
3
3
  /**
4
4
  * Configuration for the TeamMentionResource, which extends {@link MentionResourceConfig}
@@ -62,6 +62,7 @@ export declare class MentionResource extends AbstractMentionResource implements
62
62
  inviteXProductUser?: (userId: string, mentionName: string) => Promise<void>;
63
63
  constructor(config: MentionResourceConfig);
64
64
  shouldHighlightMention(mention: MentionDescription): boolean;
65
+ getMentionDisabledState(mention: MentionDisabledStateInput): MentionDisabledState | undefined;
65
66
  notify(searchTime: number, mentionResult: MentionsResult, query?: string): void;
66
67
  notifyError(error: Error, query?: string): void;
67
68
  filter(query?: string, contextIdentifier?: MentionContextIdentifier): Promise<void>;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ declare const AsyncDisabledMentionTooltip: React.LazyExoticComponent<({ tooltip, children }: {
3
+ children: React.ReactNode;
4
+ tooltip: string;
5
+ }) => React.JSX.Element>;
6
+ export default AsyncDisabledMentionTooltip;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ type Props = {
3
+ children: React.ReactNode;
4
+ tooltip: string;
5
+ };
6
+ /**
7
+ * Wraps a disabled `<Mention>` chip with a tooltip explaining why the chip
8
+ * is disabled. The chip itself remains non-interactive; the tooltip is the
9
+ * sole hover affordance.
10
+ */
11
+ export declare const DisabledMentionTooltip: ({ tooltip, children }: Props) => React.JSX.Element;
12
+ export {};
@@ -5,7 +5,19 @@ export declare const ANALYTICS_HOVER_DELAY = 1000;
5
5
  export declare const UNKNOWN_USER_ID = "_|unknown|_";
6
6
  export type OwnProps = {
7
7
  accessLevel?: string;
8
+ /**
9
+ * Tooltip text shown on hover when the chip is disabled. Ignored when
10
+ * `isDisabled` is false. When omitted, no tooltip is rendered even if
11
+ * `isDisabled` is true.
12
+ */
13
+ disabledTooltip?: string;
8
14
  id: string;
15
+ /**
16
+ * When true, the mention chip is rendered in its disabled visual state
17
+ * (`MentionType.DISABLED`) and click handlers are not invoked. Takes
18
+ * precedence over `isHighlighted` and the restricted state.
19
+ */
20
+ isDisabled?: boolean;
9
21
  isHighlighted?: boolean;
10
22
  localId?: string;
11
23
  onClick?: MentionEventHandler;
@@ -39,6 +39,24 @@ export interface MentionResourceConfig extends ServiceConfig {
39
39
  * calls to `filter` will be debounced to reduce the number of network requests.
40
40
  */
41
41
  debounceTime?: number;
42
+ /**
43
+ * A function to determine whether a given mention should be rendered in
44
+ * its disabled visual state (`MentionType.DISABLED`), and what tooltip
45
+ * (if any) to display when the disabled chip is hovered.
46
+ *
47
+ * Returning `{ disabled: false }` (or `undefined`) leaves the mention in
48
+ * whatever state the other predicates resolve to.
49
+ *
50
+ * The input deliberately exposes only the mention's `id` because the
51
+ * canonical caller (the editor mentions `NodeView`) does not have the
52
+ * full `MentionDescription` in scope. Implementations should look the
53
+ * additional context they need (e.g. agent metadata) up via the `id`.
54
+ *
55
+ * @param mention - The minimal mention identifier to evaluate.
56
+ * @returns `{ disabled, tooltip? }` describing the disabled visual state,
57
+ * or `undefined` to leave it unchanged.
58
+ */
59
+ getMentionDisabledState?: (mention: MentionDisabledStateInput) => MentionDisabledState | undefined;
42
60
  /**
43
61
  * Custom HTTP headers to include in mention service requests.
44
62
  */
@@ -94,6 +112,22 @@ export interface MentionResourceConfig extends ServiceConfig {
94
112
  */
95
113
  userRole?: UserRole;
96
114
  }
115
+ /**
116
+ * Describes whether a mention should be rendered in its disabled visual
117
+ * state and what tooltip (if any) should be shown on hover.
118
+ */
119
+ export interface MentionDisabledState {
120
+ disabled: boolean;
121
+ tooltip?: string;
122
+ }
123
+ /**
124
+ * The minimal input shape used by `getMentionDisabledState`. Kept as a named
125
+ * type so the config callback and the provider method share the same input
126
+ * surface, and so callers do not have to fabricate fields they do not have.
127
+ */
128
+ export interface MentionDisabledStateInput {
129
+ id: string;
130
+ }
97
131
  export interface ResourceProvider<Result> {
98
132
  /**
99
133
  * Subscribe to ResourceProvider results
@@ -119,9 +153,40 @@ export type MentionContextIdentifier = {
119
153
  };
120
154
  export interface MentionProvider extends ResourceProvider<MentionDescription[]>, InviteFromMentionProvider, XProductInviteMentionProvider {
121
155
  filter(query?: string, contextIdentifier?: MentionContextIdentifier): void;
156
+ /**
157
+ * Optional. When implemented, lets the rendering surface ask whether a
158
+ * mention should be displayed in its disabled visual state, and what
159
+ * tooltip to surface on hover. Returning `undefined` (or omitting the
160
+ * method entirely) is equivalent to "not disabled".
161
+ */
162
+ getMentionDisabledState?(mention: MentionDisabledStateInput): MentionDisabledState | undefined;
122
163
  isFiltering(query: string): boolean;
164
+ /**
165
+ * Optional. Called by the rendering surface (e.g. the editor NodeView)
166
+ * when a mention chip is destroyed (removed from the doc). This is the
167
+ * lowest-level deletion signal — it fires regardless of how the chip was
168
+ * removed (backspace, select-and-delete, programmatic replace, …) and
169
+ * does not depend on the editor's debounced `onChange` callback.
170
+ *
171
+ * Implementations typically forward the call to consumers via the chat
172
+ * layer so they can react (e.g. update `selectedAgentIds`).
173
+ */
174
+ notifyMentionDestroyed?(mention: {
175
+ id: string;
176
+ }): void;
123
177
  recordMentionSelection(mention: MentionDescription, contextIdentifier?: MentionContextIdentifier): void;
124
178
  shouldHighlightMention(mention: MentionDescription): boolean;
179
+ /**
180
+ * Optional. When implemented, lets the rendering surface subscribe to
181
+ * changes in the disabled-state predicate so already-rendered chips can
182
+ * re-evaluate themselves when the external state that drives
183
+ * `getMentionDisabledState` changes (e.g. the active agent selection in
184
+ * Rovo Chat). Implementations should invoke the listener after their
185
+ * own state changes.
186
+ *
187
+ * Returns an unsubscribe function. Callers MUST invoke it on teardown.
188
+ */
189
+ subscribeToDisabledStateChanges?(listener: () => void): () => void;
125
190
  }
126
191
  export interface HighlightDetail {
127
192
  end: number;
@@ -188,7 +253,8 @@ export interface OnMentionEvent {
188
253
  export declare enum MentionType {
189
254
  SELF = 0,
190
255
  RESTRICTED = 1,
191
- DEFAULT = 2
256
+ DEFAULT = 2,
257
+ DISABLED = 3
192
258
  }
193
259
  export declare enum UserAccessLevel {
194
260
  NONE = 0,
package/docs/0-intro.tsx CHANGED
@@ -79,6 +79,27 @@ const _default_1: any = md`
79
79
  />
80
80
  )}
81
81
 
82
+ ## Mention chip variants
83
+
84
+ The \`<Mention>\` chip has four visual variants:
85
+
86
+ - **Default** — a neutral chip rendered for any in-scope mention.
87
+ - **Self** — emphasised brand-coloured chip rendered when \`isHighlighted\`
88
+ is set, typically used to highlight a mention of the current user.
89
+ - **Restricted** — outlined chip rendered when the mention's
90
+ \`accessLevel\` indicates the referenced user does not have access; on
91
+ hover the chip surfaces a "no access" tooltip.
92
+ - **Disabled** — muted grey chip rendered when \`isDisabled\` is set.
93
+ Click handlers are suppressed, the chip exposes
94
+ \`aria-disabled="true"\`, and (with a \`disabledTooltip\` set) hover or
95
+ keyboard focus surfaces an ADS tooltip explaining why the chip is
96
+ disabled. The disabled chip remains keyboard-focusable so screen-reader
97
+ users encounter it and hear the reason.
98
+
99
+ Inside the editor, the disabled state is driven by
100
+ \`MentionProvider.getMentionDisabledState({ id })\` so rendering surfaces
101
+ don't need to thread per-chip props through ProseMirror node views.
102
+
82
103
  ${(<Props props={MentionProps} />)}
83
104
 
84
105
  `;
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "*.compiled.css"
8
8
  ],
9
- "types": "../dist/types/element.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../dist/types-ts4.5/element.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../dist/types/element.d.ts"
17
10
  }
package/item/package.json CHANGED
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "*.compiled.css"
8
8
  ],
9
- "types": "../dist/types/item.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../dist/types-ts4.5/item.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../dist/types/item.d.ts"
17
10
  }
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "*.compiled.css"
8
8
  ],
9
- "types": "../dist/types/components/Mention/index.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../dist/types-ts4.5/components/Mention/index.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../dist/types/components/Mention/index.d.ts"
17
10
  }
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "*.compiled.css"
8
8
  ],
9
- "types": "../dist/types/components/MentionItem/index.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../dist/types-ts4.5/components/MentionItem/index.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../dist/types/components/MentionItem/index.d.ts"
17
10
  }
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "*.compiled.css"
8
8
  ],
9
- "types": "../../dist/types/components/MentionItem/styles.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../../dist/types-ts4.5/components/MentionItem/styles.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../../dist/types/components/MentionItem/styles.d.ts"
17
10
  }
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "*.compiled.css"
8
8
  ],
9
- "types": "../dist/types/components/MentionList/index.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../dist/types-ts4.5/components/MentionList/index.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../dist/types/components/MentionList/index.d.ts"
17
10
  }
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "*.compiled.css"
8
8
  ],
9
- "types": "../dist/types/api/MentionNameClient.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../dist/types-ts4.5/api/MentionNameClient.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../dist/types/api/MentionNameClient.d.ts"
17
10
  }
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "*.compiled.css"
8
8
  ],
9
- "types": "../dist/types/api/MentionNameResolver.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../dist/types-ts4.5/api/MentionNameResolver.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../dist/types/api/MentionNameResolver.d.ts"
17
10
  }
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "*.compiled.css"
8
8
  ],
9
- "types": "../dist/types/components/MentionPicker/index.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../dist/types-ts4.5/components/MentionPicker/index.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../dist/types/components/MentionPicker/index.d.ts"
17
10
  }
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "*.compiled.css"
8
8
  ],
9
- "types": "../dist/types/api/MentionResource.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../dist/types-ts4.5/api/MentionResource.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../dist/types/api/MentionResource.d.ts"
17
10
  }