@atlaskit/reactions 21.0.5 → 21.2.1
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 +24 -0
- package/dist/cjs/analytics/index.js +11 -1
- package/dist/cjs/analytics/ufo.js +71 -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 +43 -37
- 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/components/UfoErrorBoundary.js +68 -0
- package/dist/cjs/components/index.js +9 -1
- package/dist/cjs/containers/ConnectedReactionPicker.js +44 -0
- package/dist/cjs/containers/ConnectedReactionsView.js +131 -0
- package/dist/cjs/containers/index.js +4 -6
- package/dist/cjs/index.js +11 -3
- package/dist/cjs/{reaction-store → store}/ReactionConsumer.js +0 -0
- package/dist/cjs/{reaction-store → store}/ReactionsStore.js +63 -14
- package/dist/cjs/{reaction-store → store}/batched.js +0 -0
- package/dist/cjs/{reaction-store → store}/index.js +0 -0
- package/dist/cjs/{reaction-store → store}/utils.js +0 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/analytics/index.js +2 -0
- package/dist/es2019/analytics/ufo.js +62 -0
- 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 +39 -34
- 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/components/UfoErrorBoundary.js +13 -0
- package/dist/es2019/components/index.js +2 -1
- package/dist/es2019/containers/ConnectedReactionPicker.js +27 -0
- package/dist/es2019/containers/ConnectedReactionsView.js +112 -0
- package/dist/es2019/containers/index.js +2 -2
- package/dist/es2019/index.js +2 -1
- package/dist/es2019/{reaction-store → store}/ReactionConsumer.js +0 -0
- package/dist/es2019/{reaction-store → store}/ReactionsStore.js +59 -13
- package/dist/es2019/{reaction-store → store}/batched.js +0 -0
- package/dist/es2019/{reaction-store → store}/index.js +0 -0
- package/dist/es2019/{reaction-store → store}/utils.js +0 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/analytics/index.js +2 -0
- package/dist/esm/analytics/ufo.js +62 -0
- 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 +39 -34
- 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/components/UfoErrorBoundary.js +54 -0
- package/dist/esm/components/index.js +2 -1
- package/dist/esm/containers/ConnectedReactionPicker.js +29 -0
- package/dist/esm/containers/ConnectedReactionsView.js +108 -0
- package/dist/esm/containers/index.js +2 -2
- package/dist/esm/index.js +2 -1
- package/dist/esm/{reaction-store → store}/ReactionConsumer.js +0 -0
- package/dist/esm/{reaction-store → store}/ReactionsStore.js +61 -13
- package/dist/esm/{reaction-store → store}/batched.js +0 -0
- package/dist/esm/{reaction-store → store}/index.js +0 -0
- package/dist/esm/{reaction-store → store}/utils.js +0 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/analytics/index.d.ts +1 -0
- package/dist/types/analytics/ufo.d.ts +26 -0
- package/dist/types/components/Counter.d.ts +4 -3
- package/dist/types/components/FlashAnimation.d.ts +3 -1
- package/dist/types/components/ReactionPicker.d.ts +2 -1
- package/dist/types/components/Reactions.d.ts +7 -5
- package/dist/types/components/Selector.d.ts +2 -1
- package/dist/types/components/ShowMore.d.ts +4 -0
- package/dist/types/components/UfoErrorBoundary.d.ts +8 -0
- package/dist/types/components/index.d.ts +2 -0
- package/dist/types/containers/ConnectedReactionPicker.d.ts +10 -0
- package/dist/types/containers/ConnectedReactionsView.d.ts +19 -0
- package/dist/types/containers/index.d.ts +2 -2
- package/dist/types/index.d.ts +3 -2
- package/dist/types/store/ReactionConsumer.d.ts +29 -0
- package/dist/types/{reaction-store → store}/ReactionsStore.d.ts +11 -7
- package/dist/types/{reaction-store → store}/batched.d.ts +0 -0
- package/dist/types/{reaction-store → store}/index.d.ts +0 -0
- package/dist/types/{reaction-store → store}/utils.d.ts +0 -0
- package/dist/types/types/Actions.d.ts +6 -0
- package/dist/types/types/index.d.ts +1 -1
- package/docs/0-intro.tsx +1 -1
- package/package.json +7 -6
- package/dist/cjs/containers/ReactionsContainer.js +0 -142
- package/dist/cjs/containers/ReactionsPickerContainer.js +0 -76
- package/dist/es2019/containers/ReactionsContainer.js +0 -96
- package/dist/es2019/containers/ReactionsPickerContainer.js +0 -26
- package/dist/esm/containers/ReactionsContainer.js +0 -125
- package/dist/esm/containers/ReactionsPickerContainer.js +0 -62
- package/dist/types/containers/ReactionsContainer.d.ts +0 -22
- package/dist/types/containers/ReactionsPickerContainer.d.ts +0 -18
- package/dist/types/reaction-store/ReactionConsumer.d.ts +0 -32
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
|
|
3
|
+
/** @jsx jsx */
|
|
4
|
+
import { jsx, css } from '@emotion/core';
|
|
2
5
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
3
6
|
import { ResourcedEmoji } from '@atlaskit/emoji/element';
|
|
4
7
|
import { B50, B75, B300, N20, N40, N400 } from '@atlaskit/theme/colors';
|
|
5
8
|
import { token } from '@atlaskit/tokens';
|
|
6
|
-
import cx from 'classnames';
|
|
7
9
|
import React from 'react';
|
|
8
10
|
import { PureComponent } from 'react';
|
|
9
|
-
import { style } from 'typestyle';
|
|
10
11
|
import { createAndFireSafe, createReactionClickedEvent, createReactionHoveredEvent } from '../analytics';
|
|
11
12
|
import { Counter } from './Counter';
|
|
12
13
|
import { FlashAnimation } from './FlashAnimation';
|
|
@@ -18,12 +19,12 @@ import { isLeftClick, akHeight } from './utils';
|
|
|
18
19
|
* of FlashAnimation b/c it otherwise throws off the flash styling
|
|
19
20
|
*/
|
|
20
21
|
|
|
21
|
-
const emojiStyle =
|
|
22
|
+
const emojiStyle = css({
|
|
22
23
|
transformOrigin: 'center center 0',
|
|
23
24
|
lineHeight: '12px',
|
|
24
25
|
padding: '4px 4px 4px 8px'
|
|
25
26
|
});
|
|
26
|
-
const reactionStyle =
|
|
27
|
+
const reactionStyle = css({
|
|
27
28
|
outline: 'none',
|
|
28
29
|
display: 'flex',
|
|
29
30
|
flexDirection: 'row',
|
|
@@ -39,24 +40,20 @@ const reactionStyle = style({
|
|
|
39
40
|
margin: 0,
|
|
40
41
|
padding: 0,
|
|
41
42
|
transition: '200ms ease-in-out',
|
|
42
|
-
|
|
43
|
-
'
|
|
44
|
-
background: `${token('color.background.neutral.subtle.hovered', N20)}`
|
|
45
|
-
}
|
|
43
|
+
'&:hover': {
|
|
44
|
+
background: `${token('color.background.neutral.subtle.hovered', N20)}`
|
|
46
45
|
}
|
|
47
46
|
});
|
|
48
|
-
const reactedStyle =
|
|
49
|
-
backgroundColor: token('color.background.
|
|
50
|
-
borderColor: token('color.
|
|
51
|
-
|
|
52
|
-
'
|
|
53
|
-
background: `${token('color.background.brand.hovered', B75)}`
|
|
54
|
-
}
|
|
47
|
+
const reactedStyle = css({
|
|
48
|
+
backgroundColor: token('color.background.selected', B50),
|
|
49
|
+
borderColor: token('color.border.selected', B300),
|
|
50
|
+
'&:hover': {
|
|
51
|
+
background: `${token('color.background.selected.hovered', B75)}`
|
|
55
52
|
}
|
|
56
53
|
});
|
|
57
54
|
const flashHeight = akHeight - 2; // height without the 1px border
|
|
58
55
|
|
|
59
|
-
const flashStyle =
|
|
56
|
+
const flashStyle = css({
|
|
60
57
|
display: 'flex',
|
|
61
58
|
flexDirection: 'row',
|
|
62
59
|
borderRadius: '10px',
|
|
@@ -141,30 +138,28 @@ class ReactionWithoutAnalytics extends PureComponent {
|
|
|
141
138
|
const {
|
|
142
139
|
emojiName
|
|
143
140
|
} = this.state;
|
|
144
|
-
const classNames = cx(reactionStyle, classNameProp, {
|
|
145
|
-
[reactedStyle]: reaction.reacted
|
|
146
|
-
});
|
|
147
141
|
const emojiId = {
|
|
148
142
|
id: reaction.emojiId,
|
|
149
143
|
shortName: ''
|
|
150
144
|
};
|
|
151
|
-
return
|
|
152
|
-
className:
|
|
145
|
+
return jsx("button", {
|
|
146
|
+
className: classNameProp,
|
|
147
|
+
css: [reactionStyle, reaction.reacted && reactedStyle],
|
|
153
148
|
onMouseUp: this.handleMouseDown,
|
|
154
149
|
onMouseEnter: this.handleMouseEnter
|
|
155
|
-
},
|
|
150
|
+
}, jsx(ReactionTooltip, {
|
|
156
151
|
emojiName: emojiName,
|
|
157
152
|
reaction: reaction
|
|
158
|
-
},
|
|
153
|
+
}, jsx(FlashAnimation, {
|
|
159
154
|
flash: flash,
|
|
160
|
-
|
|
161
|
-
},
|
|
162
|
-
|
|
163
|
-
},
|
|
155
|
+
css: flashStyle
|
|
156
|
+
}, jsx("div", {
|
|
157
|
+
css: emojiStyle
|
|
158
|
+
}, jsx(ResourcedEmoji, {
|
|
164
159
|
emojiProvider: emojiProvider,
|
|
165
160
|
emojiId: emojiId,
|
|
166
161
|
fitToHeight: 16
|
|
167
|
-
})),
|
|
162
|
+
})), jsx(Counter, {
|
|
168
163
|
value: reaction.count,
|
|
169
164
|
highlight: reaction.reacted
|
|
170
165
|
}))));
|
|
@@ -1,37 +1,34 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
|
|
3
|
+
/** @jsx jsx */
|
|
4
|
+
import React, { Fragment, PureComponent } from 'react';
|
|
5
|
+
import ReactDOM from 'react-dom';
|
|
6
|
+
import { jsx, css } from '@emotion/core';
|
|
2
7
|
import { EmojiPicker } from '@atlaskit/emoji/picker';
|
|
3
8
|
import { Manager, Popper, Reference } from '@atlaskit/popper';
|
|
4
9
|
import { borderRadius } from '@atlaskit/theme/constants';
|
|
5
10
|
import { N0, N50A, N60A } from '@atlaskit/theme/colors';
|
|
6
11
|
import { token } from '@atlaskit/tokens';
|
|
7
|
-
import cx from 'classnames';
|
|
8
|
-
import React from 'react';
|
|
9
|
-
import { PureComponent } from 'react';
|
|
10
|
-
import ReactDOM from 'react-dom';
|
|
11
|
-
import { style } from 'typestyle';
|
|
12
12
|
import { Selector } from './Selector';
|
|
13
13
|
import { Trigger } from './Trigger';
|
|
14
|
+
import { UFO } from '../analytics';
|
|
14
15
|
import { layers } from '@atlaskit/theme/constants';
|
|
15
|
-
const pickerStyle =
|
|
16
|
+
const pickerStyle = css({
|
|
16
17
|
verticalAlign: 'middle',
|
|
17
|
-
|
|
18
|
-
'
|
|
19
|
-
|
|
20
|
-
marginRight: '4px'
|
|
21
|
-
}
|
|
18
|
+
'&.miniMode': {
|
|
19
|
+
display: 'inline-block',
|
|
20
|
+
marginRight: '4px'
|
|
22
21
|
}
|
|
23
22
|
});
|
|
24
|
-
const contentStyle =
|
|
23
|
+
const contentStyle = css({
|
|
25
24
|
display: 'flex'
|
|
26
25
|
});
|
|
27
|
-
const popupStyle =
|
|
26
|
+
const popupStyle = css({
|
|
28
27
|
background: token('elevation.surface.overlay', N0),
|
|
29
28
|
borderRadius: `${borderRadius()}px`,
|
|
30
29
|
boxShadow: token('elevation.shadow.overlay', `0 4px 8px -2px ${N50A}, 0 0 1px ${N60A}`),
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
boxShadow: undefined
|
|
34
|
-
}
|
|
30
|
+
'&> div': {
|
|
31
|
+
boxShadow: undefined
|
|
35
32
|
}
|
|
36
33
|
});
|
|
37
34
|
|
|
@@ -94,6 +91,9 @@ export class ReactionPicker extends PureComponent {
|
|
|
94
91
|
});
|
|
95
92
|
|
|
96
93
|
_defineProperty(this, "onTriggerClick", () => {
|
|
94
|
+
// ufo start reaction experience
|
|
95
|
+
UFO.PickerRender.start();
|
|
96
|
+
|
|
97
97
|
if (this.props.onOpen) {
|
|
98
98
|
this.props.onOpen();
|
|
99
99
|
}
|
|
@@ -101,6 +101,9 @@ export class ReactionPicker extends PureComponent {
|
|
|
101
101
|
this.setState({
|
|
102
102
|
isOpen: !this.state.isOpen,
|
|
103
103
|
showFullPicker: false
|
|
104
|
+
}, () => {
|
|
105
|
+
// ufo add reaction success
|
|
106
|
+
UFO.PickerRender.success();
|
|
104
107
|
});
|
|
105
108
|
});
|
|
106
109
|
|
|
@@ -140,12 +143,16 @@ export class ReactionPicker extends PureComponent {
|
|
|
140
143
|
|
|
141
144
|
componentWillUnmount() {
|
|
142
145
|
document.removeEventListener('click', this.handleClickOutside);
|
|
146
|
+
UFO.PickerRender.abort();
|
|
143
147
|
}
|
|
144
148
|
|
|
145
149
|
close(_emojiId) {
|
|
146
150
|
this.setState({
|
|
147
151
|
isOpen: false,
|
|
148
152
|
showFullPicker: false
|
|
153
|
+
}, () => {
|
|
154
|
+
// ufo abort reaction experience
|
|
155
|
+
UFO.PickerRender.abort();
|
|
149
156
|
});
|
|
150
157
|
}
|
|
151
158
|
|
|
@@ -154,9 +161,9 @@ export class ReactionPicker extends PureComponent {
|
|
|
154
161
|
emojiProvider,
|
|
155
162
|
allowAllEmojis
|
|
156
163
|
} = this.props;
|
|
157
|
-
return
|
|
158
|
-
|
|
159
|
-
},
|
|
164
|
+
return jsx("div", {
|
|
165
|
+
css: contentStyle
|
|
166
|
+
}, jsx(Selector, {
|
|
160
167
|
emojiProvider: emojiProvider,
|
|
161
168
|
onSelection: this.onEmojiSelected,
|
|
162
169
|
showMore: allowAllEmojis,
|
|
@@ -165,7 +172,7 @@ export class ReactionPicker extends PureComponent {
|
|
|
165
172
|
}
|
|
166
173
|
|
|
167
174
|
renderEmojiPicker() {
|
|
168
|
-
return
|
|
175
|
+
return jsx(EmojiPicker, {
|
|
169
176
|
emojiProvider: this.props.emojiProvider,
|
|
170
177
|
onSelection: this.onEmojiSelected
|
|
171
178
|
});
|
|
@@ -180,22 +187,20 @@ export class ReactionPicker extends PureComponent {
|
|
|
180
187
|
isOpen
|
|
181
188
|
} = this.state;
|
|
182
189
|
const {
|
|
183
|
-
miniMode
|
|
190
|
+
miniMode,
|
|
191
|
+
className
|
|
184
192
|
} = this.props;
|
|
185
|
-
|
|
186
|
-
isOpen:
|
|
187
|
-
|
|
188
|
-
},
|
|
189
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
190
|
-
className: classNames
|
|
191
|
-
}, /*#__PURE__*/React.createElement(Manager, null, /*#__PURE__*/React.createElement(Reference, null, ({
|
|
193
|
+
return jsx("div", {
|
|
194
|
+
className: ` ${isOpen ? 'isOpen' : ''} ${miniMode ? 'miniMode' : ''} ${className}`,
|
|
195
|
+
css: pickerStyle
|
|
196
|
+
}, jsx(Manager, null, jsx(Reference, null, ({
|
|
192
197
|
ref
|
|
193
|
-
}) =>
|
|
198
|
+
}) => jsx(Trigger, {
|
|
194
199
|
ref: ref,
|
|
195
200
|
onClick: this.onTriggerClick,
|
|
196
201
|
miniMode: miniMode,
|
|
197
202
|
disabled: this.props.disabled
|
|
198
|
-
})),
|
|
203
|
+
})), jsx(Popper, {
|
|
199
204
|
placement: "bottom-start",
|
|
200
205
|
modifiers: this.popperModifiers
|
|
201
206
|
}, ({
|
|
@@ -204,14 +209,14 @@ export class ReactionPicker extends PureComponent {
|
|
|
204
209
|
update
|
|
205
210
|
}) => {
|
|
206
211
|
this.updatePopper = update;
|
|
207
|
-
return
|
|
212
|
+
return jsx(Fragment, null, isOpen && jsx("div", {
|
|
208
213
|
style: {
|
|
209
214
|
zIndex: layers.layer(),
|
|
210
215
|
...style
|
|
211
216
|
},
|
|
212
217
|
ref: ref
|
|
213
|
-
},
|
|
214
|
-
|
|
218
|
+
}, jsx("div", {
|
|
219
|
+
css: popupStyle
|
|
215
220
|
}, this.renderContent())));
|
|
216
221
|
})));
|
|
217
222
|
}
|
|
@@ -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
|
const verticalMargin = 5;
|
|
10
|
-
const tooltipStyle =
|
|
12
|
+
const 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
|
-
const emojiNameStyle =
|
|
30
|
+
const emojiNameStyle = css({
|
|
31
31
|
textTransform: 'capitalize',
|
|
32
32
|
color: token('color.text.inverse', N90),
|
|
33
33
|
fontWeight: 600
|
|
34
34
|
});
|
|
35
|
-
const footerStyle =
|
|
35
|
+
const footerStyle = css({
|
|
36
36
|
color: token('color.text.inverse', N90),
|
|
37
37
|
fontWeight: 300
|
|
38
38
|
});
|
|
@@ -45,25 +45,25 @@ export const ReactionTooltip = ({
|
|
|
45
45
|
}
|
|
46
46
|
}) => {
|
|
47
47
|
if (!users || users.length === 0) {
|
|
48
|
-
return
|
|
48
|
+
return jsx(Fragment, null, React.Children.only(children));
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
const content =
|
|
52
|
-
|
|
53
|
-
},
|
|
54
|
-
|
|
51
|
+
const content = jsx("div", {
|
|
52
|
+
css: tooltipStyle
|
|
53
|
+
}, jsx("ul", null, emojiName ? jsx("li", {
|
|
54
|
+
css: emojiNameStyle
|
|
55
55
|
}, emojiName) : null, users.slice(0, TOOLTIP_USERS_LIMIT).map((user, index) => {
|
|
56
|
-
return
|
|
56
|
+
return jsx("li", {
|
|
57
57
|
key: index
|
|
58
58
|
}, user.displayName);
|
|
59
|
-
}), users.length > TOOLTIP_USERS_LIMIT ?
|
|
60
|
-
|
|
61
|
-
},
|
|
59
|
+
}), users.length > TOOLTIP_USERS_LIMIT ? jsx("li", {
|
|
60
|
+
css: footerStyle
|
|
61
|
+
}, jsx(FormattedMessage, _extends({}, messages.otherUsers, {
|
|
62
62
|
values: {
|
|
63
63
|
count: users.length - TOOLTIP_USERS_LIMIT
|
|
64
64
|
}
|
|
65
65
|
}))) : null));
|
|
66
|
-
return
|
|
66
|
+
return jsx(Tooltip, {
|
|
67
67
|
content: content,
|
|
68
68
|
position: "bottom"
|
|
69
69
|
}, React.Children.only(children));
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
|
|
3
|
+
/** @jsx jsx */
|
|
4
|
+
import { jsx, css } from '@emotion/core';
|
|
2
5
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
3
6
|
import Tooltip from '@atlaskit/tooltip';
|
|
4
7
|
import React from 'react';
|
|
5
8
|
import { FormattedMessage } from 'react-intl-next';
|
|
6
|
-
import { style } from 'typestyle';
|
|
7
9
|
import { createAndFireSafe, createPickerButtonClickedEvent, createPickerCancelledEvent, createPickerMoreClickedEvent, createReactionSelectionEvent, createReactionsRenderedEvent } from '../analytics';
|
|
8
10
|
import { ReactionStatus } from '../types/ReactionStatus';
|
|
9
11
|
import { messages } from './i18n';
|
|
10
12
|
import { Reaction } from './Reaction';
|
|
11
13
|
import { ReactionPicker } from './ReactionPicker';
|
|
12
|
-
const reactionStyle =
|
|
14
|
+
const reactionStyle = css({
|
|
13
15
|
display: 'inline-block',
|
|
14
16
|
// top margin of 2px to allow spacing between rows when wrapped (paired with top margin in reactionsStyle)
|
|
15
17
|
margin: '2px 4px 0 4px'
|
|
16
18
|
});
|
|
17
|
-
const reactionsStyle =
|
|
19
|
+
const reactionsStyle = css({
|
|
18
20
|
display: 'flex',
|
|
19
21
|
flexWrap: 'wrap',
|
|
20
22
|
position: 'relative',
|
|
@@ -22,10 +24,8 @@ const reactionsStyle = style({
|
|
|
22
24
|
borderRadius: '15px',
|
|
23
25
|
// To allow to row spacing of 2px on wrap, and 0px on first row
|
|
24
26
|
marginTop: '-2px',
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
marginLeft: 0
|
|
28
|
-
}
|
|
27
|
+
'& > :first-of-type': {
|
|
28
|
+
marginLeft: 0
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
31
|
export class ReactionsWithoutAnalytics extends React.PureComponent {
|
|
@@ -49,11 +49,11 @@ export class ReactionsWithoutAnalytics extends React.PureComponent {
|
|
|
49
49
|
|
|
50
50
|
switch (status) {
|
|
51
51
|
case ReactionStatus.error:
|
|
52
|
-
return errorMessage ? errorMessage :
|
|
52
|
+
return errorMessage ? errorMessage : jsx(FormattedMessage, messages.unexpectedError);
|
|
53
53
|
|
|
54
54
|
case ReactionStatus.loading:
|
|
55
55
|
case ReactionStatus.notLoaded:
|
|
56
|
-
return
|
|
56
|
+
return jsx(FormattedMessage, messages.loadingReactions);
|
|
57
57
|
|
|
58
58
|
default:
|
|
59
59
|
return undefined;
|
|
@@ -89,9 +89,9 @@ export class ReactionsWithoutAnalytics extends React.PureComponent {
|
|
|
89
89
|
}
|
|
90
90
|
});
|
|
91
91
|
|
|
92
|
-
_defineProperty(this, "renderReaction", reaction =>
|
|
92
|
+
_defineProperty(this, "renderReaction", reaction => jsx(Reaction, {
|
|
93
93
|
key: reaction.emojiId,
|
|
94
|
-
|
|
94
|
+
css: reactionStyle,
|
|
95
95
|
reaction: reaction,
|
|
96
96
|
emojiProvider: this.props.emojiProvider,
|
|
97
97
|
onClick: this.props.onReactionClick,
|
|
@@ -116,10 +116,10 @@ export class ReactionsWithoutAnalytics extends React.PureComponent {
|
|
|
116
116
|
boundariesElement,
|
|
117
117
|
allowAllEmojis
|
|
118
118
|
} = this.props;
|
|
119
|
-
return
|
|
119
|
+
return jsx(Tooltip, {
|
|
120
120
|
content: this.getTooltip()
|
|
121
|
-
},
|
|
122
|
-
|
|
121
|
+
}, jsx(ReactionPicker, {
|
|
122
|
+
css: reactionStyle,
|
|
123
123
|
emojiProvider: emojiProvider,
|
|
124
124
|
miniMode: true,
|
|
125
125
|
boundariesElement: boundariesElement,
|
|
@@ -133,8 +133,8 @@ export class ReactionsWithoutAnalytics extends React.PureComponent {
|
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
render() {
|
|
136
|
-
return
|
|
137
|
-
|
|
136
|
+
return jsx("div", {
|
|
137
|
+
css: reactionsStyle
|
|
138
138
|
}, this.props.reactions.map(this.renderReaction), this.renderPicker());
|
|
139
139
|
}
|
|
140
140
|
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
|
|
3
|
+
/** @jsx jsx */
|
|
4
|
+
import { jsx, css, keyframes } from '@emotion/core';
|
|
2
5
|
import Tooltip from '@atlaskit/tooltip';
|
|
3
|
-
import cx from 'classnames';
|
|
4
6
|
import React from 'react';
|
|
5
7
|
import { PureComponent } from 'react';
|
|
6
|
-
import { keyframes, style } from 'typestyle';
|
|
7
8
|
import { EmojiButton } from './EmojiButton';
|
|
8
9
|
import { ShowMore } from './ShowMore';
|
|
9
10
|
import { equalEmojiId } from './utils';
|
|
10
|
-
const
|
|
11
|
+
export const renderEmojiTestId = 'render-emoji';
|
|
12
|
+
const selectorStyle = css({
|
|
11
13
|
boxSizing: 'border-box',
|
|
12
14
|
display: 'flex',
|
|
13
15
|
padding: 0
|
|
14
16
|
});
|
|
15
|
-
const emojiStyle =
|
|
17
|
+
const emojiStyle = css({
|
|
16
18
|
display: 'inline-block',
|
|
17
19
|
opacity: 0,
|
|
18
|
-
|
|
19
|
-
'
|
|
20
|
-
|
|
21
|
-
transform: 'translateY(-48px) scale(2.667)'
|
|
22
|
-
}
|
|
20
|
+
'&.selected': {
|
|
21
|
+
transition: 'transform 200ms ease-in-out ',
|
|
22
|
+
transform: 'translateY(-48px) scale(2.667)'
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
25
|
const revealAnimation = keyframes({
|
|
@@ -35,7 +35,7 @@ const revealAnimation = keyframes({
|
|
|
35
35
|
transform: 'scale(1)'
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
|
-
export const revealStyle =
|
|
38
|
+
export const revealStyle = css({
|
|
39
39
|
animation: `${revealAnimation} 150ms ease-in-out forwards`
|
|
40
40
|
});
|
|
41
41
|
|
|
@@ -80,28 +80,25 @@ export class Selector extends PureComponent {
|
|
|
80
80
|
emojiProvider
|
|
81
81
|
} = this.props;
|
|
82
82
|
const key = emojiId.id || emojiId.shortName;
|
|
83
|
-
const classNames = cx(emojiStyle, revealStyle, {
|
|
84
|
-
selected: emojiId === this.state.selection
|
|
85
|
-
});
|
|
86
83
|
const style = revealDelay(index);
|
|
87
|
-
return
|
|
84
|
+
return jsx("div", {
|
|
88
85
|
key: key,
|
|
89
|
-
className:
|
|
90
|
-
|
|
91
|
-
|
|
86
|
+
className: emojiId === this.state.selection ? 'selected' : '',
|
|
87
|
+
css: [emojiStyle, revealStyle],
|
|
88
|
+
style: style,
|
|
89
|
+
"data-testid": renderEmojiTestId
|
|
90
|
+
}, jsx(Tooltip, {
|
|
92
91
|
content: emojiId.shortName
|
|
93
|
-
},
|
|
92
|
+
}, jsx(EmojiButton, {
|
|
94
93
|
emojiId: emojiId,
|
|
95
94
|
emojiProvider: emojiProvider,
|
|
96
95
|
onClick: this.onEmojiSelected
|
|
97
96
|
})));
|
|
98
97
|
});
|
|
99
98
|
|
|
100
|
-
_defineProperty(this, "renderShowMore", () =>
|
|
99
|
+
_defineProperty(this, "renderShowMore", () => jsx(ShowMore, {
|
|
101
100
|
key: "more",
|
|
102
|
-
|
|
103
|
-
button: revealStyle
|
|
104
|
-
},
|
|
101
|
+
revealStyle: revealStyle,
|
|
105
102
|
style: {
|
|
106
103
|
button: revealDelay(defaultReactions.length)
|
|
107
104
|
},
|
|
@@ -122,8 +119,8 @@ export class Selector extends PureComponent {
|
|
|
122
119
|
const {
|
|
123
120
|
showMore
|
|
124
121
|
} = this.props;
|
|
125
|
-
return
|
|
126
|
-
|
|
122
|
+
return jsx("div", {
|
|
123
|
+
css: selectorStyle
|
|
127
124
|
}, defaultReactions.map(this.renderEmoji), showMore ? this.renderShowMore() : null);
|
|
128
125
|
}
|
|
129
126
|
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
|
|
3
|
+
/** @jsx jsx */
|
|
4
|
+
import { jsx, css } from '@emotion/core';
|
|
2
5
|
import EditorMoreIcon from '@atlaskit/icon/glyph/editor/more';
|
|
3
6
|
import { borderRadius } from '@atlaskit/theme/constants';
|
|
4
7
|
import { N30A } from '@atlaskit/theme/colors';
|
|
5
8
|
import { token } from '@atlaskit/tokens';
|
|
6
9
|
import Tooltip from '@atlaskit/tooltip';
|
|
7
|
-
import cx from 'classnames';
|
|
8
10
|
import React from 'react';
|
|
9
|
-
import { style } from 'typestyle';
|
|
10
11
|
import { messages } from './i18n';
|
|
11
12
|
import { FormattedMessage } from 'react-intl-next';
|
|
12
|
-
|
|
13
|
+
import { revealStyle } from './Selector';
|
|
14
|
+
const moreEmojiContainerStyle = css({
|
|
13
15
|
display: 'flex'
|
|
14
16
|
});
|
|
15
|
-
const moreButtonStyle =
|
|
17
|
+
const moreButtonStyle = css({
|
|
16
18
|
opacity: 0,
|
|
17
19
|
outline: 'none',
|
|
18
20
|
backgroundColor: 'transparent',
|
|
@@ -23,19 +25,18 @@ const moreButtonStyle = style({
|
|
|
23
25
|
padding: '4px',
|
|
24
26
|
width: '38px',
|
|
25
27
|
verticalAlign: 'top',
|
|
26
|
-
|
|
27
|
-
'
|
|
28
|
-
backgroundColor: token('color.background.neutral.subtle.hovered', N30A)
|
|
29
|
-
}
|
|
28
|
+
'&:hover': {
|
|
29
|
+
backgroundColor: token('color.background.neutral.subtle.hovered', N30A)
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
|
-
const separatorStyle =
|
|
32
|
+
const separatorStyle = css({
|
|
33
33
|
backgroundColor: token('color.border', N30A),
|
|
34
34
|
margin: '8px 8px 8px 4px',
|
|
35
35
|
width: '1px',
|
|
36
36
|
height: '60%',
|
|
37
37
|
display: 'inline-block'
|
|
38
38
|
});
|
|
39
|
+
export const showMoreTestId = 'show-more-button';
|
|
39
40
|
export class ShowMore extends React.PureComponent {
|
|
40
41
|
render() {
|
|
41
42
|
const {
|
|
@@ -43,18 +44,21 @@ export class ShowMore extends React.PureComponent {
|
|
|
43
44
|
onClick,
|
|
44
45
|
className: classNameProp
|
|
45
46
|
} = this.props;
|
|
46
|
-
return
|
|
47
|
-
className:
|
|
47
|
+
return jsx("div", {
|
|
48
|
+
className: classNameProp.container,
|
|
49
|
+
css: moreEmojiContainerStyle,
|
|
48
50
|
style: style.container
|
|
49
|
-
},
|
|
50
|
-
|
|
51
|
-
}),
|
|
51
|
+
}, jsx("div", {
|
|
52
|
+
css: separatorStyle
|
|
53
|
+
}), jsx(FormattedMessage, messages.moreEmoji, text => jsx(Tooltip, {
|
|
52
54
|
content: text
|
|
53
|
-
},
|
|
54
|
-
className:
|
|
55
|
+
}, jsx("button", {
|
|
56
|
+
className: classNameProp.button,
|
|
57
|
+
css: [moreButtonStyle, revealStyle],
|
|
55
58
|
style: style.button,
|
|
56
|
-
onMouseDown: onClick
|
|
57
|
-
|
|
59
|
+
onMouseDown: onClick,
|
|
60
|
+
"data-testid": showMoreTestId
|
|
61
|
+
}, jsx(EditorMoreIcon, {
|
|
58
62
|
label: "More"
|
|
59
63
|
})))));
|
|
60
64
|
}
|
|
@@ -1,20 +1,18 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx, css } from '@emotion/core';
|
|
1
3
|
import Button from '@atlaskit/button/standard-button';
|
|
2
4
|
import EmojiAddIcon from '@atlaskit/icon/glyph/emoji-add';
|
|
3
|
-
import cx from 'classnames';
|
|
4
5
|
import React from 'react';
|
|
5
|
-
|
|
6
|
-
const triggerStyle = style({
|
|
6
|
+
const triggerStyle = css({
|
|
7
7
|
width: '32px',
|
|
8
8
|
height: '32px',
|
|
9
9
|
display: 'flex',
|
|
10
10
|
justifyContent: 'center',
|
|
11
11
|
alignItems: 'center',
|
|
12
12
|
lineHeight: '16px',
|
|
13
|
-
|
|
14
|
-
'
|
|
15
|
-
|
|
16
|
-
height: '24px'
|
|
17
|
-
}
|
|
13
|
+
'&.miniMode': {
|
|
14
|
+
width: '24px',
|
|
15
|
+
height: '24px'
|
|
18
16
|
}
|
|
19
17
|
});
|
|
20
18
|
export const Trigger = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
@@ -29,15 +27,13 @@ export const Trigger = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
29
27
|
}
|
|
30
28
|
};
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
miniMode
|
|
34
|
-
|
|
35
|
-
return /*#__PURE__*/React.createElement(Button, {
|
|
36
|
-
className: classNames,
|
|
30
|
+
return jsx(Button, {
|
|
31
|
+
className: miniMode ? 'miniMode' : '',
|
|
32
|
+
css: triggerStyle,
|
|
37
33
|
appearance: "subtle",
|
|
38
34
|
onClick: handleMouseDown,
|
|
39
35
|
isDisabled: disabled,
|
|
40
|
-
iconBefore:
|
|
36
|
+
iconBefore: jsx(EmojiAddIcon, {
|
|
41
37
|
size: "small",
|
|
42
38
|
label: "Add reaction"
|
|
43
39
|
}),
|