@atlaskit/reactions 21.8.0 → 22.0.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 +32 -0
- package/dist/cjs/MockReactionsClient.js +24 -16
- package/dist/cjs/analytics/analytics.js +9 -1
- package/dist/cjs/analytics/ufo.js +24 -2
- package/dist/cjs/components/Counter/Counter.js +16 -20
- package/dist/cjs/components/Reaction/Reaction.js +52 -18
- package/dist/cjs/components/Reaction/styles.js +8 -1
- package/dist/cjs/components/ReactionDialog/ReactionView.js +121 -0
- package/dist/cjs/components/ReactionDialog/ReactionsDialog.js +187 -0
- package/dist/cjs/components/ReactionDialog/ReactionsList.js +104 -0
- package/dist/cjs/components/ReactionDialog/index.js +13 -0
- package/dist/cjs/components/ReactionDialog/styles.js +202 -0
- package/dist/cjs/components/ReactionPicker/ReactionPicker.js +15 -20
- package/dist/cjs/components/ReactionTooltip/ReactionTooltip.js +26 -12
- package/dist/cjs/components/ReactionTooltip/styles.js +11 -2
- package/dist/cjs/components/Reactions/Reactions.js +166 -21
- package/dist/cjs/components/Reactions/styles.js +11 -6
- package/dist/cjs/components/Trigger/Trigger.js +1 -2
- package/dist/cjs/components/index.js +9 -1
- package/dist/cjs/containers/ConnectedReactionPicker/ConnectedReactionPicker.js +6 -2
- package/dist/cjs/containers/ConnectedReactionsView/ConnectedReactionsView.js +9 -4
- package/dist/cjs/shared/constants.js +62 -10
- package/dist/cjs/shared/i18n.js +40 -0
- package/dist/cjs/shared/utils.js +60 -2
- package/dist/cjs/types/reaction.js +13 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/MockReactionsClient.js +22 -14
- package/dist/es2019/analytics/analytics.js +3 -0
- package/dist/es2019/analytics/ufo.js +19 -0
- package/dist/es2019/components/Counter/Counter.js +16 -15
- package/dist/es2019/components/Reaction/Reaction.js +43 -18
- package/dist/es2019/components/Reaction/styles.js +9 -2
- package/dist/es2019/components/ReactionDialog/ReactionView.js +69 -0
- package/dist/es2019/components/ReactionDialog/ReactionsDialog.js +145 -0
- package/dist/es2019/components/ReactionDialog/ReactionsList.js +69 -0
- package/dist/es2019/components/ReactionDialog/index.js +1 -0
- package/dist/es2019/components/ReactionDialog/styles.js +169 -0
- package/dist/es2019/components/ReactionPicker/ReactionPicker.js +12 -20
- package/dist/es2019/components/ReactionTooltip/ReactionTooltip.js +22 -12
- package/dist/es2019/components/ReactionTooltip/styles.js +9 -1
- package/dist/es2019/components/Reactions/Reactions.js +146 -22
- package/dist/es2019/components/Reactions/styles.js +9 -5
- package/dist/es2019/components/Trigger/Trigger.js +1 -2
- package/dist/es2019/components/index.js +2 -1
- package/dist/es2019/containers/ConnectedReactionPicker/ConnectedReactionPicker.js +8 -2
- package/dist/es2019/containers/ConnectedReactionsView/ConnectedReactionsView.js +5 -4
- package/dist/es2019/shared/constants.js +55 -6
- package/dist/es2019/shared/i18n.js +43 -0
- package/dist/es2019/shared/utils.js +51 -0
- package/dist/es2019/types/reaction.js +13 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/MockReactionsClient.js +24 -13
- package/dist/esm/analytics/analytics.js +5 -0
- package/dist/esm/analytics/ufo.js +19 -0
- package/dist/esm/components/Counter/Counter.js +17 -17
- package/dist/esm/components/Reaction/Reaction.js +51 -19
- package/dist/esm/components/Reaction/styles.js +9 -2
- package/dist/esm/components/ReactionDialog/ReactionView.js +98 -0
- package/dist/esm/components/ReactionDialog/ReactionsDialog.js +161 -0
- package/dist/esm/components/ReactionDialog/ReactionsList.js +79 -0
- package/dist/esm/components/ReactionDialog/index.js +1 -0
- package/dist/esm/components/ReactionDialog/styles.js +177 -0
- package/dist/esm/components/ReactionPicker/ReactionPicker.js +15 -20
- package/dist/esm/components/ReactionTooltip/ReactionTooltip.js +26 -12
- package/dist/esm/components/ReactionTooltip/styles.js +9 -1
- package/dist/esm/components/Reactions/Reactions.js +158 -22
- package/dist/esm/components/Reactions/styles.js +9 -5
- package/dist/esm/components/Trigger/Trigger.js +1 -2
- package/dist/esm/components/index.js +2 -1
- package/dist/esm/containers/ConnectedReactionPicker/ConnectedReactionPicker.js +6 -2
- package/dist/esm/containers/ConnectedReactionsView/ConnectedReactionsView.js +8 -4
- package/dist/esm/shared/constants.js +57 -6
- package/dist/esm/shared/i18n.js +40 -0
- package/dist/esm/shared/utils.js +53 -0
- package/dist/esm/types/reaction.js +13 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/MockReactionsClient.d.ts +7 -3
- package/dist/types/analytics/analytics.d.ts +10 -0
- package/dist/types/analytics/ufo.d.ts +18 -2
- package/dist/types/components/Counter/Counter.d.ts +0 -1
- package/dist/types/components/Reaction/Reaction.d.ts +11 -1
- package/dist/types/components/ReactionDialog/ReactionView.d.ts +19 -0
- package/dist/types/components/ReactionDialog/ReactionsDialog.d.ts +32 -0
- package/dist/types/components/ReactionDialog/ReactionsList.d.ts +23 -0
- package/dist/types/components/ReactionDialog/index.d.ts +1 -0
- package/dist/types/components/ReactionDialog/styles.d.ts +11 -0
- package/dist/types/components/ReactionPicker/ReactionPicker.d.ts +5 -0
- package/dist/types/components/ReactionTooltip/ReactionTooltip.d.ts +12 -0
- package/dist/types/components/ReactionTooltip/styles.d.ts +1 -0
- package/dist/types/components/Reactions/Reactions.d.ts +45 -6
- package/dist/types/components/Reactions/styles.d.ts +1 -0
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/containers/ConnectedReactionPicker/ConnectedReactionPicker.d.ts +0 -4
- package/dist/types/containers/ConnectedReactionsView/ConnectedReactionsView.d.ts +2 -11
- package/dist/types/index.d.ts +1 -1
- package/dist/types/shared/constants.d.ts +11 -5
- package/dist/types/shared/i18n.d.ts +40 -0
- package/dist/types/shared/utils.d.ts +7 -0
- package/dist/types/types/User.d.ts +10 -0
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types/types/reaction.d.ts +15 -2
- package/docs/0-intro.tsx +3 -0
- package/docs/5-graphql-support.tsx +153 -0
- package/package.json +11 -18
- package/dist/types-ts4.0/MockReactionsClient.d.ts +0 -23
- package/dist/types-ts4.0/analytics/analytics.d.ts +0 -102
- package/dist/types-ts4.0/analytics/constants.d.ts +0 -1
- package/dist/types-ts4.0/analytics/index.d.ts +0 -2
- package/dist/types-ts4.0/analytics/ufo.d.ts +0 -40
- package/dist/types-ts4.0/client/ReactionServiceClient.d.ts +0 -35
- package/dist/types-ts4.0/client/index.d.ts +0 -1
- package/dist/types-ts4.0/components/Counter/Counter.d.ts +0 -45
- package/dist/types-ts4.0/components/Counter/index.d.ts +0 -3
- package/dist/types-ts4.0/components/Counter/styles.d.ts +0 -3
- package/dist/types-ts4.0/components/EmojiButton/EmojiButton.d.ts +0 -22
- package/dist/types-ts4.0/components/EmojiButton/index.d.ts +0 -2
- package/dist/types-ts4.0/components/EmojiButton/styles.d.ts +0 -1
- package/dist/types-ts4.0/components/FlashAnimation/FlashAnimation.d.ts +0 -20
- package/dist/types-ts4.0/components/FlashAnimation/index.d.ts +0 -2
- package/dist/types-ts4.0/components/FlashAnimation/styles.d.ts +0 -5
- package/dist/types-ts4.0/components/Reaction/Reaction.d.ts +0 -38
- package/dist/types-ts4.0/components/Reaction/index.d.ts +0 -2
- package/dist/types-ts4.0/components/Reaction/styles.d.ts +0 -10
- package/dist/types-ts4.0/components/ReactionPicker/ReactionPicker.d.ts +0 -50
- package/dist/types-ts4.0/components/ReactionPicker/index.d.ts +0 -2
- package/dist/types-ts4.0/components/ReactionPicker/styles.d.ts +0 -3
- package/dist/types-ts4.0/components/ReactionTooltip/ReactionTooltip.d.ts +0 -22
- package/dist/types-ts4.0/components/ReactionTooltip/index.d.ts +0 -2
- package/dist/types-ts4.0/components/ReactionTooltip/styles.d.ts +0 -4
- package/dist/types-ts4.0/components/Reactions/Reactions.d.ts +0 -57
- package/dist/types-ts4.0/components/Reactions/index.d.ts +0 -2
- package/dist/types-ts4.0/components/Reactions/styles.d.ts +0 -2
- package/dist/types-ts4.0/components/Selector/Selector.d.ts +0 -34
- package/dist/types-ts4.0/components/Selector/index.d.ts +0 -3
- package/dist/types-ts4.0/components/Selector/styles.d.ts +0 -12
- package/dist/types-ts4.0/components/ShowMore/ShowMore.d.ts +0 -35
- package/dist/types-ts4.0/components/ShowMore/index.d.ts +0 -2
- package/dist/types-ts4.0/components/ShowMore/styles.d.ts +0 -3
- package/dist/types-ts4.0/components/Trigger/Trigger.d.ts +0 -35
- package/dist/types-ts4.0/components/Trigger/index.d.ts +0 -2
- package/dist/types-ts4.0/components/Trigger/styles.d.ts +0 -5
- package/dist/types-ts4.0/components/UfoErrorBoundary/UfoErrorBoundary.d.ts +0 -16
- package/dist/types-ts4.0/components/UfoErrorBoundary/index.d.ts +0 -2
- package/dist/types-ts4.0/components/index.d.ts +0 -8
- package/dist/types-ts4.0/containers/ConnectedReactionPicker/ConnectedReactionPicker.d.ts +0 -27
- package/dist/types-ts4.0/containers/ConnectedReactionPicker/index.d.ts +0 -2
- package/dist/types-ts4.0/containers/ConnectedReactionsView/ConnectedReactionsView.d.ts +0 -52
- package/dist/types-ts4.0/containers/ConnectedReactionsView/index.d.ts +0 -2
- package/dist/types-ts4.0/containers/index.d.ts +0 -2
- package/dist/types-ts4.0/hooks/index.d.ts +0 -1
- package/dist/types-ts4.0/hooks/useClickAway.d.ts +0 -9
- package/dist/types-ts4.0/i18n/cs.d.ts +0 -13
- package/dist/types-ts4.0/i18n/da.d.ts +0 -13
- package/dist/types-ts4.0/i18n/de.d.ts +0 -13
- package/dist/types-ts4.0/i18n/en.d.ts +0 -7
- package/dist/types-ts4.0/i18n/en_GB.d.ts +0 -7
- package/dist/types-ts4.0/i18n/en_ZZ.d.ts +0 -13
- package/dist/types-ts4.0/i18n/es.d.ts +0 -13
- package/dist/types-ts4.0/i18n/et.d.ts +0 -12
- package/dist/types-ts4.0/i18n/fi.d.ts +0 -13
- package/dist/types-ts4.0/i18n/fr.d.ts +0 -13
- package/dist/types-ts4.0/i18n/hu.d.ts +0 -13
- package/dist/types-ts4.0/i18n/index.d.ts +0 -35
- package/dist/types-ts4.0/i18n/is.d.ts +0 -6
- package/dist/types-ts4.0/i18n/it.d.ts +0 -13
- package/dist/types-ts4.0/i18n/ja.d.ts +0 -13
- package/dist/types-ts4.0/i18n/ko.d.ts +0 -13
- package/dist/types-ts4.0/i18n/languages.d.ts +0 -27
- package/dist/types-ts4.0/i18n/nb.d.ts +0 -13
- package/dist/types-ts4.0/i18n/nl.d.ts +0 -13
- package/dist/types-ts4.0/i18n/pl.d.ts +0 -13
- package/dist/types-ts4.0/i18n/pt_BR.d.ts +0 -13
- package/dist/types-ts4.0/i18n/pt_PT.d.ts +0 -12
- package/dist/types-ts4.0/i18n/ro.d.ts +0 -6
- package/dist/types-ts4.0/i18n/ru.d.ts +0 -13
- package/dist/types-ts4.0/i18n/sk.d.ts +0 -12
- package/dist/types-ts4.0/i18n/sv.d.ts +0 -13
- package/dist/types-ts4.0/i18n/th.d.ts +0 -13
- package/dist/types-ts4.0/i18n/tr.d.ts +0 -13
- package/dist/types-ts4.0/i18n/uk.d.ts +0 -13
- package/dist/types-ts4.0/i18n/vi.d.ts +0 -13
- package/dist/types-ts4.0/i18n/zh.d.ts +0 -13
- package/dist/types-ts4.0/i18n/zh_TW.d.ts +0 -13
- package/dist/types-ts4.0/index.d.ts +0 -7
- package/dist/types-ts4.0/shared/constants.d.ts +0 -21
- package/dist/types-ts4.0/shared/i18n.d.ts +0 -32
- package/dist/types-ts4.0/shared/index.d.ts +0 -3
- package/dist/types-ts4.0/shared/utils.d.ts +0 -11
- package/dist/types-ts4.0/store/MemoryReactionsStore.d.ts +0 -94
- package/dist/types-ts4.0/store/ReactionConsumer.d.ts +0 -57
- package/dist/types-ts4.0/store/batched.d.ts +0 -2
- package/dist/types-ts4.0/store/index.d.ts +0 -3
- package/dist/types-ts4.0/store/utils.d.ts +0 -11
- package/dist/types-ts4.0/types/Actions.d.ts +0 -27
- package/dist/types-ts4.0/types/Updater.d.ts +0 -1
- package/dist/types-ts4.0/types/User.d.ts +0 -10
- package/dist/types-ts4.0/types/client.d.ts +0 -38
- package/dist/types-ts4.0/types/index.d.ts +0 -7
- package/dist/types-ts4.0/types/reaction.d.ts +0 -100
- package/dist/types-ts4.0/types/store.d.ts +0 -63
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
5
|
+
|
|
6
|
+
/** @jsx jsx */
|
|
7
|
+
import { useEffect, useState, useMemo } from 'react';
|
|
8
|
+
import { useIntl } from 'react-intl-next';
|
|
9
|
+
import { jsx } from '@emotion/react';
|
|
10
|
+
import { ResourcedEmoji } from '@atlaskit/emoji/element';
|
|
11
|
+
import Avatar from '@atlaskit/avatar/Avatar';
|
|
12
|
+
import Spinner from '@atlaskit/spinner';
|
|
13
|
+
import { useTabPanel } from '@atlaskit/tabs';
|
|
14
|
+
import { i18n } from '../../shared';
|
|
15
|
+
import { reactionViewStyle, userListStyle, userStyle, centerSpinner } from './styles';
|
|
16
|
+
export var ReactionView = function ReactionView(_ref) {
|
|
17
|
+
var selectedEmojiId = _ref.selectedEmojiId,
|
|
18
|
+
emojiProvider = _ref.emojiProvider,
|
|
19
|
+
reaction = _ref.reaction;
|
|
20
|
+
var intl = useIntl();
|
|
21
|
+
|
|
22
|
+
var _useState = useState(''),
|
|
23
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
24
|
+
emojiName = _useState2[0],
|
|
25
|
+
setEmojiName = _useState2[1];
|
|
26
|
+
|
|
27
|
+
useEffect(function () {
|
|
28
|
+
_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
29
|
+
var provider, emoji;
|
|
30
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
31
|
+
while (1) {
|
|
32
|
+
switch (_context.prev = _context.next) {
|
|
33
|
+
case 0:
|
|
34
|
+
_context.next = 2;
|
|
35
|
+
return emojiProvider;
|
|
36
|
+
|
|
37
|
+
case 2:
|
|
38
|
+
provider = _context.sent;
|
|
39
|
+
_context.next = 5;
|
|
40
|
+
return provider.findByEmojiId({
|
|
41
|
+
shortName: '',
|
|
42
|
+
id: selectedEmojiId
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
case 5:
|
|
46
|
+
emoji = _context.sent;
|
|
47
|
+
|
|
48
|
+
if (emoji && emoji.name) {
|
|
49
|
+
setEmojiName(emoji.name);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
case 7:
|
|
53
|
+
case "end":
|
|
54
|
+
return _context.stop();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}, _callee);
|
|
58
|
+
}))();
|
|
59
|
+
}, [emojiProvider, selectedEmojiId]);
|
|
60
|
+
var alphabeticalNames = useMemo(function () {
|
|
61
|
+
var _reactionObj$users;
|
|
62
|
+
|
|
63
|
+
var reactionObj = reaction;
|
|
64
|
+
return ((_reactionObj$users = reactionObj.users) === null || _reactionObj$users === void 0 ? void 0 : _reactionObj$users.sort(function (a, b) {
|
|
65
|
+
return a.displayName.localeCompare(b.displayName);
|
|
66
|
+
})) || [];
|
|
67
|
+
}, [reaction]);
|
|
68
|
+
var tabPanelAttributes = useTabPanel();
|
|
69
|
+
return jsx("div", _extends({
|
|
70
|
+
css: reactionViewStyle
|
|
71
|
+
}, tabPanelAttributes), jsx("p", null, jsx(ResourcedEmoji, {
|
|
72
|
+
emojiProvider: emojiProvider,
|
|
73
|
+
emojiId: {
|
|
74
|
+
id: selectedEmojiId,
|
|
75
|
+
shortName: ''
|
|
76
|
+
},
|
|
77
|
+
fitToHeight: 24
|
|
78
|
+
}), intl.formatMessage(i18n.messages.emojiName, {
|
|
79
|
+
emojiName: emojiName
|
|
80
|
+
})), alphabeticalNames.length === 0 ? jsx("div", {
|
|
81
|
+
css: centerSpinner
|
|
82
|
+
}, jsx(Spinner, {
|
|
83
|
+
size: "large"
|
|
84
|
+
})) : jsx("ul", {
|
|
85
|
+
css: userListStyle
|
|
86
|
+
}, alphabeticalNames.map(function (user) {
|
|
87
|
+
var _user$profilePicture;
|
|
88
|
+
|
|
89
|
+
var profile = (_user$profilePicture = user.profilePicture) === null || _user$profilePicture === void 0 ? void 0 : _user$profilePicture.path;
|
|
90
|
+
return jsx("li", {
|
|
91
|
+
css: userStyle,
|
|
92
|
+
key: user.id
|
|
93
|
+
}, jsx(Avatar, {
|
|
94
|
+
size: "large",
|
|
95
|
+
src: profile
|
|
96
|
+
}), jsx("span", null, user.displayName));
|
|
97
|
+
})));
|
|
98
|
+
};
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
|
|
3
|
+
/** @jsx jsx */
|
|
4
|
+
import { useEffect, useState, useRef, useCallback, useMemo } from 'react';
|
|
5
|
+
import { useIntl } from 'react-intl-next';
|
|
6
|
+
import { jsx } from '@emotion/react';
|
|
7
|
+
import Button from '@atlaskit/button/standard-button';
|
|
8
|
+
import Modal, { ModalBody, ModalFooter, ModalHeader, ModalTitle } from '@atlaskit/modal-dialog';
|
|
9
|
+
import { constants, i18n } from '../../shared';
|
|
10
|
+
import { ReactionsList } from './ReactionsList';
|
|
11
|
+
import { containerStyle, titleStyle } from './styles';
|
|
12
|
+
/**
|
|
13
|
+
* Test id for the Reactions modal dialog
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
export var RENDER_MODAL_TESTID = 'render-reactions-modal';
|
|
17
|
+
|
|
18
|
+
var getDimensions = function getDimensions(container) {
|
|
19
|
+
return {
|
|
20
|
+
clientWidth: container === null || container === void 0 ? void 0 : container.clientWidth,
|
|
21
|
+
scrollWidth: container === null || container === void 0 ? void 0 : container.scrollWidth,
|
|
22
|
+
scrollLeft: container === null || container === void 0 ? void 0 : container.scrollLeft
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export var ReactionsDialog = function ReactionsDialog(_ref) {
|
|
27
|
+
var _ref$reactions = _ref.reactions,
|
|
28
|
+
reactions = _ref$reactions === void 0 ? [] : _ref$reactions,
|
|
29
|
+
_ref$handleCloseReact = _ref.handleCloseReactionsDialog,
|
|
30
|
+
handleCloseReactionsDialog = _ref$handleCloseReact === void 0 ? function () {} : _ref$handleCloseReact,
|
|
31
|
+
emojiProvider = _ref.emojiProvider,
|
|
32
|
+
selectedEmojiId = _ref.selectedEmojiId,
|
|
33
|
+
_ref$handleSelectReac = _ref.handleSelectReaction,
|
|
34
|
+
handleSelectReaction = _ref$handleSelectReac === void 0 ? function () {} : _ref$handleSelectReac;
|
|
35
|
+
|
|
36
|
+
var _useState = useState(),
|
|
37
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
38
|
+
elementToScroll = _useState2[0],
|
|
39
|
+
setElementToScroll = _useState2[1];
|
|
40
|
+
|
|
41
|
+
var _useState3 = useState(null),
|
|
42
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
43
|
+
reactionsContainerRef = _useState4[0],
|
|
44
|
+
setReactionsContainerRef = _useState4[1];
|
|
45
|
+
|
|
46
|
+
var reactionElementsRef = useRef();
|
|
47
|
+
var observerRef = useRef();
|
|
48
|
+
var intl = useIntl();
|
|
49
|
+
var isSelectedEmojiViewed = useRef(false);
|
|
50
|
+
var totalReactionsCount = useMemo(function () {
|
|
51
|
+
return reactions.reduce(function (accum, current) {
|
|
52
|
+
return accum += current === null || current === void 0 ? void 0 : current.count;
|
|
53
|
+
}, 0);
|
|
54
|
+
}, [reactions]);
|
|
55
|
+
var sortedReactions = useMemo(function () {
|
|
56
|
+
return reactions.sort(function (a, b) {
|
|
57
|
+
return (b === null || b === void 0 ? void 0 : b.count) - (a === null || a === void 0 ? void 0 : a.count);
|
|
58
|
+
});
|
|
59
|
+
}, [reactions]);
|
|
60
|
+
/* set Reactions Border Width , 9 Number of reactions to display*/
|
|
61
|
+
|
|
62
|
+
var reactionsBorderWidth = useMemo(function () {
|
|
63
|
+
return Math.ceil(reactions.length / constants.NUMBER_OF_REACTIONS_TO_DISPLAY) * 100;
|
|
64
|
+
}, [reactions]);
|
|
65
|
+
/* Callback from IntersectionObserver to set/unset classNames based on visibility to toggle styles*/
|
|
66
|
+
|
|
67
|
+
var handleNavigation = useCallback(function (entries) {
|
|
68
|
+
entries.forEach(function (entry, index) {
|
|
69
|
+
var _dataset;
|
|
70
|
+
|
|
71
|
+
var element = entry.target;
|
|
72
|
+
var emojiElement = element === null || element === void 0 ? void 0 : element.querySelector('[data-emoji-id]');
|
|
73
|
+
var emojiId = emojiElement === null || emojiElement === void 0 ? void 0 : (_dataset = emojiElement.dataset) === null || _dataset === void 0 ? void 0 : _dataset.emojiId;
|
|
74
|
+
|
|
75
|
+
if (entry.intersectionRatio < 1) {
|
|
76
|
+
element.classList.add('disabled');
|
|
77
|
+
/*Check if selectedEmoji (passed as props based on what user selects) is out of viewport */
|
|
78
|
+
|
|
79
|
+
if (emojiId === selectedEmojiId && !isSelectedEmojiViewed.current) {
|
|
80
|
+
setElementToScroll(emojiElement !== null && emojiElement !== void 0 ? emojiElement : undefined);
|
|
81
|
+
}
|
|
82
|
+
} else {
|
|
83
|
+
if (emojiId === selectedEmojiId && !isSelectedEmojiViewed.current) {
|
|
84
|
+
isSelectedEmojiViewed.current = true;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
element.classList.remove('disabled');
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}, [selectedEmojiId]);
|
|
91
|
+
useEffect(function () {
|
|
92
|
+
if (elementToScroll && !isSelectedEmojiViewed.current && reactionsContainerRef) {
|
|
93
|
+
isSelectedEmojiViewed.current = true;
|
|
94
|
+
var parentElement = elementToScroll.closest('.reaction-elements');
|
|
95
|
+
var reactionsList = document.querySelector('#reactions-dialog-tabs-list');
|
|
96
|
+
|
|
97
|
+
var _getDimensions = getDimensions(reactionsList),
|
|
98
|
+
clientWidth = _getDimensions.clientWidth;
|
|
99
|
+
|
|
100
|
+
var offsetLeft = parentElement === null || parentElement === void 0 ? void 0 : parentElement.offsetLeft;
|
|
101
|
+
/* which means emoji is not in viewport so scroll to it*/
|
|
102
|
+
|
|
103
|
+
if (reactionsList && offsetLeft > clientWidth) {
|
|
104
|
+
var scrollBy = Math.trunc(offsetLeft / clientWidth) * clientWidth;
|
|
105
|
+
reactionsList.scrollLeft += scrollBy;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}, [elementToScroll, reactionsContainerRef]);
|
|
109
|
+
/* Set up InterSectionObserver to observer reaction elements on navigating*/
|
|
110
|
+
|
|
111
|
+
useEffect(function () {
|
|
112
|
+
if (reactionsContainerRef) {
|
|
113
|
+
var options = {
|
|
114
|
+
root: reactionsContainerRef,
|
|
115
|
+
rootMargin: '0px',
|
|
116
|
+
threshold: 1.0
|
|
117
|
+
};
|
|
118
|
+
observerRef.current = new IntersectionObserver(handleNavigation, options);
|
|
119
|
+
reactionElementsRef.current = reactionsContainerRef.querySelectorAll('.reaction-elements');
|
|
120
|
+
reactionElementsRef.current && reactionElementsRef.current.length > 0 && reactionElementsRef.current.forEach(function (child) {
|
|
121
|
+
var _observerRef$current;
|
|
122
|
+
|
|
123
|
+
observerRef === null || observerRef === void 0 ? void 0 : (_observerRef$current = observerRef.current) === null || _observerRef$current === void 0 ? void 0 : _observerRef$current.observe(child);
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return function () {
|
|
128
|
+
if (observerRef.current) {
|
|
129
|
+
observerRef.current.disconnect();
|
|
130
|
+
observerRef.current = undefined;
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
}, [reactionsContainerRef, reactions, handleNavigation, selectedEmojiId]);
|
|
134
|
+
var setRef = useCallback(function (node) {
|
|
135
|
+
if (!reactionsContainerRef) {
|
|
136
|
+
setReactionsContainerRef(node);
|
|
137
|
+
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
138
|
+
|
|
139
|
+
}, []);
|
|
140
|
+
return jsx(Modal, {
|
|
141
|
+
onClose: handleCloseReactionsDialog,
|
|
142
|
+
height: 600,
|
|
143
|
+
testId: RENDER_MODAL_TESTID
|
|
144
|
+
}, jsx(ModalHeader, null, jsx("div", {
|
|
145
|
+
css: titleStyle
|
|
146
|
+
}, jsx(ModalTitle, null, intl.formatMessage(i18n.messages.reactionsCount, {
|
|
147
|
+
count: totalReactionsCount
|
|
148
|
+
})))), jsx(ModalBody, null, jsx("div", {
|
|
149
|
+
css: containerStyle(reactionsBorderWidth),
|
|
150
|
+
ref: setRef
|
|
151
|
+
}, jsx(ReactionsList, {
|
|
152
|
+
initialEmojiId: selectedEmojiId,
|
|
153
|
+
reactions: sortedReactions,
|
|
154
|
+
emojiProvider: emojiProvider,
|
|
155
|
+
onReactionChanged: handleSelectReaction
|
|
156
|
+
}))), jsx(ModalFooter, null, jsx(Button, {
|
|
157
|
+
appearance: "primary",
|
|
158
|
+
onClick: handleCloseReactionsDialog,
|
|
159
|
+
autoFocus: true
|
|
160
|
+
}, intl.formatMessage(i18n.messages.closeReactionsDialog))));
|
|
161
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
|
|
3
|
+
/** @jsx jsx */
|
|
4
|
+
import { useCallback, useState } from 'react';
|
|
5
|
+
import { jsx } from '@emotion/react';
|
|
6
|
+
import { ResourcedEmoji } from '@atlaskit/emoji/element';
|
|
7
|
+
import Tabs, { Tab, TabList } from '@atlaskit/tabs';
|
|
8
|
+
import { useThemeObserver } from '@atlaskit/tokens';
|
|
9
|
+
import { Counter } from '../Counter';
|
|
10
|
+
import { counterStyle, customTabWrapper, customTabListStyles } from './styles';
|
|
11
|
+
import { ReactionView } from './ReactionView';
|
|
12
|
+
export var ReactionsList = function ReactionsList(_ref) {
|
|
13
|
+
var reactions = _ref.reactions,
|
|
14
|
+
initialEmojiId = _ref.initialEmojiId,
|
|
15
|
+
emojiProvider = _ref.emojiProvider,
|
|
16
|
+
onReactionChanged = _ref.onReactionChanged;
|
|
17
|
+
|
|
18
|
+
var _useState = useState(function () {
|
|
19
|
+
// Calculate this only on initialize the List of Tabs and each Reactions View collection
|
|
20
|
+
return {
|
|
21
|
+
index: reactions.findIndex(function (reaction) {
|
|
22
|
+
return reaction.emojiId === initialEmojiId;
|
|
23
|
+
}),
|
|
24
|
+
id: initialEmojiId
|
|
25
|
+
};
|
|
26
|
+
}),
|
|
27
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
28
|
+
selectedEmoji = _useState2[0],
|
|
29
|
+
setSelectedEmoji = _useState2[1];
|
|
30
|
+
|
|
31
|
+
var theme = useThemeObserver();
|
|
32
|
+
var onTabChange = useCallback(function (index, analyticsEvent) {
|
|
33
|
+
if (index === selectedEmoji.index) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
var emojiId = reactions[index].emojiId;
|
|
38
|
+
setSelectedEmoji({
|
|
39
|
+
index: index,
|
|
40
|
+
id: emojiId
|
|
41
|
+
});
|
|
42
|
+
onReactionChanged(emojiId, analyticsEvent);
|
|
43
|
+
}, [selectedEmoji.index, reactions, onReactionChanged]);
|
|
44
|
+
return jsx(Tabs, {
|
|
45
|
+
id: "reactions-dialog-tabs",
|
|
46
|
+
onChange: onTabChange,
|
|
47
|
+
selected: selectedEmoji.index
|
|
48
|
+
}, jsx("div", {
|
|
49
|
+
css: customTabListStyles,
|
|
50
|
+
id: "reactions-dialog-tabs-list"
|
|
51
|
+
}, jsx(TabList, null, reactions.map(function (reaction) {
|
|
52
|
+
var emojiId = {
|
|
53
|
+
id: reaction.emojiId,
|
|
54
|
+
shortName: ''
|
|
55
|
+
};
|
|
56
|
+
return jsx("div", {
|
|
57
|
+
css: customTabWrapper((emojiId === null || emojiId === void 0 ? void 0 : emojiId.id) === selectedEmoji.id, selectedEmoji.id, theme),
|
|
58
|
+
className: "reaction-elements",
|
|
59
|
+
key: reaction.emojiId,
|
|
60
|
+
"data-testid": emojiId === null || emojiId === void 0 ? void 0 : emojiId.id
|
|
61
|
+
}, jsx(Tab, null, jsx(ResourcedEmoji, {
|
|
62
|
+
emojiProvider: emojiProvider,
|
|
63
|
+
emojiId: emojiId,
|
|
64
|
+
fitToHeight: 16,
|
|
65
|
+
showTooltip: true
|
|
66
|
+
}), jsx("div", {
|
|
67
|
+
css: counterStyle((emojiId === null || emojiId === void 0 ? void 0 : emojiId.id) === selectedEmoji.id)
|
|
68
|
+
}, jsx(Counter, {
|
|
69
|
+
value: reaction.count
|
|
70
|
+
}))));
|
|
71
|
+
}))), reactions.map(function (reaction) {
|
|
72
|
+
return jsx(ReactionView, {
|
|
73
|
+
key: reaction.emojiId,
|
|
74
|
+
reaction: reaction,
|
|
75
|
+
selectedEmojiId: selectedEmoji.id,
|
|
76
|
+
emojiProvider: emojiProvider
|
|
77
|
+
});
|
|
78
|
+
}));
|
|
79
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ReactionsDialog } from './ReactionsDialog';
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { css } from '@emotion/react';
|
|
3
|
+
import { B400, N500, N800 } from '@atlaskit/theme/colors';
|
|
4
|
+
import { token } from '@atlaskit/tokens';
|
|
5
|
+
import { constants } from '../../shared';
|
|
6
|
+
var REACTIONS_CONTAINER_WIDTH = 48;
|
|
7
|
+
var REACTION_RIGHT_MARGIN = 8;
|
|
8
|
+
/* we want to display around 9 reactions and show 10th one as faded so removing 2px from REACTIONS_CONTAINER_WIDTH*/
|
|
9
|
+
|
|
10
|
+
var CONTAINER_WIDTH = constants.NUMBER_OF_REACTIONS_TO_DISPLAY * (REACTIONS_CONTAINER_WIDTH + REACTION_RIGHT_MARGIN) + REACTIONS_CONTAINER_WIDTH - 2;
|
|
11
|
+
var REACTION_CONTAINER_HEIGHT = 48;
|
|
12
|
+
/*Reactions Container. Using pseudo Element :after to set border since with onClick of Reaction to higlight the
|
|
13
|
+
border blue below the reaction. Setting Border Width based on number of reactions to make sure it shows up
|
|
14
|
+
in case the container overflows */
|
|
15
|
+
|
|
16
|
+
export var containerStyle = function containerStyle(reactionsBorderWidth) {
|
|
17
|
+
return css({
|
|
18
|
+
overflow: 'hidden',
|
|
19
|
+
maxWidth: "".concat(CONTAINER_WIDTH, "px"),
|
|
20
|
+
height: '100%',
|
|
21
|
+
display: 'flex',
|
|
22
|
+
justifyContent: 'start',
|
|
23
|
+
position: 'relative',
|
|
24
|
+
scrollBehavior: 'smooth',
|
|
25
|
+
'&:after': {
|
|
26
|
+
content: '""',
|
|
27
|
+
zIndex: 0,
|
|
28
|
+
display: 'block',
|
|
29
|
+
minWidth: "".concat(reactionsBorderWidth, "%"),
|
|
30
|
+
bottom: '0px',
|
|
31
|
+
position: 'absolute'
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
export var titleStyle = css({
|
|
36
|
+
'& > h1': {
|
|
37
|
+
fontSize: '24px!important',
|
|
38
|
+
color: "".concat(token('color.text', N800))
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
var containerEdgeAngle = {
|
|
42
|
+
rightEdge: 270,
|
|
43
|
+
leftEdge: 90
|
|
44
|
+
};
|
|
45
|
+
export var counterStyle = function counterStyle(isSelected) {
|
|
46
|
+
return css({
|
|
47
|
+
display: 'flex',
|
|
48
|
+
alignSelf: 'center',
|
|
49
|
+
lineHeight: '14px',
|
|
50
|
+
fontSize: '11px',
|
|
51
|
+
fontWeight: isSelected ? 700 : 400,
|
|
52
|
+
paddingRight: '0px',
|
|
53
|
+
marginTop: '5px',
|
|
54
|
+
'> div': {
|
|
55
|
+
width: '100%',
|
|
56
|
+
padding: '0px!important',
|
|
57
|
+
//Counter component has its own styles overriding them to match designs
|
|
58
|
+
color: isSelected ? "".concat(token('color.text', B400), "!important") : "2px solid ".concat(token('color.text', N500), "!important")
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
var fadedCss = function fadedCss(edge, theme) {
|
|
64
|
+
return css({
|
|
65
|
+
content: '""',
|
|
66
|
+
position: 'absolute',
|
|
67
|
+
left: '0px',
|
|
68
|
+
top: '0px',
|
|
69
|
+
width: "".concat(REACTIONS_CONTAINER_WIDTH, "px"),
|
|
70
|
+
height: "".concat(REACTION_CONTAINER_HEIGHT, "px"),
|
|
71
|
+
zIndex: 0,
|
|
72
|
+
background: theme === 'dark' || theme === 'legacy-dark' ? "linear-gradient(".concat(containerEdgeAngle[edge], "deg, rgba(34, 39, 43, 0.95) 40.23%, rgba(34, 39, 43, 0.55) 58.33%, rgba(34, 39, 43, 0) 77.49%)") : "linear-gradient(".concat(containerEdgeAngle[edge], "deg, rgba(255, 255, 255, 0.95) 40.23%, rgba(255, 255, 255, 0.55) 58.33%, rgba(255, 255, 255, 0) 77.49%)")
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export var customTabWrapper = function customTabWrapper(isSelected, selectedEmojiId, theme) {
|
|
77
|
+
return css({
|
|
78
|
+
flexShrink: 0,
|
|
79
|
+
display: 'flex',
|
|
80
|
+
flexDirection: 'column',
|
|
81
|
+
textAlign: 'center',
|
|
82
|
+
alignItems: 'center',
|
|
83
|
+
justifyContent: 'center',
|
|
84
|
+
minWidth: "".concat(REACTIONS_CONTAINER_WIDTH, "px"),
|
|
85
|
+
minHeight: "".concat(REACTION_CONTAINER_HEIGHT, "px"),
|
|
86
|
+
marginRight: "".concat(REACTION_RIGHT_MARGIN, "px"),
|
|
87
|
+
boxSizing: 'border-box',
|
|
88
|
+
position: 'relative',
|
|
89
|
+
'> div': {
|
|
90
|
+
minWidth: "".concat(REACTIONS_CONTAINER_WIDTH, "px"),
|
|
91
|
+
minHeight: "".concat(REACTION_CONTAINER_HEIGHT, "px"),
|
|
92
|
+
padding: '0px !important',
|
|
93
|
+
alignItems: 'center',
|
|
94
|
+
justifyContent: 'center'
|
|
95
|
+
},
|
|
96
|
+
'& > span': {
|
|
97
|
+
minHeight: '16px',
|
|
98
|
+
minWidth: '16px'
|
|
99
|
+
},
|
|
100
|
+
'&.disabled:after': fadedCss('rightEdge', theme),
|
|
101
|
+
'&.disabled + &.disabled:after': fadedCss('leftEdge', theme),
|
|
102
|
+
'&:after': isSelected ? {
|
|
103
|
+
content: '""',
|
|
104
|
+
borderBottom: "2px solid ".concat(token('color.text', B400)),
|
|
105
|
+
width: "".concat(REACTIONS_CONTAINER_WIDTH, "px"),
|
|
106
|
+
bottom: '0px',
|
|
107
|
+
display: 'block',
|
|
108
|
+
position: 'absolute',
|
|
109
|
+
zIndex: 2
|
|
110
|
+
} : {
|
|
111
|
+
content: '""',
|
|
112
|
+
borderBottom: "2px solid transparent",
|
|
113
|
+
width: "".concat(REACTIONS_CONTAINER_WIDTH, "px"),
|
|
114
|
+
bottom: '0px',
|
|
115
|
+
display: 'block',
|
|
116
|
+
position: 'absolute',
|
|
117
|
+
zIndex: 1
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
export var navigationContainerStyle = css({
|
|
122
|
+
'> button': {
|
|
123
|
+
cursor: 'pointer'
|
|
124
|
+
},
|
|
125
|
+
'button:last-child': {
|
|
126
|
+
marginLeft: '16px'
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
export var reactionViewStyle = css({
|
|
130
|
+
marginTop: '24px',
|
|
131
|
+
display: 'flex',
|
|
132
|
+
flexDirection: 'column',
|
|
133
|
+
p: {
|
|
134
|
+
margin: 0,
|
|
135
|
+
color: "".concat(token('color.text', N800)),
|
|
136
|
+
textTransform: 'capitalize',
|
|
137
|
+
fontWeight: 600,
|
|
138
|
+
fontSize: 16,
|
|
139
|
+
lineHeight: '20px',
|
|
140
|
+
'> span': {
|
|
141
|
+
marginRight: 8
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
export var userListStyle = css({
|
|
146
|
+
listStyle: 'none',
|
|
147
|
+
marginTop: 16,
|
|
148
|
+
padding: 0,
|
|
149
|
+
textAlign: 'left',
|
|
150
|
+
li: {
|
|
151
|
+
color: "".concat(token('color.text', N500)),
|
|
152
|
+
fontSize: 14
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
export var userStyle = css({
|
|
156
|
+
display: 'flex',
|
|
157
|
+
alignItems: 'center',
|
|
158
|
+
padding: '8px 0px 8px 0px',
|
|
159
|
+
'> span': {
|
|
160
|
+
marginLeft: 16
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
export var customTabListStyles = css({
|
|
164
|
+
overflow: 'auto',
|
|
165
|
+
scrollBehavior: 'smooth',
|
|
166
|
+
display: 'flex',
|
|
167
|
+
paddingBottom: 4,
|
|
168
|
+
'div[role=tablist]': {
|
|
169
|
+
flexGrow: 1
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
export var centerSpinner = css({
|
|
173
|
+
display: 'flex',
|
|
174
|
+
justifyContent: 'center',
|
|
175
|
+
alignItems: 'center',
|
|
176
|
+
height: '100%'
|
|
177
|
+
});
|
|
@@ -67,11 +67,15 @@ export var ReactionPicker = /*#__PURE__*/React.memo(function (props) {
|
|
|
67
67
|
allowAllEmojis = props.allowAllEmojis,
|
|
68
68
|
disabled = props.disabled,
|
|
69
69
|
pickerQuickReactionEmojiIds = props.pickerQuickReactionEmojiIds,
|
|
70
|
-
onShowMore = props.onShowMore,
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
_props$onShowMore = props.onShowMore,
|
|
71
|
+
onShowMore = _props$onShowMore === void 0 ? function () {} : _props$onShowMore,
|
|
72
|
+
_props$onOpen = props.onOpen,
|
|
73
|
+
onOpen = _props$onOpen === void 0 ? function () {} : _props$onOpen,
|
|
74
|
+
_props$onCancel = props.onCancel,
|
|
75
|
+
onCancel = _props$onCancel === void 0 ? function () {} : _props$onCancel,
|
|
73
76
|
_props$tooltipContent = props.tooltipContent,
|
|
74
|
-
tooltipContent = _props$tooltipContent === void 0 ? jsx(FormattedMessage, i18n.messages.addReaction) : _props$tooltipContent
|
|
77
|
+
tooltipContent = _props$tooltipContent === void 0 ? jsx(FormattedMessage, i18n.messages.addReaction) : _props$tooltipContent,
|
|
78
|
+
emojiPickerSize = props.emojiPickerSize;
|
|
75
79
|
/**
|
|
76
80
|
* Container <div /> reference (used by custom hook to detect click outside)
|
|
77
81
|
*/
|
|
@@ -103,10 +107,7 @@ export var ReactionPicker = /*#__PURE__*/React.memo(function (props) {
|
|
|
103
107
|
|
|
104
108
|
|
|
105
109
|
useClickAway(wrapperRef, function () {
|
|
106
|
-
|
|
107
|
-
onCancel();
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
+
onCancel();
|
|
110
111
|
close();
|
|
111
112
|
}, 'click', true);
|
|
112
113
|
/**
|
|
@@ -139,10 +140,7 @@ export var ReactionPicker = /*#__PURE__*/React.memo(function (props) {
|
|
|
139
140
|
isOpen: true,
|
|
140
141
|
showFullPicker: true
|
|
141
142
|
});
|
|
142
|
-
|
|
143
|
-
if (onShowMore) {
|
|
144
|
-
onShowMore();
|
|
145
|
-
}
|
|
143
|
+
onShowMore();
|
|
146
144
|
}, [onShowMore]);
|
|
147
145
|
/**
|
|
148
146
|
* Event callback when an emoji icon is selected
|
|
@@ -169,11 +167,7 @@ export var ReactionPicker = /*#__PURE__*/React.memo(function (props) {
|
|
|
169
167
|
isOpen: !settings.isOpen,
|
|
170
168
|
showFullPicker: !!allowAllEmojis && Array.isArray(pickerQuickReactionEmojiIds) && pickerQuickReactionEmojiIds.length === 0
|
|
171
169
|
});
|
|
172
|
-
|
|
173
|
-
if (onOpen) {
|
|
174
|
-
onOpen();
|
|
175
|
-
} // ufo reactions picker opened success
|
|
176
|
-
|
|
170
|
+
onOpen(); // ufo reactions picker opened success
|
|
177
171
|
|
|
178
172
|
UFO.PickerRender.success();
|
|
179
173
|
};
|
|
@@ -193,7 +187,6 @@ export var ReactionPicker = /*#__PURE__*/React.memo(function (props) {
|
|
|
193
187
|
return jsx("div", {
|
|
194
188
|
className: wrapperClassName,
|
|
195
189
|
css: styles.pickerStyle,
|
|
196
|
-
ref: wrapperRef,
|
|
197
190
|
"data-testid": RENDER_REACTIONPICKER_TESTID
|
|
198
191
|
}, jsx(Manager, null, jsx(Reference, null, function (_ref) {
|
|
199
192
|
var popperRef = _ref.ref;
|
|
@@ -225,10 +218,12 @@ export var ReactionPicker = /*#__PURE__*/React.memo(function (props) {
|
|
|
225
218
|
}, style),
|
|
226
219
|
ref: ref
|
|
227
220
|
}, jsx("div", {
|
|
228
|
-
css: styles.popupStyle
|
|
221
|
+
css: styles.popupStyle,
|
|
222
|
+
ref: wrapperRef
|
|
229
223
|
}, settings.showFullPicker ? jsx(EmojiPicker, {
|
|
230
224
|
emojiProvider: emojiProvider,
|
|
231
|
-
onSelection: onEmojiSelected
|
|
225
|
+
onSelection: onEmojiSelected,
|
|
226
|
+
size: emojiPickerSize
|
|
232
227
|
}) : jsx("div", {
|
|
233
228
|
css: styles.contentStyle
|
|
234
229
|
}, jsx(Selector, {
|
|
@@ -13,31 +13,45 @@ import * as styles from './styles';
|
|
|
13
13
|
|
|
14
14
|
export var RENDER_REACTIONTOOLTIP_TESTID = 'render-reactionTooltip';
|
|
15
15
|
export var ReactionTooltip = function ReactionTooltip(_ref) {
|
|
16
|
-
var
|
|
17
|
-
|
|
16
|
+
var children = _ref.children,
|
|
17
|
+
emojiName = _ref.emojiName,
|
|
18
|
+
_ref$reaction = _ref.reaction,
|
|
19
|
+
_ref$reaction$users = _ref$reaction.users,
|
|
20
|
+
users = _ref$reaction$users === void 0 ? [] : _ref$reaction$users,
|
|
21
|
+
_ref$reaction$emojiId = _ref$reaction.emojiId,
|
|
22
|
+
emojiId = _ref$reaction$emojiId === void 0 ? '' : _ref$reaction$emojiId,
|
|
18
23
|
_ref$maxReactions = _ref.maxReactions,
|
|
19
24
|
maxReactions = _ref$maxReactions === void 0 ? constants.TOOLTIP_USERS_LIMIT : _ref$maxReactions,
|
|
20
|
-
|
|
21
|
-
|
|
25
|
+
handleUserListClick = _ref.handleUserListClick,
|
|
26
|
+
_ref$allowUserDialog = _ref.allowUserDialog,
|
|
27
|
+
allowUserDialog = _ref$allowUserDialog === void 0 ? false : _ref$allowUserDialog,
|
|
28
|
+
_ref$isEnabled = _ref.isEnabled,
|
|
29
|
+
isEnabled = _ref$isEnabled === void 0 ? true : _ref$isEnabled;
|
|
22
30
|
|
|
23
31
|
/**
|
|
24
32
|
* Render list of users in the tooltip box
|
|
25
33
|
*/
|
|
26
|
-
var content = !users || users.length === 0 ? null : jsx("div", {
|
|
27
|
-
css: styles.tooltipStyle
|
|
34
|
+
var content = !users || users.length === 0 || !isEnabled ? null : jsx("div", {
|
|
35
|
+
css: styles.tooltipStyle,
|
|
36
|
+
tabIndex: 0
|
|
28
37
|
}, jsx("ul", null, emojiName ? jsx("li", {
|
|
29
38
|
css: styles.emojiNameStyle
|
|
30
|
-
}, emojiName) : null, users.slice(0, maxReactions).map(function (user
|
|
39
|
+
}, emojiName) : null, users.slice(0, maxReactions).map(function (user) {
|
|
31
40
|
return jsx("li", {
|
|
32
|
-
key:
|
|
41
|
+
key: user.id
|
|
33
42
|
}, user.displayName);
|
|
34
|
-
}),
|
|
35
|
-
css: styles.footerStyle
|
|
36
|
-
|
|
43
|
+
}), jsx("li", {
|
|
44
|
+
css: allowUserDialog ? [styles.footerStyle, styles.underlineStyle] : styles.footerStyle,
|
|
45
|
+
onClick: function onClick() {
|
|
46
|
+
if (allowUserDialog && handleUserListClick) {
|
|
47
|
+
handleUserListClick(emojiId);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}, users.length > maxReactions ? jsx(FormattedMessage, _extends({}, i18n.messages.otherUsers, {
|
|
37
51
|
values: {
|
|
38
52
|
count: users.length - maxReactions
|
|
39
53
|
}
|
|
40
|
-
}))
|
|
54
|
+
})) : allowUserDialog && jsx(FormattedMessage, i18n.messages.moreInfo))));
|
|
41
55
|
return jsx(Tooltip, {
|
|
42
56
|
content: content,
|
|
43
57
|
position: "bottom",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { css } from '@emotion/react';
|
|
3
3
|
import { token } from '@atlaskit/tokens';
|
|
4
|
-
import { N90 } from '@atlaskit/theme/colors';
|
|
4
|
+
import { N90, N800, N0 } from '@atlaskit/theme/colors';
|
|
5
5
|
export var verticalMargin = 5;
|
|
6
6
|
export var tooltipStyle = css({
|
|
7
7
|
maxWidth: '150px',
|
|
@@ -29,4 +29,12 @@ export var emojiNameStyle = css({
|
|
|
29
29
|
export var footerStyle = css({
|
|
30
30
|
color: token('color.text.inverse', N90),
|
|
31
31
|
fontWeight: 300
|
|
32
|
+
});
|
|
33
|
+
export var underlineStyle = css({
|
|
34
|
+
cursor: 'pointer',
|
|
35
|
+
textDecoration: 'underline',
|
|
36
|
+
':hover': {
|
|
37
|
+
backgroundColor: token('color.background.neutral.bold', N800),
|
|
38
|
+
color: token('color.text.inverse', N0)
|
|
39
|
+
}
|
|
32
40
|
});
|