@atlaskit/mention 19.9.6 → 20.0.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 (110) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/api/MentionResource.js +4 -6
  3. package/dist/cjs/api/SmartMentionResource.js +2 -2
  4. package/dist/cjs/api/TeamMentionResource.js +2 -2
  5. package/dist/cjs/components/LockCircleIcon/index.js +28 -0
  6. package/dist/cjs/components/Mention/PrimitiveMention.js +118 -0
  7. package/dist/cjs/components/Mention/index.js +19 -16
  8. package/dist/cjs/components/MentionDescriptionByline/TeamMentionDescriptionByline.js +5 -5
  9. package/dist/cjs/components/MentionDescriptionByline/styles.js +4 -2
  10. package/dist/cjs/components/MentionItem/index.js +14 -8
  11. package/dist/cjs/components/MentionItem/styles.js +12 -10
  12. package/dist/cjs/components/MentionList/index.js +4 -2
  13. package/dist/cjs/components/MentionList/styles.js +5 -3
  14. package/dist/cjs/components/MentionListError/styles.js +7 -5
  15. package/dist/cjs/components/MentionPicker/index.js +12 -4
  16. package/dist/cjs/components/MentionPicker/styles.js +5 -3
  17. package/dist/cjs/components/MessagesIntlProvider/index.js +57 -0
  18. package/dist/cjs/components/NoAccessTooltip/index.js +29 -0
  19. package/dist/cjs/components/{NoAccessTooltip.js → NoAccessTooltip/main.js} +4 -2
  20. package/dist/cjs/components/ResourcedMentionList/index.js +14 -6
  21. package/dist/cjs/components/Scrollable/index.js +1 -1
  22. package/dist/cjs/components/Scrollable/styles.js +4 -2
  23. package/dist/cjs/components/TeamMentionHighlight/index.js +6 -4
  24. package/dist/cjs/components/TeamMentionHighlight/lazy.js +28 -0
  25. package/dist/cjs/components/TeamMentionHighlight/styles.js +11 -9
  26. package/dist/cjs/components/i18n.js +2 -2
  27. package/dist/cjs/shared-styles.js +4 -2
  28. package/dist/cjs/util/analytics.js +2 -2
  29. package/dist/cjs/util/i18n.js +297 -26
  30. package/dist/cjs/version.json +1 -1
  31. package/dist/es2019/components/LockCircleIcon/index.js +7 -0
  32. package/dist/es2019/components/Mention/PrimitiveMention.js +117 -0
  33. package/dist/es2019/components/Mention/index.js +16 -13
  34. package/dist/es2019/components/MentionDescriptionByline/TeamMentionDescriptionByline.js +1 -1
  35. package/dist/es2019/components/MentionDescriptionByline/styles.js +3 -4
  36. package/dist/es2019/components/MentionItem/index.js +11 -7
  37. package/dist/es2019/components/MentionItem/styles.js +6 -7
  38. package/dist/es2019/components/MentionList/index.js +3 -2
  39. package/dist/es2019/components/MentionList/styles.js +3 -4
  40. package/dist/es2019/components/MentionListError/GenericErrorIllustration.js +1 -0
  41. package/dist/es2019/components/MentionListError/styles.js +5 -6
  42. package/dist/es2019/components/MentionPicker/index.js +11 -4
  43. package/dist/es2019/components/MentionPicker/styles.js +4 -5
  44. package/dist/es2019/components/MessagesIntlProvider/index.js +38 -0
  45. package/dist/es2019/components/NoAccessTooltip/index.js +9 -0
  46. package/dist/es2019/components/{NoAccessTooltip.js → NoAccessTooltip/main.js} +4 -2
  47. package/dist/es2019/components/ResourcedMentionList/index.js +6 -4
  48. package/dist/es2019/components/Scrollable/index.js +1 -1
  49. package/dist/es2019/components/Scrollable/styles.js +3 -4
  50. package/dist/es2019/components/TeamMentionHighlight/index.js +4 -3
  51. package/dist/es2019/components/TeamMentionHighlight/lazy.js +6 -0
  52. package/dist/es2019/components/TeamMentionHighlight/styles.js +3 -2
  53. package/dist/es2019/components/i18n.js +1 -1
  54. package/dist/es2019/shared-styles.js +3 -2
  55. package/dist/es2019/util/i18n.js +260 -18
  56. package/dist/es2019/version.json +1 -1
  57. package/dist/esm/api/MentionResource.js +4 -4
  58. package/dist/esm/api/SmartMentionResource.js +2 -2
  59. package/dist/esm/api/TeamMentionResource.js +2 -2
  60. package/dist/esm/components/LockCircleIcon/index.js +11 -0
  61. package/dist/esm/components/Mention/PrimitiveMention.js +100 -0
  62. package/dist/esm/components/Mention/index.js +17 -14
  63. package/dist/esm/components/MentionDescriptionByline/TeamMentionDescriptionByline.js +1 -1
  64. package/dist/esm/components/MentionDescriptionByline/styles.js +3 -4
  65. package/dist/esm/components/MentionItem/index.js +11 -7
  66. package/dist/esm/components/MentionItem/styles.js +6 -7
  67. package/dist/esm/components/MentionList/index.js +3 -2
  68. package/dist/esm/components/MentionList/styles.js +4 -5
  69. package/dist/esm/components/MentionListError/GenericErrorIllustration.js +1 -0
  70. package/dist/esm/components/MentionListError/styles.js +3 -4
  71. package/dist/esm/components/MentionPicker/index.js +11 -4
  72. package/dist/esm/components/MentionPicker/styles.js +3 -4
  73. package/dist/esm/components/MessagesIntlProvider/index.js +41 -0
  74. package/dist/esm/components/NoAccessTooltip/index.js +11 -0
  75. package/dist/esm/components/{NoAccessTooltip.js → NoAccessTooltip/main.js} +4 -2
  76. package/dist/esm/components/ResourcedMentionList/index.js +8 -6
  77. package/dist/esm/components/Scrollable/index.js +1 -1
  78. package/dist/esm/components/Scrollable/styles.js +3 -4
  79. package/dist/esm/components/TeamMentionHighlight/index.js +4 -3
  80. package/dist/esm/components/TeamMentionHighlight/lazy.js +10 -0
  81. package/dist/esm/components/TeamMentionHighlight/styles.js +3 -2
  82. package/dist/esm/components/i18n.js +1 -1
  83. package/dist/esm/shared-styles.js +3 -2
  84. package/dist/esm/util/analytics.js +2 -2
  85. package/dist/esm/util/i18n.js +284 -23
  86. package/dist/esm/version.json +1 -1
  87. package/dist/types/components/LockCircleIcon/index.d.ts +3 -0
  88. package/dist/types/components/Mention/PrimitiveMention.d.ts +7 -0
  89. package/dist/types/components/Mention/index.d.ts +1 -1
  90. package/dist/types/components/MentionDescriptionByline/styles.d.ts +2 -2
  91. package/dist/types/components/MentionItem/MentionHighlightHelpers.d.ts +2 -3
  92. package/dist/types/components/MentionItem/styles.d.ts +9 -9
  93. package/dist/types/components/MentionList/styles.d.ts +2 -2
  94. package/dist/types/components/MentionListError/styles.d.ts +5 -5
  95. package/dist/types/components/MentionPicker/index.d.ts +11 -8
  96. package/dist/types/components/MentionPicker/styles.d.ts +3 -3
  97. package/dist/types/components/MessagesIntlProvider/index.d.ts +3 -0
  98. package/dist/types/components/NoAccessTooltip/index.d.ts +6 -0
  99. package/dist/types/components/{NoAccessTooltip.d.ts → NoAccessTooltip/main.d.ts} +0 -0
  100. package/dist/types/components/Scrollable/styles.d.ts +2 -4
  101. package/dist/types/components/TeamMentionHighlight/index.d.ts +1 -1
  102. package/dist/types/components/TeamMentionHighlight/lazy.d.ts +4 -0
  103. package/dist/types/components/TeamMentionHighlight/styles.d.ts +8 -8
  104. package/dist/types/shared-styles.d.ts +2 -2
  105. package/dist/types/util/i18n.d.ts +32 -17
  106. package/package.json +22 -11
  107. package/dist/cjs/components/Mention/styles.js +0 -66
  108. package/dist/es2019/components/Mention/styles.js +0 -61
  109. package/dist/esm/components/Mention/styles.js +0 -50
  110. package/dist/types/components/Mention/styles.d.ts +0 -6
