@atlaskit/reactions 21.7.0 → 21.8.1

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 (198) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/cjs/analytics/analytics.js +21 -2
  3. package/dist/cjs/components/Counter/Counter.js +39 -31
  4. package/dist/cjs/components/Counter/index.js +8 -2
  5. package/dist/cjs/components/Counter/styles.js +4 -4
  6. package/dist/cjs/components/EmojiButton/EmojiButton.js +3 -3
  7. package/dist/cjs/components/EmojiButton/styles.js +2 -2
  8. package/dist/cjs/components/FlashAnimation/FlashAnimation.js +2 -2
  9. package/dist/cjs/components/FlashAnimation/styles.js +4 -4
  10. package/dist/cjs/components/Reaction/Reaction.js +7 -7
  11. package/dist/cjs/components/Reaction/styles.js +5 -5
  12. package/dist/cjs/components/ReactionPicker/ReactionPicker.js +22 -12
  13. package/dist/cjs/components/ReactionPicker/styles.js +4 -4
  14. package/dist/cjs/components/ReactionTooltip/ReactionTooltip.js +8 -8
  15. package/dist/cjs/components/ReactionTooltip/styles.js +4 -4
  16. package/dist/cjs/components/Reactions/Reactions.js +7 -7
  17. package/dist/cjs/components/Reactions/styles.js +3 -3
  18. package/dist/cjs/components/Selector/Selector.js +6 -6
  19. package/dist/cjs/components/Selector/styles.js +5 -5
  20. package/dist/cjs/components/ShowMore/ShowMore.js +12 -9
  21. package/dist/cjs/components/ShowMore/index.js +6 -0
  22. package/dist/cjs/components/ShowMore/styles.js +4 -4
  23. package/dist/cjs/components/Trigger/Trigger.js +10 -6
  24. package/dist/cjs/components/Trigger/styles.js +2 -2
  25. package/dist/cjs/containers/ConnectedReactionsView/ConnectedReactionsView.js +5 -7
  26. package/dist/cjs/shared/constants.js +14 -2
  27. package/dist/cjs/store/MemoryReactionsStore.js +33 -29
  28. package/dist/cjs/version.json +1 -1
  29. package/dist/es2019/analytics/analytics.js +17 -1
  30. package/dist/es2019/components/Counter/Counter.js +39 -32
  31. package/dist/es2019/components/Counter/index.js +1 -1
  32. package/dist/es2019/components/Counter/styles.js +1 -1
  33. package/dist/es2019/components/EmojiButton/EmojiButton.js +1 -1
  34. package/dist/es2019/components/EmojiButton/styles.js +1 -1
  35. package/dist/es2019/components/FlashAnimation/FlashAnimation.js +1 -1
  36. package/dist/es2019/components/FlashAnimation/styles.js +1 -1
  37. package/dist/es2019/components/Reaction/Reaction.js +1 -1
  38. package/dist/es2019/components/Reaction/styles.js +1 -1
  39. package/dist/es2019/components/ReactionPicker/ReactionPicker.js +12 -2
  40. package/dist/es2019/components/ReactionPicker/styles.js +1 -1
  41. package/dist/es2019/components/ReactionTooltip/ReactionTooltip.js +2 -2
  42. package/dist/es2019/components/ReactionTooltip/styles.js +1 -1
  43. package/dist/es2019/components/Reactions/Reactions.js +1 -1
  44. package/dist/es2019/components/Reactions/styles.js +1 -1
  45. package/dist/es2019/components/Selector/Selector.js +1 -1
  46. package/dist/es2019/components/Selector/styles.js +1 -1
  47. package/dist/es2019/components/ShowMore/ShowMore.js +4 -2
  48. package/dist/es2019/components/ShowMore/index.js +1 -1
  49. package/dist/es2019/components/ShowMore/styles.js +1 -1
  50. package/dist/es2019/components/Trigger/Trigger.js +7 -4
  51. package/dist/es2019/components/Trigger/styles.js +1 -1
  52. package/dist/es2019/containers/ConnectedReactionsView/ConnectedReactionsView.js +5 -7
  53. package/dist/es2019/shared/constants.js +10 -0
  54. package/dist/es2019/store/MemoryReactionsStore.js +32 -29
  55. package/dist/es2019/version.json +1 -1
  56. package/dist/esm/analytics/analytics.js +16 -0
  57. package/dist/esm/components/Counter/Counter.js +26 -24
  58. package/dist/esm/components/Counter/index.js +1 -1
  59. package/dist/esm/components/Counter/styles.js +1 -1
  60. package/dist/esm/components/EmojiButton/EmojiButton.js +1 -1
  61. package/dist/esm/components/EmojiButton/styles.js +1 -1
  62. package/dist/esm/components/FlashAnimation/FlashAnimation.js +1 -1
  63. package/dist/esm/components/FlashAnimation/styles.js +1 -1
  64. package/dist/esm/components/Reaction/Reaction.js +1 -1
  65. package/dist/esm/components/Reaction/styles.js +1 -1
  66. package/dist/esm/components/ReactionPicker/ReactionPicker.js +12 -2
  67. package/dist/esm/components/ReactionPicker/styles.js +1 -1
  68. package/dist/esm/components/ReactionTooltip/ReactionTooltip.js +2 -2
  69. package/dist/esm/components/ReactionTooltip/styles.js +1 -1
  70. package/dist/esm/components/Reactions/Reactions.js +1 -1
  71. package/dist/esm/components/Reactions/styles.js +1 -1
  72. package/dist/esm/components/Selector/Selector.js +1 -1
  73. package/dist/esm/components/Selector/styles.js +1 -1
  74. package/dist/esm/components/ShowMore/ShowMore.js +4 -2
  75. package/dist/esm/components/ShowMore/index.js +1 -1
  76. package/dist/esm/components/ShowMore/styles.js +1 -1
  77. package/dist/esm/components/Trigger/Trigger.js +8 -4
  78. package/dist/esm/components/Trigger/styles.js +1 -1
  79. package/dist/esm/containers/ConnectedReactionsView/ConnectedReactionsView.js +5 -7
  80. package/dist/esm/shared/constants.js +10 -0
  81. package/dist/esm/store/MemoryReactionsStore.js +32 -29
  82. package/dist/esm/version.json +1 -1
  83. package/dist/types/analytics/analytics.d.ts +6 -0
  84. package/dist/types/components/Counter/Counter.d.ts +8 -3
  85. package/dist/types/components/Counter/index.d.ts +1 -1
  86. package/dist/types/components/Counter/styles.d.ts +3 -3
  87. package/dist/types/components/EmojiButton/styles.d.ts +1 -1
  88. package/dist/types/components/FlashAnimation/styles.d.ts +3 -3
  89. package/dist/types/components/Reaction/styles.d.ts +4 -4
  90. package/dist/types/components/ReactionPicker/styles.d.ts +3 -3
  91. package/dist/types/components/ReactionTooltip/styles.d.ts +3 -3
  92. package/dist/types/components/Reactions/Reactions.d.ts +2 -1
  93. package/dist/types/components/Reactions/styles.d.ts +2 -2
  94. package/dist/types/components/Selector/styles.d.ts +4 -4
  95. package/dist/types/components/ShowMore/ShowMore.d.ts +2 -1
  96. package/dist/types/components/ShowMore/index.d.ts +1 -1
  97. package/dist/types/components/ShowMore/styles.d.ts +3 -3
  98. package/dist/types/components/Trigger/Trigger.d.ts +5 -1
  99. package/dist/types/components/Trigger/styles.d.ts +1 -1
  100. package/dist/types/containers/ConnectedReactionsView/ConnectedReactionsView.d.ts +2 -2
  101. package/dist/types/shared/constants.d.ts +8 -0
  102. package/package.json +7 -15
  103. package/dist/types-ts4.0/MockReactionsClient.d.ts +0 -23
  104. package/dist/types-ts4.0/analytics/analytics.d.ts +0 -96
  105. package/dist/types-ts4.0/analytics/constants.d.ts +0 -1
  106. package/dist/types-ts4.0/analytics/index.d.ts +0 -2
  107. package/dist/types-ts4.0/analytics/ufo.d.ts +0 -40
  108. package/dist/types-ts4.0/client/ReactionServiceClient.d.ts +0 -35
  109. package/dist/types-ts4.0/client/index.d.ts +0 -1
  110. package/dist/types-ts4.0/components/Counter/Counter.d.ts +0 -40
  111. package/dist/types-ts4.0/components/Counter/index.d.ts +0 -3
  112. package/dist/types-ts4.0/components/Counter/styles.d.ts +0 -3
  113. package/dist/types-ts4.0/components/EmojiButton/EmojiButton.d.ts +0 -22
  114. package/dist/types-ts4.0/components/EmojiButton/index.d.ts +0 -2
  115. package/dist/types-ts4.0/components/EmojiButton/styles.d.ts +0 -1
  116. package/dist/types-ts4.0/components/FlashAnimation/FlashAnimation.d.ts +0 -20
  117. package/dist/types-ts4.0/components/FlashAnimation/index.d.ts +0 -2
  118. package/dist/types-ts4.0/components/FlashAnimation/styles.d.ts +0 -5
  119. package/dist/types-ts4.0/components/Reaction/Reaction.d.ts +0 -38
  120. package/dist/types-ts4.0/components/Reaction/index.d.ts +0 -2
  121. package/dist/types-ts4.0/components/Reaction/styles.d.ts +0 -10
  122. package/dist/types-ts4.0/components/ReactionPicker/ReactionPicker.d.ts +0 -50
  123. package/dist/types-ts4.0/components/ReactionPicker/index.d.ts +0 -2
  124. package/dist/types-ts4.0/components/ReactionPicker/styles.d.ts +0 -3
  125. package/dist/types-ts4.0/components/ReactionTooltip/ReactionTooltip.d.ts +0 -22
  126. package/dist/types-ts4.0/components/ReactionTooltip/index.d.ts +0 -2
  127. package/dist/types-ts4.0/components/ReactionTooltip/styles.d.ts +0 -4
  128. package/dist/types-ts4.0/components/Reactions/Reactions.d.ts +0 -56
  129. package/dist/types-ts4.0/components/Reactions/index.d.ts +0 -2
  130. package/dist/types-ts4.0/components/Reactions/styles.d.ts +0 -2
  131. package/dist/types-ts4.0/components/Selector/Selector.d.ts +0 -34
  132. package/dist/types-ts4.0/components/Selector/index.d.ts +0 -3
  133. package/dist/types-ts4.0/components/Selector/styles.d.ts +0 -12
  134. package/dist/types-ts4.0/components/ShowMore/ShowMore.d.ts +0 -34
  135. package/dist/types-ts4.0/components/ShowMore/index.d.ts +0 -2
  136. package/dist/types-ts4.0/components/ShowMore/styles.d.ts +0 -3
  137. package/dist/types-ts4.0/components/Trigger/Trigger.d.ts +0 -31
  138. package/dist/types-ts4.0/components/Trigger/index.d.ts +0 -2
  139. package/dist/types-ts4.0/components/Trigger/styles.d.ts +0 -5
  140. package/dist/types-ts4.0/components/UfoErrorBoundary/UfoErrorBoundary.d.ts +0 -16
  141. package/dist/types-ts4.0/components/UfoErrorBoundary/index.d.ts +0 -2
  142. package/dist/types-ts4.0/components/index.d.ts +0 -8
  143. package/dist/types-ts4.0/containers/ConnectedReactionPicker/ConnectedReactionPicker.d.ts +0 -27
  144. package/dist/types-ts4.0/containers/ConnectedReactionPicker/index.d.ts +0 -2
  145. package/dist/types-ts4.0/containers/ConnectedReactionsView/ConnectedReactionsView.d.ts +0 -52
  146. package/dist/types-ts4.0/containers/ConnectedReactionsView/index.d.ts +0 -2
  147. package/dist/types-ts4.0/containers/index.d.ts +0 -2
  148. package/dist/types-ts4.0/hooks/index.d.ts +0 -1
  149. package/dist/types-ts4.0/hooks/useClickAway.d.ts +0 -9
  150. package/dist/types-ts4.0/i18n/cs.d.ts +0 -13
  151. package/dist/types-ts4.0/i18n/da.d.ts +0 -13
  152. package/dist/types-ts4.0/i18n/de.d.ts +0 -13
  153. package/dist/types-ts4.0/i18n/en.d.ts +0 -7
  154. package/dist/types-ts4.0/i18n/en_GB.d.ts +0 -7
  155. package/dist/types-ts4.0/i18n/en_ZZ.d.ts +0 -13
  156. package/dist/types-ts4.0/i18n/es.d.ts +0 -13
  157. package/dist/types-ts4.0/i18n/et.d.ts +0 -12
  158. package/dist/types-ts4.0/i18n/fi.d.ts +0 -13
  159. package/dist/types-ts4.0/i18n/fr.d.ts +0 -13
  160. package/dist/types-ts4.0/i18n/hu.d.ts +0 -13
  161. package/dist/types-ts4.0/i18n/index.d.ts +0 -35
  162. package/dist/types-ts4.0/i18n/is.d.ts +0 -6
  163. package/dist/types-ts4.0/i18n/it.d.ts +0 -13
  164. package/dist/types-ts4.0/i18n/ja.d.ts +0 -13
  165. package/dist/types-ts4.0/i18n/ko.d.ts +0 -13
  166. package/dist/types-ts4.0/i18n/languages.d.ts +0 -27
  167. package/dist/types-ts4.0/i18n/nb.d.ts +0 -13
  168. package/dist/types-ts4.0/i18n/nl.d.ts +0 -13
  169. package/dist/types-ts4.0/i18n/pl.d.ts +0 -13
  170. package/dist/types-ts4.0/i18n/pt_BR.d.ts +0 -13
  171. package/dist/types-ts4.0/i18n/pt_PT.d.ts +0 -12
  172. package/dist/types-ts4.0/i18n/ro.d.ts +0 -6
  173. package/dist/types-ts4.0/i18n/ru.d.ts +0 -13
  174. package/dist/types-ts4.0/i18n/sk.d.ts +0 -12
  175. package/dist/types-ts4.0/i18n/sv.d.ts +0 -13
  176. package/dist/types-ts4.0/i18n/th.d.ts +0 -13
  177. package/dist/types-ts4.0/i18n/tr.d.ts +0 -13
  178. package/dist/types-ts4.0/i18n/uk.d.ts +0 -13
  179. package/dist/types-ts4.0/i18n/vi.d.ts +0 -13
  180. package/dist/types-ts4.0/i18n/zh.d.ts +0 -13
  181. package/dist/types-ts4.0/i18n/zh_TW.d.ts +0 -13
  182. package/dist/types-ts4.0/index.d.ts +0 -7
  183. package/dist/types-ts4.0/shared/constants.d.ts +0 -13
  184. package/dist/types-ts4.0/shared/i18n.d.ts +0 -32
  185. package/dist/types-ts4.0/shared/index.d.ts +0 -3
  186. package/dist/types-ts4.0/shared/utils.d.ts +0 -11
  187. package/dist/types-ts4.0/store/MemoryReactionsStore.d.ts +0 -94
  188. package/dist/types-ts4.0/store/ReactionConsumer.d.ts +0 -57
  189. package/dist/types-ts4.0/store/batched.d.ts +0 -2
  190. package/dist/types-ts4.0/store/index.d.ts +0 -3
  191. package/dist/types-ts4.0/store/utils.d.ts +0 -11
  192. package/dist/types-ts4.0/types/Actions.d.ts +0 -27
  193. package/dist/types-ts4.0/types/Updater.d.ts +0 -1
  194. package/dist/types-ts4.0/types/User.d.ts +0 -10
  195. package/dist/types-ts4.0/types/client.d.ts +0 -38
  196. package/dist/types-ts4.0/types/index.d.ts +0 -7
  197. package/dist/types-ts4.0/types/reaction.d.ts +0 -100
  198. package/dist/types-ts4.0/types/store.d.ts +0 -63
