@atlaskit/reactions 24.7.0 → 24.8.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.
Files changed (29) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/cjs/analytics/index.js +1 -1
  3. package/dist/cjs/components/ReactionDialog/ReactionView.js +73 -60
  4. package/dist/cjs/components/ReactionDialog/ReactionsDialog.js +42 -81
  5. package/dist/cjs/components/ReactionDialog/ReactionsDialogHeader.js +205 -0
  6. package/dist/cjs/components/ReactionDialog/ReactionsList.js +12 -105
  7. package/dist/cjs/components/ReactionDialog/styles.js +3 -75
  8. package/dist/cjs/components/Reactions/Reactions.js +5 -2
  9. package/dist/es2019/analytics/index.js +1 -1
  10. package/dist/es2019/components/ReactionDialog/ReactionView.js +75 -62
  11. package/dist/es2019/components/ReactionDialog/ReactionsDialog.js +30 -64
  12. package/dist/es2019/components/ReactionDialog/ReactionsDialogHeader.js +188 -0
  13. package/dist/es2019/components/ReactionDialog/ReactionsList.js +12 -91
  14. package/dist/es2019/components/ReactionDialog/styles.js +3 -71
  15. package/dist/es2019/components/Reactions/Reactions.js +5 -2
  16. package/dist/esm/analytics/index.js +1 -1
  17. package/dist/esm/components/ReactionDialog/ReactionView.js +76 -63
  18. package/dist/esm/components/ReactionDialog/ReactionsDialog.js +44 -82
  19. package/dist/esm/components/ReactionDialog/ReactionsDialogHeader.js +196 -0
  20. package/dist/esm/components/ReactionDialog/ReactionsList.js +11 -99
  21. package/dist/esm/components/ReactionDialog/styles.js +3 -75
  22. package/dist/esm/components/Reactions/Reactions.js +5 -2
  23. package/dist/types/components/ReactionDialog/ReactionsDialogHeader.d.ts +15 -0
  24. package/dist/types/components/ReactionDialog/ReactionsList.d.ts +7 -7
  25. package/dist/types/components/ReactionDialog/styles.d.ts +0 -3
  26. package/dist/types-ts4.5/components/ReactionDialog/ReactionsDialogHeader.d.ts +15 -0
  27. package/dist/types-ts4.5/components/ReactionDialog/ReactionsList.d.ts +7 -7
  28. package/dist/types-ts4.5/components/ReactionDialog/styles.d.ts +0 -3
  29. package/package.json +4 -1