@@ -4,6 +4,7 @@ import debug from '../../util/logger';
4
4
  import { actualMouseMove, mouseLocation } from '../../util/mouse';
5
5
  import MentionItem from '../MentionItem';
6
6
  import MentionListError from '../MentionListError';
7
+ import MessagesIntlProvider from '../MessagesIntlProvider';
7
8
  import Scrollable from '../Scrollable';
8
9
  import { MentionListStyle } from './styles';
9
10
 
@@ -257,9 +258,9 @@ export default class MentionList extends React.PureComponent {
257
258
  }, this.renderItems());
258
259
  }
259
260
 
260
- return /*#__PURE__*/React.createElement(MentionListStyle, {
261
+ return /*#__PURE__*/React.createElement(MessagesIntlProvider, null, /*#__PURE__*/React.createElement(MentionListStyle, {
261
262
  empty: !hasMentions && !resourceError
262
- }, errorSection, resultSection);
263
+ }, errorSection, resultSection));
263
264
  }
264
265
 
265
266
  }
@@ -1,13 +1,12 @@
1
- import styled from 'styled-components'; // @ts-ignore: unused variable
2
- // prettier-ignore
3
-
1
+ import styled from '@emotion/styled';
2
+ import { token } from '@atlaskit/tokens';
4
3
  import { mentionListWidth, noDialogContainerBorderColor, noDialogContainerBorderRadius, noDialogContainerBoxShadow } from '../../shared-styles';
