@atlaskit/reactions 25.0.0 → 25.1.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/analytics/index.js +1 -1
- package/dist/cjs/components/ReactionDialog/ReactionView.js +2 -69
- package/dist/cjs/components/ReactionDialog/ReactionsDialog.js +11 -17
- package/dist/cjs/components/ReactionDialog/ReactionsDialogHeader.js +168 -94
- package/dist/cjs/components/ReactionDialog/ReactionsList.js +2 -1
- package/dist/cjs/components/ReactionSummary/ReactionSummaryView.js +16 -7
- package/dist/cjs/components/Reactions/Reactions.js +22 -11
- package/dist/cjs/shared/i18n.js +0 -5
- package/dist/es2019/analytics/index.js +1 -1
- package/dist/es2019/components/ReactionDialog/ReactionView.js +4 -48
- package/dist/es2019/components/ReactionDialog/ReactionsDialog.js +11 -17
- package/dist/es2019/components/ReactionDialog/ReactionsDialogHeader.js +129 -68
- package/dist/es2019/components/ReactionDialog/ReactionsList.js +2 -1
- package/dist/es2019/components/ReactionSummary/ReactionSummaryView.js +17 -8
- package/dist/es2019/components/Reactions/Reactions.js +23 -12
- package/dist/es2019/shared/i18n.js +0 -5
- package/dist/esm/analytics/index.js +1 -1
- package/dist/esm/components/ReactionDialog/ReactionView.js +4 -71
- package/dist/esm/components/ReactionDialog/ReactionsDialog.js +11 -17
- package/dist/esm/components/ReactionDialog/ReactionsDialogHeader.js +161 -83
- package/dist/esm/components/ReactionDialog/ReactionsList.js +2 -1
- package/dist/esm/components/ReactionSummary/ReactionSummaryView.js +18 -9
- package/dist/esm/components/Reactions/Reactions.js +24 -13
- package/dist/esm/shared/i18n.js +0 -5
- package/dist/types/components/ReactionDialog/ReactionsDialog.d.ts +2 -1
- package/dist/types/components/ReactionDialog/ReactionsDialogHeader.d.ts +3 -2
- package/dist/types/components/Reactions/Reactions.d.ts +1 -0
- package/dist/types/shared/i18n.d.ts +0 -5
- package/dist/types-ts4.5/components/ReactionDialog/ReactionsDialog.d.ts +2 -1
- package/dist/types-ts4.5/components/ReactionDialog/ReactionsDialogHeader.d.ts +3 -2
- package/dist/types-ts4.5/components/Reactions/Reactions.d.ts +1 -0
- package/dist/types-ts4.5/shared/i18n.d.ts +0 -5
- package/package.json +1 -1
|
@@ -16,10 +16,11 @@ var _react2 = require("@emotion/react");
|
|
|
16
16
|
var _reactIntlNext = require("react-intl-next");
|
|
17
17
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
18
18
|
var _modalDialog = require("@atlaskit/modal-dialog");
|
|
19
|
-
var _new = _interopRequireDefault(require("@atlaskit/button/new"));
|
|
20
19
|
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
21
20
|
var _primitives = require("@atlaskit/primitives");
|
|
22
21
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
22
|
+
var _showMoreHorizontal = _interopRequireDefault(require("@atlaskit/icon/core/show-more-horizontal"));
|
|
23
|
+
var _new = _interopRequireDefault(require("@atlaskit/button/new"));
|
|
23
24
|
var _analytics = require("../../analytics");
|
|
24
25
|
var _constants = require("../../shared/constants");
|
|
25
26
|
var _i18n = require("../../shared/i18n");
|
|
@@ -57,10 +58,6 @@ var ufoExperiences = exports.ufoExperiences = {
|
|
|
57
58
|
selectedReactionChangeInsideDialog: _ufo.ReactionDialogSelectedReactionChanged,
|
|
58
59
|
pageNavigated: _ufo.ReactionDialogPageNavigation
|
|
59
60
|
};
|
|
60
|
-
var dialogEntrypointButtonStyle = (0, _primitives.xcss)({
|
|
61
|
-
marginRight: 'space.050',
|
|
62
|
-
marginTop: 'space.050'
|
|
63
|
-
});
|
|
64
61
|
|
|
65
62
|
/**
|
|
66
63
|
* Test id for wrapper Reactions div
|
|
@@ -92,6 +89,13 @@ function getTooltip(status, errorMessage) {
|
|
|
92
89
|
return (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _i18n.messages.addReaction);
|
|
93
90
|
}
|
|
94
91
|
}
|
|
92
|
+
var dialogEntrypointButtonStyle = (0, _primitives.xcss)({
|
|
93
|
+
marginRight: 'space.050',
|
|
94
|
+
marginTop: 'space.050'
|
|
95
|
+
});
|
|
96
|
+
var iconStyle = (0, _primitives.xcss)({
|
|
97
|
+
height: '20px'
|
|
98
|
+
});
|
|
95
99
|
|
|
96
100
|
/**
|
|
97
101
|
* Renders list of reactions
|
|
@@ -149,6 +153,7 @@ var Reactions = exports.Reactions = /*#__PURE__*/_react.default.memo(function (_
|
|
|
149
153
|
setSelectedEmojiId = _useState2[1];
|
|
150
154
|
var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
|
|
151
155
|
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
156
|
+
var intl = (0, _reactIntlNext.useIntl)();
|
|
152
157
|
var openTime = (0, _react.useRef)();
|
|
153
158
|
var renderTime = (0, _react.useRef)();
|
|
154
159
|
(0, _react.useEffect)(function () {
|
|
@@ -340,18 +345,24 @@ var Reactions = exports.Reactions = /*#__PURE__*/_react.default.memo(function (_
|
|
|
340
345
|
});
|
|
341
346
|
}), allowUserDialog && hasEmojiWithFivePlusReactions && !shouldShowSummaryView && (0, _react2.jsx)(_primitives.Box, {
|
|
342
347
|
xcss: dialogEntrypointButtonStyle
|
|
348
|
+
}, (0, _react2.jsx)(_primitives.Pressable, {
|
|
349
|
+
backgroundColor: "color.background.neutral.subtle",
|
|
350
|
+
padding: "space.0"
|
|
343
351
|
}, (0, _react2.jsx)(_tooltip.default, {
|
|
344
|
-
content:
|
|
345
|
-
hideTooltipOnClick: true
|
|
352
|
+
content: intl.formatMessage(_i18n.messages.seeWhoReactedTooltip)
|
|
346
353
|
}, function (tooltipProps) {
|
|
347
354
|
return (0, _react2.jsx)(_new.default, (0, _extends2.default)({}, tooltipProps, {
|
|
348
355
|
spacing: "compact",
|
|
349
356
|
onClick: function onClick() {
|
|
350
357
|
return handleOpenReactionsDialog(sortedReactions[0].emojiId);
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
358
|
+
}
|
|
359
|
+
}), (0, _react2.jsx)(_primitives.Flex, {
|
|
360
|
+
alignItems: "center",
|
|
361
|
+
xcss: iconStyle
|
|
362
|
+
}, (0, _react2.jsx)(_showMoreHorizontal.default, {
|
|
363
|
+
label: intl.formatMessage(_i18n.messages.seeWhoReacted)
|
|
364
|
+
})));
|
|
365
|
+
}))), (0, _react2.jsx)(_ReactionPicker.ReactionPicker
|
|
355
366
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
356
367
|
, {
|
|
357
368
|
css: _styles.reactionPickerStyle,
|
package/dist/cjs/shared/i18n.js
CHANGED
|
@@ -75,10 +75,5 @@ var messages = exports.messages = (0, _reactIntlNext.defineMessages)({
|
|
|
75
75
|
id: 'reactions.dialog.viewall.tooltip',
|
|
76
76
|
defaultMessage: 'View all user reactions',
|
|
77
77
|
description: 'Tooltip content of see who reacted link'
|
|
78
|
-
},
|
|
79
|
-
peopleWhoReactedSubheading: {
|
|
80
|
-
id: 'reactions.dialog.people-who-reacted.subheader',
|
|
81
|
-
defaultMessage: 'People who reacted with {emojiShortName}',
|
|
82
|
-
description: 'Subheading that shows the user which emoji tab they are on'
|
|
83
78
|
}
|
|
84
79
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createAndFireEvent } from '@atlaskit/analytics-next';
|
|
2
2
|
import { UI_EVENT_TYPE, OPERATIONAL_EVENT_TYPE } from '@atlaskit/analytics-gas-types';
|
|
3
3
|
const packageName = "@atlaskit/reactions";
|
|
4
|
-
const packageVersion = "25.
|
|
4
|
+
const packageVersion = "25.1.0";
|
|
5
5
|
/**
|
|
6
6
|
* TODO: move to utility package?
|
|
7
7
|
* A random sampling function
|
|
@@ -1,19 +1,14 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
1
|
/**
|
|
3
2
|
* @jsxRuntime classic
|
|
4
3
|
* @jsx jsx
|
|
5
4
|
*/
|
|
6
|
-
import {
|
|
7
|
-
import { FormattedMessage } from 'react-intl-next';
|
|
5
|
+
import { useMemo } from 'react';
|
|
8
6
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
7
|
import { jsx } from '@emotion/react';
|
|
10
|
-
import { ResourcedEmoji } from '@atlaskit/emoji/element';
|
|
11
8
|
import Avatar from '@atlaskit/avatar/Avatar';
|
|
12
9
|
import Spinner from '@atlaskit/spinner';
|
|
13
10
|
import { TabPanel } from '@atlaskit/tabs';
|
|
14
|
-
import { Box, Flex, xcss
|
|
15
|
-
import Heading from '@atlaskit/heading';
|
|
16
|
-
import { messages } from '../../shared/i18n';
|
|
11
|
+
import { Box, Flex, xcss } from '@atlaskit/primitives';
|
|
17
12
|
import { userListStyle, userStyle } from './styles';
|
|
18
13
|
const userDescriptionStyle = xcss({
|
|
19
14
|
marginLeft: 'space.150'
|
|
@@ -22,7 +17,7 @@ const profileWrapperStyle = xcss({
|
|
|
22
17
|
marginLeft: 'space.0'
|
|
23
18
|
});
|
|
24
19
|
const reactionViewStyle = xcss({
|
|
25
|
-
marginTop: 'space.
|
|
20
|
+
marginTop: 'space.150',
|
|
26
21
|
minHeight: '300px',
|
|
27
22
|
minWidth: '550px'
|
|
28
23
|
});
|
|
@@ -33,33 +28,12 @@ const centerSpinnerStyle = xcss({
|
|
|
33
28
|
height: '100%',
|
|
34
29
|
marginTop: 'space.300'
|
|
35
30
|
});
|
|
36
|
-
const headerStyle = xcss({
|
|
37
|
-
alignItems: 'flex-end'
|
|
38
|
-
});
|
|
39
|
-
const emojiSpacingStlye = xcss({
|
|
40
|
-
marginLeft: 'space.100'
|
|
41
|
-
});
|
|
42
31
|
export const ReactionView = ({
|
|
43
32
|
selectedEmojiId,
|
|
44
33
|
emojiProvider,
|
|
45
34
|
reaction,
|
|
46
35
|
ProfileCardWrapper
|
|
47
36
|
}) => {
|
|
48
|
-
const [emojiName, setEmojiName] = useState('');
|
|
49
|
-
useEffect(() => {
|
|
50
|
-
(async () => {
|
|
51
|
-
const provider = await emojiProvider;
|
|
52
|
-
const emoji = await provider.findByEmojiId({
|
|
53
|
-
shortName: '',
|
|
54
|
-
id: selectedEmojiId
|
|
55
|
-
});
|
|
56
|
-
if (emoji !== null && emoji !== void 0 && emoji.name) {
|
|
57
|
-
// capitalize first letter of each string
|
|
58
|
-
const capitalizedName = emoji.name.replace(/\b\w/g, char => char.toUpperCase());
|
|
59
|
-
setEmojiName(capitalizedName);
|
|
60
|
-
}
|
|
61
|
-
})();
|
|
62
|
-
}, [emojiProvider, selectedEmojiId, reaction]);
|
|
63
37
|
const alphabeticalNames = useMemo(() => {
|
|
64
38
|
var _reactionObj$users;
|
|
65
39
|
const reactionObj = reaction;
|
|
@@ -68,25 +42,7 @@ export const ReactionView = ({
|
|
|
68
42
|
return jsx(TabPanel, null, jsx(Flex, {
|
|
69
43
|
direction: "column",
|
|
70
44
|
xcss: reactionViewStyle
|
|
71
|
-
},
|
|
72
|
-
xcss: headerStyle
|
|
73
|
-
}, jsx(Heading, {
|
|
74
|
-
size: "xsmall"
|
|
75
|
-
}, jsx(FormattedMessage, _extends({}, messages.peopleWhoReactedSubheading, {
|
|
76
|
-
values: {
|
|
77
|
-
emojiShortName: emojiName
|
|
78
|
-
}
|
|
79
|
-
}))), jsx(Box, {
|
|
80
|
-
as: "span",
|
|
81
|
-
xcss: emojiSpacingStlye
|
|
82
|
-
}, jsx(ResourcedEmoji, {
|
|
83
|
-
emojiProvider: emojiProvider,
|
|
84
|
-
emojiId: {
|
|
85
|
-
id: selectedEmojiId,
|
|
86
|
-
shortName: ''
|
|
87
|
-
},
|
|
88
|
-
fitToHeight: 24
|
|
89
|
-
}))), alphabeticalNames.length === 0 ?
|
|
45
|
+
}, alphabeticalNames.length === 0 ?
|
|
90
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
|
|
91
47
|
jsx(Box, {
|
|
92
48
|
xcss: centerSpinnerStyle
|
|
@@ -3,15 +3,12 @@
|
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
5
|
import { useEffect, useState, useRef, useCallback, useMemo } from 'react';
|
|
6
|
-
import { useIntl } from 'react-intl-next';
|
|
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
8
|
import Tabs from '@atlaskit/tabs';
|
|
10
|
-
import
|
|
9
|
+
import Modal, { ModalBody } from '@atlaskit/modal-dialog';
|
|
11
10
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
12
|
-
import Modal, { ModalBody, ModalFooter } from '@atlaskit/modal-dialog';
|
|
13
11
|
import { NUMBER_OF_REACTIONS_TO_DISPLAY } from '../../shared/constants';
|
|
14
|
-
import { messages } from '../../shared/i18n';
|
|
15
12
|
import { ReactionsList } from './ReactionsList';
|
|
16
13
|
import { ReactionsDialogHeader } from './ReactionsDialogHeader';
|
|
17
14
|
import { containerStyle } from './styles';
|
|
@@ -27,8 +24,8 @@ const getDimensions = container => {
|
|
|
27
24
|
scrollLeft: container === null || container === void 0 ? void 0 : container.scrollLeft
|
|
28
25
|
};
|
|
29
26
|
};
|
|
30
|
-
const
|
|
31
|
-
|
|
27
|
+
const modalBodyStyle = xcss({
|
|
28
|
+
marginBottom: 'space.300'
|
|
32
29
|
});
|
|
33
30
|
export const ReactionsDialog = ({
|
|
34
31
|
reactions = [],
|
|
@@ -37,7 +34,8 @@ export const ReactionsDialog = ({
|
|
|
37
34
|
selectedEmojiId,
|
|
38
35
|
handleSelectReaction = () => {},
|
|
39
36
|
handlePaginationChange = () => {},
|
|
40
|
-
ProfileCardWrapper
|
|
37
|
+
ProfileCardWrapper,
|
|
38
|
+
handleReactionMouseEnter
|
|
41
39
|
}) => {
|
|
42
40
|
var _currentReactions$;
|
|
43
41
|
const [elementToScroll, setElementToScroll] = useState();
|
|
@@ -48,7 +46,6 @@ export const ReactionsDialog = ({
|
|
|
48
46
|
const [currentPage, setCurrentPage] = useState(1);
|
|
49
47
|
const reactionElementsRef = useRef();
|
|
50
48
|
const observerRef = useRef();
|
|
51
|
-
const intl = useIntl();
|
|
52
49
|
const isSelectedEmojiViewed = useRef(false);
|
|
53
50
|
const totalReactionsCount = useMemo(() => {
|
|
54
51
|
return reactions.reduce((accum, current) => {
|
|
@@ -174,9 +171,11 @@ export const ReactionsDialog = ({
|
|
|
174
171
|
handleNextPage: handleNextPage,
|
|
175
172
|
currentPage: currentPage,
|
|
176
173
|
emojiProvider: emojiProvider,
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
}), jsx(ModalBody, null, jsx(
|
|
174
|
+
currentReactions: currentReactions,
|
|
175
|
+
handleCloseReactionsDialog: handleCloseReactionsDialog
|
|
176
|
+
}), jsx(ModalBody, null, jsx(Box, {
|
|
177
|
+
xcss: modalBodyStyle
|
|
178
|
+
}, jsx("div", {
|
|
180
179
|
css: containerStyle(reactionsBorderWidth),
|
|
181
180
|
ref: setRef
|
|
182
181
|
}, jsx(ReactionsList, {
|
|
@@ -184,10 +183,5 @@ export const ReactionsDialog = ({
|
|
|
184
183
|
reactions: currentReactions,
|
|
185
184
|
emojiProvider: emojiProvider,
|
|
186
185
|
ProfileCardWrapper: ProfileCardWrapper
|
|
187
|
-
}))))
|
|
188
|
-
xcss: footerStyle
|
|
189
|
-
}, jsx(ModalFooter, null, jsx(Button, {
|
|
190
|
-
appearance: "subtle",
|
|
191
|
-
onClick: handleCloseReactionsDialog
|
|
192
|
-
}, intl.formatMessage(messages.closeReactionsDialog)))));
|
|
186
|
+
}))))));
|
|
193
187
|
};
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
1
|
/**
|
|
3
2
|
* @jsxRuntime classic
|
|
4
3
|
* @jsx jsx
|
|
5
4
|
*/
|
|
5
|
+
import { useState } from 'react';
|
|
6
6
|
import { useIntl } from 'react-intl-next';
|
|
7
7
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
8
|
import { jsx, css } from '@emotion/react';
|
|
9
9
|
import { useThemeObserver } from '@atlaskit/tokens';
|
|
10
10
|
import { Tab, TabList } from '@atlaskit/tabs';
|
|
11
|
-
import { Box, Flex, xcss, Stack } from '@atlaskit/primitives';
|
|
11
|
+
import { Box, Flex, xcss, Stack, Inline } from '@atlaskit/primitives';
|
|
12
12
|
import { IconButton } from '@atlaskit/button/new';
|
|
13
13
|
import Heading from '@atlaskit/heading';
|
|
14
14
|
import { useModal } from '@atlaskit/modal-dialog';
|
|
15
15
|
import Tooltip from '@atlaskit/tooltip';
|
|
16
16
|
import ChevronLeftIcon from '@atlaskit/icon/utility/chevron-left';
|
|
17
17
|
import ChevronRightIcon from '@atlaskit/icon/utility/chevron-right';
|
|
18
|
+
import CloseIcon from '@atlaskit/icon/core/close';
|
|
18
19
|
import { ResourcedEmoji } from '@atlaskit/emoji/element';
|
|
19
20
|
import { messages } from '../../shared/i18n';
|
|
20
21
|
import { Counter } from '../Counter';
|
|
@@ -24,6 +25,17 @@ const containerEdgeAngle = {
|
|
|
24
25
|
rightEdge: 270,
|
|
25
26
|
leftEdge: 90
|
|
26
27
|
};
|
|
28
|
+
const leftNavigationStyle = xcss({
|
|
29
|
+
marginLeft: 'space.200',
|
|
30
|
+
alignSelf: 'self-start',
|
|
31
|
+
marginTop: 'space.050'
|
|
32
|
+
});
|
|
33
|
+
const rightNavigationStyle = xcss({
|
|
34
|
+
marginRight: 'space.100',
|
|
35
|
+
marginLeft: 'auto',
|
|
36
|
+
alignSelf: 'self-start',
|
|
37
|
+
marginTop: 'space.050'
|
|
38
|
+
});
|
|
27
39
|
const fadedCss = (edge, theme) => css({
|
|
28
40
|
content: '""',
|
|
29
41
|
position: 'absolute',
|
|
@@ -44,7 +56,9 @@ const customTabListStyles = css({
|
|
|
44
56
|
flexGrow: 1,
|
|
45
57
|
// paddingInline exists to maintain styling prior to @atlaskit/tabs update that removed baked in horizontal padding
|
|
46
58
|
paddingInline: "var(--ds-space-100, 8px)"
|
|
47
|
-
}
|
|
59
|
+
},
|
|
60
|
+
width: ' 100%',
|
|
61
|
+
alignItems: 'flex-start'
|
|
48
62
|
});
|
|
49
63
|
const customTabWrapper = theme => css({
|
|
50
64
|
flexShrink: 0,
|
|
@@ -92,47 +106,45 @@ const emojiStyles = xcss({
|
|
|
92
106
|
const counterStyle = xcss({
|
|
93
107
|
marginTop: 'space.025'
|
|
94
108
|
});
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
emojiProvider,
|
|
98
|
-
selectedEmojiId
|
|
109
|
+
const CloseButton = ({
|
|
110
|
+
handleCloseReactionsDialog
|
|
99
111
|
}) => {
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}))
|
|
112
|
+
const intl = useIntl();
|
|
113
|
+
return jsx(IconButton, {
|
|
114
|
+
onClick: handleCloseReactionsDialog,
|
|
115
|
+
icon: CloseIcon,
|
|
116
|
+
label: intl.formatMessage(messages.closeReactionsDialog),
|
|
117
|
+
appearance: "subtle",
|
|
118
|
+
isTooltipDisabled: false
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
const LeftNavigationButton = ({
|
|
122
|
+
handlePreviousPage
|
|
123
|
+
}) => {
|
|
124
|
+
const intl = useIntl();
|
|
125
|
+
return jsx(Flex, {
|
|
126
|
+
xcss: leftNavigationStyle
|
|
127
|
+
}, jsx(IconButton, {
|
|
128
|
+
spacing: "compact",
|
|
129
|
+
onClick: handlePreviousPage,
|
|
130
|
+
icon: ChevronLeftIcon,
|
|
131
|
+
label: intl.formatMessage(messages.leftNavigateLabel),
|
|
132
|
+
isTooltipDisabled: false
|
|
133
|
+
}));
|
|
134
|
+
};
|
|
135
|
+
const RightNavigationButton = ({
|
|
136
|
+
handleNextPage
|
|
137
|
+
}) => {
|
|
138
|
+
const intl = useIntl();
|
|
139
|
+
return jsx(Flex, {
|
|
140
|
+
xcss: rightNavigationStyle
|
|
141
|
+
}, jsx(IconButton, {
|
|
142
|
+
spacing: "compact",
|
|
143
|
+
onClick: handleNextPage,
|
|
144
|
+
icon: ChevronRightIcon,
|
|
145
|
+
label: intl.formatMessage(messages.rightNavigateLabel),
|
|
146
|
+
isTooltipDisabled: false
|
|
147
|
+
}));
|
|
136
148
|
};
|
|
137
149
|
export const ReactionsDialogHeader = ({
|
|
138
150
|
totalReactionsCount,
|
|
@@ -142,15 +154,42 @@ export const ReactionsDialogHeader = ({
|
|
|
142
154
|
maxPages,
|
|
143
155
|
currentReactions,
|
|
144
156
|
emojiProvider,
|
|
145
|
-
|
|
157
|
+
handleCloseReactionsDialog
|
|
146
158
|
}) => {
|
|
159
|
+
const [cache, setCache] = useState({});
|
|
147
160
|
const {
|
|
148
161
|
titleId
|
|
149
162
|
} = useModal();
|
|
150
163
|
const intl = useIntl();
|
|
164
|
+
const {
|
|
165
|
+
colorMode
|
|
166
|
+
} = useThemeObserver();
|
|
151
167
|
const isSinglePage = maxPages === 1;
|
|
152
168
|
const isOnFirstPage = currentPage === 1;
|
|
153
169
|
const isOnLastPage = currentPage === maxPages;
|
|
170
|
+
const handleHover = reaction => {
|
|
171
|
+
const {
|
|
172
|
+
emojiId
|
|
173
|
+
} = reaction;
|
|
174
|
+
if (!emojiId || cache[emojiId]) {
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
(async () => {
|
|
178
|
+
const provider = await emojiProvider;
|
|
179
|
+
const emoji = await provider.findByEmojiId({
|
|
180
|
+
shortName: '',
|
|
181
|
+
id: emojiId
|
|
182
|
+
});
|
|
183
|
+
if (emoji !== null && emoji !== void 0 && emoji.name) {
|
|
184
|
+
// capitalize first letter of each string
|
|
185
|
+
const capitalizedName = emoji.name.replace(/\b\w/g, char => char.toUpperCase());
|
|
186
|
+
setCache(prevCache => ({
|
|
187
|
+
...prevCache,
|
|
188
|
+
[emojiId]: capitalizedName
|
|
189
|
+
}));
|
|
190
|
+
}
|
|
191
|
+
})();
|
|
192
|
+
};
|
|
154
193
|
return jsx(Stack, null, jsx(Flex, {
|
|
155
194
|
direction: "row",
|
|
156
195
|
justifyContent: "space-between",
|
|
@@ -161,28 +200,50 @@ export const ReactionsDialogHeader = ({
|
|
|
161
200
|
id: titleId
|
|
162
201
|
}, intl.formatMessage(messages.reactionsCount, {
|
|
163
202
|
count: totalReactionsCount
|
|
164
|
-
})),
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
203
|
+
})), jsx(CloseButton, {
|
|
204
|
+
handleCloseReactionsDialog: handleCloseReactionsDialog
|
|
205
|
+
})), jsx(Inline, null, jsx("div", {
|
|
206
|
+
css: customTabListStyles,
|
|
207
|
+
id: "reactions-dialog-tabs-list"
|
|
208
|
+
}, jsx(TabList, null, !isSinglePage && !isOnFirstPage && jsx(LeftNavigationButton, {
|
|
209
|
+
handlePreviousPage: handlePreviousPage
|
|
210
|
+
}), currentReactions.map((reaction, index) => {
|
|
211
|
+
const emojiId = {
|
|
212
|
+
id: reaction.emojiId,
|
|
213
|
+
shortName: ''
|
|
214
|
+
};
|
|
215
|
+
return (
|
|
216
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
217
|
+
jsx("div", {
|
|
218
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
219
|
+
css: [customTabWrapper(colorMode), index === 0 ? firstElement : []]
|
|
220
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
221
|
+
,
|
|
222
|
+
className: "reaction-elements",
|
|
223
|
+
key: reaction.emojiId,
|
|
224
|
+
"data-testid": emojiId === null || emojiId === void 0 ? void 0 : emojiId.id,
|
|
225
|
+
onMouseEnter: () => handleHover(reaction)
|
|
226
|
+
}, jsx(Tab, null, jsx(Tooltip, {
|
|
227
|
+
content: cache[reaction.emojiId],
|
|
228
|
+
canAppear: () => !!cache[reaction.emojiId]
|
|
229
|
+
}, jsx(Flex, {
|
|
230
|
+
justifyContent: "center",
|
|
231
|
+
alignItems: "center",
|
|
232
|
+
direction: "row"
|
|
233
|
+
}, jsx(Box, {
|
|
234
|
+
xcss: emojiStyles
|
|
235
|
+
}, jsx(ResourcedEmoji, {
|
|
236
|
+
emojiProvider: emojiProvider,
|
|
237
|
+
emojiId: emojiId,
|
|
238
|
+
fitToHeight: 16,
|
|
239
|
+
showTooltip: true
|
|
240
|
+
})), jsx(Box, {
|
|
241
|
+
xcss: counterStyle
|
|
242
|
+
}, jsx(Counter, {
|
|
243
|
+
value: reaction.count
|
|
244
|
+
}))))))
|
|
245
|
+
);
|
|
246
|
+
}), !isSinglePage && !isOnLastPage && jsx(RightNavigationButton, {
|
|
247
|
+
handleNextPage: handleNextPage
|
|
248
|
+
})))));
|
|
188
249
|
};
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
6
6
|
import { jsx } from '@emotion/react';
|
|
7
|
+
import { Box } from '@atlaskit/primitives';
|
|
7
8
|
import { ReactionView } from './ReactionView';
|
|
8
9
|
export const ReactionsList = ({
|
|
9
10
|
reactions,
|
|
@@ -11,7 +12,7 @@ export const ReactionsList = ({
|
|
|
11
12
|
emojiProvider,
|
|
12
13
|
ProfileCardWrapper
|
|
13
14
|
}) => {
|
|
14
|
-
return jsx(
|
|
15
|
+
return jsx(Box, null, reactions.map(reaction => {
|
|
15
16
|
if (reaction.emojiId === selectedEmojiId) {
|
|
16
17
|
return jsx(ReactionView, {
|
|
17
18
|
key: reaction.emojiId,
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { useCallback, useState } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { useIntl } from 'react-intl-next';
|
|
4
4
|
import Popup from '@atlaskit/popup';
|
|
5
|
-
import { Box, Inline,
|
|
5
|
+
import { Box, Inline, Pressable, Flex, xcss } from '@atlaskit/primitives';
|
|
6
6
|
import Button from '@atlaskit/button/new';
|
|
7
7
|
import Tooltip from '@atlaskit/tooltip';
|
|
8
|
+
import ShowMoreHorizontalIcon from '@atlaskit/icon/core/show-more-horizontal';
|
|
8
9
|
import { Reaction } from '../Reaction';
|
|
9
10
|
import { ReactionSummaryButton } from './ReactionSummaryButton';
|
|
10
11
|
import { messages } from '../../shared/i18n';
|
|
@@ -16,6 +17,9 @@ const summaryPopupStyles = xcss({
|
|
|
16
17
|
const viewAllButtonStyling = xcss({
|
|
17
18
|
marginTop: 'space.050'
|
|
18
19
|
});
|
|
20
|
+
const iconStyle = xcss({
|
|
21
|
+
height: '20px'
|
|
22
|
+
});
|
|
19
23
|
|
|
20
24
|
/**
|
|
21
25
|
* Test id for the Reactions summary view popup
|
|
@@ -35,6 +39,7 @@ export const ReactionSummaryView = ({
|
|
|
35
39
|
handleOpenReactionsDialog,
|
|
36
40
|
allowUserDialog
|
|
37
41
|
}) => {
|
|
42
|
+
const intl = useIntl();
|
|
38
43
|
const [isSummaryPopupOpen, setSummaryPopupOpen] = useState(false);
|
|
39
44
|
const handlePopupClose = useCallback(() => setSummaryPopupOpen(false), []);
|
|
40
45
|
const handleSummaryClick = useCallback(() => setSummaryPopupOpen(!isSummaryPopupOpen), [isSummaryPopupOpen]);
|
|
@@ -57,19 +62,23 @@ export const ReactionSummaryView = ({
|
|
|
57
62
|
showParticleEffect: particleEffectByEmoji[reaction.emojiId]
|
|
58
63
|
})), allowUserDialog && /*#__PURE__*/React.createElement(Box, {
|
|
59
64
|
xcss: viewAllButtonStyling
|
|
65
|
+
}, /*#__PURE__*/React.createElement(Pressable, {
|
|
66
|
+
backgroundColor: "color.background.neutral.subtle",
|
|
67
|
+
padding: "space.0"
|
|
60
68
|
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
61
|
-
content:
|
|
62
|
-
hideTooltipOnClick: true
|
|
69
|
+
content: intl.formatMessage(messages.seeWhoReactedTooltip)
|
|
63
70
|
}, tooltipProps => /*#__PURE__*/React.createElement(Button, _extends({}, tooltipProps, {
|
|
64
71
|
spacing: "compact",
|
|
65
72
|
onClick: () => {
|
|
66
73
|
handlePopupClose();
|
|
67
74
|
handleOpenReactionsDialog === null || handleOpenReactionsDialog === void 0 ? void 0 : handleOpenReactionsDialog(reactions[0].emojiId);
|
|
68
75
|
}
|
|
69
|
-
}), /*#__PURE__*/React.createElement(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}, /*#__PURE__*/React.createElement(
|
|
76
|
+
}), /*#__PURE__*/React.createElement(Flex, {
|
|
77
|
+
alignItems: "center",
|
|
78
|
+
xcss: iconStyle
|
|
79
|
+
}, /*#__PURE__*/React.createElement(ShowMoreHorizontalIcon, {
|
|
80
|
+
label: intl.formatMessage(messages.seeWhoReacted)
|
|
81
|
+
}))))))),
|
|
73
82
|
isOpen: isSummaryPopupOpen,
|
|
74
83
|
onClose: handlePopupClose,
|
|
75
84
|
trigger: triggerProps => /*#__PURE__*/React.createElement(ReactionSummaryButton, _extends({}, triggerProps, {
|