@atlaskit/reactions 21.0.3 → 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 +28 -0
- package/README.md +3 -0
- package/dist/cjs/components/Counter.js +73 -162
- package/dist/cjs/components/EmojiButton.js +9 -11
- package/dist/cjs/components/FlashAnimation.js +19 -17
- package/dist/cjs/components/Reaction.js +28 -39
- package/dist/cjs/components/ReactionPicker.js +26 -33
- package/dist/cjs/components/ReactionTooltip.js +33 -29
- package/dist/cjs/components/Reactions.js +17 -19
- 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/i18n/cs.js +4 -3
- package/dist/cjs/i18n/da.js +4 -3
- package/dist/cjs/i18n/de.js +4 -3
- package/dist/cjs/i18n/en_ZZ.js +21 -0
- package/dist/cjs/i18n/es.js +4 -3
- package/dist/cjs/i18n/et.js +2 -2
- package/dist/cjs/i18n/fi.js +4 -3
- package/dist/cjs/i18n/fr.js +4 -3
- package/dist/cjs/i18n/hu.js +4 -3
- package/dist/cjs/i18n/it.js +4 -3
- package/dist/cjs/i18n/ja.js +4 -3
- package/dist/cjs/i18n/ko.js +4 -3
- package/dist/cjs/i18n/nb.js +4 -3
- package/dist/cjs/i18n/nl.js +4 -3
- package/dist/cjs/i18n/pl.js +4 -3
- package/dist/cjs/i18n/pt_BR.js +4 -3
- package/dist/cjs/i18n/pt_PT.js +2 -2
- package/dist/cjs/i18n/ru.js +4 -3
- package/dist/cjs/i18n/sk.js +2 -2
- package/dist/cjs/i18n/sv.js +4 -3
- package/dist/cjs/i18n/th.js +4 -3
- package/dist/cjs/i18n/tr.js +4 -3
- package/dist/cjs/i18n/uk.js +4 -3
- package/dist/cjs/i18n/vi.js +4 -3
- package/dist/cjs/i18n/zh.js +4 -3
- package/dist/cjs/i18n/zh_TW.js +4 -3
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/Counter.js +57 -141
- package/dist/es2019/components/EmojiButton.js +10 -10
- package/dist/es2019/components/FlashAnimation.js +16 -15
- package/dist/es2019/components/Reaction.js +29 -39
- package/dist/es2019/components/ReactionPicker.js +27 -32
- package/dist/es2019/components/ReactionTooltip.js +27 -27
- package/dist/es2019/components/Reactions.js +18 -18
- 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/i18n/cs.js +4 -3
- package/dist/es2019/i18n/da.js +4 -3
- package/dist/es2019/i18n/de.js +4 -3
- package/dist/es2019/i18n/en_ZZ.js +13 -0
- package/dist/es2019/i18n/es.js +4 -3
- package/dist/es2019/i18n/et.js +2 -2
- package/dist/es2019/i18n/fi.js +4 -3
- package/dist/es2019/i18n/fr.js +4 -3
- package/dist/es2019/i18n/hu.js +4 -3
- package/dist/es2019/i18n/it.js +4 -3
- package/dist/es2019/i18n/ja.js +4 -3
- package/dist/es2019/i18n/ko.js +4 -3
- package/dist/es2019/i18n/nb.js +4 -3
- package/dist/es2019/i18n/nl.js +4 -3
- package/dist/es2019/i18n/pl.js +4 -3
- package/dist/es2019/i18n/pt_BR.js +4 -3
- package/dist/es2019/i18n/pt_PT.js +2 -2
- package/dist/es2019/i18n/ru.js +4 -3
- package/dist/es2019/i18n/sk.js +2 -2
- package/dist/es2019/i18n/sv.js +4 -3
- package/dist/es2019/i18n/th.js +4 -3
- package/dist/es2019/i18n/tr.js +4 -3
- package/dist/es2019/i18n/uk.js +4 -3
- package/dist/es2019/i18n/vi.js +4 -3
- package/dist/es2019/i18n/zh.js +4 -3
- package/dist/es2019/i18n/zh_TW.js +4 -3
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/Counter.js +65 -158
- package/dist/esm/components/EmojiButton.js +9 -10
- package/dist/esm/components/FlashAnimation.js +16 -14
- package/dist/esm/components/Reaction.js +28 -37
- package/dist/esm/components/ReactionPicker.js +27 -32
- package/dist/esm/components/ReactionTooltip.js +27 -27
- package/dist/esm/components/Reactions.js +17 -18
- 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/i18n/cs.js +4 -3
- package/dist/esm/i18n/da.js +4 -3
- package/dist/esm/i18n/de.js +4 -3
- package/dist/esm/i18n/en_ZZ.js +13 -0
- package/dist/esm/i18n/es.js +4 -3
- package/dist/esm/i18n/et.js +2 -2
- package/dist/esm/i18n/fi.js +4 -3
- package/dist/esm/i18n/fr.js +4 -3
- package/dist/esm/i18n/hu.js +4 -3
- package/dist/esm/i18n/it.js +4 -3
- package/dist/esm/i18n/ja.js +4 -3
- package/dist/esm/i18n/ko.js +4 -3
- package/dist/esm/i18n/nb.js +4 -3
- package/dist/esm/i18n/nl.js +4 -3
- package/dist/esm/i18n/pl.js +4 -3
- package/dist/esm/i18n/pt_BR.js +4 -3
- package/dist/esm/i18n/pt_PT.js +2 -2
- package/dist/esm/i18n/ru.js +4 -3
- package/dist/esm/i18n/sk.js +2 -2
- package/dist/esm/i18n/sv.js +4 -3
- package/dist/esm/i18n/th.js +4 -3
- package/dist/esm/i18n/tr.js +4 -3
- package/dist/esm/i18n/uk.js +4 -3
- package/dist/esm/i18n/vi.js +4 -3
- package/dist/esm/i18n/zh.js +4 -3
- package/dist/esm/i18n/zh_TW.js +4 -3
- package/dist/esm/version.json +1 -1
- package/dist/types/components/Counter.d.ts +6 -26
- package/dist/types/components/FlashAnimation.d.ts +3 -1
- package/dist/types/components/Reaction.d.ts +3 -3
- package/dist/types/components/Reactions.d.ts +1 -1
- package/dist/types/components/Selector.d.ts +2 -1
- package/dist/types/components/ShowMore.d.ts +4 -0
- package/dist/types/i18n/cs.d.ts +2 -1
- package/dist/types/i18n/da.d.ts +2 -1
- package/dist/types/i18n/de.d.ts +2 -1
- package/dist/types/i18n/en_ZZ.d.ts +13 -0
- package/dist/types/i18n/es.d.ts +2 -1
- package/dist/types/i18n/et.d.ts +1 -1
- package/dist/types/i18n/fi.d.ts +2 -1
- package/dist/types/i18n/fr.d.ts +2 -1
- package/dist/types/i18n/hu.d.ts +2 -1
- package/dist/types/i18n/it.d.ts +2 -1
- package/dist/types/i18n/ja.d.ts +2 -1
- package/dist/types/i18n/ko.d.ts +2 -1
- package/dist/types/i18n/nb.d.ts +2 -1
- package/dist/types/i18n/nl.d.ts +2 -1
- package/dist/types/i18n/pl.d.ts +2 -1
- package/dist/types/i18n/pt_BR.d.ts +2 -1
- package/dist/types/i18n/pt_PT.d.ts +1 -1
- package/dist/types/i18n/ru.d.ts +2 -1
- package/dist/types/i18n/sk.d.ts +1 -1
- package/dist/types/i18n/sv.d.ts +2 -1
- package/dist/types/i18n/th.d.ts +2 -1
- package/dist/types/i18n/tr.d.ts +2 -1
- package/dist/types/i18n/uk.d.ts +2 -1
- package/dist/types/i18n/vi.d.ts +2 -1
- package/dist/types/i18n/zh.d.ts +2 -1
- package/dist/types/i18n/zh_TW.d.ts +2 -1
- package/local-config-example.ts +3 -1
- package/package.json +12 -10
|
@@ -1,154 +1,70 @@
|
|
|
1
|
-
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx, css } from '@emotion/core';
|
|
2
3
|
import { N90, B400 } from '@atlaskit/theme/colors';
|
|
3
4
|
import { token } from '@atlaskit/tokens';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
fontSize: '11px',
|
|
5
|
+
import React, { memo } from 'react';
|
|
6
|
+
import { SlideIn, ExitingPersistence, mediumDurationMs } from '@atlaskit/motion';
|
|
7
|
+
import usePreviousValue from '@atlaskit/ds-lib/use-previous-value';
|
|
8
|
+
export const counterTestId = 'counter-container';
|
|
9
|
+
export const countStyle = css({
|
|
10
|
+
fontSize: 11,
|
|
11
|
+
// TODO: nice to have a theme level token for fontSize
|
|
12
12
|
color: token('color.text.subtlest', N90),
|
|
13
13
|
overflow: 'hidden',
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
position: 'relative',
|
|
15
|
+
padding: '4px 8px 4px 0',
|
|
16
|
+
lineHeight: '14px'
|
|
16
17
|
});
|
|
17
|
-
export const highlightStyle =
|
|
18
|
-
color: token('color.text.
|
|
18
|
+
export const highlightStyle = css({
|
|
19
|
+
color: token('color.text.selected', B400),
|
|
19
20
|
fontWeight: 600
|
|
20
21
|
});
|
|
21
|
-
export const containerStyle =
|
|
22
|
+
export const containerStyle = css({
|
|
22
23
|
display: 'flex',
|
|
23
24
|
flexDirection: 'column'
|
|
24
25
|
});
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
export const Counter = /*#__PURE__*/memo(({
|
|
27
|
+
highlight = false,
|
|
28
|
+
limit = 100,
|
|
29
|
+
overLimitLabel = '99+',
|
|
30
|
+
className,
|
|
31
|
+
value,
|
|
32
|
+
animationDuration = mediumDurationMs
|
|
33
|
+
}) => {
|
|
34
|
+
const hasReachedLimit = value => limit && value >= limit;
|
|
35
|
+
|
|
36
|
+
const getLabel = value => {
|
|
37
|
+
if (hasReachedLimit(value)) {
|
|
38
|
+
return overLimitLabel || '';
|
|
39
|
+
} else if (value === 0) {
|
|
40
|
+
return '';
|
|
41
|
+
} else {
|
|
42
|
+
return value.toString();
|
|
33
43
|
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
export class Counter extends React.PureComponent {
|
|
45
|
-
constructor(props) {
|
|
46
|
-
super(props);
|
|
47
|
-
|
|
48
|
-
_defineProperty(this, "getLabel", value => {
|
|
49
|
-
const {
|
|
50
|
-
overLimitLabel
|
|
51
|
-
} = this.props;
|
|
52
|
-
|
|
53
|
-
if (this.hasReachedLimit(value)) {
|
|
54
|
-
return overLimitLabel || '';
|
|
55
|
-
} else if (value === 0) {
|
|
56
|
-
return '';
|
|
57
|
-
} else {
|
|
58
|
-
return value.toString();
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
_defineProperty(this, "hasReachedLimit", value => this.props.limit && value >= this.props.limit);
|
|
63
|
-
|
|
64
|
-
_defineProperty(this, "renderPrevious", () => {
|
|
65
|
-
const {
|
|
66
|
-
previous
|
|
67
|
-
} = this.state;
|
|
68
|
-
|
|
69
|
-
if (previous !== undefined) {
|
|
70
|
-
const className = cx({
|
|
71
|
-
[highlightStyle]: previous.highlight
|
|
72
|
-
});
|
|
73
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
74
|
-
key: previous.value,
|
|
75
|
-
className: className
|
|
76
|
-
}, this.getLabel(previous.value));
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
return null;
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
_defineProperty(this, "clearPrevious", () => {
|
|
83
|
-
this.setState({
|
|
84
|
-
previous: undefined
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
this.state = {
|
|
89
|
-
previous: undefined
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
94
|
-
const {
|
|
95
|
-
value,
|
|
96
|
-
highlight
|
|
97
|
-
} = this.props;
|
|
98
|
-
|
|
99
|
-
if (value !== undefined && value !== nextProps.value && (!this.hasReachedLimit(value) || !this.hasReachedLimit(nextProps.value))) {
|
|
100
|
-
this.setState({
|
|
101
|
-
previous: {
|
|
102
|
-
value,
|
|
103
|
-
highlight
|
|
104
|
-
}
|
|
105
|
-
});
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const previousValue = usePreviousValue(value);
|
|
47
|
+
const label = getLabel(value);
|
|
48
|
+
const increase = previousValue ? previousValue < value : false;
|
|
49
|
+
return jsx("div", {
|
|
50
|
+
className: className,
|
|
51
|
+
css: countStyle,
|
|
52
|
+
style: {
|
|
53
|
+
width: label.length * 7
|
|
106
54
|
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
const className = cx(countStyle, classNameProp);
|
|
123
|
-
const currentClassName = cx({
|
|
124
|
-
[highlightStyle]: highlight
|
|
125
|
-
}); // WS-2525 With the pill UI updates, width of * 10 was too much so dropped down to * 7
|
|
126
|
-
|
|
127
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
128
|
-
className: className,
|
|
129
|
-
style: {
|
|
130
|
-
width: label.length * 7
|
|
131
|
-
}
|
|
132
|
-
}, /*#__PURE__*/React.createElement(CSSTransition, {
|
|
133
|
-
classNames: {
|
|
134
|
-
enter: enterClass
|
|
135
|
-
},
|
|
136
|
-
timeout: animationTime,
|
|
137
|
-
in: increase || decrease,
|
|
138
|
-
onEntered: this.clearPrevious
|
|
139
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
140
|
-
className: containerStyle
|
|
141
|
-
}, increase ? this.renderPrevious() : null, /*#__PURE__*/React.createElement("div", {
|
|
142
|
-
className: currentClassName,
|
|
143
|
-
key: value
|
|
144
|
-
}, label), decrease ? this.renderPrevious() : null)));
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
_defineProperty(Counter, "defaultProps", {
|
|
150
|
-
highlight: false,
|
|
151
|
-
limit: 100,
|
|
152
|
-
overLimitLabel: '99+',
|
|
153
|
-
className: undefined
|
|
55
|
+
}, jsx(ExitingPersistence, null, jsx(SlideIn, {
|
|
56
|
+
enterFrom: increase ? 'bottom' : 'top',
|
|
57
|
+
key: value,
|
|
58
|
+
duration: animationDuration
|
|
59
|
+
}, (motion, direction) => jsx("div", {
|
|
60
|
+
ref: motion.ref,
|
|
61
|
+
css: [containerStyle, css({
|
|
62
|
+
position: direction === 'exiting' ? 'absolute' : undefined
|
|
63
|
+
})],
|
|
64
|
+
className: motion.className,
|
|
65
|
+
"data-testid": counterTestId
|
|
66
|
+
}, jsx("div", {
|
|
67
|
+
css: highlight && highlightStyle,
|
|
68
|
+
key: value
|
|
69
|
+
}, label)))));
|
|
154
70
|
});
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
|
|
3
|
+
/** @jsx jsx */
|
|
4
|
+
import { jsx, css } from '@emotion/core';
|
|
2
5
|
import { ResourcedEmoji } from '@atlaskit/emoji/element';
|
|
3
6
|
import React from 'react';
|
|
4
7
|
import { PureComponent } from 'react';
|
|
5
|
-
import { style } from 'typestyle';
|
|
6
8
|
import { isLeftClick } from './utils';
|
|
7
|
-
const emojiButtonStyle =
|
|
9
|
+
const emojiButtonStyle = css({
|
|
8
10
|
outline: 'none',
|
|
9
11
|
display: 'flex',
|
|
10
12
|
backgroundColor: 'transparent',
|
|
@@ -13,11 +15,9 @@ const emojiButtonStyle = style({
|
|
|
13
15
|
cursor: 'pointer',
|
|
14
16
|
margin: '0',
|
|
15
17
|
padding: '10px 8px',
|
|
16
|
-
|
|
17
|
-
'
|
|
18
|
-
|
|
19
|
-
transform: 'scale(1.33)'
|
|
20
|
-
}
|
|
18
|
+
'&:hover > span': {
|
|
19
|
+
transition: 'transform cubic-bezier(0.23, 1, 0.32, 1) 200ms',
|
|
20
|
+
transform: 'scale(1.33)'
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
23
|
export class EmojiButton extends PureComponent {
|
|
@@ -38,10 +38,10 @@ export class EmojiButton extends PureComponent {
|
|
|
38
38
|
emojiId,
|
|
39
39
|
emojiProvider
|
|
40
40
|
} = this.props;
|
|
41
|
-
return
|
|
41
|
+
return jsx("button", {
|
|
42
42
|
onMouseUp: this.handleMouseDown,
|
|
43
|
-
|
|
44
|
-
},
|
|
43
|
+
css: emojiButtonStyle
|
|
44
|
+
}, jsx(ResourcedEmoji, {
|
|
45
45
|
emojiProvider: emojiProvider,
|
|
46
46
|
emojiId: emojiId
|
|
47
47
|
}));
|
|
@@ -1,39 +1,40 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx, css, keyframes } from '@emotion/core';
|
|
1
3
|
import { B75, B300 } from '@atlaskit/theme/colors';
|
|
2
4
|
import { token } from '@atlaskit/tokens';
|
|
3
|
-
import cx from 'classnames';
|
|
4
5
|
import React from 'react';
|
|
5
|
-
|
|
6
|
-
const containerStyle =
|
|
6
|
+
export const flashAnimationTestId = 'flash-animation';
|
|
7
|
+
const containerStyle = css({
|
|
7
8
|
width: '100%',
|
|
8
9
|
height: '100%'
|
|
9
10
|
});
|
|
10
11
|
const flashTime = 700;
|
|
11
|
-
const flashAnimation = keyframes({
|
|
12
|
+
export const flashAnimation = keyframes({
|
|
12
13
|
'0%': {
|
|
13
14
|
backgroundColor: 'transparent'
|
|
14
15
|
},
|
|
15
16
|
'20%': {
|
|
16
|
-
backgroundColor: token('color.background.
|
|
17
|
-
borderColor: token('color.
|
|
17
|
+
backgroundColor: token('color.background.selected.pressed', B75),
|
|
18
|
+
borderColor: token('color.border.selected', B300)
|
|
18
19
|
},
|
|
19
20
|
'75%': {
|
|
20
|
-
backgroundColor: token('color.background.
|
|
21
|
-
borderColor: token('color.
|
|
21
|
+
backgroundColor: token('color.background.selected.pressed', B75),
|
|
22
|
+
borderColor: token('color.border.selected', B300)
|
|
22
23
|
},
|
|
23
24
|
'100%': {
|
|
24
|
-
backgroundColor: token('color.background.
|
|
25
|
-
borderColor: token('color.
|
|
25
|
+
backgroundColor: token('color.background.selected.pressed', B75),
|
|
26
|
+
borderColor: token('color.border.selected', B300)
|
|
26
27
|
}
|
|
27
28
|
});
|
|
28
|
-
export const flashStyle =
|
|
29
|
+
export const flashStyle = css({
|
|
29
30
|
animation: `${flashAnimation} ${flashTime}ms ease-in-out`
|
|
30
31
|
});
|
|
31
32
|
/**
|
|
32
33
|
* Flash animation background component. See Reaction component for usage.
|
|
33
34
|
*/
|
|
34
35
|
|
|
35
|
-
export const FlashAnimation = props =>
|
|
36
|
-
className:
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
export const FlashAnimation = props => jsx("div", {
|
|
37
|
+
className: props.className,
|
|
38
|
+
css: [containerStyle, props.flash && flashStyle],
|
|
39
|
+
"data-testid": flashAnimationTestId
|
|
39
40
|
}, props.children);
|
|
@@ -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,33 +40,25 @@ 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',
|
|
63
60
|
height: `${flashHeight}px`
|
|
64
61
|
});
|
|
65
|
-
const counterStyle = style({
|
|
66
|
-
padding: '4px 8px 4px 0',
|
|
67
|
-
lineHeight: '14px'
|
|
68
|
-
});
|
|
69
62
|
|
|
70
63
|
class ReactionWithoutAnalytics extends PureComponent {
|
|
71
64
|
constructor(props) {
|
|
@@ -90,10 +83,10 @@ class ReactionWithoutAnalytics extends PureComponent {
|
|
|
90
83
|
}
|
|
91
84
|
});
|
|
92
85
|
|
|
93
|
-
_defineProperty(this, "
|
|
86
|
+
_defineProperty(this, "handleMouseEnter", event => {
|
|
94
87
|
event.preventDefault();
|
|
95
88
|
const {
|
|
96
|
-
|
|
89
|
+
onMouseEnter,
|
|
97
90
|
reaction
|
|
98
91
|
} = this.props;
|
|
99
92
|
|
|
@@ -101,8 +94,8 @@ class ReactionWithoutAnalytics extends PureComponent {
|
|
|
101
94
|
this.hoverStart = Date.now();
|
|
102
95
|
}
|
|
103
96
|
|
|
104
|
-
if (
|
|
105
|
-
|
|
97
|
+
if (onMouseEnter) {
|
|
98
|
+
onMouseEnter(this.props.reaction, event);
|
|
106
99
|
}
|
|
107
100
|
});
|
|
108
101
|
|
|
@@ -145,31 +138,28 @@ class ReactionWithoutAnalytics extends PureComponent {
|
|
|
145
138
|
const {
|
|
146
139
|
emojiName
|
|
147
140
|
} = this.state;
|
|
148
|
-
const classNames = cx(reactionStyle, classNameProp, {
|
|
149
|
-
[reactedStyle]: reaction.reacted
|
|
150
|
-
});
|
|
151
141
|
const emojiId = {
|
|
152
142
|
id: reaction.emojiId,
|
|
153
143
|
shortName: ''
|
|
154
144
|
};
|
|
155
|
-
return
|
|
156
|
-
className:
|
|
145
|
+
return jsx("button", {
|
|
146
|
+
className: classNameProp,
|
|
147
|
+
css: [reactionStyle, reaction.reacted && reactedStyle],
|
|
157
148
|
onMouseUp: this.handleMouseDown,
|
|
158
|
-
|
|
159
|
-
},
|
|
149
|
+
onMouseEnter: this.handleMouseEnter
|
|
150
|
+
}, jsx(ReactionTooltip, {
|
|
160
151
|
emojiName: emojiName,
|
|
161
152
|
reaction: reaction
|
|
162
|
-
},
|
|
153
|
+
}, jsx(FlashAnimation, {
|
|
163
154
|
flash: flash,
|
|
164
|
-
|
|
165
|
-
},
|
|
166
|
-
|
|
167
|
-
},
|
|
155
|
+
css: flashStyle
|
|
156
|
+
}, jsx("div", {
|
|
157
|
+
css: emojiStyle
|
|
158
|
+
}, jsx(ResourcedEmoji, {
|
|
168
159
|
emojiProvider: emojiProvider,
|
|
169
160
|
emojiId: emojiId,
|
|
170
161
|
fitToHeight: 16
|
|
171
|
-
})),
|
|
172
|
-
className: counterStyle,
|
|
162
|
+
})), jsx(Counter, {
|
|
173
163
|
value: reaction.count,
|
|
174
164
|
highlight: reaction.reacted
|
|
175
165
|
}))));
|
|
@@ -180,7 +170,7 @@ class ReactionWithoutAnalytics extends PureComponent {
|
|
|
180
170
|
_defineProperty(ReactionWithoutAnalytics, "defaultProps", {
|
|
181
171
|
flash: false,
|
|
182
172
|
className: undefined,
|
|
183
|
-
|
|
173
|
+
onMouseEnter: undefined,
|
|
184
174
|
flashOnMount: false
|
|
185
175
|
});
|
|
186
176
|
|
|
@@ -1,37 +1,34 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
|
|
3
|
+
/** @jsx jsx */
|
|
4
|
+
import { jsx, css } from '@emotion/core';
|
|
2
5
|
import { EmojiPicker } from '@atlaskit/emoji/picker';
|
|
3
6
|
import { Manager, Popper, Reference } from '@atlaskit/popper';
|
|
4
7
|
import { borderRadius } from '@atlaskit/theme/constants';
|
|
5
8
|
import { N0, N50A, N60A } from '@atlaskit/theme/colors';
|
|
6
9
|
import { token } from '@atlaskit/tokens';
|
|
7
|
-
import
|
|
8
|
-
import React from 'react';
|
|
10
|
+
import React, { Fragment } from 'react';
|
|
9
11
|
import { PureComponent } from 'react';
|
|
10
12
|
import ReactDOM from 'react-dom';
|
|
11
|
-
import { style } from 'typestyle';
|
|
12
13
|
import { Selector } from './Selector';
|
|
13
14
|
import { Trigger } from './Trigger';
|
|
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
|
|
|
@@ -154,9 +151,9 @@ export class ReactionPicker extends PureComponent {
|
|
|
154
151
|
emojiProvider,
|
|
155
152
|
allowAllEmojis
|
|
156
153
|
} = this.props;
|
|
157
|
-
return
|
|
158
|
-
|
|
159
|
-
},
|
|
154
|
+
return jsx("div", {
|
|
155
|
+
css: contentStyle
|
|
156
|
+
}, jsx(Selector, {
|
|
160
157
|
emojiProvider: emojiProvider,
|
|
161
158
|
onSelection: this.onEmojiSelected,
|
|
162
159
|
showMore: allowAllEmojis,
|
|
@@ -165,7 +162,7 @@ export class ReactionPicker extends PureComponent {
|
|
|
165
162
|
}
|
|
166
163
|
|
|
167
164
|
renderEmojiPicker() {
|
|
168
|
-
return
|
|
165
|
+
return jsx(EmojiPicker, {
|
|
169
166
|
emojiProvider: this.props.emojiProvider,
|
|
170
167
|
onSelection: this.onEmojiSelected
|
|
171
168
|
});
|
|
@@ -180,22 +177,20 @@ export class ReactionPicker extends PureComponent {
|
|
|
180
177
|
isOpen
|
|
181
178
|
} = this.state;
|
|
182
179
|
const {
|
|
183
|
-
miniMode
|
|
180
|
+
miniMode,
|
|
181
|
+
className
|
|
184
182
|
} = 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, ({
|
|
183
|
+
return jsx("div", {
|
|
184
|
+
className: ` ${isOpen ? 'isOpen' : ''} ${miniMode ? 'miniMode' : ''} ${className}`,
|
|
185
|
+
css: pickerStyle
|
|
186
|
+
}, jsx(Manager, null, jsx(Reference, null, ({
|
|
192
187
|
ref
|
|
193
|
-
}) =>
|
|
188
|
+
}) => jsx(Trigger, {
|
|
194
189
|
ref: ref,
|
|
195
190
|
onClick: this.onTriggerClick,
|
|
196
191
|
miniMode: miniMode,
|
|
197
192
|
disabled: this.props.disabled
|
|
198
|
-
})),
|
|
193
|
+
})), jsx(Popper, {
|
|
199
194
|
placement: "bottom-start",
|
|
200
195
|
modifiers: this.popperModifiers
|
|
201
196
|
}, ({
|
|
@@ -204,14 +199,14 @@ export class ReactionPicker extends PureComponent {
|
|
|
204
199
|
update
|
|
205
200
|
}) => {
|
|
206
201
|
this.updatePopper = update;
|
|
207
|
-
return
|
|
202
|
+
return jsx(Fragment, null, isOpen && jsx("div", {
|
|
208
203
|
style: {
|
|
209
204
|
zIndex: layers.layer(),
|
|
210
205
|
...style
|
|
211
206
|
},
|
|
212
207
|
ref: ref
|
|
213
|
-
},
|
|
214
|
-
|
|
208
|
+
}, jsx("div", {
|
|
209
|
+
css: popupStyle
|
|
215
210
|
}, this.renderContent())));
|
|
216
211
|
})));
|
|
217
212
|
}
|
|
@@ -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));
|