@atlaskit/reactions 35.12.9 → 35.12.10
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 +8 -0
- package/dist/cjs/analytics/index.js +1 -1
- package/dist/cjs/components/Reactions.js +38 -35
- package/dist/cjs/shared/i18n.js +5 -0
- package/dist/es2019/analytics/index.js +1 -1
- package/dist/es2019/components/Reactions.js +32 -35
- package/dist/es2019/shared/i18n.js +5 -0
- package/dist/esm/analytics/index.js +1 -1
- package/dist/esm/components/Reactions.js +39 -36
- package/dist/esm/shared/i18n.js +5 -0
- package/dist/types/shared/i18n.d.ts +5 -0
- package/package.json +7 -4
- package/reactions.docs.tsx +0 -74
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/reactions
|
|
2
2
|
|
|
3
|
+
## 35.12.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`26d8af3468aee`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/26d8af3468aee) -
|
|
8
|
+
Group added reaction controls with an accessible name behind
|
|
9
|
+
platform_reactions_a11y_group_added_reactions
|
|
10
|
+
|
|
3
11
|
## 35.12.9
|
|
4
12
|
|
|
5
13
|
### Patch 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; } // eslint-disable-next-line @typescript-eslint/consistent-type-imports
|
|
13
13
|
var packageName = "@atlaskit/reactions";
|
|
14
|
-
var packageVersion = "35.12.
|
|
14
|
+
var packageVersion = "35.12.10";
|
|
15
15
|
/**
|
|
16
16
|
* TODO: move to utility package?
|
|
17
17
|
* A random sampling function
|
|
@@ -18,7 +18,7 @@ var _reactIntl = require("react-intl");
|
|
|
18
18
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
19
19
|
var _modalDialog = require("@atlaskit/modal-dialog");
|
|
20
20
|
var _segment = _interopRequireDefault(require("@atlaskit/react-ufo/segment"));
|
|
21
|
-
var
|
|
21
|
+
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
22
22
|
var _analytics = require("../analytics");
|
|
23
23
|
var _constants = require("../shared/constants");
|
|
24
24
|
var _i18n = require("../shared/i18n");
|
|
@@ -155,6 +155,7 @@ var Reactions = exports.Reactions = /*#__PURE__*/_react.default.memo(function (_
|
|
|
155
155
|
_ref$renderParticleEf = _ref.renderParticleEffectOnSummaryView,
|
|
156
156
|
renderParticleEffectOnSummaryView = _ref$renderParticleEf === void 0 ? false : _ref$renderParticleEf,
|
|
157
157
|
reactionPickerPopperZIndex = _ref.reactionPickerPopperZIndex;
|
|
158
|
+
var intl = (0, _reactIntl.useIntl)();
|
|
158
159
|
var _useState = (0, _react.useState)(''),
|
|
159
160
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
160
161
|
selectedEmojiId = _useState2[0],
|
|
@@ -335,6 +336,39 @@ var Reactions = exports.Reactions = /*#__PURE__*/_react.default.memo(function (_
|
|
|
335
336
|
}
|
|
336
337
|
});
|
|
337
338
|
};
|
|
339
|
+
var renderReactionItem = function renderReactionItem(reaction, rootElement) {
|
|
340
|
+
return /*#__PURE__*/_react.default.createElement(_Reaction.Reaction, {
|
|
341
|
+
key: reaction.emojiId,
|
|
342
|
+
rootElement: rootElement,
|
|
343
|
+
reaction: reaction,
|
|
344
|
+
emojiProvider: emojiProvider,
|
|
345
|
+
onClick: onReactionClick,
|
|
346
|
+
onMouseEnter: handleReactionMouseEnter,
|
|
347
|
+
onFocused: handleReactionFocused,
|
|
348
|
+
flash: flash[reaction.emojiId],
|
|
349
|
+
showParticleEffect: particleEffectByEmoji[reaction.emojiId],
|
|
350
|
+
showOpaqueBackground: showOpaqueBackground,
|
|
351
|
+
allowUserDialog: allowUserDialog && hasEmojiWithFivePlusReactions,
|
|
352
|
+
handleOpenReactionsDialog: _handleOpenReactionsDialog,
|
|
353
|
+
isViewOnly: isViewOnly,
|
|
354
|
+
showSubtleStyle: showSubtleDefaultReactions && reactions.length === 0,
|
|
355
|
+
optimisticImageURL: (0, _fg.fg)('platform_reactions_optimistic_url') ? getOptimisticImageURL === null || getOptimisticImageURL === void 0 ? void 0 : getOptimisticImageURL(reaction.emojiId) : undefined
|
|
356
|
+
});
|
|
357
|
+
};
|
|
358
|
+
var renderReactionGroup = function renderReactionGroup() {
|
|
359
|
+
var shouldRenderReactionList = (0, _fg.fg)('jfp_a11y_team_comment_actions_semantic');
|
|
360
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
361
|
+
role: "group",
|
|
362
|
+
"aria-label": intl.formatMessage(_i18n.messages.addedReaction),
|
|
363
|
+
className: (0, _runtime.ax)([!shouldRenderReactionList && "_qtt8glyw _19pkidpf _2hwxidpf _otyridpf _18u0idpf _ca0qidpf _u5f3idpf _n3tdidpf _19bvidpf _1e0c1txw _1n261g80 _4cvr1h6o _kqswh2mm", !shouldRenderReactionList && noWrap && "_1n261q9c"])
|
|
364
|
+
}, shouldRenderReactionList ? /*#__PURE__*/_react.default.createElement("ul", {
|
|
365
|
+
className: (0, _runtime.ax)(["_qtt8glyw _19pkidpf _2hwxidpf _otyridpf _18u0idpf _ca0qidpf _u5f3idpf _n3tdidpf _19bvidpf _1e0c1txw _1n261g80 _4cvr1h6o _kqswh2mm", noWrap && "_1n261q9c"])
|
|
366
|
+
}, memorizedReactions.map(function (reaction) {
|
|
367
|
+
return renderReactionItem(reaction, 'li');
|
|
368
|
+
})) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, memorizedReactions.map(function (reaction) {
|
|
369
|
+
return renderReactionItem(reaction);
|
|
370
|
+
})));
|
|
371
|
+
};
|
|
338
372
|
return /*#__PURE__*/_react.default.createElement(_segment.default, {
|
|
339
373
|
name: "reactions"
|
|
340
374
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -373,43 +407,12 @@ var Reactions = exports.Reactions = /*#__PURE__*/_react.default.memo(function (_
|
|
|
373
407
|
summaryGetOptimisticImageURL: summaryGetOptimisticImageURL,
|
|
374
408
|
summaryButtonIconAfter: summaryButtonIconAfter,
|
|
375
409
|
summaryViewParticleEffectEmojiId: renderParticleEffectOnSummaryView ? summaryViewParticleEffectEmojiId : null
|
|
376
|
-
})) : (0,
|
|
410
|
+
})) : reactions.length > 0 && (0, _fg.fg)('platform_reactions_a11y_group_added_reactions') ? renderReactionGroup() : (0, _fg.fg)('jfp_a11y_team_comment_actions_semantic') ? /*#__PURE__*/_react.default.createElement("ul", {
|
|
377
411
|
className: (0, _runtime.ax)(["_qtt8glyw _19pkidpf _2hwxidpf _otyridpf _18u0idpf _ca0qidpf _u5f3idpf _n3tdidpf _19bvidpf _1e0c1txw _1n261g80 _4cvr1h6o _kqswh2mm"])
|
|
378
412
|
}, memorizedReactions.map(function (reaction) {
|
|
379
|
-
return
|
|
380
|
-
key: reaction.emojiId,
|
|
381
|
-
rootElement: "li",
|
|
382
|
-
reaction: reaction,
|
|
383
|
-
emojiProvider: emojiProvider,
|
|
384
|
-
onClick: onReactionClick,
|
|
385
|
-
onMouseEnter: handleReactionMouseEnter,
|
|
386
|
-
onFocused: handleReactionFocused,
|
|
387
|
-
flash: flash[reaction.emojiId],
|
|
388
|
-
showParticleEffect: particleEffectByEmoji[reaction.emojiId],
|
|
389
|
-
showOpaqueBackground: showOpaqueBackground,
|
|
390
|
-
allowUserDialog: allowUserDialog && hasEmojiWithFivePlusReactions,
|
|
391
|
-
handleOpenReactionsDialog: _handleOpenReactionsDialog,
|
|
392
|
-
isViewOnly: isViewOnly,
|
|
393
|
-
showSubtleStyle: showSubtleDefaultReactions && reactions.length === 0,
|
|
394
|
-
optimisticImageURL: (0, _platformFeatureFlags.fg)('platform_reactions_optimistic_url') ? getOptimisticImageURL === null || getOptimisticImageURL === void 0 ? void 0 : getOptimisticImageURL(reaction.emojiId) : undefined
|
|
395
|
-
});
|
|
413
|
+
return renderReactionItem(reaction, 'li');
|
|
396
414
|
})) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, memorizedReactions.map(function (reaction) {
|
|
397
|
-
return
|
|
398
|
-
key: reaction.emojiId,
|
|
399
|
-
reaction: reaction,
|
|
400
|
-
emojiProvider: emojiProvider,
|
|
401
|
-
onClick: onReactionClick,
|
|
402
|
-
onMouseEnter: handleReactionMouseEnter,
|
|
403
|
-
onFocused: handleReactionFocused,
|
|
404
|
-
flash: flash[reaction.emojiId],
|
|
405
|
-
showParticleEffect: particleEffectByEmoji[reaction.emojiId],
|
|
406
|
-
showOpaqueBackground: showOpaqueBackground,
|
|
407
|
-
allowUserDialog: allowUserDialog && hasEmojiWithFivePlusReactions,
|
|
408
|
-
handleOpenReactionsDialog: _handleOpenReactionsDialog,
|
|
409
|
-
isViewOnly: isViewOnly,
|
|
410
|
-
showSubtleStyle: showSubtleDefaultReactions && reactions.length === 0,
|
|
411
|
-
optimisticImageURL: (0, _platformFeatureFlags.fg)('platform_reactions_optimistic_url') ? getOptimisticImageURL === null || getOptimisticImageURL === void 0 ? void 0 : getOptimisticImageURL(reaction.emojiId) : undefined
|
|
412
|
-
});
|
|
415
|
+
return renderReactionItem(reaction);
|
|
413
416
|
}))), shouldShowPicker && /*#__PURE__*/_react.default.createElement(_ReactionPicker.ReactionPicker, {
|
|
414
417
|
emojiProvider: emojiProvider,
|
|
415
418
|
allowAllEmojis: allowAllEmojis,
|
package/dist/cjs/shared/i18n.js
CHANGED
|
@@ -11,6 +11,11 @@ var messages = exports.messages = (0, _reactIntl.defineMessages)({
|
|
|
11
11
|
defaultMessage: 'Add reaction',
|
|
12
12
|
description: 'Label for the add reaction button that opens the emoji picker for users to choose a reaction.'
|
|
13
13
|
},
|
|
14
|
+
addedReaction: {
|
|
15
|
+
id: 'reactions.shared.i18n.addedReaction',
|
|
16
|
+
defaultMessage: 'Added reaction',
|
|
17
|
+
description: 'Accessible label for the group of added reaction toggle buttons displayed with a comment or content item.'
|
|
18
|
+
},
|
|
14
19
|
addNewReaction: {
|
|
15
20
|
id: 'fabric.reactions.add.new',
|
|
16
21
|
defaultMessage: 'Add new',
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { createAndFireEvent } from '@atlaskit/analytics-next';
|
|
3
3
|
import { UI_EVENT_TYPE, OPERATIONAL_EVENT_TYPE } from '@atlaskit/analytics-gas-types';
|
|
4
4
|
const packageName = "@atlaskit/reactions";
|
|
5
|
-
const packageVersion = "35.12.
|
|
5
|
+
const packageVersion = "35.12.10";
|
|
6
6
|
/**
|
|
7
7
|
* TODO: move to utility package?
|
|
8
8
|
* A random sampling function
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import "./Reactions.compiled.css";
|
|
3
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
4
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
5
|
-
import { FormattedMessage } from 'react-intl';
|
|
5
|
+
import { FormattedMessage, useIntl } from 'react-intl';
|
|
6
6
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
7
7
|
import { ModalTransition } from '@atlaskit/modal-dialog';
|
|
8
8
|
import UFOSegment from '@atlaskit/react-ufo/segment';
|
|
9
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
10
10
|
import { createAndFireSafe, createPickerButtonClickedEvent, createPickerCancelledEvent, createPickerMoreClickedEvent, createReactionsRenderedEvent, createReactionSelectionEvent, isSampled } from '../analytics';
|
|
11
11
|
import { SAMPLING_RATE_REACTIONS_RENDERED_EXP } from '../shared/constants';
|
|
12
12
|
import { messages } from '../shared/i18n';
|
|
@@ -118,6 +118,7 @@ export const Reactions = /*#__PURE__*/React.memo(({
|
|
|
118
118
|
renderParticleEffectOnSummaryView = false,
|
|
119
119
|
reactionPickerPopperZIndex
|
|
120
120
|
}) => {
|
|
121
|
+
const intl = useIntl();
|
|
121
122
|
const [selectedEmojiId, setSelectedEmojiId] = useState('');
|
|
122
123
|
const [summaryViewParticleEffectEmojiId, setSummaryViewParticleEffectEmojiId] = useState(null);
|
|
123
124
|
|
|
@@ -281,6 +282,33 @@ export const Reactions = /*#__PURE__*/React.memo(({
|
|
|
281
282
|
}
|
|
282
283
|
});
|
|
283
284
|
};
|
|
285
|
+
const renderReactionItem = (reaction, rootElement) => /*#__PURE__*/React.createElement(Reaction, {
|
|
286
|
+
key: reaction.emojiId,
|
|
287
|
+
rootElement: rootElement,
|
|
288
|
+
reaction: reaction,
|
|
289
|
+
emojiProvider: emojiProvider,
|
|
290
|
+
onClick: onReactionClick,
|
|
291
|
+
onMouseEnter: handleReactionMouseEnter,
|
|
292
|
+
onFocused: handleReactionFocused,
|
|
293
|
+
flash: flash[reaction.emojiId],
|
|
294
|
+
showParticleEffect: particleEffectByEmoji[reaction.emojiId],
|
|
295
|
+
showOpaqueBackground: showOpaqueBackground,
|
|
296
|
+
allowUserDialog: allowUserDialog && hasEmojiWithFivePlusReactions,
|
|
297
|
+
handleOpenReactionsDialog: handleOpenReactionsDialog,
|
|
298
|
+
isViewOnly: isViewOnly,
|
|
299
|
+
showSubtleStyle: showSubtleDefaultReactions && reactions.length === 0,
|
|
300
|
+
optimisticImageURL: fg('platform_reactions_optimistic_url') ? getOptimisticImageURL === null || getOptimisticImageURL === void 0 ? void 0 : getOptimisticImageURL(reaction.emojiId) : undefined
|
|
301
|
+
});
|
|
302
|
+
const renderReactionGroup = () => {
|
|
303
|
+
const shouldRenderReactionList = fg('jfp_a11y_team_comment_actions_semantic');
|
|
304
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
305
|
+
role: "group",
|
|
306
|
+
"aria-label": intl.formatMessage(messages.addedReaction),
|
|
307
|
+
className: ax([!shouldRenderReactionList && "_qtt8glyw _19pkidpf _2hwxidpf _otyridpf _18u0idpf _ca0qidpf _u5f3idpf _n3tdidpf _19bvidpf _1e0c1txw _1n261g80 _4cvr1h6o _kqswh2mm", !shouldRenderReactionList && noWrap && "_1n261q9c"])
|
|
308
|
+
}, shouldRenderReactionList ? /*#__PURE__*/React.createElement("ul", {
|
|
309
|
+
className: ax(["_qtt8glyw _19pkidpf _2hwxidpf _otyridpf _18u0idpf _ca0qidpf _u5f3idpf _n3tdidpf _19bvidpf _1e0c1txw _1n261g80 _4cvr1h6o _kqswh2mm", noWrap && "_1n261q9c"])
|
|
310
|
+
}, memorizedReactions.map(reaction => renderReactionItem(reaction, 'li'))) : /*#__PURE__*/React.createElement(React.Fragment, null, memorizedReactions.map(reaction => renderReactionItem(reaction))));
|
|
311
|
+
};
|
|
284
312
|
return /*#__PURE__*/React.createElement(UFOSegment, {
|
|
285
313
|
name: "reactions"
|
|
286
314
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -317,40 +345,9 @@ export const Reactions = /*#__PURE__*/React.memo(({
|
|
|
317
345
|
summaryGetOptimisticImageURL: summaryGetOptimisticImageURL,
|
|
318
346
|
summaryButtonIconAfter: summaryButtonIconAfter,
|
|
319
347
|
summaryViewParticleEffectEmojiId: renderParticleEffectOnSummaryView ? summaryViewParticleEffectEmojiId : null
|
|
320
|
-
})) : fg('jfp_a11y_team_comment_actions_semantic') ? /*#__PURE__*/React.createElement("ul", {
|
|
348
|
+
})) : reactions.length > 0 && fg('platform_reactions_a11y_group_added_reactions') ? renderReactionGroup() : fg('jfp_a11y_team_comment_actions_semantic') ? /*#__PURE__*/React.createElement("ul", {
|
|
321
349
|
className: ax(["_qtt8glyw _19pkidpf _2hwxidpf _otyridpf _18u0idpf _ca0qidpf _u5f3idpf _n3tdidpf _19bvidpf _1e0c1txw _1n261g80 _4cvr1h6o _kqswh2mm"])
|
|
322
|
-
}, memorizedReactions.map(reaction => /*#__PURE__*/React.createElement(
|
|
323
|
-
key: reaction.emojiId,
|
|
324
|
-
rootElement: "li",
|
|
325
|
-
reaction: reaction,
|
|
326
|
-
emojiProvider: emojiProvider,
|
|
327
|
-
onClick: onReactionClick,
|
|
328
|
-
onMouseEnter: handleReactionMouseEnter,
|
|
329
|
-
onFocused: handleReactionFocused,
|
|
330
|
-
flash: flash[reaction.emojiId],
|
|
331
|
-
showParticleEffect: particleEffectByEmoji[reaction.emojiId],
|
|
332
|
-
showOpaqueBackground: showOpaqueBackground,
|
|
333
|
-
allowUserDialog: allowUserDialog && hasEmojiWithFivePlusReactions,
|
|
334
|
-
handleOpenReactionsDialog: handleOpenReactionsDialog,
|
|
335
|
-
isViewOnly: isViewOnly,
|
|
336
|
-
showSubtleStyle: showSubtleDefaultReactions && reactions.length === 0,
|
|
337
|
-
optimisticImageURL: fg('platform_reactions_optimistic_url') ? getOptimisticImageURL === null || getOptimisticImageURL === void 0 ? void 0 : getOptimisticImageURL(reaction.emojiId) : undefined
|
|
338
|
-
}))) : /*#__PURE__*/React.createElement(React.Fragment, null, memorizedReactions.map(reaction => /*#__PURE__*/React.createElement(Reaction, {
|
|
339
|
-
key: reaction.emojiId,
|
|
340
|
-
reaction: reaction,
|
|
341
|
-
emojiProvider: emojiProvider,
|
|
342
|
-
onClick: onReactionClick,
|
|
343
|
-
onMouseEnter: handleReactionMouseEnter,
|
|
344
|
-
onFocused: handleReactionFocused,
|
|
345
|
-
flash: flash[reaction.emojiId],
|
|
346
|
-
showParticleEffect: particleEffectByEmoji[reaction.emojiId],
|
|
347
|
-
showOpaqueBackground: showOpaqueBackground,
|
|
348
|
-
allowUserDialog: allowUserDialog && hasEmojiWithFivePlusReactions,
|
|
349
|
-
handleOpenReactionsDialog: handleOpenReactionsDialog,
|
|
350
|
-
isViewOnly: isViewOnly,
|
|
351
|
-
showSubtleStyle: showSubtleDefaultReactions && reactions.length === 0,
|
|
352
|
-
optimisticImageURL: fg('platform_reactions_optimistic_url') ? getOptimisticImageURL === null || getOptimisticImageURL === void 0 ? void 0 : getOptimisticImageURL(reaction.emojiId) : undefined
|
|
353
|
-
})))), shouldShowPicker && /*#__PURE__*/React.createElement(ReactionPicker, {
|
|
350
|
+
}, memorizedReactions.map(reaction => renderReactionItem(reaction, 'li'))) : /*#__PURE__*/React.createElement(React.Fragment, null, memorizedReactions.map(reaction => renderReactionItem(reaction)))), shouldShowPicker && /*#__PURE__*/React.createElement(ReactionPicker, {
|
|
354
351
|
emojiProvider: emojiProvider,
|
|
355
352
|
allowAllEmojis: allowAllEmojis,
|
|
356
353
|
pickerQuickReactionEmojiIds: pickerQuickReactionEmojiIds,
|
|
@@ -5,6 +5,11 @@ export const messages = defineMessages({
|
|
|
5
5
|
defaultMessage: 'Add reaction',
|
|
6
6
|
description: 'Label for the add reaction button that opens the emoji picker for users to choose a reaction.'
|
|
7
7
|
},
|
|
8
|
+
addedReaction: {
|
|
9
|
+
id: 'reactions.shared.i18n.addedReaction',
|
|
10
|
+
defaultMessage: 'Added reaction',
|
|
11
|
+
description: 'Accessible label for the group of added reaction toggle buttons displayed with a comment or content item.'
|
|
12
|
+
},
|
|
8
13
|
addNewReaction: {
|
|
9
14
|
id: 'fabric.reactions.add.new',
|
|
10
15
|
defaultMessage: 'Add new',
|
|
@@ -5,7 +5,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
5
5
|
import { createAndFireEvent } from '@atlaskit/analytics-next';
|
|
6
6
|
import { UI_EVENT_TYPE, OPERATIONAL_EVENT_TYPE } from '@atlaskit/analytics-gas-types';
|
|
7
7
|
var packageName = "@atlaskit/reactions";
|
|
8
|
-
var packageVersion = "35.12.
|
|
8
|
+
var packageVersion = "35.12.10";
|
|
9
9
|
/**
|
|
10
10
|
* TODO: move to utility package?
|
|
11
11
|
* A random sampling function
|
|
@@ -4,11 +4,11 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
4
4
|
import "./Reactions.compiled.css";
|
|
5
5
|
import { ax, ix } from "@compiled/react/runtime";
|
|
6
6
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
7
|
-
import { FormattedMessage } from 'react-intl';
|
|
7
|
+
import { FormattedMessage, useIntl } from 'react-intl';
|
|
8
8
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
9
9
|
import { ModalTransition } from '@atlaskit/modal-dialog';
|
|
10
10
|
import UFOSegment from '@atlaskit/react-ufo/segment';
|
|
11
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
12
12
|
import { createAndFireSafe, createPickerButtonClickedEvent, createPickerCancelledEvent, createPickerMoreClickedEvent, createReactionsRenderedEvent, createReactionSelectionEvent, isSampled } from '../analytics';
|
|
13
13
|
import { SAMPLING_RATE_REACTIONS_RENDERED_EXP } from '../shared/constants';
|
|
14
14
|
import { messages } from '../shared/i18n';
|
|
@@ -144,6 +144,7 @@ export var Reactions = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
144
144
|
_ref$renderParticleEf = _ref.renderParticleEffectOnSummaryView,
|
|
145
145
|
renderParticleEffectOnSummaryView = _ref$renderParticleEf === void 0 ? false : _ref$renderParticleEf,
|
|
146
146
|
reactionPickerPopperZIndex = _ref.reactionPickerPopperZIndex;
|
|
147
|
+
var intl = useIntl();
|
|
147
148
|
var _useState = useState(''),
|
|
148
149
|
_useState2 = _slicedToArray(_useState, 2),
|
|
149
150
|
selectedEmojiId = _useState2[0],
|
|
@@ -324,6 +325,39 @@ export var Reactions = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
324
325
|
}
|
|
325
326
|
});
|
|
326
327
|
};
|
|
328
|
+
var renderReactionItem = function renderReactionItem(reaction, rootElement) {
|
|
329
|
+
return /*#__PURE__*/React.createElement(Reaction, {
|
|
330
|
+
key: reaction.emojiId,
|
|
331
|
+
rootElement: rootElement,
|
|
332
|
+
reaction: reaction,
|
|
333
|
+
emojiProvider: emojiProvider,
|
|
334
|
+
onClick: onReactionClick,
|
|
335
|
+
onMouseEnter: handleReactionMouseEnter,
|
|
336
|
+
onFocused: handleReactionFocused,
|
|
337
|
+
flash: flash[reaction.emojiId],
|
|
338
|
+
showParticleEffect: particleEffectByEmoji[reaction.emojiId],
|
|
339
|
+
showOpaqueBackground: showOpaqueBackground,
|
|
340
|
+
allowUserDialog: allowUserDialog && hasEmojiWithFivePlusReactions,
|
|
341
|
+
handleOpenReactionsDialog: _handleOpenReactionsDialog,
|
|
342
|
+
isViewOnly: isViewOnly,
|
|
343
|
+
showSubtleStyle: showSubtleDefaultReactions && reactions.length === 0,
|
|
344
|
+
optimisticImageURL: fg('platform_reactions_optimistic_url') ? getOptimisticImageURL === null || getOptimisticImageURL === void 0 ? void 0 : getOptimisticImageURL(reaction.emojiId) : undefined
|
|
345
|
+
});
|
|
346
|
+
};
|
|
347
|
+
var renderReactionGroup = function renderReactionGroup() {
|
|
348
|
+
var shouldRenderReactionList = fg('jfp_a11y_team_comment_actions_semantic');
|
|
349
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
350
|
+
role: "group",
|
|
351
|
+
"aria-label": intl.formatMessage(messages.addedReaction),
|
|
352
|
+
className: ax([!shouldRenderReactionList && "_qtt8glyw _19pkidpf _2hwxidpf _otyridpf _18u0idpf _ca0qidpf _u5f3idpf _n3tdidpf _19bvidpf _1e0c1txw _1n261g80 _4cvr1h6o _kqswh2mm", !shouldRenderReactionList && noWrap && "_1n261q9c"])
|
|
353
|
+
}, shouldRenderReactionList ? /*#__PURE__*/React.createElement("ul", {
|
|
354
|
+
className: ax(["_qtt8glyw _19pkidpf _2hwxidpf _otyridpf _18u0idpf _ca0qidpf _u5f3idpf _n3tdidpf _19bvidpf _1e0c1txw _1n261g80 _4cvr1h6o _kqswh2mm", noWrap && "_1n261q9c"])
|
|
355
|
+
}, memorizedReactions.map(function (reaction) {
|
|
356
|
+
return renderReactionItem(reaction, 'li');
|
|
357
|
+
})) : /*#__PURE__*/React.createElement(React.Fragment, null, memorizedReactions.map(function (reaction) {
|
|
358
|
+
return renderReactionItem(reaction);
|
|
359
|
+
})));
|
|
360
|
+
};
|
|
327
361
|
return /*#__PURE__*/React.createElement(UFOSegment, {
|
|
328
362
|
name: "reactions"
|
|
329
363
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -362,43 +396,12 @@ export var Reactions = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
362
396
|
summaryGetOptimisticImageURL: summaryGetOptimisticImageURL,
|
|
363
397
|
summaryButtonIconAfter: summaryButtonIconAfter,
|
|
364
398
|
summaryViewParticleEffectEmojiId: renderParticleEffectOnSummaryView ? summaryViewParticleEffectEmojiId : null
|
|
365
|
-
})) : fg('jfp_a11y_team_comment_actions_semantic') ? /*#__PURE__*/React.createElement("ul", {
|
|
399
|
+
})) : reactions.length > 0 && fg('platform_reactions_a11y_group_added_reactions') ? renderReactionGroup() : fg('jfp_a11y_team_comment_actions_semantic') ? /*#__PURE__*/React.createElement("ul", {
|
|
366
400
|
className: ax(["_qtt8glyw _19pkidpf _2hwxidpf _otyridpf _18u0idpf _ca0qidpf _u5f3idpf _n3tdidpf _19bvidpf _1e0c1txw _1n261g80 _4cvr1h6o _kqswh2mm"])
|
|
367
401
|
}, memorizedReactions.map(function (reaction) {
|
|
368
|
-
return
|
|
369
|
-
key: reaction.emojiId,
|
|
370
|
-
rootElement: "li",
|
|
371
|
-
reaction: reaction,
|
|
372
|
-
emojiProvider: emojiProvider,
|
|
373
|
-
onClick: onReactionClick,
|
|
374
|
-
onMouseEnter: handleReactionMouseEnter,
|
|
375
|
-
onFocused: handleReactionFocused,
|
|
376
|
-
flash: flash[reaction.emojiId],
|
|
377
|
-
showParticleEffect: particleEffectByEmoji[reaction.emojiId],
|
|
378
|
-
showOpaqueBackground: showOpaqueBackground,
|
|
379
|
-
allowUserDialog: allowUserDialog && hasEmojiWithFivePlusReactions,
|
|
380
|
-
handleOpenReactionsDialog: _handleOpenReactionsDialog,
|
|
381
|
-
isViewOnly: isViewOnly,
|
|
382
|
-
showSubtleStyle: showSubtleDefaultReactions && reactions.length === 0,
|
|
383
|
-
optimisticImageURL: fg('platform_reactions_optimistic_url') ? getOptimisticImageURL === null || getOptimisticImageURL === void 0 ? void 0 : getOptimisticImageURL(reaction.emojiId) : undefined
|
|
384
|
-
});
|
|
402
|
+
return renderReactionItem(reaction, 'li');
|
|
385
403
|
})) : /*#__PURE__*/React.createElement(React.Fragment, null, memorizedReactions.map(function (reaction) {
|
|
386
|
-
return
|
|
387
|
-
key: reaction.emojiId,
|
|
388
|
-
reaction: reaction,
|
|
389
|
-
emojiProvider: emojiProvider,
|
|
390
|
-
onClick: onReactionClick,
|
|
391
|
-
onMouseEnter: handleReactionMouseEnter,
|
|
392
|
-
onFocused: handleReactionFocused,
|
|
393
|
-
flash: flash[reaction.emojiId],
|
|
394
|
-
showParticleEffect: particleEffectByEmoji[reaction.emojiId],
|
|
395
|
-
showOpaqueBackground: showOpaqueBackground,
|
|
396
|
-
allowUserDialog: allowUserDialog && hasEmojiWithFivePlusReactions,
|
|
397
|
-
handleOpenReactionsDialog: _handleOpenReactionsDialog,
|
|
398
|
-
isViewOnly: isViewOnly,
|
|
399
|
-
showSubtleStyle: showSubtleDefaultReactions && reactions.length === 0,
|
|
400
|
-
optimisticImageURL: fg('platform_reactions_optimistic_url') ? getOptimisticImageURL === null || getOptimisticImageURL === void 0 ? void 0 : getOptimisticImageURL(reaction.emojiId) : undefined
|
|
401
|
-
});
|
|
404
|
+
return renderReactionItem(reaction);
|
|
402
405
|
}))), shouldShowPicker && /*#__PURE__*/React.createElement(ReactionPicker, {
|
|
403
406
|
emojiProvider: emojiProvider,
|
|
404
407
|
allowAllEmojis: allowAllEmojis,
|
package/dist/esm/shared/i18n.js
CHANGED
|
@@ -5,6 +5,11 @@ export var messages = defineMessages({
|
|
|
5
5
|
defaultMessage: 'Add reaction',
|
|
6
6
|
description: 'Label for the add reaction button that opens the emoji picker for users to choose a reaction.'
|
|
7
7
|
},
|
|
8
|
+
addedReaction: {
|
|
9
|
+
id: 'reactions.shared.i18n.addedReaction',
|
|
10
|
+
defaultMessage: 'Added reaction',
|
|
11
|
+
description: 'Accessible label for the group of added reaction toggle buttons displayed with a comment or content item.'
|
|
12
|
+
},
|
|
8
13
|
addNewReaction: {
|
|
9
14
|
id: 'fabric.reactions.add.new',
|
|
10
15
|
defaultMessage: 'Add new',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/reactions",
|
|
3
|
-
"version": "35.12.
|
|
3
|
+
"version": "35.12.10",
|
|
4
4
|
"description": "Reactions component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@atlaskit/avatar": "^27.0.0",
|
|
38
38
|
"@atlaskit/button": "^25.0.0",
|
|
39
39
|
"@atlaskit/css": "^1.0.0",
|
|
40
|
-
"@atlaskit/emoji": "^71.
|
|
40
|
+
"@atlaskit/emoji": "^71.17.0",
|
|
41
41
|
"@atlaskit/feature-gate-js-client": "^6.0.0",
|
|
42
42
|
"@atlaskit/heading": "^7.0.0",
|
|
43
43
|
"@atlaskit/icon": "^37.3.0",
|
|
@@ -51,11 +51,11 @@
|
|
|
51
51
|
"@atlaskit/portal": "^6.2.0",
|
|
52
52
|
"@atlaskit/primitives": "^22.2.0",
|
|
53
53
|
"@atlaskit/react-compiler-gating": "^0.2.0",
|
|
54
|
-
"@atlaskit/react-ufo": "^7.
|
|
54
|
+
"@atlaskit/react-ufo": "^7.6.0",
|
|
55
55
|
"@atlaskit/spinner": "^20.1.0",
|
|
56
56
|
"@atlaskit/tabs": "^21.0.0",
|
|
57
57
|
"@atlaskit/theme": "^28.0.0",
|
|
58
|
-
"@atlaskit/tmp-editor-statsig": "^147.
|
|
58
|
+
"@atlaskit/tmp-editor-statsig": "^147.1.0",
|
|
59
59
|
"@atlaskit/tokens": "^16.7.0",
|
|
60
60
|
"@atlaskit/tooltip": "^24.0.0",
|
|
61
61
|
"@atlaskit/ufo": "^1.0.0",
|
|
@@ -138,6 +138,9 @@
|
|
|
138
138
|
},
|
|
139
139
|
"a11y_reactions_reading_order": {
|
|
140
140
|
"type": "boolean"
|
|
141
|
+
},
|
|
142
|
+
"platform_reactions_a11y_group_added_reactions": {
|
|
143
|
+
"type": "boolean"
|
|
141
144
|
}
|
|
142
145
|
},
|
|
143
146
|
"platform-experiments": {
|
package/reactions.docs.tsx
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Structured MCP docs for `@atlaskit/reactions`.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import path from 'path';
|
|
6
|
-
|
|
7
|
-
import type { StructuredContentSource } from '@atlassian/structured-docs-types/types';
|
|
8
|
-
|
|
9
|
-
import packageJson from './package.json';
|
|
10
|
-
|
|
11
|
-
const packagePath = path.resolve(__dirname);
|
|
12
|
-
|
|
13
|
-
const documentation: StructuredContentSource = {
|
|
14
|
-
package: {
|
|
15
|
-
package: '@atlaskit/reactions',
|
|
16
|
-
packagePath,
|
|
17
|
-
packageJson,
|
|
18
|
-
overview:
|
|
19
|
-
'React components for displaying and managing emoji reactions on content. It includes support for reaction pickers and reaction views with backend integration.',
|
|
20
|
-
},
|
|
21
|
-
components: [
|
|
22
|
-
{
|
|
23
|
-
name: 'ConnectedReactionPicker',
|
|
24
|
-
description: 'A reaction picker component pre-wired with a reactions store.',
|
|
25
|
-
status: 'general-availability',
|
|
26
|
-
import: {
|
|
27
|
-
name: 'ConnectedReactionPicker',
|
|
28
|
-
package: '@atlaskit/reactions',
|
|
29
|
-
type: 'named',
|
|
30
|
-
packagePath,
|
|
31
|
-
packageJson,
|
|
32
|
-
},
|
|
33
|
-
usageGuidelines: [
|
|
34
|
-
'Use `ConnectedReactionPicker` to allow users to add reactions to content.',
|
|
35
|
-
'Requires a `ReactionsStore` to manage reaction state.',
|
|
36
|
-
],
|
|
37
|
-
keywords: ['reactions', 'picker', 'emoji'],
|
|
38
|
-
categories: ['elements'],
|
|
39
|
-
examples: [
|
|
40
|
-
{
|
|
41
|
-
name: 'Connected reaction picker',
|
|
42
|
-
description: 'Basic usage of ConnectedReactionPicker.',
|
|
43
|
-
source: path.resolve(packagePath, './examples/00-connected-reaction-picker.tsx'),
|
|
44
|
-
},
|
|
45
|
-
],
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
name: 'ConnectedReactionsView',
|
|
49
|
-
description: 'A component for displaying the current reactions on a piece of content.',
|
|
50
|
-
status: 'general-availability',
|
|
51
|
-
import: {
|
|
52
|
-
name: 'ConnectedReactionsView',
|
|
53
|
-
package: '@atlaskit/reactions',
|
|
54
|
-
type: 'named',
|
|
55
|
-
packagePath,
|
|
56
|
-
packageJson,
|
|
57
|
-
},
|
|
58
|
-
usageGuidelines: [
|
|
59
|
-
'Use `ConnectedReactionsView` to show the list of reactions and allow users to toggle their own reactions.',
|
|
60
|
-
],
|
|
61
|
-
keywords: ['reactions', 'view', 'display'],
|
|
62
|
-
categories: ['elements'],
|
|
63
|
-
examples: [
|
|
64
|
-
{
|
|
65
|
-
name: 'Connected reactions view',
|
|
66
|
-
description: 'Basic usage of ConnectedReactionsView.',
|
|
67
|
-
source: path.resolve(packagePath, './examples/01-connected-reactions-view.tsx'),
|
|
68
|
-
},
|
|
69
|
-
],
|
|
70
|
-
},
|
|
71
|
-
],
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
export default documentation;
|