@atlaskit/reactions 19.1.3 → 20.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/dist/cjs/analytics/index.js +1 -1
- package/dist/cjs/client/MockReactionsClient.js +2 -2
- package/dist/cjs/client/ReactionServiceClient.js +10 -6
- package/dist/cjs/components/Counter.js +5 -3
- package/dist/cjs/components/FlashAnimation.js +9 -4
- package/dist/cjs/components/Reaction.js +18 -5
- package/dist/cjs/components/ReactionPicker.js +5 -7
- package/dist/cjs/components/ReactionTooltip.js +25 -7
- package/dist/cjs/components/Reactions.js +1 -1
- package/dist/cjs/components/Selector.js +3 -3
- package/dist/cjs/components/ShowMore.js +4 -2
- package/dist/cjs/components/i18n.js +5 -0
- package/dist/cjs/components/utils.js +1 -1
- package/dist/cjs/i18n/en.js +2 -1
- package/dist/cjs/i18n/en_GB.js +2 -1
- package/dist/cjs/i18n/index.js +36 -36
- package/dist/cjs/index.js +16 -16
- package/dist/cjs/reaction-store/ReactionsStore.js +4 -2
- package/dist/cjs/reaction-store/index.js +4 -4
- package/dist/cjs/reaction-store/utils.js +2 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/client/MockReactionsClient.js +1 -1
- package/dist/es2019/client/ReactionServiceClient.js +10 -4
- package/dist/es2019/components/Counter.js +3 -2
- package/dist/es2019/components/FlashAnimation.js +8 -4
- package/dist/es2019/components/Reaction.js +20 -6
- package/dist/es2019/components/ReactionPicker.js +4 -7
- package/dist/es2019/components/ReactionTooltip.js +20 -7
- package/dist/es2019/components/Selector.js +2 -2
- package/dist/es2019/components/ShowMore.js +3 -2
- package/dist/es2019/components/i18n.js +5 -0
- package/dist/es2019/i18n/en.js +2 -1
- package/dist/es2019/i18n/en_GB.js +2 -1
- package/dist/es2019/reaction-store/ReactionsStore.js +4 -3
- package/dist/es2019/version.json +1 -1
- package/dist/esm/client/MockReactionsClient.js +1 -1
- package/dist/esm/client/ReactionServiceClient.js +10 -6
- package/dist/esm/components/Counter.js +3 -2
- package/dist/esm/components/FlashAnimation.js +8 -4
- package/dist/esm/components/Reaction.js +18 -6
- package/dist/esm/components/ReactionPicker.js +4 -7
- package/dist/esm/components/ReactionTooltip.js +20 -7
- package/dist/esm/components/Selector.js +2 -2
- package/dist/esm/components/ShowMore.js +3 -2
- package/dist/esm/components/i18n.js +5 -0
- package/dist/esm/i18n/en.js +2 -1
- package/dist/esm/i18n/en_GB.js +2 -1
- package/dist/esm/reaction-store/ReactionsStore.js +4 -2
- package/dist/esm/version.json +1 -1
- package/dist/types/client/ReactionClient.d.ts +3 -1
- package/dist/types/client/ReactionServiceClient.d.ts +6 -2
- package/dist/types/components/i18n.d.ts +5 -0
- package/dist/types/i18n/en.d.ts +1 -0
- package/dist/types/i18n/en_GB.d.ts +1 -0
- package/dist/types/reaction-store/ReactionsStore.d.ts +6 -1
- package/package.json +13 -9
|
@@ -39,6 +39,7 @@ var MemoryReactionsStore = /*#__PURE__*/function () {
|
|
|
39
39
|
reactions: {},
|
|
40
40
|
flash: {}
|
|
41
41
|
};
|
|
42
|
+
var metadata = arguments.length > 2 ? arguments[2] : undefined;
|
|
42
43
|
(0, _classCallCheck2.default)(this, MemoryReactionsStore);
|
|
43
44
|
(0, _defineProperty2.default)(this, "callbacks", []);
|
|
44
45
|
(0, _defineProperty2.default)(this, "setState", function (newState) {
|
|
@@ -122,7 +123,7 @@ var MemoryReactionsStore = /*#__PURE__*/function () {
|
|
|
122
123
|
|
|
123
124
|
_this.flash(reaction);
|
|
124
125
|
|
|
125
|
-
_this.client.addReaction(containerAri, ari, emojiId).then(function (
|
|
126
|
+
_this.client.addReaction(containerAri, ari, emojiId, _this.metadata).then(function (_) {
|
|
126
127
|
if (_this.createAnalyticsEvent) {
|
|
127
128
|
(0, _analytics.createAndFireSafe)(_this.createAnalyticsEvent, _analytics.createRestSucceededEvent, 'addReaction');
|
|
128
129
|
}
|
|
@@ -141,7 +142,7 @@ var MemoryReactionsStore = /*#__PURE__*/function () {
|
|
|
141
142
|
|
|
142
143
|
_this.optmisticUpdate(containerAri, ari, emojiId)(utils.removeOne);
|
|
143
144
|
|
|
144
|
-
_this.client.deleteReaction(containerAri, ari, emojiId);
|
|
145
|
+
_this.client.deleteReaction(containerAri, ari, emojiId, _this.metadata);
|
|
145
146
|
});
|
|
146
147
|
(0, _defineProperty2.default)(this, "setCreateAnalyticsEvent", function (createAnalyticsEvent) {
|
|
147
148
|
_this.createAnalyticsEvent = createAnalyticsEvent;
|
|
@@ -185,6 +186,7 @@ var MemoryReactionsStore = /*#__PURE__*/function () {
|
|
|
185
186
|
});
|
|
186
187
|
this.client = client;
|
|
187
188
|
this.state = state;
|
|
189
|
+
this.metadata = metadata;
|
|
188
190
|
}
|
|
189
191
|
|
|
190
192
|
(0, _createClass2.default)(MemoryReactionsStore, [{
|
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
Object.defineProperty(exports, "
|
|
6
|
+
Object.defineProperty(exports, "MemoryReactionsStore", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
get: function get() {
|
|
9
|
-
return
|
|
9
|
+
return _ReactionsStore.MemoryReactionsStore;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
Object.defineProperty(exports, "
|
|
12
|
+
Object.defineProperty(exports, "ReactionConsumer", {
|
|
13
13
|
enumerable: true,
|
|
14
14
|
get: function get() {
|
|
15
|
-
return
|
|
15
|
+
return _ReactionConsumer.ReactionConsumer;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
|
|
@@ -5,8 +5,9 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
+
exports.getReactionsSortFunction = exports.flattenAris = exports.compareEmojiId = exports.byEmojiId = exports.addOne = void 0;
|
|
8
9
|
exports.isRealErrorFromService = isRealErrorFromService;
|
|
9
|
-
exports.
|
|
10
|
+
exports.updateByEmojiId = exports.sortByRelevance = exports.sortByPreviousPosition = exports.removeOne = exports.readyState = void 0;
|
|
10
11
|
|
|
11
12
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
13
|
|
package/dist/cjs/version.json
CHANGED
|
@@ -22,7 +22,7 @@ const defaultUsers = [user('oscar', 'Oscar Wallhult'), user('julien', 'Julien Mi
|
|
|
22
22
|
export class MockReactionsClient {
|
|
23
23
|
constructor(delay = 0) {
|
|
24
24
|
_defineProperty(this, "mockData", {
|
|
25
|
-
[objectReactionKey(containerAri, ari)]: [reaction(':fire:', 1, true), reaction(':thumbsup:', 9, false), reaction(':astonished:', 5, false), reaction(':
|
|
25
|
+
[objectReactionKey(containerAri, ari)]: [reaction(':fire:', 1, true), reaction(':thumbsup:', 9, false), reaction(':astonished:', 5, false), reaction(':heart:', 100, false)]
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
_defineProperty(this, "delayPromise", () => new Promise(resolve => window.setTimeout(resolve, this.delay)));
|
|
@@ -59,7 +59,7 @@ export class ReactionServiceClient {
|
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
addReaction(containerAri, ari, emojiId) {
|
|
62
|
+
addReaction(containerAri, ari, emojiId, metadata) {
|
|
63
63
|
return this.requestService('reactions', {
|
|
64
64
|
requestInit: {
|
|
65
65
|
method: 'POST',
|
|
@@ -67,7 +67,10 @@ export class ReactionServiceClient {
|
|
|
67
67
|
body: JSON.stringify({
|
|
68
68
|
emojiId,
|
|
69
69
|
ari,
|
|
70
|
-
containerAri
|
|
70
|
+
containerAri,
|
|
71
|
+
...(metadata ? {
|
|
72
|
+
metadata: JSON.stringify(metadata)
|
|
73
|
+
} : {})
|
|
71
74
|
}),
|
|
72
75
|
credentials: 'include'
|
|
73
76
|
}
|
|
@@ -76,12 +79,15 @@ export class ReactionServiceClient {
|
|
|
76
79
|
}) => reactions);
|
|
77
80
|
}
|
|
78
81
|
|
|
79
|
-
deleteReaction(containerAri, ari, emojiId) {
|
|
82
|
+
deleteReaction(containerAri, ari, emojiId, metadata) {
|
|
80
83
|
return this.requestService('reactions', {
|
|
81
84
|
queryParams: {
|
|
82
85
|
ari,
|
|
83
86
|
emojiId,
|
|
84
|
-
containerAri
|
|
87
|
+
containerAri,
|
|
88
|
+
...(metadata ? {
|
|
89
|
+
metadata: JSON.stringify(metadata)
|
|
90
|
+
} : {})
|
|
85
91
|
},
|
|
86
92
|
requestInit: {
|
|
87
93
|
method: 'DELETE',
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import { N90, B400 } from '@atlaskit/theme/colors';
|
|
3
|
+
import { token } from '@atlaskit/tokens';
|
|
3
4
|
import cx from 'classnames';
|
|
4
5
|
import React from 'react';
|
|
5
6
|
import { CSSTransition } from 'react-transition-group';
|
|
@@ -8,13 +9,13 @@ import { akHeight } from './utils';
|
|
|
8
9
|
const animationTime = 300;
|
|
9
10
|
export const countStyle = style({
|
|
10
11
|
fontSize: '11px',
|
|
11
|
-
color: N90,
|
|
12
|
+
color: token('color.text.lowEmphasis', N90),
|
|
12
13
|
overflow: 'hidden',
|
|
13
14
|
height: `${akHeight}px`,
|
|
14
15
|
transition: `width ${animationTime}ms ease-in-out`
|
|
15
16
|
});
|
|
16
17
|
export const highlightStyle = style({
|
|
17
|
-
color: B400,
|
|
18
|
+
color: token('color.text.selected', B400),
|
|
18
19
|
fontWeight: 600
|
|
19
20
|
});
|
|
20
21
|
export const containerStyle = style({
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { B75 } from '@atlaskit/theme/colors';
|
|
1
|
+
import { B75, B300 } from '@atlaskit/theme/colors';
|
|
2
|
+
import { token } from '@atlaskit/tokens';
|
|
2
3
|
import cx from 'classnames';
|
|
3
4
|
import React from 'react';
|
|
4
5
|
import { keyframes, style } from 'typestyle';
|
|
@@ -12,13 +13,16 @@ const flashAnimation = keyframes({
|
|
|
12
13
|
backgroundColor: 'transparent'
|
|
13
14
|
},
|
|
14
15
|
'20%': {
|
|
15
|
-
backgroundColor: B75
|
|
16
|
+
backgroundColor: token('color.background.selected.pressed', B75),
|
|
17
|
+
borderColor: token('color.iconBorder.brand', B300)
|
|
16
18
|
},
|
|
17
19
|
'75%': {
|
|
18
|
-
backgroundColor: B75
|
|
20
|
+
backgroundColor: token('color.background.selected.pressed', B75),
|
|
21
|
+
borderColor: token('color.iconBorder.brand', B300)
|
|
19
22
|
},
|
|
20
23
|
'100%': {
|
|
21
|
-
backgroundColor: '
|
|
24
|
+
backgroundColor: token('color.background.selected.pressed', B75),
|
|
25
|
+
borderColor: token('color.iconBorder.brand', B300)
|
|
22
26
|
}
|
|
23
27
|
});
|
|
24
28
|
export const flashStyle = style({
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
3
3
|
import { ResourcedEmoji } from '@atlaskit/emoji/element';
|
|
4
|
-
import { N20, N40, N400 } from '@atlaskit/theme/colors';
|
|
4
|
+
import { B50, B75, B300, N20, N40, N400 } from '@atlaskit/theme/colors';
|
|
5
|
+
import { token } from '@atlaskit/tokens';
|
|
5
6
|
import cx from 'classnames';
|
|
6
7
|
import React from 'react';
|
|
7
8
|
import { PureComponent } from 'react';
|
|
@@ -30,25 +31,36 @@ const reactionStyle = style({
|
|
|
30
31
|
minWidth: '36px',
|
|
31
32
|
height: `${akHeight}px`,
|
|
32
33
|
background: 'transparent',
|
|
33
|
-
border: `1px solid ${N40}`,
|
|
34
|
+
border: `1px solid ${token('color.border.neutral', N40)}`,
|
|
34
35
|
boxSizing: 'border-box',
|
|
35
36
|
borderRadius: '20px',
|
|
36
|
-
color: `${N400}`,
|
|
37
|
+
color: `${token('color.text.mediumEmphasis', N400)}`,
|
|
37
38
|
cursor: 'pointer',
|
|
38
39
|
margin: 0,
|
|
39
40
|
padding: 0,
|
|
40
41
|
transition: '200ms ease-in-out',
|
|
41
42
|
$nest: {
|
|
42
43
|
'&:hover': {
|
|
43
|
-
background: `${N20}`
|
|
44
|
+
background: `${token('color.background.transparentNeutral.hover', N20)}`
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
47
|
});
|
|
48
|
+
const reactedStyle = style({
|
|
49
|
+
backgroundColor: token('color.background.selected.resting', B50),
|
|
50
|
+
borderColor: token('color.iconBorder.brand', B300),
|
|
51
|
+
$nest: {
|
|
52
|
+
'&:hover': {
|
|
53
|
+
background: `${token('color.background.selected.hover', B75)}`
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
const flashHeight = akHeight - 2; // height without the 1px border
|
|
58
|
+
|
|
47
59
|
const flashStyle = style({
|
|
48
60
|
display: 'flex',
|
|
49
61
|
flexDirection: 'row',
|
|
50
62
|
borderRadius: '10px',
|
|
51
|
-
height: `${
|
|
63
|
+
height: `${flashHeight}px`
|
|
52
64
|
});
|
|
53
65
|
const counterStyle = style({
|
|
54
66
|
padding: '4px 8px 4px 0',
|
|
@@ -133,7 +145,9 @@ class ReactionWithoutAnalytics extends PureComponent {
|
|
|
133
145
|
const {
|
|
134
146
|
emojiName
|
|
135
147
|
} = this.state;
|
|
136
|
-
const classNames = cx(reactionStyle, classNameProp
|
|
148
|
+
const classNames = cx(reactionStyle, classNameProp, {
|
|
149
|
+
[reactedStyle]: reaction.reacted
|
|
150
|
+
});
|
|
137
151
|
const emojiId = {
|
|
138
152
|
id: reaction.emojiId,
|
|
139
153
|
shortName: ''
|
|
@@ -3,6 +3,7 @@ import { EmojiPicker } from '@atlaskit/emoji/picker';
|
|
|
3
3
|
import { Manager, Popper, Reference } from '@atlaskit/popper';
|
|
4
4
|
import { borderRadius } from '@atlaskit/theme/constants';
|
|
5
5
|
import { N0, N50A, N60A } from '@atlaskit/theme/colors';
|
|
6
|
+
import { token } from '@atlaskit/tokens';
|
|
6
7
|
import cx from 'classnames';
|
|
7
8
|
import React from 'react';
|
|
8
9
|
import { PureComponent } from 'react';
|
|
@@ -11,10 +12,6 @@ import { style } from 'typestyle';
|
|
|
11
12
|
import { Selector } from './Selector';
|
|
12
13
|
import { Trigger } from './Trigger';
|
|
13
14
|
import { layers } from '@atlaskit/theme/constants';
|
|
14
|
-
const akBorderRadius = `${borderRadius()}px`;
|
|
15
|
-
const akColorN0 = N0;
|
|
16
|
-
const akColorN50A = N50A;
|
|
17
|
-
const akColorN60A = N60A;
|
|
18
15
|
const pickerStyle = style({
|
|
19
16
|
verticalAlign: 'middle',
|
|
20
17
|
$nest: {
|
|
@@ -28,9 +25,9 @@ const contentStyle = style({
|
|
|
28
25
|
display: 'flex'
|
|
29
26
|
});
|
|
30
27
|
const popupStyle = style({
|
|
31
|
-
background:
|
|
32
|
-
borderRadius:
|
|
33
|
-
boxShadow: `0 4px 8px -2px ${
|
|
28
|
+
background: token('color.background.overlay', N0),
|
|
29
|
+
borderRadius: `${borderRadius()}px`,
|
|
30
|
+
boxShadow: token('shadow.overlay', `0 4px 8px -2px ${N50A}, 0 0 1px ${N60A}`),
|
|
34
31
|
$nest: {
|
|
35
32
|
'&> div': {
|
|
36
33
|
boxShadow: undefined
|
|
@@ -1,11 +1,18 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
1
2
|
import Tooltip from '@atlaskit/tooltip';
|
|
2
3
|
import React from 'react';
|
|
4
|
+
import { FormattedMessage } from 'react-intl';
|
|
3
5
|
import { style } from 'typestyle';
|
|
6
|
+
import { token } from '@atlaskit/tokens';
|
|
7
|
+
import { N90 } from '@atlaskit/theme/colors';
|
|
8
|
+
import { messages } from './i18n';
|
|
9
|
+
const verticalMargin = 5;
|
|
4
10
|
const tooltipStyle = style({
|
|
5
11
|
maxWidth: '150px',
|
|
6
12
|
textOverflow: 'ellipsis',
|
|
7
13
|
whiteSpace: 'nowrap',
|
|
8
14
|
overflow: 'hidden',
|
|
15
|
+
marginBottom: verticalMargin,
|
|
9
16
|
$nest: {
|
|
10
17
|
ul: {
|
|
11
18
|
listStyle: 'none',
|
|
@@ -16,16 +23,18 @@ const tooltipStyle = style({
|
|
|
16
23
|
li: {
|
|
17
24
|
overflow: 'hidden',
|
|
18
25
|
textOverflow: 'ellipsis',
|
|
19
|
-
marginTop:
|
|
26
|
+
marginTop: verticalMargin
|
|
20
27
|
}
|
|
21
28
|
}
|
|
22
29
|
});
|
|
23
30
|
const emojiNameStyle = style({
|
|
24
31
|
textTransform: 'capitalize',
|
|
25
|
-
|
|
32
|
+
color: token('color.text.mediumEmphasis', N90),
|
|
33
|
+
fontWeight: 600
|
|
26
34
|
});
|
|
27
35
|
const footerStyle = style({
|
|
28
|
-
|
|
36
|
+
color: token('color.text.mediumEmphasis', N90),
|
|
37
|
+
fontWeight: 300
|
|
29
38
|
});
|
|
30
39
|
const TOOLTIP_USERS_LIMIT = 5;
|
|
31
40
|
export const ReactionTooltip = ({
|
|
@@ -41,15 +50,19 @@ export const ReactionTooltip = ({
|
|
|
41
50
|
|
|
42
51
|
const content = /*#__PURE__*/React.createElement("div", {
|
|
43
52
|
className: tooltipStyle
|
|
44
|
-
}, emojiName ? /*#__PURE__*/React.createElement("
|
|
53
|
+
}, /*#__PURE__*/React.createElement("ul", null, emojiName ? /*#__PURE__*/React.createElement("li", {
|
|
45
54
|
className: emojiNameStyle
|
|
46
|
-
}, emojiName) : null,
|
|
55
|
+
}, emojiName) : null, users.slice(0, TOOLTIP_USERS_LIMIT).map((user, index) => {
|
|
47
56
|
return /*#__PURE__*/React.createElement("li", {
|
|
48
57
|
key: index
|
|
49
58
|
}, user.displayName);
|
|
50
|
-
})
|
|
59
|
+
}), users.length > TOOLTIP_USERS_LIMIT ? /*#__PURE__*/React.createElement("li", {
|
|
51
60
|
className: footerStyle
|
|
52
|
-
},
|
|
61
|
+
}, /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.otherUsers, {
|
|
62
|
+
values: {
|
|
63
|
+
count: users.length - TOOLTIP_USERS_LIMIT
|
|
64
|
+
}
|
|
65
|
+
}))) : null));
|
|
53
66
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
54
67
|
content: content,
|
|
55
68
|
position: "bottom"
|
|
@@ -2,6 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
import EditorMoreIcon from '@atlaskit/icon/glyph/editor/more';
|
|
3
3
|
import { borderRadius } from '@atlaskit/theme/constants';
|
|
4
4
|
import { N30A } from '@atlaskit/theme/colors';
|
|
5
|
+
import { token } from '@atlaskit/tokens';
|
|
5
6
|
import Tooltip from '@atlaskit/tooltip';
|
|
6
7
|
import cx from 'classnames';
|
|
7
8
|
import React from 'react';
|
|
@@ -24,12 +25,12 @@ const moreButtonStyle = style({
|
|
|
24
25
|
verticalAlign: 'top',
|
|
25
26
|
$nest: {
|
|
26
27
|
'&:hover': {
|
|
27
|
-
backgroundColor: N30A
|
|
28
|
+
backgroundColor: token('color.background.transparentNeutral.hover', N30A)
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
31
|
});
|
|
31
32
|
const separatorStyle = style({
|
|
32
|
-
backgroundColor: N30A,
|
|
33
|
+
backgroundColor: token('color.border.neutral', N30A),
|
|
33
34
|
margin: '8px 8px 8px 4px',
|
|
34
35
|
width: '1px',
|
|
35
36
|
height: '60%',
|
|
@@ -14,5 +14,10 @@ export const messages = defineMessages({
|
|
|
14
14
|
id: 'fabric.reactions.error.unexpected',
|
|
15
15
|
defaultMessage: 'Something went wrong',
|
|
16
16
|
description: 'Unexpected error message'
|
|
17
|
+
},
|
|
18
|
+
otherUsers: {
|
|
19
|
+
id: 'fabric.reactions.other.reacted.users',
|
|
20
|
+
defaultMessage: '{count, plural, one {and one other} other {and {count} others}}',
|
|
21
|
+
description: "The number of users that have reacted similarly, but aren't shown"
|
|
17
22
|
}
|
|
18
23
|
});
|
package/dist/es2019/i18n/en.js
CHANGED
|
@@ -2,5 +2,6 @@
|
|
|
2
2
|
export default {
|
|
3
3
|
'fabric.reactions.loading': 'Loading...',
|
|
4
4
|
'fabric.reactions.more.emoji': 'More emoji',
|
|
5
|
-
'fabric.reactions.error.unexpected': 'Something went wrong'
|
|
5
|
+
'fabric.reactions.error.unexpected': 'Something went wrong',
|
|
6
|
+
'fabric.reactions.other.reacted.users': '{count, plural, one {and one other} other {and "{count}" others}}'
|
|
6
7
|
};
|
|
@@ -2,5 +2,6 @@
|
|
|
2
2
|
export default {
|
|
3
3
|
'fabric.reactions.loading': 'Loading...',
|
|
4
4
|
'fabric.reactions.more.emoji': 'More emoji',
|
|
5
|
-
'fabric.reactions.error.unexpected': 'Something went wrong'
|
|
5
|
+
'fabric.reactions.error.unexpected': 'Something went wrong',
|
|
6
|
+
'fabric.reactions.other.reacted.users': '{count, plural, one {and one other} other {and "{count}" others}}'
|
|
6
7
|
};
|
|
@@ -8,7 +8,7 @@ export class MemoryReactionsStore {
|
|
|
8
8
|
constructor(client, state = {
|
|
9
9
|
reactions: {},
|
|
10
10
|
flash: {}
|
|
11
|
-
}) {
|
|
11
|
+
}, metadata) {
|
|
12
12
|
_defineProperty(this, "callbacks", []);
|
|
13
13
|
|
|
14
14
|
_defineProperty(this, "setState", newState => {
|
|
@@ -90,7 +90,7 @@ export class MemoryReactionsStore {
|
|
|
90
90
|
} = reaction;
|
|
91
91
|
this.optmisticUpdate(containerAri, ari, emojiId)(utils.addOne);
|
|
92
92
|
this.flash(reaction);
|
|
93
|
-
this.client.addReaction(containerAri, ari, emojiId).then(
|
|
93
|
+
this.client.addReaction(containerAri, ari, emojiId, this.metadata).then(_ => {
|
|
94
94
|
if (this.createAnalyticsEvent) {
|
|
95
95
|
createAndFireSafe(this.createAnalyticsEvent, createRestSucceededEvent, 'addReaction');
|
|
96
96
|
}
|
|
@@ -110,7 +110,7 @@ export class MemoryReactionsStore {
|
|
|
110
110
|
emojiId
|
|
111
111
|
} = reaction;
|
|
112
112
|
this.optmisticUpdate(containerAri, ari, emojiId)(utils.removeOne);
|
|
113
|
-
this.client.deleteReaction(containerAri, ari, emojiId);
|
|
113
|
+
this.client.deleteReaction(containerAri, ari, emojiId, this.metadata);
|
|
114
114
|
});
|
|
115
115
|
|
|
116
116
|
_defineProperty(this, "setCreateAnalyticsEvent", createAnalyticsEvent => {
|
|
@@ -157,6 +157,7 @@ export class MemoryReactionsStore {
|
|
|
157
157
|
|
|
158
158
|
this.client = client;
|
|
159
159
|
this.state = state;
|
|
160
|
+
this.metadata = metadata;
|
|
160
161
|
}
|
|
161
162
|
|
|
162
163
|
getReactionsState(containerAri, ari) {
|
package/dist/es2019/version.json
CHANGED
|
@@ -39,7 +39,7 @@ export var MockReactionsClient = /*#__PURE__*/function () {
|
|
|
39
39
|
|
|
40
40
|
_classCallCheck(this, MockReactionsClient);
|
|
41
41
|
|
|
42
|
-
_defineProperty(this, "mockData", _defineProperty({}, objectReactionKey(containerAri, ari), [reaction(':fire:', 1, true), reaction(':thumbsup:', 9, false), reaction(':astonished:', 5, false), reaction(':
|
|
42
|
+
_defineProperty(this, "mockData", _defineProperty({}, objectReactionKey(containerAri, ari), [reaction(':fire:', 1, true), reaction(':thumbsup:', 9, false), reaction(':astonished:', 5, false), reaction(':heart:', 100, false)]));
|
|
43
43
|
|
|
44
44
|
_defineProperty(this, "delayPromise", function () {
|
|
45
45
|
return new Promise(function (resolve) {
|
|
@@ -78,16 +78,18 @@ export var ReactionServiceClient = /*#__PURE__*/function () {
|
|
|
78
78
|
}
|
|
79
79
|
}, {
|
|
80
80
|
key: "addReaction",
|
|
81
|
-
value: function addReaction(containerAri, ari, emojiId) {
|
|
81
|
+
value: function addReaction(containerAri, ari, emojiId, metadata) {
|
|
82
82
|
return this.requestService('reactions', {
|
|
83
83
|
requestInit: {
|
|
84
84
|
method: 'POST',
|
|
85
85
|
headers: this.getHeaders(),
|
|
86
|
-
body: JSON.stringify({
|
|
86
|
+
body: JSON.stringify(_objectSpread({
|
|
87
87
|
emojiId: emojiId,
|
|
88
88
|
ari: ari,
|
|
89
89
|
containerAri: containerAri
|
|
90
|
-
}
|
|
90
|
+
}, metadata ? {
|
|
91
|
+
metadata: JSON.stringify(metadata)
|
|
92
|
+
} : {})),
|
|
91
93
|
credentials: 'include'
|
|
92
94
|
}
|
|
93
95
|
}).then(function (_ref) {
|
|
@@ -97,13 +99,15 @@ export var ReactionServiceClient = /*#__PURE__*/function () {
|
|
|
97
99
|
}
|
|
98
100
|
}, {
|
|
99
101
|
key: "deleteReaction",
|
|
100
|
-
value: function deleteReaction(containerAri, ari, emojiId) {
|
|
102
|
+
value: function deleteReaction(containerAri, ari, emojiId, metadata) {
|
|
101
103
|
return this.requestService('reactions', {
|
|
102
|
-
queryParams: {
|
|
104
|
+
queryParams: _objectSpread({
|
|
103
105
|
ari: ari,
|
|
104
106
|
emojiId: emojiId,
|
|
105
107
|
containerAri: containerAri
|
|
106
|
-
},
|
|
108
|
+
}, metadata ? {
|
|
109
|
+
metadata: JSON.stringify(metadata)
|
|
110
|
+
} : {}),
|
|
107
111
|
requestInit: {
|
|
108
112
|
method: 'DELETE',
|
|
109
113
|
headers: this.getHeaders(),
|
|
@@ -11,6 +11,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
11
11
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
12
12
|
|
|
13
13
|
import { N90, B400 } from '@atlaskit/theme/colors';
|
|
14
|
+
import { token } from '@atlaskit/tokens';
|
|
14
15
|
import cx from 'classnames';
|
|
15
16
|
import React from 'react';
|
|
16
17
|
import { CSSTransition } from 'react-transition-group';
|
|
@@ -19,13 +20,13 @@ import { akHeight } from './utils';
|
|
|
19
20
|
var animationTime = 300;
|
|
20
21
|
export var countStyle = style({
|
|
21
22
|
fontSize: '11px',
|
|
22
|
-
color: N90,
|
|
23
|
+
color: token('color.text.lowEmphasis', N90),
|
|
23
24
|
overflow: 'hidden',
|
|
24
25
|
height: "".concat(akHeight, "px"),
|
|
25
26
|
transition: "width ".concat(animationTime, "ms ease-in-out")
|
|
26
27
|
});
|
|
27
28
|
export var highlightStyle = style({
|
|
28
|
-
color: B400,
|
|
29
|
+
color: token('color.text.selected', B400),
|
|
29
30
|
fontWeight: 600
|
|
30
31
|
});
|
|
31
32
|
export var containerStyle = style({
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
import { B75 } from '@atlaskit/theme/colors';
|
|
2
|
+
import { B75, B300 } from '@atlaskit/theme/colors';
|
|
3
|
+
import { token } from '@atlaskit/tokens';
|
|
3
4
|
import cx from 'classnames';
|
|
4
5
|
import React from 'react';
|
|
5
6
|
import { keyframes, style } from 'typestyle';
|
|
@@ -13,13 +14,16 @@ var flashAnimation = keyframes({
|
|
|
13
14
|
backgroundColor: 'transparent'
|
|
14
15
|
},
|
|
15
16
|
'20%': {
|
|
16
|
-
backgroundColor: B75
|
|
17
|
+
backgroundColor: token('color.background.selected.pressed', B75),
|
|
18
|
+
borderColor: token('color.iconBorder.brand', B300)
|
|
17
19
|
},
|
|
18
20
|
'75%': {
|
|
19
|
-
backgroundColor: B75
|
|
21
|
+
backgroundColor: token('color.background.selected.pressed', B75),
|
|
22
|
+
borderColor: token('color.iconBorder.brand', B300)
|
|
20
23
|
},
|
|
21
24
|
'100%': {
|
|
22
|
-
backgroundColor: '
|
|
25
|
+
backgroundColor: token('color.background.selected.pressed', B75),
|
|
26
|
+
borderColor: token('color.iconBorder.brand', B300)
|
|
23
27
|
}
|
|
24
28
|
});
|
|
25
29
|
export var flashStyle = style({
|
|
@@ -12,7 +12,8 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
12
12
|
|
|
13
13
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
14
14
|
import { ResourcedEmoji } from '@atlaskit/emoji/element';
|
|
15
|
-
import { N20, N40, N400 } from '@atlaskit/theme/colors';
|
|
15
|
+
import { B50, B75, B300, N20, N40, N400 } from '@atlaskit/theme/colors';
|
|
16
|
+
import { token } from '@atlaskit/tokens';
|
|
16
17
|
import cx from 'classnames';
|
|
17
18
|
import React from 'react';
|
|
18
19
|
import { PureComponent } from 'react';
|
|
@@ -41,25 +42,36 @@ var reactionStyle = style({
|
|
|
41
42
|
minWidth: '36px',
|
|
42
43
|
height: "".concat(akHeight, "px"),
|
|
43
44
|
background: 'transparent',
|
|
44
|
-
border: "1px solid ".concat(N40),
|
|
45
|
+
border: "1px solid ".concat(token('color.border.neutral', N40)),
|
|
45
46
|
boxSizing: 'border-box',
|
|
46
47
|
borderRadius: '20px',
|
|
47
|
-
color: "".concat(N400),
|
|
48
|
+
color: "".concat(token('color.text.mediumEmphasis', N400)),
|
|
48
49
|
cursor: 'pointer',
|
|
49
50
|
margin: 0,
|
|
50
51
|
padding: 0,
|
|
51
52
|
transition: '200ms ease-in-out',
|
|
52
53
|
$nest: {
|
|
53
54
|
'&:hover': {
|
|
54
|
-
background: "".concat(N20)
|
|
55
|
+
background: "".concat(token('color.background.transparentNeutral.hover', N20))
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
58
|
});
|
|
59
|
+
var reactedStyle = style({
|
|
60
|
+
backgroundColor: token('color.background.selected.resting', B50),
|
|
61
|
+
borderColor: token('color.iconBorder.brand', B300),
|
|
62
|
+
$nest: {
|
|
63
|
+
'&:hover': {
|
|
64
|
+
background: "".concat(token('color.background.selected.hover', B75))
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
var flashHeight = akHeight - 2; // height without the 1px border
|
|
69
|
+
|
|
58
70
|
var flashStyle = style({
|
|
59
71
|
display: 'flex',
|
|
60
72
|
flexDirection: 'row',
|
|
61
73
|
borderRadius: '10px',
|
|
62
|
-
height: "".concat(
|
|
74
|
+
height: "".concat(flashHeight, "px")
|
|
63
75
|
});
|
|
64
76
|
var counterStyle = style({
|
|
65
77
|
padding: '4px 8px 4px 0',
|
|
@@ -156,7 +168,7 @@ var ReactionWithoutAnalytics = /*#__PURE__*/function (_PureComponent) {
|
|
|
156
168
|
classNameProp = _this$props3.className,
|
|
157
169
|
flash = _this$props3.flash;
|
|
158
170
|
var emojiName = this.state.emojiName;
|
|
159
|
-
var classNames = cx(reactionStyle, classNameProp);
|
|
171
|
+
var classNames = cx(reactionStyle, classNameProp, _defineProperty({}, reactedStyle, reaction.reacted));
|
|
160
172
|
var emojiId = {
|
|
161
173
|
id: reaction.emojiId,
|
|
162
174
|
shortName: ''
|
|
@@ -18,6 +18,7 @@ import { EmojiPicker } from '@atlaskit/emoji/picker';
|
|
|
18
18
|
import { Manager, Popper, Reference } from '@atlaskit/popper';
|
|
19
19
|
import { borderRadius } from '@atlaskit/theme/constants';
|
|
20
20
|
import { N0, N50A, N60A } from '@atlaskit/theme/colors';
|
|
21
|
+
import { token } from '@atlaskit/tokens';
|
|
21
22
|
import cx from 'classnames';
|
|
22
23
|
import React from 'react';
|
|
23
24
|
import { PureComponent } from 'react';
|
|
@@ -26,10 +27,6 @@ import { style } from 'typestyle';
|
|
|
26
27
|
import { Selector } from './Selector';
|
|
27
28
|
import { Trigger } from './Trigger';
|
|
28
29
|
import { layers } from '@atlaskit/theme/constants';
|
|
29
|
-
var akBorderRadius = "".concat(borderRadius(), "px");
|
|
30
|
-
var akColorN0 = N0;
|
|
31
|
-
var akColorN50A = N50A;
|
|
32
|
-
var akColorN60A = N60A;
|
|
33
30
|
var pickerStyle = style({
|
|
34
31
|
verticalAlign: 'middle',
|
|
35
32
|
$nest: {
|
|
@@ -43,9 +40,9 @@ var contentStyle = style({
|
|
|
43
40
|
display: 'flex'
|
|
44
41
|
});
|
|
45
42
|
var popupStyle = style({
|
|
46
|
-
background:
|
|
47
|
-
borderRadius:
|
|
48
|
-
boxShadow: "0 4px 8px -2px ".concat(
|
|
43
|
+
background: token('color.background.overlay', N0),
|
|
44
|
+
borderRadius: "".concat(borderRadius(), "px"),
|
|
45
|
+
boxShadow: token('shadow.overlay', "0 4px 8px -2px ".concat(N50A, ", 0 0 1px ").concat(N60A)),
|
|
49
46
|
$nest: {
|
|
50
47
|
'&> div': {
|
|
51
48
|
boxShadow: undefined
|