@atlaskit/reactions 25.4.1 → 25.5.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 +10 -0
- package/dist/cjs/MockReactionsClient.js +2 -1
- package/dist/cjs/analytics/index.js +1 -1
- package/dist/cjs/components/Reaction/Reaction.js +6 -2
- package/dist/cjs/components/ReactionDialog/ReactionView.js +2 -6
- package/dist/cjs/components/ReactionDialog/ReactionsDialog.js +8 -97
- package/dist/cjs/components/ReactionDialog/ReactionsDialogHeader.js +17 -11
- package/dist/cjs/components/ReactionDialog/ReactionsDialogTrigger.js +49 -0
- package/dist/cjs/components/ReactionDialog/ReactionsList.js +0 -3
- package/dist/cjs/components/ReactionSummary/ReactionSummaryView.js +6 -36
- package/dist/cjs/components/ReactionTooltip/ReactionTooltip.js +9 -5
- package/dist/cjs/components/ReactionTooltip/styles.js +12 -1
- package/dist/cjs/components/Reactions/Reactions.js +28 -59
- package/dist/es2019/MockReactionsClient.js +2 -1
- package/dist/es2019/analytics/index.js +1 -1
- package/dist/es2019/components/Reaction/Reaction.js +6 -2
- package/dist/es2019/components/ReactionDialog/ReactionView.js +1 -5
- package/dist/es2019/components/ReactionDialog/ReactionsDialog.js +3 -87
- package/dist/es2019/components/ReactionDialog/ReactionsDialogHeader.js +20 -11
- package/dist/es2019/components/ReactionDialog/ReactionsDialogTrigger.js +43 -0
- package/dist/es2019/components/ReactionDialog/ReactionsList.js +0 -3
- package/dist/es2019/components/ReactionSummary/ReactionSummaryView.js +7 -35
- package/dist/es2019/components/ReactionTooltip/ReactionTooltip.js +10 -6
- package/dist/es2019/components/ReactionTooltip/styles.js +12 -1
- package/dist/es2019/components/Reactions/Reactions.js +27 -55
- package/dist/esm/MockReactionsClient.js +2 -1
- package/dist/esm/analytics/index.js +1 -1
- package/dist/esm/components/Reaction/Reaction.js +6 -2
- package/dist/esm/components/ReactionDialog/ReactionView.js +2 -6
- package/dist/esm/components/ReactionDialog/ReactionsDialog.js +9 -98
- package/dist/esm/components/ReactionDialog/ReactionsDialogHeader.js +17 -11
- package/dist/esm/components/ReactionDialog/ReactionsDialogTrigger.js +42 -0
- package/dist/esm/components/ReactionDialog/ReactionsList.js +0 -3
- package/dist/esm/components/ReactionSummary/ReactionSummaryView.js +7 -37
- package/dist/esm/components/ReactionTooltip/ReactionTooltip.js +10 -6
- package/dist/esm/components/ReactionTooltip/styles.js +12 -1
- package/dist/esm/components/Reactions/Reactions.js +29 -60
- package/dist/types/components/Reaction/Reaction.d.ts +9 -1
- package/dist/types/components/ReactionDialog/ReactionView.d.ts +2 -8
- package/dist/types/components/ReactionDialog/ReactionsDialog.d.ts +1 -2
- package/dist/types/components/ReactionDialog/ReactionsDialogTrigger.d.ts +6 -0
- package/dist/types/components/ReactionDialog/ReactionsList.d.ts +1 -3
- package/dist/types/components/ReactionSummary/ReactionSummaryView.d.ts +7 -3
- package/dist/types/components/ReactionTooltip/ReactionTooltip.d.ts +9 -1
- package/dist/types/components/ReactionTooltip/styles.d.ts +1 -0
- package/dist/types/components/Reactions/Reactions.d.ts +1 -6
- package/dist/types-ts4.5/components/Reaction/Reaction.d.ts +9 -1
- package/dist/types-ts4.5/components/ReactionDialog/ReactionView.d.ts +2 -8
- package/dist/types-ts4.5/components/ReactionDialog/ReactionsDialog.d.ts +1 -2
- package/dist/types-ts4.5/components/ReactionDialog/ReactionsDialogTrigger.d.ts +6 -0
- package/dist/types-ts4.5/components/ReactionDialog/ReactionsList.d.ts +1 -3
- package/dist/types-ts4.5/components/ReactionSummary/ReactionSummaryView.d.ts +7 -3
- package/dist/types-ts4.5/components/ReactionTooltip/ReactionTooltip.d.ts +9 -1
- package/dist/types-ts4.5/components/ReactionTooltip/styles.d.ts +1 -0
- package/dist/types-ts4.5/components/Reactions/Reactions.d.ts +1 -6
- package/package.json +1 -1
|
@@ -56,7 +56,9 @@ export const Reaction = ({
|
|
|
56
56
|
onFocused = () => {},
|
|
57
57
|
flash = false,
|
|
58
58
|
showParticleEffect = false,
|
|
59
|
-
showOpaqueBackground = false
|
|
59
|
+
showOpaqueBackground = false,
|
|
60
|
+
allowUserDialog,
|
|
61
|
+
handleOpenReactionsDialog
|
|
60
62
|
}) => {
|
|
61
63
|
const intl = useIntl();
|
|
62
64
|
const hoverStart = useRef();
|
|
@@ -123,7 +125,9 @@ export const Reaction = ({
|
|
|
123
125
|
}), jsx(ReactionTooltip, {
|
|
124
126
|
emojiName: emojiName,
|
|
125
127
|
reaction: reaction,
|
|
126
|
-
isEnabled: isTooltipEnabled
|
|
128
|
+
isEnabled: isTooltipEnabled,
|
|
129
|
+
allowUserDialog: allowUserDialog,
|
|
130
|
+
handleOpenReactionsDialog: handleOpenReactionsDialog
|
|
127
131
|
}, jsx(ReactionButton, {
|
|
128
132
|
onClick: handleClick,
|
|
129
133
|
flash: flash,
|
|
@@ -29,8 +29,6 @@ const centerSpinnerStyle = xcss({
|
|
|
29
29
|
marginTop: 'space.300'
|
|
30
30
|
});
|
|
31
31
|
export const ReactionView = ({
|
|
32
|
-
selectedEmojiId,
|
|
33
|
-
emojiProvider,
|
|
34
32
|
reaction,
|
|
35
33
|
ProfileCardWrapper
|
|
36
34
|
}) => {
|
|
@@ -42,9 +40,7 @@ export const ReactionView = ({
|
|
|
42
40
|
return jsx(TabPanel, null, jsx(Flex, {
|
|
43
41
|
direction: "column",
|
|
44
42
|
xcss: reactionViewStyle
|
|
45
|
-
}, alphabeticalNames.length === 0 ?
|
|
46
|
-
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
47
|
-
jsx(Box, {
|
|
43
|
+
}, alphabeticalNames.length === 0 ? jsx(Box, {
|
|
48
44
|
xcss: centerSpinnerStyle
|
|
49
45
|
}, jsx(Spinner, {
|
|
50
46
|
size: "large"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @jsxRuntime classic
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
|
-
import { useEffect, useState,
|
|
5
|
+
import { useEffect, useState, useCallback, useMemo } from 'react';
|
|
6
6
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
7
7
|
import { jsx } from '@emotion/react';
|
|
8
8
|
import Tabs from '@atlaskit/tabs';
|
|
@@ -17,13 +17,6 @@ import { containerStyle } from './styles';
|
|
|
17
17
|
* Test id for the Reactions modal dialog
|
|
18
18
|
*/
|
|
19
19
|
export const RENDER_MODAL_TESTID = 'render-reactions-modal';
|
|
20
|
-
const getDimensions = container => {
|
|
21
|
-
return {
|
|
22
|
-
clientWidth: container === null || container === void 0 ? void 0 : container.clientWidth,
|
|
23
|
-
scrollWidth: container === null || container === void 0 ? void 0 : container.scrollWidth,
|
|
24
|
-
scrollLeft: container === null || container === void 0 ? void 0 : container.scrollLeft
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
20
|
const modalBodyStyle = xcss({
|
|
28
21
|
marginBottom: 'space.300'
|
|
29
22
|
});
|
|
@@ -34,19 +27,11 @@ export const ReactionsDialog = ({
|
|
|
34
27
|
selectedEmojiId,
|
|
35
28
|
handleSelectReaction = () => {},
|
|
36
29
|
handlePaginationChange = () => {},
|
|
37
|
-
ProfileCardWrapper
|
|
38
|
-
handleReactionMouseEnter
|
|
30
|
+
ProfileCardWrapper
|
|
39
31
|
}) => {
|
|
40
32
|
var _currentReactions$;
|
|
41
|
-
const [elementToScroll, setElementToScroll] = useState();
|
|
42
|
-
const [reactionsContainerRef, setReactionsContainerRef] = useState(null);
|
|
43
|
-
|
|
44
|
-
// prevents accidental triggering of handlePaginationChange on initial load
|
|
45
33
|
const [hasNavigatedPages, setHasNavigatedPages] = useState(false);
|
|
46
34
|
const [currentPage, setCurrentPage] = useState(1);
|
|
47
|
-
const reactionElementsRef = useRef();
|
|
48
|
-
const observerRef = useRef();
|
|
49
|
-
const isSelectedEmojiViewed = useRef(false);
|
|
50
35
|
const totalReactionsCount = useMemo(() => {
|
|
51
36
|
return reactions.reduce((accum, current) => {
|
|
52
37
|
return accum += current === null || current === void 0 ? void 0 : current.count;
|
|
@@ -78,73 +63,6 @@ export const ReactionsDialog = ({
|
|
|
78
63
|
const reactionsBorderWidth = useMemo(() => {
|
|
79
64
|
return Math.ceil(reactions.length / NUMBER_OF_REACTIONS_TO_DISPLAY) * 100;
|
|
80
65
|
}, [reactions]);
|
|
81
|
-
|
|
82
|
-
/* Callback from IntersectionObserver to set/unset classNames based on visibility to toggle styles*/
|
|
83
|
-
const handleNavigation = useCallback(entries => {
|
|
84
|
-
entries.forEach(entry => {
|
|
85
|
-
var _dataset;
|
|
86
|
-
const element = entry.target;
|
|
87
|
-
const emojiElement = element === null || element === void 0 ? void 0 : element.querySelector('[data-emoji-id]');
|
|
88
|
-
const emojiId = emojiElement === null || emojiElement === void 0 ? void 0 : (_dataset = emojiElement.dataset) === null || _dataset === void 0 ? void 0 : _dataset.emojiId;
|
|
89
|
-
if (entry.intersectionRatio < 1) {
|
|
90
|
-
element.classList.add('disabled');
|
|
91
|
-
/*Check if selectedEmoji (passed as props based on what user selects) is out of viewport */
|
|
92
|
-
if (emojiId === selectedEmojiId && !isSelectedEmojiViewed.current) {
|
|
93
|
-
setElementToScroll(emojiElement !== null && emojiElement !== void 0 ? emojiElement : undefined);
|
|
94
|
-
}
|
|
95
|
-
} else {
|
|
96
|
-
if (emojiId === selectedEmojiId && !isSelectedEmojiViewed.current) {
|
|
97
|
-
isSelectedEmojiViewed.current = true;
|
|
98
|
-
}
|
|
99
|
-
element.classList.remove('disabled');
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
}, [selectedEmojiId]);
|
|
103
|
-
useEffect(() => {
|
|
104
|
-
if (elementToScroll && !isSelectedEmojiViewed.current && reactionsContainerRef) {
|
|
105
|
-
isSelectedEmojiViewed.current = true;
|
|
106
|
-
const parentElement = elementToScroll.closest('.reaction-elements');
|
|
107
|
-
const reactionsList = document.querySelector('#reactions-dialog-tabs-list');
|
|
108
|
-
const {
|
|
109
|
-
clientWidth
|
|
110
|
-
} = getDimensions(reactionsList);
|
|
111
|
-
const offsetLeft = parentElement === null || parentElement === void 0 ? void 0 : parentElement.offsetLeft;
|
|
112
|
-
/* which means emoji is not in viewport so scroll to it*/
|
|
113
|
-
if (reactionsList && offsetLeft > clientWidth) {
|
|
114
|
-
const scrollBy = Math.trunc(offsetLeft / clientWidth) * clientWidth;
|
|
115
|
-
reactionsList.scrollLeft += scrollBy;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}, [elementToScroll, reactionsContainerRef]);
|
|
119
|
-
|
|
120
|
-
/* Set up InterSectionObserver to observer reaction elements on navigating*/
|
|
121
|
-
useEffect(() => {
|
|
122
|
-
if (reactionsContainerRef) {
|
|
123
|
-
const options = {
|
|
124
|
-
root: reactionsContainerRef,
|
|
125
|
-
rootMargin: '0px',
|
|
126
|
-
threshold: 1.0
|
|
127
|
-
};
|
|
128
|
-
observerRef.current = new IntersectionObserver(handleNavigation, options);
|
|
129
|
-
reactionElementsRef.current = reactionsContainerRef.querySelectorAll('.reaction-elements');
|
|
130
|
-
reactionElementsRef.current && reactionElementsRef.current.length > 0 && reactionElementsRef.current.forEach(child => {
|
|
131
|
-
var _observerRef$current;
|
|
132
|
-
observerRef === null || observerRef === void 0 ? void 0 : (_observerRef$current = observerRef.current) === null || _observerRef$current === void 0 ? void 0 : _observerRef$current.observe(child);
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
return () => {
|
|
136
|
-
if (observerRef.current) {
|
|
137
|
-
observerRef.current.disconnect();
|
|
138
|
-
observerRef.current = undefined;
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
}, [reactionsContainerRef, reactions, handleNavigation, selectedEmojiId]);
|
|
142
|
-
const setRef = useCallback(node => {
|
|
143
|
-
if (!reactionsContainerRef) {
|
|
144
|
-
setReactionsContainerRef(node);
|
|
145
|
-
}
|
|
146
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
147
|
-
}, []);
|
|
148
66
|
const selectedIndex = currentReactions.findIndex(reaction => reaction.emojiId === selectedEmojiId);
|
|
149
67
|
const onTabChange = useCallback(index => {
|
|
150
68
|
if (index === selectedIndex) {
|
|
@@ -176,12 +94,10 @@ export const ReactionsDialog = ({
|
|
|
176
94
|
}), jsx(ModalBody, null, jsx(Box, {
|
|
177
95
|
xcss: modalBodyStyle
|
|
178
96
|
}, jsx("div", {
|
|
179
|
-
css: containerStyle(reactionsBorderWidth)
|
|
180
|
-
ref: setRef
|
|
97
|
+
css: containerStyle(reactionsBorderWidth)
|
|
181
98
|
}, jsx(ReactionsList, {
|
|
182
99
|
selectedEmojiId: selectedEmojiId,
|
|
183
100
|
reactions: currentReactions,
|
|
184
|
-
emojiProvider: emojiProvider,
|
|
185
101
|
ProfileCardWrapper: ProfileCardWrapper
|
|
186
102
|
}))))));
|
|
187
103
|
};
|
|
@@ -26,15 +26,16 @@ const containerEdgeAngle = {
|
|
|
26
26
|
leftEdge: 90
|
|
27
27
|
};
|
|
28
28
|
const leftNavigationStyle = xcss({
|
|
29
|
-
|
|
29
|
+
marginTop: 'space.050',
|
|
30
30
|
alignSelf: 'self-start',
|
|
31
|
-
|
|
31
|
+
paddingLeft: 'space.200',
|
|
32
|
+
paddingBottom: 'space.150'
|
|
32
33
|
});
|
|
33
34
|
const rightNavigationStyle = xcss({
|
|
34
|
-
|
|
35
|
-
marginLeft: 'auto',
|
|
35
|
+
marginTop: 'space.050',
|
|
36
36
|
alignSelf: 'self-start',
|
|
37
|
-
|
|
37
|
+
marginLeft: 'auto',
|
|
38
|
+
marginRight: 'space.100'
|
|
38
39
|
});
|
|
39
40
|
const fadedCss = (edge, theme) => css({
|
|
40
41
|
content: '""',
|
|
@@ -55,10 +56,15 @@ const customTabListStyles = css({
|
|
|
55
56
|
'div[role=tablist]': {
|
|
56
57
|
flexGrow: 1,
|
|
57
58
|
// paddingInline exists to maintain styling prior to @atlaskit/tabs update that removed baked in horizontal padding
|
|
58
|
-
paddingInline: "var(--ds-space-100, 8px)"
|
|
59
|
+
paddingInline: "var(--ds-space-100, 8px)",
|
|
60
|
+
// we add our own border bottom below since tablist border is not full width
|
|
61
|
+
'&::before': {
|
|
62
|
+
backgroundColor: 'transparent'
|
|
63
|
+
}
|
|
59
64
|
},
|
|
60
65
|
width: ' 100%',
|
|
61
|
-
alignItems: 'flex-start'
|
|
66
|
+
alignItems: 'flex-start',
|
|
67
|
+
borderBottom: `1px solid ${"var(--ds-border, #EBECF0)"}`
|
|
62
68
|
});
|
|
63
69
|
const customTabWrapper = theme => css({
|
|
64
70
|
flexShrink: 0,
|
|
@@ -167,7 +173,7 @@ export const ReactionsDialogHeader = ({
|
|
|
167
173
|
const isSinglePage = maxPages === 1;
|
|
168
174
|
const isOnFirstPage = currentPage === 1;
|
|
169
175
|
const isOnLastPage = currentPage === maxPages;
|
|
170
|
-
const
|
|
176
|
+
const handleMouseEnterTab = reaction => {
|
|
171
177
|
const {
|
|
172
178
|
emojiId
|
|
173
179
|
} = reaction;
|
|
@@ -175,6 +181,7 @@ export const ReactionsDialogHeader = ({
|
|
|
175
181
|
return;
|
|
176
182
|
}
|
|
177
183
|
(async () => {
|
|
184
|
+
// Note: not a network request e.g. ReactedUsersQuery
|
|
178
185
|
const provider = await emojiProvider;
|
|
179
186
|
const emoji = await provider.findByEmojiId({
|
|
180
187
|
shortName: '',
|
|
@@ -205,9 +212,9 @@ export const ReactionsDialogHeader = ({
|
|
|
205
212
|
})), jsx(Inline, null, jsx("div", {
|
|
206
213
|
css: customTabListStyles,
|
|
207
214
|
id: "reactions-dialog-tabs-list"
|
|
208
|
-
},
|
|
215
|
+
}, !isSinglePage && !isOnFirstPage && jsx(LeftNavigationButton, {
|
|
209
216
|
handlePreviousPage: handlePreviousPage
|
|
210
|
-
}), currentReactions.map((reaction, index) => {
|
|
217
|
+
}), jsx(TabList, null, currentReactions.map((reaction, index) => {
|
|
211
218
|
const emojiId = {
|
|
212
219
|
id: reaction.emojiId,
|
|
213
220
|
shortName: ''
|
|
@@ -222,7 +229,9 @@ export const ReactionsDialogHeader = ({
|
|
|
222
229
|
className: "reaction-elements",
|
|
223
230
|
key: reaction.emojiId,
|
|
224
231
|
"data-testid": emojiId === null || emojiId === void 0 ? void 0 : emojiId.id,
|
|
225
|
-
onMouseEnter: () =>
|
|
232
|
+
onMouseEnter: () => {
|
|
233
|
+
handleMouseEnterTab(reaction);
|
|
234
|
+
}
|
|
226
235
|
}, jsx(Tab, null, jsx(Tooltip, {
|
|
227
236
|
content: cache[reaction.emojiId],
|
|
228
237
|
canAppear: () => !!cache[reaction.emojiId]
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Tooltip from '@atlaskit/tooltip';
|
|
3
|
+
import { Pressable, xcss } from '@atlaskit/primitives';
|
|
4
|
+
import ShowMoreHorizontalIcon from '@atlaskit/icon/core/show-more-horizontal';
|
|
5
|
+
import { useIntl } from 'react-intl-next';
|
|
6
|
+
import { messages } from '../../shared/i18n';
|
|
7
|
+
const triggerStyles = xcss({
|
|
8
|
+
marginRight: 'space.050',
|
|
9
|
+
marginTop: 'space.050',
|
|
10
|
+
minWidth: '32px',
|
|
11
|
+
height: '24px',
|
|
12
|
+
borderRadius: 'border.radius.100',
|
|
13
|
+
display: 'flex',
|
|
14
|
+
justifyContent: 'center',
|
|
15
|
+
alignItems: 'center'
|
|
16
|
+
});
|
|
17
|
+
const transparentEnabledTriggerStyles = xcss({
|
|
18
|
+
borderColor: 'color.border',
|
|
19
|
+
':hover': {
|
|
20
|
+
backgroundColor: 'color.background.neutral.subtle.hovered'
|
|
21
|
+
},
|
|
22
|
+
':active': {
|
|
23
|
+
backgroundColor: 'color.background.neutral.subtle.pressed'
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
// Currently not in use due to Reactions Dialog trigger being moved to tooltip
|
|
27
|
+
// Similar to platform/packages/elements/reactions/src/components/Trigger/Trigger.tsx
|
|
28
|
+
export const ReactionsDialogTrigger = ({
|
|
29
|
+
onClick
|
|
30
|
+
}) => {
|
|
31
|
+
const intl = useIntl();
|
|
32
|
+
return /*#__PURE__*/React.createElement(Pressable, {
|
|
33
|
+
xcss: [triggerStyles, transparentEnabledTriggerStyles],
|
|
34
|
+
backgroundColor: "color.background.neutral.subtle",
|
|
35
|
+
padding: "space.0",
|
|
36
|
+
onClick: onClick,
|
|
37
|
+
"aria-label": intl.formatMessage(messages.seeWhoReactedTooltip)
|
|
38
|
+
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
39
|
+
content: intl.formatMessage(messages.seeWhoReactedTooltip)
|
|
40
|
+
}, /*#__PURE__*/React.createElement(ShowMoreHorizontalIcon, {
|
|
41
|
+
label: intl.formatMessage(messages.seeWhoReacted)
|
|
42
|
+
})));
|
|
43
|
+
};
|
|
@@ -9,7 +9,6 @@ import { ReactionView } from './ReactionView';
|
|
|
9
9
|
export const ReactionsList = ({
|
|
10
10
|
reactions,
|
|
11
11
|
selectedEmojiId,
|
|
12
|
-
emojiProvider,
|
|
13
12
|
ProfileCardWrapper
|
|
14
13
|
}) => {
|
|
15
14
|
return jsx(Box, null, reactions.map(reaction => {
|
|
@@ -17,8 +16,6 @@ export const ReactionsList = ({
|
|
|
17
16
|
return jsx(ReactionView, {
|
|
18
17
|
key: reaction.emojiId,
|
|
19
18
|
reaction: reaction,
|
|
20
|
-
selectedEmojiId: selectedEmojiId,
|
|
21
|
-
emojiProvider: emojiProvider,
|
|
22
19
|
ProfileCardWrapper: ProfileCardWrapper
|
|
23
20
|
});
|
|
24
21
|
} else {
|
|
@@ -1,25 +1,14 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { useCallback, useState } from 'react';
|
|
3
|
-
import { useIntl } from 'react-intl-next';
|
|
4
3
|
import Popup from '@atlaskit/popup';
|
|
5
|
-
import {
|
|
6
|
-
import Button from '@atlaskit/button/new';
|
|
7
|
-
import Tooltip from '@atlaskit/tooltip';
|
|
8
|
-
import ShowMoreHorizontalIcon from '@atlaskit/icon/core/show-more-horizontal';
|
|
4
|
+
import { Inline, xcss } from '@atlaskit/primitives';
|
|
9
5
|
import { Reaction } from '../Reaction';
|
|
10
6
|
import { ReactionSummaryButton } from './ReactionSummaryButton';
|
|
11
|
-
import { messages } from '../../shared/i18n';
|
|
12
7
|
const summaryPopupStyles = xcss({
|
|
13
8
|
padding: 'space.100',
|
|
14
9
|
paddingTop: 'space.050',
|
|
15
10
|
maxWidth: '325px'
|
|
16
11
|
});
|
|
17
|
-
const viewAllButtonStyling = xcss({
|
|
18
|
-
marginTop: 'space.050'
|
|
19
|
-
});
|
|
20
|
-
const iconStyle = xcss({
|
|
21
|
-
height: '20px'
|
|
22
|
-
});
|
|
23
12
|
|
|
24
13
|
/**
|
|
25
14
|
* Test id for the Reactions summary view popup
|
|
@@ -36,10 +25,9 @@ export const ReactionSummaryView = ({
|
|
|
36
25
|
onReactionMouseEnter,
|
|
37
26
|
showOpaqueBackground = false,
|
|
38
27
|
subtleReactionsSummaryAndPicker = false,
|
|
39
|
-
|
|
40
|
-
|
|
28
|
+
allowUserDialog,
|
|
29
|
+
handleOpenReactionsDialog
|
|
41
30
|
}) => {
|
|
42
|
-
const intl = useIntl();
|
|
43
31
|
const [isSummaryPopupOpen, setSummaryPopupOpen] = useState(false);
|
|
44
32
|
const handlePopupClose = useCallback(() => setSummaryPopupOpen(false), []);
|
|
45
33
|
const handleSummaryClick = useCallback(() => setSummaryPopupOpen(!isSummaryPopupOpen), [isSummaryPopupOpen]);
|
|
@@ -59,26 +47,10 @@ export const ReactionSummaryView = ({
|
|
|
59
47
|
onFocused: onReactionFocused,
|
|
60
48
|
onMouseEnter: onReactionMouseEnter,
|
|
61
49
|
flash: flash[reaction.emojiId],
|
|
62
|
-
showParticleEffect: particleEffectByEmoji[reaction.emojiId]
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
},
|
|
66
|
-
backgroundColor: "color.background.neutral.subtle",
|
|
67
|
-
padding: "space.0"
|
|
68
|
-
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
69
|
-
content: intl.formatMessage(messages.seeWhoReactedTooltip)
|
|
70
|
-
}, tooltipProps => /*#__PURE__*/React.createElement(Button, _extends({}, tooltipProps, {
|
|
71
|
-
spacing: "compact",
|
|
72
|
-
onClick: () => {
|
|
73
|
-
handlePopupClose();
|
|
74
|
-
handleOpenReactionsDialog === null || handleOpenReactionsDialog === void 0 ? void 0 : handleOpenReactionsDialog(reactions[0].emojiId);
|
|
75
|
-
}
|
|
76
|
-
}), /*#__PURE__*/React.createElement(Flex, {
|
|
77
|
-
alignItems: "center",
|
|
78
|
-
xcss: iconStyle
|
|
79
|
-
}, /*#__PURE__*/React.createElement(ShowMoreHorizontalIcon, {
|
|
80
|
-
label: intl.formatMessage(messages.seeWhoReacted)
|
|
81
|
-
}))))))),
|
|
50
|
+
showParticleEffect: particleEffectByEmoji[reaction.emojiId],
|
|
51
|
+
allowUserDialog: allowUserDialog,
|
|
52
|
+
handleOpenReactionsDialog: handleOpenReactionsDialog
|
|
53
|
+
}))),
|
|
82
54
|
isOpen: isSummaryPopupOpen,
|
|
83
55
|
onClose: handlePopupClose,
|
|
84
56
|
trigger: triggerProps => /*#__PURE__*/React.createElement(ReactionSummaryButton, _extends({}, triggerProps, {
|
|
@@ -10,7 +10,7 @@ import Tooltip from '@atlaskit/tooltip';
|
|
|
10
10
|
import { FormattedMessage } from 'react-intl-next';
|
|
11
11
|
import { TOOLTIP_USERS_LIMIT } from '../../shared/constants';
|
|
12
12
|
import { messages } from '../../shared/i18n';
|
|
13
|
-
import { emojiNameStyle, footerStyle, tooltipStyle } from './styles';
|
|
13
|
+
import { emojiNameStyle, footerStyle, tooltipStyle, underlineStyle } from './styles';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Test id for wrapper ReactionTooltip div
|
|
@@ -23,11 +23,10 @@ export const ReactionTooltip = ({
|
|
|
23
23
|
users = []
|
|
24
24
|
},
|
|
25
25
|
maxReactions = TOOLTIP_USERS_LIMIT,
|
|
26
|
-
isEnabled = true
|
|
26
|
+
isEnabled = true,
|
|
27
|
+
allowUserDialog,
|
|
28
|
+
handleOpenReactionsDialog
|
|
27
29
|
}) => {
|
|
28
|
-
/**
|
|
29
|
-
* Render list of users in the tooltip box
|
|
30
|
-
*/
|
|
31
30
|
const content = !users || users.length === 0 || !isEnabled ? null :
|
|
32
31
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values, jsx-a11y/no-noninteractive-tabindex -- Ignored via go/DSP-18766
|
|
33
32
|
jsx("div", {
|
|
@@ -41,7 +40,12 @@ export const ReactionTooltip = ({
|
|
|
41
40
|
}, user.displayName);
|
|
42
41
|
}), jsx("li", {
|
|
43
42
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
44
|
-
css: footerStyle
|
|
43
|
+
css: allowUserDialog ? [footerStyle, underlineStyle] : footerStyle,
|
|
44
|
+
onClick: () => {
|
|
45
|
+
if (allowUserDialog && handleOpenReactionsDialog) {
|
|
46
|
+
handleOpenReactionsDialog();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
45
49
|
}, users.length > maxReactions && jsx(FormattedMessage, _extends({}, messages.otherUsers, {
|
|
46
50
|
values: {
|
|
47
51
|
count: users.length - maxReactions
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
6
6
|
import { css } from '@emotion/react';
|
|
7
|
-
import { N90 } from '@atlaskit/theme/colors';
|
|
7
|
+
import { N90, N800, N0 } from '@atlaskit/theme/colors';
|
|
8
8
|
export const verticalMargin = 5;
|
|
9
9
|
|
|
10
10
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
@@ -39,4 +39,15 @@ export const emojiNameStyle = css({
|
|
|
39
39
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
40
40
|
export const footerStyle = css({
|
|
41
41
|
color: `var(--ds-text-inverse, ${N90})`
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
45
|
+
export const underlineStyle = css({
|
|
46
|
+
cursor: 'pointer',
|
|
47
|
+
textDecoration: 'underline',
|
|
48
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
49
|
+
':hover': {
|
|
50
|
+
backgroundColor: `var(--ds-background-neutral-bold, ${N800})`,
|
|
51
|
+
color: `var(--ds-text-inverse, ${N0})`
|
|
52
|
+
}
|
|
42
53
|
});
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
1
|
/**
|
|
3
2
|
* @jsxRuntime classic
|
|
4
3
|
* @jsx jsx
|
|
@@ -6,14 +5,10 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
6
5
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
7
6
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
7
|
import { jsx } from '@emotion/react';
|
|
9
|
-
import { FormattedMessage
|
|
8
|
+
import { FormattedMessage } from 'react-intl-next';
|
|
10
9
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
11
10
|
import { ModalTransition } from '@atlaskit/modal-dialog';
|
|
12
|
-
import Tooltip from '@atlaskit/tooltip';
|
|
13
|
-
import { Box, Pressable, Flex, xcss } from '@atlaskit/primitives';
|
|
14
11
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
|
-
import ShowMoreHorizontalIcon from '@atlaskit/icon/core/show-more-horizontal';
|
|
16
|
-
import Button from '@atlaskit/button/new';
|
|
17
12
|
import { createAndFireSafe, createPickerButtonClickedEvent, createPickerCancelledEvent, createPickerMoreClickedEvent, createReactionsRenderedEvent, createReactionSelectionEvent, isSampled } from '../../analytics';
|
|
18
13
|
import { SAMPLING_RATE_REACTIONS_RENDERED_EXP } from '../../shared/constants';
|
|
19
14
|
import { messages } from '../../shared/i18n';
|
|
@@ -74,13 +69,6 @@ export function getTooltip(status, errorMessage) {
|
|
|
74
69
|
return jsx(FormattedMessage, messages.addReaction);
|
|
75
70
|
}
|
|
76
71
|
}
|
|
77
|
-
const dialogEntrypointButtonStyle = xcss({
|
|
78
|
-
marginRight: 'space.050',
|
|
79
|
-
marginTop: 'space.050'
|
|
80
|
-
});
|
|
81
|
-
const iconStyle = xcss({
|
|
82
|
-
height: '20px'
|
|
83
|
-
});
|
|
84
72
|
|
|
85
73
|
/**
|
|
86
74
|
* Renders list of reactions
|
|
@@ -94,7 +82,6 @@ export const Reactions = /*#__PURE__*/React.memo(({
|
|
|
94
82
|
quickReactionEmojis,
|
|
95
83
|
pickerQuickReactionEmojiIds,
|
|
96
84
|
getReactionDetails = () => {},
|
|
97
|
-
onReactionHover = () => {},
|
|
98
85
|
onSelection,
|
|
99
86
|
reactions = [],
|
|
100
87
|
emojiProvider,
|
|
@@ -123,7 +110,6 @@ export const Reactions = /*#__PURE__*/React.memo(({
|
|
|
123
110
|
const {
|
|
124
111
|
createAnalyticsEvent
|
|
125
112
|
} = useAnalyticsEvents();
|
|
126
|
-
const intl = useIntl();
|
|
127
113
|
let openTime = useRef();
|
|
128
114
|
let renderTime = useRef();
|
|
129
115
|
useEffect(() => {
|
|
@@ -146,8 +132,7 @@ export const Reactions = /*#__PURE__*/React.memo(({
|
|
|
146
132
|
}, [createAnalyticsEvent, status]);
|
|
147
133
|
const handleReactionMouseEnter = useCallback(emojiId => {
|
|
148
134
|
getReactionDetails(emojiId);
|
|
149
|
-
|
|
150
|
-
}, [getReactionDetails, onReactionHover]);
|
|
135
|
+
}, [getReactionDetails]);
|
|
151
136
|
const handleReactionFocused = useCallback(emojiId => {
|
|
152
137
|
getReactionDetails(emojiId);
|
|
153
138
|
}, [getReactionDetails]);
|
|
@@ -167,27 +152,6 @@ export const Reactions = /*#__PURE__*/React.memo(({
|
|
|
167
152
|
openTime.current = undefined;
|
|
168
153
|
onSelection(emojiId);
|
|
169
154
|
}, [createAnalyticsEvent, onSelection, reactions]);
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* event handler to open dialog with selected reaction
|
|
173
|
-
* @param emojiId selected emoji id
|
|
174
|
-
*/
|
|
175
|
-
const handleOpenReactionsDialog = emojiId => {
|
|
176
|
-
// ufo start opening reaction dialog
|
|
177
|
-
ufoExperiences.openDialog.start();
|
|
178
|
-
getReactionDetails(emojiId);
|
|
179
|
-
setSelectedEmojiId(emojiId);
|
|
180
|
-
onDialogOpenCallback(emojiId, 'button');
|
|
181
|
-
|
|
182
|
-
// ufo opening reaction dialog success
|
|
183
|
-
ufoExperiences.openDialog.success({
|
|
184
|
-
metadata: {
|
|
185
|
-
emojiId,
|
|
186
|
-
source: 'Reactions',
|
|
187
|
-
reason: 'Opening Reactions Dialog successfully'
|
|
188
|
-
}
|
|
189
|
-
});
|
|
190
|
-
};
|
|
191
155
|
const handleCloseReactionsDialog = (e, analyticsEvent) => {
|
|
192
156
|
// ufo closing opening reaction dialog
|
|
193
157
|
ufoExperiences.closeDialog.start();
|
|
@@ -273,6 +237,27 @@ export const Reactions = /*#__PURE__*/React.memo(({
|
|
|
273
237
|
const sortedReactions = useMemo(() => {
|
|
274
238
|
return [...memorizedReactions].sort((a, b) => (b === null || b === void 0 ? void 0 : b.count) - (a === null || a === void 0 ? void 0 : a.count));
|
|
275
239
|
}, [memorizedReactions]);
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* event handler to open dialog with selected reaction
|
|
243
|
+
* @param emojiId initial emoji id to load dialog with
|
|
244
|
+
*/
|
|
245
|
+
const handleOpenReactionsDialog = (emojiId = sortedReactions[0].emojiId, source = 'endOfPageReactions') => {
|
|
246
|
+
// ufo start opening reaction dialog
|
|
247
|
+
ufoExperiences.openDialog.start();
|
|
248
|
+
getReactionDetails(emojiId);
|
|
249
|
+
setSelectedEmojiId(emojiId);
|
|
250
|
+
onDialogOpenCallback(emojiId, source);
|
|
251
|
+
|
|
252
|
+
// ufo opening reaction dialog success
|
|
253
|
+
ufoExperiences.openDialog.success({
|
|
254
|
+
metadata: {
|
|
255
|
+
emojiId,
|
|
256
|
+
source: 'Reactions',
|
|
257
|
+
reason: 'Opening Reactions Dialog successfully'
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
};
|
|
276
261
|
return (
|
|
277
262
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
278
263
|
jsx("div", {
|
|
@@ -302,23 +287,10 @@ export const Reactions = /*#__PURE__*/React.memo(({
|
|
|
302
287
|
onFocused: handleReactionFocused,
|
|
303
288
|
flash: flash[reaction.emojiId],
|
|
304
289
|
showParticleEffect: particleEffectByEmoji[reaction.emojiId],
|
|
305
|
-
showOpaqueBackground: showOpaqueBackground
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
}, jsx(
|
|
309
|
-
backgroundColor: "color.background.neutral.subtle",
|
|
310
|
-
padding: "space.0"
|
|
311
|
-
}, jsx(Tooltip, {
|
|
312
|
-
content: intl.formatMessage(messages.seeWhoReactedTooltip)
|
|
313
|
-
}, tooltipProps => jsx(Button, _extends({}, tooltipProps, {
|
|
314
|
-
spacing: "compact",
|
|
315
|
-
onClick: () => handleOpenReactionsDialog(sortedReactions[0].emojiId)
|
|
316
|
-
}), jsx(Flex, {
|
|
317
|
-
alignItems: "center",
|
|
318
|
-
xcss: iconStyle
|
|
319
|
-
}, jsx(ShowMoreHorizontalIcon, {
|
|
320
|
-
label: intl.formatMessage(messages.seeWhoReacted)
|
|
321
|
-
})))))), !isViewOnly && jsx(ReactionPicker
|
|
290
|
+
showOpaqueBackground: showOpaqueBackground,
|
|
291
|
+
allowUserDialog: allowUserDialog && hasEmojiWithFivePlusReactions,
|
|
292
|
+
handleOpenReactionsDialog: handleOpenReactionsDialog
|
|
293
|
+
}))), !isViewOnly && jsx(ReactionPicker
|
|
322
294
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
323
295
|
, {
|
|
324
296
|
css: reactionPickerStyle,
|
|
@@ -16,7 +16,8 @@ export var getReactionSummary = function getReactionSummary(shortName, count, re
|
|
|
16
16
|
containerAri: containerAri,
|
|
17
17
|
emojiId: getReactionsByShortName.id,
|
|
18
18
|
count: count,
|
|
19
|
-
reacted: reacted
|
|
19
|
+
reacted: reacted,
|
|
20
|
+
users: defaultUsers
|
|
20
21
|
};
|
|
21
22
|
};
|
|
22
23
|
export var getUser = function getUser(id, displayName) {
|
|
@@ -4,7 +4,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
import { createAndFireEvent } from '@atlaskit/analytics-next';
|
|
5
5
|
import { UI_EVENT_TYPE, OPERATIONAL_EVENT_TYPE } from '@atlaskit/analytics-gas-types';
|
|
6
6
|
var packageName = "@atlaskit/reactions";
|
|
7
|
-
var packageVersion = "25.
|
|
7
|
+
var packageVersion = "25.5.0";
|
|
8
8
|
/**
|
|
9
9
|
* TODO: move to utility package?
|
|
10
10
|
* A random sampling function
|
|
@@ -64,7 +64,9 @@ export var Reaction = function Reaction(_ref) {
|
|
|
64
64
|
_ref$showParticleEffe = _ref.showParticleEffect,
|
|
65
65
|
showParticleEffect = _ref$showParticleEffe === void 0 ? false : _ref$showParticleEffe,
|
|
66
66
|
_ref$showOpaqueBackgr = _ref.showOpaqueBackground,
|
|
67
|
-
showOpaqueBackground = _ref$showOpaqueBackgr === void 0 ? false : _ref$showOpaqueBackgr
|
|
67
|
+
showOpaqueBackground = _ref$showOpaqueBackgr === void 0 ? false : _ref$showOpaqueBackgr,
|
|
68
|
+
allowUserDialog = _ref.allowUserDialog,
|
|
69
|
+
handleOpenReactionsDialog = _ref.handleOpenReactionsDialog;
|
|
68
70
|
var intl = useIntl();
|
|
69
71
|
var hoverStart = useRef();
|
|
70
72
|
var focusStart = useRef();
|
|
@@ -146,7 +148,9 @@ export var Reaction = function Reaction(_ref) {
|
|
|
146
148
|
}), jsx(ReactionTooltip, {
|
|
147
149
|
emojiName: emojiName,
|
|
148
150
|
reaction: reaction,
|
|
149
|
-
isEnabled: isTooltipEnabled
|
|
151
|
+
isEnabled: isTooltipEnabled,
|
|
152
|
+
allowUserDialog: allowUserDialog,
|
|
153
|
+
handleOpenReactionsDialog: handleOpenReactionsDialog
|
|
150
154
|
}, jsx(ReactionButton, {
|
|
151
155
|
onClick: handleClick,
|
|
152
156
|
flash: flash,
|
|
@@ -29,9 +29,7 @@ var centerSpinnerStyle = xcss({
|
|
|
29
29
|
marginTop: 'space.300'
|
|
30
30
|
});
|
|
31
31
|
export var ReactionView = function ReactionView(_ref) {
|
|
32
|
-
var
|
|
33
|
-
emojiProvider = _ref.emojiProvider,
|
|
34
|
-
reaction = _ref.reaction,
|
|
32
|
+
var reaction = _ref.reaction,
|
|
35
33
|
ProfileCardWrapper = _ref.ProfileCardWrapper;
|
|
36
34
|
var alphabeticalNames = useMemo(function () {
|
|
37
35
|
var _reactionObj$users;
|
|
@@ -43,9 +41,7 @@ export var ReactionView = function ReactionView(_ref) {
|
|
|
43
41
|
return jsx(TabPanel, null, jsx(Flex, {
|
|
44
42
|
direction: "column",
|
|
45
43
|
xcss: reactionViewStyle
|
|
46
|
-
}, alphabeticalNames.length === 0 ?
|
|
47
|
-
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
48
|
-
jsx(Box, {
|
|
44
|
+
}, alphabeticalNames.length === 0 ? jsx(Box, {
|
|
49
45
|
xcss: centerSpinnerStyle
|
|
50
46
|
}, jsx(Spinner, {
|
|
51
47
|
size: "large"
|