@atlaskit/reactions 25.5.0 → 25.6.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 +18 -0
- package/dist/cjs/analytics/index.js +1 -1
- package/dist/cjs/components/Reaction/Reaction.js +28 -13
- package/dist/cjs/components/Reaction/ReactionButton.js +3 -2
- package/dist/cjs/components/Reaction/StaticReaction.js +51 -0
- package/dist/cjs/components/ReactionDialog/ReactionsDialogHeader.js +2 -2
- package/dist/cjs/components/ReactionSummary/ReactionSummaryView.js +5 -2
- package/dist/cjs/components/ReactionTooltip/ReactionTooltip.js +3 -1
- package/dist/cjs/components/Reactions/Reactions.js +4 -2
- package/dist/es2019/analytics/index.js +1 -1
- package/dist/es2019/components/Reaction/Reaction.js +28 -14
- package/dist/es2019/components/Reaction/ReactionButton.js +4 -2
- package/dist/es2019/components/Reaction/StaticReaction.js +43 -0
- package/dist/es2019/components/ReactionDialog/ReactionsDialogHeader.js +2 -2
- package/dist/es2019/components/ReactionSummary/ReactionSummaryView.js +4 -2
- package/dist/es2019/components/ReactionTooltip/ReactionTooltip.js +3 -1
- package/dist/es2019/components/Reactions/Reactions.js +4 -2
- package/dist/esm/analytics/index.js +1 -1
- package/dist/esm/components/Reaction/Reaction.js +29 -14
- package/dist/esm/components/Reaction/ReactionButton.js +4 -2
- package/dist/esm/components/Reaction/StaticReaction.js +43 -0
- package/dist/esm/components/ReactionDialog/ReactionsDialogHeader.js +2 -2
- package/dist/esm/components/ReactionSummary/ReactionSummaryView.js +5 -2
- package/dist/esm/components/ReactionTooltip/ReactionTooltip.js +3 -1
- package/dist/esm/components/Reactions/Reactions.js +4 -2
- package/dist/types/components/Reaction/Reaction.d.ts +5 -1
- package/dist/types/components/Reaction/StaticReaction.d.ts +17 -0
- package/dist/types/components/ReactionSummary/ReactionSummaryView.d.ts +5 -1
- package/dist/types/components/ReactionTooltip/ReactionTooltip.d.ts +5 -1
- package/dist/types-ts4.5/components/Reaction/Reaction.d.ts +5 -1
- package/dist/types-ts4.5/components/Reaction/StaticReaction.d.ts +17 -0
- package/dist/types-ts4.5/components/ReactionSummary/ReactionSummaryView.d.ts +5 -1
- package/dist/types-ts4.5/components/ReactionTooltip/ReactionTooltip.d.ts +5 -1
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/reactions
|
|
2
2
|
|
|
3
|
+
## 25.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#115993](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/115993)
|
|
8
|
+
[`b41f57ae81daf`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b41f57ae81daf) -
|
|
9
|
+
[ux] Makes reactions behind the isViewOnly prop view-only in the tray, not allowing further
|
|
10
|
+
reactions and applies view only styles
|
|
11
|
+
- [#116057](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/116057)
|
|
12
|
+
[`4eaacc70b49dd`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4eaacc70b49dd) -
|
|
13
|
+
[ux] Close tooltip after Reaction Dialog is opened and fix outdated tests
|
|
14
|
+
|
|
15
|
+
## 25.5.1
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 25.5.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
|
@@ -11,7 +11,7 @@ var _analyticsGasTypes = require("@atlaskit/analytics-gas-types");
|
|
|
11
11
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
12
12
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
13
13
|
var packageName = "@atlaskit/reactions";
|
|
14
|
-
var packageVersion = "25.
|
|
14
|
+
var packageVersion = "25.6.0";
|
|
15
15
|
/**
|
|
16
16
|
* TODO: move to utility package?
|
|
17
17
|
* A random sampling function
|
|
@@ -23,6 +23,7 @@ var _i18n = require("../../shared/i18n");
|
|
|
23
23
|
var _utils = require("../../shared/utils");
|
|
24
24
|
var _styles = require("./styles");
|
|
25
25
|
var _ReactionButton = require("./ReactionButton");
|
|
26
|
+
var _StaticReaction = require("./StaticReaction");
|
|
26
27
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
27
28
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
28
29
|
/**
|
|
@@ -77,7 +78,9 @@ var Reaction = exports.Reaction = function Reaction(_ref) {
|
|
|
77
78
|
_ref$showOpaqueBackgr = _ref.showOpaqueBackground,
|
|
78
79
|
showOpaqueBackground = _ref$showOpaqueBackgr === void 0 ? false : _ref$showOpaqueBackgr,
|
|
79
80
|
allowUserDialog = _ref.allowUserDialog,
|
|
80
|
-
handleOpenReactionsDialog = _ref.handleOpenReactionsDialog
|
|
81
|
+
handleOpenReactionsDialog = _ref.handleOpenReactionsDialog,
|
|
82
|
+
_ref$isViewOnly = _ref.isViewOnly,
|
|
83
|
+
isViewOnly = _ref$isViewOnly === void 0 ? false : _ref$isViewOnly;
|
|
81
84
|
var intl = (0, _reactIntlNext.useIntl)();
|
|
82
85
|
var hoverStart = (0, _react.useRef)();
|
|
83
86
|
var focusStart = (0, _react.useRef)();
|
|
@@ -150,7 +153,20 @@ var Reaction = exports.Reaction = function Reaction(_ref) {
|
|
|
150
153
|
(0, _analytics.createAndFireSafe)(createAnalyticsEvent, _analytics.createReactionFocusedEvent, hoverStart.current);
|
|
151
154
|
onFocused(reaction.emojiId, event);
|
|
152
155
|
}, [createAnalyticsEvent, reaction, onFocused]);
|
|
156
|
+
var dismissTooltip = function dismissTooltip() {
|
|
157
|
+
setIsTooltipEnabled(false);
|
|
158
|
+
};
|
|
153
159
|
var buttonStyles = showOpaqueBackground ? [opaqueBackgroundStyles] : [];
|
|
160
|
+
var emojiAndCount = (0, _react2.jsx)(_primitives.Inline, null, (0, _react2.jsx)("div", {
|
|
161
|
+
css: [_styles.emojiStyle, reaction.count === 0 && _styles.emojiNoReactionStyle]
|
|
162
|
+
}, (0, _react2.jsx)(_emoji.ResourcedEmoji, {
|
|
163
|
+
emojiProvider: emojiProvider,
|
|
164
|
+
emojiId: emojiId,
|
|
165
|
+
fitToHeight: 16
|
|
166
|
+
})), (0, _react2.jsx)(_Counter.Counter, {
|
|
167
|
+
value: reaction.count,
|
|
168
|
+
highlight: !isViewOnly && reaction.reacted
|
|
169
|
+
}));
|
|
154
170
|
return (0, _react2.jsx)(_primitives.Box, {
|
|
155
171
|
xcss: containerStyles
|
|
156
172
|
}, showParticleEffect && (0, _react2.jsx)(_ReactionParticleEffect.ReactionParticleEffect, {
|
|
@@ -161,8 +177,16 @@ var Reaction = exports.Reaction = function Reaction(_ref) {
|
|
|
161
177
|
reaction: reaction,
|
|
162
178
|
isEnabled: isTooltipEnabled,
|
|
163
179
|
allowUserDialog: allowUserDialog,
|
|
164
|
-
handleOpenReactionsDialog: handleOpenReactionsDialog
|
|
165
|
-
|
|
180
|
+
handleOpenReactionsDialog: handleOpenReactionsDialog,
|
|
181
|
+
dismissTooltip: dismissTooltip
|
|
182
|
+
}, isViewOnly ? (0, _react2.jsx)(_StaticReaction.StaticReaction, {
|
|
183
|
+
onMouseEnter: handleMouseEnter,
|
|
184
|
+
onFocus: handleFocused,
|
|
185
|
+
testId: RENDER_REACTION_TESTID,
|
|
186
|
+
dataAttributes: {
|
|
187
|
+
'data-emoji-id': reaction.emojiId
|
|
188
|
+
}
|
|
189
|
+
}, emojiAndCount) : (0, _react2.jsx)(_ReactionButton.ReactionButton, {
|
|
166
190
|
onClick: handleClick,
|
|
167
191
|
flash: flash,
|
|
168
192
|
additionalStyles: reaction.reacted ? [reactedStyles] : buttonStyles,
|
|
@@ -177,14 +201,5 @@ var Reaction = exports.Reaction = function Reaction(_ref) {
|
|
|
177
201
|
'data-emoji-id': reaction.emojiId,
|
|
178
202
|
'data-emoji-button-id': reaction.emojiId
|
|
179
203
|
}
|
|
180
|
-
},
|
|
181
|
-
css: [_styles.emojiStyle, reaction.count === 0 && _styles.emojiNoReactionStyle]
|
|
182
|
-
}, (0, _react2.jsx)(_emoji.ResourcedEmoji, {
|
|
183
|
-
emojiProvider: emojiProvider,
|
|
184
|
-
emojiId: emojiId,
|
|
185
|
-
fitToHeight: 16
|
|
186
|
-
})), (0, _react2.jsx)(_Counter.Counter, {
|
|
187
|
-
value: reaction.count,
|
|
188
|
-
highlight: reaction.reacted
|
|
189
|
-
}))));
|
|
204
|
+
}, emojiAndCount)));
|
|
190
205
|
};
|
|
@@ -22,7 +22,8 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
|
22
22
|
|
|
23
23
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
// please sync reaction styles that are not button-specific with StaticReaction.tsx
|
|
26
|
+
var reactionButtonStyles = (0, _primitives.xcss)({
|
|
26
27
|
display: 'flex',
|
|
27
28
|
flexDirection: 'row',
|
|
28
29
|
alignItems: 'flex-start',
|
|
@@ -69,7 +70,7 @@ var ReactionButton = exports.ReactionButton = function ReactionButton(_ref) {
|
|
|
69
70
|
"aria-label": ariaLabel,
|
|
70
71
|
"aria-pressed": ariaPressed,
|
|
71
72
|
testId: testId,
|
|
72
|
-
xcss: [
|
|
73
|
+
xcss: [reactionButtonStyles].concat((0, _toConsumableArray2.default)(additionalStyles), [
|
|
73
74
|
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
74
75
|
(0, _platformFeatureFlags.fg)('platform-component-visual-refresh') && reactionStylesRefresh])
|
|
75
76
|
}, dataAttributes), (0, _react2.jsx)(_FlashAnimation.FlashAnimation, {
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.StaticReaction = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _primitives = require("@atlaskit/primitives");
|
|
11
|
+
var _react2 = require("@emotion/react");
|
|
12
|
+
/**
|
|
13
|
+
* @jsxRuntime classic
|
|
14
|
+
* @jsx jsx
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
18
|
+
|
|
19
|
+
// please sync reaction styles that are not button-specific with ReactionButton.tsx
|
|
20
|
+
var staticReactionStyles = (0, _primitives.xcss)({
|
|
21
|
+
display: 'flex',
|
|
22
|
+
flexDirection: 'row',
|
|
23
|
+
alignItems: 'flex-start',
|
|
24
|
+
minWidth: '36px',
|
|
25
|
+
height: '24px',
|
|
26
|
+
backgroundColor: 'color.background.neutral.subtle',
|
|
27
|
+
color: 'color.text.subtle',
|
|
28
|
+
marginBlockStart: 'space.050',
|
|
29
|
+
marginInlineEnd: 'space.050',
|
|
30
|
+
padding: 'space.0',
|
|
31
|
+
overflow: 'hidden',
|
|
32
|
+
border: 'none',
|
|
33
|
+
':hover': {
|
|
34
|
+
backgroundColor: 'color.background.neutral.subtle.hovered',
|
|
35
|
+
cursor: 'default'
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
var StaticReaction = exports.StaticReaction = function StaticReaction(_ref) {
|
|
39
|
+
var onMouseEnter = _ref.onMouseEnter,
|
|
40
|
+
onFocus = _ref.onFocus,
|
|
41
|
+
children = _ref.children,
|
|
42
|
+
testId = _ref.testId,
|
|
43
|
+
_ref$dataAttributes = _ref.dataAttributes,
|
|
44
|
+
dataAttributes = _ref$dataAttributes === void 0 ? {} : _ref$dataAttributes;
|
|
45
|
+
return (0, _react2.jsx)(_primitives.Box, (0, _extends2.default)({
|
|
46
|
+
onMouseEnter: onMouseEnter,
|
|
47
|
+
onFocus: onFocus,
|
|
48
|
+
testId: testId,
|
|
49
|
+
xcss: staticReactionStyles
|
|
50
|
+
}, dataAttributes), children);
|
|
51
|
+
};
|
|
@@ -185,7 +185,7 @@ var ReactionsDialogHeader = exports.ReactionsDialogHeader = function ReactionsDi
|
|
|
185
185
|
var isSinglePage = maxPages === 1;
|
|
186
186
|
var isOnFirstPage = currentPage === 1;
|
|
187
187
|
var isOnLastPage = currentPage === maxPages;
|
|
188
|
-
var
|
|
188
|
+
var handleMouseEnter = function handleMouseEnter(reaction) {
|
|
189
189
|
var emojiId = reaction.emojiId;
|
|
190
190
|
if (!emojiId || cache[emojiId]) {
|
|
191
191
|
return;
|
|
@@ -255,7 +255,7 @@ var ReactionsDialogHeader = exports.ReactionsDialogHeader = function ReactionsDi
|
|
|
255
255
|
key: reaction.emojiId,
|
|
256
256
|
"data-testid": emojiId === null || emojiId === void 0 ? void 0 : emojiId.id,
|
|
257
257
|
onMouseEnter: function onMouseEnter() {
|
|
258
|
-
|
|
258
|
+
handleMouseEnter(reaction);
|
|
259
259
|
}
|
|
260
260
|
}, (0, _react2.jsx)(_tabs.Tab, null, (0, _react2.jsx)(_tooltip.default, {
|
|
261
261
|
content: cache[reaction.emojiId],
|
|
@@ -43,7 +43,9 @@ var ReactionSummaryView = exports.ReactionSummaryView = function ReactionSummary
|
|
|
43
43
|
_ref$subtleReactionsS = _ref.subtleReactionsSummaryAndPicker,
|
|
44
44
|
subtleReactionsSummaryAndPicker = _ref$subtleReactionsS === void 0 ? false : _ref$subtleReactionsS,
|
|
45
45
|
allowUserDialog = _ref.allowUserDialog,
|
|
46
|
-
handleOpenReactionsDialog = _ref.handleOpenReactionsDialog
|
|
46
|
+
handleOpenReactionsDialog = _ref.handleOpenReactionsDialog,
|
|
47
|
+
_ref$isViewOnly = _ref.isViewOnly,
|
|
48
|
+
isViewOnly = _ref$isViewOnly === void 0 ? false : _ref$isViewOnly;
|
|
47
49
|
var _useState = (0, _react.useState)(false),
|
|
48
50
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
49
51
|
isSummaryPopupOpen = _useState2[0],
|
|
@@ -74,7 +76,8 @@ var ReactionSummaryView = exports.ReactionSummaryView = function ReactionSummary
|
|
|
74
76
|
flash: flash[reaction.emojiId],
|
|
75
77
|
showParticleEffect: particleEffectByEmoji[reaction.emojiId],
|
|
76
78
|
allowUserDialog: allowUserDialog,
|
|
77
|
-
handleOpenReactionsDialog: handleOpenReactionsDialog
|
|
79
|
+
handleOpenReactionsDialog: handleOpenReactionsDialog,
|
|
80
|
+
isViewOnly: isViewOnly
|
|
78
81
|
});
|
|
79
82
|
}));
|
|
80
83
|
},
|
|
@@ -34,7 +34,8 @@ var ReactionTooltip = exports.ReactionTooltip = function ReactionTooltip(_ref) {
|
|
|
34
34
|
_ref$isEnabled = _ref.isEnabled,
|
|
35
35
|
isEnabled = _ref$isEnabled === void 0 ? true : _ref$isEnabled,
|
|
36
36
|
allowUserDialog = _ref.allowUserDialog,
|
|
37
|
-
handleOpenReactionsDialog = _ref.handleOpenReactionsDialog
|
|
37
|
+
handleOpenReactionsDialog = _ref.handleOpenReactionsDialog,
|
|
38
|
+
dismissTooltip = _ref.dismissTooltip;
|
|
38
39
|
var content = !users || users.length === 0 || !isEnabled ? null :
|
|
39
40
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values, jsx-a11y/no-noninteractive-tabindex -- Ignored via go/DSP-18766
|
|
40
41
|
(0, _react2.jsx)("div", {
|
|
@@ -51,6 +52,7 @@ var ReactionTooltip = exports.ReactionTooltip = function ReactionTooltip(_ref) {
|
|
|
51
52
|
css: allowUserDialog ? [_styles.footerStyle, _styles.underlineStyle] : _styles.footerStyle,
|
|
52
53
|
onClick: function onClick() {
|
|
53
54
|
if (allowUserDialog && handleOpenReactionsDialog) {
|
|
55
|
+
dismissTooltip();
|
|
54
56
|
handleOpenReactionsDialog();
|
|
55
57
|
}
|
|
56
58
|
}
|
|
@@ -322,7 +322,8 @@ var Reactions = exports.Reactions = /*#__PURE__*/_react.default.memo(function (_
|
|
|
322
322
|
showOpaqueBackground: showOpaqueBackground,
|
|
323
323
|
subtleReactionsSummaryAndPicker: subtleReactionsSummaryAndPicker,
|
|
324
324
|
handleOpenReactionsDialog: handleOpenReactionsDialog,
|
|
325
|
-
allowUserDialog: allowUserDialog && hasEmojiWithFivePlusReactions
|
|
325
|
+
allowUserDialog: allowUserDialog && hasEmojiWithFivePlusReactions,
|
|
326
|
+
isViewOnly: isViewOnly
|
|
326
327
|
})) : memorizedReactions.map(function (reaction) {
|
|
327
328
|
return (0, _react2.jsx)(_Reaction.Reaction, {
|
|
328
329
|
key: reaction.emojiId,
|
|
@@ -335,7 +336,8 @@ var Reactions = exports.Reactions = /*#__PURE__*/_react.default.memo(function (_
|
|
|
335
336
|
showParticleEffect: particleEffectByEmoji[reaction.emojiId],
|
|
336
337
|
showOpaqueBackground: showOpaqueBackground,
|
|
337
338
|
allowUserDialog: allowUserDialog && hasEmojiWithFivePlusReactions,
|
|
338
|
-
handleOpenReactionsDialog: handleOpenReactionsDialog
|
|
339
|
+
handleOpenReactionsDialog: handleOpenReactionsDialog,
|
|
340
|
+
isViewOnly: isViewOnly
|
|
339
341
|
});
|
|
340
342
|
})), !isViewOnly && (0, _react2.jsx)(_ReactionPicker.ReactionPicker
|
|
341
343
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createAndFireEvent } from '@atlaskit/analytics-next';
|
|
2
2
|
import { UI_EVENT_TYPE, OPERATIONAL_EVENT_TYPE } from '@atlaskit/analytics-gas-types';
|
|
3
3
|
const packageName = "@atlaskit/reactions";
|
|
4
|
-
const packageVersion = "25.
|
|
4
|
+
const packageVersion = "25.6.0";
|
|
5
5
|
/**
|
|
6
6
|
* TODO: move to utility package?
|
|
7
7
|
* A random sampling function
|
|
@@ -8,7 +8,7 @@ import { useIntl } from 'react-intl-next';
|
|
|
8
8
|
import { jsx } from '@emotion/react';
|
|
9
9
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
10
10
|
import { ResourcedEmoji } from '@atlaskit/emoji';
|
|
11
|
-
import { Box, xcss } from '@atlaskit/primitives';
|
|
11
|
+
import { Box, Inline, xcss } from '@atlaskit/primitives';
|
|
12
12
|
import { createAndFireSafe, createReactionClickedEvent, createReactionFocusedEvent, createReactionHoveredEvent } from '../../analytics';
|
|
13
13
|
import { Counter } from '../Counter';
|
|
14
14
|
import { ReactionParticleEffect } from '../ReactionParticleEffect';
|
|
@@ -17,6 +17,7 @@ import { messages } from '../../shared/i18n';
|
|
|
17
17
|
import { isLeftClick } from '../../shared/utils';
|
|
18
18
|
import { emojiStyle, emojiNoReactionStyle } from './styles';
|
|
19
19
|
import { ReactionButton } from './ReactionButton';
|
|
20
|
+
import { StaticReaction } from './StaticReaction';
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
23
|
* Test id for Reaction item wrapper div
|
|
@@ -58,7 +59,8 @@ export const Reaction = ({
|
|
|
58
59
|
showParticleEffect = false,
|
|
59
60
|
showOpaqueBackground = false,
|
|
60
61
|
allowUserDialog,
|
|
61
|
-
handleOpenReactionsDialog
|
|
62
|
+
handleOpenReactionsDialog,
|
|
63
|
+
isViewOnly = false
|
|
62
64
|
}) => {
|
|
63
65
|
const intl = useIntl();
|
|
64
66
|
const hoverStart = useRef();
|
|
@@ -116,7 +118,20 @@ export const Reaction = ({
|
|
|
116
118
|
createAndFireSafe(createAnalyticsEvent, createReactionFocusedEvent, hoverStart.current);
|
|
117
119
|
onFocused(reaction.emojiId, event);
|
|
118
120
|
}, [createAnalyticsEvent, reaction, onFocused]);
|
|
121
|
+
const dismissTooltip = () => {
|
|
122
|
+
setIsTooltipEnabled(false);
|
|
123
|
+
};
|
|
119
124
|
const buttonStyles = showOpaqueBackground ? [opaqueBackgroundStyles] : [];
|
|
125
|
+
const emojiAndCount = jsx(Inline, null, jsx("div", {
|
|
126
|
+
css: [emojiStyle, reaction.count === 0 && emojiNoReactionStyle]
|
|
127
|
+
}, jsx(ResourcedEmoji, {
|
|
128
|
+
emojiProvider: emojiProvider,
|
|
129
|
+
emojiId: emojiId,
|
|
130
|
+
fitToHeight: 16
|
|
131
|
+
})), jsx(Counter, {
|
|
132
|
+
value: reaction.count,
|
|
133
|
+
highlight: !isViewOnly && reaction.reacted
|
|
134
|
+
}));
|
|
120
135
|
return jsx(Box, {
|
|
121
136
|
xcss: containerStyles
|
|
122
137
|
}, showParticleEffect && jsx(ReactionParticleEffect, {
|
|
@@ -127,8 +142,16 @@ export const Reaction = ({
|
|
|
127
142
|
reaction: reaction,
|
|
128
143
|
isEnabled: isTooltipEnabled,
|
|
129
144
|
allowUserDialog: allowUserDialog,
|
|
130
|
-
handleOpenReactionsDialog: handleOpenReactionsDialog
|
|
131
|
-
|
|
145
|
+
handleOpenReactionsDialog: handleOpenReactionsDialog,
|
|
146
|
+
dismissTooltip: dismissTooltip
|
|
147
|
+
}, isViewOnly ? jsx(StaticReaction, {
|
|
148
|
+
onMouseEnter: handleMouseEnter,
|
|
149
|
+
onFocus: handleFocused,
|
|
150
|
+
testId: RENDER_REACTION_TESTID,
|
|
151
|
+
dataAttributes: {
|
|
152
|
+
'data-emoji-id': reaction.emojiId
|
|
153
|
+
}
|
|
154
|
+
}, emojiAndCount) : jsx(ReactionButton, {
|
|
132
155
|
onClick: handleClick,
|
|
133
156
|
flash: flash,
|
|
134
157
|
additionalStyles: reaction.reacted ? [reactedStyles] : buttonStyles,
|
|
@@ -143,14 +166,5 @@ export const Reaction = ({
|
|
|
143
166
|
'data-emoji-id': reaction.emojiId,
|
|
144
167
|
'data-emoji-button-id': reaction.emojiId
|
|
145
168
|
}
|
|
146
|
-
},
|
|
147
|
-
css: [emojiStyle, reaction.count === 0 && emojiNoReactionStyle]
|
|
148
|
-
}, jsx(ResourcedEmoji, {
|
|
149
|
-
emojiProvider: emojiProvider,
|
|
150
|
-
emojiId: emojiId,
|
|
151
|
-
fitToHeight: 16
|
|
152
|
-
})), jsx(Counter, {
|
|
153
|
-
value: reaction.count,
|
|
154
|
-
highlight: reaction.reacted
|
|
155
|
-
}))));
|
|
169
|
+
}, emojiAndCount)));
|
|
156
170
|
};
|
|
@@ -11,7 +11,9 @@ import { FlashAnimation } from '../FlashAnimation';
|
|
|
11
11
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
12
12
|
import { flashStyle, flashStyleOld } from './styles';
|
|
13
13
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
|
-
|
|
14
|
+
|
|
15
|
+
// please sync reaction styles that are not button-specific with StaticReaction.tsx
|
|
16
|
+
const reactionButtonStyles = xcss({
|
|
15
17
|
display: 'flex',
|
|
16
18
|
flexDirection: 'row',
|
|
17
19
|
alignItems: 'flex-start',
|
|
@@ -56,7 +58,7 @@ export const ReactionButton = ({
|
|
|
56
58
|
"aria-label": ariaLabel,
|
|
57
59
|
"aria-pressed": ariaPressed,
|
|
58
60
|
testId: testId,
|
|
59
|
-
xcss: [
|
|
61
|
+
xcss: [reactionButtonStyles, ...additionalStyles,
|
|
60
62
|
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
61
63
|
fg('platform-component-visual-refresh') && reactionStylesRefresh]
|
|
62
64
|
}, dataAttributes), jsx(FlashAnimation, {
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
/**
|
|
3
|
+
* @jsxRuntime classic
|
|
4
|
+
* @jsx jsx
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { Box, xcss } from '@atlaskit/primitives';
|
|
8
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
|
+
import { jsx } from '@emotion/react';
|
|
10
|
+
|
|
11
|
+
// please sync reaction styles that are not button-specific with ReactionButton.tsx
|
|
12
|
+
const staticReactionStyles = xcss({
|
|
13
|
+
display: 'flex',
|
|
14
|
+
flexDirection: 'row',
|
|
15
|
+
alignItems: 'flex-start',
|
|
16
|
+
minWidth: '36px',
|
|
17
|
+
height: '24px',
|
|
18
|
+
backgroundColor: 'color.background.neutral.subtle',
|
|
19
|
+
color: 'color.text.subtle',
|
|
20
|
+
marginBlockStart: 'space.050',
|
|
21
|
+
marginInlineEnd: 'space.050',
|
|
22
|
+
padding: 'space.0',
|
|
23
|
+
overflow: 'hidden',
|
|
24
|
+
border: 'none',
|
|
25
|
+
':hover': {
|
|
26
|
+
backgroundColor: 'color.background.neutral.subtle.hovered',
|
|
27
|
+
cursor: 'default'
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
export const StaticReaction = ({
|
|
31
|
+
onMouseEnter,
|
|
32
|
+
onFocus,
|
|
33
|
+
children,
|
|
34
|
+
testId,
|
|
35
|
+
dataAttributes = {}
|
|
36
|
+
}) => {
|
|
37
|
+
return jsx(Box, _extends({
|
|
38
|
+
onMouseEnter: onMouseEnter,
|
|
39
|
+
onFocus: onFocus,
|
|
40
|
+
testId: testId,
|
|
41
|
+
xcss: staticReactionStyles
|
|
42
|
+
}, dataAttributes), children);
|
|
43
|
+
};
|
|
@@ -173,7 +173,7 @@ export const ReactionsDialogHeader = ({
|
|
|
173
173
|
const isSinglePage = maxPages === 1;
|
|
174
174
|
const isOnFirstPage = currentPage === 1;
|
|
175
175
|
const isOnLastPage = currentPage === maxPages;
|
|
176
|
-
const
|
|
176
|
+
const handleMouseEnter = reaction => {
|
|
177
177
|
const {
|
|
178
178
|
emojiId
|
|
179
179
|
} = reaction;
|
|
@@ -230,7 +230,7 @@ export const ReactionsDialogHeader = ({
|
|
|
230
230
|
key: reaction.emojiId,
|
|
231
231
|
"data-testid": emojiId === null || emojiId === void 0 ? void 0 : emojiId.id,
|
|
232
232
|
onMouseEnter: () => {
|
|
233
|
-
|
|
233
|
+
handleMouseEnter(reaction);
|
|
234
234
|
}
|
|
235
235
|
}, jsx(Tab, null, jsx(Tooltip, {
|
|
236
236
|
content: cache[reaction.emojiId],
|
|
@@ -26,7 +26,8 @@ export const ReactionSummaryView = ({
|
|
|
26
26
|
showOpaqueBackground = false,
|
|
27
27
|
subtleReactionsSummaryAndPicker = false,
|
|
28
28
|
allowUserDialog,
|
|
29
|
-
handleOpenReactionsDialog
|
|
29
|
+
handleOpenReactionsDialog,
|
|
30
|
+
isViewOnly = false
|
|
30
31
|
}) => {
|
|
31
32
|
const [isSummaryPopupOpen, setSummaryPopupOpen] = useState(false);
|
|
32
33
|
const handlePopupClose = useCallback(() => setSummaryPopupOpen(false), []);
|
|
@@ -49,7 +50,8 @@ export const ReactionSummaryView = ({
|
|
|
49
50
|
flash: flash[reaction.emojiId],
|
|
50
51
|
showParticleEffect: particleEffectByEmoji[reaction.emojiId],
|
|
51
52
|
allowUserDialog: allowUserDialog,
|
|
52
|
-
handleOpenReactionsDialog: handleOpenReactionsDialog
|
|
53
|
+
handleOpenReactionsDialog: handleOpenReactionsDialog,
|
|
54
|
+
isViewOnly: isViewOnly
|
|
53
55
|
}))),
|
|
54
56
|
isOpen: isSummaryPopupOpen,
|
|
55
57
|
onClose: handlePopupClose,
|
|
@@ -25,7 +25,8 @@ export const ReactionTooltip = ({
|
|
|
25
25
|
maxReactions = TOOLTIP_USERS_LIMIT,
|
|
26
26
|
isEnabled = true,
|
|
27
27
|
allowUserDialog,
|
|
28
|
-
handleOpenReactionsDialog
|
|
28
|
+
handleOpenReactionsDialog,
|
|
29
|
+
dismissTooltip
|
|
29
30
|
}) => {
|
|
30
31
|
const content = !users || users.length === 0 || !isEnabled ? null :
|
|
31
32
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values, jsx-a11y/no-noninteractive-tabindex -- Ignored via go/DSP-18766
|
|
@@ -43,6 +44,7 @@ export const ReactionTooltip = ({
|
|
|
43
44
|
css: allowUserDialog ? [footerStyle, underlineStyle] : footerStyle,
|
|
44
45
|
onClick: () => {
|
|
45
46
|
if (allowUserDialog && handleOpenReactionsDialog) {
|
|
47
|
+
dismissTooltip();
|
|
46
48
|
handleOpenReactionsDialog();
|
|
47
49
|
}
|
|
48
50
|
}
|
|
@@ -277,7 +277,8 @@ export const Reactions = /*#__PURE__*/React.memo(({
|
|
|
277
277
|
showOpaqueBackground: showOpaqueBackground,
|
|
278
278
|
subtleReactionsSummaryAndPicker: subtleReactionsSummaryAndPicker,
|
|
279
279
|
handleOpenReactionsDialog: handleOpenReactionsDialog,
|
|
280
|
-
allowUserDialog: allowUserDialog && hasEmojiWithFivePlusReactions
|
|
280
|
+
allowUserDialog: allowUserDialog && hasEmojiWithFivePlusReactions,
|
|
281
|
+
isViewOnly: isViewOnly
|
|
281
282
|
})) : memorizedReactions.map(reaction => jsx(Reaction, {
|
|
282
283
|
key: reaction.emojiId,
|
|
283
284
|
reaction: reaction,
|
|
@@ -289,7 +290,8 @@ export const Reactions = /*#__PURE__*/React.memo(({
|
|
|
289
290
|
showParticleEffect: particleEffectByEmoji[reaction.emojiId],
|
|
290
291
|
showOpaqueBackground: showOpaqueBackground,
|
|
291
292
|
allowUserDialog: allowUserDialog && hasEmojiWithFivePlusReactions,
|
|
292
|
-
handleOpenReactionsDialog: handleOpenReactionsDialog
|
|
293
|
+
handleOpenReactionsDialog: handleOpenReactionsDialog,
|
|
294
|
+
isViewOnly: isViewOnly
|
|
293
295
|
}))), !isViewOnly && jsx(ReactionPicker
|
|
294
296
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
295
297
|
, {
|
|
@@ -4,7 +4,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
import { createAndFireEvent } from '@atlaskit/analytics-next';
|
|
5
5
|
import { UI_EVENT_TYPE, OPERATIONAL_EVENT_TYPE } from '@atlaskit/analytics-gas-types';
|
|
6
6
|
var packageName = "@atlaskit/reactions";
|
|
7
|
-
var packageVersion = "25.
|
|
7
|
+
var packageVersion = "25.6.0";
|
|
8
8
|
/**
|
|
9
9
|
* TODO: move to utility package?
|
|
10
10
|
* A random sampling function
|
|
@@ -11,7 +11,7 @@ import { useIntl } from 'react-intl-next';
|
|
|
11
11
|
import { jsx } from '@emotion/react';
|
|
12
12
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
13
13
|
import { ResourcedEmoji } from '@atlaskit/emoji';
|
|
14
|
-
import { Box, xcss } from '@atlaskit/primitives';
|
|
14
|
+
import { Box, Inline, xcss } from '@atlaskit/primitives';
|
|
15
15
|
import { createAndFireSafe, createReactionClickedEvent, createReactionFocusedEvent, createReactionHoveredEvent } from '../../analytics';
|
|
16
16
|
import { Counter } from '../Counter';
|
|
17
17
|
import { ReactionParticleEffect } from '../ReactionParticleEffect';
|
|
@@ -20,6 +20,7 @@ import { messages } from '../../shared/i18n';
|
|
|
20
20
|
import { isLeftClick } from '../../shared/utils';
|
|
21
21
|
import { emojiStyle, emojiNoReactionStyle } from './styles';
|
|
22
22
|
import { ReactionButton } from './ReactionButton';
|
|
23
|
+
import { StaticReaction } from './StaticReaction';
|
|
23
24
|
|
|
24
25
|
/**
|
|
25
26
|
* Test id for Reaction item wrapper div
|
|
@@ -66,7 +67,9 @@ export var Reaction = function Reaction(_ref) {
|
|
|
66
67
|
_ref$showOpaqueBackgr = _ref.showOpaqueBackground,
|
|
67
68
|
showOpaqueBackground = _ref$showOpaqueBackgr === void 0 ? false : _ref$showOpaqueBackgr,
|
|
68
69
|
allowUserDialog = _ref.allowUserDialog,
|
|
69
|
-
handleOpenReactionsDialog = _ref.handleOpenReactionsDialog
|
|
70
|
+
handleOpenReactionsDialog = _ref.handleOpenReactionsDialog,
|
|
71
|
+
_ref$isViewOnly = _ref.isViewOnly,
|
|
72
|
+
isViewOnly = _ref$isViewOnly === void 0 ? false : _ref$isViewOnly;
|
|
70
73
|
var intl = useIntl();
|
|
71
74
|
var hoverStart = useRef();
|
|
72
75
|
var focusStart = useRef();
|
|
@@ -139,7 +142,20 @@ export var Reaction = function Reaction(_ref) {
|
|
|
139
142
|
createAndFireSafe(createAnalyticsEvent, createReactionFocusedEvent, hoverStart.current);
|
|
140
143
|
onFocused(reaction.emojiId, event);
|
|
141
144
|
}, [createAnalyticsEvent, reaction, onFocused]);
|
|
145
|
+
var dismissTooltip = function dismissTooltip() {
|
|
146
|
+
setIsTooltipEnabled(false);
|
|
147
|
+
};
|
|
142
148
|
var buttonStyles = showOpaqueBackground ? [opaqueBackgroundStyles] : [];
|
|
149
|
+
var emojiAndCount = jsx(Inline, null, jsx("div", {
|
|
150
|
+
css: [emojiStyle, reaction.count === 0 && emojiNoReactionStyle]
|
|
151
|
+
}, jsx(ResourcedEmoji, {
|
|
152
|
+
emojiProvider: emojiProvider,
|
|
153
|
+
emojiId: emojiId,
|
|
154
|
+
fitToHeight: 16
|
|
155
|
+
})), jsx(Counter, {
|
|
156
|
+
value: reaction.count,
|
|
157
|
+
highlight: !isViewOnly && reaction.reacted
|
|
158
|
+
}));
|
|
143
159
|
return jsx(Box, {
|
|
144
160
|
xcss: containerStyles
|
|
145
161
|
}, showParticleEffect && jsx(ReactionParticleEffect, {
|
|
@@ -150,8 +166,16 @@ export var Reaction = function Reaction(_ref) {
|
|
|
150
166
|
reaction: reaction,
|
|
151
167
|
isEnabled: isTooltipEnabled,
|
|
152
168
|
allowUserDialog: allowUserDialog,
|
|
153
|
-
handleOpenReactionsDialog: handleOpenReactionsDialog
|
|
154
|
-
|
|
169
|
+
handleOpenReactionsDialog: handleOpenReactionsDialog,
|
|
170
|
+
dismissTooltip: dismissTooltip
|
|
171
|
+
}, isViewOnly ? jsx(StaticReaction, {
|
|
172
|
+
onMouseEnter: handleMouseEnter,
|
|
173
|
+
onFocus: handleFocused,
|
|
174
|
+
testId: RENDER_REACTION_TESTID,
|
|
175
|
+
dataAttributes: {
|
|
176
|
+
'data-emoji-id': reaction.emojiId
|
|
177
|
+
}
|
|
178
|
+
}, emojiAndCount) : jsx(ReactionButton, {
|
|
155
179
|
onClick: handleClick,
|
|
156
180
|
flash: flash,
|
|
157
181
|
additionalStyles: reaction.reacted ? [reactedStyles] : buttonStyles,
|
|
@@ -166,14 +190,5 @@ export var Reaction = function Reaction(_ref) {
|
|
|
166
190
|
'data-emoji-id': reaction.emojiId,
|
|
167
191
|
'data-emoji-button-id': reaction.emojiId
|
|
168
192
|
}
|
|
169
|
-
},
|
|
170
|
-
css: [emojiStyle, reaction.count === 0 && emojiNoReactionStyle]
|
|
171
|
-
}, jsx(ResourcedEmoji, {
|
|
172
|
-
emojiProvider: emojiProvider,
|
|
173
|
-
emojiId: emojiId,
|
|
174
|
-
fitToHeight: 16
|
|
175
|
-
})), jsx(Counter, {
|
|
176
|
-
value: reaction.count,
|
|
177
|
-
highlight: reaction.reacted
|
|
178
|
-
}))));
|
|
193
|
+
}, emojiAndCount)));
|
|
179
194
|
};
|
|
@@ -12,7 +12,9 @@ import { FlashAnimation } from '../FlashAnimation';
|
|
|
12
12
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
13
13
|
import { flashStyle, flashStyleOld } from './styles';
|
|
14
14
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
|
-
|
|
15
|
+
|
|
16
|
+
// please sync reaction styles that are not button-specific with StaticReaction.tsx
|
|
17
|
+
var reactionButtonStyles = xcss({
|
|
16
18
|
display: 'flex',
|
|
17
19
|
flexDirection: 'row',
|
|
18
20
|
alignItems: 'flex-start',
|
|
@@ -59,7 +61,7 @@ export var ReactionButton = function ReactionButton(_ref) {
|
|
|
59
61
|
"aria-label": ariaLabel,
|
|
60
62
|
"aria-pressed": ariaPressed,
|
|
61
63
|
testId: testId,
|
|
62
|
-
xcss: [
|
|
64
|
+
xcss: [reactionButtonStyles].concat(_toConsumableArray(additionalStyles), [
|
|
63
65
|
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
64
66
|
fg('platform-component-visual-refresh') && reactionStylesRefresh])
|
|
65
67
|
}, dataAttributes), jsx(FlashAnimation, {
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
/**
|
|
3
|
+
* @jsxRuntime classic
|
|
4
|
+
* @jsx jsx
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { Box, xcss } from '@atlaskit/primitives';
|
|
8
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
|
+
import { jsx } from '@emotion/react';
|
|
10
|
+
|
|
11
|
+
// please sync reaction styles that are not button-specific with ReactionButton.tsx
|
|
12
|
+
var staticReactionStyles = xcss({
|
|
13
|
+
display: 'flex',
|
|
14
|
+
flexDirection: 'row',
|
|
15
|
+
alignItems: 'flex-start',
|
|
16
|
+
minWidth: '36px',
|
|
17
|
+
height: '24px',
|
|
18
|
+
backgroundColor: 'color.background.neutral.subtle',
|
|
19
|
+
color: 'color.text.subtle',
|
|
20
|
+
marginBlockStart: 'space.050',
|
|
21
|
+
marginInlineEnd: 'space.050',
|
|
22
|
+
padding: 'space.0',
|
|
23
|
+
overflow: 'hidden',
|
|
24
|
+
border: 'none',
|
|
25
|
+
':hover': {
|
|
26
|
+
backgroundColor: 'color.background.neutral.subtle.hovered',
|
|
27
|
+
cursor: 'default'
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
export var StaticReaction = function StaticReaction(_ref) {
|
|
31
|
+
var onMouseEnter = _ref.onMouseEnter,
|
|
32
|
+
onFocus = _ref.onFocus,
|
|
33
|
+
children = _ref.children,
|
|
34
|
+
testId = _ref.testId,
|
|
35
|
+
_ref$dataAttributes = _ref.dataAttributes,
|
|
36
|
+
dataAttributes = _ref$dataAttributes === void 0 ? {} : _ref$dataAttributes;
|
|
37
|
+
return jsx(Box, _extends({
|
|
38
|
+
onMouseEnter: onMouseEnter,
|
|
39
|
+
onFocus: onFocus,
|
|
40
|
+
testId: testId,
|
|
41
|
+
xcss: staticReactionStyles
|
|
42
|
+
}, dataAttributes), children);
|
|
43
|
+
};
|
|
@@ -180,7 +180,7 @@ export var ReactionsDialogHeader = function ReactionsDialogHeader(_ref4) {
|
|
|
180
180
|
var isSinglePage = maxPages === 1;
|
|
181
181
|
var isOnFirstPage = currentPage === 1;
|
|
182
182
|
var isOnLastPage = currentPage === maxPages;
|
|
183
|
-
var
|
|
183
|
+
var handleMouseEnter = function handleMouseEnter(reaction) {
|
|
184
184
|
var emojiId = reaction.emojiId;
|
|
185
185
|
if (!emojiId || cache[emojiId]) {
|
|
186
186
|
return;
|
|
@@ -250,7 +250,7 @@ export var ReactionsDialogHeader = function ReactionsDialogHeader(_ref4) {
|
|
|
250
250
|
key: reaction.emojiId,
|
|
251
251
|
"data-testid": emojiId === null || emojiId === void 0 ? void 0 : emojiId.id,
|
|
252
252
|
onMouseEnter: function onMouseEnter() {
|
|
253
|
-
|
|
253
|
+
handleMouseEnter(reaction);
|
|
254
254
|
}
|
|
255
255
|
}, jsx(Tab, null, jsx(Tooltip, {
|
|
256
256
|
content: cache[reaction.emojiId],
|
|
@@ -33,7 +33,9 @@ export var ReactionSummaryView = function ReactionSummaryView(_ref) {
|
|
|
33
33
|
_ref$subtleReactionsS = _ref.subtleReactionsSummaryAndPicker,
|
|
34
34
|
subtleReactionsSummaryAndPicker = _ref$subtleReactionsS === void 0 ? false : _ref$subtleReactionsS,
|
|
35
35
|
allowUserDialog = _ref.allowUserDialog,
|
|
36
|
-
handleOpenReactionsDialog = _ref.handleOpenReactionsDialog
|
|
36
|
+
handleOpenReactionsDialog = _ref.handleOpenReactionsDialog,
|
|
37
|
+
_ref$isViewOnly = _ref.isViewOnly,
|
|
38
|
+
isViewOnly = _ref$isViewOnly === void 0 ? false : _ref$isViewOnly;
|
|
37
39
|
var _useState = useState(false),
|
|
38
40
|
_useState2 = _slicedToArray(_useState, 2),
|
|
39
41
|
isSummaryPopupOpen = _useState2[0],
|
|
@@ -64,7 +66,8 @@ export var ReactionSummaryView = function ReactionSummaryView(_ref) {
|
|
|
64
66
|
flash: flash[reaction.emojiId],
|
|
65
67
|
showParticleEffect: particleEffectByEmoji[reaction.emojiId],
|
|
66
68
|
allowUserDialog: allowUserDialog,
|
|
67
|
-
handleOpenReactionsDialog: handleOpenReactionsDialog
|
|
69
|
+
handleOpenReactionsDialog: handleOpenReactionsDialog,
|
|
70
|
+
isViewOnly: isViewOnly
|
|
68
71
|
});
|
|
69
72
|
}));
|
|
70
73
|
},
|
|
@@ -26,7 +26,8 @@ export var ReactionTooltip = function ReactionTooltip(_ref) {
|
|
|
26
26
|
_ref$isEnabled = _ref.isEnabled,
|
|
27
27
|
isEnabled = _ref$isEnabled === void 0 ? true : _ref$isEnabled,
|
|
28
28
|
allowUserDialog = _ref.allowUserDialog,
|
|
29
|
-
handleOpenReactionsDialog = _ref.handleOpenReactionsDialog
|
|
29
|
+
handleOpenReactionsDialog = _ref.handleOpenReactionsDialog,
|
|
30
|
+
dismissTooltip = _ref.dismissTooltip;
|
|
30
31
|
var content = !users || users.length === 0 || !isEnabled ? null :
|
|
31
32
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values, jsx-a11y/no-noninteractive-tabindex -- Ignored via go/DSP-18766
|
|
32
33
|
jsx("div", {
|
|
@@ -43,6 +44,7 @@ export var ReactionTooltip = function ReactionTooltip(_ref) {
|
|
|
43
44
|
css: allowUserDialog ? [footerStyle, underlineStyle] : footerStyle,
|
|
44
45
|
onClick: function onClick() {
|
|
45
46
|
if (allowUserDialog && handleOpenReactionsDialog) {
|
|
47
|
+
dismissTooltip();
|
|
46
48
|
handleOpenReactionsDialog();
|
|
47
49
|
}
|
|
48
50
|
}
|
|
@@ -309,7 +309,8 @@ export var Reactions = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
309
309
|
showOpaqueBackground: showOpaqueBackground,
|
|
310
310
|
subtleReactionsSummaryAndPicker: subtleReactionsSummaryAndPicker,
|
|
311
311
|
handleOpenReactionsDialog: handleOpenReactionsDialog,
|
|
312
|
-
allowUserDialog: allowUserDialog && hasEmojiWithFivePlusReactions
|
|
312
|
+
allowUserDialog: allowUserDialog && hasEmojiWithFivePlusReactions,
|
|
313
|
+
isViewOnly: isViewOnly
|
|
313
314
|
})) : memorizedReactions.map(function (reaction) {
|
|
314
315
|
return jsx(Reaction, {
|
|
315
316
|
key: reaction.emojiId,
|
|
@@ -322,7 +323,8 @@ export var Reactions = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
322
323
|
showParticleEffect: particleEffectByEmoji[reaction.emojiId],
|
|
323
324
|
showOpaqueBackground: showOpaqueBackground,
|
|
324
325
|
allowUserDialog: allowUserDialog && hasEmojiWithFivePlusReactions,
|
|
325
|
-
handleOpenReactionsDialog: handleOpenReactionsDialog
|
|
326
|
+
handleOpenReactionsDialog: handleOpenReactionsDialog,
|
|
327
|
+
isViewOnly: isViewOnly
|
|
326
328
|
});
|
|
327
329
|
})), !isViewOnly && jsx(ReactionPicker
|
|
328
330
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
@@ -47,8 +47,12 @@ export interface ReactionProps {
|
|
|
47
47
|
* Optional function when the user wants to open the Reactions Dialog
|
|
48
48
|
*/
|
|
49
49
|
handleOpenReactionsDialog?: (emojiId?: string, source?: string) => void;
|
|
50
|
+
/**
|
|
51
|
+
* Optional prop for controlling if the reactions component is view only, disabling adding reactions
|
|
52
|
+
*/
|
|
53
|
+
isViewOnly?: boolean;
|
|
50
54
|
}
|
|
51
55
|
/**
|
|
52
56
|
* Render an emoji reaction button
|
|
53
57
|
*/
|
|
54
|
-
export declare const Reaction: ({ emojiProvider, onClick, reaction, onMouseEnter, onFocused, flash, showParticleEffect, showOpaqueBackground, allowUserDialog, handleOpenReactionsDialog, }: ReactionProps) => jsx.JSX.Element;
|
|
58
|
+
export declare const Reaction: ({ emojiProvider, onClick, reaction, onMouseEnter, onFocused, flash, showParticleEffect, showOpaqueBackground, allowUserDialog, handleOpenReactionsDialog, isViewOnly, }: ReactionProps) => jsx.JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { jsx } from '@emotion/react';
|
|
7
|
+
type StaticReactionProps = {
|
|
8
|
+
onMouseEnter?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
9
|
+
onFocus?: (event: React.FocusEvent<HTMLButtonElement>) => void;
|
|
10
|
+
testId?: string;
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
dataAttributes?: {
|
|
13
|
+
[key: string]: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export declare const StaticReaction: ({ onMouseEnter, onFocus, children, testId, dataAttributes, }: StaticReactionProps) => jsx.JSX.Element;
|
|
17
|
+
export {};
|
|
@@ -39,6 +39,10 @@ interface ReactionSummaryViewProps extends Pick<ReactionsProps, 'emojiProvider'
|
|
|
39
39
|
* Optional function when the user wants to open the Reactions Dialog
|
|
40
40
|
*/
|
|
41
41
|
handleOpenReactionsDialog?: (emojiId?: string, source?: string) => void;
|
|
42
|
+
/**
|
|
43
|
+
* Optional prop for controlling if the reactions component is view only, disabling adding reactions
|
|
44
|
+
*/
|
|
45
|
+
isViewOnly?: boolean;
|
|
42
46
|
}
|
|
43
|
-
export declare const ReactionSummaryView: ({ emojiProvider, reactions, flash, particleEffectByEmoji, placement, onReactionClick, onReactionFocused, onReactionMouseEnter, showOpaqueBackground, subtleReactionsSummaryAndPicker, allowUserDialog, handleOpenReactionsDialog, }: ReactionSummaryViewProps) => React.JSX.Element;
|
|
47
|
+
export declare const ReactionSummaryView: ({ emojiProvider, reactions, flash, particleEffectByEmoji, placement, onReactionClick, onReactionFocused, onReactionMouseEnter, showOpaqueBackground, subtleReactionsSummaryAndPicker, allowUserDialog, handleOpenReactionsDialog, isViewOnly, }: ReactionSummaryViewProps) => React.JSX.Element;
|
|
44
48
|
export {};
|
|
@@ -34,5 +34,9 @@ export type ReactionTooltipProps = PropsWithChildren<{
|
|
|
34
34
|
* Optional function when the user wants to open the Reactions Dialog
|
|
35
35
|
*/
|
|
36
36
|
handleOpenReactionsDialog?: (emojiId?: string, source?: string) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Function that hides the tooltip
|
|
39
|
+
*/
|
|
40
|
+
dismissTooltip: () => void;
|
|
37
41
|
}>;
|
|
38
|
-
export declare const ReactionTooltip: ({ children, emojiName, reaction: { users }, maxReactions, isEnabled, allowUserDialog, handleOpenReactionsDialog, }: ReactionTooltipProps) => jsx.JSX.Element;
|
|
42
|
+
export declare const ReactionTooltip: ({ children, emojiName, reaction: { users }, maxReactions, isEnabled, allowUserDialog, handleOpenReactionsDialog, dismissTooltip, }: ReactionTooltipProps) => jsx.JSX.Element;
|
|
@@ -47,8 +47,12 @@ export interface ReactionProps {
|
|
|
47
47
|
* Optional function when the user wants to open the Reactions Dialog
|
|
48
48
|
*/
|
|
49
49
|
handleOpenReactionsDialog?: (emojiId?: string, source?: string) => void;
|
|
50
|
+
/**
|
|
51
|
+
* Optional prop for controlling if the reactions component is view only, disabling adding reactions
|
|
52
|
+
*/
|
|
53
|
+
isViewOnly?: boolean;
|
|
50
54
|
}
|
|
51
55
|
/**
|
|
52
56
|
* Render an emoji reaction button
|
|
53
57
|
*/
|
|
54
|
-
export declare const Reaction: ({ emojiProvider, onClick, reaction, onMouseEnter, onFocused, flash, showParticleEffect, showOpaqueBackground, allowUserDialog, handleOpenReactionsDialog, }: ReactionProps) => jsx.JSX.Element;
|
|
58
|
+
export declare const Reaction: ({ emojiProvider, onClick, reaction, onMouseEnter, onFocused, flash, showParticleEffect, showOpaqueBackground, allowUserDialog, handleOpenReactionsDialog, isViewOnly, }: ReactionProps) => jsx.JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { jsx } from '@emotion/react';
|
|
7
|
+
type StaticReactionProps = {
|
|
8
|
+
onMouseEnter?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
9
|
+
onFocus?: (event: React.FocusEvent<HTMLButtonElement>) => void;
|
|
10
|
+
testId?: string;
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
dataAttributes?: {
|
|
13
|
+
[key: string]: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export declare const StaticReaction: ({ onMouseEnter, onFocus, children, testId, dataAttributes, }: StaticReactionProps) => jsx.JSX.Element;
|
|
17
|
+
export {};
|
|
@@ -39,6 +39,10 @@ interface ReactionSummaryViewProps extends Pick<ReactionsProps, 'emojiProvider'
|
|
|
39
39
|
* Optional function when the user wants to open the Reactions Dialog
|
|
40
40
|
*/
|
|
41
41
|
handleOpenReactionsDialog?: (emojiId?: string, source?: string) => void;
|
|
42
|
+
/**
|
|
43
|
+
* Optional prop for controlling if the reactions component is view only, disabling adding reactions
|
|
44
|
+
*/
|
|
45
|
+
isViewOnly?: boolean;
|
|
42
46
|
}
|
|
43
|
-
export declare const ReactionSummaryView: ({ emojiProvider, reactions, flash, particleEffectByEmoji, placement, onReactionClick, onReactionFocused, onReactionMouseEnter, showOpaqueBackground, subtleReactionsSummaryAndPicker, allowUserDialog, handleOpenReactionsDialog, }: ReactionSummaryViewProps) => React.JSX.Element;
|
|
47
|
+
export declare const ReactionSummaryView: ({ emojiProvider, reactions, flash, particleEffectByEmoji, placement, onReactionClick, onReactionFocused, onReactionMouseEnter, showOpaqueBackground, subtleReactionsSummaryAndPicker, allowUserDialog, handleOpenReactionsDialog, isViewOnly, }: ReactionSummaryViewProps) => React.JSX.Element;
|
|
44
48
|
export {};
|
|
@@ -34,5 +34,9 @@ export type ReactionTooltipProps = PropsWithChildren<{
|
|
|
34
34
|
* Optional function when the user wants to open the Reactions Dialog
|
|
35
35
|
*/
|
|
36
36
|
handleOpenReactionsDialog?: (emojiId?: string, source?: string) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Function that hides the tooltip
|
|
39
|
+
*/
|
|
40
|
+
dismissTooltip: () => void;
|
|
37
41
|
}>;
|
|
38
|
-
export declare const ReactionTooltip: ({ children, emojiName, reaction: { users }, maxReactions, isEnabled, allowUserDialog, handleOpenReactionsDialog, }: ReactionTooltipProps) => jsx.JSX.Element;
|
|
42
|
+
export declare const ReactionTooltip: ({ children, emojiName, reaction: { users }, maxReactions, isEnabled, allowUserDialog, handleOpenReactionsDialog, dismissTooltip, }: ReactionTooltipProps) => jsx.JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/reactions",
|
|
3
|
-
"version": "25.
|
|
3
|
+
"version": "25.6.0",
|
|
4
4
|
"description": "Reactions component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -38,19 +38,19 @@
|
|
|
38
38
|
"@atlaskit/avatar": "^21.18.0",
|
|
39
39
|
"@atlaskit/button": "^20.5.0",
|
|
40
40
|
"@atlaskit/emoji": "^67.14.0",
|
|
41
|
-
"@atlaskit/heading": "^4.
|
|
42
|
-
"@atlaskit/icon": "^23.
|
|
41
|
+
"@atlaskit/heading": "^4.3.0",
|
|
42
|
+
"@atlaskit/icon": "^23.11.0",
|
|
43
43
|
"@atlaskit/modal-dialog": "^12.20.0",
|
|
44
|
-
"@atlaskit/motion": "^3.
|
|
44
|
+
"@atlaskit/motion": "^3.1.0",
|
|
45
45
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
46
46
|
"@atlaskit/popper": "^6.4.0",
|
|
47
|
-
"@atlaskit/popup": "1.
|
|
48
|
-
"@atlaskit/primitives": "^13.
|
|
49
|
-
"@atlaskit/spinner": "^17.
|
|
50
|
-
"@atlaskit/tabs": "^17.
|
|
47
|
+
"@atlaskit/popup": "1.32.0",
|
|
48
|
+
"@atlaskit/primitives": "^13.6.0",
|
|
49
|
+
"@atlaskit/spinner": "^17.2.0",
|
|
50
|
+
"@atlaskit/tabs": "^17.3.0",
|
|
51
51
|
"@atlaskit/theme": "^16.0.0",
|
|
52
52
|
"@atlaskit/tokens": "^3.3.0",
|
|
53
|
-
"@atlaskit/tooltip": "^19.
|
|
53
|
+
"@atlaskit/tooltip": "^19.2.0",
|
|
54
54
|
"@atlaskit/ufo": "^0.3.0",
|
|
55
55
|
"@atlaskit/util-service-support": "^6.2.0",
|
|
56
56
|
"@babel/runtime": "^7.0.0",
|