@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
@@ -1,150 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
-
3
- /** @jsx jsx */
4
- import { jsx, css } from '@emotion/core';
5
- import { withAnalyticsEvents } from '@atlaskit/analytics-next';
6
- import Tooltip from '@atlaskit/tooltip';
7
- import React from 'react';
8
- import { FormattedMessage } from 'react-intl-next';
9
- import { createAndFireSafe, createPickerButtonClickedEvent, createPickerCancelledEvent, createPickerMoreClickedEvent, createReactionSelectionEvent, createReactionsRenderedEvent } from '../analytics';
10
- import { ReactionStatus } from '../types/ReactionStatus';
11
- import { messages } from './i18n';
12
- import { Reaction } from './Reaction';
13
- import { ReactionPicker } from './ReactionPicker';
14
- const reactionStyle = css({
15
- display: 'inline-block',
16
- // top margin of 2px to allow spacing between rows when wrapped (paired with top margin in reactionsStyle)
17
- margin: '2px 4px 0 4px'
18
- });
19
- const wrapperStyle = css({
20
- display: 'flex',
21
- flexWrap: 'wrap',
22
- position: 'relative',
23
- alignItems: 'center',
24
- borderRadius: '15px',
25
- // To allow to row spacing of 2px on wrap, and 0px on first row
26
- marginTop: '-2px',
27
- '> :first-of-type > :first-child': {
28
- marginLeft: 0
29
- }
30
- });
31
- export class ReactionsWithoutAnalytics extends React.PureComponent {
32
- constructor(props) {
33
- super(props);
34
-
35
- _defineProperty(this, "componentDidUpdate", () => {
36
- if (this.props.status === ReactionStatus.ready && this.renderTime) {
37
- createAndFireSafe(this.props.createAnalyticsEvent, createReactionsRenderedEvent, this.renderTime);
38
- this.renderTime = undefined;
39
- }
40
- });
41
-
42
- _defineProperty(this, "isDisabled", () => this.props.status !== ReactionStatus.ready);
43
-
44
- _defineProperty(this, "getTooltip", () => {
45
- const {
46
- status,
47
- errorMessage
48
- } = this.props;
49
-
50
- switch (status) {
51
- case ReactionStatus.error:
52
- return errorMessage ? errorMessage : jsx(FormattedMessage, messages.unexpectedError);
53
-
54
- case ReactionStatus.loading:
55
- case ReactionStatus.notLoaded:
56
- return jsx(FormattedMessage, messages.loadingReactions);
57
-
58
- default:
59
- return undefined;
60
- }
61
- });
62
-
63
- _defineProperty(this, "handleReactionMouseEnter", reaction => {
64
- if (this.props.onReactionHover) {
65
- this.props.onReactionHover(reaction.emojiId);
66
- }
67
- });
68
-
69
- _defineProperty(this, "handlePickerOpen", () => {
70
- this.openTime = Date.now();
71
- createAndFireSafe(this.props.createAnalyticsEvent, createPickerButtonClickedEvent, this.props.reactions.length);
72
- });
73
-
74
- _defineProperty(this, "handleOnCancel", () => {
75
- createAndFireSafe(this.props.createAnalyticsEvent, createPickerCancelledEvent, this.openTime);
76
- this.openTime = undefined;
77
- });
78
-
79
- _defineProperty(this, "handleOnMore", () => {
80
- createAndFireSafe(this.props.createAnalyticsEvent, createPickerMoreClickedEvent, this.openTime);
81
- });
82
-
83
- _defineProperty(this, "handleOnSelection", (emojiId, source) => {
84
- createAndFireSafe(this.props.createAnalyticsEvent, createReactionSelectionEvent, source, emojiId, this.props.reactions.find(reaction => reaction.emojiId === emojiId), this.openTime);
85
- this.openTime = undefined;
86
-
87
- if (this.props.onSelection) {
88
- this.props.onSelection(emojiId);
89
- }
90
- });
91
-
92
- _defineProperty(this, "renderReaction", reaction => jsx(Reaction, {
93
- key: reaction.emojiId,
94
- css: reactionStyle,
95
- reaction: reaction,
96
- emojiProvider: this.props.emojiProvider,
97
- onClick: this.props.onReactionClick,
98
- onMouseEnter: this.handleReactionMouseEnter,
99
- flash: this.props.flash[reaction.emojiId]
100
- }));
101
-
102
- if (props.status !== ReactionStatus.ready) {
103
- this.renderTime = Date.now();
104
- }
105
- }
106
-
107
- componentDidMount() {
108
- if (this.props.status === ReactionStatus.notLoaded) {
109
- this.props.loadReaction();
110
- }
111
- }
112
-
113
- renderPicker() {
114
- const {
115
- emojiProvider,
116
- boundariesElement,
117
- allowAllEmojis
118
- } = this.props;
119
- return jsx(Tooltip, {
120
- content: this.getTooltip()
121
- }, jsx(ReactionPicker, {
122
- css: reactionStyle,
123
- emojiProvider: emojiProvider,
124
- miniMode: true,
125
- boundariesElement: boundariesElement,
126
- allowAllEmojis: allowAllEmojis,
127
- disabled: this.isDisabled(),
128
- onSelection: this.handleOnSelection,
129
- onOpen: this.handlePickerOpen,
130
- onCancel: this.handleOnCancel,
131
- onMore: this.handleOnMore
132
- }));
133
- }
134
-
135
- render() {
136
- return jsx("div", {
137
- css: wrapperStyle
138
- }, this.props.reactions.map(this.renderReaction), this.renderPicker());
139
- }
140
-
141
- }
142
-
143
- _defineProperty(ReactionsWithoutAnalytics, "defaultProps", {
144
- flash: {},
145
- reactions: []
146
- });
147
-
148
- _defineProperty(ReactionsWithoutAnalytics, "displayName", 'Reactions');
149
-
150
- export const Reactions = withAnalyticsEvents()(ReactionsWithoutAnalytics);
@@ -1,127 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
-
3
- /** @jsx jsx */
4
- import { jsx, css, keyframes } from '@emotion/core';
5
- import Tooltip from '@atlaskit/tooltip';
6
- import React from 'react';
7
- import { PureComponent } from 'react';
8
- import { EmojiButton } from './EmojiButton';
9
- import { ShowMore } from './ShowMore';
10
- import { equalEmojiId } from './utils';
11
- export const renderEmojiTestId = 'render-emoji';
12
- const selectorStyle = css({
13
- boxSizing: 'border-box',
14
- display: 'flex',
15
- padding: 0
16
- });
17
- const emojiStyle = css({
18
- display: 'inline-block',
19
- opacity: 0,
20
- '&.selected': {
21
- transition: 'transform 200ms ease-in-out ',
22
- transform: 'translateY(-48px) scale(2.667)'
23
- }
24
- });
25
- const revealAnimation = keyframes({
26
- '0%': {
27
- opacity: 1,
28
- transform: 'scale(0.5)'
29
- },
30
- '75%': {
31
- transform: 'scale(1.25)'
32
- },
33
- '100%': {
34
- opacity: 1,
35
- transform: 'scale(1)'
36
- }
37
- });
38
- export const revealStyle = css({
39
- animation: `${revealAnimation} 150ms ease-in-out forwards`
40
- });
41
-
42
- const revealDelay = index => ({
43
- animationDelay: `${index * 50}ms`
44
- });
45
-
46
- export const defaultReactions = [{
47
- id: '1f44d',
48
- shortName: ':thumbsup:'
49
- }, {
50
- id: '1f44f',
51
- shortName: ':clap:'
52
- }, {
53
- id: '1f525',
54
- shortName: ':fire:'
55
- }, {
56
- id: '2764',
57
- shortName: ':heart:'
58
- }, {
59
- id: '1f632',
60
- shortName: ':astonished:'
61
- }, {
62
- id: '1f914',
63
- shortName: ':thinking:'
64
- }];
65
- export const defaultReactionsByShortName = new Map(defaultReactions.map(reaction => [reaction.shortName, reaction]));
66
- export const isDefaultReaction = emojiId => defaultReactions.filter(otherEmojiId => equalEmojiId(otherEmojiId, emojiId)).length > 0;
67
- export class Selector extends PureComponent {
68
- constructor(props) {
69
- super(props);
70
-
71
- _defineProperty(this, "onEmojiSelected", (emojiId, emoji, event) => {
72
- this.timeouts.push(window.setTimeout(() => this.props.onSelection(emojiId, emoji, event), 250));
73
- this.setState({
74
- selection: emojiId
75
- });
76
- });
77
-
78
- _defineProperty(this, "renderEmoji", (emojiId, index) => {
79
- const {
80
- emojiProvider
81
- } = this.props;
82
- const key = emojiId.id || emojiId.shortName;
83
- const style = revealDelay(index);
84
- return jsx("div", {
85
- key: key,
86
- className: emojiId === this.state.selection ? 'selected' : '',
87
- css: [emojiStyle, revealStyle],
88
- style: style,
89
- "data-testid": renderEmojiTestId
90
- }, jsx(Tooltip, {
91
- content: emojiId.shortName
92
- }, jsx(EmojiButton, {
93
- emojiId: emojiId,
94
- emojiProvider: emojiProvider,
95
- onClick: this.onEmojiSelected
96
- })));
97
- });
98
-
99
- _defineProperty(this, "renderShowMore", () => jsx(ShowMore, {
100
- key: "more",
101
- revealStyle: revealStyle,
102
- style: {
103
- button: revealDelay(defaultReactions.length)
104
- },
105
- onClick: this.props.onMoreClick
106
- }));
107
-
108
- this.timeouts = [];
109
- this.state = {
110
- selection: undefined
111
- };
112
- }
113
-
114
- componentWillUnmount() {
115
- this.timeouts.forEach(clearTimeout);
116
- }
117
-
118
- render() {
119
- const {
120
- showMore
121
- } = this.props;
122
- return jsx("div", {
123
- css: selectorStyle
124
- }, defaultReactions.map(this.renderEmoji), showMore ? this.renderShowMore() : null);
125
- }
126
-
127
- }
@@ -1,71 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
-
3
- /** @jsx jsx */
4
- import { jsx, css } from '@emotion/core';
5
- import EditorMoreIcon from '@atlaskit/icon/glyph/editor/more';
6
- import { borderRadius } from '@atlaskit/theme/constants';
7
- import { N30A } from '@atlaskit/theme/colors';
8
- import { token } from '@atlaskit/tokens';
9
- import Tooltip from '@atlaskit/tooltip';
10
- import React from 'react';
11
- import { messages } from './i18n';
12
- import { FormattedMessage } from 'react-intl-next';
13
- import { revealStyle } from './Selector';
14
- const moreEmojiContainerStyle = css({
15
- display: 'flex'
16
- });
17
- const moreButtonStyle = css({
18
- opacity: 0,
19
- outline: 'none',
20
- backgroundColor: 'transparent',
21
- border: 0,
22
- borderRadius: `${borderRadius()}px`,
23
- cursor: 'pointer',
24
- margin: '4px 4px 4px 0',
25
- padding: '4px',
26
- width: '38px',
27
- verticalAlign: 'top',
28
- '&:hover': {
29
- backgroundColor: token('color.background.neutral.subtle.hovered', N30A)
30
- }
31
- });
32
- const separatorStyle = css({
33
- backgroundColor: token('color.border', N30A),
34
- margin: '8px 8px 8px 4px',
35
- width: '1px',
36
- height: '60%',
37
- display: 'inline-block'
38
- });
39
- export const showMoreTestId = 'show-more-button';
40
- export class ShowMore extends React.PureComponent {
41
- render() {
42
- const {
43
- style,
44
- onClick,
45
- className: classNameProp
46
- } = this.props;
47
- return jsx("div", {
48
- className: classNameProp.container,
49
- css: moreEmojiContainerStyle,
50
- style: style.container
51
- }, jsx("div", {
52
- css: separatorStyle
53
- }), jsx(FormattedMessage, messages.moreEmoji, text => jsx(Tooltip, {
54
- content: text
55
- }, jsx("button", {
56
- className: classNameProp.button,
57
- css: [moreButtonStyle, revealStyle],
58
- style: style.button,
59
- onMouseDown: onClick,
60
- "data-testid": showMoreTestId
61
- }, jsx(EditorMoreIcon, {
62
- label: "More"
63
- })))));
64
- }
65
-
66
- }
67
-
68
- _defineProperty(ShowMore, "defaultProps", {
69
- className: {},
70
- style: {}
71
- });
@@ -1,13 +0,0 @@
1
- export const akHeight = 24;
2
- export const isLeftClick = event => event.button === 0 && !event.altKey && !event.ctrlKey && !event.metaKey && !event.shiftKey;
3
- export const equalEmojiId = (l, r) => {
4
- if (isEmojiId(l) && isEmojiId(r)) {
5
- return l === r || l && r && l.id === r.id && l.shortName === r.shortName;
6
- } else {
7
- return l === r;
8
- }
9
- };
10
-
11
- const isEmojiId = emojiId => {
12
- return emojiId.id !== undefined;
13
- };
@@ -1,27 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import React from 'react';
3
- import { ReactionPicker, UfoErrorBoundary } from '../components';
4
- import { ReactionConsumer } from '../store/ReactionConsumer';
5
- import { UFO } from '../analytics';
6
-
7
- /**
8
- * UFO Instance for picker
9
- */
10
- export const ConnectedReactionPicker = props => {
11
- const renderChild = innerProps => {
12
- return /*#__PURE__*/React.createElement(ReactionPicker, _extends({}, props, innerProps));
13
- };
14
-
15
- const actionsMapper = actions => ({
16
- onSelection: emojiId => {
17
- actions.addReaction(props.containerAri, props.ari, emojiId);
18
- }
19
- });
20
-
21
- return /*#__PURE__*/React.createElement(UfoErrorBoundary, {
22
- experiences: [UFO.PickerRender]
23
- }, /*#__PURE__*/React.createElement(ReactionConsumer, {
24
- store: props.store,
25
- actionsMapper: actionsMapper
26
- }, renderChild));
27
- };
@@ -1,118 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import React, { useEffect, useRef } from 'react';
3
- import { FabricElementsAnalyticsContext } from '@atlaskit/analytics-namespaced-context';
4
- import { withAnalyticsEvents } from '@atlaskit/analytics-next';
5
- import { Reactions, UfoErrorBoundary } from '../components';
6
- import { ReactionConsumer } from '../store/ReactionConsumer';
7
- import { ReactionStatus } from '../types/ReactionStatus';
8
- import { ufoExperiences } from '../store/ReactionsStore';
9
-
10
- const ReactionsView = props => {
11
- // // compose a UFO experience object
12
- let experienceInstance = useRef();
13
- const {
14
- ari,
15
- createAnalyticsEvent,
16
- store,
17
- containerAri
18
- } = props;
19
- useEffect(() => {
20
- experienceInstance.current = ufoExperiences.render(ari);
21
- }, [ari]);
22
- useEffect(() => {
23
- Promise.resolve(store).then(_store => {
24
- if (_store.setCreateAnalyticsEvent && createAnalyticsEvent) {
25
- _store.setCreateAnalyticsEvent(createAnalyticsEvent);
26
- }
27
- });
28
- }, [createAnalyticsEvent, store]); // abort when component gets unmounted
29
-
30
- useEffect(() => {
31
- return function cleanup() {
32
- var _experienceInstance$c;
33
-
34
- (_experienceInstance$c = experienceInstance.current) === null || _experienceInstance$c === void 0 ? void 0 : _experienceInstance$c.abort({
35
- metadata: {
36
- source: 'Connected-Reactions-View',
37
- data: {
38
- ari,
39
- containerAri
40
- },
41
- reason: 'unmount'
42
- }
43
- });
44
- };
45
- }, [experienceInstance, containerAri, ari]);
46
-
47
- const renderChildren = innerProps => {
48
- return /*#__PURE__*/React.createElement(FabricElementsAnalyticsContext, {
49
- data: {
50
- containerAri,
51
- ari
52
- }
53
- }, /*#__PURE__*/React.createElement(Reactions, _extends({
54
- key: `${props.containerAri}|${props.ari}`
55
- }, props, innerProps)));
56
- };
57
-
58
- const stateMapper = state => {
59
- const {
60
- containerAri,
61
- ari
62
- } = props;
63
- const reactionsState = state && state.reactions[`${containerAri}|${ari}`];
64
-
65
- if (!state || !reactionsState) {
66
- return {
67
- status: ReactionStatus.notLoaded,
68
- reactions: []
69
- };
70
- }
71
-
72
- switch (reactionsState.status) {
73
- case ReactionStatus.ready:
74
- return {
75
- reactions: reactionsState.reactions,
76
- status: reactionsState.status,
77
- flash: state.flash[`${containerAri}|${ari}`]
78
- };
79
-
80
- case ReactionStatus.error:
81
- return {
82
- status: ReactionStatus.error,
83
- reactions: []
84
- };
85
-
86
- default:
87
- return {
88
- status: ReactionStatus.loading,
89
- reactions: []
90
- };
91
- }
92
- };
93
-
94
- const actionsMapper = actions => ({
95
- loadReaction: () => {
96
- actions.getReactions(props.containerAri, props.ari);
97
- },
98
- onReactionClick: emojiId => {
99
- actions.toggleReaction(props.containerAri, props.ari, emojiId);
100
- },
101
- onReactionHover: emojiId => {
102
- actions.getDetailedReaction(props.containerAri, props.ari, emojiId);
103
- },
104
- onSelection: emojiId => {
105
- actions.addReaction(props.containerAri, props.ari, emojiId);
106
- }
107
- });
108
-
109
- return /*#__PURE__*/React.createElement(UfoErrorBoundary, {
110
- experiences: experienceInstance.current ? [experienceInstance.current] : []
111
- }, /*#__PURE__*/React.createElement(ReactionConsumer, {
112
- store: props.store,
113
- actionsMapper: actionsMapper,
114
- stateMapper: stateMapper
115
- }, renderChildren));
116
- };
117
-
118
- export const ConnectedReactionsView = withAnalyticsEvents()(ReactionsView);
@@ -1,8 +0,0 @@
1
- export let ReactionStatus;
2
-
3
- (function (ReactionStatus) {
4
- ReactionStatus["ready"] = "READY";
5
- ReactionStatus["loading"] = "LOADING";
6
- ReactionStatus["error"] = "ERROR";
7
- ReactionStatus["notLoaded"] = "NOT_LOADED";
8
- })(ReactionStatus || (ReactionStatus = {}));
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,164 +0,0 @@
1
- import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
- import _createClass from "@babel/runtime/helpers/createClass";
4
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
5
-
6
- 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; }
7
-
8
- 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; }
9
-
10
- import { defaultReactionsByShortName } from '../components/Selector';
11
- export var containerAri = 'ari:cloud:owner:demo-cloud-id:container/1';
12
- export var ari = 'ari:cloud:owner:demo-cloud-id:item/1';
13
- export var reaction = function reaction(shortName, count, reacted) {
14
- return {
15
- ari: ari,
16
- containerAri: containerAri,
17
- emojiId: defaultReactionsByShortName.get(shortName).id,
18
- count: count,
19
- reacted: reacted
20
- };
21
- };
22
- export var user = function user(id, displayName) {
23
- return {
24
- id: id,
25
- displayName: displayName
26
- };
27
- };
28
-
29
- var objectReactionKey = function objectReactionKey(containerAri, ari) {
30
- return "".concat(containerAri, "|").concat(ari);
31
- };
32
-
33
- var defaultUsers = [user('oscar', 'Oscar Wallhult'), user('julien', 'Julien Michel Hoarau'), user('craig', 'Craig Petchell'), user('jerome', 'Jerome Touffe-Blin'), user('esoares', 'Eduardo Soares'), user('lpereira', 'Luiz Pereira'), user('pcurren', 'Paul Curren'), user('ttjandra', 'Tara Tjandra'), user('severington', 'Ste Everington'), user('sguillope', 'Sylvain Guillope'), user('alunnon', 'Alex Lunnon')];
34
- export var MockReactionsClient = /*#__PURE__*/function () {
35
- function MockReactionsClient() {
36
- var _this = this;
37
-
38
- var delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
39
-
40
- _classCallCheck(this, MockReactionsClient);
41
-
42
- _defineProperty(this, "mockData", _defineProperty({}, objectReactionKey(containerAri, ari), [reaction(':fire:', 1, true), reaction(':thumbsup:', 9, false), reaction(':astonished:', 5, false), reaction(':heart:', 100, false)]));
43
-
44
- _defineProperty(this, "delayPromise", function () {
45
- return new Promise(function (resolve) {
46
- return window.setTimeout(resolve, _this.delay);
47
- });
48
- });
49
-
50
- this.delay = delay;
51
- }
52
-
53
- _createClass(MockReactionsClient, [{
54
- key: "getReactions",
55
- value: function getReactions(containerAri, aris) {
56
- var _this2 = this;
57
-
58
- return this.delayPromise().then(function () {
59
- return aris.reduce(function (results, ari) {
60
- var reactionKey = objectReactionKey(containerAri, ari);
61
- results[ari] = _this2.mockData[reactionKey] || [];
62
- return results;
63
- }, {});
64
- });
65
- }
66
- }, {
67
- key: "getDetailedReaction",
68
- value: function getDetailedReaction(containerAri, ari, emojiId) {
69
- var _this3 = this;
70
-
71
- return this.delayPromise().then(function () {
72
- var reactionKey = "".concat(containerAri, "|").concat(ari);
73
- var reactionsMockData = _this3.mockData[reactionKey];
74
-
75
- if (reactionsMockData) {
76
- var _reaction = reactionsMockData.find(function (reaction) {
77
- return reaction.emojiId === emojiId;
78
- });
79
-
80
- if (_reaction) {
81
- var users = [].concat(defaultUsers).slice(Math.floor(Math.random() * 4), Math.floor(Math.random() * 9) + 4).slice(0, _reaction.count);
82
- return _objectSpread(_objectSpread({}, _reaction), {}, {
83
- users: users
84
- });
85
- }
86
- }
87
-
88
- return {
89
- containerAri: containerAri,
90
- ari: ari,
91
- emojiId: emojiId,
92
- count: 1,
93
- reacted: true,
94
- users: []
95
- };
96
- });
97
- }
98
- }, {
99
- key: "addReaction",
100
- value: function addReaction(containerAri, ari, emojiId) {
101
- var _this4 = this;
102
-
103
- return this.delayPromise().then(function () {
104
- var reactionKey = objectReactionKey(containerAri, ari);
105
- var found = false;
106
- var reactionsMockData = _this4.mockData[reactionKey];
107
-
108
- if (reactionsMockData) {
109
- _this4.mockData[reactionKey] = reactionsMockData.map(function (reaction) {
110
- if (reaction.emojiId === emojiId) {
111
- found = true;
112
- return _objectSpread(_objectSpread({}, reaction), {}, {
113
- count: reaction.count + 1,
114
- reacted: true
115
- });
116
- }
117
-
118
- return reaction;
119
- });
120
- }
121
-
122
- if (!found) {
123
- _this4.mockData[reactionKey] = [].concat(_toConsumableArray(reactionsMockData ? reactionsMockData : []), [{
124
- containerAri: containerAri,
125
- ari: ari,
126
- emojiId: emojiId,
127
- count: 1,
128
- reacted: true
129
- }]);
130
- }
131
-
132
- return _this4.mockData[reactionKey];
133
- });
134
- }
135
- }, {
136
- key: "deleteReaction",
137
- value: function deleteReaction(containerAri, ari, emojiId) {
138
- var _this5 = this;
139
-
140
- return this.delayPromise().then(function () {
141
- var reactionKey = objectReactionKey(containerAri, ari);
142
- _this5.mockData[reactionKey] = _this5.mockData[reactionKey].map(function (reaction) {
143
- if (reaction.emojiId === emojiId) {
144
- if (reaction.count === 1) {
145
- return undefined;
146
- }
147
-
148
- return _objectSpread(_objectSpread({}, reaction), {}, {
149
- count: reaction.count - 1,
150
- reacted: false
151
- });
152
- }
153
-
154
- return reaction;
155
- }).filter(function (reaction) {
156
- return !!reaction;
157
- });
158
- return _this5.mockData[reactionKey];
159
- });
160
- }
161
- }]);
162
-
163
- return MockReactionsClient;
164
- }();
@@ -1 +0,0 @@
1
- export {};