@atlaskit/reactions 21.4.0 → 21.6.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 (319) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/MockReactionsClient/package.json +7 -0
  3. package/dist/cjs/MockReactionsClient.js +276 -0
  4. package/dist/cjs/analytics/analytics.js +141 -0
  5. package/dist/cjs/analytics/index.js +4 -134
  6. package/dist/cjs/client/ReactionServiceClient.js +29 -6
  7. package/dist/cjs/components/{Counter.js → Counter/Counter.js} +32 -39
  8. package/dist/cjs/components/Counter/index.js +36 -0
  9. package/dist/cjs/components/Counter/styles.js +33 -0
  10. package/dist/cjs/components/EmojiButton/EmojiButton.js +58 -0
  11. package/dist/cjs/components/EmojiButton/index.js +19 -0
  12. package/dist/cjs/components/EmojiButton/styles.js +25 -0
  13. package/dist/cjs/components/FlashAnimation/FlashAnimation.js +42 -0
  14. package/dist/cjs/components/FlashAnimation/index.js +19 -0
  15. package/dist/cjs/components/{FlashAnimation.js → FlashAnimation/styles.js} +7 -26
  16. package/dist/cjs/components/Reaction/Reaction.js +163 -0
  17. package/dist/cjs/components/Reaction/index.js +19 -0
  18. package/dist/cjs/components/Reaction/styles.js +70 -0
  19. package/dist/cjs/components/ReactionPicker/ReactionPicker.js +272 -0
  20. package/dist/cjs/components/ReactionPicker/index.js +19 -0
  21. package/dist/cjs/components/ReactionPicker/styles.js +37 -0
  22. package/dist/cjs/components/ReactionTooltip/ReactionTooltip.js +71 -0
  23. package/dist/cjs/components/ReactionTooltip/index.js +19 -0
  24. package/dist/cjs/components/ReactionTooltip/styles.js +46 -0
  25. package/dist/cjs/components/Reactions/Reactions.js +200 -0
  26. package/dist/cjs/components/Reactions/index.js +25 -0
  27. package/dist/cjs/components/Reactions/styles.js +29 -0
  28. package/dist/cjs/components/Selector/Selector.js +132 -0
  29. package/dist/cjs/components/Selector/index.js +30 -0
  30. package/dist/cjs/components/Selector/styles.js +56 -0
  31. package/dist/cjs/components/ShowMore/ShowMore.js +71 -0
  32. package/dist/cjs/components/ShowMore/index.js +19 -0
  33. package/dist/cjs/components/ShowMore/styles.js +44 -0
  34. package/dist/cjs/components/Trigger/Trigger.js +59 -0
  35. package/dist/cjs/components/Trigger/index.js +13 -0
  36. package/dist/cjs/components/Trigger/styles.js +46 -0
  37. package/dist/cjs/components/{UfoErrorBoundary.js → UfoErrorBoundary/UfoErrorBoundary.js} +3 -0
  38. package/dist/cjs/components/UfoErrorBoundary/index.js +13 -0
  39. package/dist/cjs/containers/ConnectedReactionPicker/ConnectedReactionPicker.js +62 -0
  40. package/dist/cjs/containers/ConnectedReactionPicker/index.js +13 -0
  41. package/dist/cjs/containers/ConnectedReactionsView/ConnectedReactionsView.js +258 -0
  42. package/dist/cjs/containers/ConnectedReactionsView/index.js +13 -0
  43. package/dist/cjs/containers/index.js +23 -13
  44. package/dist/cjs/hooks/index.js +13 -0
  45. package/dist/cjs/hooks/useClickAway.js +35 -0
  46. package/dist/cjs/index.js +8 -0
  47. package/dist/cjs/shared/constants.js +44 -0
  48. package/dist/cjs/{components → shared}/i18n.js +1 -1
  49. package/dist/cjs/shared/index.js +24 -0
  50. package/dist/cjs/shared/utils.js +54 -0
  51. package/dist/cjs/store/{ReactionsStore.js → MemoryReactionsStore.js} +41 -18
  52. package/dist/cjs/store/ReactionConsumer.js +43 -15
  53. package/dist/cjs/store/index.js +8 -2
  54. package/dist/cjs/store/utils.js +4 -10
  55. package/dist/cjs/{client/ReactionClient.js → types/client.js} +0 -0
  56. package/dist/cjs/types/index.js +2 -2
  57. package/dist/cjs/types/reaction.js +43 -0
  58. package/dist/cjs/types/{DetailedReaction.js → store.js} +0 -0
  59. package/dist/cjs/version.json +1 -1
  60. package/dist/es2019/MockReactionsClient.js +126 -0
  61. package/dist/es2019/analytics/analytics.js +64 -0
  62. package/dist/es2019/analytics/index.js +3 -65
  63. package/dist/es2019/analytics/ufo.js +0 -1
  64. package/dist/es2019/client/ReactionServiceClient.js +31 -6
  65. package/dist/es2019/components/{Counter.js → Counter/Counter.js} +26 -31
  66. package/dist/es2019/components/Counter/index.js +3 -0
  67. package/dist/es2019/components/Counter/styles.js +20 -0
  68. package/dist/es2019/components/EmojiButton/EmojiButton.js +35 -0
  69. package/dist/es2019/components/EmojiButton/index.js +1 -0
  70. package/dist/es2019/components/EmojiButton/styles.js +16 -0
  71. package/dist/es2019/components/FlashAnimation/FlashAnimation.js +18 -0
  72. package/dist/es2019/components/FlashAnimation/index.js +1 -0
  73. package/dist/es2019/components/{FlashAnimation.js → FlashAnimation/styles.js} +6 -17
  74. package/dist/es2019/components/Reaction/Reaction.js +104 -0
  75. package/dist/es2019/components/Reaction/index.js +1 -0
  76. package/dist/es2019/components/Reaction/styles.js +55 -0
  77. package/dist/es2019/components/ReactionPicker/ReactionPicker.js +208 -0
  78. package/dist/es2019/components/ReactionPicker/index.js +1 -0
  79. package/dist/es2019/components/ReactionPicker/styles.js +23 -0
  80. package/dist/es2019/components/ReactionTooltip/ReactionTooltip.js +46 -0
  81. package/dist/es2019/components/ReactionTooltip/index.js +1 -0
  82. package/dist/es2019/components/ReactionTooltip/styles.js +32 -0
  83. package/dist/es2019/components/Reactions/Reactions.js +156 -0
  84. package/dist/es2019/components/Reactions/index.js +1 -0
  85. package/dist/es2019/components/Reactions/styles.js +19 -0
  86. package/dist/es2019/components/Selector/Selector.js +98 -0
  87. package/dist/es2019/components/Selector/index.js +3 -0
  88. package/dist/es2019/components/Selector/styles.js +39 -0
  89. package/dist/es2019/components/ShowMore/ShowMore.js +43 -0
  90. package/dist/es2019/components/ShowMore/index.js +1 -0
  91. package/dist/es2019/components/ShowMore/styles.js +30 -0
  92. package/dist/es2019/components/{Trigger.js → Trigger/Trigger.js} +15 -20
  93. package/dist/es2019/components/Trigger/index.js +1 -0
  94. package/dist/es2019/components/Trigger/styles.js +24 -0
  95. package/dist/es2019/components/{UfoErrorBoundary.js → UfoErrorBoundary/UfoErrorBoundary.js} +4 -0
  96. package/dist/es2019/components/UfoErrorBoundary/index.js +1 -0
  97. package/dist/es2019/containers/ConnectedReactionPicker/ConnectedReactionPicker.js +27 -0
  98. package/dist/es2019/containers/ConnectedReactionPicker/index.js +1 -0
  99. package/dist/es2019/containers/ConnectedReactionsView/ConnectedReactionsView.js +166 -0
  100. package/dist/es2019/containers/ConnectedReactionsView/index.js +1 -0
  101. package/dist/es2019/containers/index.js +2 -2
  102. package/dist/es2019/hooks/index.js +1 -0
  103. package/dist/es2019/hooks/useClickAway.js +27 -0
  104. package/dist/es2019/index.js +3 -1
  105. package/dist/es2019/shared/constants.js +32 -0
  106. package/dist/es2019/{components → shared}/i18n.js +1 -1
  107. package/dist/es2019/shared/index.js +6 -0
  108. package/dist/es2019/shared/utils.js +35 -0
  109. package/dist/es2019/store/{ReactionsStore.js → MemoryReactionsStore.js} +40 -14
  110. package/dist/es2019/store/ReactionConsumer.js +18 -12
  111. package/dist/es2019/store/index.js +1 -1
  112. package/dist/es2019/store/utils.js +8 -4
  113. package/dist/es2019/{client/ReactionClient.js → types/client.js} +0 -0
  114. package/dist/es2019/types/index.js +1 -1
  115. package/dist/es2019/types/reaction.js +34 -0
  116. package/dist/es2019/types/{DetailedReaction.js → store.js} +0 -0
  117. package/dist/es2019/version.json +1 -1
  118. package/dist/esm/MockReactionsClient.js +257 -0
  119. package/dist/esm/analytics/analytics.js +99 -0
  120. package/dist/esm/analytics/index.js +3 -99
  121. package/dist/esm/analytics/ufo.js +0 -1
  122. package/dist/esm/client/ReactionServiceClient.js +30 -6
  123. package/dist/esm/components/{Counter.js → Counter/Counter.js} +26 -31
  124. package/dist/esm/components/Counter/index.js +3 -0
  125. package/dist/esm/components/Counter/styles.js +20 -0
  126. package/dist/esm/components/EmojiButton/EmojiButton.js +35 -0
  127. package/dist/esm/components/EmojiButton/index.js +1 -0
  128. package/dist/esm/components/EmojiButton/styles.js +16 -0
  129. package/dist/esm/components/FlashAnimation/FlashAnimation.js +20 -0
  130. package/dist/esm/components/FlashAnimation/index.js +1 -0
  131. package/dist/esm/components/{FlashAnimation.js → FlashAnimation/styles.js} +6 -19
  132. package/dist/esm/components/Reaction/Reaction.js +131 -0
  133. package/dist/esm/components/Reaction/index.js +1 -0
  134. package/dist/esm/components/Reaction/styles.js +55 -0
  135. package/dist/esm/components/ReactionPicker/ReactionPicker.js +243 -0
  136. package/dist/esm/components/ReactionPicker/index.js +1 -0
  137. package/dist/esm/components/ReactionPicker/styles.js +23 -0
  138. package/dist/esm/components/ReactionTooltip/ReactionTooltip.js +46 -0
  139. package/dist/esm/components/ReactionTooltip/index.js +1 -0
  140. package/dist/esm/components/ReactionTooltip/styles.js +32 -0
  141. package/dist/esm/components/Reactions/Reactions.js +166 -0
  142. package/dist/esm/components/Reactions/index.js +1 -0
  143. package/dist/esm/components/Reactions/styles.js +19 -0
  144. package/dist/esm/components/Selector/Selector.js +107 -0
  145. package/dist/esm/components/Selector/index.js +3 -0
  146. package/dist/esm/components/Selector/styles.js +41 -0
  147. package/dist/esm/components/ShowMore/ShowMore.js +46 -0
  148. package/dist/esm/components/ShowMore/index.js +1 -0
  149. package/dist/esm/components/ShowMore/styles.js +30 -0
  150. package/dist/esm/components/{Trigger.js → Trigger/Trigger.js} +15 -20
  151. package/dist/esm/components/Trigger/index.js +1 -0
  152. package/dist/esm/components/Trigger/styles.js +31 -0
  153. package/dist/esm/components/{UfoErrorBoundary.js → UfoErrorBoundary/UfoErrorBoundary.js} +4 -0
  154. package/dist/esm/components/UfoErrorBoundary/index.js +1 -0
  155. package/dist/esm/containers/ConnectedReactionPicker/ConnectedReactionPicker.js +46 -0
  156. package/dist/esm/containers/ConnectedReactionPicker/index.js +1 -0
  157. package/dist/esm/containers/ConnectedReactionsView/ConnectedReactionsView.js +227 -0
  158. package/dist/esm/containers/ConnectedReactionsView/index.js +1 -0
  159. package/dist/esm/containers/index.js +2 -2
  160. package/dist/esm/hooks/index.js +1 -0
  161. package/dist/esm/hooks/useClickAway.js +28 -0
  162. package/dist/esm/index.js +3 -1
  163. package/dist/esm/shared/constants.js +34 -0
  164. package/dist/esm/{components → shared}/i18n.js +1 -1
  165. package/dist/esm/shared/index.js +6 -0
  166. package/dist/esm/shared/utils.js +41 -0
  167. package/dist/esm/store/{ReactionsStore.js → MemoryReactionsStore.js} +40 -17
  168. package/dist/esm/store/ReactionConsumer.js +42 -15
  169. package/dist/esm/store/index.js +1 -1
  170. package/dist/esm/store/utils.js +8 -4
  171. package/dist/{es2019/types/ReactionSource.js → esm/types/client.js} +0 -0
  172. package/dist/esm/types/index.js +1 -1
  173. package/dist/esm/types/reaction.js +34 -0
  174. package/dist/{es2019/types/ReactionSummary.js → esm/types/store.js} +0 -0
  175. package/dist/esm/version.json +1 -1
  176. package/dist/types/MockReactionsClient.d.ts +20 -0
  177. package/dist/types/analytics/analytics.d.ts +96 -0
  178. package/dist/types/analytics/index.d.ts +1 -96
  179. package/dist/types/client/ReactionServiceClient.d.ts +27 -10
  180. package/dist/types/client/index.d.ts +0 -1
  181. package/dist/types/components/Counter/Counter.d.ts +40 -0
  182. package/dist/types/components/Counter/index.d.ts +3 -0
  183. package/dist/types/components/Counter/styles.d.ts +3 -0
  184. package/dist/types/components/EmojiButton/EmojiButton.d.ts +22 -0
  185. package/dist/types/components/EmojiButton/index.d.ts +2 -0
  186. package/dist/types/components/EmojiButton/styles.d.ts +1 -0
  187. package/dist/types/components/FlashAnimation/FlashAnimation.d.ts +20 -0
  188. package/dist/types/components/FlashAnimation/index.d.ts +2 -0
  189. package/dist/types/components/FlashAnimation/styles.d.ts +3 -0
  190. package/dist/types/components/Reaction/Reaction.d.ts +38 -0
  191. package/dist/types/components/Reaction/index.d.ts +2 -0
  192. package/dist/types/components/Reaction/styles.d.ts +10 -0
  193. package/dist/types/components/ReactionPicker/ReactionPicker.d.ts +53 -0
  194. package/dist/types/components/ReactionPicker/index.d.ts +2 -0
  195. package/dist/types/components/ReactionPicker/styles.d.ts +3 -0
  196. package/dist/types/components/ReactionTooltip/ReactionTooltip.d.ts +22 -0
  197. package/dist/types/components/ReactionTooltip/index.d.ts +2 -0
  198. package/dist/types/components/ReactionTooltip/styles.d.ts +4 -0
  199. package/dist/types/components/Reactions/Reactions.d.ts +64 -0
  200. package/dist/types/components/Reactions/index.d.ts +2 -0
  201. package/dist/types/components/Reactions/styles.d.ts +2 -0
  202. package/dist/types/components/Selector/Selector.d.ts +34 -0
  203. package/dist/types/components/Selector/index.d.ts +3 -0
  204. package/dist/types/components/Selector/styles.d.ts +10 -0
  205. package/dist/types/components/ShowMore/ShowMore.d.ts +34 -0
  206. package/dist/types/components/ShowMore/index.d.ts +2 -0
  207. package/dist/types/components/ShowMore/styles.d.ts +3 -0
  208. package/dist/types/components/Trigger/Trigger.d.ts +23 -0
  209. package/dist/types/components/Trigger/index.d.ts +2 -0
  210. package/dist/types/components/Trigger/styles.d.ts +5 -0
  211. package/dist/types/components/UfoErrorBoundary/UfoErrorBoundary.d.ts +16 -0
  212. package/dist/types/components/UfoErrorBoundary/index.d.ts +2 -0
  213. package/dist/types/components/index.d.ts +4 -1
  214. package/dist/types/containers/ConnectedReactionPicker/ConnectedReactionPicker.d.ts +27 -0
  215. package/dist/types/containers/ConnectedReactionPicker/index.d.ts +2 -0
  216. package/dist/types/containers/ConnectedReactionsView/ConnectedReactionsView.d.ts +52 -0
  217. package/dist/types/containers/ConnectedReactionsView/index.d.ts +2 -0
  218. package/dist/types/containers/index.d.ts +2 -2
  219. package/dist/types/hooks/index.d.ts +1 -0
  220. package/dist/types/hooks/useClickAway.d.ts +8 -0
  221. package/dist/types/index.d.ts +2 -2
  222. package/dist/types/shared/constants.d.ts +13 -0
  223. package/dist/types/{components → shared}/i18n.d.ts +0 -0
  224. package/dist/types/shared/index.d.ts +3 -0
  225. package/dist/types/shared/utils.d.ts +11 -0
  226. package/dist/types/store/{ReactionsStore.d.ts → MemoryReactionsStore.d.ts} +23 -26
  227. package/dist/types/store/ReactionConsumer.d.ts +47 -19
  228. package/dist/types/store/index.d.ts +2 -2
  229. package/dist/types/store/utils.d.ts +3 -7
  230. package/dist/types/types/Actions.d.ts +20 -4
  231. package/dist/types/types/User.d.ts +6 -0
  232. package/dist/types/types/client.d.ts +38 -0
  233. package/dist/types/types/index.d.ts +5 -7
  234. package/dist/types/types/reaction.d.ts +82 -0
  235. package/dist/types/types/store.d.ts +63 -0
  236. package/docs/0-intro.tsx +118 -27
  237. package/docs/1-connected-reaction-picker.tsx +133 -0
  238. package/docs/2-connected-reactions-view.tsx +130 -0
  239. package/docs/3-reactions-store.tsx +71 -0
  240. package/docs/4-reaction-service-client.tsx +42 -0
  241. package/extract-react-type/ConnectedReactionPicker.ts +6 -0
  242. package/extract-react-type/ConnectedReactionsView.ts +6 -0
  243. package/extract-react-type/Reaction.ts +6 -0
  244. package/extract-react-type/Reactions.ts +6 -0
  245. package/extract-react-type/actions.ts +6 -0
  246. package/extract-react-type/reactionClient.ts +6 -0
  247. package/extract-react-type/reactionsStore.ts +6 -0
  248. package/package.json +24 -7
  249. package/dist/cjs/client/MockReactionsClient.js +0 -183
  250. package/dist/cjs/components/EmojiButton.js +0 -100
  251. package/dist/cjs/components/Reaction.js +0 -226
  252. package/dist/cjs/components/ReactionPicker.js +0 -289
  253. package/dist/cjs/components/ReactionTooltip.js +0 -82
  254. package/dist/cjs/components/Reactions.js +0 -194
  255. package/dist/cjs/components/Selector.js +0 -189
  256. package/dist/cjs/components/ShowMore.js +0 -119
  257. package/dist/cjs/components/Trigger.js +0 -58
  258. package/dist/cjs/components/utils.js +0 -28
  259. package/dist/cjs/containers/ConnectedReactionPicker.js +0 -44
  260. package/dist/cjs/containers/ConnectedReactionsView.js +0 -139
  261. package/dist/cjs/types/ReactionSource.js +0 -5
  262. package/dist/cjs/types/ReactionStatus.js +0 -15
  263. package/dist/cjs/types/ReactionSummary.js +0 -5
  264. package/dist/cjs/types/Reactions.js +0 -5
  265. package/dist/cjs/types/ReactionsState.js +0 -5
  266. package/dist/es2019/client/MockReactionsClient.js +0 -123
  267. package/dist/es2019/components/EmojiButton.js +0 -50
  268. package/dist/es2019/components/Reaction.js +0 -180
  269. package/dist/es2019/components/ReactionPicker.js +0 -239
  270. package/dist/es2019/components/ReactionTooltip.js +0 -66
  271. package/dist/es2019/components/Reactions.js +0 -150
  272. package/dist/es2019/components/Selector.js +0 -127
  273. package/dist/es2019/components/ShowMore.js +0 -71
  274. package/dist/es2019/components/utils.js +0 -13
  275. package/dist/es2019/containers/ConnectedReactionPicker.js +0 -27
  276. package/dist/es2019/containers/ConnectedReactionsView.js +0 -118
  277. package/dist/es2019/types/ReactionStatus.js +0 -8
  278. package/dist/es2019/types/Reactions.js +0 -1
  279. package/dist/es2019/types/ReactionsState.js +0 -1
  280. package/dist/esm/client/MockReactionsClient.js +0 -164
  281. package/dist/esm/client/ReactionClient.js +0 -1
  282. package/dist/esm/components/EmojiButton.js +0 -77
  283. package/dist/esm/components/Reaction.js +0 -204
  284. package/dist/esm/components/ReactionPicker.js +0 -266
  285. package/dist/esm/components/ReactionTooltip.js +0 -63
  286. package/dist/esm/components/Reactions.js +0 -180
  287. package/dist/esm/components/Selector.js +0 -160
  288. package/dist/esm/components/ShowMore.js +0 -95
  289. package/dist/esm/components/utils.js +0 -15
  290. package/dist/esm/containers/ConnectedReactionPicker.js +0 -29
  291. package/dist/esm/containers/ConnectedReactionsView.js +0 -116
  292. package/dist/esm/types/DetailedReaction.js +0 -1
  293. package/dist/esm/types/ReactionSource.js +0 -1
  294. package/dist/esm/types/ReactionStatus.js +0 -8
  295. package/dist/esm/types/ReactionSummary.js +0 -1
  296. package/dist/esm/types/Reactions.js +0 -1
  297. package/dist/esm/types/ReactionsState.js +0 -1
  298. package/dist/types/client/MockReactionsClient.d.ts +0 -28
  299. package/dist/types/client/ReactionClient.d.ts +0 -25
  300. package/dist/types/components/Counter.d.ts +0 -14
  301. package/dist/types/components/EmojiButton.d.ts +0 -12
  302. package/dist/types/components/FlashAnimation.d.ts +0 -13
  303. package/dist/types/components/Reaction.d.ts +0 -25
  304. package/dist/types/components/ReactionPicker.d.ts +0 -39
  305. package/dist/types/components/ReactionTooltip.d.ts +0 -9
  306. package/dist/types/components/Reactions.d.ts +0 -49
  307. package/dist/types/components/Selector.d.ts +0 -27
  308. package/dist/types/components/ShowMore.d.ts +0 -21
  309. package/dist/types/components/Trigger.d.ts +0 -7
  310. package/dist/types/components/UfoErrorBoundary.d.ts +0 -9
  311. package/dist/types/components/utils.d.ts +0 -4
  312. package/dist/types/containers/ConnectedReactionPicker.d.ts +0 -10
  313. package/dist/types/containers/ConnectedReactionsView.d.ts +0 -19
  314. package/dist/types/types/DetailedReaction.d.ts +0 -7
  315. package/dist/types/types/ReactionSource.d.ts +0 -1
  316. package/dist/types/types/ReactionStatus.d.ts +0 -6
  317. package/dist/types/types/ReactionSummary.d.ts +0 -10
  318. package/dist/types/types/Reactions.d.ts +0 -4
  319. package/dist/types/types/ReactionsState.d.ts +0 -17
