@atlaskit/reactions 21.5.1 → 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.
- package/CHANGELOG.md +11 -0
- package/MockReactionsClient/package.json +7 -0
- package/dist/cjs/{client/MockReactionsClient.js → MockReactionsClient.js} +4 -6
- package/dist/cjs/analytics/analytics.js +141 -0
- package/dist/cjs/analytics/index.js +4 -134
- package/dist/cjs/client/ReactionServiceClient.js +29 -6
- package/dist/cjs/client/index.js +1 -33
- package/dist/cjs/components/{Counter.js → Counter/Counter.js} +32 -39
- package/dist/cjs/components/Counter/index.js +36 -0
- package/dist/cjs/components/Counter/styles.js +33 -0
- package/dist/cjs/components/EmojiButton/EmojiButton.js +58 -0
- package/dist/cjs/components/EmojiButton/index.js +19 -0
- package/dist/cjs/components/EmojiButton/styles.js +25 -0
- package/dist/cjs/components/FlashAnimation/FlashAnimation.js +42 -0
- package/dist/cjs/components/FlashAnimation/index.js +19 -0
- package/dist/cjs/components/{FlashAnimation.js → FlashAnimation/styles.js} +7 -26
- package/dist/cjs/components/Reaction/Reaction.js +163 -0
- package/dist/cjs/components/Reaction/index.js +19 -0
- package/dist/cjs/components/Reaction/styles.js +70 -0
- package/dist/cjs/components/ReactionPicker/ReactionPicker.js +272 -0
- package/dist/cjs/components/ReactionPicker/index.js +19 -0
- package/dist/cjs/components/ReactionPicker/styles.js +37 -0
- package/dist/cjs/components/ReactionTooltip/ReactionTooltip.js +71 -0
- package/dist/cjs/components/ReactionTooltip/index.js +19 -0
- package/dist/cjs/components/ReactionTooltip/styles.js +46 -0
- package/dist/cjs/components/Reactions/Reactions.js +200 -0
- package/dist/cjs/components/Reactions/index.js +25 -0
- package/dist/cjs/components/Reactions/styles.js +29 -0
- package/dist/cjs/components/Selector/Selector.js +132 -0
- package/dist/cjs/components/Selector/index.js +30 -0
- package/dist/cjs/components/Selector/styles.js +56 -0
- package/dist/cjs/components/ShowMore/ShowMore.js +71 -0
- package/dist/cjs/components/ShowMore/index.js +19 -0
- package/dist/cjs/components/ShowMore/styles.js +44 -0
- package/dist/cjs/components/Trigger/Trigger.js +59 -0
- package/dist/cjs/components/Trigger/index.js +13 -0
- package/dist/cjs/components/Trigger/styles.js +46 -0
- package/dist/cjs/components/{UfoErrorBoundary.js → UfoErrorBoundary/UfoErrorBoundary.js} +3 -0
- package/dist/cjs/components/UfoErrorBoundary/index.js +13 -0
- package/dist/cjs/containers/ConnectedReactionPicker/ConnectedReactionPicker.js +62 -0
- package/dist/cjs/containers/ConnectedReactionPicker/index.js +13 -0
- package/dist/cjs/containers/ConnectedReactionsView/ConnectedReactionsView.js +258 -0
- package/dist/cjs/containers/ConnectedReactionsView/index.js +13 -0
- package/dist/cjs/containers/index.js +23 -13
- package/dist/cjs/hooks/index.js +13 -0
- package/dist/cjs/hooks/useClickAway.js +35 -0
- package/dist/cjs/index.js +8 -0
- package/dist/cjs/shared/constants.js +39 -8
- package/dist/cjs/{components → shared}/i18n.js +1 -1
- package/dist/cjs/shared/index.js +11 -3
- package/dist/cjs/shared/utils.js +54 -0
- package/dist/cjs/store/{ReactionsStore.js → MemoryReactionsStore.js} +37 -18
- package/dist/cjs/store/ReactionConsumer.js +43 -15
- package/dist/cjs/store/index.js +8 -2
- package/dist/cjs/store/utils.js +4 -10
- package/dist/cjs/{client/ReactionClient.js → types/client.js} +0 -0
- package/dist/cjs/types/index.js +2 -2
- package/dist/cjs/types/reaction.js +43 -0
- package/dist/cjs/types/{DetailedReaction.js → store.js} +0 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/{client/MockReactionsClient.js → MockReactionsClient.js} +4 -5
- package/dist/es2019/analytics/analytics.js +64 -0
- package/dist/es2019/analytics/index.js +3 -65
- package/dist/es2019/analytics/ufo.js +0 -1
- package/dist/es2019/client/ReactionServiceClient.js +31 -6
- package/dist/es2019/client/index.js +1 -2
- package/dist/es2019/components/{Counter.js → Counter/Counter.js} +26 -31
- package/dist/es2019/components/Counter/index.js +3 -0
- package/dist/es2019/components/Counter/styles.js +20 -0
- package/dist/es2019/components/EmojiButton/EmojiButton.js +35 -0
- package/dist/es2019/components/EmojiButton/index.js +1 -0
- package/dist/es2019/components/EmojiButton/styles.js +16 -0
- package/dist/es2019/components/FlashAnimation/FlashAnimation.js +18 -0
- package/dist/es2019/components/FlashAnimation/index.js +1 -0
- package/dist/es2019/components/{FlashAnimation.js → FlashAnimation/styles.js} +6 -17
- package/dist/es2019/components/Reaction/Reaction.js +104 -0
- package/dist/es2019/components/Reaction/index.js +1 -0
- package/dist/es2019/components/Reaction/styles.js +55 -0
- package/dist/es2019/components/ReactionPicker/ReactionPicker.js +208 -0
- package/dist/es2019/components/ReactionPicker/index.js +1 -0
- package/dist/es2019/components/ReactionPicker/styles.js +23 -0
- package/dist/es2019/components/ReactionTooltip/ReactionTooltip.js +46 -0
- package/dist/es2019/components/ReactionTooltip/index.js +1 -0
- package/dist/es2019/components/ReactionTooltip/styles.js +32 -0
- package/dist/es2019/components/Reactions/Reactions.js +156 -0
- package/dist/es2019/components/Reactions/index.js +1 -0
- package/dist/es2019/components/Reactions/styles.js +19 -0
- package/dist/es2019/components/Selector/Selector.js +98 -0
- package/dist/es2019/components/Selector/index.js +3 -0
- package/dist/es2019/components/Selector/styles.js +39 -0
- package/dist/es2019/components/ShowMore/ShowMore.js +43 -0
- package/dist/es2019/components/ShowMore/index.js +1 -0
- package/dist/es2019/components/ShowMore/styles.js +30 -0
- package/dist/es2019/components/{Trigger.js → Trigger/Trigger.js} +15 -20
- package/dist/es2019/components/Trigger/index.js +1 -0
- package/dist/es2019/components/Trigger/styles.js +24 -0
- package/dist/es2019/components/{UfoErrorBoundary.js → UfoErrorBoundary/UfoErrorBoundary.js} +4 -0
- package/dist/es2019/components/UfoErrorBoundary/index.js +1 -0
- package/dist/es2019/containers/ConnectedReactionPicker/ConnectedReactionPicker.js +27 -0
- package/dist/es2019/containers/ConnectedReactionPicker/index.js +1 -0
- package/dist/es2019/containers/ConnectedReactionsView/ConnectedReactionsView.js +166 -0
- package/dist/es2019/containers/ConnectedReactionsView/index.js +1 -0
- package/dist/es2019/containers/index.js +2 -2
- package/dist/es2019/hooks/index.js +1 -0
- package/dist/es2019/hooks/useClickAway.js +27 -0
- package/dist/es2019/index.js +3 -1
- package/dist/es2019/shared/constants.js +32 -4
- package/dist/es2019/{components → shared}/i18n.js +1 -1
- package/dist/es2019/shared/index.js +6 -2
- package/dist/es2019/shared/utils.js +35 -0
- package/dist/es2019/store/{ReactionsStore.js → MemoryReactionsStore.js} +36 -17
- package/dist/es2019/store/ReactionConsumer.js +18 -12
- package/dist/es2019/store/index.js +1 -1
- package/dist/es2019/store/utils.js +8 -4
- package/dist/es2019/{client/ReactionClient.js → types/client.js} +0 -0
- package/dist/es2019/types/index.js +1 -1
- package/dist/es2019/types/reaction.js +34 -0
- package/dist/es2019/types/{DetailedReaction.js → store.js} +0 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/{client/MockReactionsClient.js → MockReactionsClient.js} +4 -5
- package/dist/esm/analytics/analytics.js +99 -0
- package/dist/esm/analytics/index.js +3 -99
- package/dist/esm/analytics/ufo.js +0 -1
- package/dist/esm/client/ReactionServiceClient.js +30 -6
- package/dist/esm/client/index.js +1 -2
- package/dist/esm/components/{Counter.js → Counter/Counter.js} +26 -31
- package/dist/esm/components/Counter/index.js +3 -0
- package/dist/esm/components/Counter/styles.js +20 -0
- package/dist/esm/components/EmojiButton/EmojiButton.js +35 -0
- package/dist/esm/components/EmojiButton/index.js +1 -0
- package/dist/esm/components/EmojiButton/styles.js +16 -0
- package/dist/esm/components/FlashAnimation/FlashAnimation.js +20 -0
- package/dist/esm/components/FlashAnimation/index.js +1 -0
- package/dist/esm/components/{FlashAnimation.js → FlashAnimation/styles.js} +6 -19
- package/dist/esm/components/Reaction/Reaction.js +131 -0
- package/dist/esm/components/Reaction/index.js +1 -0
- package/dist/esm/components/Reaction/styles.js +55 -0
- package/dist/esm/components/ReactionPicker/ReactionPicker.js +243 -0
- package/dist/esm/components/ReactionPicker/index.js +1 -0
- package/dist/esm/components/ReactionPicker/styles.js +23 -0
- package/dist/esm/components/ReactionTooltip/ReactionTooltip.js +46 -0
- package/dist/esm/components/ReactionTooltip/index.js +1 -0
- package/dist/esm/components/ReactionTooltip/styles.js +32 -0
- package/dist/esm/components/Reactions/Reactions.js +166 -0
- package/dist/esm/components/Reactions/index.js +1 -0
- package/dist/esm/components/Reactions/styles.js +19 -0
- package/dist/esm/components/Selector/Selector.js +107 -0
- package/dist/esm/components/Selector/index.js +3 -0
- package/dist/esm/components/Selector/styles.js +41 -0
- package/dist/esm/components/ShowMore/ShowMore.js +46 -0
- package/dist/esm/components/ShowMore/index.js +1 -0
- package/dist/esm/components/ShowMore/styles.js +30 -0
- package/dist/esm/components/{Trigger.js → Trigger/Trigger.js} +15 -20
- package/dist/esm/components/Trigger/index.js +1 -0
- package/dist/esm/components/Trigger/styles.js +31 -0
- package/dist/esm/components/{UfoErrorBoundary.js → UfoErrorBoundary/UfoErrorBoundary.js} +4 -0
- package/dist/esm/components/UfoErrorBoundary/index.js +1 -0
- package/dist/esm/containers/ConnectedReactionPicker/ConnectedReactionPicker.js +46 -0
- package/dist/esm/containers/ConnectedReactionPicker/index.js +1 -0
- package/dist/esm/containers/ConnectedReactionsView/ConnectedReactionsView.js +227 -0
- package/dist/esm/containers/ConnectedReactionsView/index.js +1 -0
- package/dist/esm/containers/index.js +2 -2
- package/dist/esm/hooks/index.js +1 -0
- package/dist/esm/hooks/useClickAway.js +28 -0
- package/dist/esm/index.js +3 -1
- package/dist/esm/shared/constants.js +34 -4
- package/dist/esm/{components → shared}/i18n.js +1 -1
- package/dist/esm/shared/index.js +6 -2
- package/dist/esm/shared/utils.js +41 -0
- package/dist/esm/store/{ReactionsStore.js → MemoryReactionsStore.js} +36 -20
- package/dist/esm/store/ReactionConsumer.js +42 -15
- package/dist/esm/store/index.js +1 -1
- package/dist/esm/store/utils.js +8 -4
- package/dist/{es2019/types/ReactionSource.js → esm/types/client.js} +0 -0
- package/dist/esm/types/index.js +1 -1
- package/dist/esm/types/reaction.js +34 -0
- package/dist/{es2019/types/ReactionSummary.js → esm/types/store.js} +0 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/{client/MockReactionsClient.d.ts → MockReactionsClient.d.ts} +4 -5
- package/dist/types/analytics/analytics.d.ts +96 -0
- package/dist/types/analytics/index.d.ts +1 -96
- package/dist/types/client/ReactionServiceClient.d.ts +27 -10
- package/dist/types/client/index.d.ts +0 -2
- package/dist/types/components/{Counter.d.ts → Counter/Counter.d.ts} +15 -7
- package/dist/types/components/Counter/index.d.ts +3 -0
- package/dist/types/components/Counter/styles.d.ts +3 -0
- package/dist/types/components/EmojiButton/EmojiButton.d.ts +22 -0
- package/dist/types/components/EmojiButton/index.d.ts +2 -0
- package/dist/types/components/EmojiButton/styles.d.ts +1 -0
- package/dist/types/components/FlashAnimation/FlashAnimation.d.ts +20 -0
- package/dist/types/components/FlashAnimation/index.d.ts +2 -0
- package/dist/types/components/FlashAnimation/styles.d.ts +3 -0
- package/dist/types/components/Reaction/Reaction.d.ts +38 -0
- package/dist/types/components/Reaction/index.d.ts +2 -0
- package/dist/types/components/Reaction/styles.d.ts +10 -0
- package/dist/types/components/{ReactionPicker.d.ts → ReactionPicker/ReactionPicker.d.ts} +12 -33
- package/dist/types/components/ReactionPicker/index.d.ts +2 -0
- package/dist/types/components/ReactionPicker/styles.d.ts +3 -0
- package/dist/types/components/ReactionTooltip/ReactionTooltip.d.ts +22 -0
- package/dist/types/components/ReactionTooltip/index.d.ts +2 -0
- package/dist/types/components/ReactionTooltip/styles.d.ts +4 -0
- package/dist/types/components/Reactions/Reactions.d.ts +64 -0
- package/dist/types/components/Reactions/index.d.ts +2 -0
- package/dist/types/components/Reactions/styles.d.ts +2 -0
- package/dist/types/components/Selector/Selector.d.ts +34 -0
- package/dist/types/components/Selector/index.d.ts +3 -0
- package/dist/types/components/Selector/styles.d.ts +10 -0
- package/dist/types/components/{ShowMore.d.ts → ShowMore/ShowMore.d.ts} +14 -13
- package/dist/types/components/ShowMore/index.d.ts +2 -0
- package/dist/types/components/ShowMore/styles.d.ts +3 -0
- package/dist/types/components/Trigger/Trigger.d.ts +23 -0
- package/dist/types/components/Trigger/index.d.ts +2 -0
- package/dist/types/components/Trigger/styles.d.ts +5 -0
- package/dist/types/components/UfoErrorBoundary/UfoErrorBoundary.d.ts +16 -0
- package/dist/types/components/UfoErrorBoundary/index.d.ts +2 -0
- package/dist/types/components/index.d.ts +4 -1
- package/dist/types/containers/ConnectedReactionPicker/ConnectedReactionPicker.d.ts +27 -0
- package/dist/types/containers/ConnectedReactionPicker/index.d.ts +2 -0
- package/dist/types/containers/ConnectedReactionsView/ConnectedReactionsView.d.ts +52 -0
- package/dist/types/containers/ConnectedReactionsView/index.d.ts +2 -0
- package/dist/types/containers/index.d.ts +2 -2
- package/dist/types/hooks/index.d.ts +1 -0
- package/dist/types/hooks/useClickAway.d.ts +8 -0
- package/dist/types/index.d.ts +2 -2
- package/dist/types/shared/constants.d.ts +13 -3
- package/dist/types/{components → shared}/i18n.d.ts +0 -0
- package/dist/types/shared/index.d.ts +3 -1
- package/dist/types/shared/utils.d.ts +11 -0
- package/dist/types/store/{ReactionsStore.d.ts → MemoryReactionsStore.d.ts} +21 -61
- package/dist/types/store/ReactionConsumer.d.ts +47 -19
- package/dist/types/store/index.d.ts +2 -2
- package/dist/types/store/utils.d.ts +3 -7
- package/dist/types/types/Actions.d.ts +3 -0
- package/dist/types/types/User.d.ts +6 -0
- package/dist/types/types/client.d.ts +38 -0
- package/dist/types/types/index.d.ts +4 -6
- package/dist/types/types/reaction.d.ts +82 -0
- package/dist/types/types/store.d.ts +63 -0
- package/extract-react-type/ConnectedReactionPicker.ts +2 -4
- package/extract-react-type/ConnectedReactionsView.ts +3 -5
- package/extract-react-type/Reaction.ts +2 -4
- package/extract-react-type/Reactions.ts +2 -4
- package/extract-react-type/actions.ts +1 -3
- package/extract-react-type/reactionClient.ts +3 -5
- package/extract-react-type/reactionsStore.ts +3 -5
- package/package.json +21 -5
- package/dist/cjs/components/EmojiButton.js +0 -100
- package/dist/cjs/components/Reaction.js +0 -229
- package/dist/cjs/components/ReactionPicker.js +0 -297
- package/dist/cjs/components/ReactionTooltip.js +0 -82
- package/dist/cjs/components/Reactions.js +0 -194
- package/dist/cjs/components/Selector.js +0 -189
- package/dist/cjs/components/ShowMore.js +0 -119
- package/dist/cjs/components/Trigger.js +0 -58
- package/dist/cjs/components/utils.js +0 -28
- package/dist/cjs/containers/ConnectedReactionPicker.js +0 -53
- package/dist/cjs/containers/ConnectedReactionsView.js +0 -139
- package/dist/cjs/types/ReactionSource.js +0 -5
- package/dist/cjs/types/ReactionStatus.js +0 -19
- package/dist/cjs/types/ReactionSummary.js +0 -5
- package/dist/cjs/types/Reactions.js +0 -5
- package/dist/cjs/types/ReactionsState.js +0 -5
- package/dist/es2019/components/EmojiButton.js +0 -50
- package/dist/es2019/components/Reaction.js +0 -183
- package/dist/es2019/components/ReactionPicker.js +0 -247
- package/dist/es2019/components/ReactionTooltip.js +0 -66
- package/dist/es2019/components/Reactions.js +0 -150
- package/dist/es2019/components/Selector.js +0 -127
- package/dist/es2019/components/ShowMore.js +0 -71
- package/dist/es2019/components/utils.js +0 -13
- package/dist/es2019/containers/ConnectedReactionPicker.js +0 -36
- package/dist/es2019/containers/ConnectedReactionsView.js +0 -118
- package/dist/es2019/types/ReactionStatus.js +0 -11
- package/dist/es2019/types/Reactions.js +0 -1
- package/dist/es2019/types/ReactionsState.js +0 -1
- package/dist/esm/client/ReactionClient.js +0 -1
- package/dist/esm/components/EmojiButton.js +0 -77
- package/dist/esm/components/Reaction.js +0 -207
- package/dist/esm/components/ReactionPicker.js +0 -274
- package/dist/esm/components/ReactionTooltip.js +0 -63
- package/dist/esm/components/Reactions.js +0 -180
- package/dist/esm/components/Selector.js +0 -160
- package/dist/esm/components/ShowMore.js +0 -95
- package/dist/esm/components/utils.js +0 -15
- package/dist/esm/containers/ConnectedReactionPicker.js +0 -38
- package/dist/esm/containers/ConnectedReactionsView.js +0 -116
- package/dist/esm/types/DetailedReaction.js +0 -1
- package/dist/esm/types/ReactionSource.js +0 -1
- package/dist/esm/types/ReactionStatus.js +0 -11
- package/dist/esm/types/ReactionSummary.js +0 -1
- package/dist/esm/types/Reactions.js +0 -1
- package/dist/esm/types/ReactionsState.js +0 -1
- package/dist/types/client/ReactionClient.d.ts +0 -28
- package/dist/types/components/EmojiButton.d.ts +0 -21
- package/dist/types/components/FlashAnimation.d.ts +0 -18
- package/dist/types/components/Reaction.d.ts +0 -44
- package/dist/types/components/ReactionTooltip.d.ts +0 -14
- package/dist/types/components/Reactions.d.ts +0 -83
- package/dist/types/components/Selector.d.ts +0 -39
- package/dist/types/components/Trigger.d.ts +0 -16
- package/dist/types/components/UfoErrorBoundary.d.ts +0 -9
- package/dist/types/components/utils.d.ts +0 -4
- package/dist/types/containers/ConnectedReactionPicker.d.ts +0 -16
- package/dist/types/containers/ConnectedReactionsView.d.ts +0 -31
- package/dist/types/types/DetailedReaction.d.ts +0 -7
- package/dist/types/types/ReactionSource.d.ts +0 -4
- package/dist/types/types/ReactionStatus.d.ts +0 -9
- package/dist/types/types/ReactionSummary.d.ts +0 -10
- package/dist/types/types/Reactions.d.ts +0 -4
- package/dist/types/types/ReactionsState.d.ts +0 -20
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
3
|
+
import { jsx } from '@emotion/core';
|
|
4
|
+
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
5
|
+
import Tooltip from '@atlaskit/tooltip';
|
|
6
|
+
import { FormattedMessage } from 'react-intl-next';
|
|
7
|
+
import { Analytics } from '../../analytics';
|
|
8
|
+
import { ReactionStatus } from '../../types';
|
|
9
|
+
import { i18n } from '../../shared';
|
|
10
|
+
import { Reaction } from '../Reaction';
|
|
11
|
+
import { ReactionPicker } from '../ReactionPicker';
|
|
12
|
+
import * as styles from './styles';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Test id for wrapper Reactions div
|
|
16
|
+
*/
|
|
17
|
+
export var RENDER_REACTIONS_TESTID = 'render-reactions';
|
|
18
|
+
/**
|
|
19
|
+
* Test id for the tooltip
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
export var RENDER_TOOLTIP_TESTID = 'render-tooltip';
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Renders list of reactions
|
|
26
|
+
*/
|
|
27
|
+
export var Reactions = /*#__PURE__*/React.memo(function (_ref) {
|
|
28
|
+
var _ref$flash = _ref.flash,
|
|
29
|
+
flash = _ref$flash === void 0 ? {} : _ref$flash,
|
|
30
|
+
status = _ref.status,
|
|
31
|
+
errorMessage = _ref.errorMessage,
|
|
32
|
+
loadReaction = _ref.loadReaction,
|
|
33
|
+
quickReactionEmojiIds = _ref.quickReactionEmojiIds,
|
|
34
|
+
containerAri = _ref.containerAri,
|
|
35
|
+
ari = _ref.ari,
|
|
36
|
+
pickerQuickReactionEmojiIds = _ref.pickerQuickReactionEmojiIds,
|
|
37
|
+
onReactionHover = _ref.onReactionHover,
|
|
38
|
+
onSelection = _ref.onSelection,
|
|
39
|
+
_ref$reactions = _ref.reactions,
|
|
40
|
+
reactions = _ref$reactions === void 0 ? [] : _ref$reactions,
|
|
41
|
+
emojiProvider = _ref.emojiProvider,
|
|
42
|
+
allowAllEmojis = _ref.allowAllEmojis,
|
|
43
|
+
onReactionClick = _ref.onReactionClick;
|
|
44
|
+
|
|
45
|
+
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
46
|
+
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
47
|
+
|
|
48
|
+
var openTime = useRef();
|
|
49
|
+
var renderTime = useRef();
|
|
50
|
+
|
|
51
|
+
if (status !== ReactionStatus.ready) {
|
|
52
|
+
renderTime.current = Date.now();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
useEffect(function () {
|
|
56
|
+
if (status === ReactionStatus.notLoaded) {
|
|
57
|
+
loadReaction();
|
|
58
|
+
}
|
|
59
|
+
}, [status, loadReaction]);
|
|
60
|
+
useEffect(function () {
|
|
61
|
+
if (status === ReactionStatus.ready && renderTime.current) {
|
|
62
|
+
Analytics.createAndFireSafe(createAnalyticsEvent, Analytics.createReactionsRenderedEvent, renderTime.current);
|
|
63
|
+
renderTime.current = undefined;
|
|
64
|
+
}
|
|
65
|
+
}, [createAnalyticsEvent, status]);
|
|
66
|
+
/**
|
|
67
|
+
* Get content of the tooltip
|
|
68
|
+
*/
|
|
69
|
+
|
|
70
|
+
var getTooltip = function getTooltip() {
|
|
71
|
+
switch (status) {
|
|
72
|
+
case ReactionStatus.error:
|
|
73
|
+
return errorMessage || jsx(FormattedMessage, i18n.messages.unexpectedError);
|
|
74
|
+
|
|
75
|
+
case ReactionStatus.loading:
|
|
76
|
+
case ReactionStatus.notLoaded:
|
|
77
|
+
return jsx(FormattedMessage, i18n.messages.loadingReactions);
|
|
78
|
+
|
|
79
|
+
default:
|
|
80
|
+
return undefined;
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
var handleReactionMouseEnter = function handleReactionMouseEnter(summary) {
|
|
85
|
+
if (onReactionHover) {
|
|
86
|
+
onReactionHover(summary.emojiId);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
var handlePickerOpen = useCallback(function () {
|
|
91
|
+
openTime.current = Date.now();
|
|
92
|
+
Analytics.createAndFireSafe(createAnalyticsEvent, Analytics.createPickerButtonClickedEvent, reactions.length);
|
|
93
|
+
}, [createAnalyticsEvent, reactions]);
|
|
94
|
+
var handleOnCancel = useCallback(function () {
|
|
95
|
+
Analytics.createAndFireSafe(createAnalyticsEvent, Analytics.createPickerCancelledEvent, openTime.current);
|
|
96
|
+
openTime.current = undefined;
|
|
97
|
+
}, [createAnalyticsEvent]);
|
|
98
|
+
var handleOnMore = useCallback(function () {
|
|
99
|
+
Analytics.createAndFireSafe(createAnalyticsEvent, Analytics.createPickerMoreClickedEvent, openTime.current);
|
|
100
|
+
}, [createAnalyticsEvent]);
|
|
101
|
+
var handleOnSelection = useCallback(function (emojiId, source) {
|
|
102
|
+
Analytics.createAndFireSafe(createAnalyticsEvent, Analytics.createReactionSelectionEvent, source, emojiId, reactions.find(function (reaction) {
|
|
103
|
+
return reaction.emojiId === emojiId;
|
|
104
|
+
}), openTime.current);
|
|
105
|
+
openTime.current = undefined;
|
|
106
|
+
onSelection(emojiId);
|
|
107
|
+
}, [createAnalyticsEvent, onSelection, reactions]);
|
|
108
|
+
/**
|
|
109
|
+
* Get the reactions that we want to render are any reactions with a count greater than zero as well as any default emoji not already shown
|
|
110
|
+
*/
|
|
111
|
+
|
|
112
|
+
var memorizedReactions = useMemo(function () {
|
|
113
|
+
//
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* If reactions not empty, don't show quick reactions Pre defined emoji or if its empty => return the current list of reactions
|
|
117
|
+
*/
|
|
118
|
+
if (reactions.length > 0 || !quickReactionEmojiIds) {
|
|
119
|
+
return reactions;
|
|
120
|
+
} // add any missing default reactions
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
var items = quickReactionEmojiIds.filter(function (emojiId) {
|
|
124
|
+
return !reactions.some(function (reaction) {
|
|
125
|
+
return reaction.emojiId === emojiId;
|
|
126
|
+
});
|
|
127
|
+
}).map(function (emojiId) {
|
|
128
|
+
return {
|
|
129
|
+
ari: ari,
|
|
130
|
+
containerAri: containerAri,
|
|
131
|
+
emojiId: emojiId,
|
|
132
|
+
count: 0,
|
|
133
|
+
reacted: false
|
|
134
|
+
};
|
|
135
|
+
});
|
|
136
|
+
return reactions.concat(items);
|
|
137
|
+
}, [ari, containerAri, quickReactionEmojiIds, reactions]);
|
|
138
|
+
return jsx("div", {
|
|
139
|
+
css: styles.wrapperStyle,
|
|
140
|
+
"data-testid": RENDER_REACTIONS_TESTID
|
|
141
|
+
}, memorizedReactions.map(function (reaction) {
|
|
142
|
+
return jsx(Reaction, {
|
|
143
|
+
key: reaction.emojiId,
|
|
144
|
+
css: styles.reactionStyle,
|
|
145
|
+
reaction: reaction,
|
|
146
|
+
emojiProvider: emojiProvider,
|
|
147
|
+
onClick: onReactionClick,
|
|
148
|
+
onMouseEnter: handleReactionMouseEnter,
|
|
149
|
+
flash: flash[reaction.emojiId]
|
|
150
|
+
});
|
|
151
|
+
}), jsx(Tooltip, {
|
|
152
|
+
testId: RENDER_TOOLTIP_TESTID,
|
|
153
|
+
content: getTooltip()
|
|
154
|
+
}, jsx(ReactionPicker, {
|
|
155
|
+
css: styles.reactionStyle,
|
|
156
|
+
emojiProvider: emojiProvider,
|
|
157
|
+
miniMode: true,
|
|
158
|
+
allowAllEmojis: allowAllEmojis,
|
|
159
|
+
pickerQuickReactionEmojiIds: pickerQuickReactionEmojiIds,
|
|
160
|
+
disabled: status !== ReactionStatus.ready,
|
|
161
|
+
onSelection: handleOnSelection,
|
|
162
|
+
onOpen: handlePickerOpen,
|
|
163
|
+
onCancel: handleOnCancel,
|
|
164
|
+
onShowMore: handleOnMore
|
|
165
|
+
})));
|
|
166
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Reactions, RENDER_REACTIONS_TESTID, RENDER_TOOLTIP_TESTID } from './Reactions';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { css } from '@emotion/core';
|
|
3
|
+
export var reactionStyle = css({
|
|
4
|
+
display: 'inline-block',
|
|
5
|
+
// top margin of 2px to allow spacing between rows when wrapped (paired with top margin in reactionsStyle)
|
|
6
|
+
margin: '2px 4px 0 4px'
|
|
7
|
+
});
|
|
8
|
+
export var wrapperStyle = css({
|
|
9
|
+
display: 'flex',
|
|
10
|
+
flexWrap: 'wrap',
|
|
11
|
+
position: 'relative',
|
|
12
|
+
alignItems: 'center',
|
|
13
|
+
borderRadius: '15px',
|
|
14
|
+
// To allow to row spacing of 2px on wrap, and 0px on first row
|
|
15
|
+
marginTop: '-2px',
|
|
16
|
+
'> :first-of-type > :first-child': {
|
|
17
|
+
marginLeft: 0
|
|
18
|
+
}
|
|
19
|
+
});
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
|
|
3
|
+
/** @jsx jsx */
|
|
4
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
5
|
+
import { jsx } from '@emotion/core';
|
|
6
|
+
import Tooltip from '@atlaskit/tooltip';
|
|
7
|
+
import { constants } from '../../shared';
|
|
8
|
+
import { EmojiButton } from '../EmojiButton';
|
|
9
|
+
import { ShowMore } from '../ShowMore';
|
|
10
|
+
import * as styles from './styles';
|
|
11
|
+
/**
|
|
12
|
+
* Test id for wrapper Selector div
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
export var RENDER_SELECTOR_TESTID = 'render-selector';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Reactions picker panel part of the <ReactionPicker /> component
|
|
19
|
+
*/
|
|
20
|
+
export var Selector = function Selector(_ref) {
|
|
21
|
+
var emojiProvider = _ref.emojiProvider,
|
|
22
|
+
onMoreClick = _ref.onMoreClick,
|
|
23
|
+
onSelection = _ref.onSelection,
|
|
24
|
+
showMore = _ref.showMore,
|
|
25
|
+
_ref$pickerQuickReact = _ref.pickerQuickReactionEmojiIds,
|
|
26
|
+
pickerQuickReactionEmojiIds = _ref$pickerQuickReact === void 0 ? constants.DefaultReactions : _ref$pickerQuickReact;
|
|
27
|
+
|
|
28
|
+
var _useState = useState(),
|
|
29
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
30
|
+
selection = _useState2[0],
|
|
31
|
+
setSelection = _useState2[1];
|
|
32
|
+
/**
|
|
33
|
+
* Collection of global DOM timeout ids when user selects emojis for animation display
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
var timeoutIds = useRef([]);
|
|
38
|
+
/**
|
|
39
|
+
* Clear the timeouts for the selected emojis when the component unmounts
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
useEffect(function () {
|
|
43
|
+
var timeoutValues = timeoutIds.current;
|
|
44
|
+
return function cleanup() {
|
|
45
|
+
timeoutValues.forEach(clearTimeout);
|
|
46
|
+
};
|
|
47
|
+
}, []);
|
|
48
|
+
/**
|
|
49
|
+
* event handler when an emoji gets selected
|
|
50
|
+
* @param item selected emoji
|
|
51
|
+
* @param description depth detail of the selected emoji
|
|
52
|
+
* @param event Dom event data
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
var onSelected = function onSelected(item, description, event) {
|
|
56
|
+
timeoutIds.current.push(window.setTimeout(function () {
|
|
57
|
+
onSelection(item, description, event);
|
|
58
|
+
}, 250));
|
|
59
|
+
setSelection(item);
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* custom css styling for the emoji icon
|
|
63
|
+
* @param index location of the emoji in the rendered list of items
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
var emojiStyleAnimation = function emojiStyleAnimation(index) {
|
|
68
|
+
return {
|
|
69
|
+
animationDelay: "".concat(index * 50, "ms")
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Render the default emoji icon
|
|
74
|
+
* @param emoji emoji item
|
|
75
|
+
* @param index location of the emoji in the array
|
|
76
|
+
*/
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
var renderEmoji = function renderEmoji(emoji, index) {
|
|
80
|
+
var _emoji$id;
|
|
81
|
+
|
|
82
|
+
return jsx("div", {
|
|
83
|
+
key: (_emoji$id = emoji.id) !== null && _emoji$id !== void 0 ? _emoji$id : emoji.shortName,
|
|
84
|
+
className: emoji === selection ? 'selected' : undefined,
|
|
85
|
+
css: [styles.emojiStyle, styles.revealStyle],
|
|
86
|
+
style: emojiStyleAnimation(index),
|
|
87
|
+
"data-testid": RENDER_SELECTOR_TESTID
|
|
88
|
+
}, jsx(Tooltip, {
|
|
89
|
+
content: emoji.shortName
|
|
90
|
+
}, jsx(EmojiButton, {
|
|
91
|
+
emojiId: emoji,
|
|
92
|
+
emojiProvider: emojiProvider,
|
|
93
|
+
onClick: onSelected
|
|
94
|
+
})));
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
return jsx("div", {
|
|
98
|
+
css: styles.selectorStyle
|
|
99
|
+
}, pickerQuickReactionEmojiIds ? pickerQuickReactionEmojiIds.map(renderEmoji) : null, showMore ? jsx(ShowMore, {
|
|
100
|
+
key: "more",
|
|
101
|
+
buttonStyle: styles.revealStyle,
|
|
102
|
+
style: {
|
|
103
|
+
button: emojiStyleAnimation(constants.DefaultReactions.length)
|
|
104
|
+
},
|
|
105
|
+
onClick: onMoreClick
|
|
106
|
+
}) : null);
|
|
107
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { css, keyframes } from '@emotion/core';
|
|
3
|
+
export var selectorStyle = css({
|
|
4
|
+
boxSizing: 'border-box',
|
|
5
|
+
display: 'flex',
|
|
6
|
+
padding: 0
|
|
7
|
+
});
|
|
8
|
+
export var emojiStyle = css({
|
|
9
|
+
display: 'inline-block',
|
|
10
|
+
opacity: 0,
|
|
11
|
+
'&.selected': {
|
|
12
|
+
transition: 'transform 200ms ease-in-out ',
|
|
13
|
+
transform: 'translateY(-48px) scale(2.667)'
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
export var revealAnimation = keyframes({
|
|
17
|
+
'0%': {
|
|
18
|
+
opacity: 1,
|
|
19
|
+
transform: 'scale(0.5)'
|
|
20
|
+
},
|
|
21
|
+
'75%': {
|
|
22
|
+
transform: 'scale(1.25)'
|
|
23
|
+
},
|
|
24
|
+
'100%': {
|
|
25
|
+
opacity: 1,
|
|
26
|
+
transform: 'scale(1)'
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
export var revealStyle = css({
|
|
30
|
+
animation: "".concat(revealAnimation, " 150ms ease-in-out forwards")
|
|
31
|
+
});
|
|
32
|
+
/**
|
|
33
|
+
* custom css styling for the emoji icon
|
|
34
|
+
* @param index location of the emoji in the rendered list of items
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
export var emojiStyleAnimation = function emojiStyleAnimation(index) {
|
|
38
|
+
return {
|
|
39
|
+
animationDelay: "".concat(index * 50, "ms")
|
|
40
|
+
};
|
|
41
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { jsx } from '@emotion/core';
|
|
4
|
+
import { FormattedMessage } from 'react-intl-next';
|
|
5
|
+
import EditorMoreIcon from '@atlaskit/icon/glyph/editor/more';
|
|
6
|
+
import Tooltip from '@atlaskit/tooltip';
|
|
7
|
+
import { i18n } from '../../shared';
|
|
8
|
+
import * as styles from './styles';
|
|
9
|
+
/**
|
|
10
|
+
* Test id for wrapper button
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export var RENDER_SHOWMORE_TESTID = 'show-more-button';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Show more custom emojis button
|
|
17
|
+
*/
|
|
18
|
+
export var ShowMore = function ShowMore(_ref) {
|
|
19
|
+
var onClick = _ref.onClick,
|
|
20
|
+
_ref$style = _ref.style,
|
|
21
|
+
style = _ref$style === void 0 ? {} : _ref$style,
|
|
22
|
+
_ref$className = _ref.className,
|
|
23
|
+
className = _ref$className === void 0 ? {} : _ref$className,
|
|
24
|
+
buttonStyle = _ref.buttonStyle;
|
|
25
|
+
return jsx("div", {
|
|
26
|
+
className: className.container,
|
|
27
|
+
css: styles.moreEmojiContainerStyle,
|
|
28
|
+
style: style.container
|
|
29
|
+
}, jsx("div", {
|
|
30
|
+
css: styles.separatorStyle
|
|
31
|
+
}), jsx(FormattedMessage, i18n.messages.moreEmoji, function (message) {
|
|
32
|
+
return jsx(Tooltip, {
|
|
33
|
+
content: message
|
|
34
|
+
}, jsx("button", {
|
|
35
|
+
className: className.button,
|
|
36
|
+
css: [styles.moreButtonStyle, buttonStyle],
|
|
37
|
+
title: i18n.messages.moreEmoji.defaultMessage,
|
|
38
|
+
type: "button",
|
|
39
|
+
style: style.button,
|
|
40
|
+
onMouseDown: onClick,
|
|
41
|
+
"data-testid": RENDER_SHOWMORE_TESTID
|
|
42
|
+
}, jsx(EditorMoreIcon, {
|
|
43
|
+
label: "More"
|
|
44
|
+
})));
|
|
45
|
+
}));
|
|
46
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ShowMore, RENDER_SHOWMORE_TESTID } from './ShowMore';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { css } from '@emotion/core';
|
|
3
|
+
import { borderRadius } from '@atlaskit/theme/constants';
|
|
4
|
+
import { N30A } from '@atlaskit/theme/colors';
|
|
5
|
+
import { token } from '@atlaskit/tokens';
|
|
6
|
+
export var moreEmojiContainerStyle = css({
|
|
7
|
+
display: 'flex'
|
|
8
|
+
});
|
|
9
|
+
export var moreButtonStyle = css({
|
|
10
|
+
opacity: 0,
|
|
11
|
+
outline: 'none',
|
|
12
|
+
backgroundColor: 'transparent',
|
|
13
|
+
border: 0,
|
|
14
|
+
borderRadius: "".concat(borderRadius(), "px"),
|
|
15
|
+
cursor: 'pointer',
|
|
16
|
+
margin: '4px 4px 4px 0',
|
|
17
|
+
padding: '4px',
|
|
18
|
+
width: '38px',
|
|
19
|
+
verticalAlign: 'top',
|
|
20
|
+
'&:hover': {
|
|
21
|
+
backgroundColor: token('color.background.neutral.subtle.hovered', N30A)
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
export var separatorStyle = css({
|
|
25
|
+
backgroundColor: token('color.border', N30A),
|
|
26
|
+
margin: '8px 8px 8px 4px',
|
|
27
|
+
width: '1px',
|
|
28
|
+
height: '60%',
|
|
29
|
+
display: 'inline-block'
|
|
30
|
+
});
|
|
@@ -1,37 +1,32 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { jsx } from '@emotion/core';
|
|
3
4
|
import Button from '@atlaskit/button/standard-button';
|
|
4
5
|
import EmojiAddIcon from '@atlaskit/icon/glyph/emoji-add';
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
justifyContent: 'center',
|
|
11
|
-
alignItems: 'center',
|
|
12
|
-
lineHeight: '16px',
|
|
13
|
-
'&.miniMode': {
|
|
14
|
-
width: '24px',
|
|
15
|
-
height: '24px'
|
|
16
|
-
}
|
|
17
|
-
});
|
|
6
|
+
import * as styles from './styles';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Render a button to open the reactions picker
|
|
10
|
+
*/
|
|
18
11
|
export var Trigger = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
19
12
|
var miniMode = props.miniMode,
|
|
20
13
|
_props$disabled = props.disabled,
|
|
21
14
|
disabled = _props$disabled === void 0 ? false : _props$disabled;
|
|
22
15
|
|
|
23
|
-
var handleMouseDown = function handleMouseDown() {
|
|
24
|
-
if (props.onClick) {
|
|
25
|
-
props.onClick();
|
|
16
|
+
var handleMouseDown = function handleMouseDown(e, analyticsEvent) {
|
|
17
|
+
if (props.onClick && !props.disabled) {
|
|
18
|
+
props.onClick(e, analyticsEvent);
|
|
26
19
|
}
|
|
27
20
|
};
|
|
28
21
|
|
|
29
22
|
return jsx(Button, {
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
css: styles.triggerStyle({
|
|
24
|
+
miniMode: miniMode,
|
|
25
|
+
disabled: disabled
|
|
26
|
+
}),
|
|
32
27
|
appearance: "subtle",
|
|
33
28
|
onClick: handleMouseDown,
|
|
34
|
-
|
|
29
|
+
"aria-disabled": disabled,
|
|
35
30
|
iconBefore: jsx(EmojiAddIcon, {
|
|
36
31
|
size: "small",
|
|
37
32
|
label: "Add reaction"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Trigger } from './Trigger';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
|
|
3
|
+
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; }
|
|
4
|
+
|
|
5
|
+
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; }
|
|
6
|
+
|
|
7
|
+
/** @jsx jsx */
|
|
8
|
+
import { css } from '@emotion/core';
|
|
9
|
+
import { token } from '@atlaskit/tokens';
|
|
10
|
+
import { N70 } from '@atlaskit/theme/colors';
|
|
11
|
+
export var DISABLED_BUTTON_COLOR = "".concat(token('color.text.disabled', N70), " !important");
|
|
12
|
+
export var triggerStyle = function triggerStyle(_ref) {
|
|
13
|
+
var _ref$miniMode = _ref.miniMode,
|
|
14
|
+
miniMode = _ref$miniMode === void 0 ? false : _ref$miniMode,
|
|
15
|
+
_ref$disabled = _ref.disabled,
|
|
16
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled;
|
|
17
|
+
return css(_objectSpread(_objectSpread({
|
|
18
|
+
width: '32px',
|
|
19
|
+
height: '32px',
|
|
20
|
+
display: 'flex',
|
|
21
|
+
justifyContent: 'center',
|
|
22
|
+
alignItems: 'center',
|
|
23
|
+
lineHeight: '16px'
|
|
24
|
+
}, miniMode && {
|
|
25
|
+
width: '24px',
|
|
26
|
+
height: '24px'
|
|
27
|
+
}), disabled && {
|
|
28
|
+
color: DISABLED_BUTTON_COLOR,
|
|
29
|
+
cursor: 'not-allowed'
|
|
30
|
+
}));
|
|
31
|
+
};
|
|
@@ -15,6 +15,10 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
15
15
|
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; } }
|
|
16
16
|
|
|
17
17
|
import React from 'react';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Error boundary wrapper to notify "failure" for UFO events of components when there was a re-rendering exception caught inside the `componentDidCatch` event handler
|
|
21
|
+
*/
|
|
18
22
|
export var UfoErrorBoundary = /*#__PURE__*/function (_React$Component) {
|
|
19
23
|
_inherits(UfoErrorBoundary, _React$Component);
|
|
20
24
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { UfoErrorBoundary } from './UfoErrorBoundary';
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { ReactionPicker, UfoErrorBoundary } from '../../components';
|
|
6
|
+
import { UFO } from '../../analytics';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Reaction Picker component
|
|
10
|
+
*/
|
|
11
|
+
export var ConnectedReactionPicker = function ConnectedReactionPicker(props) {
|
|
12
|
+
/**
|
|
13
|
+
* callback event when an emoji item is selected
|
|
14
|
+
* @param emojiId unique id for the reaction emoji
|
|
15
|
+
*/
|
|
16
|
+
var onSelection = function onSelection(emojiId) {
|
|
17
|
+
_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
18
|
+
var _store;
|
|
19
|
+
|
|
20
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
21
|
+
while (1) {
|
|
22
|
+
switch (_context.prev = _context.next) {
|
|
23
|
+
case 0:
|
|
24
|
+
_context.next = 2;
|
|
25
|
+
return Promise.resolve(props.store);
|
|
26
|
+
|
|
27
|
+
case 2:
|
|
28
|
+
_store = _context.sent;
|
|
29
|
+
|
|
30
|
+
_store.addReaction(props.containerAri, props.ari, emojiId);
|
|
31
|
+
|
|
32
|
+
case 4:
|
|
33
|
+
case "end":
|
|
34
|
+
return _context.stop();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}, _callee);
|
|
38
|
+
}))();
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
return /*#__PURE__*/React.createElement(UfoErrorBoundary, {
|
|
42
|
+
experiences: [UFO.PickerRender]
|
|
43
|
+
}, /*#__PURE__*/React.createElement(ReactionPicker, _extends({}, props, {
|
|
44
|
+
onSelection: onSelection
|
|
45
|
+
})));
|
|
46
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ConnectedReactionPicker } from './ConnectedReactionPicker';
|