@atlaskit/reactions 22.5.2 → 22.5.4
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 +75 -63
- package/dist/cjs/MockReactionsClient.js +12 -17
- package/dist/cjs/analytics/index.js +130 -8
- package/dist/cjs/client/ReactionServiceClient.js +4 -5
- package/dist/cjs/components/Counter/Counter.js +11 -15
- package/dist/cjs/components/Counter/index.js +1 -7
- package/dist/cjs/components/Counter/styles.js +6 -10
- package/dist/cjs/components/EmojiButton/EmojiButton.js +9 -13
- package/dist/cjs/components/EmojiButton/styles.js +3 -4
- package/dist/cjs/components/FlashAnimation/FlashAnimation.js +5 -10
- package/dist/cjs/components/FlashAnimation/styles.js +4 -7
- package/dist/cjs/components/Reaction/Reaction.js +15 -16
- package/dist/cjs/components/Reaction/styles.js +9 -13
- package/dist/cjs/components/ReactionDialog/ReactionView.js +4 -5
- package/dist/cjs/components/ReactionDialog/ReactionsDialog.js +10 -11
- package/dist/cjs/components/ReactionDialog/ReactionsList.js +2 -3
- package/dist/cjs/components/ReactionDialog/styles.js +21 -30
- package/dist/cjs/components/ReactionPicker/ReactionPicker.js +20 -23
- package/dist/cjs/components/ReactionPicker/RepositionOnUpdate.js +2 -3
- package/dist/cjs/components/ReactionPicker/styles.js +7 -11
- package/dist/cjs/components/ReactionTooltip/ReactionTooltip.js +12 -16
- package/dist/cjs/components/ReactionTooltip/styles.js +6 -11
- package/dist/cjs/components/Reactions/Reactions.js +26 -30
- package/dist/cjs/components/Reactions/styles.js +9 -12
- package/dist/cjs/components/Selector/Selector.js +10 -12
- package/dist/cjs/components/Selector/index.js +1 -7
- package/dist/cjs/components/Selector/styles.js +6 -11
- package/dist/cjs/components/ShowMore/ShowMore.js +11 -17
- package/dist/cjs/components/ShowMore/styles.js +7 -10
- package/dist/cjs/components/Trigger/Trigger.js +6 -12
- package/dist/cjs/components/Trigger/styles.js +6 -8
- package/dist/cjs/components/UfoErrorBoundary/UfoErrorBoundary.js +2 -3
- package/dist/cjs/containers/ConnectedReactionPicker/ConnectedReactionPicker.js +4 -5
- package/dist/cjs/containers/ConnectedReactionsView/ConnectedReactionsView.js +5 -8
- package/dist/cjs/containers/index.js +13 -21
- package/dist/cjs/hooks/useFocusTrap.js +2 -3
- package/dist/cjs/i18n/cs.js +2 -3
- package/dist/cjs/i18n/da.js +2 -3
- package/dist/cjs/i18n/de.js +2 -3
- package/dist/cjs/i18n/en.js +2 -3
- package/dist/cjs/i18n/en_GB.js +2 -3
- package/dist/cjs/i18n/en_ZZ.js +2 -3
- package/dist/cjs/i18n/es.js +2 -3
- package/dist/cjs/i18n/et.js +2 -3
- package/dist/cjs/i18n/fi.js +2 -3
- package/dist/cjs/i18n/fr.js +2 -3
- package/dist/cjs/i18n/hu.js +2 -3
- package/dist/cjs/i18n/is.js +2 -3
- package/dist/cjs/i18n/it.js +2 -3
- package/dist/cjs/i18n/ja.js +2 -3
- package/dist/cjs/i18n/ko.js +2 -3
- package/dist/cjs/i18n/languages.js +2 -3
- package/dist/cjs/i18n/nb.js +2 -3
- package/dist/cjs/i18n/nl.js +2 -3
- package/dist/cjs/i18n/pl.js +2 -3
- package/dist/cjs/i18n/pt_BR.js +2 -3
- package/dist/cjs/i18n/pt_PT.js +2 -3
- package/dist/cjs/i18n/ro.js +2 -3
- package/dist/cjs/i18n/ru.js +2 -3
- package/dist/cjs/i18n/sk.js +2 -3
- package/dist/cjs/i18n/sv.js +2 -3
- package/dist/cjs/i18n/th.js +2 -3
- package/dist/cjs/i18n/tr.js +2 -3
- package/dist/cjs/i18n/uk.js +2 -3
- package/dist/cjs/i18n/vi.js +2 -3
- package/dist/cjs/i18n/zh.js +2 -3
- package/dist/cjs/i18n/zh_TW.js +2 -3
- package/dist/cjs/index.js +28 -15
- package/dist/cjs/shared/constants.js +7 -14
- package/dist/cjs/shared/i18n.js +2 -3
- package/dist/cjs/shared/utils.js +5 -9
- package/dist/cjs/store/MemoryReactionsStore.js +31 -37
- package/dist/cjs/store/ReactionConsumer.js +2 -3
- package/dist/cjs/store/utils.js +9 -16
- package/dist/cjs/types/reaction.js +2 -3
- package/dist/cjs/ufo/index.js +92 -0
- package/dist/es2019/MockReactionsClient.js +2 -2
- package/dist/es2019/analytics/index.js +95 -4
- package/dist/es2019/components/Counter/Counter.js +6 -6
- package/dist/es2019/components/Counter/index.js +1 -3
- package/dist/es2019/components/Counter/styles.js +1 -1
- package/dist/es2019/components/EmojiButton/EmojiButton.js +6 -5
- package/dist/es2019/components/EmojiButton/styles.js +1 -1
- package/dist/es2019/components/FlashAnimation/FlashAnimation.js +2 -2
- package/dist/es2019/components/Reaction/Reaction.js +13 -12
- package/dist/es2019/components/Reaction/styles.js +2 -2
- package/dist/es2019/components/ReactionDialog/ReactionView.js +2 -2
- package/dist/es2019/components/ReactionDialog/ReactionsDialog.js +5 -4
- package/dist/es2019/components/ReactionDialog/styles.js +10 -9
- package/dist/es2019/components/ReactionPicker/ReactionPicker.js +13 -13
- package/dist/es2019/components/ReactionPicker/styles.js +2 -2
- package/dist/es2019/components/ReactionTooltip/ReactionTooltip.js +9 -8
- package/dist/es2019/components/Reactions/Reactions.js +21 -21
- package/dist/es2019/components/Reactions/styles.js +5 -5
- package/dist/es2019/components/Selector/Selector.js +7 -7
- package/dist/es2019/components/Selector/index.js +1 -3
- package/dist/es2019/components/ShowMore/ShowMore.js +7 -7
- package/dist/es2019/components/ShowMore/styles.js +3 -3
- package/dist/es2019/components/Trigger/Trigger.js +2 -2
- package/dist/es2019/components/Trigger/styles.js +1 -1
- package/dist/es2019/containers/ConnectedReactionPicker/ConnectedReactionPicker.js +2 -2
- package/dist/es2019/containers/index.js +2 -2
- package/dist/es2019/index.js +27 -5
- package/dist/es2019/store/MemoryReactionsStore.js +21 -23
- package/dist/esm/MockReactionsClient.js +4 -4
- package/dist/esm/analytics/index.js +127 -4
- package/dist/esm/client/ReactionServiceClient.js +2 -2
- package/dist/esm/components/Counter/Counter.js +6 -6
- package/dist/esm/components/Counter/index.js +1 -3
- package/dist/esm/components/Counter/styles.js +1 -1
- package/dist/esm/components/EmojiButton/EmojiButton.js +6 -5
- package/dist/esm/components/EmojiButton/styles.js +1 -1
- package/dist/esm/components/FlashAnimation/FlashAnimation.js +2 -2
- package/dist/esm/components/Reaction/Reaction.js +13 -12
- package/dist/esm/components/Reaction/styles.js +2 -2
- package/dist/esm/components/ReactionDialog/ReactionView.js +2 -2
- package/dist/esm/components/ReactionDialog/ReactionsDialog.js +7 -6
- package/dist/esm/components/ReactionDialog/styles.js +10 -9
- package/dist/esm/components/ReactionPicker/ReactionPicker.js +16 -16
- package/dist/esm/components/ReactionPicker/styles.js +2 -2
- package/dist/esm/components/ReactionTooltip/ReactionTooltip.js +9 -8
- package/dist/esm/components/Reactions/Reactions.js +21 -21
- package/dist/esm/components/Reactions/styles.js +5 -5
- package/dist/esm/components/Selector/Selector.js +7 -7
- package/dist/esm/components/Selector/index.js +1 -3
- package/dist/esm/components/ShowMore/ShowMore.js +7 -7
- package/dist/esm/components/ShowMore/styles.js +3 -3
- package/dist/esm/components/Trigger/Trigger.js +2 -2
- package/dist/esm/components/Trigger/styles.js +3 -3
- package/dist/esm/containers/ConnectedReactionPicker/ConnectedReactionPicker.js +2 -2
- package/dist/esm/containers/ConnectedReactionsView/ConnectedReactionsView.js +1 -1
- package/dist/esm/containers/index.js +2 -2
- package/dist/esm/index.js +27 -5
- package/dist/esm/store/MemoryReactionsStore.js +23 -25
- package/dist/esm/store/utils.js +2 -2
- package/dist/types/analytics/index.d.ts +121 -2
- package/dist/types/components/Counter/index.d.ts +0 -1
- package/dist/types/components/ReactionPicker/ReactionPicker.d.ts +1 -1
- package/dist/types/components/Reactions/styles.d.ts +1 -1
- package/dist/types/components/Selector/Selector.d.ts +1 -1
- package/dist/types/components/Selector/index.d.ts +0 -1
- package/dist/types/containers/index.d.ts +2 -2
- package/dist/types/index.d.ts +24 -3
- package/dist/types/store/MemoryReactionsStore.d.ts +6 -6
- package/dist/types-ts4.5/analytics/index.d.ts +121 -2
- package/dist/types-ts4.5/components/Counter/index.d.ts +0 -1
- package/dist/types-ts4.5/components/ReactionPicker/ReactionPicker.d.ts +1 -1
- package/dist/types-ts4.5/components/Reactions/styles.d.ts +1 -1
- package/dist/types-ts4.5/components/Selector/Selector.d.ts +1 -1
- package/dist/types-ts4.5/components/Selector/index.d.ts +0 -1
- package/dist/types-ts4.5/containers/index.d.ts +2 -2
- package/dist/types-ts4.5/index.d.ts +24 -3
- package/dist/types-ts4.5/store/MemoryReactionsStore.d.ts +6 -6
- package/package.json +9 -10
- package/report.api.md +494 -0
- package/tmp/api-report-tmp.d.ts +398 -0
- package/dist/cjs/analytics/analytics.js +0 -149
- package/dist/cjs/analytics/ufo.js +0 -103
- package/dist/cjs/hooks/index.js +0 -12
- package/dist/cjs/shared/index.js +0 -15
- package/dist/es2019/analytics/analytics.js +0 -95
- package/dist/es2019/hooks/index.js +0 -1
- package/dist/es2019/shared/index.js +0 -6
- package/dist/esm/analytics/analytics.js +0 -127
- package/dist/esm/hooks/index.js +0 -1
- package/dist/esm/shared/index.js +0 -6
- package/dist/types/analytics/analytics.d.ts +0 -121
- package/dist/types/hooks/index.d.ts +0 -1
- package/dist/types/shared/index.d.ts +0 -3
- package/dist/types-ts4.5/analytics/analytics.d.ts +0 -121
- package/dist/types-ts4.5/hooks/index.d.ts +0 -1
- package/dist/types-ts4.5/shared/index.d.ts +0 -3
- /package/dist/es2019/{analytics/ufo.js → ufo/index.js} +0 -0
- /package/dist/esm/{analytics/ufo.js → ufo/index.js} +0 -0
- /package/dist/types/{analytics/ufo.d.ts → ufo/index.d.ts} +0 -0
- /package/dist/types-ts4.5/{analytics/ufo.d.ts → ufo/index.d.ts} +0 -0
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import React, { useEffect, useRef, useState } from 'react';
|
|
3
3
|
import { jsx } from '@emotion/react';
|
|
4
4
|
import Tooltip from '@atlaskit/tooltip';
|
|
5
|
-
import {
|
|
5
|
+
import { DefaultReactions } from '../../shared/constants';
|
|
6
6
|
import { EmojiButton } from '../EmojiButton';
|
|
7
7
|
import { ShowMore } from '../ShowMore';
|
|
8
|
-
import
|
|
8
|
+
import { emojiStyle, revealStyle, selectorStyle } from './styles';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Test id for wrapper Selector div
|
|
@@ -19,7 +19,7 @@ export const Selector = ({
|
|
|
19
19
|
onMoreClick,
|
|
20
20
|
onSelection,
|
|
21
21
|
showMore,
|
|
22
|
-
pickerQuickReactionEmojiIds =
|
|
22
|
+
pickerQuickReactionEmojiIds = DefaultReactions
|
|
23
23
|
}) => {
|
|
24
24
|
const [selection, setSelection] = useState();
|
|
25
25
|
/**
|
|
@@ -68,7 +68,7 @@ export const Selector = ({
|
|
|
68
68
|
return jsx("div", {
|
|
69
69
|
key: (_emoji$id = emoji.id) !== null && _emoji$id !== void 0 ? _emoji$id : emoji.shortName,
|
|
70
70
|
className: emoji === selection ? 'selected' : undefined,
|
|
71
|
-
css: [
|
|
71
|
+
css: [emojiStyle, revealStyle],
|
|
72
72
|
style: emojiStyleAnimation(index),
|
|
73
73
|
"data-testid": RENDER_SELECTOR_TESTID
|
|
74
74
|
}, jsx(Tooltip, {
|
|
@@ -80,12 +80,12 @@ export const Selector = ({
|
|
|
80
80
|
})));
|
|
81
81
|
};
|
|
82
82
|
return jsx("div", {
|
|
83
|
-
css:
|
|
83
|
+
css: selectorStyle
|
|
84
84
|
}, pickerQuickReactionEmojiIds ? pickerQuickReactionEmojiIds.map(renderEmoji) : null, showMore ? jsx(ShowMore, {
|
|
85
85
|
key: "more",
|
|
86
|
-
buttonStyle:
|
|
86
|
+
buttonStyle: revealStyle,
|
|
87
87
|
style: {
|
|
88
|
-
button: emojiStyleAnimation(
|
|
88
|
+
button: emojiStyleAnimation(DefaultReactions.length)
|
|
89
89
|
},
|
|
90
90
|
onClick: onMoreClick
|
|
91
91
|
}) : null);
|
|
@@ -4,8 +4,8 @@ import { jsx } from '@emotion/react';
|
|
|
4
4
|
import { FormattedMessage } from 'react-intl-next';
|
|
5
5
|
import EditorMoreIcon from '@atlaskit/icon/glyph/editor/more';
|
|
6
6
|
import Tooltip from '@atlaskit/tooltip';
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
7
|
+
import { messages } from '../../shared/i18n';
|
|
8
|
+
import { moreButtonStyle, moreEmojiContainerStyle, separatorStyle } from './styles';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Test id for wrapper button
|
|
@@ -23,17 +23,17 @@ export const ShowMore = ({
|
|
|
23
23
|
}) => {
|
|
24
24
|
return jsx("div", {
|
|
25
25
|
className: className.container,
|
|
26
|
-
css:
|
|
26
|
+
css: moreEmojiContainerStyle,
|
|
27
27
|
style: style.container,
|
|
28
28
|
"data-testid": RENDER_WRAPPER_TESTID
|
|
29
29
|
}, jsx("div", {
|
|
30
|
-
css:
|
|
31
|
-
}), jsx(FormattedMessage,
|
|
30
|
+
css: separatorStyle
|
|
31
|
+
}), jsx(FormattedMessage, messages.moreEmoji, message => jsx(Tooltip, {
|
|
32
32
|
content: message
|
|
33
33
|
}, jsx("button", {
|
|
34
34
|
className: className.button,
|
|
35
|
-
css: [
|
|
36
|
-
"aria-label":
|
|
35
|
+
css: [moreButtonStyle, buttonStyle],
|
|
36
|
+
"aria-label": messages.moreEmoji.defaultMessage,
|
|
37
37
|
type: "button",
|
|
38
38
|
style: style.button,
|
|
39
39
|
onClick: onClick,
|
|
@@ -12,8 +12,8 @@ export const moreButtonStyle = css({
|
|
|
12
12
|
border: 0,
|
|
13
13
|
borderRadius: `${borderRadius()}px`,
|
|
14
14
|
cursor: 'pointer',
|
|
15
|
-
margin:
|
|
16
|
-
padding:
|
|
15
|
+
margin: `${"var(--ds-space-050, 4px)"} ${"var(--ds-space-050, 4px)"} ${"var(--ds-space-050, 4px)"} 0`,
|
|
16
|
+
padding: "var(--ds-space-050, 4px)",
|
|
17
17
|
width: '38px',
|
|
18
18
|
verticalAlign: 'top',
|
|
19
19
|
'&:hover': {
|
|
@@ -22,7 +22,7 @@ export const moreButtonStyle = css({
|
|
|
22
22
|
});
|
|
23
23
|
export const separatorStyle = css({
|
|
24
24
|
backgroundColor: `var(--ds-border, ${N30A})`,
|
|
25
|
-
margin:
|
|
25
|
+
margin: `${"var(--ds-space-100, 8px)"} ${"var(--ds-space-100, 8px)"} ${"var(--ds-space-100, 8px)"} ${"var(--ds-space-050, 4px)"}`,
|
|
26
26
|
width: '1px',
|
|
27
27
|
height: '60%',
|
|
28
28
|
display: 'inline-block'
|
|
@@ -5,7 +5,7 @@ import { jsx } from '@emotion/react';
|
|
|
5
5
|
import Button from '@atlaskit/button/standard-button';
|
|
6
6
|
import Tooltip from '@atlaskit/tooltip';
|
|
7
7
|
import EmojiAddIcon from '@atlaskit/icon/glyph/emoji-add';
|
|
8
|
-
import
|
|
8
|
+
import { triggerStyle } from './styles';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Test id for the tooltip
|
|
@@ -33,7 +33,7 @@ export const Trigger = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
33
33
|
content: tooltipContent
|
|
34
34
|
}, jsx(Button, _extends({
|
|
35
35
|
testId: RENDER_TRIGGER_BUTTON_TESTID,
|
|
36
|
-
css:
|
|
36
|
+
css: triggerStyle({
|
|
37
37
|
miniMode,
|
|
38
38
|
disabled
|
|
39
39
|
}),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { ReactionPicker, UfoErrorBoundary } from '../../components';
|
|
4
|
-
import {
|
|
4
|
+
import { PickerRender } from '../../ufo';
|
|
5
5
|
/**
|
|
6
6
|
* Reaction Picker component
|
|
7
7
|
*/
|
|
@@ -22,7 +22,7 @@ export const ConnectedReactionPicker = props => {
|
|
|
22
22
|
})();
|
|
23
23
|
};
|
|
24
24
|
return /*#__PURE__*/React.createElement(UfoErrorBoundary, {
|
|
25
|
-
experiences: [
|
|
25
|
+
experiences: [PickerRender]
|
|
26
26
|
}, /*#__PURE__*/React.createElement(ReactionPicker, _extends({}, props, {
|
|
27
27
|
onSelection: onSelection
|
|
28
28
|
})));
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export { ConnectedReactionPicker } from './ConnectedReactionPicker';
|
|
2
|
+
export { ConnectedReactionsView } from './ConnectedReactionsView';
|
package/dist/es2019/index.js
CHANGED
|
@@ -1,8 +1,30 @@
|
|
|
1
|
-
|
|
1
|
+
import { DefaultReactions, DefaultReactionsByShortName, ExtendedReactions, ExtendedReactionsByShortName, NUMBER_OF_REACTIONS_TO_DISPLAY, SAMPLING_RATE_REACTIONS_RENDERED_EXP, TOOLTIP_USERS_LIMIT } from './shared/constants';
|
|
2
|
+
import { ComponentName, ExperienceName, PickerRender, ReactionsAdd, ReactionDetailsFetch, ReactionDialogClosed, ReactionDialogOpened, ReactionDialogSelectedReactionChanged, ReactionsRemove, ReactionsRendered, sampledReactionsRendered } from './ufo';
|
|
2
3
|
export { ReactionServiceClient } from './client';
|
|
3
|
-
// TODO: Convert all calls for ReactionRequest to Request, RequestClient to Client and ReactionsStore to Store
|
|
4
|
-
|
|
5
|
-
export { constants } from './shared';
|
|
6
4
|
export { Reaction, ReactionPicker, Reactions } from './components';
|
|
7
5
|
export { ConnectedReactionPicker, ConnectedReactionsView } from './containers';
|
|
8
|
-
export { MemoryReactionsStore, ReactionConsumer } from './store';
|
|
6
|
+
export { MemoryReactionsStore, ReactionConsumer } from './store';
|
|
7
|
+
// TODO: Convert all calls for ReactionRequest to Request, RequestClient to Client and ReactionsStore to Store
|
|
8
|
+
|
|
9
|
+
export const constants = {
|
|
10
|
+
DefaultReactions,
|
|
11
|
+
DefaultReactionsByShortName,
|
|
12
|
+
ExtendedReactions,
|
|
13
|
+
ExtendedReactionsByShortName,
|
|
14
|
+
NUMBER_OF_REACTIONS_TO_DISPLAY,
|
|
15
|
+
SAMPLING_RATE_REACTIONS_RENDERED_EXP,
|
|
16
|
+
TOOLTIP_USERS_LIMIT
|
|
17
|
+
};
|
|
18
|
+
export const UFO = {
|
|
19
|
+
ComponentName,
|
|
20
|
+
ExperienceName,
|
|
21
|
+
PickerRender,
|
|
22
|
+
ReactionsAdd,
|
|
23
|
+
ReactionDetailsFetch,
|
|
24
|
+
ReactionDialogClosed,
|
|
25
|
+
ReactionDialogOpened,
|
|
26
|
+
ReactionDialogSelectedReactionChanged,
|
|
27
|
+
ReactionsRemove,
|
|
28
|
+
ReactionsRendered,
|
|
29
|
+
sampledReactionsRendered
|
|
30
|
+
};
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
2
|
+
import { createAndFireSafe, createRestFailedEvent, createRestSucceededEvent, extractErrorInfo } from '../analytics';
|
|
3
|
+
import { ReactionStatus } from '../types';
|
|
4
4
|
import { batch, batchByKey } from './batched';
|
|
5
|
-
import
|
|
6
|
-
import { isRealErrorFromService } from './utils';
|
|
5
|
+
import { addOne, byEmojiId, flattenAris, getReactionsSortFunction, isRealErrorFromService, readyState, removeOne, updateByEmojiId } from './utils';
|
|
7
6
|
import { SAMPLING_RATE_REACTIONS_RENDERED_EXP } from '../shared/constants';
|
|
8
|
-
import { sampledReactionsRendered } from '../
|
|
9
|
-
import { extractErrorInfo } from '../analytics/analytics';
|
|
7
|
+
import { ReactionsAdd, ReactionDetailsFetch, ReactionsRemove, sampledReactionsRendered } from '../ufo';
|
|
10
8
|
|
|
11
9
|
/**
|
|
12
10
|
* Set of all available UFO experiences relating to reaction element
|
|
@@ -15,11 +13,11 @@ export const ufoExperiences = {
|
|
|
15
13
|
/**
|
|
16
14
|
* Experience when a reaction emoji gets added
|
|
17
15
|
*/
|
|
18
|
-
add:
|
|
16
|
+
add: ReactionsAdd,
|
|
19
17
|
/**
|
|
20
18
|
* Experience when a reaction emoji gets removed/decrement
|
|
21
19
|
*/
|
|
22
|
-
remove:
|
|
20
|
+
remove: ReactionsRemove,
|
|
23
21
|
/**
|
|
24
22
|
* Experience when the list of reactions gets rendered with sampling
|
|
25
23
|
*/
|
|
@@ -27,7 +25,7 @@ export const ufoExperiences = {
|
|
|
27
25
|
/**
|
|
28
26
|
* Experience when a reaction details gets fetched
|
|
29
27
|
*/
|
|
30
|
-
fetchDetails:
|
|
28
|
+
fetchDetails: ReactionDetailsFetch
|
|
31
29
|
};
|
|
32
30
|
|
|
33
31
|
/**
|
|
@@ -113,7 +111,7 @@ export class MemoryReactionsStore {
|
|
|
113
111
|
});
|
|
114
112
|
}
|
|
115
113
|
}
|
|
116
|
-
return
|
|
114
|
+
return readyState(reactions);
|
|
117
115
|
});
|
|
118
116
|
});
|
|
119
117
|
_defineProperty(this, "doAddReaction", reaction => {
|
|
@@ -122,7 +120,7 @@ export class MemoryReactionsStore {
|
|
|
122
120
|
ari,
|
|
123
121
|
emojiId
|
|
124
122
|
} = reaction;
|
|
125
|
-
this.optmisticUpdate(containerAri, ari, emojiId)(
|
|
123
|
+
this.optmisticUpdate(containerAri, ari, emojiId)(addOne);
|
|
126
124
|
this.flash(reaction);
|
|
127
125
|
const exp = ufoExperiences.add.getInstance(`${ari}|${emojiId}`);
|
|
128
126
|
// ufo start reaction experience
|
|
@@ -136,13 +134,13 @@ export class MemoryReactionsStore {
|
|
|
136
134
|
});
|
|
137
135
|
this.client.addReaction(containerAri, ari, emojiId, this.metadata).then(_ => {
|
|
138
136
|
if (this.createAnalyticsEvent) {
|
|
139
|
-
|
|
137
|
+
createAndFireSafe(this.createAnalyticsEvent, createRestSucceededEvent, 'addReaction');
|
|
140
138
|
}
|
|
141
139
|
// ufo add reaction success
|
|
142
140
|
exp.success();
|
|
143
141
|
}).catch(error => {
|
|
144
142
|
if (isRealErrorFromService(error.code)) {
|
|
145
|
-
this.createAnalyticsEvent &&
|
|
143
|
+
this.createAnalyticsEvent && createAndFireSafe(this.createAnalyticsEvent, createRestFailedEvent, 'addReaction', error.code);
|
|
146
144
|
// ufo add reaction failure
|
|
147
145
|
exp.failure({
|
|
148
146
|
metadata: {
|
|
@@ -172,7 +170,7 @@ export class MemoryReactionsStore {
|
|
|
172
170
|
containerAri,
|
|
173
171
|
emojiId
|
|
174
172
|
});
|
|
175
|
-
this.optmisticUpdate(containerAri, ari, emojiId)(
|
|
173
|
+
this.optmisticUpdate(containerAri, ari, emojiId)(removeOne);
|
|
176
174
|
this.client.deleteReaction(containerAri, ari, emojiId, this.metadata).then(_ => {
|
|
177
175
|
// ufo add reaction success
|
|
178
176
|
exp.success();
|
|
@@ -195,7 +193,7 @@ export class MemoryReactionsStore {
|
|
|
195
193
|
* All reactions are usually fetched in a single call to reactions-service. Need to check why "getReactions" gets called randomly 1-2 times everytime on each fetch request despite using same containerAri.
|
|
196
194
|
*/
|
|
197
195
|
const sampledExp = ufoExperiences.render(containerAri);
|
|
198
|
-
const arisArr = aris.reduce(
|
|
196
|
+
const arisArr = aris.reduce(flattenAris);
|
|
199
197
|
// ufo start reaction experience
|
|
200
198
|
sampledExp.start({
|
|
201
199
|
samplingRate: SAMPLING_RATE_REACTIONS_RENDERED_EXP
|
|
@@ -209,18 +207,18 @@ export class MemoryReactionsStore {
|
|
|
209
207
|
this.client.getReactions(containerAri, arisArr).then(value => {
|
|
210
208
|
Object.keys(value).map(ari => {
|
|
211
209
|
const reactionsState = this.getReactionsState(containerAri, ari);
|
|
212
|
-
const reactions = reactionsState && reactionsState.status ===
|
|
213
|
-
this.setReactions(containerAri, ari,
|
|
210
|
+
const reactions = reactionsState && reactionsState.status === ReactionStatus.ready ? reactionsState.reactions : undefined;
|
|
211
|
+
this.setReactions(containerAri, ari, readyState(value[ari].sort(getReactionsSortFunction(reactions))));
|
|
214
212
|
});
|
|
215
213
|
}).then(() => {
|
|
216
214
|
if (this.createAnalyticsEvent) {
|
|
217
|
-
|
|
215
|
+
createAndFireSafe(this.createAnalyticsEvent, createRestSucceededEvent, 'getReactions');
|
|
218
216
|
}
|
|
219
217
|
sampledExp.success();
|
|
220
218
|
}).catch(error => {
|
|
221
219
|
if (isRealErrorFromService(error.code)) {
|
|
222
220
|
if (this.createAnalyticsEvent) {
|
|
223
|
-
|
|
221
|
+
createAndFireSafe(this.createAnalyticsEvent, createRestFailedEvent, 'getReactions');
|
|
224
222
|
}
|
|
225
223
|
sampledExp.failure({
|
|
226
224
|
metadata: {
|
|
@@ -233,7 +231,7 @@ export class MemoryReactionsStore {
|
|
|
233
231
|
...acc,
|
|
234
232
|
[`${containerAri}|${ari}`]: {
|
|
235
233
|
reactions: [],
|
|
236
|
-
status:
|
|
234
|
+
status: ReactionStatus.error
|
|
237
235
|
}
|
|
238
236
|
}), {});
|
|
239
237
|
this.setState({
|
|
@@ -310,7 +308,7 @@ export class MemoryReactionsStore {
|
|
|
310
308
|
withReadyReaction(containerAri, ari) {
|
|
311
309
|
return updater => {
|
|
312
310
|
const reactionsState = this.getReactionsState(containerAri, ari);
|
|
313
|
-
if (reactionsState && reactionsState.status ===
|
|
311
|
+
if (reactionsState && reactionsState.status === ReactionStatus.ready) {
|
|
314
312
|
const updated = updater(reactionsState);
|
|
315
313
|
if (updated) {
|
|
316
314
|
this.setReactions(containerAri, ari, updated);
|
|
@@ -335,7 +333,7 @@ export class MemoryReactionsStore {
|
|
|
335
333
|
withReaction(reactedCallback, notReactedCallback) {
|
|
336
334
|
return (containerAri, ari, emojiId) => {
|
|
337
335
|
this.withReadyReaction(containerAri, ari)(reactionsState => {
|
|
338
|
-
const reaction = reactionsState.reactions.find(
|
|
336
|
+
const reaction = reactionsState.reactions.find(byEmojiId(emojiId)) || {
|
|
339
337
|
containerAri,
|
|
340
338
|
ari,
|
|
341
339
|
emojiId,
|
|
@@ -345,7 +343,7 @@ export class MemoryReactionsStore {
|
|
|
345
343
|
const callback = reaction.reacted || !notReactedCallback ? reactedCallback : notReactedCallback;
|
|
346
344
|
const updatedReaction = callback(reaction);
|
|
347
345
|
if (updatedReaction && !(updatedReaction instanceof Function)) {
|
|
348
|
-
return
|
|
346
|
+
return readyState(reactionsState.reactions.map(updateByEmojiId(emojiId, updatedReaction)));
|
|
349
347
|
}
|
|
350
348
|
return;
|
|
351
349
|
});
|
|
@@ -3,14 +3,14 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
|
3
3
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
4
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
5
5
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
6
|
-
function ownKeys(
|
|
7
|
-
function _objectSpread(
|
|
6
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
8
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
9
|
-
import {
|
|
9
|
+
import { DefaultReactionsByShortName, ExtendedReactionsByShortName } from './shared/constants';
|
|
10
10
|
export var containerAri = 'ari:cloud:owner:demo-cloud-id:container/1';
|
|
11
11
|
export var ari = 'ari:cloud:owner:demo-cloud-id:item/1';
|
|
12
12
|
export var getReactionSummary = function getReactionSummary(shortName, count, reacted, extendedReactions) {
|
|
13
|
-
var getReactionsByShortName = extendedReactions ?
|
|
13
|
+
var getReactionsByShortName = extendedReactions ? ExtendedReactionsByShortName.get(shortName) : DefaultReactionsByShortName.get(shortName);
|
|
14
14
|
return {
|
|
15
15
|
ari: ari,
|
|
16
16
|
containerAri: containerAri,
|
|
@@ -1,4 +1,127 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
import { createAndFireEvent } from '@atlaskit/analytics-next';
|
|
5
|
+
import { UI_EVENT_TYPE, OPERATIONAL_EVENT_TYPE } from '@atlaskit/analytics-gas-types';
|
|
6
|
+
var packageName = "@atlaskit/reactions";
|
|
7
|
+
var packageVersion = "22.5.4";
|
|
8
|
+
/**
|
|
9
|
+
* TODO: move to utility package?
|
|
10
|
+
* A random sampling function
|
|
11
|
+
* sampling algorithm is from @atlassian/jira-coinflip at https://stash.atlassian.com/projects/JIRACLOUD/repos/jira-frontend/browse/src/packages/platform/app-framework/coinflip/src/index.tsx
|
|
12
|
+
* E.g. isSampled(2) will pass 50% of the time
|
|
13
|
+
* @param rate The chance that it will pass (1 in <rate> times)
|
|
14
|
+
* @returns bool, if it passes or not
|
|
15
|
+
*/ // default sampling function to determine which one to be sampled
|
|
16
|
+
export var isSampled = function isSampled(rate) {
|
|
17
|
+
if (rate === 1) {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
if (rate === 0) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
return Math.random() * rate <= 1;
|
|
24
|
+
};
|
|
25
|
+
export var createAndFireEventInElementsChannel = createAndFireEvent('fabric-elements');
|
|
26
|
+
export var createAndFireSafe = function createAndFireSafe(createAnalyticsEvent, creator) {
|
|
27
|
+
if (createAnalyticsEvent) {
|
|
28
|
+
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
29
|
+
args[_key - 2] = arguments[_key];
|
|
30
|
+
}
|
|
31
|
+
createAndFireEventInElementsChannel(creator.apply(void 0, args))(createAnalyticsEvent);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
var createPayload = function createPayload(action, actionSubject, eventType, actionSubjectId) {
|
|
35
|
+
return function () {
|
|
36
|
+
var attributes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
37
|
+
return {
|
|
38
|
+
action: action,
|
|
39
|
+
actionSubject: actionSubject,
|
|
40
|
+
eventType: eventType,
|
|
41
|
+
actionSubjectId: actionSubjectId,
|
|
42
|
+
attributes: _objectSpread(_objectSpread({}, attributes), {}, {
|
|
43
|
+
packageName: packageName,
|
|
44
|
+
packageVersion: packageVersion
|
|
45
|
+
})
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
var calculateDuration = function calculateDuration(startTime) {
|
|
50
|
+
return startTime ? Date.now() - startTime : undefined;
|
|
51
|
+
};
|
|
52
|
+
var getPreviousState = function getPreviousState(reaction) {
|
|
53
|
+
if (reaction) {
|
|
54
|
+
if (reaction.reacted) {
|
|
55
|
+
return 'existingReacted';
|
|
56
|
+
}
|
|
57
|
+
return 'existingNotReacted';
|
|
58
|
+
}
|
|
59
|
+
return 'new';
|
|
60
|
+
};
|
|
61
|
+
export var createRestSucceededEvent = function createRestSucceededEvent(actionSubject) {
|
|
62
|
+
return createPayload('succeeded', actionSubject, OPERATIONAL_EVENT_TYPE)();
|
|
63
|
+
};
|
|
64
|
+
export var createRestFailedEvent = function createRestFailedEvent(actionSubject, errorCode) {
|
|
65
|
+
return createPayload('failed', actionSubject, OPERATIONAL_EVENT_TYPE)({
|
|
66
|
+
errorCode: errorCode
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
export var createReactionsRenderedEvent = function createReactionsRenderedEvent(startTime) {
|
|
70
|
+
return createPayload('rendered', 'reactionView', OPERATIONAL_EVENT_TYPE)({
|
|
71
|
+
duration: calculateDuration(startTime)
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
export var createPickerButtonClickedEvent = function createPickerButtonClickedEvent(reactionEmojiCount) {
|
|
75
|
+
return createPayload('clicked', 'reactionPickerButton', UI_EVENT_TYPE)({
|
|
76
|
+
reactionEmojiCount: reactionEmojiCount
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
export var createPickerCancelledEvent = function createPickerCancelledEvent(startTime) {
|
|
80
|
+
return createPayload('cancelled', 'reactionPicker', UI_EVENT_TYPE)({
|
|
81
|
+
duration: calculateDuration(startTime)
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
export var createPickerMoreClickedEvent = function createPickerMoreClickedEvent(startTime) {
|
|
85
|
+
return createPayload('clicked', 'reactionPicker', UI_EVENT_TYPE, 'more')({
|
|
86
|
+
duration: calculateDuration(startTime)
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
export var createReactionSelectionEvent = function createReactionSelectionEvent(source, emojiId, reaction, startTime) {
|
|
90
|
+
return createPayload('clicked', 'reactionPicker', UI_EVENT_TYPE, 'emoji')({
|
|
91
|
+
duration: calculateDuration(startTime),
|
|
92
|
+
source: source,
|
|
93
|
+
previousState: getPreviousState(reaction),
|
|
94
|
+
emojiId: emojiId
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
export var createReactionHoveredEvent = function createReactionHoveredEvent(startTime) {
|
|
98
|
+
return createPayload('hovered', 'existingReaction', UI_EVENT_TYPE)({
|
|
99
|
+
duration: calculateDuration(startTime)
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
export var createReactionFocusedEvent = function createReactionFocusedEvent(startTime) {
|
|
103
|
+
return createPayload('focused', 'existingReaction', UI_EVENT_TYPE)({
|
|
104
|
+
duration: calculateDuration(startTime)
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
export var createReactionClickedEvent = function createReactionClickedEvent(added, emojiId) {
|
|
108
|
+
return createPayload('clicked', 'existingReaction', UI_EVENT_TYPE)({
|
|
109
|
+
added: added,
|
|
110
|
+
emojiId: emojiId
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Used for store failure metadata for analytics
|
|
116
|
+
* @param error The error could be a service error with {code, reason} or an Error
|
|
117
|
+
* @returns any
|
|
118
|
+
*/
|
|
119
|
+
export var extractErrorInfo = function extractErrorInfo(error) {
|
|
120
|
+
if (error instanceof Error) {
|
|
121
|
+
return {
|
|
122
|
+
name: error.name,
|
|
123
|
+
message: error.message
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
return error;
|
|
127
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
-
function ownKeys(
|
|
5
|
-
function _objectSpread(
|
|
4
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
6
|
import { utils } from '@atlaskit/util-service-support';
|
|
7
7
|
/**
|
|
8
8
|
* Utility class to retrieve/modify all actions on reactions collection
|
|
@@ -4,8 +4,8 @@ import { jsx, css } from '@emotion/react';
|
|
|
4
4
|
import { SlideIn, ExitingPersistence, mediumDurationMs } from '@atlaskit/motion';
|
|
5
5
|
// eslint-disable-next-line @atlaskit/design-system/no-banned-imports
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
7
|
+
import { formatLargeNumber } from '../../shared/utils';
|
|
8
|
+
import { containerStyle, counterLabelStyle, countStyle, highlightStyle } from './styles';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Test id for component top level div
|
|
@@ -40,7 +40,7 @@ export var Counter = function Counter(_ref) {
|
|
|
40
40
|
} else if (value === 0) {
|
|
41
41
|
return '';
|
|
42
42
|
} else {
|
|
43
|
-
return
|
|
43
|
+
return formatLargeNumber(value);
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
46
|
var lastValue = useRef();
|
|
@@ -54,7 +54,7 @@ export var Counter = function Counter(_ref) {
|
|
|
54
54
|
return jsx("div", {
|
|
55
55
|
className: className,
|
|
56
56
|
"data-testid": RENDER_COMPONENT_WRAPPER,
|
|
57
|
-
css:
|
|
57
|
+
css: countStyle
|
|
58
58
|
}, jsx(ExitingPersistence, null, jsx(SlideIn, {
|
|
59
59
|
enterFrom: isIncreasing ? 'top' : 'bottom',
|
|
60
60
|
exitTo: isIncreasing ? 'top' : 'bottom',
|
|
@@ -63,14 +63,14 @@ export var Counter = function Counter(_ref) {
|
|
|
63
63
|
}, function (motion, direction) {
|
|
64
64
|
return jsx("div", {
|
|
65
65
|
ref: motion.ref,
|
|
66
|
-
css: [
|
|
66
|
+
css: [containerStyle, css({
|
|
67
67
|
position: direction === 'exiting' ? 'absolute' : undefined
|
|
68
68
|
})],
|
|
69
69
|
className: motion.className,
|
|
70
70
|
"data-testid": RENDER_COUNTER_TESTID
|
|
71
71
|
}, jsx("span", {
|
|
72
72
|
"data-testid": RENDER_LABEL_TESTID,
|
|
73
|
-
css: highlight ? [
|
|
73
|
+
css: highlight ? [counterLabelStyle, highlightStyle] : counterLabelStyle,
|
|
74
74
|
key: value
|
|
75
75
|
}, label));
|
|
76
76
|
})));
|
|
@@ -1,3 +1 @@
|
|
|
1
|
-
export { Counter, RENDER_COUNTER_TESTID, RENDER_COMPONENT_WRAPPER, RENDER_LABEL_TESTID } from './Counter';
|
|
2
|
-
import * as _styles from './styles';
|
|
3
|
-
export { _styles as styles };
|
|
1
|
+
export { Counter, RENDER_COUNTER_TESTID, RENDER_COMPONENT_WRAPPER, RENDER_LABEL_TESTID } from './Counter';
|
|
@@ -6,7 +6,7 @@ export var countStyle = css({
|
|
|
6
6
|
color: "var(--ds-text-subtlest, ".concat(N90, ")"),
|
|
7
7
|
overflow: 'hidden',
|
|
8
8
|
position: 'relative',
|
|
9
|
-
padding:
|
|
9
|
+
padding: "var(--ds-space-050, 4px)".concat(" ", "var(--ds-space-100, 8px)", " ", "var(--ds-space-050, 4px)", " 0"),
|
|
10
10
|
lineHeight: '14px'
|
|
11
11
|
});
|
|
12
12
|
export var containerStyle = css({
|
|
@@ -3,8 +3,9 @@ import React from 'react';
|
|
|
3
3
|
import { useIntl } from 'react-intl-next';
|
|
4
4
|
import { jsx } from '@emotion/react';
|
|
5
5
|
import { ResourcedEmoji } from '@atlaskit/emoji';
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
6
|
+
import { messages } from '../../shared/i18n';
|
|
7
|
+
import { isLeftClick } from '../../shared/utils';
|
|
8
|
+
import { emojiButtonStyle } from './styles';
|
|
8
9
|
export var RENDER_BUTTON_TESTID = 'button-emoji-id';
|
|
9
10
|
/**
|
|
10
11
|
* custom button to render the custom emoji selector inside the reaction picker
|
|
@@ -15,7 +16,7 @@ export var EmojiButton = function EmojiButton(_ref) {
|
|
|
15
16
|
emojiProvider = _ref.emojiProvider;
|
|
16
17
|
var onButtonClick = function onButtonClick(event) {
|
|
17
18
|
event.preventDefault();
|
|
18
|
-
if (onClick &&
|
|
19
|
+
if (onClick && isLeftClick(event)) {
|
|
19
20
|
onClick(emojiId, undefined, event);
|
|
20
21
|
}
|
|
21
22
|
};
|
|
@@ -23,11 +24,11 @@ export var EmojiButton = function EmojiButton(_ref) {
|
|
|
23
24
|
return jsx("button", {
|
|
24
25
|
"data-testid": RENDER_BUTTON_TESTID,
|
|
25
26
|
onClick: onButtonClick,
|
|
26
|
-
"aria-label": intl.formatMessage(
|
|
27
|
+
"aria-label": intl.formatMessage(messages.reactWithEmoji, {
|
|
27
28
|
emoji: emojiId.shortName
|
|
28
29
|
}),
|
|
29
30
|
type: "button",
|
|
30
|
-
css:
|
|
31
|
+
css: emojiButtonStyle
|
|
31
32
|
}, jsx(ResourcedEmoji, {
|
|
32
33
|
emojiProvider: emojiProvider,
|
|
33
34
|
emojiId: emojiId
|
|
@@ -8,7 +8,7 @@ export var emojiButtonStyle = css({
|
|
|
8
8
|
borderRadius: '5px',
|
|
9
9
|
cursor: 'pointer',
|
|
10
10
|
margin: '0',
|
|
11
|
-
padding:
|
|
11
|
+
padding: "10px ".concat("var(--ds-space-100, 8px)"),
|
|
12
12
|
'&:hover > span': {
|
|
13
13
|
transition: 'transform cubic-bezier(0.23, 1, 0.32, 1) 200ms',
|
|
14
14
|
transform: 'scale(1.33)'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { jsx } from '@emotion/react';
|
|
4
|
-
import
|
|
4
|
+
import { containerStyle, flashStyle } from './styles';
|
|
5
5
|
/**
|
|
6
6
|
* Test id for wrapper FlashAnimation div
|
|
7
7
|
*/
|
|
@@ -13,7 +13,7 @@ export var RENDER_FLASHANIMATION_TESTID = 'flash-animation';
|
|
|
13
13
|
export var FlashAnimation = function FlashAnimation(props) {
|
|
14
14
|
return jsx("div", {
|
|
15
15
|
className: props.className,
|
|
16
|
-
css: [
|
|
16
|
+
css: [containerStyle, props.flash && flashStyle],
|
|
17
17
|
"data-testid": RENDER_FLASHANIMATION_TESTID
|
|
18
18
|
}, props.children);
|
|
19
19
|
};
|