@@ -1,6 +1,5 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
- import _extends from "@babel/runtime/helpers/extends";
4
3
  /**
5
4
  * @jsxRuntime classic
6
5
  * @jsx jsx
@@ -9,22 +8,15 @@ import { useEffect, useState, useRef, useCallback, useMemo } from 'react';
9
8
  import { useIntl } from 'react-intl-next';
10
9
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
11
10
  import { jsx } from '@emotion/react';
12
- import { Flex, xcss } from '@atlaskit/primitives';
13
- import Button, { IconButton } from '@atlaskit/button/new';
14
- import Heading from '@atlaskit/heading';
15
- import Modal, { ModalBody, ModalFooter, useModal } from '@atlaskit/modal-dialog';
16
- import Tooltip from '@atlaskit/tooltip';
17
- import ChevronLeftIcon from '@atlaskit/icon/utility/chevron-left';
18
- import ChevronRightIcon from '@atlaskit/icon/utility/chevron-right';
11
+ import Tabs from '@atlaskit/tabs';
12
+ import Button from '@atlaskit/button/new';
13
+ import { Box, xcss } from '@atlaskit/primitives';
14
+ import Modal, { ModalBody, ModalFooter } from '@atlaskit/modal-dialog';
19
15
  import { NUMBER_OF_REACTIONS_TO_DISPLAY } from '../../shared/constants';
20
16
  import { messages } from '../../shared/i18n';
21
17
  import { ReactionsList } from './ReactionsList';
18
+ import { ReactionsDialogHeader } from './ReactionsDialogHeader';
22
19
  import { containerStyle } from './styles';
23
- var fullWidthStyle = xcss({
24
- width: '100%',
25
- padding: 'space.300',
26
- paddingBlockEnd: 'space.400'
27
- });
28
20
 
29
21
  /**
30
22
  * Test id for the Reactions modal dialog
@@ -37,70 +29,22 @@ var getDimensions = function getDimensions(container) {
37
29
  scrollLeft: container === null || container === void 0 ? void 0 : container.scrollLeft
38
30
  };
39
31
  };
40
- var ReactionsDialogModalHeader = function ReactionsDialogModalHeader(_ref) {
41
- var totalReactionsCount = _ref.totalReactionsCount,
42
- handlePreviousPage = _ref.handlePreviousPage,
43
- handleNextPage = _ref.handleNextPage,
44
- currentPage = _ref.currentPage,
45
- maxPages = _ref.maxPages;
46
- var _useModal = useModal(),
47
- titleId = _useModal.titleId;
48
- var intl = useIntl();
49
- var isSinglePage = maxPages === 1;
50
- var isOnFirstPage = currentPage === 1;
51
- var isOnLastPage = currentPage === maxPages;
52
- return jsx(Flex, {
53
- direction: "row",
54
- justifyContent: "space-between",
55
- alignItems: "center",
56
- xcss: fullWidthStyle
57
- }, jsx(Heading, {
58
- size: "medium",
59
- id: titleId
60
- }, intl.formatMessage(messages.reactionsCount, {
61
- count: totalReactionsCount
62
- })), !isSinglePage && jsx(Flex, {
63
- alignItems: "center",
64
- gap: "space.100"
65
- }, jsx(Tooltip, {
66
- content: intl.formatMessage(messages.leftNavigateLabel),
67
- canAppear: function canAppear() {
68
- return !isOnFirstPage;
69
- }
70
- }, function (tooltipProps) {
71
- return jsx(IconButton, _extends({}, tooltipProps, {
72
- isDisabled: isOnFirstPage,
73
- onClick: handlePreviousPage,
74
- icon: ChevronLeftIcon,
75
- label: intl.formatMessage(messages.leftNavigateLabel)
76
- }));
77
- }), jsx(Tooltip, {
78
- content: intl.formatMessage(messages.rightNavigateLabel),
79
- canAppear: function canAppear() {
80
- return !isOnLastPage;
81
- }
82
- }, function (tooltipProps) {
83
- return jsx(IconButton, _extends({}, tooltipProps, {
84
- onClick: handleNextPage,
85
- isDisabled: isOnLastPage,
86
- icon: ChevronRightIcon,
87
- label: intl.formatMessage(messages.rightNavigateLabel)
88
- }));
89
- })));
90
- };
91
- export var ReactionsDialog = function ReactionsDialog(_ref2) {
32
+ var footerStyle = xcss({
33
+ borderTop: "2px solid ".concat("var(--ds-border, rgba(11, 18, 14, 0.14))")
34
+ });
35
+ export var ReactionsDialog = function ReactionsDialog(_ref) {
92
36
  var _currentReactions$;
93
- var _ref2$reactions = _ref2.reactions,
94
- reactions = _ref2$reactions === void 0 ? [] : _ref2$reactions,
95
- _ref2$handleCloseReac = _ref2.handleCloseReactionsDialog,
96
- handleCloseReactionsDialog = _ref2$handleCloseReac === void 0 ? function () {} : _ref2$handleCloseReac,
97
- emojiProvider = _ref2.emojiProvider,
98
- selectedEmojiId = _ref2.selectedEmojiId,
99
- _ref2$handleSelectRea = _ref2.handleSelectReaction,
100
- handleSelectReaction = _ref2$handleSelectRea === void 0 ? function () {} : _ref2$handleSelectRea,
101
- _ref2$handlePaginatio = _ref2.handlePaginationChange,
102
- handlePaginationChange = _ref2$handlePaginatio === void 0 ? function () {} : _ref2$handlePaginatio,
103
- ProfileCardWrapper = _ref2.ProfileCardWrapper;
37
+ var _ref$reactions = _ref.reactions,
38
+ reactions = _ref$reactions === void 0 ? [] : _ref$reactions,
39
+ _ref$handleCloseReact = _ref.handleCloseReactionsDialog,
40
+ handleCloseReactionsDialog = _ref$handleCloseReact === void 0 ? function () {} : _ref$handleCloseReact,
41
+ emojiProvider = _ref.emojiProvider,
42
+ selectedEmojiId = _ref.selectedEmojiId,
43
+ _ref$handleSelectReac = _ref.handleSelectReaction,
44
+ handleSelectReaction = _ref$handleSelectReac === void 0 ? function () {} : _ref$handleSelectReac,
45
+ _ref$handlePagination = _ref.handlePaginationChange,
46
+ handlePaginationChange = _ref$handlePagination === void 0 ? function () {} : _ref$handlePagination,
47
+ ProfileCardWrapper = _ref.ProfileCardWrapper;
104
48
  var _useState = useState(),
105
49
  _useState2 = _slicedToArray(_useState, 2),
106
50
  elementToScroll = _useState2[0],
@@ -221,6 +165,16 @@ export var ReactionsDialog = function ReactionsDialog(_ref2) {
221
165
  }
222
166
  // eslint-disable-next-line react-hooks/exhaustive-deps
223
167
  }, []);
168
+ var selectedIndex = currentReactions.findIndex(function (reaction) {
169
+ return reaction.emojiId === selectedEmojiId;
170
+ });
171
+ var onTabChange = useCallback(function (index, analyticsEvent) {
172
+ if (index === selectedIndex) {
173
+ return;
174
+ }
175
+ var emojiId = currentReactions[index].emojiId;
176
+ handleSelectReaction(emojiId, analyticsEvent);
177
+ }, [selectedIndex, currentReactions, handleSelectReaction]);
224
178
  return jsx(Modal, {
225
179
  onClose: handleCloseReactionsDialog,
226
180
  height: 600,
@@ -228,23 +182,31 @@ export var ReactionsDialog = function ReactionsDialog(_ref2) {
228
182
  // eslint-disable-next-line jsx-a11y/no-autofocus
229
183
  ,
230
184
  autoFocus: false
231
- }, jsx(ReactionsDialogModalHeader, {
185
+ }, jsx(Tabs, {
186
+ id: "reactions-dialog-tabs",
187
+ onChange: onTabChange,
188
+ selected: selectedIndex
189
+ }, jsx(ReactionsDialogHeader, {
232
190
  totalReactionsCount: totalReactionsCount,
233
191
  maxPages: maxPages,
234
192
  handlePreviousPage: handlePreviousPage,
235
193
  handleNextPage: handleNextPage,
236
- currentPage: currentPage
194
+ currentPage: currentPage,
195
+ emojiProvider: emojiProvider,
196
+ selectedEmojiId: selectedEmojiId,
197
+ currentReactions: currentReactions
237
198
  }), jsx(ModalBody, null, jsx("div", {
238
199
  css: containerStyle(reactionsBorderWidth),
239
200
  ref: setRef
240
201
  }, jsx(ReactionsList, {
241
- initialEmojiId: selectedEmojiId,
202
+ selectedEmojiId: selectedEmojiId,
242
203
  reactions: currentReactions,
243
204
  emojiProvider: emojiProvider,
244
- onReactionChanged: handleSelectReaction,
245
205
  ProfileCardWrapper: ProfileCardWrapper
246
- }))), jsx(ModalFooter, null, jsx(Button, {
206
+ })))), jsx(Box, {
207
+ xcss: footerStyle
208
+ }, jsx(ModalFooter, null, jsx(Button, {
247
209
  appearance: "subtle",
248
210
  onClick: handleCloseReactionsDialog
249
- }, intl.formatMessage(messages.closeReactionsDialog))));
211
+ }, intl.formatMessage(messages.closeReactionsDialog)))));
250
212
  };
@@ -0,0 +1,196 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ /**
3
+ * @jsxRuntime classic
4
+ * @jsx jsx
5
+ */
6
+ import { useIntl } from 'react-intl-next';
7
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
8
+ import { jsx, css } from '@emotion/react';
9
+ import { useThemeObserver } from '@atlaskit/tokens';
10
+ import { Tab, TabList } from '@atlaskit/tabs';
11
+ import { Box, Flex, xcss, Stack } from '@atlaskit/primitives';
12
+ import { IconButton } from '@atlaskit/button/new';
13
+ import Heading from '@atlaskit/heading';
14
+ import { useModal } from '@atlaskit/modal-dialog';
15
+ import Tooltip from '@atlaskit/tooltip';
16
+ import ChevronLeftIcon from '@atlaskit/icon/utility/chevron-left';
17
+ import ChevronRightIcon from '@atlaskit/icon/utility/chevron-right';
18
+ import { ResourcedEmoji } from '@atlaskit/emoji/element';
19
+ import { messages } from '../../shared/i18n';
20
+ import { Counter } from '../Counter';
21
+ var REACTIONS_CONTAINER_WIDTH = 56;
22
+ var REACTION_CONTAINER_HEIGHT = 40;
23
+ var containerEdgeAngle = {
24
+ rightEdge: 270,
25
+ leftEdge: 90
26
+ };
27
+ var fadedCss = function fadedCss(edge, theme) {
28
+ return css({
29
+ content: '""',
30
+ position: 'absolute',
31
+ left: '0px',
32
+ top: '0px',
33
+ width: "".concat(REACTIONS_CONTAINER_WIDTH, "px"),
34
+ height: "".concat(REACTION_CONTAINER_HEIGHT, "px"),
35
+ zIndex: 0,
36
+ background:
37
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
38
+ theme === '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%)")
39
+ });
40
+ };
41
+ var customTabListStyles = css({
42
+ overflow: 'auto',
43
+ display: 'flex',
44
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
45
+ 'div[role=tablist]': {
46
+ flexGrow: 1,
47
+ // paddingInline exists to maintain styling prior to @atlaskit/tabs update that removed baked in horizontal padding
48
+ paddingInline: "var(--ds-space-100, 8px)"
49
+ }
50
+ });
51
+ var customTabWrapper = function customTabWrapper(theme) {
52
+ return css({
53
+ flexShrink: 0,
54
+ display: 'flex',
55
+ flexDirection: 'column',
56
+ textAlign: 'center',
57
+ alignItems: 'center',
58
+ justifyContent: 'center',
59
+ minWidth: "".concat(REACTIONS_CONTAINER_WIDTH, "px"),
60
+ boxSizing: 'border-box',
61
+ position: 'relative',
62
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
63
+ '> div': {
64
+ minWidth: "".concat(REACTIONS_CONTAINER_WIDTH, "px"),
65
+ minHeight: "".concat(REACTION_CONTAINER_HEIGHT, "px"),
66
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles -- Ignored via go/DSP-18766
67
+ padding: '0px !important',
68
+ alignItems: 'center',
69
+ justifyContent: 'center'
70
+ },
71
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
72
+ '& > span': {
73
+ minHeight: '16px',
74
+ minWidth: '16px'
75
+ },
76
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
77
+ '&.disabled:after': fadedCss('rightEdge', theme),
78
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
79
+ '&.disabled + &.disabled:after': fadedCss('leftEdge', theme)
80
+ });
81
+ };
82
+ var firstElement = css({
83
+ paddingLeft: "var(--ds-space-200, 16px)"
84
+ });
85
+ var fullWidthStyle = xcss({
86
+ width: '100%',
87
+ padding: 'space.300',
88
+ paddingBlockEnd: 'space.400'
89
+ });
90
+ var emojiStyles = xcss({
91
+ transformOrigin: 'center center 0',
92
+ paddingInlineStart: 'space.100',
93
+ paddingBlock: 'space.050',
94
+ paddingInlineEnd: 'space.050'
95
+ });
96
+ var counterStyle = xcss({
97
+ marginTop: 'space.025'
98
+ });
99
+ var ReactionsTabs = function ReactionsTabs(_ref) {
100
+ var currentReactions = _ref.currentReactions,
101
+ emojiProvider = _ref.emojiProvider,
102
+ selectedEmojiId = _ref.selectedEmojiId;
103
+ var _useThemeObserver = useThemeObserver(),
104
+ colorMode = _useThemeObserver.colorMode;
105
+ return jsx("div", {
106
+ css: customTabListStyles,
107
+ id: "reactions-dialog-tabs-list"
108
+ }, jsx(TabList, null, currentReactions.map(function (reaction, index) {
109
+ var emojiId = {
110
+ id: reaction.emojiId,
111
+ shortName: ''
112
+ };
113
+ return jsx("div", {
114
+ // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
115
+ css: [customTabWrapper(colorMode), index === 0 ? firstElement : []]
116
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
117
+ ,
118
+ className: "reaction-elements",
119
+ key: reaction.emojiId,
120
+ "data-testid": emojiId === null || emojiId === void 0 ? void 0 : emojiId.id
121
+ }, jsx(Tab, null, jsx(Flex, {
122
+ justifyContent: "center",
123
+ alignItems: "center",
124
+ direction: "row"
125
+ }, jsx(Box, {
126
+ xcss: emojiStyles
127
+ }, jsx(ResourcedEmoji, {
128
+ emojiProvider: emojiProvider,
129
+ emojiId: emojiId,
130
+ fitToHeight: 16,
131
+ showTooltip: true
132
+ })), jsx(Box, {
133
+ xcss: counterStyle
134
+ }, jsx(Counter, {
135
+ value: reaction.count
136
+ })))));
137
+ })));
138
+ };
139
+ export var ReactionsDialogHeader = function ReactionsDialogHeader(_ref2) {
140
+ var totalReactionsCount = _ref2.totalReactionsCount,
141
+ handlePreviousPage = _ref2.handlePreviousPage,
142
+ handleNextPage = _ref2.handleNextPage,
143
+ currentPage = _ref2.currentPage,
144
+ maxPages = _ref2.maxPages,
145
+ currentReactions = _ref2.currentReactions,
146
+ emojiProvider = _ref2.emojiProvider,
147
+ selectedEmojiId = _ref2.selectedEmojiId;
148
+ var _useModal = useModal(),
149
+ titleId = _useModal.titleId;
150
+ var intl = useIntl();
151
+ var isSinglePage = maxPages === 1;
152
+ var isOnFirstPage = currentPage === 1;
153
+ var isOnLastPage = currentPage === maxPages;
154
+ return jsx(Stack, null, jsx(Flex, {
155
+ direction: "row",
156
+ justifyContent: "space-between",
157
+ alignItems: "center",
158
+ xcss: fullWidthStyle
159
+ }, jsx(Heading, {
160
+ size: "medium",
161
+ id: titleId
162
+ }, intl.formatMessage(messages.reactionsCount, {
163
+ count: totalReactionsCount
164
+ })), !isSinglePage && jsx(Flex, {
165
+ alignItems: "center",
166
+ gap: "space.100"
167
+ }, jsx(Tooltip, {
168
+ content: intl.formatMessage(messages.leftNavigateLabel),
169
+ canAppear: function canAppear() {
170
+ return !isOnFirstPage;
171
+ }
172
+ }, function (tooltipProps) {
173
+ return jsx(IconButton, _extends({}, tooltipProps, {
174
+ isDisabled: isOnFirstPage,
175
+ onClick: handlePreviousPage,
176
+ icon: ChevronLeftIcon,
177
+ label: intl.formatMessage(messages.leftNavigateLabel)
178
+ }));
179
+ }), jsx(Tooltip, {
180
+ content: intl.formatMessage(messages.rightNavigateLabel),
181
+ canAppear: function canAppear() {
182
+ return !isOnLastPage;
183
+ }
184
+ }, function (tooltipProps) {
185
+ return jsx(IconButton, _extends({}, tooltipProps, {
186
+ onClick: handleNextPage,
187
+ isDisabled: isOnLastPage,
188
+ icon: ChevronRightIcon,
189
+ label: intl.formatMessage(messages.rightNavigateLabel)
190
+ }));
191
+ }))), jsx(ReactionsTabs, {
192
+ currentReactions: currentReactions,
193
+ emojiProvider: emojiProvider,
194
+ selectedEmojiId: selectedEmojiId
195
+ }));
196
+ };
@@ -1,114 +1,26 @@
1
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
1
  /**
3
2
  * @jsxRuntime classic
4
3
  * @jsx jsx
5
4
  */
