@atlaskit/reactions 21.0.3 → 21.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/dist/cjs/components/Counter.js +64 -153
- package/dist/cjs/components/Reaction.js +6 -11
- package/dist/cjs/components/Reactions.js +2 -2
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/Counter.js +51 -135
- package/dist/es2019/components/Reaction.js +6 -11
- package/dist/es2019/components/Reactions.js +2 -2
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/Counter.js +58 -152
- package/dist/esm/components/Reaction.js +6 -11
- package/dist/esm/components/Reactions.js +2 -2
- package/dist/esm/version.json +1 -1
- package/dist/types/components/Counter.d.ts +2 -23
- package/dist/types/components/Reaction.d.ts +3 -3
- package/dist/types/components/Reactions.d.ts +1 -1
- package/package.json +5 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/reactions
|
|
2
2
|
|
|
3
|
+
## 21.0.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`62a37c2a5c8`](https://bitbucket.org/atlassian/atlassian-frontend/commits/62a37c2a5c8) - replace `react-transition-group` with `@atlaskit/motion` and improve Counter component
|
|
8
|
+
- [`696ba6c465d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/696ba6c465d) - The Reaction component now fires only one request to the service when being hovered.
|
|
9
|
+
- [`95015909035`](https://bitbucket.org/atlassian/atlassian-frontend/commits/95015909035) - Fixed issue where some of the examples where crashing.
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
3
12
|
## 21.0.3
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -2,22 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
5
7
|
Object.defineProperty(exports, "__esModule", {
|
|
6
8
|
value: true
|
|
7
9
|
});
|
|
8
|
-
exports.
|
|
9
|
-
|
|
10
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
-
|
|
12
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
-
|
|
14
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
15
|
-
|
|
16
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
|
-
|
|
18
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
19
|
-
|
|
20
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
10
|
+
exports.highlightStyle = exports.countStyle = exports.containerStyle = exports.Counter = void 0;
|
|
21
11
|
|
|
22
12
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
23
13
|
|
|
@@ -27,25 +17,26 @@ var _tokens = require("@atlaskit/tokens");
|
|
|
27
17
|
|
|
28
18
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
29
19
|
|
|
30
|
-
var _react =
|
|
20
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
31
21
|
|
|
32
|
-
var
|
|
22
|
+
var _motion = require("@atlaskit/motion");
|
|
33
23
|
|
|
34
24
|
var _typestyle = require("typestyle");
|
|
35
25
|
|
|
36
|
-
var
|
|
26
|
+
var _usePreviousValue = _interopRequireDefault(require("@atlaskit/ds-lib/use-previous-value"));
|
|
37
27
|
|
|
38
|
-
function
|
|
28
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
39
29
|
|
|
40
|
-
function
|
|
30
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
41
31
|
|
|
42
|
-
var animationTime = 300;
|
|
43
32
|
var countStyle = (0, _typestyle.style)({
|
|
44
|
-
fontSize:
|
|
33
|
+
fontSize: 11,
|
|
34
|
+
// TODO: nice to have a theme level token for fontSize
|
|
45
35
|
color: (0, _tokens.token)('color.text.subtlest', _colors.N90),
|
|
46
36
|
overflow: 'hidden',
|
|
47
|
-
|
|
48
|
-
|
|
37
|
+
position: 'relative',
|
|
38
|
+
padding: '4px 8px 4px 0',
|
|
39
|
+
lineHeight: '14px'
|
|
49
40
|
});
|
|
50
41
|
exports.countStyle = countStyle;
|
|
51
42
|
var highlightStyle = (0, _typestyle.style)({
|
|
@@ -58,136 +49,56 @@ var containerStyle = (0, _typestyle.style)({
|
|
|
58
49
|
flexDirection: 'column'
|
|
59
50
|
});
|
|
60
51
|
exports.containerStyle = containerStyle;
|
|
61
|
-
|
|
62
|
-
var
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
52
|
+
var Counter = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
53
|
+
var _ref$highlight = _ref.highlight,
|
|
54
|
+
highlight = _ref$highlight === void 0 ? false : _ref$highlight,
|
|
55
|
+
_ref$limit = _ref.limit,
|
|
56
|
+
limit = _ref$limit === void 0 ? 100 : _ref$limit,
|
|
57
|
+
_ref$overLimitLabel = _ref.overLimitLabel,
|
|
58
|
+
overLimitLabel = _ref$overLimitLabel === void 0 ? '99+' : _ref$overLimitLabel,
|
|
59
|
+
className = _ref.className,
|
|
60
|
+
value = _ref.value,
|
|
61
|
+
_ref$animationDuratio = _ref.animationDuration,
|
|
62
|
+
animationDuration = _ref$animationDuratio === void 0 ? _motion.mediumDurationMs : _ref$animationDuratio;
|
|
63
|
+
|
|
64
|
+
var hasReachedLimit = function hasReachedLimit(value) {
|
|
65
|
+
return limit && value >= limit;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
var getLabel = function getLabel(value) {
|
|
69
|
+
if (hasReachedLimit(value)) {
|
|
70
|
+
return overLimitLabel || '';
|
|
71
|
+
} else if (value === 0) {
|
|
72
|
+
return '';
|
|
73
|
+
} else {
|
|
74
|
+
return value.toString();
|
|
69
75
|
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
var
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
exports.slideUpStyle = slideUpStyle;
|
|
82
|
-
var slideDownStyle = counterAnimation(-50, 0);
|
|
83
|
-
exports.slideDownStyle = slideDownStyle;
|
|
84
|
-
|
|
85
|
-
var Counter = /*#__PURE__*/function (_React$PureComponent) {
|
|
86
|
-
(0, _inherits2.default)(Counter, _React$PureComponent);
|
|
87
|
-
|
|
88
|
-
var _super = _createSuper(Counter);
|
|
89
|
-
|
|
90
|
-
function Counter(props) {
|
|
91
|
-
var _this;
|
|
92
|
-
|
|
93
|
-
(0, _classCallCheck2.default)(this, Counter);
|
|
94
|
-
_this = _super.call(this, props);
|
|
95
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getLabel", function (value) {
|
|
96
|
-
var overLimitLabel = _this.props.overLimitLabel;
|
|
97
|
-
|
|
98
|
-
if (_this.hasReachedLimit(value)) {
|
|
99
|
-
return overLimitLabel || '';
|
|
100
|
-
} else if (value === 0) {
|
|
101
|
-
return '';
|
|
102
|
-
} else {
|
|
103
|
-
return value.toString();
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "hasReachedLimit", function (value) {
|
|
107
|
-
return _this.props.limit && value >= _this.props.limit;
|
|
108
|
-
});
|
|
109
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderPrevious", function () {
|
|
110
|
-
var previous = _this.state.previous;
|
|
111
|
-
|
|
112
|
-
if (previous !== undefined) {
|
|
113
|
-
var className = (0, _classnames.default)((0, _defineProperty2.default)({}, highlightStyle, previous.highlight));
|
|
114
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
115
|
-
key: previous.value,
|
|
116
|
-
className: className
|
|
117
|
-
}, _this.getLabel(previous.value));
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
return null;
|
|
121
|
-
});
|
|
122
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "clearPrevious", function () {
|
|
123
|
-
_this.setState({
|
|
124
|
-
previous: undefined
|
|
125
|
-
});
|
|
126
|
-
});
|
|
127
|
-
_this.state = {
|
|
128
|
-
previous: undefined
|
|
129
|
-
};
|
|
130
|
-
return _this;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
(0, _createClass2.default)(Counter, [{
|
|
134
|
-
key: "UNSAFE_componentWillReceiveProps",
|
|
135
|
-
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
136
|
-
var _this$props = this.props,
|
|
137
|
-
value = _this$props.value,
|
|
138
|
-
highlight = _this$props.highlight;
|
|
139
|
-
|
|
140
|
-
if (value !== undefined && value !== nextProps.value && (!this.hasReachedLimit(value) || !this.hasReachedLimit(nextProps.value))) {
|
|
141
|
-
this.setState({
|
|
142
|
-
previous: {
|
|
143
|
-
value: value,
|
|
144
|
-
highlight: highlight
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
}
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
var previousValue = (0, _usePreviousValue.default)(value);
|
|
79
|
+
var label = getLabel(value);
|
|
80
|
+
var increase = previousValue ? previousValue < value : false;
|
|
81
|
+
var rootClassName = (0, _classnames.default)(countStyle, className);
|
|
82
|
+
var currentClassName = (0, _classnames.default)((0, _defineProperty2.default)({}, highlightStyle, highlight));
|
|
83
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
84
|
+
className: rootClassName,
|
|
85
|
+
style: {
|
|
86
|
+
width: label.length * 7
|
|
148
87
|
}
|
|
149
|
-
}, {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
style: {
|
|
167
|
-
width: label.length * 7
|
|
168
|
-
}
|
|
169
|
-
}, /*#__PURE__*/_react.default.createElement(_reactTransitionGroup.CSSTransition, {
|
|
170
|
-
classNames: {
|
|
171
|
-
enter: enterClass
|
|
172
|
-
},
|
|
173
|
-
timeout: animationTime,
|
|
174
|
-
in: increase || decrease,
|
|
175
|
-
onEntered: this.clearPrevious
|
|
176
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
177
|
-
className: containerStyle
|
|
178
|
-
}, increase ? this.renderPrevious() : null, /*#__PURE__*/_react.default.createElement("div", {
|
|
179
|
-
className: currentClassName,
|
|
180
|
-
key: value
|
|
181
|
-
}, label), decrease ? this.renderPrevious() : null)));
|
|
182
|
-
}
|
|
183
|
-
}]);
|
|
184
|
-
return Counter;
|
|
185
|
-
}(_react.default.PureComponent);
|
|
186
|
-
|
|
187
|
-
exports.Counter = Counter;
|
|
188
|
-
(0, _defineProperty2.default)(Counter, "defaultProps", {
|
|
189
|
-
highlight: false,
|
|
190
|
-
limit: 100,
|
|
191
|
-
overLimitLabel: '99+',
|
|
192
|
-
className: undefined
|
|
193
|
-
});
|
|
88
|
+
}, /*#__PURE__*/_react.default.createElement(_motion.ExitingPersistence, null, /*#__PURE__*/_react.default.createElement(_motion.SlideIn, {
|
|
89
|
+
enterFrom: increase ? 'bottom' : 'top',
|
|
90
|
+
key: value,
|
|
91
|
+
duration: animationDuration
|
|
92
|
+
}, function (motion, direction) {
|
|
93
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
94
|
+
ref: motion.ref,
|
|
95
|
+
className: (0, _classnames.default)(containerStyle, motion.className, (0, _typestyle.style)({
|
|
96
|
+
position: direction === 'exiting' ? 'absolute' : undefined
|
|
97
|
+
}))
|
|
98
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
99
|
+
className: currentClassName,
|
|
100
|
+
key: value
|
|
101
|
+
}, label));
|
|
102
|
+
})));
|
|
103
|
+
});
|
|
104
|
+
exports.Counter = Counter;
|
|
@@ -104,10 +104,6 @@ var flashStyle = (0, _typestyle.style)({
|
|
|
104
104
|
borderRadius: '10px',
|
|
105
105
|
height: "".concat(flashHeight, "px")
|
|
106
106
|
});
|
|
107
|
-
var counterStyle = (0, _typestyle.style)({
|
|
108
|
-
padding: '4px 8px 4px 0',
|
|
109
|
-
lineHeight: '14px'
|
|
110
|
-
});
|
|
111
107
|
|
|
112
108
|
var ReactionWithoutAnalytics = /*#__PURE__*/function (_PureComponent) {
|
|
113
109
|
(0, _inherits2.default)(ReactionWithoutAnalytics, _PureComponent);
|
|
@@ -134,18 +130,18 @@ var ReactionWithoutAnalytics = /*#__PURE__*/function (_PureComponent) {
|
|
|
134
130
|
_this.props.onClick(_this.props.reaction.emojiId, event);
|
|
135
131
|
}
|
|
136
132
|
});
|
|
137
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "
|
|
133
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleMouseEnter", function (event) {
|
|
138
134
|
event.preventDefault();
|
|
139
135
|
var _this$props2 = _this.props,
|
|
140
|
-
|
|
136
|
+
onMouseEnter = _this$props2.onMouseEnter,
|
|
141
137
|
reaction = _this$props2.reaction;
|
|
142
138
|
|
|
143
139
|
if (!reaction.users || !reaction.users.length) {
|
|
144
140
|
_this.hoverStart = Date.now();
|
|
145
141
|
}
|
|
146
142
|
|
|
147
|
-
if (
|
|
148
|
-
|
|
143
|
+
if (onMouseEnter) {
|
|
144
|
+
onMouseEnter(_this.props.reaction, event);
|
|
149
145
|
}
|
|
150
146
|
});
|
|
151
147
|
_this.state = {};
|
|
@@ -202,7 +198,7 @@ var ReactionWithoutAnalytics = /*#__PURE__*/function (_PureComponent) {
|
|
|
202
198
|
return /*#__PURE__*/_react.default.createElement("button", {
|
|
203
199
|
className: classNames,
|
|
204
200
|
onMouseUp: this.handleMouseDown,
|
|
205
|
-
|
|
201
|
+
onMouseEnter: this.handleMouseEnter
|
|
206
202
|
}, /*#__PURE__*/_react.default.createElement(_ReactionTooltip.ReactionTooltip, {
|
|
207
203
|
emojiName: emojiName,
|
|
208
204
|
reaction: reaction
|
|
@@ -216,7 +212,6 @@ var ReactionWithoutAnalytics = /*#__PURE__*/function (_PureComponent) {
|
|
|
216
212
|
emojiId: emojiId,
|
|
217
213
|
fitToHeight: 16
|
|
218
214
|
})), /*#__PURE__*/_react.default.createElement(_Counter.Counter, {
|
|
219
|
-
className: counterStyle,
|
|
220
215
|
value: reaction.count,
|
|
221
216
|
highlight: reaction.reacted
|
|
222
217
|
}))));
|
|
@@ -228,7 +223,7 @@ var ReactionWithoutAnalytics = /*#__PURE__*/function (_PureComponent) {
|
|
|
228
223
|
(0, _defineProperty2.default)(ReactionWithoutAnalytics, "defaultProps", {
|
|
229
224
|
flash: false,
|
|
230
225
|
className: undefined,
|
|
231
|
-
|
|
226
|
+
onMouseEnter: undefined,
|
|
232
227
|
flashOnMount: false
|
|
233
228
|
});
|
|
234
229
|
(0, _defineProperty2.default)(ReactionWithoutAnalytics, "displayName", 'Reaction');
|
|
@@ -101,7 +101,7 @@ var ReactionsWithoutAnalytics = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
101
101
|
return undefined;
|
|
102
102
|
}
|
|
103
103
|
});
|
|
104
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "
|
|
104
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleReactionMouseEnter", function (reaction) {
|
|
105
105
|
if (_this.props.onReactionHover) {
|
|
106
106
|
_this.props.onReactionHover(reaction.emojiId);
|
|
107
107
|
}
|
|
@@ -134,7 +134,7 @@ var ReactionsWithoutAnalytics = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
134
134
|
reaction: reaction,
|
|
135
135
|
emojiProvider: _this.props.emojiProvider,
|
|
136
136
|
onClick: _this.props.onReactionClick,
|
|
137
|
-
|
|
137
|
+
onMouseEnter: _this.handleReactionMouseEnter,
|
|
138
138
|
flash: _this.props.flash[reaction.emojiId]
|
|
139
139
|
});
|
|
140
140
|
});
|
package/dist/cjs/version.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
1
|
import { N90, B400 } from '@atlaskit/theme/colors';
|
|
3
2
|
import { token } from '@atlaskit/tokens';
|
|
4
3
|
import cx from 'classnames';
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
const animationTime = 300;
|
|
4
|
+
import React, { memo } from 'react';
|
|
5
|
+
import { SlideIn, ExitingPersistence, mediumDurationMs } from '@atlaskit/motion';
|
|
6
|
+
import { style } from 'typestyle';
|
|
7
|
+
import usePreviousValue from '@atlaskit/ds-lib/use-previous-value';
|
|
10
8
|
export const countStyle = style({
|
|
11
|
-
fontSize:
|
|
9
|
+
fontSize: 11,
|
|
10
|
+
// TODO: nice to have a theme level token for fontSize
|
|
12
11
|
color: token('color.text.subtlest', N90),
|
|
13
12
|
overflow: 'hidden',
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
position: 'relative',
|
|
14
|
+
padding: '4px 8px 4px 0',
|
|
15
|
+
lineHeight: '14px'
|
|
16
16
|
});
|
|
17
17
|
export const highlightStyle = style({
|
|
18
18
|
color: token('color.text.brand', B400),
|
|
@@ -22,133 +22,49 @@ export const containerStyle = style({
|
|
|
22
22
|
display: 'flex',
|
|
23
23
|
flexDirection: 'column'
|
|
24
24
|
});
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
export const Counter = /*#__PURE__*/memo(({
|
|
26
|
+
highlight = false,
|
|
27
|
+
limit = 100,
|
|
28
|
+
overLimitLabel = '99+',
|
|
29
|
+
className,
|
|
30
|
+
value,
|
|
31
|
+
animationDuration = mediumDurationMs
|
|
32
|
+
}) => {
|
|
33
|
+
const hasReachedLimit = value => limit && value >= limit;
|
|
34
|
+
|
|
35
|
+
const getLabel = value => {
|
|
36
|
+
if (hasReachedLimit(value)) {
|
|
37
|
+
return overLimitLabel || '';
|
|
38
|
+
} else if (value === 0) {
|
|
39
|
+
return '';
|
|
40
|
+
} else {
|
|
41
|
+
return value.toString();
|
|
33
42
|
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const previousValue = usePreviousValue(value);
|
|
46
|
+
const label = getLabel(value);
|
|
47
|
+
const increase = previousValue ? previousValue < value : false;
|
|
48
|
+
const rootClassName = cx(countStyle, className);
|
|
49
|
+
const currentClassName = cx({
|
|
50
|
+
[highlightStyle]: highlight
|
|
34
51
|
});
|
|
35
|
-
return
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
animation: slideAnimation(start, end)
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
export const slideUpStyle = counterAnimation(0, -50);
|
|
43
|
-
export const slideDownStyle = counterAnimation(-50, 0);
|
|
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
|
-
});
|
|
52
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
53
|
+
className: rootClassName,
|
|
54
|
+
style: {
|
|
55
|
+
width: label.length * 7
|
|
106
56
|
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
const decrease = previous !== undefined && previous.value > value;
|
|
121
|
-
const enterClass = increase ? slideUpStyle : decrease ? slideDownStyle : undefined;
|
|
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
|
|
57
|
+
}, /*#__PURE__*/React.createElement(ExitingPersistence, null, /*#__PURE__*/React.createElement(SlideIn, {
|
|
58
|
+
enterFrom: increase ? 'bottom' : 'top',
|
|
59
|
+
key: value,
|
|
60
|
+
duration: animationDuration
|
|
61
|
+
}, (motion, direction) => /*#__PURE__*/React.createElement("div", {
|
|
62
|
+
ref: motion.ref,
|
|
63
|
+
className: cx(containerStyle, motion.className, style({
|
|
64
|
+
position: direction === 'exiting' ? 'absolute' : undefined
|
|
65
|
+
}))
|
|
66
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
67
|
+
className: currentClassName,
|
|
68
|
+
key: value
|
|
69
|
+
}, label)))));
|
|
154
70
|
});
|
|
@@ -62,10 +62,6 @@ const flashStyle = style({
|
|
|
62
62
|
borderRadius: '10px',
|
|
63
63
|
height: `${flashHeight}px`
|
|
64
64
|
});
|
|
65
|
-
const counterStyle = style({
|
|
66
|
-
padding: '4px 8px 4px 0',
|
|
67
|
-
lineHeight: '14px'
|
|
68
|
-
});
|
|
69
65
|
|
|
70
66
|
class ReactionWithoutAnalytics extends PureComponent {
|
|
71
67
|
constructor(props) {
|
|
@@ -90,10 +86,10 @@ class ReactionWithoutAnalytics extends PureComponent {
|
|
|
90
86
|
}
|
|
91
87
|
});
|
|
92
88
|
|
|
93
|
-
_defineProperty(this, "
|
|
89
|
+
_defineProperty(this, "handleMouseEnter", event => {
|
|
94
90
|
event.preventDefault();
|
|
95
91
|
const {
|
|
96
|
-
|
|
92
|
+
onMouseEnter,
|
|
97
93
|
reaction
|
|
98
94
|
} = this.props;
|
|
99
95
|
|
|
@@ -101,8 +97,8 @@ class ReactionWithoutAnalytics extends PureComponent {
|
|
|
101
97
|
this.hoverStart = Date.now();
|
|
102
98
|
}
|
|
103
99
|
|
|
104
|
-
if (
|
|
105
|
-
|
|
100
|
+
if (onMouseEnter) {
|
|
101
|
+
onMouseEnter(this.props.reaction, event);
|
|
106
102
|
}
|
|
107
103
|
});
|
|
108
104
|
|
|
@@ -155,7 +151,7 @@ class ReactionWithoutAnalytics extends PureComponent {
|
|
|
155
151
|
return /*#__PURE__*/React.createElement("button", {
|
|
156
152
|
className: classNames,
|
|
157
153
|
onMouseUp: this.handleMouseDown,
|
|
158
|
-
|
|
154
|
+
onMouseEnter: this.handleMouseEnter
|
|
159
155
|
}, /*#__PURE__*/React.createElement(ReactionTooltip, {
|
|
160
156
|
emojiName: emojiName,
|
|
161
157
|
reaction: reaction
|
|
@@ -169,7 +165,6 @@ class ReactionWithoutAnalytics extends PureComponent {
|
|
|
169
165
|
emojiId: emojiId,
|
|
170
166
|
fitToHeight: 16
|
|
171
167
|
})), /*#__PURE__*/React.createElement(Counter, {
|
|
172
|
-
className: counterStyle,
|
|
173
168
|
value: reaction.count,
|
|
174
169
|
highlight: reaction.reacted
|
|
175
170
|
}))));
|
|
@@ -180,7 +175,7 @@ class ReactionWithoutAnalytics extends PureComponent {
|
|
|
180
175
|
_defineProperty(ReactionWithoutAnalytics, "defaultProps", {
|
|
181
176
|
flash: false,
|
|
182
177
|
className: undefined,
|
|
183
|
-
|
|
178
|
+
onMouseEnter: undefined,
|
|
184
179
|
flashOnMount: false
|
|
185
180
|
});
|
|
186
181
|
|
|
@@ -60,7 +60,7 @@ export class ReactionsWithoutAnalytics extends React.PureComponent {
|
|
|
60
60
|
}
|
|
61
61
|
});
|
|
62
62
|
|
|
63
|
-
_defineProperty(this, "
|
|
63
|
+
_defineProperty(this, "handleReactionMouseEnter", reaction => {
|
|
64
64
|
if (this.props.onReactionHover) {
|
|
65
65
|
this.props.onReactionHover(reaction.emojiId);
|
|
66
66
|
}
|
|
@@ -95,7 +95,7 @@ export class ReactionsWithoutAnalytics extends React.PureComponent {
|
|
|
95
95
|
reaction: reaction,
|
|
96
96
|
emojiProvider: this.props.emojiProvider,
|
|
97
97
|
onClick: this.props.onReactionClick,
|
|
98
|
-
|
|
98
|
+
onMouseEnter: this.handleReactionMouseEnter,
|
|
99
99
|
flash: this.props.flash[reaction.emojiId]
|
|
100
100
|
}));
|
|
101
101
|
|
package/dist/es2019/version.json
CHANGED
|
@@ -1,29 +1,19 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
4
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
-
|
|
9
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
10
|
-
|
|
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
|
-
|
|
13
2
|
import { N90, B400 } from '@atlaskit/theme/colors';
|
|
14
3
|
import { token } from '@atlaskit/tokens';
|
|
15
4
|
import cx from 'classnames';
|
|
16
|
-
import React from 'react';
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import
|
|
20
|
-
var animationTime = 300;
|
|
5
|
+
import React, { memo } from 'react';
|
|
6
|
+
import { SlideIn, ExitingPersistence, mediumDurationMs } from '@atlaskit/motion';
|
|
7
|
+
import { style } from 'typestyle';
|
|
8
|
+
import usePreviousValue from '@atlaskit/ds-lib/use-previous-value';
|
|
21
9
|
export var countStyle = style({
|
|
22
|
-
fontSize:
|
|
10
|
+
fontSize: 11,
|
|
11
|
+
// TODO: nice to have a theme level token for fontSize
|
|
23
12
|
color: token('color.text.subtlest', N90),
|
|
24
13
|
overflow: 'hidden',
|
|
25
|
-
|
|
26
|
-
|
|
14
|
+
position: 'relative',
|
|
15
|
+
padding: '4px 8px 4px 0',
|
|
16
|
+
lineHeight: '14px'
|
|
27
17
|
});
|
|
28
18
|
export var highlightStyle = style({
|
|
29
19
|
color: token('color.text.brand', B400),
|
|
@@ -33,139 +23,55 @@ export var containerStyle = style({
|
|
|
33
23
|
display: 'flex',
|
|
34
24
|
flexDirection: 'column'
|
|
35
25
|
});
|
|
36
|
-
|
|
37
|
-
var
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
var _super = _createSuper(Counter);
|
|
61
|
-
|
|
62
|
-
function Counter(props) {
|
|
63
|
-
var _this;
|
|
64
|
-
|
|
65
|
-
_classCallCheck(this, Counter);
|
|
66
|
-
|
|
67
|
-
_this = _super.call(this, props);
|
|
68
|
-
|
|
69
|
-
_defineProperty(_assertThisInitialized(_this), "getLabel", function (value) {
|
|
70
|
-
var overLimitLabel = _this.props.overLimitLabel;
|
|
71
|
-
|
|
72
|
-
if (_this.hasReachedLimit(value)) {
|
|
73
|
-
return overLimitLabel || '';
|
|
74
|
-
} else if (value === 0) {
|
|
75
|
-
return '';
|
|
76
|
-
} else {
|
|
77
|
-
return value.toString();
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
_defineProperty(_assertThisInitialized(_this), "hasReachedLimit", function (value) {
|
|
82
|
-
return _this.props.limit && value >= _this.props.limit;
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
_defineProperty(_assertThisInitialized(_this), "renderPrevious", function () {
|
|
86
|
-
var previous = _this.state.previous;
|
|
87
|
-
|
|
88
|
-
if (previous !== undefined) {
|
|
89
|
-
var className = cx(_defineProperty({}, highlightStyle, previous.highlight));
|
|
90
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
91
|
-
key: previous.value,
|
|
92
|
-
className: className
|
|
93
|
-
}, _this.getLabel(previous.value));
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
return null;
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
_defineProperty(_assertThisInitialized(_this), "clearPrevious", function () {
|
|
100
|
-
_this.setState({
|
|
101
|
-
previous: undefined
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
_this.state = {
|
|
106
|
-
previous: undefined
|
|
107
|
-
};
|
|
108
|
-
return _this;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
_createClass(Counter, [{
|
|
112
|
-
key: "UNSAFE_componentWillReceiveProps",
|
|
113
|
-
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
114
|
-
var _this$props = this.props,
|
|
115
|
-
value = _this$props.value,
|
|
116
|
-
highlight = _this$props.highlight;
|
|
117
|
-
|
|
118
|
-
if (value !== undefined && value !== nextProps.value && (!this.hasReachedLimit(value) || !this.hasReachedLimit(nextProps.value))) {
|
|
119
|
-
this.setState({
|
|
120
|
-
previous: {
|
|
121
|
-
value: value,
|
|
122
|
-
highlight: highlight
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
}
|
|
26
|
+
export var Counter = /*#__PURE__*/memo(function (_ref) {
|
|
27
|
+
var _ref$highlight = _ref.highlight,
|
|
28
|
+
highlight = _ref$highlight === void 0 ? false : _ref$highlight,
|
|
29
|
+
_ref$limit = _ref.limit,
|
|
30
|
+
limit = _ref$limit === void 0 ? 100 : _ref$limit,
|
|
31
|
+
_ref$overLimitLabel = _ref.overLimitLabel,
|
|
32
|
+
overLimitLabel = _ref$overLimitLabel === void 0 ? '99+' : _ref$overLimitLabel,
|
|
33
|
+
className = _ref.className,
|
|
34
|
+
value = _ref.value,
|
|
35
|
+
_ref$animationDuratio = _ref.animationDuration,
|
|
36
|
+
animationDuration = _ref$animationDuratio === void 0 ? mediumDurationMs : _ref$animationDuratio;
|
|
37
|
+
|
|
38
|
+
var hasReachedLimit = function hasReachedLimit(value) {
|
|
39
|
+
return limit && value >= limit;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
var getLabel = function getLabel(value) {
|
|
43
|
+
if (hasReachedLimit(value)) {
|
|
44
|
+
return overLimitLabel || '';
|
|
45
|
+
} else if (value === 0) {
|
|
46
|
+
return '';
|
|
47
|
+
} else {
|
|
48
|
+
return value.toString();
|
|
126
49
|
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
var enterClass = increase ? slideUpStyle : decrease ? slideDownStyle : undefined;
|
|
139
|
-
var className = cx(countStyle, classNameProp);
|
|
140
|
-
var currentClassName = cx(_defineProperty({}, highlightStyle, highlight)); // WS-2525 With the pill UI updates, width of * 10 was too much so dropped down to * 7
|
|
141
|
-
|
|
142
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
143
|
-
className: className,
|
|
144
|
-
style: {
|
|
145
|
-
width: label.length * 7
|
|
146
|
-
}
|
|
147
|
-
}, /*#__PURE__*/React.createElement(CSSTransition, {
|
|
148
|
-
classNames: {
|
|
149
|
-
enter: enterClass
|
|
150
|
-
},
|
|
151
|
-
timeout: animationTime,
|
|
152
|
-
in: increase || decrease,
|
|
153
|
-
onEntered: this.clearPrevious
|
|
154
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
155
|
-
className: containerStyle
|
|
156
|
-
}, increase ? this.renderPrevious() : null, /*#__PURE__*/React.createElement("div", {
|
|
157
|
-
className: currentClassName,
|
|
158
|
-
key: value
|
|
159
|
-
}, label), decrease ? this.renderPrevious() : null)));
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
var previousValue = usePreviousValue(value);
|
|
53
|
+
var label = getLabel(value);
|
|
54
|
+
var increase = previousValue ? previousValue < value : false;
|
|
55
|
+
var rootClassName = cx(countStyle, className);
|
|
56
|
+
var currentClassName = cx(_defineProperty({}, highlightStyle, highlight));
|
|
57
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
58
|
+
className: rootClassName,
|
|
59
|
+
style: {
|
|
60
|
+
width: label.length * 7
|
|
160
61
|
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
62
|
+
}, /*#__PURE__*/React.createElement(ExitingPersistence, null, /*#__PURE__*/React.createElement(SlideIn, {
|
|
63
|
+
enterFrom: increase ? 'bottom' : 'top',
|
|
64
|
+
key: value,
|
|
65
|
+
duration: animationDuration
|
|
66
|
+
}, function (motion, direction) {
|
|
67
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
68
|
+
ref: motion.ref,
|
|
69
|
+
className: cx(containerStyle, motion.className, style({
|
|
70
|
+
position: direction === 'exiting' ? 'absolute' : undefined
|
|
71
|
+
}))
|
|
72
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
73
|
+
className: currentClassName,
|
|
74
|
+
key: value
|
|
75
|
+
}, label));
|
|
76
|
+
})));
|
|
171
77
|
});
|
|
@@ -73,10 +73,6 @@ var flashStyle = style({
|
|
|
73
73
|
borderRadius: '10px',
|
|
74
74
|
height: "".concat(flashHeight, "px")
|
|
75
75
|
});
|
|
76
|
-
var counterStyle = style({
|
|
77
|
-
padding: '4px 8px 4px 0',
|
|
78
|
-
lineHeight: '14px'
|
|
79
|
-
});
|
|
80
76
|
|
|
81
77
|
var ReactionWithoutAnalytics = /*#__PURE__*/function (_PureComponent) {
|
|
82
78
|
_inherits(ReactionWithoutAnalytics, _PureComponent);
|
|
@@ -107,18 +103,18 @@ var ReactionWithoutAnalytics = /*#__PURE__*/function (_PureComponent) {
|
|
|
107
103
|
}
|
|
108
104
|
});
|
|
109
105
|
|
|
110
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
106
|
+
_defineProperty(_assertThisInitialized(_this), "handleMouseEnter", function (event) {
|
|
111
107
|
event.preventDefault();
|
|
112
108
|
var _this$props2 = _this.props,
|
|
113
|
-
|
|
109
|
+
onMouseEnter = _this$props2.onMouseEnter,
|
|
114
110
|
reaction = _this$props2.reaction;
|
|
115
111
|
|
|
116
112
|
if (!reaction.users || !reaction.users.length) {
|
|
117
113
|
_this.hoverStart = Date.now();
|
|
118
114
|
}
|
|
119
115
|
|
|
120
|
-
if (
|
|
121
|
-
|
|
116
|
+
if (onMouseEnter) {
|
|
117
|
+
onMouseEnter(_this.props.reaction, event);
|
|
122
118
|
}
|
|
123
119
|
});
|
|
124
120
|
|
|
@@ -176,7 +172,7 @@ var ReactionWithoutAnalytics = /*#__PURE__*/function (_PureComponent) {
|
|
|
176
172
|
return /*#__PURE__*/React.createElement("button", {
|
|
177
173
|
className: classNames,
|
|
178
174
|
onMouseUp: this.handleMouseDown,
|
|
179
|
-
|
|
175
|
+
onMouseEnter: this.handleMouseEnter
|
|
180
176
|
}, /*#__PURE__*/React.createElement(ReactionTooltip, {
|
|
181
177
|
emojiName: emojiName,
|
|
182
178
|
reaction: reaction
|
|
@@ -190,7 +186,6 @@ var ReactionWithoutAnalytics = /*#__PURE__*/function (_PureComponent) {
|
|
|
190
186
|
emojiId: emojiId,
|
|
191
187
|
fitToHeight: 16
|
|
192
188
|
})), /*#__PURE__*/React.createElement(Counter, {
|
|
193
|
-
className: counterStyle,
|
|
194
189
|
value: reaction.count,
|
|
195
190
|
highlight: reaction.reacted
|
|
196
191
|
}))));
|
|
@@ -203,7 +198,7 @@ var ReactionWithoutAnalytics = /*#__PURE__*/function (_PureComponent) {
|
|
|
203
198
|
_defineProperty(ReactionWithoutAnalytics, "defaultProps", {
|
|
204
199
|
flash: false,
|
|
205
200
|
className: undefined,
|
|
206
|
-
|
|
201
|
+
onMouseEnter: undefined,
|
|
207
202
|
flashOnMount: false
|
|
208
203
|
});
|
|
209
204
|
|
|
@@ -80,7 +80,7 @@ export var ReactionsWithoutAnalytics = /*#__PURE__*/function (_React$PureCompone
|
|
|
80
80
|
}
|
|
81
81
|
});
|
|
82
82
|
|
|
83
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
83
|
+
_defineProperty(_assertThisInitialized(_this), "handleReactionMouseEnter", function (reaction) {
|
|
84
84
|
if (_this.props.onReactionHover) {
|
|
85
85
|
_this.props.onReactionHover(reaction.emojiId);
|
|
86
86
|
}
|
|
@@ -118,7 +118,7 @@ export var ReactionsWithoutAnalytics = /*#__PURE__*/function (_React$PureCompone
|
|
|
118
118
|
reaction: reaction,
|
|
119
119
|
emojiProvider: _this.props.emojiProvider,
|
|
120
120
|
onClick: _this.props.onReactionClick,
|
|
121
|
-
|
|
121
|
+
onMouseEnter: _this.handleReactionMouseEnter,
|
|
122
122
|
flash: _this.props.flash[reaction.emojiId]
|
|
123
123
|
});
|
|
124
124
|
});
|
package/dist/esm/version.json
CHANGED
|
@@ -2,33 +2,12 @@ import React from 'react';
|
|
|
2
2
|
export declare const countStyle: string;
|
|
3
3
|
export declare const highlightStyle: string;
|
|
4
4
|
export declare const containerStyle: string;
|
|
5
|
-
export declare const slideUpStyle: string;
|
|
6
|
-
export declare const slideDownStyle: string;
|
|
7
5
|
export declare type Props = {
|
|
8
6
|
value: number;
|
|
9
7
|
highlight?: boolean;
|
|
10
8
|
limit?: number;
|
|
11
9
|
overLimitLabel?: string;
|
|
12
10
|
className?: string;
|
|
11
|
+
animationDuration?: number;
|
|
13
12
|
};
|
|
14
|
-
export declare
|
|
15
|
-
previous?: {
|
|
16
|
-
value: number;
|
|
17
|
-
highlight?: boolean;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
export declare class Counter extends React.PureComponent<Props, State> {
|
|
21
|
-
static defaultProps: {
|
|
22
|
-
highlight: boolean;
|
|
23
|
-
limit: number;
|
|
24
|
-
overLimitLabel: string;
|
|
25
|
-
className: undefined;
|
|
26
|
-
};
|
|
27
|
-
constructor(props: Props);
|
|
28
|
-
UNSAFE_componentWillReceiveProps(nextProps: Props): void;
|
|
29
|
-
private getLabel;
|
|
30
|
-
private hasReachedLimit;
|
|
31
|
-
private renderPrevious;
|
|
32
|
-
private clearPrevious;
|
|
33
|
-
render(): JSX.Element;
|
|
34
|
-
}
|
|
13
|
+
export declare const Counter: React.FC<Props>;
|
|
@@ -11,15 +11,15 @@ export interface Props {
|
|
|
11
11
|
emojiProvider: Promise<EmojiProvider>;
|
|
12
12
|
onClick: ReactionOnClick;
|
|
13
13
|
className?: string;
|
|
14
|
-
|
|
14
|
+
onMouseEnter?: (reaction: ReactionSummary, event?: SyntheticEvent<any>) => void;
|
|
15
15
|
flash?: boolean;
|
|
16
16
|
}
|
|
17
17
|
export interface State {
|
|
18
18
|
emojiName?: string;
|
|
19
19
|
}
|
|
20
|
-
export declare const Reaction: React.ForwardRefExoticComponent<Pick<Pick<Props & WithAnalyticsEventsProps, "className" | "reaction" | "emojiProvider" | "onClick" | "
|
|
20
|
+
export declare const Reaction: React.ForwardRefExoticComponent<Pick<Pick<Props & WithAnalyticsEventsProps, "className" | "reaction" | "emojiProvider" | "onClick" | "onMouseEnter" | "flash">, "reaction" | "emojiProvider" | "onClick"> & Partial<Pick<Pick<Props & WithAnalyticsEventsProps, "className" | "reaction" | "emojiProvider" | "onClick" | "onMouseEnter" | "flash">, "className" | "onMouseEnter" | "flash">> & Partial<Pick<{
|
|
21
21
|
flash: boolean;
|
|
22
22
|
className: undefined;
|
|
23
|
-
|
|
23
|
+
onMouseEnter: undefined;
|
|
24
24
|
flashOnMount: boolean;
|
|
25
25
|
}, "flashOnMount">> & React.RefAttributes<any>>;
|
|
@@ -32,7 +32,7 @@ export declare class ReactionsWithoutAnalytics extends React.PureComponent<Props
|
|
|
32
32
|
componentDidUpdate: () => void;
|
|
33
33
|
private isDisabled;
|
|
34
34
|
private getTooltip;
|
|
35
|
-
private
|
|
35
|
+
private handleReactionMouseEnter;
|
|
36
36
|
private handlePickerOpen;
|
|
37
37
|
private handleOnCancel;
|
|
38
38
|
private handleOnMore;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/reactions",
|
|
3
|
-
"version": "21.0.
|
|
3
|
+
"version": "21.0.4",
|
|
4
4
|
"description": "Reactions component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -26,11 +26,13 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@atlaskit/analytics-gas-types": "^5.0.0",
|
|
29
|
-
"@atlaskit/analytics-namespaced-context": "^6.
|
|
29
|
+
"@atlaskit/analytics-namespaced-context": "^6.4.0",
|
|
30
30
|
"@atlaskit/analytics-next": "^8.2.0",
|
|
31
31
|
"@atlaskit/button": "^16.0.0",
|
|
32
|
+
"@atlaskit/ds-lib": "^1.4.0",
|
|
32
33
|
"@atlaskit/emoji": "^64.1.0",
|
|
33
34
|
"@atlaskit/icon": "^21.10.0",
|
|
35
|
+
"@atlaskit/motion": "^1.0.3",
|
|
34
36
|
"@atlaskit/popper": "^5.0.0",
|
|
35
37
|
"@atlaskit/theme": "^12.1.0",
|
|
36
38
|
"@atlaskit/tokens": "^0.6.0",
|
|
@@ -38,7 +40,6 @@
|
|
|
38
40
|
"@atlaskit/util-service-support": "^6.1.0",
|
|
39
41
|
"@babel/runtime": "^7.0.0",
|
|
40
42
|
"classnames": "^2.2.5",
|
|
41
|
-
"react-transition-group": "^4.4.1",
|
|
42
43
|
"typestyle": "^1.4.4"
|
|
43
44
|
},
|
|
44
45
|
"peerDependencies": {
|
|
@@ -49,7 +50,7 @@
|
|
|
49
50
|
"devDependencies": {
|
|
50
51
|
"@atlaskit/analytics-viewer": "^0.4.5",
|
|
51
52
|
"@atlaskit/docs": "^9.0.0",
|
|
52
|
-
"@atlaskit/editor-test-helpers": "^16.
|
|
53
|
+
"@atlaskit/editor-test-helpers": "^16.1.0",
|
|
53
54
|
"@atlaskit/elements-test-helpers": "^0.7.0",
|
|
54
55
|
"@atlaskit/tooltip": "^17.5.0",
|
|
55
56
|
"@atlaskit/util-data-test": "^17.2.0",
|