@atlaskit/reactions 21.0.5 → 21.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 +12 -0
- package/dist/cjs/components/Counter.js +20 -20
- package/dist/cjs/components/EmojiButton.js +9 -11
- package/dist/cjs/components/FlashAnimation.js +19 -17
- package/dist/cjs/components/Reaction.js +22 -28
- package/dist/cjs/components/ReactionPicker.js +26 -33
- package/dist/cjs/components/ReactionTooltip.js +33 -29
- package/dist/cjs/components/Reactions.js +15 -17
- package/dist/cjs/components/Selector.js +23 -28
- package/dist/cjs/components/ShowMore.js +25 -22
- package/dist/cjs/components/Trigger.js +11 -16
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/Counter.js +18 -18
- package/dist/es2019/components/EmojiButton.js +10 -10
- package/dist/es2019/components/FlashAnimation.js +16 -15
- package/dist/es2019/components/Reaction.js +23 -28
- package/dist/es2019/components/ReactionPicker.js +27 -32
- package/dist/es2019/components/ReactionTooltip.js +27 -27
- package/dist/es2019/components/Reactions.js +16 -16
- package/dist/es2019/components/Selector.js +21 -24
- package/dist/es2019/components/ShowMore.js +22 -18
- package/dist/es2019/components/Trigger.js +10 -14
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/Counter.js +18 -17
- package/dist/esm/components/EmojiButton.js +9 -10
- package/dist/esm/components/FlashAnimation.js +16 -14
- package/dist/esm/components/Reaction.js +22 -26
- package/dist/esm/components/ReactionPicker.js +27 -32
- package/dist/esm/components/ReactionTooltip.js +27 -27
- package/dist/esm/components/Reactions.js +15 -16
- package/dist/esm/components/Selector.js +20 -24
- package/dist/esm/components/ShowMore.js +22 -19
- package/dist/esm/components/Trigger.js +10 -14
- package/dist/esm/version.json +1 -1
- package/dist/types/components/Counter.d.ts +4 -3
- package/dist/types/components/FlashAnimation.d.ts +3 -1
- package/dist/types/components/Selector.d.ts +2 -1
- package/dist/types/components/ShowMore.d.ts +4 -0
- package/package.json +5 -6
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx, css, keyframes } from '@emotion/core';
|
|
2
3
|
import { B75, B300 } from '@atlaskit/theme/colors';
|
|
3
4
|
import { token } from '@atlaskit/tokens';
|
|
4
|
-
import cx from 'classnames';
|
|
5
5
|
import React from 'react';
|
|
6
|
-
|
|
7
|
-
var containerStyle =
|
|
6
|
+
export var flashAnimationTestId = 'flash-animation';
|
|
7
|
+
var containerStyle = css({
|
|
8
8
|
width: '100%',
|
|
9
9
|
height: '100%'
|
|
10
10
|
});
|
|
11
11
|
var flashTime = 700;
|
|
12
|
-
var flashAnimation = keyframes({
|
|
12
|
+
export var flashAnimation = keyframes({
|
|
13
13
|
'0%': {
|
|
14
14
|
backgroundColor: 'transparent'
|
|
15
15
|
},
|
|
16
16
|
'20%': {
|
|
17
|
-
backgroundColor: token('color.background.
|
|
18
|
-
borderColor: token('color.
|
|
17
|
+
backgroundColor: token('color.background.selected.pressed', B75),
|
|
18
|
+
borderColor: token('color.border.selected', B300)
|
|
19
19
|
},
|
|
20
20
|
'75%': {
|
|
21
|
-
backgroundColor: token('color.background.
|
|
22
|
-
borderColor: token('color.
|
|
21
|
+
backgroundColor: token('color.background.selected.pressed', B75),
|
|
22
|
+
borderColor: token('color.border.selected', B300)
|
|
23
23
|
},
|
|
24
24
|
'100%': {
|
|
25
|
-
backgroundColor: token('color.background.
|
|
26
|
-
borderColor: token('color.
|
|
25
|
+
backgroundColor: token('color.background.selected.pressed', B75),
|
|
26
|
+
borderColor: token('color.border.selected', B300)
|
|
27
27
|
}
|
|
28
28
|
});
|
|
29
|
-
export var flashStyle =
|
|
29
|
+
export var flashStyle = css({
|
|
30
30
|
animation: "".concat(flashAnimation, " ").concat(flashTime, "ms ease-in-out")
|
|
31
31
|
});
|
|
32
32
|
/**
|
|
@@ -34,7 +34,9 @@ export var flashStyle = style({
|
|
|
34
34
|
*/
|
|
35
35
|
|
|
36
36
|
export var FlashAnimation = function FlashAnimation(props) {
|
|
37
|
-
return
|
|
38
|
-
className:
|
|
37
|
+
return jsx("div", {
|
|
38
|
+
className: props.className,
|
|
39
|
+
css: [containerStyle, props.flash && flashStyle],
|
|
40
|
+
"data-testid": flashAnimationTestId
|
|
39
41
|
}, props.children);
|
|
40
42
|
};
|
|
@@ -10,14 +10,14 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
10
10
|
|
|
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
|
+
/** @jsx jsx */
|
|
14
|
+
import { jsx, css } from '@emotion/core';
|
|
13
15
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
14
16
|
import { ResourcedEmoji } from '@atlaskit/emoji/element';
|
|
15
17
|
import { B50, B75, B300, N20, N40, N400 } from '@atlaskit/theme/colors';
|
|
16
18
|
import { token } from '@atlaskit/tokens';
|
|
17
|
-
import cx from 'classnames';
|
|
18
19
|
import React from 'react';
|
|
19
20
|
import { PureComponent } from 'react';
|
|
20
|
-
import { style } from 'typestyle';
|
|
21
21
|
import { createAndFireSafe, createReactionClickedEvent, createReactionHoveredEvent } from '../analytics';
|
|
22
22
|
import { Counter } from './Counter';
|
|
23
23
|
import { FlashAnimation } from './FlashAnimation';
|
|
@@ -29,12 +29,12 @@ import { isLeftClick, akHeight } from './utils';
|
|
|
29
29
|
* of FlashAnimation b/c it otherwise throws off the flash styling
|
|
30
30
|
*/
|
|
31
31
|
|
|
32
|
-
var emojiStyle =
|
|
32
|
+
var emojiStyle = css({
|
|
33
33
|
transformOrigin: 'center center 0',
|
|
34
34
|
lineHeight: '12px',
|
|
35
35
|
padding: '4px 4px 4px 8px'
|
|
36
36
|
});
|
|
37
|
-
var reactionStyle =
|
|
37
|
+
var reactionStyle = css({
|
|
38
38
|
outline: 'none',
|
|
39
39
|
display: 'flex',
|
|
40
40
|
flexDirection: 'row',
|
|
@@ -50,24 +50,20 @@ var reactionStyle = style({
|
|
|
50
50
|
margin: 0,
|
|
51
51
|
padding: 0,
|
|
52
52
|
transition: '200ms ease-in-out',
|
|
53
|
-
|
|
54
|
-
'
|
|
55
|
-
background: "".concat(token('color.background.neutral.subtle.hovered', N20))
|
|
56
|
-
}
|
|
53
|
+
'&:hover': {
|
|
54
|
+
background: "".concat(token('color.background.neutral.subtle.hovered', N20))
|
|
57
55
|
}
|
|
58
56
|
});
|
|
59
|
-
var reactedStyle =
|
|
60
|
-
backgroundColor: token('color.background.
|
|
61
|
-
borderColor: token('color.
|
|
62
|
-
|
|
63
|
-
'
|
|
64
|
-
background: "".concat(token('color.background.brand.hovered', B75))
|
|
65
|
-
}
|
|
57
|
+
var reactedStyle = css({
|
|
58
|
+
backgroundColor: token('color.background.selected', B50),
|
|
59
|
+
borderColor: token('color.border.selected', B300),
|
|
60
|
+
'&:hover': {
|
|
61
|
+
background: "".concat(token('color.background.selected.hovered', B75))
|
|
66
62
|
}
|
|
67
63
|
});
|
|
68
64
|
var flashHeight = akHeight - 2; // height without the 1px border
|
|
69
65
|
|
|
70
|
-
var flashStyle =
|
|
66
|
+
var flashStyle = css({
|
|
71
67
|
display: 'flex',
|
|
72
68
|
flexDirection: 'row',
|
|
73
69
|
borderRadius: '10px',
|
|
@@ -164,28 +160,28 @@ var ReactionWithoutAnalytics = /*#__PURE__*/function (_PureComponent) {
|
|
|
164
160
|
classNameProp = _this$props3.className,
|
|
165
161
|
flash = _this$props3.flash;
|
|
166
162
|
var emojiName = this.state.emojiName;
|
|
167
|
-
var classNames = cx(reactionStyle, classNameProp, _defineProperty({}, reactedStyle, reaction.reacted));
|
|
168
163
|
var emojiId = {
|
|
169
164
|
id: reaction.emojiId,
|
|
170
165
|
shortName: ''
|
|
171
166
|
};
|
|
172
|
-
return
|
|
173
|
-
className:
|
|
167
|
+
return jsx("button", {
|
|
168
|
+
className: classNameProp,
|
|
169
|
+
css: [reactionStyle, reaction.reacted && reactedStyle],
|
|
174
170
|
onMouseUp: this.handleMouseDown,
|
|
175
171
|
onMouseEnter: this.handleMouseEnter
|
|
176
|
-
},
|
|
172
|
+
}, jsx(ReactionTooltip, {
|
|
177
173
|
emojiName: emojiName,
|
|
178
174
|
reaction: reaction
|
|
179
|
-
},
|
|
175
|
+
}, jsx(FlashAnimation, {
|
|
180
176
|
flash: flash,
|
|
181
|
-
|
|
182
|
-
},
|
|
183
|
-
|
|
184
|
-
},
|
|
177
|
+
css: flashStyle
|
|
178
|
+
}, jsx("div", {
|
|
179
|
+
css: emojiStyle
|
|
180
|
+
}, jsx(ResourcedEmoji, {
|
|
185
181
|
emojiProvider: emojiProvider,
|
|
186
182
|
emojiId: emojiId,
|
|
187
183
|
fitToHeight: 16
|
|
188
|
-
})),
|
|
184
|
+
})), jsx(Counter, {
|
|
189
185
|
value: reaction.count,
|
|
190
186
|
highlight: reaction.reacted
|
|
191
187
|
}))));
|
|
@@ -14,39 +14,35 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
14
14
|
|
|
15
15
|
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; } }
|
|
16
16
|
|
|
17
|
+
/** @jsx jsx */
|
|
18
|
+
import { jsx, css } from '@emotion/core';
|
|
17
19
|
import { EmojiPicker } from '@atlaskit/emoji/picker';
|
|
18
20
|
import { Manager, Popper, Reference } from '@atlaskit/popper';
|
|
19
21
|
import { borderRadius } from '@atlaskit/theme/constants';
|
|
20
22
|
import { N0, N50A, N60A } from '@atlaskit/theme/colors';
|
|
21
23
|
import { token } from '@atlaskit/tokens';
|
|
22
|
-
import
|
|
23
|
-
import React from 'react';
|
|
24
|
+
import React, { Fragment } from 'react';
|
|
24
25
|
import { PureComponent } from 'react';
|
|
25
26
|
import ReactDOM from 'react-dom';
|
|
26
|
-
import { style } from 'typestyle';
|
|
27
27
|
import { Selector } from './Selector';
|
|
28
28
|
import { Trigger } from './Trigger';
|
|
29
29
|
import { layers } from '@atlaskit/theme/constants';
|
|
30
|
-
var pickerStyle =
|
|
30
|
+
var pickerStyle = css({
|
|
31
31
|
verticalAlign: 'middle',
|
|
32
|
-
|
|
33
|
-
'
|
|
34
|
-
|
|
35
|
-
marginRight: '4px'
|
|
36
|
-
}
|
|
32
|
+
'&.miniMode': {
|
|
33
|
+
display: 'inline-block',
|
|
34
|
+
marginRight: '4px'
|
|
37
35
|
}
|
|
38
36
|
});
|
|
39
|
-
var contentStyle =
|
|
37
|
+
var contentStyle = css({
|
|
40
38
|
display: 'flex'
|
|
41
39
|
});
|
|
42
|
-
var popupStyle =
|
|
40
|
+
var popupStyle = css({
|
|
43
41
|
background: token('elevation.surface.overlay', N0),
|
|
44
42
|
borderRadius: "".concat(borderRadius(), "px"),
|
|
45
43
|
boxShadow: token('elevation.shadow.overlay', "0 4px 8px -2px ".concat(N50A, ", 0 0 1px ").concat(N60A)),
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
boxShadow: undefined
|
|
49
|
-
}
|
|
44
|
+
'&> div': {
|
|
45
|
+
boxShadow: undefined
|
|
50
46
|
}
|
|
51
47
|
});
|
|
52
48
|
|
|
@@ -179,9 +175,9 @@ export var ReactionPicker = /*#__PURE__*/function (_PureComponent) {
|
|
|
179
175
|
var _this$props = this.props,
|
|
180
176
|
emojiProvider = _this$props.emojiProvider,
|
|
181
177
|
allowAllEmojis = _this$props.allowAllEmojis;
|
|
182
|
-
return
|
|
183
|
-
|
|
184
|
-
},
|
|
178
|
+
return jsx("div", {
|
|
179
|
+
css: contentStyle
|
|
180
|
+
}, jsx(Selector, {
|
|
185
181
|
emojiProvider: emojiProvider,
|
|
186
182
|
onSelection: this.onEmojiSelected,
|
|
187
183
|
showMore: allowAllEmojis,
|
|
@@ -191,7 +187,7 @@ export var ReactionPicker = /*#__PURE__*/function (_PureComponent) {
|
|
|
191
187
|
}, {
|
|
192
188
|
key: "renderEmojiPicker",
|
|
193
189
|
value: function renderEmojiPicker() {
|
|
194
|
-
return
|
|
190
|
+
return jsx(EmojiPicker, {
|
|
195
191
|
emojiProvider: this.props.emojiProvider,
|
|
196
192
|
onSelection: this.onEmojiSelected
|
|
197
193
|
});
|
|
@@ -207,22 +203,21 @@ export var ReactionPicker = /*#__PURE__*/function (_PureComponent) {
|
|
|
207
203
|
var _this2 = this;
|
|
208
204
|
|
|
209
205
|
var isOpen = this.state.isOpen;
|
|
210
|
-
var
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
}, /*#__PURE__*/React.createElement(Manager, null, /*#__PURE__*/React.createElement(Reference, null, function (_ref) {
|
|
206
|
+
var _this$props2 = this.props,
|
|
207
|
+
miniMode = _this$props2.miniMode,
|
|
208
|
+
className = _this$props2.className;
|
|
209
|
+
return jsx("div", {
|
|
210
|
+
className: " ".concat(isOpen ? 'isOpen' : '', " ").concat(miniMode ? 'miniMode' : '', " ").concat(className),
|
|
211
|
+
css: pickerStyle
|
|
212
|
+
}, jsx(Manager, null, jsx(Reference, null, function (_ref) {
|
|
218
213
|
var ref = _ref.ref;
|
|
219
|
-
return
|
|
214
|
+
return jsx(Trigger, {
|
|
220
215
|
ref: ref,
|
|
221
216
|
onClick: _this2.onTriggerClick,
|
|
222
217
|
miniMode: miniMode,
|
|
223
218
|
disabled: _this2.props.disabled
|
|
224
219
|
});
|
|
225
|
-
}),
|
|
220
|
+
}), jsx(Popper, {
|
|
226
221
|
placement: "bottom-start",
|
|
227
222
|
modifiers: this.popperModifiers
|
|
228
223
|
}, function (_ref2) {
|
|
@@ -230,13 +225,13 @@ export var ReactionPicker = /*#__PURE__*/function (_PureComponent) {
|
|
|
230
225
|
style = _ref2.style,
|
|
231
226
|
update = _ref2.update;
|
|
232
227
|
_this2.updatePopper = update;
|
|
233
|
-
return
|
|
228
|
+
return jsx(Fragment, null, isOpen && jsx("div", {
|
|
234
229
|
style: _objectSpread({
|
|
235
230
|
zIndex: layers.layer()
|
|
236
231
|
}, style),
|
|
237
232
|
ref: ref
|
|
238
|
-
},
|
|
239
|
-
|
|
233
|
+
}, jsx("div", {
|
|
234
|
+
css: popupStyle
|
|
240
235
|
}, _this2.renderContent())));
|
|
241
236
|
})));
|
|
242
237
|
}
|
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
|
|
3
|
+
/** @jsx jsx */
|
|
4
|
+
import { jsx, css } from '@emotion/core';
|
|
2
5
|
import Tooltip from '@atlaskit/tooltip';
|
|
3
|
-
import React from 'react';
|
|
6
|
+
import React, { Fragment } from 'react';
|
|
4
7
|
import { FormattedMessage } from 'react-intl-next';
|
|
5
|
-
import { style } from 'typestyle';
|
|
6
8
|
import { token } from '@atlaskit/tokens';
|
|
7
9
|
import { N90 } from '@atlaskit/theme/colors';
|
|
8
10
|
import { messages } from './i18n';
|
|
9
11
|
var verticalMargin = 5;
|
|
10
|
-
var tooltipStyle =
|
|
12
|
+
var tooltipStyle = css({
|
|
11
13
|
maxWidth: '150px',
|
|
12
14
|
textOverflow: 'ellipsis',
|
|
13
15
|
whiteSpace: 'nowrap',
|
|
14
16
|
overflow: 'hidden',
|
|
15
17
|
marginBottom: verticalMargin,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
marginTop: verticalMargin
|
|
27
|
-
}
|
|
18
|
+
ul: {
|
|
19
|
+
listStyle: 'none',
|
|
20
|
+
margin: 0,
|
|
21
|
+
padding: 0,
|
|
22
|
+
textAlign: 'left'
|
|
23
|
+
},
|
|
24
|
+
li: {
|
|
25
|
+
overflow: 'hidden',
|
|
26
|
+
textOverflow: 'ellipsis',
|
|
27
|
+
marginTop: verticalMargin
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
|
-
var emojiNameStyle =
|
|
30
|
+
var emojiNameStyle = css({
|
|
31
31
|
textTransform: 'capitalize',
|
|
32
32
|
color: token('color.text.inverse', N90),
|
|
33
33
|
fontWeight: 600
|
|
34
34
|
});
|
|
35
|
-
var footerStyle =
|
|
35
|
+
var footerStyle = css({
|
|
36
36
|
color: token('color.text.inverse', N90),
|
|
37
37
|
fontWeight: 300
|
|
38
38
|
});
|
|
@@ -43,25 +43,25 @@ export var ReactionTooltip = function ReactionTooltip(_ref) {
|
|
|
43
43
|
users = _ref.reaction.users;
|
|
44
44
|
|
|
45
45
|
if (!users || users.length === 0) {
|
|
46
|
-
return
|
|
46
|
+
return jsx(Fragment, null, React.Children.only(children));
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
var content =
|
|
50
|
-
|
|
51
|
-
},
|
|
52
|
-
|
|
49
|
+
var content = jsx("div", {
|
|
50
|
+
css: tooltipStyle
|
|
51
|
+
}, jsx("ul", null, emojiName ? jsx("li", {
|
|
52
|
+
css: emojiNameStyle
|
|
53
53
|
}, emojiName) : null, users.slice(0, TOOLTIP_USERS_LIMIT).map(function (user, index) {
|
|
54
|
-
return
|
|
54
|
+
return jsx("li", {
|
|
55
55
|
key: index
|
|
56
56
|
}, user.displayName);
|
|
57
|
-
}), users.length > TOOLTIP_USERS_LIMIT ?
|
|
58
|
-
|
|
59
|
-
},
|
|
57
|
+
}), users.length > TOOLTIP_USERS_LIMIT ? jsx("li", {
|
|
58
|
+
css: footerStyle
|
|
59
|
+
}, jsx(FormattedMessage, _extends({}, messages.otherUsers, {
|
|
60
60
|
values: {
|
|
61
61
|
count: users.length - TOOLTIP_USERS_LIMIT
|
|
62
62
|
}
|
|
63
63
|
}))) : null));
|
|
64
|
-
return
|
|
64
|
+
return jsx(Tooltip, {
|
|
65
65
|
content: content,
|
|
66
66
|
position: "bottom"
|
|
67
67
|
}, React.Children.only(children));
|
|
@@ -10,22 +10,23 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
10
10
|
|
|
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
|
+
/** @jsx jsx */
|
|
14
|
+
import { jsx, css } from '@emotion/core';
|
|
13
15
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
14
16
|
import Tooltip from '@atlaskit/tooltip';
|
|
15
17
|
import React from 'react';
|
|
16
18
|
import { FormattedMessage } from 'react-intl-next';
|
|
17
|
-
import { style } from 'typestyle';
|
|
18
19
|
import { createAndFireSafe, createPickerButtonClickedEvent, createPickerCancelledEvent, createPickerMoreClickedEvent, createReactionSelectionEvent, createReactionsRenderedEvent } from '../analytics';
|
|
19
20
|
import { ReactionStatus } from '../types/ReactionStatus';
|
|
20
21
|
import { messages } from './i18n';
|
|
21
22
|
import { Reaction } from './Reaction';
|
|
22
23
|
import { ReactionPicker } from './ReactionPicker';
|
|
23
|
-
var reactionStyle =
|
|
24
|
+
var reactionStyle = css({
|
|
24
25
|
display: 'inline-block',
|
|
25
26
|
// top margin of 2px to allow spacing between rows when wrapped (paired with top margin in reactionsStyle)
|
|
26
27
|
margin: '2px 4px 0 4px'
|
|
27
28
|
});
|
|
28
|
-
var reactionsStyle =
|
|
29
|
+
var reactionsStyle = css({
|
|
29
30
|
display: 'flex',
|
|
30
31
|
flexWrap: 'wrap',
|
|
31
32
|
position: 'relative',
|
|
@@ -33,10 +34,8 @@ var reactionsStyle = style({
|
|
|
33
34
|
borderRadius: '15px',
|
|
34
35
|
// To allow to row spacing of 2px on wrap, and 0px on first row
|
|
35
36
|
marginTop: '-2px',
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
marginLeft: 0
|
|
39
|
-
}
|
|
37
|
+
'& > :first-of-type': {
|
|
38
|
+
marginLeft: 0
|
|
40
39
|
}
|
|
41
40
|
});
|
|
42
41
|
export var ReactionsWithoutAnalytics = /*#__PURE__*/function (_React$PureComponent) {
|
|
@@ -69,11 +68,11 @@ export var ReactionsWithoutAnalytics = /*#__PURE__*/function (_React$PureCompone
|
|
|
69
68
|
|
|
70
69
|
switch (status) {
|
|
71
70
|
case ReactionStatus.error:
|
|
72
|
-
return errorMessage ? errorMessage :
|
|
71
|
+
return errorMessage ? errorMessage : jsx(FormattedMessage, messages.unexpectedError);
|
|
73
72
|
|
|
74
73
|
case ReactionStatus.loading:
|
|
75
74
|
case ReactionStatus.notLoaded:
|
|
76
|
-
return
|
|
75
|
+
return jsx(FormattedMessage, messages.loadingReactions);
|
|
77
76
|
|
|
78
77
|
default:
|
|
79
78
|
return undefined;
|
|
@@ -112,9 +111,9 @@ export var ReactionsWithoutAnalytics = /*#__PURE__*/function (_React$PureCompone
|
|
|
112
111
|
});
|
|
113
112
|
|
|
114
113
|
_defineProperty(_assertThisInitialized(_this), "renderReaction", function (reaction) {
|
|
115
|
-
return
|
|
114
|
+
return jsx(Reaction, {
|
|
116
115
|
key: reaction.emojiId,
|
|
117
|
-
|
|
116
|
+
css: reactionStyle,
|
|
118
117
|
reaction: reaction,
|
|
119
118
|
emojiProvider: _this.props.emojiProvider,
|
|
120
119
|
onClick: _this.props.onReactionClick,
|
|
@@ -144,10 +143,10 @@ export var ReactionsWithoutAnalytics = /*#__PURE__*/function (_React$PureCompone
|
|
|
144
143
|
emojiProvider = _this$props2.emojiProvider,
|
|
145
144
|
boundariesElement = _this$props2.boundariesElement,
|
|
146
145
|
allowAllEmojis = _this$props2.allowAllEmojis;
|
|
147
|
-
return
|
|
146
|
+
return jsx(Tooltip, {
|
|
148
147
|
content: this.getTooltip()
|
|
149
|
-
},
|
|
150
|
-
|
|
148
|
+
}, jsx(ReactionPicker, {
|
|
149
|
+
css: reactionStyle,
|
|
151
150
|
emojiProvider: emojiProvider,
|
|
152
151
|
miniMode: true,
|
|
153
152
|
boundariesElement: boundariesElement,
|
|
@@ -162,8 +161,8 @@ export var ReactionsWithoutAnalytics = /*#__PURE__*/function (_React$PureCompone
|
|
|
162
161
|
}, {
|
|
163
162
|
key: "render",
|
|
164
163
|
value: function render() {
|
|
165
|
-
return
|
|
166
|
-
|
|
164
|
+
return jsx("div", {
|
|
165
|
+
css: reactionsStyle
|
|
167
166
|
}, this.props.reactions.map(this.renderReaction), this.renderPicker());
|
|
168
167
|
}
|
|
169
168
|
}]);
|
|
@@ -10,27 +10,26 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
10
10
|
|
|
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
|
+
/** @jsx jsx */
|
|
14
|
+
import { jsx, css, keyframes } from '@emotion/core';
|
|
13
15
|
import Tooltip from '@atlaskit/tooltip';
|
|
14
|
-
import cx from 'classnames';
|
|
15
16
|
import React from 'react';
|
|
16
17
|
import { PureComponent } from 'react';
|
|
17
|
-
import { keyframes, style } from 'typestyle';
|
|
18
18
|
import { EmojiButton } from './EmojiButton';
|
|
19
19
|
import { ShowMore } from './ShowMore';
|
|
20
20
|
import { equalEmojiId } from './utils';
|
|
21
|
-
var
|
|
21
|
+
export var renderEmojiTestId = 'render-emoji';
|
|
22
|
+
var selectorStyle = css({
|
|
22
23
|
boxSizing: 'border-box',
|
|
23
24
|
display: 'flex',
|
|
24
25
|
padding: 0
|
|
25
26
|
});
|
|
26
|
-
var emojiStyle =
|
|
27
|
+
var emojiStyle = css({
|
|
27
28
|
display: 'inline-block',
|
|
28
29
|
opacity: 0,
|
|
29
|
-
|
|
30
|
-
'
|
|
31
|
-
|
|
32
|
-
transform: 'translateY(-48px) scale(2.667)'
|
|
33
|
-
}
|
|
30
|
+
'&.selected': {
|
|
31
|
+
transition: 'transform 200ms ease-in-out ',
|
|
32
|
+
transform: 'translateY(-48px) scale(2.667)'
|
|
34
33
|
}
|
|
35
34
|
});
|
|
36
35
|
var revealAnimation = keyframes({
|
|
@@ -46,7 +45,7 @@ var revealAnimation = keyframes({
|
|
|
46
45
|
transform: 'scale(1)'
|
|
47
46
|
}
|
|
48
47
|
});
|
|
49
|
-
export var revealStyle =
|
|
48
|
+
export var revealStyle = css({
|
|
50
49
|
animation: "".concat(revealAnimation, " 150ms ease-in-out forwards")
|
|
51
50
|
});
|
|
52
51
|
|
|
@@ -108,17 +107,16 @@ export var Selector = /*#__PURE__*/function (_PureComponent) {
|
|
|
108
107
|
_defineProperty(_assertThisInitialized(_this), "renderEmoji", function (emojiId, index) {
|
|
109
108
|
var emojiProvider = _this.props.emojiProvider;
|
|
110
109
|
var key = emojiId.id || emojiId.shortName;
|
|
111
|
-
var classNames = cx(emojiStyle, revealStyle, {
|
|
112
|
-
selected: emojiId === _this.state.selection
|
|
113
|
-
});
|
|
114
110
|
var style = revealDelay(index);
|
|
115
|
-
return
|
|
111
|
+
return jsx("div", {
|
|
116
112
|
key: key,
|
|
117
|
-
className:
|
|
118
|
-
|
|
119
|
-
|
|
113
|
+
className: emojiId === _this.state.selection ? 'selected' : '',
|
|
114
|
+
css: [emojiStyle, revealStyle],
|
|
115
|
+
style: style,
|
|
116
|
+
"data-testid": renderEmojiTestId
|
|
117
|
+
}, jsx(Tooltip, {
|
|
120
118
|
content: emojiId.shortName
|
|
121
|
-
},
|
|
119
|
+
}, jsx(EmojiButton, {
|
|
122
120
|
emojiId: emojiId,
|
|
123
121
|
emojiProvider: emojiProvider,
|
|
124
122
|
onClick: _this.onEmojiSelected
|
|
@@ -126,11 +124,9 @@ export var Selector = /*#__PURE__*/function (_PureComponent) {
|
|
|
126
124
|
});
|
|
127
125
|
|
|
128
126
|
_defineProperty(_assertThisInitialized(_this), "renderShowMore", function () {
|
|
129
|
-
return
|
|
127
|
+
return jsx(ShowMore, {
|
|
130
128
|
key: "more",
|
|
131
|
-
|
|
132
|
-
button: revealStyle
|
|
133
|
-
},
|
|
129
|
+
revealStyle: revealStyle,
|
|
134
130
|
style: {
|
|
135
131
|
button: revealDelay(defaultReactions.length)
|
|
136
132
|
},
|
|
@@ -154,8 +150,8 @@ export var Selector = /*#__PURE__*/function (_PureComponent) {
|
|
|
154
150
|
key: "render",
|
|
155
151
|
value: function render() {
|
|
156
152
|
var showMore = this.props.showMore;
|
|
157
|
-
return
|
|
158
|
-
|
|
153
|
+
return jsx("div", {
|
|
154
|
+
css: selectorStyle
|
|
159
155
|
}, defaultReactions.map(this.renderEmoji), showMore ? this.renderShowMore() : null);
|
|
160
156
|
}
|
|
161
157
|
}]);
|
|
@@ -9,20 +9,21 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
9
9
|
|
|
10
10
|
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; } }
|
|
11
11
|
|
|
12
|
+
/** @jsx jsx */
|
|
13
|
+
import { jsx, css } from '@emotion/core';
|
|
12
14
|
import EditorMoreIcon from '@atlaskit/icon/glyph/editor/more';
|
|
13
15
|
import { borderRadius } from '@atlaskit/theme/constants';
|
|
14
16
|
import { N30A } from '@atlaskit/theme/colors';
|
|
15
17
|
import { token } from '@atlaskit/tokens';
|
|
16
18
|
import Tooltip from '@atlaskit/tooltip';
|
|
17
|
-
import cx from 'classnames';
|
|
18
19
|
import React from 'react';
|
|
19
|
-
import { style } from 'typestyle';
|
|
20
20
|
import { messages } from './i18n';
|
|
21
21
|
import { FormattedMessage } from 'react-intl-next';
|
|
22
|
-
|
|
22
|
+
import { revealStyle } from './Selector';
|
|
23
|
+
var moreEmojiContainerStyle = css({
|
|
23
24
|
display: 'flex'
|
|
24
25
|
});
|
|
25
|
-
var moreButtonStyle =
|
|
26
|
+
var moreButtonStyle = css({
|
|
26
27
|
opacity: 0,
|
|
27
28
|
outline: 'none',
|
|
28
29
|
backgroundColor: 'transparent',
|
|
@@ -33,19 +34,18 @@ var moreButtonStyle = style({
|
|
|
33
34
|
padding: '4px',
|
|
34
35
|
width: '38px',
|
|
35
36
|
verticalAlign: 'top',
|
|
36
|
-
|
|
37
|
-
'
|
|
38
|
-
backgroundColor: token('color.background.neutral.subtle.hovered', N30A)
|
|
39
|
-
}
|
|
37
|
+
'&:hover': {
|
|
38
|
+
backgroundColor: token('color.background.neutral.subtle.hovered', N30A)
|
|
40
39
|
}
|
|
41
40
|
});
|
|
42
|
-
var separatorStyle =
|
|
41
|
+
var separatorStyle = css({
|
|
43
42
|
backgroundColor: token('color.border', N30A),
|
|
44
43
|
margin: '8px 8px 8px 4px',
|
|
45
44
|
width: '1px',
|
|
46
45
|
height: '60%',
|
|
47
46
|
display: 'inline-block'
|
|
48
47
|
});
|
|
48
|
+
export var showMoreTestId = 'show-more-button';
|
|
49
49
|
export var ShowMore = /*#__PURE__*/function (_React$PureComponent) {
|
|
50
50
|
_inherits(ShowMore, _React$PureComponent);
|
|
51
51
|
|
|
@@ -64,19 +64,22 @@ export var ShowMore = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
64
64
|
style = _this$props.style,
|
|
65
65
|
onClick = _this$props.onClick,
|
|
66
66
|
classNameProp = _this$props.className;
|
|
67
|
-
return
|
|
68
|
-
className:
|
|
67
|
+
return jsx("div", {
|
|
68
|
+
className: classNameProp.container,
|
|
69
|
+
css: moreEmojiContainerStyle,
|
|
69
70
|
style: style.container
|
|
70
|
-
},
|
|
71
|
-
|
|
72
|
-
}),
|
|
73
|
-
return
|
|
71
|
+
}, jsx("div", {
|
|
72
|
+
css: separatorStyle
|
|
73
|
+
}), jsx(FormattedMessage, messages.moreEmoji, function (text) {
|
|
74
|
+
return jsx(Tooltip, {
|
|
74
75
|
content: text
|
|
75
|
-
},
|
|
76
|
-
className:
|
|
76
|
+
}, jsx("button", {
|
|
77
|
+
className: classNameProp.button,
|
|
78
|
+
css: [moreButtonStyle, revealStyle],
|
|
77
79
|
style: style.button,
|
|
78
|
-
onMouseDown: onClick
|
|
79
|
-
|
|
80
|
+
onMouseDown: onClick,
|
|
81
|
+
"data-testid": showMoreTestId
|
|
82
|
+
}, jsx(EditorMoreIcon, {
|
|
80
83
|
label: "More"
|
|
81
84
|
})));
|
|
82
85
|
}));
|