5
4
  export const MentionListStyle = styled.div`
6
5
  display: ${props => props.empty ? 'none' : 'block'};
7
6
 
8
7
  /* list style */
9
8
  width: ${mentionListWidth};
10
- color: #333;
9
+ color: ${token('color.text.subtle', '#333')};
11
10
 
12
11
  border: 1px solid ${noDialogContainerBorderColor};
13
12
  border-radius: ${noDialogContainerBorderRadius};
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
1
2
  import React from 'react';
2
3
  import { GenericErrorVisualStyle } from './styles';
3
4
  export class GenericErrorIllustration extends React.PureComponent {
@@ -1,6 +1,5 @@
1
- import styled from 'styled-components'; // @ts-ignore: unused variable
2
- // prettier-ignore
3
-
1
+ import styled from '@emotion/styled';
2
+ import { token } from '@atlaskit/tokens';
4
3
  import { borderRadius } from '@atlaskit/theme/constants';
5
4
  import { N500 } from '@atlaskit/theme/colors';
6
5
  import { h400 } from '@atlaskit/theme/typography';
@@ -9,9 +8,9 @@ export const MentionListErrorStyle = styled.div`
9
8
  display: flex;
10
9
  justify-content: center;
11
10
  flex-direction: column;
12
- background-color: white;
13
- color: ${N500};
14
- border: 1px solid #fff;
11
+ background-color: ${token('elevation.surface.overlay', 'white')};
12
+ color: ${token('color.text.subtle', N500)};
13
+ border: 1px solid ${token('elevation.surface.overlay', '#fff')};
15
14
  border-radius: ${borderRadius()}px;
16
15
  `;
17
16
  export const GenericErrorVisualStyle = styled.div`
@@ -1,6 +1,7 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import { withAnalyticsEvents } from '@atlaskit/analytics-next';
2
+ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
3
3
  import React from 'react';
4
+ import { IntlProvider, injectIntl } from 'react-intl-next';
4
5
  import { fireAnalyticsMentionTypeaheadEvent } from '../../util/analytics';
5
6
  import uniqueId from '../../util/id';
6
7
  import debug from '../../util/logger';
@@ -162,7 +163,8 @@ export class MentionPicker extends React.PureComponent {
162
163
  zIndex,
163
164
  offsetX,
164
165
  offsetY,
165
- showTeamMentionsHighlight
166
+ showTeamMentionsHighlight,
167
+ intl
166
168
  } = this.props;
