@atlaskit/reactions 22.2.0 → 22.2.2
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 +13 -0
- package/dist/cjs/MockReactionsClient.js +1 -49
- package/dist/cjs/analytics/analytics.js +1 -40
- package/dist/cjs/analytics/index.js +0 -7
- package/dist/cjs/analytics/ufo.js +8 -20
- package/dist/cjs/client/ReactionServiceClient.js +2 -16
- package/dist/cjs/client/index.js +0 -1
- package/dist/cjs/components/Counter/Counter.js +10 -24
- package/dist/cjs/components/Counter/index.js +0 -6
- package/dist/cjs/components/Counter/styles.js +1 -3
- package/dist/cjs/components/EmojiButton/EmojiButton.js +3 -18
- package/dist/cjs/components/EmojiButton/index.js +0 -1
- package/dist/cjs/components/EmojiButton/styles.js +1 -2
- package/dist/cjs/components/FlashAnimation/FlashAnimation.js +1 -11
- package/dist/cjs/components/FlashAnimation/index.js +0 -1
- package/dist/cjs/components/FlashAnimation/styles.js +1 -3
- package/dist/cjs/components/Reaction/Reaction.js +23 -62
- package/dist/cjs/components/Reaction/index.js +0 -1
- package/dist/cjs/components/Reaction/styles.js +1 -4
- package/dist/cjs/components/ReactionDialog/ReactionView.js +6 -29
- package/dist/cjs/components/ReactionDialog/ReactionsDialog.js +19 -48
- package/dist/cjs/components/ReactionDialog/ReactionsList.js +18 -34
- package/dist/cjs/components/ReactionDialog/index.js +0 -1
- package/dist/cjs/components/ReactionDialog/styles.js +3 -13
- package/dist/cjs/components/ReactionPicker/ReactionPicker.js +41 -71
- package/dist/cjs/components/ReactionPicker/index.js +0 -1
- package/dist/cjs/components/ReactionPicker/styles.js +1 -4
- package/dist/cjs/components/ReactionTooltip/ReactionTooltip.js +13 -28
- package/dist/cjs/components/ReactionTooltip/index.js +0 -1
- package/dist/cjs/components/ReactionTooltip/styles.js +1 -3
- package/dist/cjs/components/Reactions/Reactions.js +48 -86
- package/dist/cjs/components/Reactions/index.js +0 -1
- package/dist/cjs/components/Reactions/styles.js +1 -2
- package/dist/cjs/components/Selector/Selector.js +12 -34
- package/dist/cjs/components/Selector/index.js +0 -6
- package/dist/cjs/components/Selector/styles.js +2 -5
- package/dist/cjs/components/ShowMore/ShowMore.js +5 -19
- package/dist/cjs/components/ShowMore/index.js +0 -1
- package/dist/cjs/components/ShowMore/styles.js +1 -4
- package/dist/cjs/components/Trigger/Trigger.js +6 -22
- package/dist/cjs/components/Trigger/index.js +0 -1
- package/dist/cjs/components/Trigger/styles.js +3 -13
- package/dist/cjs/components/UfoErrorBoundary/UfoErrorBoundary.js +1 -19
- package/dist/cjs/components/UfoErrorBoundary/index.js +0 -1
- package/dist/cjs/components/index.js +0 -5
- package/dist/cjs/containers/ConnectedReactionPicker/ConnectedReactionPicker.js +2 -17
- package/dist/cjs/containers/ConnectedReactionPicker/index.js +0 -1
- package/dist/cjs/containers/ConnectedReactionsView/ConnectedReactionsView.js +17 -62
- package/dist/cjs/containers/ConnectedReactionsView/index.js +0 -1
- package/dist/cjs/containers/index.js +0 -4
- package/dist/cjs/hooks/index.js +0 -1
- package/dist/cjs/hooks/useClickAway.js +2 -5
- package/dist/cjs/i18n/cs.js +0 -1
- package/dist/cjs/i18n/da.js +0 -1
- package/dist/cjs/i18n/de.js +0 -1
- package/dist/cjs/i18n/en.js +0 -1
- package/dist/cjs/i18n/en_GB.js +0 -1
- package/dist/cjs/i18n/en_ZZ.js +0 -1
- package/dist/cjs/i18n/es.js +0 -1
- package/dist/cjs/i18n/et.js +0 -1
- package/dist/cjs/i18n/fi.js +0 -1
- package/dist/cjs/i18n/fr.js +0 -1
- package/dist/cjs/i18n/hu.js +0 -1
- package/dist/cjs/i18n/index.js +0 -30
- package/dist/cjs/i18n/it.js +0 -1
- package/dist/cjs/i18n/ja.js +0 -1
- package/dist/cjs/i18n/ko.js +0 -1
- package/dist/cjs/i18n/nb.js +0 -1
- package/dist/cjs/i18n/nl.js +0 -1
- package/dist/cjs/i18n/pl.js +0 -1
- package/dist/cjs/i18n/pt_BR.js +0 -1
- package/dist/cjs/i18n/pt_PT.js +0 -1
- package/dist/cjs/i18n/ru.js +0 -1
- package/dist/cjs/i18n/sk.js +0 -1
- package/dist/cjs/i18n/sv.js +0 -1
- package/dist/cjs/i18n/th.js +0 -1
- package/dist/cjs/i18n/tr.js +0 -1
- package/dist/cjs/i18n/uk.js +0 -1
- package/dist/cjs/i18n/vi.js +0 -1
- package/dist/cjs/i18n/zh.js +0 -1
- package/dist/cjs/i18n/zh_TW.js +0 -1
- package/dist/cjs/index.js +0 -6
- package/dist/cjs/shared/constants.js +5 -6
- package/dist/cjs/shared/i18n.js +0 -2
- package/dist/cjs/shared/index.js +0 -9
- package/dist/cjs/shared/utils.js +6 -25
- package/dist/cjs/store/MemoryReactionsStore.js +21 -74
- package/dist/cjs/store/ReactionConsumer.js +0 -28
- package/dist/cjs/store/batched.js +0 -6
- package/dist/cjs/store/index.js +0 -2
- package/dist/cjs/store/utils.js +0 -25
- package/dist/cjs/types/index.js +0 -1
- package/dist/cjs/types/reaction.js +0 -10
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/MockReactionsClient.js +7 -21
- package/dist/es2019/analytics/analytics.js +3 -9
- package/dist/es2019/analytics/ufo.js +11 -13
- package/dist/es2019/client/ReactionServiceClient.js +4 -13
- package/dist/es2019/components/Counter/Counter.js +5 -7
- package/dist/es2019/components/EmojiButton/EmojiButton.js +0 -3
- package/dist/es2019/components/FlashAnimation/FlashAnimation.js +1 -2
- package/dist/es2019/components/Reaction/Reaction.js +3 -12
- package/dist/es2019/components/Reaction/styles.js +1 -1
- package/dist/es2019/components/ReactionDialog/ReactionView.js +0 -4
- package/dist/es2019/components/ReactionDialog/ReactionsDialog.js +6 -15
- package/dist/es2019/components/ReactionDialog/ReactionsList.js +4 -3
- package/dist/es2019/components/ReactionDialog/styles.js +2 -5
- package/dist/es2019/components/ReactionPicker/ReactionPicker.js +14 -19
- package/dist/es2019/components/ReactionTooltip/ReactionTooltip.js +1 -2
- package/dist/es2019/components/Reactions/Reactions.js +16 -25
- package/dist/es2019/components/Selector/Selector.js +5 -11
- package/dist/es2019/components/Selector/styles.js +1 -1
- package/dist/es2019/components/ShowMore/ShowMore.js +1 -2
- package/dist/es2019/components/Trigger/Trigger.js +1 -5
- package/dist/es2019/components/UfoErrorBoundary/UfoErrorBoundary.js +0 -3
- package/dist/es2019/containers/ConnectedReactionPicker/ConnectedReactionPicker.js +0 -4
- package/dist/es2019/containers/ConnectedReactionsView/ConnectedReactionsView.js +8 -20
- package/dist/es2019/hooks/useClickAway.js +3 -4
- package/dist/es2019/index.js +2 -1
- package/dist/es2019/shared/constants.js +5 -5
- package/dist/es2019/shared/utils.js +7 -15
- package/dist/es2019/store/MemoryReactionsStore.js +36 -61
- package/dist/es2019/store/ReactionConsumer.js +1 -12
- package/dist/es2019/store/batched.js +0 -2
- package/dist/es2019/store/utils.js +4 -8
- package/dist/es2019/types/reaction.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/MockReactionsClient.js +1 -42
- package/dist/esm/analytics/analytics.js +1 -12
- package/dist/esm/analytics/ufo.js +11 -13
- package/dist/esm/client/ReactionServiceClient.js +2 -14
- package/dist/esm/components/Counter/Counter.js +12 -15
- package/dist/esm/components/EmojiButton/EmojiButton.js +2 -6
- package/dist/esm/components/FlashAnimation/FlashAnimation.js +1 -2
- package/dist/esm/components/Reaction/Reaction.js +23 -40
- package/dist/esm/components/Reaction/styles.js +1 -1
- package/dist/esm/components/ReactionDialog/ReactionView.js +5 -14
- package/dist/esm/components/ReactionDialog/ReactionsDialog.js +20 -35
- package/dist/esm/components/ReactionDialog/ReactionsList.js +17 -20
- package/dist/esm/components/ReactionDialog/styles.js +2 -5
- package/dist/esm/components/ReactionPicker/ReactionPicker.js +42 -52
- package/dist/esm/components/ReactionTooltip/ReactionTooltip.js +14 -16
- package/dist/esm/components/Reactions/Reactions.js +49 -62
- package/dist/esm/components/Selector/Selector.js +13 -22
- package/dist/esm/components/Selector/styles.js +1 -1
- package/dist/esm/components/ShowMore/ShowMore.js +6 -7
- package/dist/esm/components/Trigger/Trigger.js +7 -11
- package/dist/esm/components/Trigger/styles.js +3 -6
- package/dist/esm/components/UfoErrorBoundary/UfoErrorBoundary.js +1 -14
- package/dist/esm/containers/ConnectedReactionPicker/ConnectedReactionPicker.js +2 -9
- package/dist/esm/containers/ConnectedReactionsView/ConnectedReactionsView.js +17 -43
- package/dist/esm/hooks/useClickAway.js +3 -4
- package/dist/esm/index.js +2 -1
- package/dist/esm/shared/constants.js +5 -5
- package/dist/esm/shared/utils.js +7 -17
- package/dist/esm/store/MemoryReactionsStore.js +22 -78
- package/dist/esm/store/ReactionConsumer.js +0 -23
- package/dist/esm/store/batched.js +0 -4
- package/dist/esm/store/utils.js +0 -9
- package/dist/esm/types/reaction.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/components/ReactionDialog/styles.d.ts +1 -2
- package/package.json +6 -4
|
@@ -5,13 +5,12 @@ import { constants } from '../../shared';
|
|
|
5
5
|
const REACTIONS_CONTAINER_WIDTH = 48;
|
|
6
6
|
const REACTION_RIGHT_MARGIN = 8;
|
|
7
7
|
/* we want to display around 9 reactions and show 10th one as faded so removing 2px from REACTIONS_CONTAINER_WIDTH*/
|
|
8
|
-
|
|
9
8
|
const CONTAINER_WIDTH = constants.NUMBER_OF_REACTIONS_TO_DISPLAY * (REACTIONS_CONTAINER_WIDTH + REACTION_RIGHT_MARGIN) + REACTIONS_CONTAINER_WIDTH - 2;
|
|
10
9
|
const REACTION_CONTAINER_HEIGHT = 48;
|
|
10
|
+
|
|
11
11
|
/*Reactions Container. Using pseudo Element :after to set border since with onClick of Reaction to higlight the
|
|
12
12
|
border blue below the reaction. Setting Border Width based on number of reactions to make sure it shows up
|
|
13
13
|
in case the container overflows */
|
|
14
|
-
|
|
15
14
|
export const containerStyle = reactionsBorderWidth => css({
|
|
16
15
|
overflow: 'hidden',
|
|
17
16
|
maxWidth: `${CONTAINER_WIDTH}px`,
|
|
@@ -54,7 +53,6 @@ export const counterStyle = isSelected => css({
|
|
|
54
53
|
color: isSelected ? `${`var(--ds-text, ${B400})`}!important` : `2px solid ${`var(--ds-text, ${N500})`}!important`
|
|
55
54
|
}
|
|
56
55
|
});
|
|
57
|
-
|
|
58
56
|
const fadedCss = (edge, theme) => css({
|
|
59
57
|
content: '""',
|
|
60
58
|
position: 'absolute',
|
|
@@ -63,9 +61,8 @@ const fadedCss = (edge, theme) => css({
|
|
|
63
61
|
width: `${REACTIONS_CONTAINER_WIDTH}px`,
|
|
64
62
|
height: `${REACTION_CONTAINER_HEIGHT}px`,
|
|
65
63
|
zIndex: 0,
|
|
66
|
-
background: theme === 'dark'
|
|
64
|
+
background: theme === 'dark' ? `linear-gradient(${containerEdgeAngle[edge]}deg, rgba(34, 39, 43, 0.95) 40.23%, rgba(34, 39, 43, 0.55) 58.33%, rgba(34, 39, 43, 0) 77.49%)` : `linear-gradient(${containerEdgeAngle[edge]}deg, rgba(255, 255, 255, 0.95) 40.23%, rgba(255, 255, 255, 0.55) 58.33%, rgba(255, 255, 255, 0) 77.49%)`
|
|
67
65
|
});
|
|
68
|
-
|
|
69
66
|
export const customTabWrapper = (isSelected, selectedEmojiId, theme) => css({
|
|
70
67
|
flexShrink: 0,
|
|
71
68
|
display: 'flex',
|
|
@@ -11,15 +11,15 @@ import { UFO } from '../../analytics';
|
|
|
11
11
|
import { i18n } from '../../shared';
|
|
12
12
|
import { useClickAway } from '../../hooks';
|
|
13
13
|
import * as styles from './styles';
|
|
14
|
+
|
|
14
15
|
/**
|
|
15
16
|
* Test id for wrapper ReactionPicker div
|
|
16
17
|
*/
|
|
17
|
-
|
|
18
18
|
export const RENDER_REACTIONPICKER_TESTID = 'reactionPicker-testid';
|
|
19
|
+
|
|
19
20
|
/**
|
|
20
21
|
* Emoji Picker Controller Id for Accessibility Labels
|
|
21
22
|
*/
|
|
22
|
-
|
|
23
23
|
const PICKER_CONTROL_ID = 'emoji-picker';
|
|
24
24
|
const popperModifiers = [
|
|
25
25
|
/**
|
|
@@ -48,7 +48,6 @@ https://popper.js.org/docs/v1/#modifiers..applyStyle
|
|
|
48
48
|
name: 'preventOverflow',
|
|
49
49
|
enabled: true
|
|
50
50
|
}];
|
|
51
|
-
|
|
52
51
|
/**
|
|
53
52
|
* Picker component for adding reactions
|
|
54
53
|
*/
|
|
@@ -70,43 +69,40 @@ export const ReactionPicker = /*#__PURE__*/React.memo(props => {
|
|
|
70
69
|
/**
|
|
71
70
|
* Container <div /> reference (used by custom hook to detect click outside)
|
|
72
71
|
*/
|
|
73
|
-
|
|
74
72
|
const wrapperRef = useRef(null);
|
|
75
73
|
/**
|
|
76
74
|
* a function you can ask Popper to recompute your tooltip's position. It will directly call the Popper#update method
|
|
77
75
|
*/
|
|
78
|
-
|
|
79
76
|
const updatePopper = useRef();
|
|
80
77
|
const [settings, setSettings] = useState({
|
|
81
78
|
/**
|
|
82
79
|
* Show the picker floating panel
|
|
83
80
|
*/
|
|
84
81
|
isOpen: false,
|
|
85
|
-
|
|
86
82
|
/**
|
|
87
83
|
* Show the full custom emoji list picker or the default list of emojis
|
|
88
84
|
*/
|
|
89
85
|
showFullPicker: !!allowAllEmojis && Array.isArray(pickerQuickReactionEmojiIds) && pickerQuickReactionEmojiIds.length === 0
|
|
90
86
|
});
|
|
87
|
+
|
|
91
88
|
/**
|
|
92
89
|
* Custom hook triggers when user clicks outside the reactions picker
|
|
93
90
|
*/
|
|
94
|
-
|
|
95
91
|
useClickAway(wrapperRef, () => {
|
|
96
92
|
onCancel();
|
|
97
93
|
close();
|
|
98
94
|
}, 'click', true, settings.isOpen);
|
|
95
|
+
|
|
99
96
|
/**
|
|
100
97
|
* Event callback when the picker is closed
|
|
101
98
|
* @param _id Optional id if an emoji button was selected or undefineed if was clicked outside the picker
|
|
102
99
|
*/
|
|
103
|
-
|
|
104
100
|
const close = useCallback(_id => {
|
|
105
101
|
setSettings({
|
|
106
102
|
isOpen: false,
|
|
107
103
|
showFullPicker: !!allowAllEmojis && Array.isArray(pickerQuickReactionEmojiIds) && pickerQuickReactionEmojiIds.length === 0
|
|
108
|
-
});
|
|
109
|
-
|
|
104
|
+
});
|
|
105
|
+
// ufo abort reaction experience
|
|
110
106
|
UFO.PickerRender.abort({
|
|
111
107
|
metadata: {
|
|
112
108
|
emojiId: _id,
|
|
@@ -115,11 +111,11 @@ export const ReactionPicker = /*#__PURE__*/React.memo(props => {
|
|
|
115
111
|
}
|
|
116
112
|
});
|
|
117
113
|
}, [allowAllEmojis, pickerQuickReactionEmojiIds]);
|
|
114
|
+
|
|
118
115
|
/**
|
|
119
116
|
* Event handle rwhen selecting to show the custom emoji icons picker
|
|
120
117
|
* @param e event param
|
|
121
118
|
*/
|
|
122
|
-
|
|
123
119
|
const onSelectMoreClick = useCallback(e => {
|
|
124
120
|
e.preventDefault();
|
|
125
121
|
setSettings({
|
|
@@ -128,24 +124,23 @@ export const ReactionPicker = /*#__PURE__*/React.memo(props => {
|
|
|
128
124
|
});
|
|
129
125
|
onShowMore();
|
|
130
126
|
}, [onShowMore]);
|
|
127
|
+
|
|
131
128
|
/**
|
|
132
129
|
* Event callback when an emoji icon is selected
|
|
133
130
|
* @param item selected item
|
|
134
131
|
*/
|
|
135
|
-
|
|
136
132
|
const onEmojiSelected = useCallback(item => {
|
|
137
133
|
// no emoji was selected
|
|
138
134
|
if (!item.id) {
|
|
139
135
|
return;
|
|
140
136
|
}
|
|
141
|
-
|
|
142
137
|
onSelection(item.id, settings.showFullPicker ? 'emojiPicker' : 'quickSelector');
|
|
143
138
|
close(item.id);
|
|
144
139
|
}, [close, onSelection, settings.showFullPicker]);
|
|
140
|
+
|
|
145
141
|
/**
|
|
146
142
|
* Event handler when the emoji icon to open the custom picker is selected
|
|
147
143
|
*/
|
|
148
|
-
|
|
149
144
|
const onTriggerClick = () => {
|
|
150
145
|
// ufo start reactions picker open experience
|
|
151
146
|
UFO.PickerRender.start();
|
|
@@ -153,15 +148,14 @@ export const ReactionPicker = /*#__PURE__*/React.memo(props => {
|
|
|
153
148
|
isOpen: !settings.isOpen,
|
|
154
149
|
showFullPicker: !!allowAllEmojis && Array.isArray(pickerQuickReactionEmojiIds) && pickerQuickReactionEmojiIds.length === 0
|
|
155
150
|
});
|
|
156
|
-
onOpen();
|
|
157
|
-
|
|
151
|
+
onOpen();
|
|
152
|
+
// ufo reactions picker opened success
|
|
158
153
|
UFO.PickerRender.success();
|
|
159
154
|
};
|
|
155
|
+
|
|
160
156
|
/**
|
|
161
157
|
* When picker is opened, re-calculate the picker position
|
|
162
158
|
*/
|
|
163
|
-
|
|
164
|
-
|
|
165
159
|
useEffect(() => {
|
|
166
160
|
if (settings.isOpen) {
|
|
167
161
|
if (updatePopper.current) {
|
|
@@ -177,7 +171,8 @@ export const ReactionPicker = /*#__PURE__*/React.memo(props => {
|
|
|
177
171
|
ref: wrapperRef
|
|
178
172
|
}, jsx(Manager, null, jsx(Reference, null, ({
|
|
179
173
|
ref: popperRef
|
|
180
|
-
}) =>
|
|
174
|
+
}) =>
|
|
175
|
+
// Render a button to open the <Selector /> panel
|
|
181
176
|
jsx(Trigger, {
|
|
182
177
|
ariaAttributes: {
|
|
183
178
|
'aria-expanded': settings.isOpen,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
|
|
3
2
|
/** @jsx jsx */
|
|
4
3
|
import React from 'react';
|
|
5
4
|
import { jsx } from '@emotion/react';
|
|
@@ -7,10 +6,10 @@ import Tooltip from '@atlaskit/tooltip';
|
|
|
7
6
|
import { FormattedMessage } from 'react-intl-next';
|
|
8
7
|
import { constants, i18n } from '../../shared';
|
|
9
8
|
import * as styles from './styles';
|
|
9
|
+
|
|
10
10
|
/**
|
|
11
11
|
* Test id for wrapper ReactionTooltip div
|
|
12
12
|
*/
|
|
13
|
-
|
|
14
13
|
export const RENDER_REACTIONTOOLTIP_TESTID = 'render-reactionTooltip';
|
|
15
14
|
export const ReactionTooltip = ({
|
|
16
15
|
children,
|
|
@@ -13,37 +13,33 @@ import { Reaction } from '../Reaction';
|
|
|
13
13
|
import { ReactionsDialog } from '../ReactionDialog';
|
|
14
14
|
import { ReactionPicker } from '../ReactionPicker';
|
|
15
15
|
import * as styles from './styles';
|
|
16
|
+
|
|
16
17
|
/**
|
|
17
18
|
* Set of all available UFO experiences relating to reactions dialog
|
|
18
19
|
*/
|
|
19
|
-
|
|
20
20
|
export const ufoExperiences = {
|
|
21
21
|
/**
|
|
22
22
|
* Expeirence when a reaction dialog is opened
|
|
23
23
|
*/
|
|
24
24
|
openDialog: UFO.ReactionDialogOpened,
|
|
25
|
-
|
|
26
25
|
/**
|
|
27
26
|
* Experience when a reaction dialog is closed
|
|
28
27
|
*/
|
|
29
28
|
closeDialog: UFO.ReactionDialogClosed,
|
|
30
|
-
|
|
31
29
|
/**
|
|
32
30
|
* Experience when a reaction changed/fetched from inside the modal dialog
|
|
33
31
|
*/
|
|
34
32
|
selectedReactionChangeInsideDialog: UFO.ReactionDialogSelectedReactionChanged
|
|
35
33
|
};
|
|
34
|
+
|
|
36
35
|
/**
|
|
37
36
|
* Test id for wrapper Reactions div
|
|
38
37
|
*/
|
|
39
|
-
|
|
40
38
|
export const RENDER_REACTIONS_TESTID = 'render-reactions';
|
|
41
39
|
/**
|
|
42
40
|
* Test id for the view all reacted user to trigger the dialog
|
|
43
41
|
*/
|
|
44
|
-
|
|
45
42
|
export const RENDER_VIEWALL_REACTED_USERS_DIALOG = 'viewall-reacted-users-dialog';
|
|
46
|
-
|
|
47
43
|
/**
|
|
48
44
|
* Get content of the tooltip
|
|
49
45
|
*/
|
|
@@ -52,22 +48,19 @@ export function getTooltip(status, errorMessage) {
|
|
|
52
48
|
case ReactionStatus.error:
|
|
53
49
|
return errorMessage || jsx(FormattedMessage, i18n.messages.unexpectedError);
|
|
54
50
|
// When reaction is not available don't show any tooltip (e.g. Archive page in Confluence)
|
|
55
|
-
|
|
56
51
|
case ReactionStatus.disabled:
|
|
57
52
|
return null;
|
|
58
|
-
|
|
59
53
|
case ReactionStatus.notLoaded:
|
|
60
54
|
case ReactionStatus.loading:
|
|
61
55
|
return jsx(FormattedMessage, i18n.messages.loadingReactions);
|
|
62
|
-
|
|
63
56
|
case ReactionStatus.ready:
|
|
64
57
|
return jsx(FormattedMessage, i18n.messages.addReaction);
|
|
65
58
|
}
|
|
66
59
|
}
|
|
60
|
+
|
|
67
61
|
/**
|
|
68
62
|
* Renders list of reactions
|
|
69
63
|
*/
|
|
70
|
-
|
|
71
64
|
export const Reactions = /*#__PURE__*/React.memo(({
|
|
72
65
|
flash = {},
|
|
73
66
|
status,
|
|
@@ -105,7 +98,6 @@ export const Reactions = /*#__PURE__*/React.memo(({
|
|
|
105
98
|
renderTime.current = Date.now();
|
|
106
99
|
} else {
|
|
107
100
|
var _renderTime$current;
|
|
108
|
-
|
|
109
101
|
Analytics.createAndFireSafe(createAnalyticsEvent, Analytics.createReactionsRenderedEvent, (_renderTime$current = renderTime.current) !== null && _renderTime$current !== void 0 ? _renderTime$current : Date.now() //renderTime.current can be null during unit test cases
|
|
110
102
|
);
|
|
111
103
|
renderTime.current = undefined;
|
|
@@ -134,17 +126,18 @@ export const Reactions = /*#__PURE__*/React.memo(({
|
|
|
134
126
|
openTime.current = undefined;
|
|
135
127
|
onSelection(emojiId);
|
|
136
128
|
}, [createAnalyticsEvent, onSelection, reactions]);
|
|
129
|
+
|
|
137
130
|
/**
|
|
138
131
|
* event handler to open selected reaction from tooltip
|
|
139
132
|
* @param emojiId selected emoji id
|
|
140
133
|
*/
|
|
141
|
-
|
|
142
134
|
const handleOpenReactionsDialog = emojiId => {
|
|
143
135
|
// ufo start opening reaction dialog
|
|
144
136
|
ufoExperiences.openDialog.start();
|
|
145
137
|
setSelectedEmojiId(emojiId);
|
|
146
|
-
onDialogOpenCallback(emojiId, 'tooltip');
|
|
138
|
+
onDialogOpenCallback(emojiId, 'tooltip');
|
|
147
139
|
|
|
140
|
+
// ufo opening reaction dialog success
|
|
148
141
|
ufoExperiences.openDialog.success({
|
|
149
142
|
metadata: {
|
|
150
143
|
emojiId: emojiId,
|
|
@@ -153,19 +146,19 @@ export const Reactions = /*#__PURE__*/React.memo(({
|
|
|
153
146
|
}
|
|
154
147
|
});
|
|
155
148
|
};
|
|
149
|
+
|
|
156
150
|
/**
|
|
157
151
|
* Event handler to oepn all reactions link button
|
|
158
152
|
*/
|
|
159
|
-
|
|
160
|
-
|
|
161
153
|
const handleOpenAllReactionsDialog = () => {
|
|
162
154
|
// ufo start opening reaction dialog
|
|
163
155
|
ufoExperiences.openDialog.start();
|
|
164
156
|
const emojiId = reactions[0].emojiId;
|
|
165
157
|
getReactionDetails(emojiId);
|
|
166
158
|
setSelectedEmojiId(emojiId);
|
|
167
|
-
onDialogOpenCallback(emojiId, 'button');
|
|
159
|
+
onDialogOpenCallback(emojiId, 'button');
|
|
168
160
|
|
|
161
|
+
// ufo opening reaction dialog success
|
|
169
162
|
ufoExperiences.openDialog.success({
|
|
170
163
|
metadata: {
|
|
171
164
|
emojiId: emojiId,
|
|
@@ -174,13 +167,13 @@ export const Reactions = /*#__PURE__*/React.memo(({
|
|
|
174
167
|
}
|
|
175
168
|
});
|
|
176
169
|
};
|
|
177
|
-
|
|
178
170
|
const handleCloseReactionsDialog = (e, analyticsEvent) => {
|
|
179
171
|
// ufo closing opening reaction dialog
|
|
180
172
|
ufoExperiences.closeDialog.start();
|
|
181
173
|
setSelectedEmojiId('');
|
|
182
|
-
onDialogCloseCallback(e, analyticsEvent);
|
|
174
|
+
onDialogCloseCallback(e, analyticsEvent);
|
|
183
175
|
|
|
176
|
+
// ufo closing reaction dialog success
|
|
184
177
|
ufoExperiences.closeDialog.success({
|
|
185
178
|
metadata: {
|
|
186
179
|
source: 'Reactions',
|
|
@@ -188,13 +181,13 @@ export const Reactions = /*#__PURE__*/React.memo(({
|
|
|
188
181
|
}
|
|
189
182
|
});
|
|
190
183
|
};
|
|
191
|
-
|
|
192
184
|
const handleSelectReactionInDialog = (emojiId, analyticsEvent) => {
|
|
193
185
|
// ufo selected reaction inside the modal dialog
|
|
194
186
|
ufoExperiences.selectedReactionChangeInsideDialog.start();
|
|
195
187
|
handleReactionMouseEnter(emojiId);
|
|
196
|
-
onDialogSelectReactionCallback(emojiId, analyticsEvent);
|
|
188
|
+
onDialogSelectReactionCallback(emojiId, analyticsEvent);
|
|
197
189
|
|
|
190
|
+
// ufo selected reaction inside the modal dialog success
|
|
198
191
|
ufoExperiences.selectedReactionChangeInsideDialog.success({
|
|
199
192
|
metadata: {
|
|
200
193
|
emojiId: emojiId,
|
|
@@ -203,22 +196,20 @@ export const Reactions = /*#__PURE__*/React.memo(({
|
|
|
203
196
|
}
|
|
204
197
|
});
|
|
205
198
|
};
|
|
199
|
+
|
|
206
200
|
/**
|
|
207
201
|
* 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
|
|
208
202
|
*/
|
|
209
|
-
|
|
210
|
-
|
|
211
203
|
const memorizedReactions = useMemo(() => {
|
|
212
204
|
//
|
|
213
|
-
|
|
214
205
|
/**
|
|
215
206
|
* If reactions not empty, don't show quick reactions Pre defined emoji or if its empty => return the current list of reactions
|
|
216
207
|
*/
|
|
217
208
|
if (reactions.length > 0 || !quickReactionEmojis) {
|
|
218
209
|
return reactions;
|
|
219
|
-
}
|
|
220
|
-
|
|
210
|
+
}
|
|
221
211
|
|
|
212
|
+
// add any missing default reactions
|
|
222
213
|
const {
|
|
223
214
|
ari,
|
|
224
215
|
containerAri,
|
|
@@ -6,12 +6,11 @@ import { constants } from '../../shared';
|
|
|
6
6
|
import { EmojiButton } from '../EmojiButton';
|
|
7
7
|
import { ShowMore } from '../ShowMore';
|
|
8
8
|
import * as styles from './styles';
|
|
9
|
+
|
|
9
10
|
/**
|
|
10
11
|
* Test id for wrapper Selector div
|
|
11
12
|
*/
|
|
12
|
-
|
|
13
13
|
export const RENDER_SELECTOR_TESTID = 'render-selector';
|
|
14
|
-
|
|
15
14
|
/**
|
|
16
15
|
* Reactions picker panel part of the <ReactionPicker /> component
|
|
17
16
|
*/
|
|
@@ -26,50 +25,46 @@ export const Selector = ({
|
|
|
26
25
|
/**
|
|
27
26
|
* Collection of global DOM timeout ids when user selects emojis for animation display
|
|
28
27
|
*/
|
|
29
|
-
|
|
30
28
|
const timeoutIds = useRef([]);
|
|
29
|
+
|
|
31
30
|
/**
|
|
32
31
|
* Clear the timeouts for the selected emojis when the component unmounts
|
|
33
32
|
*/
|
|
34
|
-
|
|
35
33
|
useEffect(() => {
|
|
36
34
|
const timeoutValues = timeoutIds.current;
|
|
37
35
|
return function cleanup() {
|
|
38
36
|
timeoutValues.forEach(clearTimeout);
|
|
39
37
|
};
|
|
40
38
|
}, []);
|
|
39
|
+
|
|
41
40
|
/**
|
|
42
41
|
* event handler when an emoji gets selected
|
|
43
42
|
* @param item selected emoji
|
|
44
43
|
* @param description depth detail of the selected emoji
|
|
45
44
|
* @param event Dom event data
|
|
46
45
|
*/
|
|
47
|
-
|
|
48
46
|
const onSelected = (item, description, event) => {
|
|
49
47
|
timeoutIds.current.push(window.setTimeout(() => {
|
|
50
48
|
onSelection(item, description, event);
|
|
51
49
|
}, 250));
|
|
52
50
|
setSelection(item);
|
|
53
51
|
};
|
|
52
|
+
|
|
54
53
|
/**
|
|
55
54
|
* custom css styling for the emoji icon
|
|
56
55
|
* @param index location of the emoji in the rendered list of items
|
|
57
56
|
*/
|
|
58
|
-
|
|
59
|
-
|
|
60
57
|
const emojiStyleAnimation = index => ({
|
|
61
58
|
animationDelay: `${index * 50}ms`
|
|
62
59
|
});
|
|
60
|
+
|
|
63
61
|
/**
|
|
64
62
|
* Render the default emoji icon
|
|
65
63
|
* @param emoji emoji item
|
|
66
64
|
* @param index location of the emoji in the array
|
|
67
65
|
*/
|
|
68
|
-
|
|
69
|
-
|
|
70
66
|
const renderEmoji = (emoji, index) => {
|
|
71
67
|
var _emoji$id;
|
|
72
|
-
|
|
73
68
|
return jsx("div", {
|
|
74
69
|
key: (_emoji$id = emoji.id) !== null && _emoji$id !== void 0 ? _emoji$id : emoji.shortName,
|
|
75
70
|
className: emoji === selection ? 'selected' : undefined,
|
|
@@ -84,7 +79,6 @@ export const Selector = ({
|
|
|
84
79
|
onClick: onSelected
|
|
85
80
|
})));
|
|
86
81
|
};
|
|
87
|
-
|
|
88
82
|
return jsx("div", {
|
|
89
83
|
css: styles.selectorStyle
|
|
90
84
|
}, pickerQuickReactionEmojiIds ? pickerQuickReactionEmojiIds.map(renderEmoji) : null, showMore ? jsx(ShowMore, {
|
|
@@ -29,11 +29,11 @@ export const revealAnimation = keyframes({
|
|
|
29
29
|
export const revealStyle = css({
|
|
30
30
|
animation: `${revealAnimation} 150ms ease-in-out forwards`
|
|
31
31
|
});
|
|
32
|
+
|
|
32
33
|
/**
|
|
33
34
|
* custom css styling for the emoji icon
|
|
34
35
|
* @param index location of the emoji in the rendered list of items
|
|
35
36
|
*/
|
|
36
|
-
|
|
37
37
|
export const emojiStyleAnimation = index => ({
|
|
38
38
|
animationDelay: `${index * 50}ms`
|
|
39
39
|
});
|
|
@@ -6,13 +6,12 @@ import EditorMoreIcon from '@atlaskit/icon/glyph/editor/more';
|
|
|
6
6
|
import Tooltip from '@atlaskit/tooltip';
|
|
7
7
|
import { i18n } from '../../shared';
|
|
8
8
|
import * as styles from './styles';
|
|
9
|
+
|
|
9
10
|
/**
|
|
10
11
|
* Test id for wrapper button
|
|
11
12
|
*/
|
|
12
|
-
|
|
13
13
|
export const RENDER_SHOWMORE_TESTID = 'show-more-button';
|
|
14
14
|
export const RENDER_WRAPPER_TESTID = 'show-more-wrapper';
|
|
15
|
-
|
|
16
15
|
/**
|
|
17
16
|
* Show more custom emojis button
|
|
18
17
|
*/
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
|
|
3
2
|
/** @jsx jsx */
|
|
4
3
|
import React from 'react';
|
|
5
4
|
import { jsx } from '@emotion/react';
|
|
@@ -7,12 +6,11 @@ import Button from '@atlaskit/button/standard-button';
|
|
|
7
6
|
import Tooltip from '@atlaskit/tooltip';
|
|
8
7
|
import EmojiAddIcon from '@atlaskit/icon/glyph/emoji-add';
|
|
9
8
|
import * as styles from './styles';
|
|
9
|
+
|
|
10
10
|
/**
|
|
11
11
|
* Test id for the tooltip
|
|
12
12
|
*/
|
|
13
|
-
|
|
14
13
|
export const RENDER_TOOLTIP_TRIGGER_TESTID = 'render-tooltip-trigger';
|
|
15
|
-
|
|
16
14
|
/**
|
|
17
15
|
* Render an emoji button to open the reactions select picker
|
|
18
16
|
*/
|
|
@@ -24,13 +22,11 @@ export const Trigger = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
24
22
|
disabled = false,
|
|
25
23
|
ariaAttributes = {}
|
|
26
24
|
} = props;
|
|
27
|
-
|
|
28
25
|
const handleMouseDown = (e, analyticsEvent) => {
|
|
29
26
|
if (onClick && !disabled) {
|
|
30
27
|
onClick(e, analyticsEvent);
|
|
31
28
|
}
|
|
32
29
|
};
|
|
33
|
-
|
|
34
30
|
return jsx(Tooltip, {
|
|
35
31
|
testId: RENDER_TOOLTIP_TRIGGER_TESTID,
|
|
36
32
|
content: tooltipContent
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* Error boundary wrapper to notify "failure" for UFO events of components when there was a re-rendering exception caught inside the `componentDidCatch` event handler
|
|
5
4
|
*/
|
|
@@ -19,9 +18,7 @@ export class UfoErrorBoundary extends React.Component {
|
|
|
19
18
|
});
|
|
20
19
|
}
|
|
21
20
|
}
|
|
22
|
-
|
|
23
21
|
render() {
|
|
24
22
|
return this.props.children;
|
|
25
23
|
}
|
|
26
|
-
|
|
27
24
|
}
|
|
@@ -2,7 +2,6 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { ReactionPicker, UfoErrorBoundary } from '../../components';
|
|
4
4
|
import { UFO } from '../../analytics';
|
|
5
|
-
|
|
6
5
|
/**
|
|
7
6
|
* Reaction Picker component
|
|
8
7
|
*/
|
|
@@ -16,15 +15,12 @@ export const ConnectedReactionPicker = props => {
|
|
|
16
15
|
* callback event when an emoji item is selected
|
|
17
16
|
* @param emojiId unique id for the reaction emoji
|
|
18
17
|
*/
|
|
19
|
-
|
|
20
18
|
const onSelection = emojiId => {
|
|
21
19
|
(async () => {
|
|
22
20
|
const _store = await Promise.resolve(store);
|
|
23
|
-
|
|
24
21
|
_store.addReaction(containerAri, ari, emojiId);
|
|
25
22
|
})();
|
|
26
23
|
};
|
|
27
|
-
|
|
28
24
|
return /*#__PURE__*/React.createElement(UfoErrorBoundary, {
|
|
29
25
|
experiences: [UFO.PickerRender]
|
|
30
26
|
}, /*#__PURE__*/React.createElement(ReactionPicker, _extends({}, props, {
|
|
@@ -5,20 +5,17 @@ import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
|
5
5
|
import { Reactions, UfoErrorBoundary } from '../../components';
|
|
6
6
|
import { ufoExperiences } from '../../store';
|
|
7
7
|
import { ReactionStatus } from '../../types';
|
|
8
|
-
|
|
9
8
|
/**
|
|
10
9
|
* Export the mapper function outside the component so easier to do unit tests
|
|
11
10
|
*/
|
|
12
11
|
export const mapStateToPropsHelper = (containerAri, ari, state) => {
|
|
13
12
|
const reactionsState = state && state.reactions[`${containerAri}|${ari}`];
|
|
14
|
-
|
|
15
13
|
if (!state || !reactionsState) {
|
|
16
14
|
return {
|
|
17
15
|
status: ReactionStatus.notLoaded,
|
|
18
16
|
reactions: []
|
|
19
17
|
};
|
|
20
18
|
}
|
|
21
|
-
|
|
22
19
|
switch (reactionsState.status) {
|
|
23
20
|
case ReactionStatus.ready:
|
|
24
21
|
return {
|
|
@@ -26,13 +23,11 @@ export const mapStateToPropsHelper = (containerAri, ari, state) => {
|
|
|
26
23
|
status: reactionsState.status,
|
|
27
24
|
flash: state.flash[`${containerAri}|${ari}`]
|
|
28
25
|
};
|
|
29
|
-
|
|
30
26
|
case ReactionStatus.error:
|
|
31
27
|
return {
|
|
32
28
|
status: ReactionStatus.error,
|
|
33
29
|
reactions: []
|
|
34
30
|
};
|
|
35
|
-
|
|
36
31
|
default:
|
|
37
32
|
return {
|
|
38
33
|
status: ReactionStatus.loading,
|
|
@@ -40,10 +35,10 @@ export const mapStateToPropsHelper = (containerAri, ari, state) => {
|
|
|
40
35
|
};
|
|
41
36
|
}
|
|
42
37
|
};
|
|
38
|
+
|
|
43
39
|
/**
|
|
44
40
|
* Export the mapper function outside the component so easier to do unit tests
|
|
45
41
|
*/
|
|
46
|
-
|
|
47
42
|
export const mapDispatchToPropsHelper = (actions, containerAri, ari) => {
|
|
48
43
|
return {
|
|
49
44
|
loadReaction: () => {
|
|
@@ -70,22 +65,21 @@ export const ConnectedReactionsView = props => {
|
|
|
70
65
|
/**
|
|
71
66
|
* Reference to the <Reactions /> component instance mandatory props
|
|
72
67
|
*/
|
|
73
|
-
|
|
74
68
|
const [stateData, setStateData] = useState();
|
|
75
|
-
const [dispatchData, setDispatchData] = useState();
|
|
76
|
-
|
|
69
|
+
const [dispatchData, setDispatchData] = useState();
|
|
70
|
+
// compose a UFO experience object
|
|
77
71
|
const experienceInstance = useRef();
|
|
78
72
|
const {
|
|
79
73
|
createAnalyticsEvent
|
|
80
74
|
} = useAnalyticsEvents();
|
|
81
75
|
useEffect(() => {
|
|
82
76
|
experienceInstance.current = ufoExperiences.render(ari);
|
|
83
|
-
}, [ari]);
|
|
77
|
+
}, [ari]);
|
|
84
78
|
|
|
79
|
+
// abort when component gets unmounted
|
|
85
80
|
useEffect(() => {
|
|
86
81
|
return function cleanup() {
|
|
87
82
|
var _experienceInstance$c;
|
|
88
|
-
|
|
89
83
|
(_experienceInstance$c = experienceInstance.current) === null || _experienceInstance$c === void 0 ? void 0 : _experienceInstance$c.abort({
|
|
90
84
|
metadata: {
|
|
91
85
|
source: 'ConnectedReactionsView',
|
|
@@ -96,58 +90,52 @@ export const ConnectedReactionsView = props => {
|
|
|
96
90
|
});
|
|
97
91
|
};
|
|
98
92
|
}, [experienceInstance, containerAri, ari]);
|
|
93
|
+
|
|
99
94
|
/**
|
|
100
95
|
* Maps the store instance "reactions" data to the <Reactions /> component state data
|
|
101
96
|
* @param state store instance latest data
|
|
102
97
|
*/
|
|
103
|
-
|
|
104
98
|
const mapStateToProps = useCallback(state => {
|
|
105
99
|
return mapStateToPropsHelper(containerAri, ari, state);
|
|
106
100
|
}, [containerAri, ari]);
|
|
101
|
+
|
|
107
102
|
/**
|
|
108
103
|
* Map the store instance "actions" methods to the <Reactions /> component actions methods
|
|
109
104
|
* @param actions list of actions in the store instance
|
|
110
105
|
*/
|
|
111
|
-
|
|
112
106
|
const mapDispatchToProps = useCallback(actions => {
|
|
113
107
|
return mapDispatchToPropsHelper(actions, containerAri, ari);
|
|
114
108
|
}, [ari, containerAri]);
|
|
115
109
|
useEffect(() => {
|
|
116
110
|
(async () => {
|
|
117
111
|
const _store = await Promise.resolve(store);
|
|
118
|
-
|
|
119
112
|
if (_store.setCreateAnalyticsEvent && createAnalyticsEvent) {
|
|
120
113
|
_store.setCreateAnalyticsEvent(createAnalyticsEvent);
|
|
121
114
|
}
|
|
122
|
-
|
|
123
115
|
const state = mapStateToProps(_store.getState());
|
|
124
116
|
const dispatch = mapDispatchToProps(_store);
|
|
125
117
|
setStateData(state);
|
|
126
118
|
setDispatchData(dispatch);
|
|
127
119
|
})();
|
|
128
120
|
}, [createAnalyticsEvent, store, ari, containerAri, mapStateToProps, mapDispatchToProps]);
|
|
121
|
+
|
|
129
122
|
/**
|
|
130
123
|
* Listen to changes on the store data.
|
|
131
124
|
* TODO: Needs to be refactored inside the MemoryReactionsStore to different pattern, currently it relies on internal callbacks variable to trigger changes to the store.
|
|
132
125
|
* The flow that each action method triggers a call to "setState" => "triggerOnChange" => calls the callback function registered by the onChange method and de-register by the "removeOnChangeListener" method
|
|
133
126
|
*/
|
|
134
|
-
|
|
135
127
|
useEffect(() => {
|
|
136
128
|
const onChangeCallback = state => {
|
|
137
129
|
const stateProps = mapStateToProps(state);
|
|
138
130
|
setStateData(stateProps);
|
|
139
131
|
};
|
|
140
|
-
|
|
141
132
|
(async () => {
|
|
142
133
|
const _store = await Promise.resolve(store);
|
|
143
|
-
|
|
144
134
|
_store.onChange(onChangeCallback);
|
|
145
135
|
})();
|
|
146
|
-
|
|
147
136
|
return function cleanup() {
|
|
148
137
|
(async () => {
|
|
149
138
|
const _store = await Promise.resolve(store);
|
|
150
|
-
|
|
151
139
|
_store.removeOnChangeListener(onChangeCallback);
|
|
152
140
|
})();
|
|
153
141
|
};
|