@@ -1,7 +1,7 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
3
  import { useIntl } from 'react-intl-next';
4
- import { jsx } from '@emotion/core';
4
+ import { jsx } from '@emotion/react';
5
5
  import { ResourcedEmoji } from '@atlaskit/emoji';
6
6
  import { i18n, utils } from '../../shared';
7
7
  import * as styles from './styles';
@@ -1,5 +1,5 @@
1
1
  /** @jsx jsx */
2
- import { css } from '@emotion/core';
2
+ import { css } from '@emotion/react';
3
3
  export const emojiButtonStyle = css({
4
4
  outline: 'none',
5
5
  display: 'flex',
@@ -1,6 +1,6 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
- import { jsx } from '@emotion/core';
3
+ import { jsx } from '@emotion/react';
4
4
  import * as styles from './styles';
5
5
 
6
6
  /**
@@ -1,5 +1,5 @@
1
1
  /** @jsx jsx */
2
- import { css, keyframes } from '@emotion/core';
2
+ import { css, keyframes } from '@emotion/react';
3
3
  import { B75, B300 } from '@atlaskit/theme/colors';
4
4
  import { token } from '@atlaskit/tokens';
5
5
  const flashTime = 700;
@@ -1,7 +1,7 @@
1
1
  /** @jsx jsx */
2
2
  import React, { useCallback, useEffect, useRef, useState } from 'react';
3
3
  import { useIntl } from 'react-intl-next';
4
- import { jsx } from '@emotion/core';
4
+ import { jsx } from '@emotion/react';
5
5
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
6
6
  import { ResourcedEmoji } from '@atlaskit/emoji';
7
7
  import { Analytics } from '../../analytics';
@@ -1,5 +1,5 @@
1
1
  /** @jsx jsx */
2
- import { css } from '@emotion/core';
2
+ import { css } from '@emotion/react';
3
3
  import { B50, B75, B300, N20, N40, N400 } from '@atlaskit/theme/colors';
4
4
  import { token } from '@atlaskit/tokens';
5
5
  /**
@@ -1,6 +1,6 @@
1
1
  /** @jsx jsx */
2
2
  import React, { Fragment, useCallback, useEffect, useRef, useState } from 'react';
3
- import { jsx } from '@emotion/core';
3
+ import { jsx } from '@emotion/react';
4
4
  import { FormattedMessage } from 'react-intl-next';
5
5
  import { EmojiPicker } from '@atlaskit/emoji/picker';
6
6
  import { Manager, Popper, Reference } from '@atlaskit/popper';
@@ -16,6 +16,11 @@ import * as styles from './styles';
16
16
  */
17
17
 
18
18
  export const RENDER_REACTIONPICKER_TESTID = 'reactionPicker-testid';
19
+ /**
20
+ * Emoji Picker Controller Id for Accessibility Labels
21
+ */
22
+
23
+ const PICKER_CONTROL_ID = 'emoji-picker';
19
24
  const popperModifiers = [
20
25
  /**
21
26
  Removing this applyStyle modifier as it throws client errors ref:
@@ -107,7 +112,7 @@ export const ReactionPicker = /*#__PURE__*/React.memo(props => {
107
112
  UFO.PickerRender.abort({
108
113
  metadata: {
109
114
  emojiId: _id,
110
- source: 'Reaction-Picker',
115
+ source: 'ReactionPicker',
111
116
  reason: 'close dialog'
112
117
  }
113
118
  });
@@ -183,6 +188,10 @@ export const ReactionPicker = /*#__PURE__*/React.memo(props => {
183
188
  ref: popperRef
184
189
  }) => // Render a button to open the <Selector /> panel
185
190
  jsx(Trigger, {
191
+ ariaAttributes: {
192
+ 'aria-expanded': settings.isOpen,
193
+ 'aria-controls': PICKER_CONTROL_ID
194
+ },
186
195
  ref: popperRef,
187
196
  onClick: onTriggerClick,
188
197
  miniMode: miniMode,
@@ -198,6 +207,7 @@ export const ReactionPicker = /*#__PURE__*/React.memo(props => {
198
207
  }) => {
199
208
  updatePopper.current = update;
200
209
  return jsx(Fragment, null, settings.isOpen && jsx("div", {
210
+ id: PICKER_CONTROL_ID,
201
211
  style: {
202
212
  zIndex: layers.layer(),
203
213
  ...style
@@ -1,5 +1,5 @@
1
1
  /** @jsx jsx */
2
- import { css } from '@emotion/core';
2
+ import { css } from '@emotion/react';
3
3
  import { borderRadius } from '@atlaskit/theme/constants';
4
4
  import { N0, N50A, N60A } from '@atlaskit/theme/colors';
5
5
  import { token } from '@atlaskit/tokens';
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
 
3
3
  /** @jsx jsx */
4
4
  import React from 'react';
5
- import { jsx } from '@emotion/core';
5
+ import { jsx } from '@emotion/react';
6
6
  import Tooltip from '@atlaskit/tooltip';
7
7
  import { FormattedMessage } from 'react-intl-next';
8
8
  import { constants, i18n } from '../../shared';
@@ -41,6 +41,6 @@ export const ReactionTooltip = ({
41
41
  return jsx(Tooltip, {
42
42
  content: content,
43
43
  position: "bottom",
44
- "data-testid": RENDER_REACTIONTOOLTIP_TESTID
44
+ testId: RENDER_REACTIONTOOLTIP_TESTID
45
45
  }, React.Children.only(children));
46
46
  };
@@ -1,5 +1,5 @@
1
1
  /** @jsx jsx */
2
- import { css } from '@emotion/core';
2
+ import { css } from '@emotion/react';
3
3
  import { token } from '@atlaskit/tokens';
4
4
  import { N90 } from '@atlaskit/theme/colors';
5
5
  export const verticalMargin = 5;
@@ -1,6 +1,6 @@
1
1
  /** @jsx jsx */
2
2
  import React, { useCallback, useEffect, useMemo, useRef } from 'react';
3
- import { jsx } from '@emotion/core';
3
+ import { jsx } from '@emotion/react';
4
4
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
5
5
  import { FormattedMessage } from 'react-intl-next';
6
6
  import { Analytics } from '../../analytics';
@@ -1,5 +1,5 @@
1
1
  /** @jsx jsx */
2
- import { css } from '@emotion/core';
2
+ import { css } from '@emotion/react';
3
3
  export const reactionStyle = css({
4
4
  display: 'inline-block',
5
5
  // top margin of 2px to allow spacing between rows when wrapped (paired with top margin in reactionsStyle)
@@ -1,6 +1,6 @@
1
1
  /** @jsx jsx */
2
2
  import React, { useEffect, useRef, useState } from 'react';
3
- import { jsx } from '@emotion/core';
3
+ import { jsx } from '@emotion/react';
4
4
  import Tooltip from '@atlaskit/tooltip';
5
5
  import { constants } from '../../shared';
6
6
  import { EmojiButton } from '../EmojiButton';
@@ -1,5 +1,5 @@
1
1
  /** @jsx jsx */
2
- import { css, keyframes } from '@emotion/core';
2
+ import { css, keyframes } from '@emotion/react';
3
3
  export const selectorStyle = css({
4
4
  boxSizing: 'border-box',
5
5
  display: 'flex',
@@ -1,6 +1,6 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
- import { jsx } from '@emotion/core';
3
+ import { jsx } from '@emotion/react';
4
4
  import { FormattedMessage } from 'react-intl-next';
5
5
  import EditorMoreIcon from '@atlaskit/icon/glyph/editor/more';
6
6
  import Tooltip from '@atlaskit/tooltip';
@@ -11,6 +11,7 @@ import * as styles from './styles';
11
11
  */
12
12
 
13
13
  export const RENDER_SHOWMORE_TESTID = 'show-more-button';
14
+ export const RENDER_WRAPPER_TESTID = 'show-more-wrapper';
14
15
 
15
16
  /**
16
17
  * Show more custom emojis button
@@ -24,7 +25,8 @@ export const ShowMore = ({
24
25
  return jsx("div", {
25
26
  className: className.container,
26
27
  css: styles.moreEmojiContainerStyle,
27
- style: style.container
28
+ style: style.container,
29
+ "data-testid": RENDER_WRAPPER_TESTID
28
30
  }, jsx("div", {
29
31
  css: styles.separatorStyle
30
32
  }), jsx(FormattedMessage, i18n.messages.moreEmoji, message => jsx(Tooltip, {
@@ -1 +1 @@
1
- export { ShowMore, RENDER_SHOWMORE_TESTID } from './ShowMore';
1
+ export { ShowMore, RENDER_SHOWMORE_TESTID, RENDER_WRAPPER_TESTID } from './ShowMore';
@@ -1,5 +1,5 @@
1
1
  /** @jsx jsx */
2
- import { css } from '@emotion/core';
2
+ import { css } from '@emotion/react';
3
3
  import { borderRadius } from '@atlaskit/theme/constants';
4
4
  import { N30A } from '@atlaskit/theme/colors';
5
5
  import { token } from '@atlaskit/tokens';
@@ -1,6 +1,8 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+
1
3
  /** @jsx jsx */
2
4
  import React from 'react';
3
- import { jsx } from '@emotion/core';
5
+ import { jsx } from '@emotion/react';
4
6
  import Button from '@atlaskit/button/standard-button';
5
7
  import Tooltip from '@atlaskit/tooltip';
6
8
  import EmojiAddIcon from '@atlaskit/icon/glyph/emoji-add';
@@ -19,7 +21,8 @@ export const Trigger = /*#__PURE__*/React.forwardRef((props, ref) => {
19
21
  onClick,
20
22
  miniMode,
21
23
  tooltipContent,
22
- disabled = false
24
+ disabled = false,
25
+ ariaAttributes = {}
23
26
  } = props;
24
27
 
25
28
  const handleMouseDown = (e, analyticsEvent) => {
@@ -32,7 +35,7 @@ export const Trigger = /*#__PURE__*/React.forwardRef((props, ref) => {
32
35
  testId: RENDER_TOOLTIP_TRIGGER_TESTID,
33
36
  content: tooltipContent,
34
37
  position: "top"
35
- }, jsx(Button, {
38
+ }, jsx(Button, _extends({
36
39
  css: styles.triggerStyle({
37
40
  miniMode,
38
41
  disabled
@@ -46,5 +49,5 @@ export const Trigger = /*#__PURE__*/React.forwardRef((props, ref) => {
46
49
  }),
47
50
  spacing: "none",
48
51
  ref: ref
49
- }));
52
+ }, ariaAttributes)));
50
53
  });
@@ -1,5 +1,5 @@
1
1
  /** @jsx jsx */
2
- import { css } from '@emotion/core';
2
+ import { css } from '@emotion/react';
3
3
  import { token } from '@atlaskit/tokens';
4
4
  import { N70, N20, N40 } from '@atlaskit/theme/colors';
5
5
  export const DISABLED_BUTTON_COLOR = `${token('color.text.disabled', N70)} !important`;
@@ -7,7 +7,7 @@ import { ufoExperiences } from '../../store';
7
7
  import { ReactionStatus } from '../../types';
8
8
 
9
9
  /**
10
- * Export the mapper function outside the component so easier to do unit tests migration from Enzyme to React Testing Library
10
+ * Export the mapper function outside the component so easier to do unit tests
11
11
  */
12
12
  export const mapStateToPropsHelper = (containerAri, ari, state) => {
13
13
  const reactionsState = state && state.reactions[`${containerAri}|${ari}`];
@@ -41,7 +41,7 @@ export const mapStateToPropsHelper = (containerAri, ari, state) => {
41
41
  }
42
42
  };
43
43
  /**
44
- * Export the mapper function outside the component so easier to do unit tests migration from Enzyme to React Testing Library
44
+ * Export the mapper function outside the component so easier to do unit tests
45
45
  */
46
46
 
47
47
  export const mapDispatchToPropsHelper = (actions, containerAri, ari) => {
@@ -87,11 +87,9 @@ export const ConnectedReactionsView = props => {
87
87
 
88
88
  (_experienceInstance$c = experienceInstance.current) === null || _experienceInstance$c === void 0 ? void 0 : _experienceInstance$c.abort({
89
89
  metadata: {
90
- source: 'Connected-Reactions-View',
91
- data: {
92
- ari,
93
- containerAri
94
- },
90
+ source: 'ConnectedReactionsView',
91
+ ari,
92
+ containerAri,
95
93
  reason: 'unmount'
96
94
  }
97
95
  });
@@ -20,6 +20,16 @@ export const DefaultReactions = [{
20
20
  id: '1f914',
21
21
  shortName: ':thinking:'
22
22
  }];
23
+ /**
24
+ * Default label to show for the overLimitLabel prop
25
+ */
26
+
27
+ export const DEFAULT_OVER_THE_LIMIT_REACTION_LABEL = '1k+';
28
+ /**
29
+ * Default maximum value to use when the emoji received higher than top limit reactions
30
+ */
31
+
32
+ export const DEFAULT_REACTION_TOP_LIMIT = 1000;
23
33
  /**
24
34
  * ES6 Map object from default emoji reactions (with key => shortName, value => entire emoji item)
25
35
  */
@@ -6,6 +6,7 @@ import * as utils from './utils';
6
6
  import { isRealErrorFromService } from './utils';
7
7
  import { SAMPLING_RATE_REACTIONS_RENDERED_EXP } from '../analytics/constants';
8
8
  import { sampledReactionsRendered } from '../analytics/ufo';
9
+ import { extractErrorInfo } from '../analytics/analytics';
9
10
  /**
10
11
  * Set of all available UFO experiences relating to reaction element
11
12
  */
@@ -129,6 +130,13 @@ export class MemoryReactionsStore {
129
130
  const exp = ufoExperiences.add.getInstance(`${ari}|${emojiId}`); // ufo start reaction experience
130
131
 
131
132
  exp.start();
133
+ exp.addMetadata({
134
+ source: 'MemoryReactionsStore',
135
+ storeMetadata: this.metadata,
136
+ ari,
137
+ containerAri,
138
+ emojiId
139
+ });
132
140
  this.client.addReaction(containerAri, ari, emojiId, this.metadata).then(_ => {
133
141
  if (this.createAnalyticsEvent) {
134
142
  Analytics.createAndFireSafe(this.createAnalyticsEvent, Analytics.createRestSucceededEvent, 'addReaction');
@@ -142,14 +150,7 @@ export class MemoryReactionsStore {
142
150
 
143
151
  exp.failure({
144
152
  metadata: {
145
- error,
146
- source: 'Reaction-Store',
147
- data: {
148
- containerAri,
149
- ari,
150
- emojiId,
151
- metadata: this.metadata
152
- },
153
+ error: extractErrorInfo(error),
153
154
  reason: 'addReaction fetch failed'
154
155
  }
155
156
  });
@@ -168,6 +169,13 @@ export class MemoryReactionsStore {
168
169
  const exp = ufoExperiences.remove.getInstance(`${ari}|${emojiId}`); // ufo start reaction experience
169
170
 
170
171
  exp.start();
172
+ exp.addMetadata({
173
+ source: 'MemoryReactionsStore',
174
+ storeMetadata: this.metadata,
175
+ ari,
176
+ containerAri,
177
+ emojiId
178
+ });
171
179
  this.optmisticUpdate(containerAri, ari, emojiId)(utils.removeOne);
172
180
  this.client.deleteReaction(containerAri, ari, emojiId, this.metadata).then(_ => {
173
181
  // ufo add reaction success
@@ -176,14 +184,7 @@ export class MemoryReactionsStore {
176
184
  // ufo add reaction failure
177
185
  exp.failure({
178
186
  metadata: {
179
- error,
180
- source: 'Reaction-Store',
181
- data: {
182
- containerAri,
183
- ari,
184
- emojiId,
185
- metadata: this.metadata
186
- },
187
+ error: extractErrorInfo(error),
187
188
  reason: 'deleteReaction fetch failed'
188
189
  }
189
190
  });
@@ -205,6 +206,12 @@ export class MemoryReactionsStore {
205
206
  sampledExp.start({
206
207
  samplingRate: SAMPLING_RATE_REACTIONS_RENDERED_EXP
207
208
  });
209
+ sampledExp.addMetadata({
210
+ source: 'MemoryReactionsStore',
211
+ storeMetadata: this.metadata,
212
+ containerAri,
213
+ aris: arisArr.join(',')
214
+ });
208
215
  this.client.getReactions(containerAri, arisArr).then(value => {
209
216
  Object.keys(value).map(ari => {
210
217
  const reactionsState = this.getReactionsState(containerAri, ari);
@@ -225,12 +232,7 @@ export class MemoryReactionsStore {
225
232
 
226
233
  sampledExp.failure({
227
234
  metadata: {
228
- error,
229
- source: 'Reaction-Store',
230
- data: {
231
- containerAri,
232
- aris: arisArr.join(',')
233
- },
235
+ error: extractErrorInfo(error),
234
236
  reason: 'getReactions fetch failed'
235
237
  }
236
238
  });
@@ -258,6 +260,13 @@ export class MemoryReactionsStore {
258
260
  _defineProperty(this, "getDetailedReaction", (containerAri, ari, emojiId) => {
259
261
  const exp = ufoExperiences.fetchDetails.getInstance(`${ari}|${emojiId}`);
260
262
  exp.start();
263
+ exp.addMetadata({
264
+ source: 'MemoryReactionsStore',
265
+ storeMetadata: this.metadata,
266
+ ari,
267
+ containerAri,
268
+ emojiId
269
+ });
261
270
  this.client.getDetailedReaction(containerAri, ari, emojiId).then(summary => {
262
271
  // ufo get reaction details success
263
272
  exp.success();
@@ -266,13 +275,7 @@ export class MemoryReactionsStore {
266
275
  // ufo get reaction details failure
267
276
  exp.failure({
268
277
  metadata: {
269
- error,
270
- source: 'Reaction-Store',
271
- data: {
272
- containerAri,
273
- ari,
274
- emojiId
275
- },
278
+ error: extractErrorInfo(error),
276
279
  reason: 'getDetailedReaction fetch failed'
277
280
  }
278
281
  });
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/reactions",
3
- "version": "21.7.0"
3
+ "version": "21.8.1"
4
4
  }
@@ -96,4 +96,20 @@ export var createReactionClickedEvent = function createReactionClickedEvent(adde
96
96
  added: added,
97
97
  emojiId: emojiId
98
98
  });
99
+ };
100
+ /**
101
+ * Used for store failure metadata for analytics
102
+ * @param error The error could be a service error with {code, reason} or an Error
103
+ * @returns any
104
+ */
105
+
106
+ export var extractErrorInfo = function extractErrorInfo(error) {
107
+ if (error instanceof Error) {
108
+ return {
109
+ name: error.name,
110
+ message: error.message
111
+ };
112
+ }
113
+
114
+ return error;
99
115
  };
@@ -1,56 +1,57 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
- import { jsx, css } from '@emotion/core';
3
+ import { jsx, css } from '@emotion/react';
4
4
  import { SlideIn, ExitingPersistence, mediumDurationMs } from '@atlaskit/motion'; // eslint-disable-next-line @atlaskit/design-system/no-banned-imports
5
5
 
6
6
  import usePreviousValue from '@atlaskit/ds-lib/use-previous-value';
7
+ import { constants } from '../../shared';
7
8
  import * as styles from './styles';
8
9
  /**
9
- * Test id for wrapper div
10
+ * Test id for component top level div
10
11
  */
11
12
 
12
- export var RENDER_COUNTER_TESTID = 'counter-container';
13
+ export var RENDER_COMPONENT_WRAPPER = 'counter-wrapper';
13
14
  /**
14
- * Test id for container div
15
+ * Test id for wrapper div of the counter inside the slider
15
16
  */
16
17
 
17
- export var RENDER_COUNTER_WRAPPER_TESTID = 'counter-wrapper';
18
+ export var RENDER_COUNTER_TESTID = 'counter-container';
19
+ /**
20
+ * Counter label value wrapper div
21
+ */
18
22
 
23
+ export var RENDER_LABEL_TESTID = 'counter_label_wrapper';
24
+ export var getLabel = function getLabel(value, overLimitLabel, limit) {
25
+ // Check if reached limit
26
+ if (limit && value >= limit) {
27
+ return overLimitLabel || '';
28
+ } else if (value === 0) {
29
+ return '';
30
+ } else {
31
+ return value.toString();
32
+ }
33
+ };
19
34
  /**
20
35
  * Display reaction count next to the emoji button
21
36
  */
37
+
22
38
  export var Counter = function Counter(_ref) {
23
39
  var _ref$highlight = _ref.highlight,
24
40
  highlight = _ref$highlight === void 0 ? false : _ref$highlight,
25
41
  _ref$limit = _ref.limit,
26
- limit = _ref$limit === void 0 ? 1000 : _ref$limit,
42
+ limit = _ref$limit === void 0 ? constants.DEFAULT_REACTION_TOP_LIMIT : _ref$limit,
27
43
  _ref$overLimitLabel = _ref.overLimitLabel,
28
- overLimitLabel = _ref$overLimitLabel === void 0 ? '1k+' : _ref$overLimitLabel,
44
+ overLimitLabel = _ref$overLimitLabel === void 0 ? constants.DEFAULT_OVER_THE_LIMIT_REACTION_LABEL : _ref$overLimitLabel,
29
45
  className = _ref.className,
30
46
  value = _ref.value,
31
47
  _ref$animationDuratio = _ref.animationDuration,
32
48
  animationDuration = _ref$animationDuratio === void 0 ? mediumDurationMs : _ref$animationDuratio;
33
-
34
- var hasReachedLimit = function hasReachedLimit(value) {
35
- return limit && value >= limit;
36
- };
37
-
38
- var getLabel = function getLabel(value) {
39
- if (hasReachedLimit(value)) {
40
- return overLimitLabel || '';
41
- } else if (value === 0) {
42
- return '';
43
- } else {
44
- return value.toString();
45
- }
46
- };
47
-
48
49
  var previousValue = usePreviousValue(value);
49
- var label = getLabel(value);
50
+ var label = getLabel(value, overLimitLabel, limit);
50
51
  var increase = previousValue ? previousValue < value : false;
51
52
  return jsx("div", {
52
53
  className: className,
53
- "data-testid": RENDER_COUNTER_WRAPPER_TESTID,
54
+ "data-testid": RENDER_COMPONENT_WRAPPER,
54
55
  css: [styles.countStyle, {
55
56
  width: label.length * 7
56
57
  }]
@@ -67,6 +68,7 @@ export var Counter = function Counter(_ref) {
67
68
  className: motion.className,
68
69
  "data-testid": RENDER_COUNTER_TESTID
69
70
  }, jsx("div", {
71
+ "data-testid": RENDER_LABEL_TESTID,
70
72
  css: highlight && styles.highlightStyle,
71
73
  key: value
72
74
  }, label));
@@ -1,3 +1,3 @@
1
- export { Counter, RENDER_COUNTER_TESTID, RENDER_COUNTER_WRAPPER_TESTID } from './Counter';
1
+ export { Counter, RENDER_COUNTER_TESTID, RENDER_COMPONENT_WRAPPER, RENDER_LABEL_TESTID } from './Counter';
2
2
  import * as _styles from './styles';
3
3
  export { _styles as styles };
@@ -1,5 +1,5 @@
1
1
  /** @jsx jsx */
2
- import { css } from '@emotion/core';
2
+ import { css } from '@emotion/react';
3
3
  import { N90, B400 } from '@atlaskit/theme/colors';
4
4
  import { token } from '@atlaskit/tokens';
5
5
  export var countStyle = css({
@@ -1,7 +1,7 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
3
  import { useIntl } from 'react-intl-next';
4
- import { jsx } from '@emotion/core';
4
+ import { jsx } from '@emotion/react';
5
5
  import { ResourcedEmoji } from '@atlaskit/emoji';
6
6
  import { i18n, utils } from '../../shared';
7
7
  import * as styles from './styles';
@@ -1,5 +1,5 @@
1
1
  /** @jsx jsx */
2
- import { css } from '@emotion/core';
2
+ import { css } from '@emotion/react';
3
3
  export var emojiButtonStyle = css({
4
4
  outline: 'none',
5
5
  display: 'flex',
@@ -1,6 +1,6 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
- import { jsx } from '@emotion/core';
3
+ import { jsx } from '@emotion/react';
4
4
  import * as styles from './styles';
5
5
 
6
6
  /**
@@ -1,5 +1,5 @@
1
1
  /** @jsx jsx */
2
- import { css, keyframes } from '@emotion/core';
2
+ import { css, keyframes } from '@emotion/react';
3
3
  import { B75, B300 } from '@atlaskit/theme/colors';
4
4
  import { token } from '@atlaskit/tokens';
5
5
  var flashTime = 700;
@@ -5,7 +5,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
5
5
  /** @jsx jsx */
6
6
  import React, { useCallback, useEffect, useRef, useState } from 'react';
7
7
  import { useIntl } from 'react-intl-next';
8
- import { jsx } from '@emotion/core';
8
+ import { jsx } from '@emotion/react';
9
9
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
10
10
  import { ResourcedEmoji } from '@atlaskit/emoji';
11
11
  import { Analytics } from '../../analytics';
@@ -1,5 +1,5 @@
1
1
  /** @jsx jsx */
2
- import { css } from '@emotion/core';
2
+ import { css } from '@emotion/react';
3
3
  import { B50, B75, B300, N20, N40, N400 } from '@atlaskit/theme/colors';
4
4
  import { token } from '@atlaskit/tokens';
5
5
  /**