@@ -7,6 +7,10 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.ReactionConsumer = void 0;
9
9
 
10
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
+
12
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
+
10
14
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
15
 
12
16
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
@@ -27,6 +31,10 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
27
31
 
28
32
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
29
33
 
34
+ /**
35
+ * A custom mapper class that takes the store instance and mapper functions "mapStateToProps" and "mapActionsToProps" to return the renderProps pattern as a child component
36
+ * @deprecated please avoid using this class as it will be removed in a future release
37
+ */
30
38
  var ReactionConsumer = /*#__PURE__*/function (_React$PureComponent) {
31
39
  (0, _inherits2.default)(ReactionConsumer, _React$PureComponent);
32
40
 
@@ -38,11 +46,11 @@ var ReactionConsumer = /*#__PURE__*/function (_React$PureComponent) {
38
46
  (0, _classCallCheck2.default)(this, ReactionConsumer);
39
47
  _this = _super.call(this, props);
40
48
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getPropsFromActions", function (actions) {
41
- var actionsMapper = _this.props.actionsMapper;
49
+ var mapActionsToProps = _this.props.mapActionsToProps;
42
50
 
43
- if (actionsMapper) {
51
+ if (mapActionsToProps) {
44
52
  if (!_this.previousActions || !_this.propsFromActions || _this.previousActions !== actions) {
45
- _this.propsFromActions = actionsMapper(actions);
53
+ _this.propsFromActions = mapActionsToProps(actions);
46
54
  }
47
55
  }
48
56
 
@@ -50,18 +58,15 @@ var ReactionConsumer = /*#__PURE__*/function (_React$PureComponent) {
50
58
  return _this.propsFromActions;
51
59
  });
52
60
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getPropsFromState", function (state) {
53
- var stateMapper = _this.props.stateMapper;
54
-
55
- if (stateMapper) {
56
- return stateMapper(state);
57
- }
58
-
59
- return undefined;
61
+ var mapStateToProps = _this.props.mapStateToProps;
62
+ return mapStateToProps ? mapStateToProps(state) : undefined;
60
63
  });
