@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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @atlaskit/reactions
|
|
2
2
|
|
|
3
|
+
## 21.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`f0c986fe03a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f0c986fe03a) - Migrated styles to emotion and removed typestyle dependency from atlassian-frontend dependencies.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [`876cae9c606`](https://bitbucket.org/atlassian/atlassian-frontend/commits/876cae9c606) - Changed selector first-child to first-of-type to better support SSR
|
|
12
|
+
- [`62edf20ab1e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/62edf20ab1e) - Migrates all usage of brand tokens to either selected or information tokens. This change is purely for semantic reasons, there are no visual or behavioural changes.
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 21.0.5
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [`63f11b8ade4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/63f11b8ade4) - support proxy via webpack config cli
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
|
|
22
|
+
## 21.0.4
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- [`62a37c2a5c8`](https://bitbucket.org/atlassian/atlassian-frontend/commits/62a37c2a5c8) - replace `react-transition-group` with `@atlaskit/motion` and improve Counter component
|
|
27
|
+
- [`696ba6c465d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/696ba6c465d) - The Reaction component now fires only one request to the service when being hovered.
|
|
28
|
+
- [`95015909035`](https://bitbucket.org/atlassian/atlassian-frontend/commits/95015909035) - Fixed issue where some of the examples where crashing.
|
|
29
|
+
- Updated dependencies
|
|
30
|
+
|
|
3
31
|
## 21.0.3
|
|
4
32
|
|
|
5
33
|
### Patch Changes
|
package/README.md
ADDED
|
@@ -2,192 +2,103 @@
|
|
|
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.counterTestId = exports.countStyle = exports.containerStyle = exports.Counter = void 0;
|
|
21
11
|
|
|
22
|
-
var
|
|
12
|
+
var _core = require("@emotion/core");
|
|
23
13
|
|
|
24
14
|
var _colors = require("@atlaskit/theme/colors");
|
|
25
15
|
|
|
26
16
|
var _tokens = require("@atlaskit/tokens");
|
|
27
17
|
|
|
28
|
-
var
|
|
18
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
29
19
|
|
|
30
|
-
var
|
|
20
|
+
var _motion = require("@atlaskit/motion");
|
|
31
21
|
|
|
32
|
-
var
|
|
22
|
+
var _usePreviousValue = _interopRequireDefault(require("@atlaskit/ds-lib/use-previous-value"));
|
|
33
23
|
|
|
34
|
-
|
|
24
|
+
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); }
|
|
35
25
|
|
|
36
|
-
var
|
|
26
|
+
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; }
|
|
37
27
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
fontSize: '11px',
|
|
28
|
+
/** @jsx jsx */
|
|
29
|
+
var counterTestId = 'counter-container';
|
|
30
|
+
exports.counterTestId = counterTestId;
|
|
31
|
+
var countStyle = (0, _core.css)({
|
|
32
|
+
fontSize: 11,
|
|
33
|
+
// TODO: nice to have a theme level token for fontSize
|
|
45
34
|
color: (0, _tokens.token)('color.text.subtlest', _colors.N90),
|
|
46
35
|
overflow: 'hidden',
|
|
47
|
-
|
|
48
|
-
|
|
36
|
+
position: 'relative',
|
|
37
|
+
padding: '4px 8px 4px 0',
|
|
38
|
+
lineHeight: '14px'
|
|
49
39
|
});
|
|
50
40
|
exports.countStyle = countStyle;
|
|
51
|
-
var highlightStyle = (0,
|
|
52
|
-
color: (0, _tokens.token)('color.text.
|
|
41
|
+
var highlightStyle = (0, _core.css)({
|
|
42
|
+
color: (0, _tokens.token)('color.text.selected', _colors.B400),
|
|
53
43
|
fontWeight: 600
|
|
54
44
|
});
|
|
55
45
|
exports.highlightStyle = highlightStyle;
|
|
56
|
-
var containerStyle = (0,
|
|
46
|
+
var containerStyle = (0, _core.css)({
|
|
57
47
|
display: 'flex',
|
|
58
48
|
flexDirection: 'column'
|
|
59
49
|
});
|
|
60
50
|
exports.containerStyle = containerStyle;
|
|
61
|
-
|
|
62
|
-
var
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
51
|
+
var Counter = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
52
|
+
var _ref$highlight = _ref.highlight,
|
|
53
|
+
highlight = _ref$highlight === void 0 ? false : _ref$highlight,
|
|
54
|
+
_ref$limit = _ref.limit,
|
|
55
|
+
limit = _ref$limit === void 0 ? 100 : _ref$limit,
|
|
56
|
+
_ref$overLimitLabel = _ref.overLimitLabel,
|
|
57
|
+
overLimitLabel = _ref$overLimitLabel === void 0 ? '99+' : _ref$overLimitLabel,
|
|
58
|
+
className = _ref.className,
|
|
59
|
+
value = _ref.value,
|
|
60
|
+
_ref$animationDuratio = _ref.animationDuration,
|
|
61
|
+
animationDuration = _ref$animationDuratio === void 0 ? _motion.mediumDurationMs : _ref$animationDuratio;
|
|
62
|
+
|
|
63
|
+
var hasReachedLimit = function hasReachedLimit(value) {
|
|
64
|
+
return limit && value >= limit;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
var getLabel = function getLabel(value) {
|
|
68
|
+
if (hasReachedLimit(value)) {
|
|
69
|
+
return overLimitLabel || '';
|
|
70
|
+
} else if (value === 0) {
|
|
71
|
+
return '';
|
|
72
|
+
} else {
|
|
73
|
+
return value.toString();
|
|
69
74
|
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
var
|
|
75
|
-
return (0,
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
var slideUpStyle = counterAnimation(0, -50);
|
|
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
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}, {
|
|
150
|
-
key: "render",
|
|
151
|
-
value: function render() {
|
|
152
|
-
var _this$props2 = this.props,
|
|
153
|
-
value = _this$props2.value,
|
|
154
|
-
highlight = _this$props2.highlight,
|
|
155
|
-
classNameProp = _this$props2.className;
|
|
156
|
-
var previous = this.state.previous;
|
|
157
|
-
var label = this.getLabel(value);
|
|
158
|
-
var increase = previous !== undefined && previous.value < value;
|
|
159
|
-
var decrease = previous !== undefined && previous.value > value;
|
|
160
|
-
var enterClass = increase ? slideUpStyle : decrease ? slideDownStyle : undefined;
|
|
161
|
-
var className = (0, _classnames.default)(countStyle, classNameProp);
|
|
162
|
-
var currentClassName = (0, _classnames.default)((0, _defineProperty2.default)({}, highlightStyle, highlight)); // WS-2525 With the pill UI updates, width of * 10 was too much so dropped down to * 7
|
|
163
|
-
|
|
164
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
165
|
-
className: className,
|
|
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)));
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
var previousValue = (0, _usePreviousValue.default)(value);
|
|
78
|
+
var label = getLabel(value);
|
|
79
|
+
var increase = previousValue ? previousValue < value : false;
|
|
80
|
+
return (0, _core.jsx)("div", {
|
|
81
|
+
className: className,
|
|
82
|
+
css: countStyle,
|
|
83
|
+
style: {
|
|
84
|
+
width: label.length * 7
|
|
182
85
|
}
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
(0,
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
86
|
+
}, (0, _core.jsx)(_motion.ExitingPersistence, null, (0, _core.jsx)(_motion.SlideIn, {
|
|
87
|
+
enterFrom: increase ? 'bottom' : 'top',
|
|
88
|
+
key: value,
|
|
89
|
+
duration: animationDuration
|
|
90
|
+
}, function (motion, direction) {
|
|
91
|
+
return (0, _core.jsx)("div", {
|
|
92
|
+
ref: motion.ref,
|
|
93
|
+
css: [containerStyle, (0, _core.css)({
|
|
94
|
+
position: direction === 'exiting' ? 'absolute' : undefined
|
|
95
|
+
})],
|
|
96
|
+
className: motion.className,
|
|
97
|
+
"data-testid": counterTestId
|
|
98
|
+
}, (0, _core.jsx)("div", {
|
|
99
|
+
css: highlight && highlightStyle,
|
|
100
|
+
key: value
|
|
101
|
+
}, label));
|
|
102
|
+
})));
|
|
103
|
+
});
|
|
104
|
+
exports.Counter = Counter;
|
|
@@ -23,12 +23,12 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
23
23
|
|
|
24
24
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
25
25
|
|
|
26
|
+
var _core = require("@emotion/core");
|
|
27
|
+
|
|
26
28
|
var _element = require("@atlaskit/emoji/element");
|
|
27
29
|
|
|
28
30
|
var _react = _interopRequireWildcard(require("react"));
|
|
29
31
|
|
|
30
|
-
var _typestyle = require("typestyle");
|
|
31
|
-
|
|
32
32
|
var _utils = require("./utils");
|
|
33
33
|
|
|
34
34
|
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,7 +39,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
39
39
|
|
|
40
40
|
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; } }
|
|
41
41
|
|
|
42
|
-
var emojiButtonStyle = (0,
|
|
42
|
+
var emojiButtonStyle = (0, _core.css)({
|
|
43
43
|
outline: 'none',
|
|
44
44
|
display: 'flex',
|
|
45
45
|
backgroundColor: 'transparent',
|
|
@@ -48,11 +48,9 @@ var emojiButtonStyle = (0, _typestyle.style)({
|
|
|
48
48
|
cursor: 'pointer',
|
|
49
49
|
margin: '0',
|
|
50
50
|
padding: '10px 8px',
|
|
51
|
-
|
|
52
|
-
'
|
|
53
|
-
|
|
54
|
-
transform: 'scale(1.33)'
|
|
55
|
-
}
|
|
51
|
+
'&:hover > span': {
|
|
52
|
+
transition: 'transform cubic-bezier(0.23, 1, 0.32, 1) 200ms',
|
|
53
|
+
transform: 'scale(1.33)'
|
|
56
54
|
}
|
|
57
55
|
});
|
|
58
56
|
|
|
@@ -87,10 +85,10 @@ var EmojiButton = /*#__PURE__*/function (_PureComponent) {
|
|
|
87
85
|
var _this$props = this.props,
|
|
88
86
|
emojiId = _this$props.emojiId,
|
|
89
87
|
emojiProvider = _this$props.emojiProvider;
|
|
90
|
-
return
|
|
88
|
+
return (0, _core.jsx)("button", {
|
|
91
89
|
onMouseUp: this.handleMouseDown,
|
|
92
|
-
|
|
93
|
-
},
|
|
90
|
+
css: emojiButtonStyle
|
|
91
|
+
}, (0, _core.jsx)(_element.ResourcedEmoji, {
|
|
94
92
|
emojiProvider: emojiProvider,
|
|
95
93
|
emojiId: emojiId
|
|
96
94
|
}));
|
|
@@ -5,43 +5,43 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.flashStyle = exports.FlashAnimation = void 0;
|
|
8
|
+
exports.flashStyle = exports.flashAnimationTestId = exports.flashAnimation = exports.FlashAnimation = void 0;
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _core = require("@emotion/core");
|
|
11
11
|
|
|
12
12
|
var _colors = require("@atlaskit/theme/colors");
|
|
13
13
|
|
|
14
14
|
var _tokens = require("@atlaskit/tokens");
|
|
15
15
|
|
|
16
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
17
|
-
|
|
18
16
|
var _react = _interopRequireDefault(require("react"));
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
/** @jsx jsx */
|
|
19
|
+
var flashAnimationTestId = 'flash-animation';
|
|
20
|
+
exports.flashAnimationTestId = flashAnimationTestId;
|
|
21
|
+
var containerStyle = (0, _core.css)({
|
|
23
22
|
width: '100%',
|
|
24
23
|
height: '100%'
|
|
25
24
|
});
|
|
26
25
|
var flashTime = 700;
|
|
27
|
-
var flashAnimation = (0,
|
|
26
|
+
var flashAnimation = (0, _core.keyframes)({
|
|
28
27
|
'0%': {
|
|
29
28
|
backgroundColor: 'transparent'
|
|
30
29
|
},
|
|
31
30
|
'20%': {
|
|
32
|
-
backgroundColor: (0, _tokens.token)('color.background.
|
|
33
|
-
borderColor: (0, _tokens.token)('color.
|
|
31
|
+
backgroundColor: (0, _tokens.token)('color.background.selected.pressed', _colors.B75),
|
|
32
|
+
borderColor: (0, _tokens.token)('color.border.selected', _colors.B300)
|
|
34
33
|
},
|
|
35
34
|
'75%': {
|
|
36
|
-
backgroundColor: (0, _tokens.token)('color.background.
|
|
37
|
-
borderColor: (0, _tokens.token)('color.
|
|
35
|
+
backgroundColor: (0, _tokens.token)('color.background.selected.pressed', _colors.B75),
|
|
36
|
+
borderColor: (0, _tokens.token)('color.border.selected', _colors.B300)
|
|
38
37
|
},
|
|
39
38
|
'100%': {
|
|
40
|
-
backgroundColor: (0, _tokens.token)('color.background.
|
|
41
|
-
borderColor: (0, _tokens.token)('color.
|
|
39
|
+
backgroundColor: (0, _tokens.token)('color.background.selected.pressed', _colors.B75),
|
|
40
|
+
borderColor: (0, _tokens.token)('color.border.selected', _colors.B300)
|
|
42
41
|
}
|
|
43
42
|
});
|
|
44
|
-
|
|
43
|
+
exports.flashAnimation = flashAnimation;
|
|
44
|
+
var flashStyle = (0, _core.css)({
|
|
45
45
|
animation: "".concat(flashAnimation, " ").concat(flashTime, "ms ease-in-out")
|
|
46
46
|
});
|
|
47
47
|
/**
|
|
@@ -51,8 +51,10 @@ var flashStyle = (0, _typestyle.style)({
|
|
|
51
51
|
exports.flashStyle = flashStyle;
|
|
52
52
|
|
|
53
53
|
var FlashAnimation = function FlashAnimation(props) {
|
|
54
|
-
return
|
|
55
|
-
className:
|
|
54
|
+
return (0, _core.jsx)("div", {
|
|
55
|
+
className: props.className,
|
|
56
|
+
css: [containerStyle, props.flash && flashStyle],
|
|
57
|
+
"data-testid": flashAnimationTestId
|
|
56
58
|
}, props.children);
|
|
57
59
|
};
|
|
58
60
|
|
|
@@ -23,6 +23,8 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
23
23
|
|
|
24
24
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
25
25
|
|
|
26
|
+
var _core = require("@emotion/core");
|
|
27
|
+
|
|
26
28
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
27
29
|
|
|
28
30
|
var _element = require("@atlaskit/emoji/element");
|
|
@@ -31,12 +33,8 @@ var _colors = require("@atlaskit/theme/colors");
|
|
|
31
33
|
|
|
32
34
|
var _tokens = require("@atlaskit/tokens");
|
|
33
35
|
|
|
34
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
35
|
-
|
|
36
36
|
var _react = _interopRequireWildcard(require("react"));
|
|
37
37
|
|
|
38
|
-
var _typestyle = require("typestyle");
|
|
39
|
-
|
|
40
38
|
var _analytics = require("../analytics");
|
|
41
39
|
|
|
42
40
|
var _Counter = require("./Counter");
|
|
@@ -60,12 +58,12 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
60
58
|
* Padding and line height are set within the child components
|
|
61
59
|
* of FlashAnimation b/c it otherwise throws off the flash styling
|
|
62
60
|
*/
|
|
63
|
-
var emojiStyle = (0,
|
|
61
|
+
var emojiStyle = (0, _core.css)({
|
|
64
62
|
transformOrigin: 'center center 0',
|
|
65
63
|
lineHeight: '12px',
|
|
66
64
|
padding: '4px 4px 4px 8px'
|
|
67
65
|
});
|
|
68
|
-
var reactionStyle = (0,
|
|
66
|
+
var reactionStyle = (0, _core.css)({
|
|
69
67
|
outline: 'none',
|
|
70
68
|
display: 'flex',
|
|
71
69
|
flexDirection: 'row',
|
|
@@ -81,33 +79,25 @@ var reactionStyle = (0, _typestyle.style)({
|
|
|
81
79
|
margin: 0,
|
|
82
80
|
padding: 0,
|
|
83
81
|
transition: '200ms ease-in-out',
|
|
84
|
-
|
|
85
|
-
'
|
|
86
|
-
background: "".concat((0, _tokens.token)('color.background.neutral.subtle.hovered', _colors.N20))
|
|
87
|
-
}
|
|
82
|
+
'&:hover': {
|
|
83
|
+
background: "".concat((0, _tokens.token)('color.background.neutral.subtle.hovered', _colors.N20))
|
|
88
84
|
}
|
|
89
85
|
});
|
|
90
|
-
var reactedStyle = (0,
|
|
91
|
-
backgroundColor: (0, _tokens.token)('color.background.
|
|
92
|
-
borderColor: (0, _tokens.token)('color.
|
|
93
|
-
|
|
94
|
-
'
|
|
95
|
-
background: "".concat((0, _tokens.token)('color.background.brand.hovered', _colors.B75))
|
|
96
|
-
}
|
|
86
|
+
var reactedStyle = (0, _core.css)({
|
|
87
|
+
backgroundColor: (0, _tokens.token)('color.background.selected', _colors.B50),
|
|
88
|
+
borderColor: (0, _tokens.token)('color.border.selected', _colors.B300),
|
|
89
|
+
'&:hover': {
|
|
90
|
+
background: "".concat((0, _tokens.token)('color.background.selected.hovered', _colors.B75))
|
|
97
91
|
}
|
|
98
92
|
});
|
|
99
93
|
var flashHeight = _utils.akHeight - 2; // height without the 1px border
|
|
100
94
|
|
|
101
|
-
var flashStyle = (0,
|
|
95
|
+
var flashStyle = (0, _core.css)({
|
|
102
96
|
display: 'flex',
|
|
103
97
|
flexDirection: 'row',
|
|
104
98
|
borderRadius: '10px',
|
|
105
99
|
height: "".concat(flashHeight, "px")
|
|
106
100
|
});
|
|
107
|
-
var counterStyle = (0, _typestyle.style)({
|
|
108
|
-
padding: '4px 8px 4px 0',
|
|
109
|
-
lineHeight: '14px'
|
|
110
|
-
});
|
|
111
101
|
|
|
112
102
|
var ReactionWithoutAnalytics = /*#__PURE__*/function (_PureComponent) {
|
|
113
103
|
(0, _inherits2.default)(ReactionWithoutAnalytics, _PureComponent);
|
|
@@ -134,18 +124,18 @@ var ReactionWithoutAnalytics = /*#__PURE__*/function (_PureComponent) {
|
|
|
134
124
|
_this.props.onClick(_this.props.reaction.emojiId, event);
|
|
135
125
|
}
|
|
136
126
|
});
|
|
137
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "
|
|
127
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleMouseEnter", function (event) {
|
|
138
128
|
event.preventDefault();
|
|
139
129
|
var _this$props2 = _this.props,
|
|
140
|
-
|
|
130
|
+
onMouseEnter = _this$props2.onMouseEnter,
|
|
141
131
|
reaction = _this$props2.reaction;
|
|
142
132
|
|
|
143
133
|
if (!reaction.users || !reaction.users.length) {
|
|
144
134
|
_this.hoverStart = Date.now();
|
|
145
135
|
}
|
|
146
136
|
|
|
147
|
-
if (
|
|
148
|
-
|
|
137
|
+
if (onMouseEnter) {
|
|
138
|
+
onMouseEnter(_this.props.reaction, event);
|
|
149
139
|
}
|
|
150
140
|
});
|
|
151
141
|
_this.state = {};
|
|
@@ -194,29 +184,28 @@ var ReactionWithoutAnalytics = /*#__PURE__*/function (_PureComponent) {
|
|
|
194
184
|
classNameProp = _this$props3.className,
|
|
195
185
|
flash = _this$props3.flash;
|
|
196
186
|
var emojiName = this.state.emojiName;
|
|
197
|
-
var classNames = (0, _classnames.default)(reactionStyle, classNameProp, (0, _defineProperty2.default)({}, reactedStyle, reaction.reacted));
|
|
198
187
|
var emojiId = {
|
|
199
188
|
id: reaction.emojiId,
|
|
200
189
|
shortName: ''
|
|
201
190
|
};
|
|
202
|
-
return
|
|
203
|
-
className:
|
|
191
|
+
return (0, _core.jsx)("button", {
|
|
192
|
+
className: classNameProp,
|
|
193
|
+
css: [reactionStyle, reaction.reacted && reactedStyle],
|
|
204
194
|
onMouseUp: this.handleMouseDown,
|
|
205
|
-
|
|
206
|
-
},
|
|
195
|
+
onMouseEnter: this.handleMouseEnter
|
|
196
|
+
}, (0, _core.jsx)(_ReactionTooltip.ReactionTooltip, {
|
|
207
197
|
emojiName: emojiName,
|
|
208
198
|
reaction: reaction
|
|
209
|
-
},
|
|
199
|
+
}, (0, _core.jsx)(_FlashAnimation.FlashAnimation, {
|
|
210
200
|
flash: flash,
|
|
211
|
-
|
|
212
|
-
},
|
|
213
|
-
|
|
214
|
-
},
|
|
201
|
+
css: flashStyle
|
|
202
|
+
}, (0, _core.jsx)("div", {
|
|
203
|
+
css: emojiStyle
|
|
204
|
+
}, (0, _core.jsx)(_element.ResourcedEmoji, {
|
|
215
205
|
emojiProvider: emojiProvider,
|
|
216
206
|
emojiId: emojiId,
|
|
217
207
|
fitToHeight: 16
|
|
218
|
-
})),
|
|
219
|
-
className: counterStyle,
|
|
208
|
+
})), (0, _core.jsx)(_Counter.Counter, {
|
|
220
209
|
value: reaction.count,
|
|
221
210
|
highlight: reaction.reacted
|
|
222
211
|
}))));
|
|
@@ -228,7 +217,7 @@ var ReactionWithoutAnalytics = /*#__PURE__*/function (_PureComponent) {
|
|
|
228
217
|
(0, _defineProperty2.default)(ReactionWithoutAnalytics, "defaultProps", {
|
|
229
218
|
flash: false,
|
|
230
219
|
className: undefined,
|
|
231
|
-
|
|
220
|
+
onMouseEnter: undefined,
|
|
232
221
|
flashOnMount: false
|
|
233
222
|
});
|
|
234
223
|
(0, _defineProperty2.default)(ReactionWithoutAnalytics, "displayName", 'Reaction');
|