6
- import { useCallback, useState, useEffect } from 'react';
7
5
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
8
6
  import { jsx } from '@emotion/react';
9
- import { ResourcedEmoji } from '@atlaskit/emoji/element';
10
- import Tabs, { Tab, TabList } from '@atlaskit/tabs';
11
- import { useThemeObserver } from '@atlaskit/tokens';
12
- import { Box, Flex, xcss } from '@atlaskit/primitives';
13
- import { Counter } from '../Counter';
14
- import { customTabWrapper, customTabListStyles } from './styles';
15
7
  import { ReactionView } from './ReactionView';
16
- var emojiStyles = xcss({
17
- transformOrigin: 'center center 0',
18
- paddingInlineStart: 'space.100',
19
- paddingBlock: 'space.050',
20
- paddingInlineEnd: 'space.050'
21
- });
22
- var counterStyle = xcss({
23
- marginTop: 'space.025'
24
- });
25
8
  export var ReactionsList = function ReactionsList(_ref) {
26
9
  var reactions = _ref.reactions,
27
- initialEmojiId = _ref.initialEmojiId,
10
+ selectedEmojiId = _ref.selectedEmojiId,
28
11
  emojiProvider = _ref.emojiProvider,
29
- onReactionChanged = _ref.onReactionChanged,
30
12
  ProfileCardWrapper = _ref.ProfileCardWrapper;
31
- var _useState = useState(function () {
32
- // Calculate this only on initialize the List of Tabs and each Reactions View collection
33
- return {
34
- index: reactions.findIndex(function (reaction) {
35
- return reaction.emojiId === initialEmojiId;
36
- }),
37
- id: initialEmojiId
38
- };
39
- }),
40
- _useState2 = _slicedToArray(_useState, 2),
41
- selectedEmoji = _useState2[0],
42
- setSelectedEmoji = _useState2[1];
43
- var _useThemeObserver = useThemeObserver(),
44
- colorMode = _useThemeObserver.colorMode;
45
- useEffect(function () {
46
- // select first emoji when navigating to a new page
47
- var currentPageEmojis = reactions.map(function (reaction) {
48
- return reaction.emojiId;
49
- });
50
- if (!currentPageEmojis.includes(selectedEmoji.id)) {
51
- setSelectedEmoji({
52
- index: 0,
53
- id: initialEmojiId
13
+ return jsx("div", null, reactions.map(function (reaction) {
14
+ if (reaction.emojiId === selectedEmojiId) {
15
+ return jsx(ReactionView, {
16
+ key: reaction.emojiId,
17
+ reaction: reaction,
18
+ selectedEmojiId: selectedEmojiId,
19
+ emojiProvider: emojiProvider,
20
+ ProfileCardWrapper: ProfileCardWrapper
54
21
  });
22
+ } else {
23
+ return null;
55
24
  }
56
- // eslint-disable-next-line react-hooks/exhaustive-deps
57
- }, [reactions, initialEmojiId]);
58
- var onTabChange = useCallback(function (index, analyticsEvent) {
59
- if (index === selectedEmoji.index) {
60
- return;
61
- }
62
- var emojiId = reactions[index].emojiId;
63
- setSelectedEmoji({
64
- index: index,
65
- id: emojiId
66
- });
67
- onReactionChanged(emojiId, analyticsEvent);
68
- }, [selectedEmoji.index, reactions, onReactionChanged]);
69
- return jsx(Tabs, {
70
- id: "reactions-dialog-tabs",
71
- onChange: onTabChange,
72
- selected: selectedEmoji.index
73
- }, jsx("div", {
74
- css: customTabListStyles,
75
- id: "reactions-dialog-tabs-list"
76
- }, jsx(TabList, null, reactions.map(function (reaction) {
77
- var emojiId = {
78
- id: reaction.emojiId,
79
- shortName: ''
80
- };
81
- return jsx("div", {
82
- // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
83
- css: customTabWrapper((emojiId === null || emojiId === void 0 ? void 0 : emojiId.id) === selectedEmoji.id, selectedEmoji.id, colorMode)
84
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
85
- ,
86
- className: "reaction-elements",
87
- key: reaction.emojiId,
88
- "data-testid": emojiId === null || emojiId === void 0 ? void 0 : emojiId.id
89
- }, jsx(Tab, null, jsx(Flex, {
90
- justifyContent: "center",
91
- alignItems: "center",
92
- direction: "row"
93
- }, jsx(Box, {
94
- xcss: emojiStyles
95
- }, jsx(ResourcedEmoji, {
96
- emojiProvider: emojiProvider,
97
- emojiId: emojiId,
98
- fitToHeight: 16,
99
- showTooltip: true
100
- })), jsx(Box, {
101
- xcss: counterStyle
102
- }, jsx(Counter, {
103
- value: reaction.count
104
- })))));
105
- }))), reactions.map(function (reaction) {
106
- return jsx(ReactionView, {
107
- key: reaction.emojiId,
108
- reaction: reaction,
109
- selectedEmojiId: selectedEmoji.id,
110
- emojiProvider: emojiProvider,
111
- ProfileCardWrapper: ProfileCardWrapper
112
- });
113
25
  }));
114
26
  };
@@ -4,10 +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 { N500, N800 } from '@atlaskit/theme/colors';
8
- var REACTIONS_CONTAINER_WIDTH = 48;
9
- var REACTION_CONTAINER_HEIGHT = 40;
10
-
7
+ import { N500 } from '@atlaskit/theme/colors';
11
8
  /*Reactions Container. Using pseudo Element :after to set border since with onClick of Reaction to higlight the
12
9
  border blue below the reaction. Setting Border Width based on number of reactions to make sure it shows up
13
10
  in case the container overflows */
@@ -32,55 +29,6 @@ export var containerStyle = function containerStyle(reactionsBorderWidth) {
32
29
  }
33
30
  });
34
31
  };
35
- var containerEdgeAngle = {
36
- rightEdge: 270,
37
- leftEdge: 90
38
- };
39
- var fadedCss = function fadedCss(edge, theme) {
40
- return css({
41
- content: '""',
42
- position: 'absolute',
43
- left: '0px',
44
- top: '0px',
45
- width: "".concat(REACTIONS_CONTAINER_WIDTH, "px"),
46
- height: "".concat(REACTION_CONTAINER_HEIGHT, "px"),
47
- zIndex: 0,
48
- background:
49
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
50
- theme === '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%)")
51
- });
52
- };
53
- export var customTabWrapper = function customTabWrapper(isSelected, selectedEmojiId, theme) {
54
- return css({
55
- flexShrink: 0,
56
- display: 'flex',
57
- flexDirection: 'column',
58
- textAlign: 'center',
59
- alignItems: 'center',
60
- justifyContent: 'center',
61
- minWidth: "".concat(REACTIONS_CONTAINER_WIDTH, "px"),
62
- boxSizing: 'border-box',
63
- position: 'relative',
64
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
65
- '> div': {
66
- minWidth: "".concat(REACTIONS_CONTAINER_WIDTH, "px"),
67
- minHeight: "".concat(REACTION_CONTAINER_HEIGHT, "px"),
68
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles -- Ignored via go/DSP-18766
69
- padding: '0px !important',
70
- alignItems: 'center',
71
- justifyContent: 'center'
72
- },
73
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
74
- '& > span': {
75
- minHeight: '16px',
76
- minWidth: '16px'
77
- },
78
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
79
- '&.disabled:after': fadedCss('rightEdge', theme),
80
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
81
- '&.disabled + &.disabled:after': fadedCss('leftEdge', theme)
82
- });
83
- };
84
32
 
85
33
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
86
34
  export var navigationContainerStyle = css({
@@ -94,26 +42,6 @@ export var navigationContainerStyle = css({
94
42
  }
95
43
  });
96
44
 
97
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
98
- export var reactionViewStyle = css({
99
- marginTop: "var(--ds-space-300, 24px)",
100
- display: 'flex',
101
- flexDirection: 'column',
102
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
103
- p: {
104
- margin: 0,
105
- color: "".concat("var(--ds-text, ".concat(N800, ")")),
106
- font: "var(--ds-font-heading-xsmall, normal 600 14px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
107
- fontWeight: "var(--ds-font-weight-semibold, 600)",
108
- // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
109
- lineHeight: '20px',
110
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
111
- '> span': {
112
- marginRight: "var(--ds-space-100, 8px)"
113
- }
114
- }
115
- });
116
-
117
45
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
118
46
  export var userListStyle = css({
119
47
  listStyle: 'none',
@@ -142,7 +70,6 @@ export var userStyle = css({
142
70
  export var customTabListStyles = css({
143
71
  overflow: 'auto',
144
72
  display: 'flex',
145
- paddingBottom: "var(--ds-space-050, 4px)",
146
73
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
147
74
  'div[role=tablist]': {
148
75
  flexGrow: 1,
@@ -156,5 +83,6 @@ export var centerSpinner = css({
156
83
  display: 'flex',
157
84
  justifyContent: 'center',
158
85
  alignItems: 'center',
159
- height: '100%'
86
+ height: '100%',
87
+ marginTop: "var(--ds-space-300, 24px)"
160
88
  });
@@ -13,6 +13,7 @@ import { ModalTransition } from '@atlaskit/modal-dialog';
13
13
  import Button from '@atlaskit/button/new';
14
14
  import Tooltip from '@atlaskit/tooltip';
15
15
  import { Box, xcss } from '@atlaskit/primitives';
16
+ import { fg } from '@atlaskit/platform-feature-flags';
16
17
  import { createAndFireSafe, createPickerButtonClickedEvent, createPickerCancelledEvent, createPickerMoreClickedEvent, createReactionsRenderedEvent, createReactionSelectionEvent, isSampled } from '../../analytics';
17
18
  import { SAMPLING_RATE_REACTIONS_RENDERED_EXP } from '../../shared/constants';
18
19
  import { messages } from '../../shared/i18n';
@@ -141,7 +142,8 @@ export var Reactions = /*#__PURE__*/React.memo(function (_ref) {
141
142
  if (status !== ReactionStatus.ready) {
142
143
  renderTime.current = Date.now();
143
144
  } else {
144
- if (isSampled(SAMPLING_RATE_REACTIONS_RENDERED_EXP)) {
145
+ var isSSR = process.env.REACT_SSR && fg('platform_fix_analytics_error');
146
+ if (isSampled(SAMPLING_RATE_REACTIONS_RENDERED_EXP) && !isSSR) {
145
147
  var _renderTime$current;
146
148
  createAndFireSafe(createAnalyticsEvent, createReactionsRenderedEvent, (_renderTime$current = renderTime.current) !== null && _renderTime$current !== void 0 ? _renderTime$current : Date.now() //renderTime.current can be null during unit test cases
147
149
  );
@@ -232,6 +234,7 @@ export var Reactions = /*#__PURE__*/React.memo(function (_ref) {
232
234
  // ufo selected reaction inside the modal dialog
233
235
  ufoExperiences.selectedReactionChangeInsideDialog.start();
234
236
  handleReactionMouseEnter(emojiId);
237
+ setSelectedEmojiId(emojiId);
235
238
  if (analyticsEvent) {
236
239
  onDialogSelectReactionCallback(emojiId, analyticsEvent);
237
240
  }
@@ -309,7 +312,7 @@ export var Reactions = /*#__PURE__*/React.memo(function (_ref) {
309
312
  showOpaqueBackground: showOpaqueBackground,
310
313
  subtleReactionsSummaryAndPicker: subtleReactionsSummaryAndPicker,
311
314
  handleOpenReactionsDialog: handleOpenReactionsDialog,
312
- allowUserDialog: allowUserDialog
315
+ allowUserDialog: allowUserDialog && hasEmojiWithFivePlusReactions
313
316
  })) : memorizedReactions.map(function (reaction) {
314
317
  return jsx(Reaction, {
315
318
  key: reaction.emojiId,
@@ -0,0 +1,15 @@
1
+ import { jsx } from '@emotion/react';
2
+ import { type EmojiProvider } from '@atlaskit/emoji/resource';
3
+ import { type ReactionSummary } from '../../types';
4
+ interface ReactionsDialogModalHeaderProps {
5
+ totalReactionsCount: number;
6
+ handlePreviousPage: () => void;
7
+ handleNextPage: () => void;
8
+ currentPage: number;
9
+ maxPages: number;
10
+ emojiProvider: Promise<EmojiProvider>;
11
+ selectedEmojiId: string;
12
+ currentReactions: ReactionSummary[];
13
+ }
14
+ export declare const ReactionsDialogHeader: ({ totalReactionsCount, handlePreviousPage, handleNextPage, currentPage, maxPages, currentReactions, emojiProvider, selectedEmojiId, }: ReactionsDialogModalHeaderProps) => jsx.JSX.Element;
15
+ export {};