@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
|
@@ -3,7 +3,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
3
3
|
* @jsxRuntime classic
|
|
4
4
|
* @jsx jsx
|
|
5
5
|
*/
|
|
6
|
-
import { useEffect, useState,
|
|
6
|
+
import { useEffect, useState, useCallback, useMemo } from 'react';
|
|
7
7
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
8
|
import { jsx } from '@emotion/react';
|
|
9
9
|
import Tabs from '@atlaskit/tabs';
|
|
@@ -18,13 +18,6 @@ import { containerStyle } from './styles';
|
|
|
18
18
|
* Test id for the Reactions modal dialog
|
|
19
19
|
*/
|
|
20
20
|
export var RENDER_MODAL_TESTID = 'render-reactions-modal';
|
|
21
|
-
var getDimensions = function getDimensions(container) {
|
|
22
|
-
return {
|
|
23
|
-
clientWidth: container === null || container === void 0 ? void 0 : container.clientWidth,
|
|
24
|
-
scrollWidth: container === null || container === void 0 ? void 0 : container.scrollWidth,
|
|
25
|
-
scrollLeft: container === null || container === void 0 ? void 0 : container.scrollLeft
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
21
|
var modalBodyStyle = xcss({
|
|
29
22
|
marginBottom: 'space.300'
|
|
30
23
|
});
|
|
@@ -40,29 +33,15 @@ export var ReactionsDialog = function ReactionsDialog(_ref) {
|
|
|
40
33
|
handleSelectReaction = _ref$handleSelectReac === void 0 ? function () {} : _ref$handleSelectReac,
|
|
41
34
|
_ref$handlePagination = _ref.handlePaginationChange,
|
|
42
35
|
handlePaginationChange = _ref$handlePagination === void 0 ? function () {} : _ref$handlePagination,
|
|
43
|
-
ProfileCardWrapper = _ref.ProfileCardWrapper
|
|
44
|
-
|
|
45
|
-
var _useState = useState(),
|
|
36
|
+
ProfileCardWrapper = _ref.ProfileCardWrapper;
|
|
37
|
+
var _useState = useState(false),
|
|
46
38
|
_useState2 = _slicedToArray(_useState, 2),
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
var _useState3 = useState(
|
|
39
|
+
hasNavigatedPages = _useState2[0],
|
|
40
|
+
setHasNavigatedPages = _useState2[1];
|
|
41
|
+
var _useState3 = useState(1),
|
|
50
42
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
// prevents accidental triggering of handlePaginationChange on initial load
|
|
55
|
-
var _useState5 = useState(false),
|
|
56
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
57
|
-
hasNavigatedPages = _useState6[0],
|
|
58
|
-
setHasNavigatedPages = _useState6[1];
|
|
59
|
-
var _useState7 = useState(1),
|
|
60
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
61
|
-
currentPage = _useState8[0],
|
|
62
|
-
setCurrentPage = _useState8[1];
|
|
63
|
-
var reactionElementsRef = useRef();
|
|
64
|
-
var observerRef = useRef();
|
|
65
|
-
var isSelectedEmojiViewed = useRef(false);
|
|
43
|
+
currentPage = _useState4[0],
|
|
44
|
+
setCurrentPage = _useState4[1];
|
|
66
45
|
var totalReactionsCount = useMemo(function () {
|
|
67
46
|
return reactions.reduce(function (accum, current) {
|
|
68
47
|
return accum += current === null || current === void 0 ? void 0 : current.count;
|
|
@@ -98,72 +77,6 @@ export var ReactionsDialog = function ReactionsDialog(_ref) {
|
|
|
98
77
|
var reactionsBorderWidth = useMemo(function () {
|
|
99
78
|
return Math.ceil(reactions.length / NUMBER_OF_REACTIONS_TO_DISPLAY) * 100;
|
|
100
79
|
}, [reactions]);
|
|
101
|
-
|
|
102
|
-
/* Callback from IntersectionObserver to set/unset classNames based on visibility to toggle styles*/
|
|
103
|
-
var handleNavigation = useCallback(function (entries) {
|
|
104
|
-
entries.forEach(function (entry) {
|
|
105
|
-
var _dataset;
|
|
106
|
-
var element = entry.target;
|
|
107
|
-
var emojiElement = element === null || element === void 0 ? void 0 : element.querySelector('[data-emoji-id]');
|
|
108
|
-
var emojiId = emojiElement === null || emojiElement === void 0 || (_dataset = emojiElement.dataset) === null || _dataset === void 0 ? void 0 : _dataset.emojiId;
|
|
109
|
-
if (entry.intersectionRatio < 1) {
|
|
110
|
-
element.classList.add('disabled');
|
|
111
|
-
/*Check if selectedEmoji (passed as props based on what user selects) is out of viewport */
|
|
112
|
-
if (emojiId === selectedEmojiId && !isSelectedEmojiViewed.current) {
|
|
113
|
-
setElementToScroll(emojiElement !== null && emojiElement !== void 0 ? emojiElement : undefined);
|
|
114
|
-
}
|
|
115
|
-
} else {
|
|
116
|
-
if (emojiId === selectedEmojiId && !isSelectedEmojiViewed.current) {
|
|
117
|
-
isSelectedEmojiViewed.current = true;
|
|
118
|
-
}
|
|
119
|
-
element.classList.remove('disabled');
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
}, [selectedEmojiId]);
|
|
123
|
-
useEffect(function () {
|
|
124
|
-
if (elementToScroll && !isSelectedEmojiViewed.current && reactionsContainerRef) {
|
|
125
|
-
isSelectedEmojiViewed.current = true;
|
|
126
|
-
var parentElement = elementToScroll.closest('.reaction-elements');
|
|
127
|
-
var reactionsList = document.querySelector('#reactions-dialog-tabs-list');
|
|
128
|
-
var _getDimensions = getDimensions(reactionsList),
|
|
129
|
-
clientWidth = _getDimensions.clientWidth;
|
|
130
|
-
var offsetLeft = parentElement === null || parentElement === void 0 ? void 0 : parentElement.offsetLeft;
|
|
131
|
-
/* which means emoji is not in viewport so scroll to it*/
|
|
132
|
-
if (reactionsList && offsetLeft > clientWidth) {
|
|
133
|
-
var scrollBy = Math.trunc(offsetLeft / clientWidth) * clientWidth;
|
|
134
|
-
reactionsList.scrollLeft += scrollBy;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}, [elementToScroll, reactionsContainerRef]);
|
|
138
|
-
|
|
139
|
-
/* Set up InterSectionObserver to observer reaction elements on navigating*/
|
|
140
|
-
useEffect(function () {
|
|
141
|
-
if (reactionsContainerRef) {
|
|
142
|
-
var options = {
|
|
143
|
-
root: reactionsContainerRef,
|
|
144
|
-
rootMargin: '0px',
|
|
145
|
-
threshold: 1.0
|
|
146
|
-
};
|
|
147
|
-
observerRef.current = new IntersectionObserver(handleNavigation, options);
|
|
148
|
-
reactionElementsRef.current = reactionsContainerRef.querySelectorAll('.reaction-elements');
|
|
149
|
-
reactionElementsRef.current && reactionElementsRef.current.length > 0 && reactionElementsRef.current.forEach(function (child) {
|
|
150
|
-
var _observerRef$current;
|
|
151
|
-
observerRef === null || observerRef === void 0 || (_observerRef$current = observerRef.current) === null || _observerRef$current === void 0 || _observerRef$current.observe(child);
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
return function () {
|
|
155
|
-
if (observerRef.current) {
|
|
156
|
-
observerRef.current.disconnect();
|
|
157
|
-
observerRef.current = undefined;
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
|
-
}, [reactionsContainerRef, reactions, handleNavigation, selectedEmojiId]);
|
|
161
|
-
var setRef = useCallback(function (node) {
|
|
162
|
-
if (!reactionsContainerRef) {
|
|
163
|
-
setReactionsContainerRef(node);
|
|
164
|
-
}
|
|
165
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
166
|
-
}, []);
|
|
167
80
|
var selectedIndex = currentReactions.findIndex(function (reaction) {
|
|
168
81
|
return reaction.emojiId === selectedEmojiId;
|
|
169
82
|
});
|
|
@@ -197,12 +110,10 @@ export var ReactionsDialog = function ReactionsDialog(_ref) {
|
|
|
197
110
|
}), jsx(ModalBody, null, jsx(Box, {
|
|
198
111
|
xcss: modalBodyStyle
|
|
199
112
|
}, jsx("div", {
|
|
200
|
-
css: containerStyle(reactionsBorderWidth)
|
|
201
|
-
ref: setRef
|
|
113
|
+
css: containerStyle(reactionsBorderWidth)
|
|
202
114
|
}, jsx(ReactionsList, {
|
|
203
115
|
selectedEmojiId: selectedEmojiId,
|
|
204
116
|
reactions: currentReactions,
|
|
205
|
-
emojiProvider: emojiProvider,
|
|
206
117
|
ProfileCardWrapper: ProfileCardWrapper
|
|
207
118
|
}))))));
|
|
208
119
|
};
|
|
@@ -32,15 +32,16 @@ var containerEdgeAngle = {
|
|
|
32
32
|
leftEdge: 90
|
|
33
33
|
};
|
|
34
34
|
var leftNavigationStyle = xcss({
|
|
35
|
-
|
|
35
|
+
marginTop: 'space.050',
|
|
36
36
|
alignSelf: 'self-start',
|
|
37
|
-
|
|
37
|
+
paddingLeft: 'space.200',
|
|
38
|
+
paddingBottom: 'space.150'
|
|
38
39
|
});
|
|
39
40
|
var rightNavigationStyle = xcss({
|
|
40
|
-
|
|
41
|
-
marginLeft: 'auto',
|
|
41
|
+
marginTop: 'space.050',
|
|
42
42
|
alignSelf: 'self-start',
|
|
43
|
-
|
|
43
|
+
marginLeft: 'auto',
|
|
44
|
+
marginRight: 'space.100'
|
|
44
45
|
});
|
|
45
46
|
var fadedCss = function fadedCss(edge, theme) {
|
|
46
47
|
return css({
|
|
@@ -63,10 +64,15 @@ var customTabListStyles = css({
|
|
|
63
64
|
'div[role=tablist]': {
|
|
64
65
|
flexGrow: 1,
|
|
65
66
|
// paddingInline exists to maintain styling prior to @atlaskit/tabs update that removed baked in horizontal padding
|
|
66
|
-
paddingInline: "var(--ds-space-100, 8px)"
|
|
67
|
+
paddingInline: "var(--ds-space-100, 8px)",
|
|
68
|
+
// we add our own border bottom below since tablist border is not full width
|
|
69
|
+
'&::before': {
|
|
70
|
+
backgroundColor: 'transparent'
|
|
71
|
+
}
|
|
67
72
|
},
|
|
68
73
|
width: ' 100%',
|
|
69
|
-
alignItems: 'flex-start'
|
|
74
|
+
alignItems: 'flex-start',
|
|
75
|
+
borderBottom: "1px solid ".concat("var(--ds-border, #EBECF0)")
|
|
70
76
|
});
|
|
71
77
|
var customTabWrapper = function customTabWrapper(theme) {
|
|
72
78
|
return css({
|
|
@@ -174,7 +180,7 @@ export var ReactionsDialogHeader = function ReactionsDialogHeader(_ref4) {
|
|
|
174
180
|
var isSinglePage = maxPages === 1;
|
|
175
181
|
var isOnFirstPage = currentPage === 1;
|
|
176
182
|
var isOnLastPage = currentPage === maxPages;
|
|
177
|
-
var
|
|
183
|
+
var handleMouseEnterTab = function handleMouseEnterTab(reaction) {
|
|
178
184
|
var emojiId = reaction.emojiId;
|
|
179
185
|
if (!emojiId || cache[emojiId]) {
|
|
180
186
|
return;
|
|
@@ -226,9 +232,9 @@ export var ReactionsDialogHeader = function ReactionsDialogHeader(_ref4) {
|
|
|
226
232
|
})), jsx(Inline, null, jsx("div", {
|
|
227
233
|
css: customTabListStyles,
|
|
228
234
|
id: "reactions-dialog-tabs-list"
|
|
229
|
-
},
|
|
235
|
+
}, !isSinglePage && !isOnFirstPage && jsx(LeftNavigationButton, {
|
|
230
236
|
handlePreviousPage: handlePreviousPage
|
|
231
|
-
}), currentReactions.map(function (reaction, index) {
|
|
237
|
+
}), jsx(TabList, null, currentReactions.map(function (reaction, index) {
|
|
232
238
|
var emojiId = {
|
|
233
239
|
id: reaction.emojiId,
|
|
234
240
|
shortName: ''
|
|
@@ -244,7 +250,7 @@ export var ReactionsDialogHeader = function ReactionsDialogHeader(_ref4) {
|
|
|
244
250
|
key: reaction.emojiId,
|
|
245
251
|
"data-testid": emojiId === null || emojiId === void 0 ? void 0 : emojiId.id,
|
|
246
252
|
onMouseEnter: function onMouseEnter() {
|
|
247
|
-
|
|
253
|
+
handleMouseEnterTab(reaction);
|
|
248
254
|
}
|
|
249
255
|
}, jsx(Tab, null, jsx(Tooltip, {
|
|
250
256
|
content: cache[reaction.emojiId],
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
var 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
|
+
var 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 var ReactionsDialogTrigger = function ReactionsDialogTrigger(_ref) {
|
|
29
|
+
var onClick = _ref.onClick;
|
|
30
|
+
var intl = useIntl();
|
|
31
|
+
return /*#__PURE__*/React.createElement(Pressable, {
|
|
32
|
+
xcss: [triggerStyles, transparentEnabledTriggerStyles],
|
|
33
|
+
backgroundColor: "color.background.neutral.subtle",
|
|
34
|
+
padding: "space.0",
|
|
35
|
+
onClick: onClick,
|
|
36
|
+
"aria-label": intl.formatMessage(messages.seeWhoReactedTooltip)
|
|
37
|
+
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
38
|
+
content: intl.formatMessage(messages.seeWhoReactedTooltip)
|
|
39
|
+
}, /*#__PURE__*/React.createElement(ShowMoreHorizontalIcon, {
|
|
40
|
+
label: intl.formatMessage(messages.seeWhoReacted)
|
|
41
|
+
})));
|
|
42
|
+
};
|
|
@@ -9,15 +9,12 @@ import { ReactionView } from './ReactionView';
|
|
|
9
9
|
export var ReactionsList = function ReactionsList(_ref) {
|
|
10
10
|
var reactions = _ref.reactions,
|
|
11
11
|
selectedEmojiId = _ref.selectedEmojiId,
|
|
12
|
-
emojiProvider = _ref.emojiProvider,
|
|
13
12
|
ProfileCardWrapper = _ref.ProfileCardWrapper;
|
|
14
13
|
return jsx(Box, null, reactions.map(function (reaction) {
|
|
15
14
|
if (reaction.emojiId === selectedEmojiId) {
|
|
16
15
|
return jsx(ReactionView, {
|
|
17
16
|
key: reaction.emojiId,
|
|
18
17
|
reaction: reaction,
|
|
19
|
-
selectedEmojiId: selectedEmojiId,
|
|
20
|
-
emojiProvider: emojiProvider,
|
|
21
18
|
ProfileCardWrapper: ProfileCardWrapper
|
|
22
19
|
});
|
|
23
20
|
} else {
|
|
@@ -1,26 +1,15 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
import React, { useCallback, useState } from 'react';
|
|
4
|
-
import { useIntl } from 'react-intl-next';
|
|
5
4
|
import Popup from '@atlaskit/popup';
|
|
6
|
-
import {
|
|
7
|
-
import Button from '@atlaskit/button/new';
|
|
8
|
-
import Tooltip from '@atlaskit/tooltip';
|
|
9
|
-
import ShowMoreHorizontalIcon from '@atlaskit/icon/core/show-more-horizontal';
|
|
5
|
+
import { Inline, xcss } from '@atlaskit/primitives';
|
|
10
6
|
import { Reaction } from '../Reaction';
|
|
11
7
|
import { ReactionSummaryButton } from './ReactionSummaryButton';
|
|
12
|
-
import { messages } from '../../shared/i18n';
|
|
13
8
|
var summaryPopupStyles = xcss({
|
|
14
9
|
padding: 'space.100',
|
|
15
10
|
paddingTop: 'space.050',
|
|
16
11
|
maxWidth: '325px'
|
|
17
12
|
});
|
|
18
|
-
var viewAllButtonStyling = xcss({
|
|
19
|
-
marginTop: 'space.050'
|
|
20
|
-
});
|
|
21
|
-
var iconStyle = xcss({
|
|
22
|
-
height: '20px'
|
|
23
|
-
});
|
|
24
13
|
|
|
25
14
|
/**
|
|
26
15
|
* Test id for the Reactions summary view popup
|
|
@@ -43,9 +32,8 @@ export var ReactionSummaryView = function ReactionSummaryView(_ref) {
|
|
|
43
32
|
showOpaqueBackground = _ref$showOpaqueBackgr === void 0 ? false : _ref$showOpaqueBackgr,
|
|
44
33
|
_ref$subtleReactionsS = _ref.subtleReactionsSummaryAndPicker,
|
|
45
34
|
subtleReactionsSummaryAndPicker = _ref$subtleReactionsS === void 0 ? false : _ref$subtleReactionsS,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
var intl = useIntl();
|
|
35
|
+
allowUserDialog = _ref.allowUserDialog,
|
|
36
|
+
handleOpenReactionsDialog = _ref.handleOpenReactionsDialog;
|
|
49
37
|
var _useState = useState(false),
|
|
50
38
|
_useState2 = _slicedToArray(_useState, 2),
|
|
51
39
|
isSummaryPopupOpen = _useState2[0],
|
|
@@ -74,29 +62,11 @@ export var ReactionSummaryView = function ReactionSummaryView(_ref) {
|
|
|
74
62
|
onFocused: onReactionFocused,
|
|
75
63
|
onMouseEnter: onReactionMouseEnter,
|
|
76
64
|
flash: flash[reaction.emojiId],
|
|
77
|
-
showParticleEffect: particleEffectByEmoji[reaction.emojiId]
|
|
65
|
+
showParticleEffect: particleEffectByEmoji[reaction.emojiId],
|
|
66
|
+
allowUserDialog: allowUserDialog,
|
|
67
|
+
handleOpenReactionsDialog: handleOpenReactionsDialog
|
|
78
68
|
});
|
|
79
|
-
})
|
|
80
|
-
xcss: viewAllButtonStyling
|
|
81
|
-
}, /*#__PURE__*/React.createElement(Pressable, {
|
|
82
|
-
backgroundColor: "color.background.neutral.subtle",
|
|
83
|
-
padding: "space.0"
|
|
84
|
-
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
85
|
-
content: intl.formatMessage(messages.seeWhoReactedTooltip)
|
|
86
|
-
}, function (tooltipProps) {
|
|
87
|
-
return /*#__PURE__*/React.createElement(Button, _extends({}, tooltipProps, {
|
|
88
|
-
spacing: "compact",
|
|
89
|
-
onClick: function onClick() {
|
|
90
|
-
handlePopupClose();
|
|
91
|
-
handleOpenReactionsDialog === null || handleOpenReactionsDialog === void 0 || handleOpenReactionsDialog(reactions[0].emojiId);
|
|
92
|
-
}
|
|
93
|
-
}), /*#__PURE__*/React.createElement(Flex, {
|
|
94
|
-
alignItems: "center",
|
|
95
|
-
xcss: iconStyle
|
|
96
|
-
}, /*#__PURE__*/React.createElement(ShowMoreHorizontalIcon, {
|
|
97
|
-
label: intl.formatMessage(messages.seeWhoReacted)
|
|
98
|
-
})));
|
|
99
|
-
}))));
|
|
69
|
+
}));
|
|
100
70
|
},
|
|
101
71
|
isOpen: isSummaryPopupOpen,
|
|
102
72
|
onClose: handlePopupClose,
|
|
@@ -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
|
|
@@ -24,10 +24,9 @@ export var ReactionTooltip = function ReactionTooltip(_ref) {
|
|
|
24
24
|
_ref$maxReactions = _ref.maxReactions,
|
|
25
25
|
maxReactions = _ref$maxReactions === void 0 ? TOOLTIP_USERS_LIMIT : _ref$maxReactions,
|
|
26
26
|
_ref$isEnabled = _ref.isEnabled,
|
|
27
|
-
isEnabled = _ref$isEnabled === void 0 ? true : _ref$isEnabled
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
*/
|
|
27
|
+
isEnabled = _ref$isEnabled === void 0 ? true : _ref$isEnabled,
|
|
28
|
+
allowUserDialog = _ref.allowUserDialog,
|
|
29
|
+
handleOpenReactionsDialog = _ref.handleOpenReactionsDialog;
|
|
31
30
|
var 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 var ReactionTooltip = function ReactionTooltip(_ref) {
|
|
|
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: function 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 var 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 var emojiNameStyle = css({
|
|
|
39
39
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
40
40
|
export var footerStyle = css({
|
|
41
41
|
color: "var(--ds-text-inverse, ".concat(N90, ")")
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
45
|
+
export var 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, ".concat(N800, ")"),
|
|
51
|
+
color: "var(--ds-text-inverse, ".concat(N0, ")")
|
|
52
|
+
}
|
|
42
53
|
});
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
3
|
/**
|
|
@@ -8,14 +7,10 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
8
7
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
9
8
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
10
9
|
import { jsx } from '@emotion/react';
|
|
11
|
-
import { FormattedMessage
|
|
10
|
+
import { FormattedMessage } from 'react-intl-next';
|
|
12
11
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
13
12
|
import { ModalTransition } from '@atlaskit/modal-dialog';
|
|
14
|
-
import Tooltip from '@atlaskit/tooltip';
|
|
15
|
-
import { Box, Pressable, Flex, xcss } from '@atlaskit/primitives';
|
|
16
13
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
17
|
-
import ShowMoreHorizontalIcon from '@atlaskit/icon/core/show-more-horizontal';
|
|
18
|
-
import Button from '@atlaskit/button/new';
|
|
19
14
|
import { createAndFireSafe, createPickerButtonClickedEvent, createPickerCancelledEvent, createPickerMoreClickedEvent, createReactionsRenderedEvent, createReactionSelectionEvent, isSampled } from '../../analytics';
|
|
20
15
|
import { SAMPLING_RATE_REACTIONS_RENDERED_EXP } from '../../shared/constants';
|
|
21
16
|
import { messages } from '../../shared/i18n';
|
|
@@ -76,13 +71,6 @@ export function getTooltip(status, errorMessage) {
|
|
|
76
71
|
return jsx(FormattedMessage, messages.addReaction);
|
|
77
72
|
}
|
|
78
73
|
}
|
|
79
|
-
var dialogEntrypointButtonStyle = xcss({
|
|
80
|
-
marginRight: 'space.050',
|
|
81
|
-
marginTop: 'space.050'
|
|
82
|
-
});
|
|
83
|
-
var iconStyle = xcss({
|
|
84
|
-
height: '20px'
|
|
85
|
-
});
|
|
86
74
|
|
|
87
75
|
/**
|
|
88
76
|
* Renders list of reactions
|
|
@@ -99,8 +87,6 @@ export var Reactions = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
99
87
|
pickerQuickReactionEmojiIds = _ref.pickerQuickReactionEmojiIds,
|
|
100
88
|
_ref$getReactionDetai = _ref.getReactionDetails,
|
|
101
89
|
getReactionDetails = _ref$getReactionDetai === void 0 ? function () {} : _ref$getReactionDetai,
|
|
102
|
-
_ref$onReactionHover = _ref.onReactionHover,
|
|
103
|
-
onReactionHover = _ref$onReactionHover === void 0 ? function () {} : _ref$onReactionHover,
|
|
104
90
|
onSelection = _ref.onSelection,
|
|
105
91
|
_ref$reactions = _ref.reactions,
|
|
106
92
|
reactions = _ref$reactions === void 0 ? [] : _ref$reactions,
|
|
@@ -146,7 +132,6 @@ export var Reactions = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
146
132
|
setSelectedEmojiId = _useState2[1];
|
|
147
133
|
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
148
134
|
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
149
|
-
var intl = useIntl();
|
|
150
135
|
var openTime = useRef();
|
|
151
136
|
var renderTime = useRef();
|
|
152
137
|
useEffect(function () {
|
|
@@ -169,8 +154,7 @@ export var Reactions = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
169
154
|
}, [createAnalyticsEvent, status]);
|
|
170
155
|
var handleReactionMouseEnter = useCallback(function (emojiId) {
|
|
171
156
|
getReactionDetails(emojiId);
|
|
172
|
-
|
|
173
|
-
}, [getReactionDetails, onReactionHover]);
|
|
157
|
+
}, [getReactionDetails]);
|
|
174
158
|
var handleReactionFocused = useCallback(function (emojiId) {
|
|
175
159
|
getReactionDetails(emojiId);
|
|
176
160
|
}, [getReactionDetails]);
|
|
@@ -192,27 +176,6 @@ export var Reactions = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
192
176
|
openTime.current = undefined;
|
|
193
177
|
onSelection(emojiId);
|
|
194
178
|
}, [createAnalyticsEvent, onSelection, reactions]);
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* event handler to open dialog with selected reaction
|
|
198
|
-
* @param emojiId selected emoji id
|
|
199
|
-
*/
|
|
200
|
-
var handleOpenReactionsDialog = function handleOpenReactionsDialog(emojiId) {
|
|
201
|
-
// ufo start opening reaction dialog
|
|
202
|
-
ufoExperiences.openDialog.start();
|
|
203
|
-
getReactionDetails(emojiId);
|
|
204
|
-
setSelectedEmojiId(emojiId);
|
|
205
|
-
onDialogOpenCallback(emojiId, 'button');
|
|
206
|
-
|
|
207
|
-
// ufo opening reaction dialog success
|
|
208
|
-
ufoExperiences.openDialog.success({
|
|
209
|
-
metadata: {
|
|
210
|
-
emojiId: emojiId,
|
|
211
|
-
source: 'Reactions',
|
|
212
|
-
reason: 'Opening Reactions Dialog successfully'
|
|
213
|
-
}
|
|
214
|
-
});
|
|
215
|
-
};
|
|
216
179
|
var handleCloseReactionsDialog = function handleCloseReactionsDialog(e, analyticsEvent) {
|
|
217
180
|
// ufo closing opening reaction dialog
|
|
218
181
|
ufoExperiences.closeDialog.start();
|
|
@@ -304,6 +267,29 @@ export var Reactions = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
304
267
|
return (b === null || b === void 0 ? void 0 : b.count) - (a === null || a === void 0 ? void 0 : a.count);
|
|
305
268
|
});
|
|
306
269
|
}, [memorizedReactions]);
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* event handler to open dialog with selected reaction
|
|
273
|
+
* @param emojiId initial emoji id to load dialog with
|
|
274
|
+
*/
|
|
275
|
+
var handleOpenReactionsDialog = function handleOpenReactionsDialog() {
|
|
276
|
+
var emojiId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : sortedReactions[0].emojiId;
|
|
277
|
+
var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'endOfPageReactions';
|
|
278
|
+
// ufo start opening reaction dialog
|
|
279
|
+
ufoExperiences.openDialog.start();
|
|
280
|
+
getReactionDetails(emojiId);
|
|
281
|
+
setSelectedEmojiId(emojiId);
|
|
282
|
+
onDialogOpenCallback(emojiId, source);
|
|
283
|
+
|
|
284
|
+
// ufo opening reaction dialog success
|
|
285
|
+
ufoExperiences.openDialog.success({
|
|
286
|
+
metadata: {
|
|
287
|
+
emojiId: emojiId,
|
|
288
|
+
source: 'Reactions',
|
|
289
|
+
reason: 'Opening Reactions Dialog successfully'
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
};
|
|
307
293
|
return (
|
|
308
294
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
309
295
|
jsx("div", {
|
|
@@ -334,28 +320,11 @@ export var Reactions = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
334
320
|
onFocused: handleReactionFocused,
|
|
335
321
|
flash: flash[reaction.emojiId],
|
|
336
322
|
showParticleEffect: particleEffectByEmoji[reaction.emojiId],
|
|
337
|
-
showOpaqueBackground: showOpaqueBackground
|
|
323
|
+
showOpaqueBackground: showOpaqueBackground,
|
|
324
|
+
allowUserDialog: allowUserDialog && hasEmojiWithFivePlusReactions,
|
|
325
|
+
handleOpenReactionsDialog: handleOpenReactionsDialog
|
|
338
326
|
});
|
|
339
|
-
})), !
|
|
340
|
-
xcss: dialogEntrypointButtonStyle
|
|
341
|
-
}, jsx(Pressable, {
|
|
342
|
-
backgroundColor: "color.background.neutral.subtle",
|
|
343
|
-
padding: "space.0"
|
|
344
|
-
}, jsx(Tooltip, {
|
|
345
|
-
content: intl.formatMessage(messages.seeWhoReactedTooltip)
|
|
346
|
-
}, function (tooltipProps) {
|
|
347
|
-
return jsx(Button, _extends({}, tooltipProps, {
|
|
348
|
-
spacing: "compact",
|
|
349
|
-
onClick: function onClick() {
|
|
350
|
-
return handleOpenReactionsDialog(sortedReactions[0].emojiId);
|
|
351
|
-
}
|
|
352
|
-
}), jsx(Flex, {
|
|
353
|
-
alignItems: "center",
|
|
354
|
-
xcss: iconStyle
|
|
355
|
-
}, jsx(ShowMoreHorizontalIcon, {
|
|
356
|
-
label: intl.formatMessage(messages.seeWhoReacted)
|
|
357
|
-
})));
|
|
358
|
-
}))), !isViewOnly && jsx(ReactionPicker
|
|
327
|
+
})), !isViewOnly && jsx(ReactionPicker
|
|
359
328
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
360
329
|
, {
|
|
361
330
|
css: reactionPickerStyle,
|
|
@@ -39,8 +39,16 @@ export interface ReactionProps {
|
|
|
39
39
|
* Optional prop for using an opaque button background instead of a transparent background
|
|
40
40
|
*/
|
|
41
41
|
showOpaqueBackground?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Optional prop for enabling the Reactions Dialog
|
|
44
|
+
*/
|
|
45
|
+
allowUserDialog?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Optional function when the user wants to open the Reactions Dialog
|
|
48
|
+
*/
|
|
49
|
+
handleOpenReactionsDialog?: (emojiId?: string, source?: string) => void;
|
|
42
50
|
}
|
|
43
51
|
/**
|
|
44
52
|
* Render an emoji reaction button
|
|
45
53
|
*/
|
|
46
|
-
export declare const Reaction: ({ emojiProvider, onClick, reaction, onMouseEnter, onFocused, flash, showParticleEffect, showOpaqueBackground, }: ReactionProps) => jsx.JSX.Element;
|
|
54
|
+
export declare const Reaction: ({ emojiProvider, onClick, reaction, onMouseEnter, onFocused, flash, showParticleEffect, showOpaqueBackground, allowUserDialog, handleOpenReactionsDialog, }: ReactionProps) => jsx.JSX.Element;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx } from '@emotion/react';
|
|
2
|
-
import { type EmojiProvider } from '@atlaskit/emoji/resource';
|
|
3
2
|
import { type ReactionSummary, type ProfileCardWrapper } from '../../types';
|
|
4
3
|
export interface ReactionViewProps {
|
|
5
4
|
/**
|
|
@@ -7,13 +6,8 @@ export interface ReactionViewProps {
|
|
|
7
6
|
*/
|
|
8
7
|
reaction: ReactionSummary;
|
|
9
8
|
/**
|
|
10
|
-
*
|
|
9
|
+
* Optional ProfileWrapper component to show profile card on hover
|
|
11
10
|
*/
|
|
12
|
-
selectedEmojiId: string;
|
|
13
|
-
/**
|
|
14
|
-
* Provider for loading emojis
|
|
15
|
-
*/
|
|
16
|
-
emojiProvider: Promise<EmojiProvider>;
|
|
17
11
|
ProfileCardWrapper?: ProfileCardWrapper;
|
|
18
12
|
}
|
|
19
|
-
export declare const ReactionView: ({
|
|
13
|
+
export declare const ReactionView: ({ reaction, ProfileCardWrapper }: ReactionViewProps) => jsx.JSX.Element;
|
|
@@ -29,6 +29,5 @@ export interface ReactionsDialogProps {
|
|
|
29
29
|
handleSelectReaction?: (emojiId: string) => void;
|
|
30
30
|
handlePaginationChange?: (emojiId: string, currentPage: number, maxPages: number) => void;
|
|
31
31
|
ProfileCardWrapper?: ProfileCardWrapper;
|
|
32
|
-
handleReactionMouseEnter?: (emojiId: string) => void;
|
|
33
32
|
}
|
|
34
|
-
export declare const ReactionsDialog: ({ reactions, handleCloseReactionsDialog, emojiProvider, selectedEmojiId, handleSelectReaction, handlePaginationChange, ProfileCardWrapper,
|
|
33
|
+
export declare const ReactionsDialog: ({ reactions, handleCloseReactionsDialog, emojiProvider, selectedEmojiId, handleSelectReaction, handlePaginationChange, ProfileCardWrapper, }: ReactionsDialogProps) => jsx.JSX.Element;
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
5
|
import { jsx } from '@emotion/react';
|
|
6
|
-
import { type EmojiProvider } from '@atlaskit/emoji/resource';
|
|
7
6
|
import { type ReactionSummary, type ProfileCardWrapper } from '../../types';
|
|
8
7
|
export interface ReactionsListProps {
|
|
9
8
|
/**
|
|
@@ -17,10 +16,9 @@ export interface ReactionsListProps {
|
|
|
17
16
|
/**
|
|
18
17
|
* Provider for loading emojis
|
|
19
18
|
*/
|
|
20
|
-
emojiProvider: Promise<EmojiProvider>;
|
|
21
19
|
/**
|
|
22
20
|
* A functional component from Confluence to show a profile card on hover
|
|
23
21
|
*/
|
|
24
22
|
ProfileCardWrapper?: ProfileCardWrapper;
|
|
25
23
|
}
|
|
26
|
-
export declare const ReactionsList: ({ reactions, selectedEmojiId,
|
|
24
|
+
export declare const ReactionsList: ({ reactions, selectedEmojiId, ProfileCardWrapper, }: ReactionsListProps) => jsx.JSX.Element;
|
|
@@ -32,9 +32,13 @@ interface ReactionSummaryViewProps extends Pick<ReactionsProps, 'emojiProvider'
|
|
|
32
32
|
*/
|
|
33
33
|
subtleReactionsSummaryAndPicker?: boolean;
|
|
34
34
|
/**
|
|
35
|
-
* Optional
|
|
35
|
+
* Optional prop for enabling the Reactions Dialog
|
|
36
36
|
*/
|
|
37
|
-
|
|
37
|
+
allowUserDialog?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Optional function when the user wants to open the Reactions Dialog
|
|
40
|
+
*/
|
|
41
|
+
handleOpenReactionsDialog?: (emojiId?: string, source?: string) => void;
|
|
38
42
|
}
|
|
39
|
-
export declare const ReactionSummaryView: ({ emojiProvider, reactions, flash, particleEffectByEmoji, placement, onReactionClick, onReactionFocused, onReactionMouseEnter, showOpaqueBackground, subtleReactionsSummaryAndPicker,
|
|
43
|
+
export declare const ReactionSummaryView: ({ emojiProvider, reactions, flash, particleEffectByEmoji, placement, onReactionClick, onReactionFocused, onReactionMouseEnter, showOpaqueBackground, subtleReactionsSummaryAndPicker, allowUserDialog, handleOpenReactionsDialog, }: ReactionSummaryViewProps) => React.JSX.Element;
|
|
40
44
|
export {};
|