61
64
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleOnChange", function () {
62
65
  _this.forceUpdate();
63
66
  });
64
- _this.state = {};
67
+ _this.state = {
68
+ store: undefined
69
+ };
65
70
  return _this;
66
71
  }
67
72
 
@@ -80,11 +85,34 @@ var ReactionConsumer = /*#__PURE__*/function (_React$PureComponent) {
80
85
  }
81
86
  }, {
82
87
  key: "componentWillUnmount",
83
- value: function componentWillUnmount() {
84
- if (this.state.store) {
85
- this.state.store.removeOnChangeListener(this.handleOnChange);
88
+ value: function () {
89
+ var _componentWillUnmount = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
90
+ return _regenerator.default.wrap(function _callee$(_context) {
91
+ while (1) {
92
+ switch (_context.prev = _context.next) {
93
+ case 0:
94
+ if (this.state.store) {
95
+ this.state.store.removeOnChangeListener(this.handleOnChange);
96
+ }
97
+
98
+ case 1:
99
+ case "end":
100
+ return _context.stop();
101
+ }
102
+ }
103
+ }, _callee, this);
104
+ }));
105
+
106
+ function componentWillUnmount() {
107
+ return _componentWillUnmount.apply(this, arguments);
86
108
  }
87
- }
109
+
110
+ return componentWillUnmount;
111
+ }()
112
+ /**
113
+ * Get the actions the child component might need to dispatch from its props
114
+ */
115
+
88
116
  }, {
89
117
  key: "render",
90
118
  value: function render() {
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  Object.defineProperty(exports, "MemoryReactionsStore", {
7
7
  enumerable: true,
8
8
  get: function get() {
9
- return _ReactionsStore.MemoryReactionsStore;
9
+ return _MemoryReactionsStore.MemoryReactionsStore;
10
10
  }
11
11
  });
12
12
  Object.defineProperty(exports, "ReactionConsumer", {
@@ -15,7 +15,13 @@ Object.defineProperty(exports, "ReactionConsumer", {
15
15
  return _ReactionConsumer.ReactionConsumer;
16
16
  }
17
17
  });
18
+ Object.defineProperty(exports, "ufoExperiences", {
19
+ enumerable: true,
20
+ get: function get() {
21
+ return _MemoryReactionsStore.ufoExperiences;
22
+ }
23
+ });
18
24
 
19
25
  var _ReactionConsumer = require("./ReactionConsumer");
20
26
 
21
- var _ReactionsStore = require("./ReactionsStore");
27
+ var _MemoryReactionsStore = require("./MemoryReactionsStore");
@@ -5,13 +5,13 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.getReactionsSortFunction = exports.flattenAris = exports.compareEmojiId = exports.byEmojiId = exports.addOne = void 0;
8
+ exports.getReactionsSortFunction = exports.flattenAris = exports.byEmojiId = exports.addOne = void 0;
9
9
  exports.isRealErrorFromService = isRealErrorFromService;
10
- exports.updateByEmojiId = exports.sortByRelevance = exports.sortByPreviousPosition = exports.removeOne = exports.readyState = void 0;
10
+ exports.updateByEmojiId = exports.removeOne = exports.readyState = void 0;
11
11
 
12
12
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
13
 
14
- var _ReactionStatus = require("../types/ReactionStatus");
14
+ var _types = require("../types");
15
15
 
16
16
  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; }
17
17
 
@@ -21,8 +21,6 @@ var compareEmojiId = function compareEmojiId(l, r) {
21
21
  return l.localeCompare(r);
22
22
  };
23
23
 
24
- exports.compareEmojiId = compareEmojiId;
25
-
26
24
  var sortByRelevance = function sortByRelevance(a, b) {
27
25
  if (a.count > b.count) {
28
26
  return -1;
@@ -33,8 +31,6 @@ var sortByRelevance = function sortByRelevance(a, b) {
33
31
  }
34
32
  };
35
33
 
36
- exports.sortByRelevance = sortByRelevance;
37
-
38
34
  var sortByPreviousPosition = function sortByPreviousPosition(reactions) {
39
35
  var indexes = reactions.reduce(function (map, reaction, index) {
40
36
  map[reaction.emojiId] = index;
@@ -51,11 +47,9 @@ var sortByPreviousPosition = function sortByPreviousPosition(reactions) {
51
47
  };
52
48
  };
53
49
 
54
- exports.sortByPreviousPosition = sortByPreviousPosition;
55
-
56
50
  var readyState = function readyState(reactions) {
57
51
  return {
58
- status: _ReactionStatus.ReactionStatus.ready,
52
+ status: _types.ReactionStatus.ready,
59
53
  reactions: reactions.filter(function (reaction) {
60
54
  return reaction.count > 0;
61
55
  })
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
6
6
  Object.defineProperty(exports, "ReactionStatus", {
7
7
  enumerable: true,
8
8
  get: function get() {
9
- return _ReactionStatus.ReactionStatus;
9
+ return _reaction.ReactionStatus;
10
10
  }
11
11
  });
12
12
 
13
- var _ReactionStatus = require("./ReactionStatus");
13
+ var _reaction = require("./reaction");
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ReactionStatus = void 0;
7
+
8
+ /**
9
+ * Collection of reactions as object (key is unique id from containerAri and ari combined)
10
+ */
11
+
12
+ /**
13
+ * MetaData for Reaction object
14
+ */
15
+
16
+ /**
17
+ * Event handler for when the user clicks on the reaction
18
+ * @param id give id for the emoji
19
+ * @param event selected mouse event proerties
20
+ */
21
+
22
+ /**
23
+ * Event handler for when the user hovers with the mouse on the reaction
24
+ * @param reaction reaction object
25
+ * @param event (Optional) custom DOM event handler callback
26
+ */
27
+
28
+ /**
29
+ * Condition of the reaction when gets loaded from the store
30
+ */
31
+ var ReactionStatus;
32
+ /**
33
+ * state in which the reaction is at
34
+ */
35
+
36
+ exports.ReactionStatus = ReactionStatus;
37
+
38
+ (function (ReactionStatus) {
39
+ ReactionStatus["ready"] = "READY";
40
+ ReactionStatus["loading"] = "LOADING";
41
+ ReactionStatus["error"] = "ERROR";
42
+ ReactionStatus["notLoaded"] = "NOT_LOADED";
43
+ })(ReactionStatus || (exports.ReactionStatus = ReactionStatus = {}));
File without changes
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/reactions",
3
- "version": "21.4.0"
3
+ "version": "21.6.0"
4
4
  }
@@ -0,0 +1,126 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import { constants } from './shared';
3
+ export const containerAri = 'ari:cloud:owner:demo-cloud-id:container/1';
4
+ export const ari = 'ari:cloud:owner:demo-cloud-id:item/1';
5
+ export const getReactionSummary = (shortName, count, reacted) => {
6
+ return {
7
+ ari,
8
+ containerAri,
9
+ emojiId: constants.DefaultReactionsByShortName.get(shortName).id,
10
+ count,
11
+ reacted
12
+ };
13
+ };
14
+ export const getUser = (id, displayName) => ({
15
+ id,
16
+ displayName
17
+ });
18
+
19
+ const getReactionKey = (containerAri, ari) => {
20
+ return `${containerAri}|${ari}`;
21
+ };
22
+
23
+ const defaultUsers = [getUser('oscar', 'Oscar Wallhult'), getUser('julien', 'Julien Michel Hoarau'), getUser('craig', 'Craig Petchell'), getUser('jerome', 'Jerome Touffe-Blin'), getUser('esoares', 'Eduardo Soares'), getUser('lpereira', 'Luiz Pereira'), getUser('pcurren', 'Paul Curren'), getUser('ttjandra', 'Tara Tjandra'), getUser('severington', 'Ste Everington'), getUser('sguillope', 'Sylvain Guillope'), getUser('alunnon', 'Alex Lunnon')];
24
+ const mockData = {
25
+ [getReactionKey(containerAri, ari)]: [getReactionSummary(':fire:', 1, true), getReactionSummary(':thumbsup:', 999, false), getReactionSummary(':astonished:', 9, false), getReactionSummary(':heart:', 99, false)]
26
+ };
27
+ /**
28
+ * Mocked version of the client to fetch user information
29
+ */
30
+
31
+ export class MockReactionsClient {
32
+ constructor(delay = 0) {
33
+ _defineProperty(this, "delayPromise", () => new Promise(resolve => window.setTimeout(resolve, this.delay)));
34
+
35
+ this.delay = delay;
36
+ }
37
+
38
+ async getReactions(containerAri, aris) {
39
+ await this.delayPromise();
40
+ return aris.reduce((results, ari) => {
41
+ const reactionKey = getReactionKey(containerAri, ari);
42
+ results[ari] = mockData[reactionKey] || [];
43
+ return results;
44
+ }, {});
45
+ }
46
+
47
+ async getDetailedReaction(containerAri, ari, emojiId) {
48
+ await this.delayPromise();
49
+ const reactionKey = `${containerAri}|${ari}`;
50
+ const reactionsMockData = mockData[reactionKey];
51
+
52
+ if (reactionsMockData) {
53
+ const reaction = reactionsMockData.find(reaction_1 => reaction_1.emojiId === emojiId);
54
+
55
+ if (reaction) {
56
+ const users = [...defaultUsers].slice(Math.floor(Math.random() * 4), Math.floor(Math.random() * 9) + 4).slice(0, reaction.count);
57
+ return { ...reaction,
58
+ users
59
+ };
60
+ }
61
+ }
62
+
63
+ return {
64
+ containerAri,
65
+ ari,
66
+ emojiId,
67
+ count: 1,
68
+ reacted: true,
69
+ users: []
70
+ };
71
+ }
72
+
73
+ async addReaction(containerAri, ari, emojiId) {
74
+ await this.delayPromise();
75
+ const reactionKey = getReactionKey(containerAri, ari);
76
+ let found = false;
77
+ const reactionsMockData = mockData[reactionKey];
78
+
79
+ if (reactionsMockData) {
80
+ mockData[reactionKey] = reactionsMockData.map(reaction => {
81
+ if (reaction.emojiId === emojiId) {
82
+ found = true;
83
+ return { ...reaction,
84
+ count: reaction.count + 1,
85
+ reacted: true
86
+ };
87
+ }
88
+
89
+ return reaction;
90
+ });
91
+ }
92
+
93
+ if (!found) {
94
+ mockData[reactionKey] = [...(reactionsMockData ? reactionsMockData : []), {
95
+ containerAri,
96
+ ari,
97
+ emojiId,
98
+ count: 1,
99
+ reacted: true
100
+ }];
101
+ }
102
+
103
+ return mockData[reactionKey];
104
+ }
105
+
106
+ async deleteReaction(containerAri, ari, emojiId) {
107
+ await this.delayPromise();
108
+ const reactionKey = getReactionKey(containerAri, ari);
109
+ mockData[reactionKey] = mockData[reactionKey].map(reaction => {
110
+ if (reaction.emojiId === emojiId) {
111
+ if (reaction.count === 1) {
112
+ return undefined;
113
+ }
114
+
115
+ return { ...reaction,
116
+ count: reaction.count - 1,
117
+ reacted: false
118
+ };
119
+ }
120
+
121
+ return reaction;
122
+ }).filter(reaction_1 => !!reaction_1);
123
+ return mockData[reactionKey];
124
+ }
125
+
126
+ }
@@ -0,0 +1,64 @@
1
+ import { createAndFireEvent } from '@atlaskit/analytics-next';
2
+ import { UI_EVENT_TYPE, OPERATIONAL_EVENT_TYPE } from '@atlaskit/analytics-gas-types';
3
+ import { name as packageName, version as packageVersion } from '../version.json';
4
+ export const createAndFireEventInElementsChannel = createAndFireEvent('fabric-elements');
5
+ export const createAndFireSafe = (createAnalyticsEvent, creator, ...args) => {
6
+ if (createAnalyticsEvent) {
7
+ createAndFireEventInElementsChannel(creator(...args))(createAnalyticsEvent);
8
+ }
9
+ };
10
+
11
+ const createPayload = (action, actionSubject, eventType, actionSubjectId) => (attributes = {}) => ({
12
+ action,
13
+ actionSubject,
14
+ eventType,
15
+ actionSubjectId,
16
+ attributes: { ...attributes,
17
+ packageName,
18
+ packageVersion
19
+ }
20
+ });
21
+
22
+ const calculateDuration = startTime => startTime ? Date.now() - startTime : undefined;
23
+
24
+ const getPreviousState = reaction => {
25
+ if (reaction) {
26
+ if (reaction.reacted) {
27
+ return 'existingReacted';
28
+ }
29
+
30
+ return 'existingNotReacted';
31
+ }
32
+
33
+ return 'new';
34
+ };
35
+
36
+ export const createRestSucceededEvent = actionSubject => createPayload('succeeded', actionSubject, OPERATIONAL_EVENT_TYPE)();
37
+ export const createRestFailedEvent = (actionSubject, errorCode) => createPayload('failed', actionSubject, OPERATIONAL_EVENT_TYPE)({
38
+ errorCode
39
+ });
40
+ export const createReactionsRenderedEvent = startTime => createPayload('rendered', 'reactionView', OPERATIONAL_EVENT_TYPE)({
41
+ duration: calculateDuration(startTime)
42
+ });
43
+ export const createPickerButtonClickedEvent = reactionEmojiCount => createPayload('clicked', 'reactionPickerButton', UI_EVENT_TYPE)({
44
+ reactionEmojiCount
45
+ });
46
+ export const createPickerCancelledEvent = startTime => createPayload('cancelled', 'reactionPicker', UI_EVENT_TYPE)({
47
+ duration: calculateDuration(startTime)
48
+ });
49
+ export const createPickerMoreClickedEvent = startTime => createPayload('clicked', 'reactionPicker', UI_EVENT_TYPE, 'more')({
50
+ duration: calculateDuration(startTime)
51
+ });
52
+ export const createReactionSelectionEvent = (source, emojiId, reaction, startTime) => createPayload('clicked', 'reactionPicker', UI_EVENT_TYPE, 'emoji')({
53
+ duration: calculateDuration(startTime),
54
+ source,
55
+ previousState: getPreviousState(reaction),
56
+ emojiId
57
+ });
58
+ export const createReactionHoveredEvent = startTime => createPayload('hovered', 'existingReaction', UI_EVENT_TYPE)({
59
+ duration: calculateDuration(startTime)
60
+ });
61
+ export const createReactionClickedEvent = (added, emojiId) => createPayload('clicked', 'existingReaction', UI_EVENT_TYPE)({
62
+ added,
63
+ emojiId
64
+ });
@@ -1,66 +1,4 @@
1
- import { createAndFireEvent } from '@atlaskit/analytics-next';
2
- import { UI_EVENT_TYPE, OPERATIONAL_EVENT_TYPE } from '@atlaskit/analytics-gas-types';
3
- import { name as packageName, version as packageVersion } from '../version.json';
1
+ import * as _Analytics from './analytics';
2
+ export { _Analytics as Analytics };
4
3
  import * as _UFO from './ufo';
5
- export { _UFO as UFO };
6
- export const createAndFireEventInElementsChannel = createAndFireEvent('fabric-elements');
7
- export const createAndFireSafe = (createAnalyticsEvent, creator, ...args) => {
8
- if (createAnalyticsEvent) {
9
- createAndFireEventInElementsChannel(creator(...args))(createAnalyticsEvent);
10
- }
11
- };
12
-
13
- const createPayload = (action, actionSubject, eventType, actionSubjectId) => attributes => ({
14
- action,
15
- actionSubject,
16
- eventType,
17
- actionSubjectId,
18
- attributes: { ...attributes,
19
- packageName,
20
- packageVersion
21
- }
22
- });
23
-
24
- const calculateDuration = startTime => startTime ? Date.now() - startTime : undefined;
25
-
26
- const getPreviousState = reaction => {
27
- if (reaction) {
28
- if (reaction.reacted) {
29
- return 'existingReacted';
30
- }
31
-
32
- return 'existingNotReacted';
33
- }
34
-
35
- return 'new';
36
- };
37
-
38
- export const createRestSucceededEvent = actionSubject => createPayload('succeeded', actionSubject, OPERATIONAL_EVENT_TYPE)({});
39
- export const createRestFailedEvent = (actionSubject, errorCode) => createPayload('failed', actionSubject, OPERATIONAL_EVENT_TYPE)({
40
- errorCode
41
- });
42
- export const createReactionsRenderedEvent = startTime => createPayload('rendered', 'reactionView', OPERATIONAL_EVENT_TYPE)({
43
- duration: calculateDuration(startTime)
44
- });
45
- export const createPickerButtonClickedEvent = reactionEmojiCount => createPayload('clicked', 'reactionPickerButton', UI_EVENT_TYPE)({
46
- reactionEmojiCount
47
- });
48
- export const createPickerCancelledEvent = startTime => createPayload('cancelled', 'reactionPicker', UI_EVENT_TYPE)({
49
- duration: calculateDuration(startTime)
50
- });
51
- export const createPickerMoreClickedEvent = startTime => createPayload('clicked', 'reactionPicker', UI_EVENT_TYPE, 'more')({
52
- duration: calculateDuration(startTime)
53
- });
54
- export const createReactionSelectionEvent = (source, emojiId, reaction, startTime) => createPayload('clicked', 'reactionPicker', UI_EVENT_TYPE, 'emoji')({
55
- duration: calculateDuration(startTime),
56
- source,
57
- previousState: getPreviousState(reaction),
58
- emojiId
59
- });
60
- export const createReactionHoveredEvent = startTime => createPayload('hovered', 'existingReaction', UI_EVENT_TYPE)({
61
- duration: calculateDuration(startTime)
62
- });
63
- export const createReactionClickedEvent = (added, emojiId) => createPayload('clicked', 'existingReaction', UI_EVENT_TYPE)({
64
- added,
65
- emojiId
66
- });
4
+ export { _UFO as UFO };
@@ -2,7 +2,6 @@ import { ConcurrentExperience, UFOExperience, ExperiencePerformanceTypes, Experi
2
2
  import { withSampling } from '@atlaskit/emoji';
3
3
  /**
4
4
  * Initial experience config object (deferred from @atlaskit/ufo inner types)
5
- * TODO: Check if possible to add this to exported types from @atlaskit/ufo
6
5
  */
7
6
 
8
7
  /**
@@ -1,6 +1,23 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import { utils } from '@atlaskit/util-service-support';
3
+
4
+ /**
5
+ * Utility class to retrieve/modify all actions on reactions collection
6
+ */
3
7
  export class ReactionServiceClient {
8
+ /**
9
+ * oAuth token
10
+ */
11
+
12
+ /**
13
+ * API config
14
+ */
15
+
16
+ /**
17
+ *
18
+ * @param baseUrl base domain url
19
+ * @param sessionToken oAuth token for reactions emoji services
20
+ */
4
21
  constructor(baseUrl, sessionToken) {
5
22
  _defineProperty(this, "requestService", (path, options) => utils.requestService(this.serviceConfig, { ...options,
6
23
  path
@@ -11,14 +28,16 @@ export class ReactionServiceClient {
11
28
  };
12
29
  this.sessionToken = sessionToken;
13
30
  }
31
+ /**
32
+ * Get http headers for the "fetch" request
33
+ * @param hasBody
34
+ */
35
+
14
36
 
15
- getHeaders(hasBody = true) {
37
+ getHeaders() {
16
38
  const headers = {};
17
39
  headers['Accept'] = 'application/json';
18
-
19
- if (hasBody) {
20
- headers['Content-Type'] = 'application/json';
21
- }
40
+ headers['Content-Type'] = 'application/json';
22
41
 
23
42
  if (this.sessionToken) {
24
43
  headers['Authorization'] = this.sessionToken;
@@ -26,6 +45,12 @@ export class ReactionServiceClient {
26
45
 
27
46
  return headers;
28
47
  }
48
+ /**
49
+ * Send a request to remote service
50
+ * @param path endpoint api url
51
+ * @param options Optional custom params
52
+ */
53
+
29
54
 
30
55
  getReactions(containerAri, aris) {
31
56
  if (aris.length === 0) {
@@ -46,7 +71,7 @@ export class ReactionServiceClient {
46
71
 
47
72
  getDetailedReaction(containerAri, ari, emojiId) {
48
73
  const reactionId = `${containerAri}|${ari}|${emojiId}`;
49
- const headers = this.getHeaders(false);
74
+ const headers = this.getHeaders();
50
75
  return this.requestService('reactions', {
51
76
  queryParams: {
52
77
  reactionId: reactionId
@@ -1,33 +1,28 @@
1
1
  /** @jsx jsx */
2
+ import React from 'react';
2
3
  import { jsx, css } from '@emotion/core';
3
- import { N500, B400 } from '@atlaskit/theme/colors';
4
- import { token } from '@atlaskit/tokens';
5
- import React, { memo } from 'react';
6
4
  import { SlideIn, ExitingPersistence, mediumDurationMs } from '@atlaskit/motion'; // eslint-disable-next-line @atlaskit/design-system/no-banned-imports
7
5
 
8
6
  import usePreviousValue from '@atlaskit/ds-lib/use-previous-value';
9
- export const counterTestId = 'counter-container';
10
- export const countStyle = css({
11
- fontSize: 11,
12
- // TODO: nice to have a theme level token for fontSize
13
- color: token('color.text.subtlest', N500),
14
- overflow: 'hidden',
15
- position: 'relative',
16
- padding: '4px 8px 4px 0',
17
- lineHeight: '14px'
18
- });
19
- export const highlightStyle = css({
20
- color: token('color.text.selected', B400),
21
- fontWeight: 600
22
- });
23
- export const containerStyle = css({
24
- display: 'flex',
25
- flexDirection: 'column'
26
- });
27
- export const Counter = /*#__PURE__*/memo(({
7
+ import * as styles from './styles';
8
+ /**
9
+ * Test id for wrapper div
10
+ */
11
+
12
+ export const RENDER_COUNTER_TESTID = 'counter-container';
13
+ /**
14
+ * Test id for container div
15
+ */
16
+
17
+ export const RENDER_COUNTER_WRAPPER_TESTID = 'counter-wrapper';
18
+
19
+ /**
20
+ * Display reaction count next to the emoji button
21
+ */
22
+ export const Counter = ({
28
23
  highlight = false,
29
- limit = 100,
30
- overLimitLabel = '99+',
24
+ limit = 1000,
25
+ overLimitLabel = '1k+',
31
26
  className,
32
27
  value,
33
28
  animationDuration = mediumDurationMs
@@ -49,23 +44,23 @@ export const Counter = /*#__PURE__*/memo(({
49
44
  const increase = previousValue ? previousValue < value : false;
50
45
  return jsx("div", {
51
46
  className: className,
52
- css: countStyle,
53
- style: {
47
+ "data-testid": RENDER_COUNTER_WRAPPER_TESTID,
48
+ css: [styles.countStyle, {
54
49
  width: label.length * 7
55
- }
50
+ }]
56
51
  }, jsx(ExitingPersistence, null, jsx(SlideIn, {
57
52
  enterFrom: increase ? 'bottom' : 'top',
58
53
  key: value,
59
54
  duration: animationDuration
60
55
  }, (motion, direction) => jsx("div", {
61
56
  ref: motion.ref,
62
- css: [containerStyle, css({
57
+ css: [styles.containerStyle, css({
63
58
  position: direction === 'exiting' ? 'absolute' : undefined
64
59
  })],
65
60
  className: motion.className,
66
- "data-testid": counterTestId
61
+ "data-testid": RENDER_COUNTER_TESTID
67
62
  }, jsx("div", {
68
- css: highlight && highlightStyle,
63
+ css: highlight && styles.highlightStyle,
69
64
  key: value
70
65
  }, label)))));
71
- });
66
+ };
@@ -0,0 +1,3 @@
1
+ export { Counter, RENDER_COUNTER_TESTID, RENDER_COUNTER_WRAPPER_TESTID } from './Counter';
2
+ import * as _styles from './styles';
3
+ export { _styles as styles };