167
169
  const {
168
170
  visible,
@@ -190,7 +192,9 @@ export class MentionPicker extends React.PureComponent {
190
192
  zIndex: zIndex,
191
193
  offsetX: offsetX,
192
194
  offsetY: offsetY
193
- }, /*#__PURE__*/React.createElement("div", null, resourceMentionList, infoContent));
195
+ }, /*#__PURE__*/React.createElement(IntlProvider, {
196
+ locale: (intl === null || intl === void 0 ? void 0 : intl.locale) || 'en'
197
+ }, /*#__PURE__*/React.createElement("div", null, resourceMentionList, infoContent)));
194
198
  } else {
195
199
  // don't show if we have a position, but no target yet
196
200
  content = null;
@@ -218,5 +222,8 @@ _defineProperty(MentionPicker, "defaultProps", {
218
222
  onClose: () => {}
219
223
  });
220
224
 
221
- export const MentionPickerWithAnalytics = withAnalyticsEvents({})(MentionPicker);
225
+ const MentionPickerWithIntl = injectIntl(MentionPicker, {
226
+ forwardRef: true
227
+ });
228
+ export const MentionPickerWithAnalytics = withAnalyticsEvents({})(MentionPickerWithIntl);
222
229
  export default MentionPickerWithAnalytics;
@@ -1,14 +1,13 @@
1
- import styled from 'styled-components'; // @ts-ignore: unused variable
2
- // prettier-ignore
3
-
1
+ import styled from '@emotion/styled';
2
+ import { token } from '@atlaskit/tokens';
4
3
  import { N100 } from '@atlaskit/theme/colors';
5
4
  import { mentionListWidth, noDialogContainerBorderColor, noDialogContainerBorderRadius, noDialogContainerBoxShadow } from '../../shared-styles';
6
5
  export const MentionPickerStyle = styled.div`
7
6
  display: ${props => props.visible ? 'block' : 'none'};
8
7
  `;
9
8
  export const MentionPickerInfoStyle = styled.div`
10
- background: #fff;
11
- color: ${N100};
9
+ background: ${token('elevation.surface', '#fff')};
10
+ color: ${token('color.text.subtlest', N100)};
12
11
  border: 1px solid ${noDialogContainerBorderColor};
13
12
  border-radius: ${noDialogContainerBorderRadius};
14
13
  box-shadow: ${noDialogContainerBoxShadow};
@@ -0,0 +1,38 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import React from 'react';
3
+ import { IntlProvider, useIntl } from 'react-intl-next';
4
+ import { getMessagesForLocale } from '../../util/i18n';
5
+ const EMPTY = {};
6
+
7
+ const useI18n = locale => {
8
+ const [messages, setMessages] = React.useState(EMPTY);
9
+ React.useEffect(() => {
10
+ let aborted = false;
11
+ setMessages(EMPTY);
12
+ getMessagesForLocale(locale).then(messages => {
13
+ if (!aborted) {
14
+ setMessages(messages);
15
+ }
16
+ }).catch(error => {
17
+ // eslint-disable-next-line no-console
18
+ console.error(error);
19
+ });
20
+ return () => {
21
+ aborted = true;
22
+ };
23
+ }, [locale]);
24
+ return messages;
25
+ };
26
+
27
+ const MessagesIntlProvider = props => {
28
+ const {
29
+ children
30
+ } = props;
31
+ const intl = useIntl();
32
+ const messages = useI18n(intl.locale);
33
+ return /*#__PURE__*/React.createElement(IntlProvider, _extends({}, intl, {
34
+ messages: messages
35
+ }), children);
36
+ };
37
+
38
+ export default MessagesIntlProvider;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ const AsyncNoAccessTooltip = /*#__PURE__*/React.lazy(() => import(
3
+ /* webpackChunkName: "@atlaskit-internal_@atlaskit/mention/no-access-tooltip" */
4
+ './main').then(module => {
5
+ return {
6
+ default: module.NoAccessTooltip
7
+ };
8
+ }));
9
+ export default AsyncNoAccessTooltip;
@@ -1,11 +1,13 @@
1
1
  import Tooltip from '@atlaskit/tooltip';
2
2
  import React from 'react';
3
- import { NoAccessWarning } from '../util/i18n';
3
+ import { NoAccessWarning } from '../../util/i18n';
4
4
  export const NoAccessTooltip = ({
5
5
  name,
6
6
  children
7
7
  }) => /*#__PURE__*/React.createElement(NoAccessWarning, {
8
- name: name
8
+ values: {
9
+ name: name
10
+ }
9
11
  }, text => /*#__PURE__*/React.createElement(Tooltip, {
10
12
  content: text,
11
13
  position: "right"
@@ -1,10 +1,10 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import React from 'react';
2
+ import React, { Suspense } from 'react';
3
3
  import { withAnalyticsEvents } from '@atlaskit/analytics-next';
4
4
  import uniqueId from '../../util/id';
5
5
  import debug from '../../util/logger';
6
6
  import MentionList from '../MentionList';
7
- import TeamMentionHighlight from '../TeamMentionHighlight';
7
+ import { LazyTeamMentionHighlight } from '../TeamMentionHighlight/lazy';
8
8
  import TeamMentionHighlightController from '../TeamMentionHighlight/TeamMentionHighlightController';
9
9
  import { fireSliAnalyticsEvent, SLI_EVENT_TYPE } from '../../util/analytics';
10
10
 
@@ -143,10 +143,12 @@ export class ResourcedMentionListWithoutAnalytics extends React.PureComponent {
143
143
  return null;
144
144
  }
145
145
 
146
- return /*#__PURE__*/React.createElement(TeamMentionHighlight, {
146
+ return /*#__PURE__*/React.createElement(Suspense, {
147
+ fallback: null
148
+ }, /*#__PURE__*/React.createElement(LazyTeamMentionHighlight, {
147
149
  createTeamLink: createTeamPath,
148
150
  onClose: this.closeHighlight
149
- });
151
+ }));
150
152
  });
151
153
 
152
154
  this.subscriberKey = uniqueId('ak-resourced-mention-list');
@@ -29,7 +29,7 @@ export default class Scrollable extends React.PureComponent {
29
29
 
30
30
  render() {
31
31
  return /*#__PURE__*/React.createElement(ScrollableStyle, {
32
- innerRef: this.handleRef
32
+ ref: this.handleRef
33
33
  }, this.props.children);
34
34
  }
35
35
 
@@ -1,6 +1,5 @@
1
- import styled from 'styled-components'; // @ts-ignore: unused variable
2
- // prettier-ignore
3
-
1
+ import styled from '@emotion/styled';
2
+ import { token } from '@atlaskit/tokens';
4
3
  import { borderRadius } from '@atlaskit/theme/constants';
5
4
  import { scrollableMaxHeight } from '../../shared-styles';
6
5
  export const ScrollableStyle = styled.div`
@@ -11,7 +10,7 @@ export const ScrollableStyle = styled.div`
11
10
  padding: 4px 0;
12
11
  margin: 0;
13
12
 
14
- background: white;
13
+ background: ${token('elevation.surface', 'white')};
15
14
  max-height: ${scrollableMaxHeight};
16
15
 
17
16
  border-radius: ${borderRadius()}px;
@@ -1,6 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import React from 'react';
3
- import { withAnalyticsEvents } from '@atlaskit/analytics-next';
3
+ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
4
4
  import Button from '@atlaskit/button/custom-theme-button';
5
5
  import EditorCloseIcon from '@atlaskit/icon/glyph/editor/close';
6
6
  import Tooltip from '@atlaskit/tooltip';
@@ -8,6 +8,7 @@ import TeamMentionHighlightController from './TeamMentionHighlightController';
8
8
  import { fireAnalyticsTeamMentionHighlightEvent, ComponentNames, Actions } from '../../util/analytics';
9
9
  import { TeamMentionHighlightTitle, TeamMentionHighlightCloseTooltip, TeamMentionHighlightDescription, TeamMentionHighlightDescriptionLink } from '../../util/i18n';
10
10
  import * as Styled from './styles';
11
+ import MessagesIntlProvider from '../MessagesIntlProvider';
11
12
  const ICON_URL = 'data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjEyOCIgdmlld0JveD0iMCAwIDEyOCAxMjgiIHdpZHRoPSIxMjgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48Y2lyY2xlIGN4PSI2NCIgY3k9IjY0IiBmaWxsPSIjNTI0M2FhIiBmaWxsLXJ1bGU9Im5vbnplcm8iIHI9IjY0Ii8+PHBhdGggZD0ibTgwIDY0Yy02LjYyNzQxNyAwLTEyLTUuMzcyNTgzLTEyLTEyczUuMzcyNTgzLTEyIDEyLTEyIDEyIDUuMzcyNTgzIDEyIDEyLTUuMzcyNTgzIDEyLTEyIDEyem0tMzItMTJjLTYuNjI3NDE3IDAtMTItNS4zNzI1ODMtMTItMTJzNS4zNzI1ODMtMTIgMTItMTIgMTIgNS4zNzI1ODMgMTIgMTItNS4zNzI1ODMgMTItMTIgMTJ6bTEyIDI0YzAtNC40MiAzLjU0OC04IDgtOGgyNGM0LjQyIDAgOCAzLjU0IDggOHYxNC45MmMwIDEyLjEwOC00MCAxMi4xMDgtNDAgMHptOC0xMmgtLjAxMmMtMy4xODQzNTM3LjAwNDI0LTYuMjM2NTQxIDEuMjczNTYxNS04LjQ4NDg0MjcgMy41Mjg2MTQ5LTIuMjQ4MzAxOCAyLjI1NTA1MzQtMy41MDg0NjU2IDUuMzExMDMzLTMuNTAzMTU3MyA4LjQ5NTM4NTF2MTEuMjI4Yy0xMS43ODQgMi4xMzYtMjgtLjI1Mi0yOC03LjkzNnYtMTUuMzA0YzAtNC40MjQgMy41NDgtOC4wMTIgOC04LjAxMmgyNGMyLjEyMjcwODYtLjAwMzE5MTIgNC4xNTkzOTQ2LjgzODYzODYgNS42NjAzNzggMi4zMzk2MjJzMi4zNDI4MTMyIDMuNTM3NjY5NCAyLjMzOTYyMiA1LjY2MDM3OHoiIGZpbGw9IiNmZmYiIGZpbGwtb3BhY2l0eT0iLjk1Ii8+PC9nPjwvc3ZnPg==';
12
13
  export class TeamMentionHighlightInternal extends React.Component {
13
14
  // Wrap whole dialog so we can catch events, see preventClickOnCard
@@ -111,7 +112,7 @@ export class TeamMentionHighlightInternal extends React.Component {
111
112
  return null;
112
113
  }
113
114
 
114
- return /*#__PURE__*/React.createElement("div", {
115
+ return /*#__PURE__*/React.createElement(MessagesIntlProvider, null, /*#__PURE__*/React.createElement("div", {
115
116
  ref: this.elWrapper
116
117
  }, /*#__PURE__*/React.createElement(Styled.Card, null, /*#__PURE__*/React.createElement(Styled.Content, null, /*#__PURE__*/React.createElement(Styled.Aside, null, /*#__PURE__*/React.createElement("img", {
117
118
  src: ICON_URL,
@@ -135,7 +136,7 @@ export class TeamMentionHighlightInternal extends React.Component {
135
136
  }),
136
137
  spacing: "none" // on click fired by preventClickOnCard, not here
137
138
 
138
- }))))))));
139
+ })))))))));
139
140
  }
140
141
 
141
142
  }
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ export const LazyTeamMentionHighlight = /*#__PURE__*/React.lazy(() => import(
3
+ /* webpackChunkName: "@atlaskit-internal_@atlassian/mention/TeamMentionHighlight" */
4
+ './').then(module => ({
5
+ default: module.default
6
+ })));
@@ -1,7 +1,8 @@
1
- import styled from 'styled-components';
1
+ import styled from '@emotion/styled';
2
2
  import { gridSize } from '@atlaskit/theme/constants';
3
3
  import { P50 } from '@atlaskit/theme/colors';
4
4
  import { h400 } from '@atlaskit/theme/typography';
5
+ import { token } from '@atlaskit/tokens';
5
6
  export const Actions = styled.div`
6
7
  justify-content: flex-end;
7
8
  margin-top: -${gridSize() * 0.5}px; /* Negative margin is used to middle align x button with title*/
@@ -18,7 +19,7 @@ export const Heading = styled.div`
18
19
  export const Card = styled.div`
19
20
  display: flex;
20
21
  flex-direction: row;
21
- background-color: ${P50};
22
+ background-color: ${token('color.background.discovery', P50)};
22
23
  overflow: hidden;
23
24
  line-height: 21px;
24
25
  padding-top: ${gridSize() * 2}px;
@@ -1,4 +1,4 @@
1
- import { defineMessages } from 'react-intl';
1
+ import { defineMessages } from 'react-intl-next';
2
2
  export const messages = defineMessages({
3
3
  unknownUserError: {
4
4
  id: 'fabric.mention.unknow.user.error',
@@ -1,9 +1,10 @@
1
1
  import { borderRadius } from '@atlaskit/theme/constants';
2
2
  import { N40 } from '@atlaskit/theme/colors';
3
- export const noDialogContainerBorderColor = N40; // This has not been confirmed by the ADG yet
3
+ import { token } from '@atlaskit/tokens';
4
+ export const noDialogContainerBorderColor = token('color.border', N40); // This has not been confirmed by the ADG yet
4
5
 
5
6
  export const noDialogContainerBorderRadius = `${borderRadius()}px`;
6
- export const noDialogContainerBoxShadow = '0 4px 8px -2px rgba(9, 30, 66, 0.25), 0 0 1px rgba(9, 30, 66, 0.31)'; // Copied from droplist style
7
+ export const noDialogContainerBoxShadow = token('elevation.shadow.overlay', '0 4px 8px -2px rgba(9, 30, 66, 0.25), 0 0 1px rgba(9, 30, 66, 0.31)'); // Copied from droplist style
7
8
 
8
9
  export const scrollableMaxHeight = '264px';
9
10
  export const mentionListWidth = '340px';
@@ -1,22 +1,264 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React from 'react';
3
- import { FormattedMessage } from 'react-intl';
3
+ import { FormattedMessage, useIntl } from 'react-intl-next';
4
4
  import { messages } from '../components/i18n';
5
- export const noPropFormatter = messageDescriptor => props => /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, props, messageDescriptor));
6
- export const NoAccessWarning = ({
7
- name,
8
- ...props
9
- }) => /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, props, {
10
- values: {
11
- name
5
+ export const propFormatter = messageDescriptor => ({
6
+ values,
7
+ children
8
+ }) => {
9
+ const {
10
+ formatMessage
11
+ } = useIntl();
12
+ const message = formatMessage(messageDescriptor, values);
13
+
14
+ if (typeof children === 'function') {
15
+ return children(message);
12
16
  }
13
- }, messages.noAccessWarning));
14
- export const NoAccessLabel = noPropFormatter(messages.noAccessLabel);
15
- export const DefaultHeadline = noPropFormatter(messages.defaultHeadline);
16
- export const DefaultAdvisedAction = noPropFormatter(messages.defaultAdvisedAction);
17
- export const LoginAgain = noPropFormatter(messages.loginAgain);
18
- export const DifferentText = noPropFormatter(messages.differentText);
19
- export const TeamMentionHighlightTitle = noPropFormatter(messages.TeamMentionHighlightTitle);
20
- export const TeamMentionHighlightCloseTooltip = noPropFormatter(messages.TeamMentionHighlightCloseButtonToolTip);
21
- export const TeamMentionHighlightDescription = noPropFormatter(messages.TeamMentionHighlightDescription);
22
- export const TeamMentionHighlightDescriptionLink = noPropFormatter(messages.TeamMentionHighlightDescriptionLink);
17
+
18
+ return /*#__PURE__*/React.createElement(FormattedMessage, _extends({
19
+ values: values
20
+ }, messageDescriptor));
21
+ };
22
+ export const UnknownUserError = propFormatter(messages.unknownUserError);
23
+ export const NoAccessWarning = propFormatter(messages.noAccessWarning);
24
+ export const NoAccessLabel = propFormatter(messages.noAccessLabel);
25
+ export const DefaultHeadline = propFormatter(messages.defaultHeadline);
26
+ export const DefaultAdvisedAction = propFormatter(messages.defaultAdvisedAction);
27
+ export const LoginAgain = propFormatter(messages.loginAgain);
28
+ export const DifferentText = propFormatter(messages.differentText);
29
+ export const TeamMentionHighlightTitle = propFormatter(messages.TeamMentionHighlightTitle);
30
+ export const TeamMentionHighlightCloseTooltip = propFormatter(messages.TeamMentionHighlightCloseButtonToolTip);
31
+ export const TeamMentionHighlightDescription = propFormatter(messages.TeamMentionHighlightDescription);
32
+ export const TeamMentionHighlightDescriptionLink = propFormatter(messages.TeamMentionHighlightDescriptionLink);
33
+ /**
34
+ * Tries to get the most specific messages bundle for a given locale.
35
+ *
36
+ * Strategy:
37
+ * 1. Try to find messages with the exact string (i.e. 'fr_FR')
38
+ * 2. If that doesn't work, try to find messages for the country locale (i.e. 'fr')
39
+ * 3. If that doesn't work, return english messages as a fallback.
40
+ *
41
+ * @param locale string specifying the locale like 'en_GB', or 'fr'.
42
+ */
43
+
44
+ export const getMessagesForLocale = async locale => {
45
+ switch (locale) {
46
+ case 'cs':
47
+ {
48
+ return import(
49
+ /* webpackChunkName: "@atlaskit-internal_mention-i18n-cs" */
50
+ '../i18n/cs').then(mod => mod.default);
51
+ }
52
+
53
+ case 'da':
54
+ {
55
+ return import(
56
+ /* webpackChunkName: "@atlaskit-internal_mention-i18n-da" */
57
+ '../i18n/da').then(mod => mod.default);
58
+ }
59
+
60
+ case 'de':
61
+ {
62
+ return import(
63
+ /* webpackChunkName: "@atlaskit-internal_mention-i18n-de" */
64
+ '../i18n/de').then(mod => mod.default);
65
+ }
66
+
67
+ case 'en':
68
+ {
69
+ return import(
70
+ /* webpackChunkName: "@atlaskit-internal_mention-i18n-en" */
71
+ '../i18n/en').then(mod => mod.default);
72
+ }
73
+
74
+ case 'en_GB':
75
+ {
76
+ return import(
77
+ /* webpackChunkName: "@atlaskit-internal_mention-i18n-en_GB" */
78
+ '../i18n/en_GB').then(mod => mod.default);
79
+ }
80
+
81
+ case 'es':
82
+ {
83
+ return import(
84
+ /* webpackChunkName: "@atlaskit-internal_mention-i18n-es" */
85
+ '../i18n/es').then(mod => mod.default);
86
+ }
87
+
88
+ case 'et':
89
+ {
90
+ return import(
91
+ /* webpackChunkName: "@atlaskit-internal_mention-i18n-et" */
92
+ '../i18n/et').then(mod => mod.default);
93
+ }
94
+
95
+ case 'fi':
96
+ {
97
+ return import(
98
+ /* webpackChunkName: "@atlaskit-internal_mention-i18n-fi" */
99
+ '../i18n/fi').then(mod => mod.default);
100
+ }
101
+
102
+ case 'fr':
103
+ {
104
+ return import(
105
+ /* webpackChunkName: "@atlaskit-internal_mention-i18n-fr" */
106
+ '../i18n/fr').then(mod => mod.default);
107
+ }
108
+
109
+ case 'hu':
110
+ {
111
+ return import(
112
+ /* webpackChunkName: "@atlaskit-internal_mention-i18n-hu" */
113
+ '../i18n/hu').then(mod => mod.default);
114
+ }
115
+
116
+ case 'is':
117
+ {
118
+ return import(
119
+ /* webpackChunkName: "@atlaskit-internal_mention-i18n-is" */
120
+ '../i18n/is').then(mod => mod.default);
121
+ }
122
+
123
+ case 'it':
124
+ {
125
+ return import(
126
+ /* webpackChunkName: "@atlaskit-internal_mention-i18n-it" */
127
+ '../i18n/it').then(mod => mod.default);
128
+ }
129
+
130
+ case 'ja':
131
+ {
132
+ return import(
133
+ /* webpackChunkName: "@atlaskit-internal_mention-i18n-ja" */
134
+ '../i18n/ja').then(mod => mod.default);
135
+ }
136
+
137
+ case 'ko':
138
+ {
139
+ return import(
140
+ /* webpackChunkName: "@atlaskit-internal_mention-i18n-ko" */
141
+ '../i18n/ko').then(mod => mod.default);
142
+ }
143
+
144
+ case 'nb':
145
+ {
146
+ return import(
147
+ /* webpackChunkName: "@atlaskit-internal_mention-i18n-nb" */
148
+ '../i18n/nb').then(mod => mod.default);
149
+ }
150
+
151
+ case 'nl':
152
+ {
153
+ return import(
154
+ /* webpackChunkName: "@atlaskit-internal_mention-i18n-nl" */
155
+ '../i18n/nl').then(mod => mod.default);
156
+ }
157
+
158
+ case 'pl':
159
+ {
160
+ return import(
161
+ /* webpackChunkName: "@atlaskit-internal_mention-i18n-pl" */
162
+ '../i18n/pl').then(mod => mod.default);
163
+ }
164
+
165
+ case 'pt_BR':
166
+ case 'pt-BR':
167
+ {
168
+ return import(
169
+ /* webpackChunkName: "@atlaskit-internal_mention-i18n-pt_BR" */
170
+ '../i18n/pt_BR').then(mod => mod.default);
171
+ }
172
+
173
+ case 'pt_PT':
174
+ case 'pt-PT':
175
+ {
176
+ return import(
177
+ /* webpackChunkName: "@atlaskit-internal_mention-i18n-pt_PT" */
178
+ '../i18n/pt_PT').then(mod => mod.default);
179
+ }
180
+
181
+ case 'ro':
182
+ {
183
+ return import(
184
+ /* webpackChunkName: "@atlaskit-internal_mention-i18n-ro" */
185
+ '../i18n/ro').then(mod => mod.default);
186
+ }
187
+
188
+ case 'ru':
189
+ {
190
+ return import(
191
+ /* webpackChunkName: "@atlaskit-internal_mention-i18n-ru" */
192
+ '../i18n/ru').then(mod => mod.default);
193
+ }
194
+
195
+ case 'sk':
196
+ {
197
+ return import(
198
+ /* webpackChunkName: "@atlaskit-internal_mention-i18n-sk" */
199
+ '../i18n/sk').then(mod => mod.default);
200
+ }
201
+
202
+ case 'sv':
203
+ {
204
+ return import(
205
+ /* webpackChunkName: "@atlaskit-internal_mention-i18n-sv" */
206
+ '../i18n/sv').then(mod => mod.default);
207
+ }
208
+
209
+ case 'th':
210
+ {
211
+ return import(
212
+ /* webpackChunkName: "@atlaskit-internal_mention-i18n-th" */
213
+ '../i18n/th').then(mod => mod.default);
214
+ }
215
+
216
+ case 'tr':
217
+ {
218
+ return import(
219
+ /* webpackChunkName: "@atlaskit-internal_mention-i18n-tr" */
220
+ '../i18n/tr').then(mod => mod.default);
221
+ }
222
+
223
+ case 'uk':
224
+ {
225
+ return import(
226
+ /* webpackChunkName: "@atlaskit-internal_mention-i18n-uk" */
227
+ '../i18n/uk').then(mod => mod.default);
228
+ }
229
+
230
+ case 'vi':
231
+ {
232
+ return import(
233
+ /* webpackChunkName: "@atlaskit-internal_mention-i18n-vi" */
234
+ '../i18n/vi').then(mod => mod.default);
235
+ }
236
+
237
+ case 'zh_TW':
238
+ {
239
+ return import(
240
+ /* webpackChunkName: "@atlaskit-internal_mention-i18n-zh_TW" */
241
+ '../i18n/zh_TW').then(mod => mod.default);
242
+ }
243
+
244
+ case 'zh':
245
+ {
246
+ return import(
247
+ /* webpackChunkName: "@atlaskit-internal_mention-i18n-zh" */
248
+ '../i18n/zh').then(mod => mod.default);
249
+ }
250
+
251
+ default:
252
+ {
253
+ const fragments = locale.split(/[_-]/);
254
+
255
+ if (fragments.length === 2) {
256
+ return getMessagesForLocale(fragments[0]);
257
+ } else {
258
+ return import(
259
+ /* webpackChunkName: "@atlaskit-internal_mention-i18n-en" */
260
+ '../i18n/en').then(mod => mod.default);
261
+ }
262
+ }
263
+ }
264
+ };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/mention",
3
- "version": "19.9.6",
3
+ "version": "20.0.0",
4
4
  "sideEffects": false
5
5
  }
@@ -7,9 +7,9 @@ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
7
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
8
8
  import _createClass from "@babel/runtime/helpers/createClass";
9
9
 
10
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
10
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
11
11
 
12
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
12
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
13
13
 
14
14
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
15
15
 
@@ -588,14 +588,14 @@ export var MentionResource = /*#__PURE__*/function (_AbstractMentionResou) {
588
588
 
589
589
  return MentionResource;
590
590
  }(AbstractMentionResource);
591
- export var HttpError = function HttpError(statusCode, statusMessage) {
591
+ export var HttpError = /*#__PURE__*/_createClass(function HttpError(statusCode, statusMessage) {
592
592
  _classCallCheck(this, HttpError);
593
593
 
594
594
  this.statusCode = statusCode;
595
595
  this.message = statusMessage;
596
596
  this.name = 'HttpError';
597
597
  this.stack = new Error().stack;
598
- };
598
+ });
599
599
  export var isResolvingMentionProvider = function isResolvingMentionProvider(p) {
600
600
  return !!(p && p.supportsMentionNameResolving && p.supportsMentionNameResolving());
601
601
  };