@atlaskit/reactions 35.12.9 → 35.12.11

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 CHANGED
@@ -1,5 +1,22 @@
1
1
  # @atlaskit/reactions
2
2
 
3
+ ## 35.12.11
4
+
5
+ ### Patch Changes
6
+
7
+ - [`c93de6bde10fd`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c93de6bde10fd) -
8
+ Cleanup feature gate `platform_ceps-5921-a11y-fix-reactions`. The reaction picker panel now always
9
+ uses non-modal dialog semantics for assistive technology.
10
+ - Updated dependencies
11
+
12
+ ## 35.12.10
13
+
14
+ ### Patch Changes
15
+
16
+ - [`26d8af3468aee`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/26d8af3468aee) -
17
+ Group added reaction controls with an accessible name behind
18
+ platform_reactions_a11y_group_added_reactions
19
+
3
20
  ## 35.12.9
4
21
 
5
22
  ### 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.8";
14
+ var packageVersion = "35.12.10";
15
15
  /**
16
16
  * TODO: move to utility package?
17
17
  * A random sampling function
@@ -382,11 +382,6 @@ var PopperWrapper = exports.PopperWrapper = function PopperWrapper(props) {
382
382
  setPopupRef = _useState12[1];
383
383
  var _useIntl = (0, _reactIntl.useIntl)(),
384
384
  formatMessage = _useIntl.formatMessage;
385
- /**
386
- * Expose the reaction picker panel as a non-modal dialog to assistive technology.
387
- * When disabled, fall back to the previous `role="group"` semantics.
388
- */
389
- var isDialogRoleEnabled = (0, _platformFeatureFlags.fg)('platform_ceps-5921-a11y-fix-reactions');
390
385
  /**
391
386
  * add focus lock to popup
392
387
  */
@@ -414,8 +409,7 @@ var PopperWrapper = exports.PopperWrapper = function PopperWrapper(props) {
414
409
  style = _ref3.style,
415
410
  update = _ref3.update;
416
411
  return /*#__PURE__*/_react.default.createElement("div", {
417
- role: isDialogRoleEnabled ? 'dialog' : 'group',
418
- "aria-modal": isDialogRoleEnabled ? false : undefined,
412
+ role: "dialog",
419
413
  "aria-label": formatMessage(_i18n.messages.popperWrapperLabel),
420
414
  id: PICKER_CONTROL_ID,
421
415
  "data-testid": RENDER_REACTIONPICKERPANEL_TESTID,
@@ -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 _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
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, _platformFeatureFlags.fg)('jfp_a11y_team_comment_actions_semantic') ? /*#__PURE__*/_react.default.createElement("ul", {
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 /*#__PURE__*/_react.default.createElement(_Reaction.Reaction, {
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 /*#__PURE__*/_react.default.createElement(_Reaction.Reaction, {
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,
@@ -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.8";
5
+ const packageVersion = "35.12.10";
6
6
  /**
7
7
  * TODO: move to utility package?
8
8
  * A random sampling function
@@ -338,11 +338,6 @@ export const PopperWrapper = props => {
338
338
  const {
339
339
  formatMessage
340
340
  } = useIntl();
341
- /**
342
- * Expose the reaction picker panel as a non-modal dialog to assistive technology.
343
- * When disabled, fall back to the previous `role="group"` semantics.
344
- */
345
- const isDialogRoleEnabled = fg('platform_ceps-5921-a11y-fix-reactions');
346
341
  /**
347
342
  * add focus lock to popup
348
343
  */
@@ -369,8 +364,7 @@ export const PopperWrapper = props => {
369
364
  update
370
365
  }) => {
371
366
  return /*#__PURE__*/React.createElement("div", {
372
- role: isDialogRoleEnabled ? 'dialog' : 'group',
373
- "aria-modal": isDialogRoleEnabled ? false : undefined,
367
+ role: "dialog",
374
368
  "aria-label": formatMessage(messages.popperWrapperLabel),
375
369
  id: PICKER_CONTROL_ID,
376
370
  "data-testid": RENDER_REACTIONPICKERPANEL_TESTID,
@@ -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(Reaction, {
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";
8
+ var packageVersion = "35.12.10";
9
9
  /**
10
10
  * TODO: move to utility package?
11
11
  * A random sampling function
@@ -373,11 +373,6 @@ export var PopperWrapper = function PopperWrapper(props) {
373
373
  setPopupRef = _useState12[1];
374
374
  var _useIntl = useIntl(),
375
375
  formatMessage = _useIntl.formatMessage;
376
- /**
377
- * Expose the reaction picker panel as a non-modal dialog to assistive technology.
378
- * When disabled, fall back to the previous `role="group"` semantics.
379
- */
380
- var isDialogRoleEnabled = fg('platform_ceps-5921-a11y-fix-reactions');
381
376
  /**
382
377
  * add focus lock to popup
383
378
  */
@@ -405,8 +400,7 @@ export var PopperWrapper = function PopperWrapper(props) {
405
400
  style = _ref3.style,
406
401
  update = _ref3.update;
407
402
  return /*#__PURE__*/React.createElement("div", {
408
- role: isDialogRoleEnabled ? 'dialog' : 'group',
409
- "aria-modal": isDialogRoleEnabled ? false : undefined,
403
+ role: "dialog",
410
404
  "aria-label": formatMessage(messages.popperWrapperLabel),
411
405
  id: PICKER_CONTROL_ID,
412
406
  "data-testid": RENDER_REACTIONPICKERPANEL_TESTID,
@@ -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 /*#__PURE__*/React.createElement(Reaction, {
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 /*#__PURE__*/React.createElement(Reaction, {
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,
@@ -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',
@@ -1,4 +1,9 @@
1
1
  export declare const messages: {
2
+ addedReaction: {
3
+ defaultMessage: string;
4
+ description: string;
5
+ id: string;
6
+ };
2
7
  addNewReaction: {
3
8
  defaultMessage: string;
4
9
  description: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/reactions",
3
- "version": "35.12.9",
3
+ "version": "35.12.11",
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.16.0",
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.4.0",
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.0.0",
58
+ "@atlaskit/tmp-editor-statsig": "^148.0.0",
59
59
  "@atlaskit/tokens": "^16.7.0",
60
60
  "@atlaskit/tooltip": "^24.0.0",
61
61
  "@atlaskit/ufo": "^1.0.0",
@@ -133,10 +133,10 @@
133
133
  "platform_suppression_removal_fix_reactions": {
134
134
  "type": "boolean"
135
135
  },
136
- "platform_ceps-5921-a11y-fix-reactions": {
136
+ "a11y_reactions_reading_order": {
137
137
  "type": "boolean"
138
138
  },
139
- "a11y_reactions_reading_order": {
139
+ "platform_reactions_a11y_group_added_reactions": {
140
140
  "type": "boolean"
141
141
  }
142
142
  },
@@ -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;