@atlaskit/reactions 22.7.4 → 22.8.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 +13 -0
- package/afm-cc/tsconfig.json +3 -0
- package/afm-jira/tsconfig.json +78 -0
- package/dist/cjs/MockReactionsClient.js +1 -1
- package/dist/cjs/analytics/index.js +1 -1
- package/dist/cjs/components/Reaction/Reaction.js +12 -35
- package/dist/cjs/components/Reaction/ReactionButton.js +66 -0
- package/dist/cjs/components/Reaction/index.js +8 -1
- package/dist/cjs/components/ReactionSummary/ReactionSummaryButton.js +92 -0
- package/dist/cjs/components/ReactionSummary/ReactionSummaryView.js +85 -0
- package/dist/cjs/components/ReactionSummary/index.js +12 -0
- package/dist/cjs/components/Reactions/Reactions.js +26 -3
- package/dist/cjs/components/UfoErrorBoundary/UfoErrorBoundary.js +2 -1
- package/dist/cjs/shared/i18n.js +5 -0
- package/dist/es2019/MockReactionsClient.js +1 -1
- package/dist/es2019/analytics/index.js +1 -1
- package/dist/es2019/components/Reaction/Reaction.js +15 -37
- package/dist/es2019/components/Reaction/ReactionButton.js +54 -0
- package/dist/es2019/components/Reaction/index.js +2 -1
- package/dist/es2019/components/ReactionSummary/ReactionSummaryButton.js +74 -0
- package/dist/es2019/components/ReactionSummary/ReactionSummaryView.js +58 -0
- package/dist/es2019/components/ReactionSummary/index.js +1 -0
- package/dist/es2019/components/Reactions/Reactions.js +23 -2
- package/dist/es2019/components/UfoErrorBoundary/UfoErrorBoundary.js +2 -1
- package/dist/es2019/shared/i18n.js +5 -0
- package/dist/esm/MockReactionsClient.js +1 -1
- package/dist/esm/analytics/index.js +1 -1
- package/dist/esm/components/Reaction/Reaction.js +15 -37
- package/dist/esm/components/Reaction/ReactionButton.js +57 -0
- package/dist/esm/components/Reaction/index.js +2 -1
- package/dist/esm/components/ReactionSummary/ReactionSummaryButton.js +82 -0
- package/dist/esm/components/ReactionSummary/ReactionSummaryView.js +75 -0
- package/dist/esm/components/ReactionSummary/index.js +1 -0
- package/dist/esm/components/Reactions/Reactions.js +25 -2
- package/dist/esm/components/UfoErrorBoundary/UfoErrorBoundary.js +2 -1
- package/dist/esm/shared/i18n.js +5 -0
- package/dist/types/components/Reaction/ReactionButton.d.ts +20 -0
- package/dist/types/components/Reaction/index.d.ts +1 -0
- package/dist/types/components/ReactionSummary/ReactionSummaryButton.d.ts +22 -0
- package/dist/types/components/ReactionSummary/ReactionSummaryView.d.ts +33 -0
- package/dist/types/components/ReactionSummary/index.d.ts +1 -0
- package/dist/types/components/Reactions/Reactions.d.ts +13 -1
- package/dist/types/containers/ConnectedReactionsView/ConnectedReactionsView.d.ts +1 -1
- package/dist/types/shared/i18n.d.ts +5 -0
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types-ts4.5/components/Reaction/ReactionButton.d.ts +20 -0
- package/dist/types-ts4.5/components/Reaction/index.d.ts +1 -0
- package/dist/types-ts4.5/components/ReactionSummary/ReactionSummaryButton.d.ts +22 -0
- package/dist/types-ts4.5/components/ReactionSummary/ReactionSummaryView.d.ts +33 -0
- package/dist/types-ts4.5/components/ReactionSummary/index.d.ts +1 -0
- package/dist/types-ts4.5/components/Reactions/Reactions.d.ts +13 -1
- package/dist/types-ts4.5/containers/ConnectedReactionsView/ConnectedReactionsView.d.ts +1 -1
- package/dist/types-ts4.5/shared/i18n.d.ts +5 -0
- package/dist/types-ts4.5/types/index.d.ts +1 -1
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/reactions
|
|
2
2
|
|
|
3
|
+
## 22.8.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`f67c5ff12702a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f67c5ff12702a) -
|
|
8
|
+
[ux] Added a new summary feature to reactions
|
|
9
|
+
|
|
10
|
+
## 22.7.5
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
3
16
|
## 22.7.4
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/afm-cc/tsconfig.json
CHANGED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../../../tsconfig.entry-points.jira.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"declaration": true,
|
|
5
|
+
"target": "es5",
|
|
6
|
+
"outDir": "../../../../../tsDist/@atlaskit__reactions/app",
|
|
7
|
+
"composite": true,
|
|
8
|
+
"rootDir": "../"
|
|
9
|
+
},
|
|
10
|
+
"include": [
|
|
11
|
+
"../src/**/*.ts",
|
|
12
|
+
"../src/**/*.tsx"
|
|
13
|
+
],
|
|
14
|
+
"exclude": [
|
|
15
|
+
"../src/**/__tests__/*",
|
|
16
|
+
"../src/**/*.test.*",
|
|
17
|
+
"../src/**/test.*"
|
|
18
|
+
],
|
|
19
|
+
"references": [
|
|
20
|
+
{
|
|
21
|
+
"path": "../../../analytics/analytics-gas-types/afm-jira/tsconfig.json"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"path": "../../../analytics/analytics-namespaced-context/afm-jira/tsconfig.json"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"path": "../../../analytics/analytics-next/afm-jira/tsconfig.json"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"path": "../../../design-system/avatar/afm-jira/tsconfig.json"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"path": "../../../design-system/button/afm-jira/tsconfig.json"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"path": "../../emoji/afm-jira/tsconfig.json"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"path": "../../../design-system/icon/afm-jira/tsconfig.json"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"path": "../../../design-system/modal-dialog/afm-jira/tsconfig.json"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"path": "../../../design-system/motion/afm-jira/tsconfig.json"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"path": "../../../design-system/popper/afm-jira/tsconfig.json"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"path": "../../../design-system/popup/afm-jira/tsconfig.json"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"path": "../../../design-system/primitives/afm-jira/tsconfig.json"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"path": "../../../design-system/spinner/afm-jira/tsconfig.json"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"path": "../../../design-system/tabs/afm-jira/tsconfig.json"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"path": "../../../design-system/theme/afm-jira/tsconfig.json"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"path": "../../../design-system/tokens/afm-jira/tsconfig.json"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"path": "../../../design-system/tooltip/afm-jira/tsconfig.json"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"path": "../../../data/ufo-external/afm-jira/tsconfig.json"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"path": "../../util-service-support/afm-jira/tsconfig.json"
|
|
76
|
+
}
|
|
77
|
+
]
|
|
78
|
+
}
|
|
@@ -39,7 +39,7 @@ var getReactionKey = function getReactionKey(containerAri, ari) {
|
|
|
39
39
|
return "".concat(containerAri, "|").concat(ari);
|
|
40
40
|
};
|
|
41
41
|
var defaultUsers = [getUser('oscar', 'Oscar Wallhult'), getUser('julien', 'Julien Michel Hoarau'), getUser('craig', 'Craig Petchell'), getUser('jerome', 'Jerome Touffe-Blin'), getUser('esoares', 'Eduardo Soares'), getUser('lpereira', 'Luiz Pereira'), getUser('pcurren', 'Paul Curren'), getUser('ttjandra', 'Tara Tjandra'), getUser('severington', 'Ste Everington'), getUser('sguillope', 'Sylvain Guillope'), getUser('alunnon', 'Alex Lunnon'), getUser('bsmith', 'Bob Smith'), getUser('jdoe', 'Jane Doe'), getUser('mhomes', 'Mary Homes'), getUser('ckent', 'Clark Kent')];
|
|
42
|
-
var simpleMockData = exports.simpleMockData = (0, _defineProperty2.default)({}, getReactionKey(containerAri, ari), [getReactionSummary(':fire:', 1, true), getReactionSummary(':
|
|
42
|
+
var simpleMockData = exports.simpleMockData = (0, _defineProperty2.default)({}, getReactionKey(containerAri, ari), [getReactionSummary(':fire:', 1, true), getReactionSummary(':astonished:', 99, false), getReactionSummary(':heart:', 44, false) // Widest character
|
|
43
43
|
]);
|
|
44
44
|
var extendedMockData = (0, _defineProperty2.default)({}, getReactionKey(containerAri, ari), [getReactionSummary(':fire:', 1, true, true), getReactionSummary(':thumbsup:', 999, false, true), getReactionSummary(':astonished:', 9, false, true), getReactionSummary(':heart:', 99, false, true), getReactionSummary(':thinking:', 10, false, true), getReactionSummary(':clap:', 99, false, true), getReactionSummary(':thumbsdown:', 2, false, true), getReactionSummary(':bulb:', 16, false, true), getReactionSummary(':star:', 9999, false, true), getReactionSummary(':green_heart:', 9, false, true), getReactionSummary(':blue_heart:', 8392, false, true), getReactionSummary(':broken_heart:', 1, false, true), getReactionSummary(':grinning:', 10601, false, true), getReactionSummary(':slight_smile:', 99, false, true)]);
|
|
45
45
|
|
|
@@ -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 = "22.
|
|
14
|
+
var packageVersion = "22.8.0";
|
|
15
15
|
/**
|
|
16
16
|
* TODO: move to utility package?
|
|
17
17
|
* A random sampling function
|
|
@@ -17,12 +17,12 @@ var _emoji = require("@atlaskit/emoji");
|
|
|
17
17
|
var _primitives = require("@atlaskit/primitives");
|
|
18
18
|
var _analytics = require("../../analytics");
|
|
19
19
|
var _Counter = require("../Counter");
|
|
20
|
-
var _FlashAnimation = require("../FlashAnimation");
|
|
21
20
|
var _ReactionParticleEffect = require("../ReactionParticleEffect");
|
|
22
21
|
var _ReactionTooltip = require("../ReactionTooltip");
|
|
23
22
|
var _i18n = require("../../shared/i18n");
|
|
24
23
|
var _utils = require("../../shared/utils");
|
|
25
24
|
var _styles = require("./styles");
|
|
25
|
+
var _ReactionButton = require("./ReactionButton");
|
|
26
26
|
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
27
|
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 && Object.prototype.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
28
|
/** @jsx jsx */
|
|
@@ -36,29 +36,6 @@ var RENDER_REACTION_TESTID = exports.RENDER_REACTION_TESTID = 'render_reaction_w
|
|
|
36
36
|
var containerStyles = (0, _primitives.xcss)({
|
|
37
37
|
position: 'relative'
|
|
38
38
|
});
|
|
39
|
-
var reactionStyles = (0, _primitives.xcss)({
|
|
40
|
-
display: 'flex',
|
|
41
|
-
flexDirection: 'row',
|
|
42
|
-
alignItems: 'flex-start',
|
|
43
|
-
minWidth: '36px',
|
|
44
|
-
height: '24px',
|
|
45
|
-
backgroundColor: 'color.background.neutral.subtle',
|
|
46
|
-
borderWidth: 'border.width',
|
|
47
|
-
borderStyle: 'solid',
|
|
48
|
-
borderColor: 'color.border',
|
|
49
|
-
borderRadius: 'border.radius.circle',
|
|
50
|
-
color: 'color.text.subtle',
|
|
51
|
-
marginBlockStart: 'space.050',
|
|
52
|
-
marginInlineEnd: 'space.050',
|
|
53
|
-
padding: 'space.0',
|
|
54
|
-
overflow: 'hidden',
|
|
55
|
-
':hover': {
|
|
56
|
-
backgroundColor: 'color.background.neutral.subtle.hovered'
|
|
57
|
-
},
|
|
58
|
-
':active': {
|
|
59
|
-
backgroundColor: 'color.background.neutral.subtle.pressed'
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
39
|
var reactedStyles = (0, _primitives.xcss)({
|
|
63
40
|
backgroundColor: 'color.background.selected',
|
|
64
41
|
borderColor: 'color.border.selected',
|
|
@@ -174,20 +151,20 @@ var Reaction = exports.Reaction = function Reaction(_ref) {
|
|
|
174
151
|
handleUserListClick: handleOpenReactionsDialog,
|
|
175
152
|
allowUserDialog: allowUserDialog,
|
|
176
153
|
isEnabled: isTooltipEnabled
|
|
177
|
-
}, (0, _react2.jsx)(
|
|
178
|
-
|
|
179
|
-
|
|
154
|
+
}, (0, _react2.jsx)(_ReactionButton.ReactionButton, {
|
|
155
|
+
onClick: handleClick,
|
|
156
|
+
flash: flash,
|
|
157
|
+
additionalStyles: reaction.reacted ? [reactedStyles] : [],
|
|
158
|
+
ariaLabel: intl.formatMessage(_i18n.messages.reactWithEmoji, {
|
|
180
159
|
emoji: emojiName
|
|
181
160
|
}),
|
|
182
|
-
"data-emoji-id": reaction.emojiId,
|
|
183
|
-
testId: RENDER_REACTION_TESTID,
|
|
184
|
-
onClick: handleClick,
|
|
185
161
|
onMouseEnter: handleMouseEnter,
|
|
186
162
|
onFocus: handleFocused,
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
163
|
+
testId: RENDER_REACTION_TESTID,
|
|
164
|
+
dataAttributes: {
|
|
165
|
+
'data-emoji-id': reaction.emojiId,
|
|
166
|
+
'data-emoji-button-id': reaction.emojiId
|
|
167
|
+
}
|
|
191
168
|
}, (0, _react2.jsx)("div", {
|
|
192
169
|
css: [_styles.emojiStyle, reaction.count === 0 && _styles.emojiNoReactionStyle]
|
|
193
170
|
}, (0, _react2.jsx)(_emoji.ResourcedEmoji, {
|
|
@@ -197,5 +174,5 @@ var Reaction = exports.Reaction = function Reaction(_ref) {
|
|
|
197
174
|
})), (0, _react2.jsx)(_Counter.Counter, {
|
|
198
175
|
value: reaction.count,
|
|
199
176
|
highlight: reaction.reacted
|
|
200
|
-
}))))
|
|
177
|
+
}))));
|
|
201
178
|
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.ReactionButton = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
var _primitives = require("@atlaskit/primitives");
|
|
12
|
+
var _react2 = require("@emotion/react");
|
|
13
|
+
var _FlashAnimation = require("../FlashAnimation");
|
|
14
|
+
var _styles = require("./styles");
|
|
15
|
+
/** @jsx jsx */
|
|
16
|
+
|
|
17
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
18
|
+
|
|
19
|
+
var reactionStyles = (0, _primitives.xcss)({
|
|
20
|
+
display: 'flex',
|
|
21
|
+
flexDirection: 'row',
|
|
22
|
+
alignItems: 'flex-start',
|
|
23
|
+
minWidth: '36px',
|
|
24
|
+
height: '24px',
|
|
25
|
+
backgroundColor: 'color.background.neutral.subtle',
|
|
26
|
+
borderWidth: 'border.width',
|
|
27
|
+
borderStyle: 'solid',
|
|
28
|
+
borderColor: 'color.border',
|
|
29
|
+
borderRadius: 'border.radius.circle',
|
|
30
|
+
color: 'color.text.subtle',
|
|
31
|
+
marginBlockStart: 'space.050',
|
|
32
|
+
marginInlineEnd: 'space.050',
|
|
33
|
+
padding: 'space.0',
|
|
34
|
+
overflow: 'hidden',
|
|
35
|
+
':hover': {
|
|
36
|
+
backgroundColor: 'color.background.neutral.subtle.hovered'
|
|
37
|
+
},
|
|
38
|
+
':active': {
|
|
39
|
+
backgroundColor: 'color.background.neutral.subtle.pressed'
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
var ReactionButton = exports.ReactionButton = function ReactionButton(_ref) {
|
|
43
|
+
var onClick = _ref.onClick,
|
|
44
|
+
_ref$flash = _ref.flash,
|
|
45
|
+
flash = _ref$flash === void 0 ? false : _ref$flash,
|
|
46
|
+
_ref$additionalStyles = _ref.additionalStyles,
|
|
47
|
+
additionalStyles = _ref$additionalStyles === void 0 ? [] : _ref$additionalStyles,
|
|
48
|
+
ariaLabel = _ref.ariaLabel,
|
|
49
|
+
onMouseEnter = _ref.onMouseEnter,
|
|
50
|
+
onFocus = _ref.onFocus,
|
|
51
|
+
children = _ref.children,
|
|
52
|
+
_ref$dataAttributes = _ref.dataAttributes,
|
|
53
|
+
dataAttributes = _ref$dataAttributes === void 0 ? {} : _ref$dataAttributes,
|
|
54
|
+
testId = _ref.testId;
|
|
55
|
+
return (0, _react2.jsx)(_primitives.Pressable, (0, _extends2.default)({
|
|
56
|
+
onClick: onClick,
|
|
57
|
+
onMouseEnter: onMouseEnter,
|
|
58
|
+
onFocus: onFocus,
|
|
59
|
+
"aria-label": ariaLabel,
|
|
60
|
+
testId: testId,
|
|
61
|
+
xcss: [reactionStyles].concat((0, _toConsumableArray2.default)(additionalStyles))
|
|
62
|
+
}, dataAttributes), (0, _react2.jsx)(_FlashAnimation.FlashAnimation, {
|
|
63
|
+
flash: flash,
|
|
64
|
+
css: _styles.flashStyle
|
|
65
|
+
}, children));
|
|
66
|
+
};
|
|
@@ -15,4 +15,11 @@ Object.defineProperty(exports, "Reaction", {
|
|
|
15
15
|
return _Reaction.Reaction;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
-
|
|
18
|
+
Object.defineProperty(exports, "ReactionButton", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _ReactionButton.ReactionButton;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
var _Reaction = require("./Reaction");
|
|
25
|
+
var _ReactionButton = require("./ReactionButton");
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.ReactionSummaryButton = exports.RENDER_SUMMARY_EMOJI_TESTID = exports.RENDER_SUMMARY_BUTTON_TESTID = void 0;
|
|
9
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _reactIntlNext = require("react-intl-next");
|
|
12
|
+
var _emoji = require("@atlaskit/emoji");
|
|
13
|
+
var _primitives = require("@atlaskit/primitives");
|
|
14
|
+
var _i18n = require("../../shared/i18n");
|
|
15
|
+
var _Counter = require("../Counter");
|
|
16
|
+
var _Reaction = require("../Reaction");
|
|
17
|
+
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); }
|
|
18
|
+
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 && Object.prototype.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; }
|
|
19
|
+
var emojiStyle = (0, _primitives.xcss)({
|
|
20
|
+
transformOrigin: 'center center 0',
|
|
21
|
+
lineHeight: '12px'
|
|
22
|
+
});
|
|
23
|
+
var buttonStyle = (0, _primitives.xcss)({
|
|
24
|
+
paddingTop: 'space.050',
|
|
25
|
+
paddingRight: 'space.050',
|
|
26
|
+
paddingBottom: 'space.050',
|
|
27
|
+
paddingLeft: 'space.100'
|
|
28
|
+
});
|
|
29
|
+
var containerStyle = (0, _primitives.xcss)({
|
|
30
|
+
position: 'relative'
|
|
31
|
+
});
|
|
32
|
+
/**
|
|
33
|
+
* Test id for summary reaction wrapper button
|
|
34
|
+
*/
|
|
35
|
+
var RENDER_SUMMARY_BUTTON_TESTID = exports.RENDER_SUMMARY_BUTTON_TESTID = 'reaction-summary-button';
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Test id for emojis displayed inside summary button. All emoji's in the summary button will have this test id
|
|
39
|
+
*/
|
|
40
|
+
var RENDER_SUMMARY_EMOJI_TESTID = exports.RENDER_SUMMARY_EMOJI_TESTID = 'summary-emoji-display';
|
|
41
|
+
|
|
42
|
+
// forwardRef is used here so that the parent popup component can properly interact with the button
|
|
43
|
+
var ReactionSummaryButton = exports.ReactionSummaryButton = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
44
|
+
var emojiProvider = _ref.emojiProvider,
|
|
45
|
+
_ref$reactions = _ref.reactions,
|
|
46
|
+
reactions = _ref$reactions === void 0 ? [] : _ref$reactions,
|
|
47
|
+
_ref$emojisToShow = _ref.emojisToShow,
|
|
48
|
+
emojisToShow = _ref$emojisToShow === void 0 ? 3 : _ref$emojisToShow,
|
|
49
|
+
onClick = _ref.onClick;
|
|
50
|
+
var intl = (0, _reactIntlNext.useIntl)();
|
|
51
|
+
|
|
52
|
+
// Helper function to sort reactions by count and return top N
|
|
53
|
+
var getTopReactions = function getTopReactions(reactions, topN) {
|
|
54
|
+
return (0, _toConsumableArray2.default)(reactions).sort(function (a, b) {
|
|
55
|
+
return b.count - a.count;
|
|
56
|
+
}).slice(0, topN);
|
|
57
|
+
};
|
|
58
|
+
var totalReactionsCount = (0, _react.useMemo)(function () {
|
|
59
|
+
return reactions.reduce(function (accum, current) {
|
|
60
|
+
return accum += (current === null || current === void 0 ? void 0 : current.count) || 0;
|
|
61
|
+
}, 0);
|
|
62
|
+
}, [reactions]);
|
|
63
|
+
var topReactions = (0, _react.useMemo)(function () {
|
|
64
|
+
return getTopReactions(reactions, emojisToShow);
|
|
65
|
+
}, [emojisToShow, reactions]);
|
|
66
|
+
return /*#__PURE__*/_react.default.createElement(_primitives.Box, {
|
|
67
|
+
xcss: containerStyle,
|
|
68
|
+
ref: ref
|
|
69
|
+
}, /*#__PURE__*/_react.default.createElement(_Reaction.ReactionButton, {
|
|
70
|
+
onClick: onClick,
|
|
71
|
+
testId: RENDER_SUMMARY_BUTTON_TESTID,
|
|
72
|
+
ariaLabel: intl.formatMessage(_i18n.messages.summary)
|
|
73
|
+
}, /*#__PURE__*/_react.default.createElement(_primitives.Inline, {
|
|
74
|
+
space: "space.050",
|
|
75
|
+
xcss: buttonStyle
|
|
76
|
+
}, topReactions.map(function (reaction) {
|
|
77
|
+
return /*#__PURE__*/_react.default.createElement(_primitives.Box, {
|
|
78
|
+
xcss: emojiStyle,
|
|
79
|
+
testId: RENDER_SUMMARY_EMOJI_TESTID
|
|
80
|
+
}, /*#__PURE__*/_react.default.createElement(_emoji.ResourcedEmoji, {
|
|
81
|
+
key: reaction.emojiId,
|
|
82
|
+
emojiProvider: emojiProvider,
|
|
83
|
+
emojiId: {
|
|
84
|
+
id: reaction.emojiId,
|
|
85
|
+
shortName: ''
|
|
86
|
+
},
|
|
87
|
+
fitToHeight: 16
|
|
88
|
+
}));
|
|
89
|
+
})), /*#__PURE__*/_react.default.createElement(_Counter.Counter, {
|
|
90
|
+
value: totalReactionsCount
|
|
91
|
+
})));
|
|
92
|
+
});
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.ReactionSummaryView = exports.RENDER_SUMMARY_VIEW_POPUP_TESTID = void 0;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
+
var _popup = _interopRequireDefault(require("@atlaskit/popup"));
|
|
12
|
+
var _primitives = require("@atlaskit/primitives");
|
|
13
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
14
|
+
var _Reaction = require("../Reaction");
|
|
15
|
+
var _ReactionSummaryButton = require("./ReactionSummaryButton");
|
|
16
|
+
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); }
|
|
17
|
+
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 && Object.prototype.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; }
|
|
18
|
+
var summaryPopupStyles = (0, _primitives.xcss)({
|
|
19
|
+
padding: 'space.100',
|
|
20
|
+
maxWidth: '400px'
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Test id for the Reactions summary view popup
|
|
25
|
+
*/
|
|
26
|
+
var RENDER_SUMMARY_VIEW_POPUP_TESTID = exports.RENDER_SUMMARY_VIEW_POPUP_TESTID = 'render-summary-view-popup';
|
|
27
|
+
var ReactionSummaryView = exports.ReactionSummaryView = function ReactionSummaryView(_ref) {
|
|
28
|
+
var emojiProvider = _ref.emojiProvider,
|
|
29
|
+
_ref$reactions = _ref.reactions,
|
|
30
|
+
reactions = _ref$reactions === void 0 ? [] : _ref$reactions,
|
|
31
|
+
_ref$flash = _ref.flash,
|
|
32
|
+
flash = _ref$flash === void 0 ? {} : _ref$flash,
|
|
33
|
+
_ref$particleEffectBy = _ref.particleEffectByEmoji,
|
|
34
|
+
particleEffectByEmoji = _ref$particleEffectBy === void 0 ? {} : _ref$particleEffectBy,
|
|
35
|
+
handleOpenReactionsDialog = _ref.handleOpenReactionsDialog,
|
|
36
|
+
allowUserDialog = _ref.allowUserDialog,
|
|
37
|
+
_ref$placement = _ref.placement,
|
|
38
|
+
placement = _ref$placement === void 0 ? 'auto-start' : _ref$placement,
|
|
39
|
+
onReactionClick = _ref.onReactionClick,
|
|
40
|
+
onReactionFocused = _ref.onReactionFocused,
|
|
41
|
+
onReactionMouseEnter = _ref.onReactionMouseEnter;
|
|
42
|
+
var _useState = (0, _react.useState)(false),
|
|
43
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
44
|
+
isSummaryPopupOpen = _useState2[0],
|
|
45
|
+
setSummaryPopupOpen = _useState2[1];
|
|
46
|
+
var handlePopupClose = (0, _react.useCallback)(function () {
|
|
47
|
+
return setSummaryPopupOpen(false);
|
|
48
|
+
}, []);
|
|
49
|
+
var handleSummaryClick = (0, _react.useCallback)(function () {
|
|
50
|
+
return setSummaryPopupOpen(true);
|
|
51
|
+
}, []);
|
|
52
|
+
return /*#__PURE__*/_react.default.createElement(_popup.default, {
|
|
53
|
+
placement: placement,
|
|
54
|
+
content: function content() {
|
|
55
|
+
return /*#__PURE__*/_react.default.createElement(_primitives.Inline, {
|
|
56
|
+
xcss: summaryPopupStyles,
|
|
57
|
+
testId: RENDER_SUMMARY_VIEW_POPUP_TESTID,
|
|
58
|
+
space: "space.025",
|
|
59
|
+
shouldWrap: true
|
|
60
|
+
}, reactions.map(function (reaction) {
|
|
61
|
+
return /*#__PURE__*/_react.default.createElement(_Reaction.Reaction, {
|
|
62
|
+
key: reaction.emojiId,
|
|
63
|
+
reaction: reaction,
|
|
64
|
+
emojiProvider: emojiProvider,
|
|
65
|
+
onClick: onReactionClick,
|
|
66
|
+
onFocused: onReactionFocused,
|
|
67
|
+
onMouseEnter: onReactionMouseEnter,
|
|
68
|
+
flash: flash[reaction.emojiId],
|
|
69
|
+
handleUserListClick: handleOpenReactionsDialog,
|
|
70
|
+
allowUserDialog: allowUserDialog,
|
|
71
|
+
showParticleEffect: particleEffectByEmoji[reaction.emojiId]
|
|
72
|
+
});
|
|
73
|
+
}));
|
|
74
|
+
},
|
|
75
|
+
isOpen: isSummaryPopupOpen,
|
|
76
|
+
onClose: handlePopupClose,
|
|
77
|
+
trigger: function trigger(triggerProps) {
|
|
78
|
+
return /*#__PURE__*/_react.default.createElement(_ReactionSummaryButton.ReactionSummaryButton, (0, _extends2.default)({}, triggerProps, {
|
|
79
|
+
emojiProvider: emojiProvider,
|
|
80
|
+
reactions: reactions,
|
|
81
|
+
onClick: handleSummaryClick
|
|
82
|
+
}));
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "ReactionSummaryView", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _ReactionSummaryView.ReactionSummaryView;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _ReactionSummaryView = require("./ReactionSummaryView");
|
|
@@ -5,7 +5,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.Reactions = exports.RENDER_VIEWALL_REACTED_USERS_DIALOG = exports.RENDER_REACTIONS_TESTID = void 0;
|
|
8
|
+
exports.Reactions = exports.RENDER_VIEWALL_REACTED_USERS_DIALOG = exports.RENDER_REACTIONS_TESTID = exports.RENDER_REACTIONS_SUMMARY_TESTID = void 0;
|
|
9
9
|
exports.getTooltip = getTooltip;
|
|
10
10
|
exports.ufoExperiences = void 0;
|
|
11
11
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
@@ -25,6 +25,7 @@ var _Reaction = require("../Reaction");
|
|
|
25
25
|
var _ReactionDialog = require("../ReactionDialog");
|
|
26
26
|
var _ReactionPicker = require("../ReactionPicker");
|
|
27
27
|
var _styles = require("./styles");
|
|
28
|
+
var _ReactionSummary = require("../ReactionSummary/");
|
|
28
29
|
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); }
|
|
29
30
|
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 && Object.prototype.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; }
|
|
30
31
|
/** @jsx jsx */
|
|
@@ -57,6 +58,11 @@ var RENDER_REACTIONS_TESTID = exports.RENDER_REACTIONS_TESTID = 'render-reaction
|
|
|
57
58
|
* Test id for the view all reacted user to trigger the dialog
|
|
58
59
|
*/
|
|
59
60
|
var RENDER_VIEWALL_REACTED_USERS_DIALOG = exports.RENDER_VIEWALL_REACTED_USERS_DIALOG = 'viewall-reacted-users-dialog';
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Test id for summary view of reactions
|
|
64
|
+
*/
|
|
65
|
+
var RENDER_REACTIONS_SUMMARY_TESTID = exports.RENDER_REACTIONS_SUMMARY_TESTID = 'reaction-summary-view';
|
|
60
66
|
/**
|
|
61
67
|
* Get content of the tooltip
|
|
62
68
|
*/
|
|
@@ -108,7 +114,11 @@ var Reactions = exports.Reactions = /*#__PURE__*/_react.default.memo(function (_
|
|
|
108
114
|
_ref$emojiPickerSize = _ref.emojiPickerSize,
|
|
109
115
|
emojiPickerSize = _ref$emojiPickerSize === void 0 ? 'medium' : _ref$emojiPickerSize,
|
|
110
116
|
_ref$miniMode = _ref.miniMode,
|
|
111
|
-
miniMode = _ref$miniMode === void 0 ? false : _ref$miniMode
|
|
117
|
+
miniMode = _ref$miniMode === void 0 ? false : _ref$miniMode,
|
|
118
|
+
_ref$summaryViewEnabl = _ref.summaryViewEnabled,
|
|
119
|
+
summaryViewEnabled = _ref$summaryViewEnabl === void 0 ? false : _ref$summaryViewEnabl,
|
|
120
|
+
_ref$summaryViewThres = _ref.summaryViewThreshold,
|
|
121
|
+
summaryViewThreshold = _ref$summaryViewThres === void 0 ? 3 : _ref$summaryViewThres;
|
|
112
122
|
var _useState = (0, _react.useState)(),
|
|
113
123
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
114
124
|
selectedEmojiId = _useState2[0],
|
|
@@ -261,12 +271,25 @@ var Reactions = exports.Reactions = /*#__PURE__*/_react.default.memo(function (_
|
|
|
261
271
|
});
|
|
262
272
|
return reactions.concat(items);
|
|
263
273
|
}, [quickReactionEmojis, reactions]);
|
|
274
|
+
var shouldShowSummaryView = summaryViewEnabled && memorizedReactions.length >= summaryViewThreshold && memorizedReactions.length > 0;
|
|
264
275
|
return (
|
|
265
276
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
266
277
|
(0, _react2.jsx)("div", {
|
|
267
278
|
css: _styles.wrapperStyle,
|
|
268
279
|
"data-testid": RENDER_REACTIONS_TESTID
|
|
269
|
-
},
|
|
280
|
+
}, shouldShowSummaryView ? (0, _react2.jsx)("div", {
|
|
281
|
+
"data-testid": RENDER_REACTIONS_SUMMARY_TESTID
|
|
282
|
+
}, (0, _react2.jsx)(_ReactionSummary.ReactionSummaryView, {
|
|
283
|
+
reactions: memorizedReactions,
|
|
284
|
+
emojiProvider: emojiProvider,
|
|
285
|
+
flash: flash,
|
|
286
|
+
particleEffectByEmoji: particleEffectByEmoji,
|
|
287
|
+
handleOpenReactionsDialog: handleOpenReactionsDialog,
|
|
288
|
+
allowUserDialog: allowUserDialog,
|
|
289
|
+
onReactionClick: onReactionClick,
|
|
290
|
+
onReactionFocused: handleReactionFocused,
|
|
291
|
+
onReactionMouseEnter: handleReactionMouseEnter
|
|
292
|
+
})) : memorizedReactions.map(function (reaction) {
|
|
270
293
|
return (0, _react2.jsx)(_Reaction.Reaction, {
|
|
271
294
|
key: reaction.emojiId,
|
|
272
295
|
reaction: reaction,
|
|
@@ -33,6 +33,7 @@ var UfoErrorBoundary = exports.UfoErrorBoundary = /*#__PURE__*/function (_React$
|
|
|
33
33
|
_step;
|
|
34
34
|
try {
|
|
35
35
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
36
|
+
var _errorInfo$componentS;
|
|
36
37
|
var exp = _step.value;
|
|
37
38
|
exp.failure({
|
|
38
39
|
metadata: {
|
|
@@ -41,7 +42,7 @@ var UfoErrorBoundary = exports.UfoErrorBoundary = /*#__PURE__*/function (_React$
|
|
|
41
42
|
error: {
|
|
42
43
|
name: error.name,
|
|
43
44
|
message: error.message,
|
|
44
|
-
infoStack: errorInfo.componentStack
|
|
45
|
+
infoStack: (_errorInfo$componentS = errorInfo.componentStack) !== null && _errorInfo$componentS !== void 0 ? _errorInfo$componentS : undefined
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
48
|
});
|
package/dist/cjs/shared/i18n.js
CHANGED
|
@@ -31,6 +31,11 @@ var messages = exports.messages = (0, _reactIntlNext.defineMessages)({
|
|
|
31
31
|
defaultMessage: 'React with {emoji} emoji',
|
|
32
32
|
description: 'Aria label on reaction button'
|
|
33
33
|
},
|
|
34
|
+
summary: {
|
|
35
|
+
id: 'fabric.reactions.summary',
|
|
36
|
+
defaultMessage: 'View all user reactions',
|
|
37
|
+
description: 'Aria label on summary reaction button. Clicking this button shows who reacted in a popup'
|
|
38
|
+
},
|
|
34
39
|
unexpectedError: {
|
|
35
40
|
id: 'fabric.reactions.error.unexpected',
|
|
36
41
|
defaultMessage: 'Reactions are temporarily unavailable',
|
|
@@ -24,7 +24,7 @@ const getReactionKey = (containerAri, ari) => {
|
|
|
24
24
|
};
|
|
25
25
|
const defaultUsers = [getUser('oscar', 'Oscar Wallhult'), getUser('julien', 'Julien Michel Hoarau'), getUser('craig', 'Craig Petchell'), getUser('jerome', 'Jerome Touffe-Blin'), getUser('esoares', 'Eduardo Soares'), getUser('lpereira', 'Luiz Pereira'), getUser('pcurren', 'Paul Curren'), getUser('ttjandra', 'Tara Tjandra'), getUser('severington', 'Ste Everington'), getUser('sguillope', 'Sylvain Guillope'), getUser('alunnon', 'Alex Lunnon'), getUser('bsmith', 'Bob Smith'), getUser('jdoe', 'Jane Doe'), getUser('mhomes', 'Mary Homes'), getUser('ckent', 'Clark Kent')];
|
|
26
26
|
export const simpleMockData = {
|
|
27
|
-
[getReactionKey(containerAri, ari)]: [getReactionSummary(':fire:', 1, true), getReactionSummary(':
|
|
27
|
+
[getReactionKey(containerAri, ari)]: [getReactionSummary(':fire:', 1, true), getReactionSummary(':astonished:', 99, false), getReactionSummary(':heart:', 44, false) // Widest character
|
|
28
28
|
]
|
|
29
29
|
};
|
|
30
30
|
const extendedMockData = {
|
|
@@ -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 = "22.
|
|
4
|
+
const packageVersion = "22.8.0";
|
|
5
5
|
/**
|
|
6
6
|
* TODO: move to utility package?
|
|
7
7
|
* A random sampling function
|