@atlaskit/reactions 31.6.2 → 31.7.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 CHANGED
@@ -1,5 +1,25 @@
1
1
  # @atlaskit/reactions
2
2
 
3
+ ## 31.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#150353](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/150353)
8
+ [`fb0f2127ccd01`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/fb0f2127ccd01) -
9
+ [ux] Removes reactions trigger tooltip when the reaction trigger already has text
10
+ - [#152335](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/152335)
11
+ [`e863365b1e932`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e863365b1e932) -
12
+ Pass reactionPickerPlacement prop into Reactions component to allow for differing aligment of
13
+ reaction picker popup
14
+
15
+ ## 31.6.3
16
+
17
+ ### Patch Changes
18
+
19
+ - [#151050](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/151050)
20
+ [`bed009e6ccbf2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/bed009e6ccbf2) -
21
+ A11y fix to allow screenreaders to read out the current emoji counts
22
+
3
23
  ## 31.6.2
4
24
 
5
25
  ### 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; }
13
13
  var packageName = "@atlaskit/reactions";
14
- var packageVersion = "31.6.2";
14
+ var packageVersion = "31.7.0";
15
15
  /**
16
16
  * TODO: move to utility package?
17
17
  * A random sampling function
@@ -146,6 +146,15 @@ var Reaction = exports.Reaction = function Reaction(_ref) {
146
146
  value: reaction.count,
147
147
  highlight: !isViewOnly && reaction.reacted
148
148
  }));
149
+ var reactionAriaLabel = intl.formatMessage(_i18n.messages.reactWithEmoji, {
150
+ emoji: emojiName
151
+ });
152
+ if (reaction.count) {
153
+ reactionAriaLabel = intl.formatMessage(_i18n.messages.reactWithEmojiAndCount, {
154
+ emoji: emojiName,
155
+ count: reaction.count
156
+ });
157
+ }
149
158
  return /*#__PURE__*/React.createElement(_compiled.Box, {
150
159
  xcss: styles.container
151
160
  }, showParticleEffect && /*#__PURE__*/React.createElement(_ReactionParticleEffect.ReactionParticleEffect, {
@@ -168,9 +177,7 @@ var Reaction = exports.Reaction = function Reaction(_ref) {
168
177
  }, emojiAndCount) : /*#__PURE__*/React.createElement(_ReactionButton.ReactionButton, {
169
178
  onClick: handleClick,
170
179
  flash: flash,
171
- ariaLabel: intl.formatMessage(_i18n.messages.reactWithEmoji, {
172
- emoji: emojiName
173
- }),
180
+ ariaLabel: reactionAriaLabel,
174
181
  ariaPressed: reacted,
175
182
  onMouseEnter: handleMouseEnter,
176
183
  onFocus: handleFocused,
@@ -146,7 +146,8 @@ var Reactions = exports.Reactions = /*#__PURE__*/_react.default.memo(function (_
146
146
  _ref$hoverableSummary = _ref.hoverableSummaryView,
147
147
  hoverableSummaryView = _ref$hoverableSummary === void 0 ? false : _ref$hoverableSummary,
148
148
  _ref$isListItem = _ref.isListItem,
149
- isListItem = _ref$isListItem === void 0 ? false : _ref$isListItem;
149
+ isListItem = _ref$isListItem === void 0 ? false : _ref$isListItem,
150
+ reactionPickerPlacement = _ref.reactionPickerPlacement;
150
151
  var _useState = (0, _react.useState)(''),
151
152
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
152
153
  selectedEmojiId = _useState2[0],
@@ -366,6 +367,7 @@ var Reactions = exports.Reactions = /*#__PURE__*/_react.default.memo(function (_
366
367
  isListItem: isListItem,
367
368
  hoverableReactionPicker: hoverableSummaryView,
368
369
  hoverableReactionPickerDelay: hoverableSummaryView ? 300 : 0,
370
+ reactionPickerPlacement: reactionPickerPlacement,
369
371
  className: (0, _runtime.ax)(["_1e0c1o8l _19pk1b66"])
370
372
  }), /*#__PURE__*/_react.default.createElement(_modalDialog.ModalTransition, null, !!selectedEmojiId && /*#__PURE__*/_react.default.createElement(_segment.default, {
371
373
  name: "reactions-dialog"
@@ -117,7 +117,10 @@ var Trigger = exports.Trigger = /*#__PURE__*/_react2.default.forwardRef(function
117
117
  testId: RENDER_TRIGGER_CONTAINER_TESTID
118
118
  }, /*#__PURE__*/_react2.default.createElement(_tooltip.default, {
119
119
  testId: RENDER_TOOLTIP_TRIGGER_TESTID,
120
- content: tooltipContent
120
+ content: tooltipContent,
121
+ canAppear: function canAppear() {
122
+ return !showAddReactionText;
123
+ }
121
124
  }, isListItem ? /*#__PURE__*/_react2.default.createElement("li", {
122
125
  "data-testid": RENDER_LIST_ITEM_WRAPPER_TESTID,
123
126
  className: (0, _runtime.ax)(["_qtt8glyw"])
@@ -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
+ reactWithEmojiAndCount: {
35
+ id: 'fabric.reactions.reactwithemojiandcount',
36
+ defaultMessage: '{count, plural, one {# {emoji} emoji} other {# {emoji} emojis}}. React with {emoji} emoji',
37
+ description: 'Aria label on reaction button'
38
+ },
34
39
  summary: {
35
40
  id: 'fabric.reactions.summary',
36
41
  defaultMessage: 'View all user reactions',
@@ -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 = "31.6.2";
4
+ const packageVersion = "31.7.0";
5
5
  /**
6
6
  * TODO: move to utility package?
7
7
  * A random sampling function
@@ -112,6 +112,15 @@ export const Reaction = ({
112
112
  value: reaction.count,
113
113
  highlight: !isViewOnly && reaction.reacted
114
114
  }));
115
+ let reactionAriaLabel = intl.formatMessage(messages.reactWithEmoji, {
116
+ emoji: emojiName
117
+ });
118
+ if (reaction.count) {
119
+ reactionAriaLabel = intl.formatMessage(messages.reactWithEmojiAndCount, {
120
+ emoji: emojiName,
121
+ count: reaction.count
122
+ });
123
+ }
115
124
  return /*#__PURE__*/React.createElement(Box, {
116
125
  xcss: styles.container
117
126
  }, showParticleEffect && /*#__PURE__*/React.createElement(ReactionParticleEffect, {
@@ -134,9 +143,7 @@ export const Reaction = ({
134
143
  }, emojiAndCount) : /*#__PURE__*/React.createElement(ReactionButton, {
135
144
  onClick: handleClick,
136
145
  flash: flash,
137
- ariaLabel: intl.formatMessage(messages.reactWithEmoji, {
138
- emoji: emojiName
139
- }),
146
+ ariaLabel: reactionAriaLabel,
140
147
  ariaPressed: reacted,
141
148
  onMouseEnter: handleMouseEnter,
142
149
  onFocus: handleFocused,
@@ -108,7 +108,8 @@ export const Reactions = /*#__PURE__*/React.memo(({
108
108
  useButtonAlignmentStyling = false,
109
109
  reactionPickerTriggerText,
110
110
  hoverableSummaryView = false,
111
- isListItem = false
111
+ isListItem = false,
112
+ reactionPickerPlacement
112
113
  }) => {
113
114
  const [selectedEmojiId, setSelectedEmojiId] = useState('');
114
115
  const {
@@ -313,6 +314,7 @@ export const Reactions = /*#__PURE__*/React.memo(({
313
314
  isListItem: isListItem,
314
315
  hoverableReactionPicker: hoverableSummaryView,
315
316
  hoverableReactionPickerDelay: hoverableSummaryView ? 300 : 0,
317
+ reactionPickerPlacement: reactionPickerPlacement,
316
318
  className: ax(["_1e0c1o8l _19pk1b66"])
317
319
  }), /*#__PURE__*/React.createElement(ModalTransition, null, !!selectedEmojiId && /*#__PURE__*/React.createElement(UFOSegment, {
318
320
  name: "reactions-dialog"
@@ -101,7 +101,8 @@ export const Trigger = /*#__PURE__*/React.forwardRef((props, ref) => {
101
101
  testId: RENDER_TRIGGER_CONTAINER_TESTID
102
102
  }, /*#__PURE__*/React.createElement(Tooltip, {
103
103
  testId: RENDER_TOOLTIP_TRIGGER_TESTID,
104
- content: tooltipContent
104
+ content: tooltipContent,
105
+ canAppear: () => !showAddReactionText
105
106
  }, isListItem ? /*#__PURE__*/React.createElement("li", {
106
107
  "data-testid": RENDER_LIST_ITEM_WRAPPER_TESTID,
107
108
  className: ax(["_qtt8glyw"])
@@ -25,6 +25,11 @@ export const messages = defineMessages({
25
25
  defaultMessage: 'React with {emoji} emoji',
26
26
  description: 'Aria label on reaction button'
27
27
  },
28
+ reactWithEmojiAndCount: {
29
+ id: 'fabric.reactions.reactwithemojiandcount',
30
+ defaultMessage: '{count, plural, one {# {emoji} emoji} other {# {emoji} emojis}}. React with {emoji} emoji',
31
+ description: 'Aria label on reaction button'
32
+ },
28
33
  summary: {
29
34
  id: 'fabric.reactions.summary',
30
35
  defaultMessage: 'View all user reactions',
@@ -4,7 +4,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
4
4
  import { createAndFireEvent } from '@atlaskit/analytics-next';
5
5
  import { UI_EVENT_TYPE, OPERATIONAL_EVENT_TYPE } from '@atlaskit/analytics-gas-types';
6
6
  var packageName = "@atlaskit/reactions";
7
- var packageVersion = "31.6.2";
7
+ var packageVersion = "31.7.0";
8
8
  /**
9
9
  * TODO: move to utility package?
10
10
  * A random sampling function
@@ -136,6 +136,15 @@ export var Reaction = function Reaction(_ref) {
136
136
  value: reaction.count,
137
137
  highlight: !isViewOnly && reaction.reacted
138
138
  }));
139
+ var reactionAriaLabel = intl.formatMessage(messages.reactWithEmoji, {
140
+ emoji: emojiName
141
+ });
142
+ if (reaction.count) {
143
+ reactionAriaLabel = intl.formatMessage(messages.reactWithEmojiAndCount, {
144
+ emoji: emojiName,
145
+ count: reaction.count
146
+ });
147
+ }
139
148
  return /*#__PURE__*/React.createElement(Box, {
140
149
  xcss: styles.container
141
150
  }, showParticleEffect && /*#__PURE__*/React.createElement(ReactionParticleEffect, {
@@ -158,9 +167,7 @@ export var Reaction = function Reaction(_ref) {
158
167
  }, emojiAndCount) : /*#__PURE__*/React.createElement(ReactionButton, {
159
168
  onClick: handleClick,
160
169
  flash: flash,
161
- ariaLabel: intl.formatMessage(messages.reactWithEmoji, {
162
- emoji: emojiName
163
- }),
170
+ ariaLabel: reactionAriaLabel,
164
171
  ariaPressed: reacted,
165
172
  onMouseEnter: handleMouseEnter,
166
173
  onFocus: handleFocused,
@@ -134,7 +134,8 @@ export var Reactions = /*#__PURE__*/React.memo(function (_ref) {
134
134
  _ref$hoverableSummary = _ref.hoverableSummaryView,
135
135
  hoverableSummaryView = _ref$hoverableSummary === void 0 ? false : _ref$hoverableSummary,
136
136
  _ref$isListItem = _ref.isListItem,
137
- isListItem = _ref$isListItem === void 0 ? false : _ref$isListItem;
137
+ isListItem = _ref$isListItem === void 0 ? false : _ref$isListItem,
138
+ reactionPickerPlacement = _ref.reactionPickerPlacement;
138
139
  var _useState = useState(''),
139
140
  _useState2 = _slicedToArray(_useState, 2),
140
141
  selectedEmojiId = _useState2[0],
@@ -354,6 +355,7 @@ export var Reactions = /*#__PURE__*/React.memo(function (_ref) {
354
355
  isListItem: isListItem,
355
356
  hoverableReactionPicker: hoverableSummaryView,
356
357
  hoverableReactionPickerDelay: hoverableSummaryView ? 300 : 0,
358
+ reactionPickerPlacement: reactionPickerPlacement,
357
359
  className: ax(["_1e0c1o8l _19pk1b66"])
358
360
  }), /*#__PURE__*/React.createElement(ModalTransition, null, !!selectedEmojiId && /*#__PURE__*/React.createElement(UFOSegment, {
359
361
  name: "reactions-dialog"
@@ -110,7 +110,10 @@ export var Trigger = /*#__PURE__*/React.forwardRef(function (props, ref) {
110
110
  testId: RENDER_TRIGGER_CONTAINER_TESTID
111
111
  }, /*#__PURE__*/React.createElement(Tooltip, {
112
112
  testId: RENDER_TOOLTIP_TRIGGER_TESTID,
113
- content: tooltipContent
113
+ content: tooltipContent,
114
+ canAppear: function canAppear() {
115
+ return !showAddReactionText;
116
+ }
114
117
  }, isListItem ? /*#__PURE__*/React.createElement("li", {
115
118
  "data-testid": RENDER_LIST_ITEM_WRAPPER_TESTID,
116
119
  className: ax(["_qtt8glyw"])
@@ -25,6 +25,11 @@ export var messages = defineMessages({
25
25
  defaultMessage: 'React with {emoji} emoji',
26
26
  description: 'Aria label on reaction button'
27
27
  },
28
+ reactWithEmojiAndCount: {
29
+ id: 'fabric.reactions.reactwithemojiandcount',
30
+ defaultMessage: '{count, plural, one {# {emoji} emoji} other {# {emoji} emojis}}. React with {emoji} emoji',
31
+ description: 'Aria label on reaction button'
32
+ },
28
33
  summary: {
29
34
  id: 'fabric.reactions.summary',
30
35
  defaultMessage: 'View all user reactions',
@@ -169,6 +169,10 @@ export interface ReactionsProps extends Pick<ReactionPickerProps, 'allowAllEmoji
169
169
  * Optional prop to say if the reactions component is in a list
170
170
  */
171
171
  isListItem?: boolean;
172
+ /**
173
+ * Optional prop to change the placement of the reaction picker popup
174
+ */
175
+ reactionPickerPlacement?: Placement;
172
176
  }
173
177
  export interface OpenReactionsDialogOptions {
174
178
  emojiId?: string;
@@ -181,4 +185,4 @@ export declare function getTooltip(status: ReactionStatus, errorMessage?: string
181
185
  /**
182
186
  * Renders list of reactions
183
187
  */
184
- export declare const Reactions: React.MemoExoticComponent<({ flash, particleEffectByEmoji, status, errorMessage, loadReaction, quickReactionEmojis, pickerQuickReactionEmojiIds, getReactionDetails, onSelection, reactions, emojiProvider, allowAllEmojis, onReactionClick, allowUserDialog, onDialogOpenCallback, onDialogCloseCallback, onDialogSelectReactionCallback, onDialogPageChangeCallback, emojiPickerSize, miniMode, summaryViewEnabled, summaryViewThreshold, summaryViewPlacement, showOpaqueBackground, subtleReactionsSummaryAndPicker, showAddReactionText, hideDefaultReactions, ProfileCardWrapper, onlyRenderPicker, isViewOnly, noWrap, noRelativeContainer, showSubtleDefaultReactions, reactionPickerTriggerTooltipContent, reactionPickerTriggerIcon, allowSelectFromSummaryView, useButtonAlignmentStyling, reactionPickerTriggerText, hoverableSummaryView, isListItem, }: ReactionsProps) => JSX.Element>;
188
+ export declare const Reactions: React.MemoExoticComponent<({ flash, particleEffectByEmoji, status, errorMessage, loadReaction, quickReactionEmojis, pickerQuickReactionEmojiIds, getReactionDetails, onSelection, reactions, emojiProvider, allowAllEmojis, onReactionClick, allowUserDialog, onDialogOpenCallback, onDialogCloseCallback, onDialogSelectReactionCallback, onDialogPageChangeCallback, emojiPickerSize, miniMode, summaryViewEnabled, summaryViewThreshold, summaryViewPlacement, showOpaqueBackground, subtleReactionsSummaryAndPicker, showAddReactionText, hideDefaultReactions, ProfileCardWrapper, onlyRenderPicker, isViewOnly, noWrap, noRelativeContainer, showSubtleDefaultReactions, reactionPickerTriggerTooltipContent, reactionPickerTriggerIcon, allowSelectFromSummaryView, useButtonAlignmentStyling, reactionPickerTriggerText, hoverableSummaryView, isListItem, reactionPickerPlacement, }: ReactionsProps) => JSX.Element>;
@@ -24,6 +24,11 @@ export declare const messages: {
24
24
  defaultMessage: string;
25
25
  description: string;
26
26
  };
27
+ reactWithEmojiAndCount: {
28
+ id: string;
29
+ defaultMessage: string;
30
+ description: string;
31
+ };
27
32
  summary: {
28
33
  id: string;
29
34
  defaultMessage: string;
@@ -169,6 +169,10 @@ export interface ReactionsProps extends Pick<ReactionPickerProps, 'allowAllEmoji
169
169
  * Optional prop to say if the reactions component is in a list
170
170
  */
171
171
  isListItem?: boolean;
172
+ /**
173
+ * Optional prop to change the placement of the reaction picker popup
174
+ */
175
+ reactionPickerPlacement?: Placement;
172
176
  }
173
177
  export interface OpenReactionsDialogOptions {
174
178
  emojiId?: string;
@@ -181,4 +185,4 @@ export declare function getTooltip(status: ReactionStatus, errorMessage?: string
181
185
  /**
182
186
  * Renders list of reactions
183
187
  */
184
- export declare const Reactions: React.MemoExoticComponent<({ flash, particleEffectByEmoji, status, errorMessage, loadReaction, quickReactionEmojis, pickerQuickReactionEmojiIds, getReactionDetails, onSelection, reactions, emojiProvider, allowAllEmojis, onReactionClick, allowUserDialog, onDialogOpenCallback, onDialogCloseCallback, onDialogSelectReactionCallback, onDialogPageChangeCallback, emojiPickerSize, miniMode, summaryViewEnabled, summaryViewThreshold, summaryViewPlacement, showOpaqueBackground, subtleReactionsSummaryAndPicker, showAddReactionText, hideDefaultReactions, ProfileCardWrapper, onlyRenderPicker, isViewOnly, noWrap, noRelativeContainer, showSubtleDefaultReactions, reactionPickerTriggerTooltipContent, reactionPickerTriggerIcon, allowSelectFromSummaryView, useButtonAlignmentStyling, reactionPickerTriggerText, hoverableSummaryView, isListItem, }: ReactionsProps) => JSX.Element>;
188
+ export declare const Reactions: React.MemoExoticComponent<({ flash, particleEffectByEmoji, status, errorMessage, loadReaction, quickReactionEmojis, pickerQuickReactionEmojiIds, getReactionDetails, onSelection, reactions, emojiProvider, allowAllEmojis, onReactionClick, allowUserDialog, onDialogOpenCallback, onDialogCloseCallback, onDialogSelectReactionCallback, onDialogPageChangeCallback, emojiPickerSize, miniMode, summaryViewEnabled, summaryViewThreshold, summaryViewPlacement, showOpaqueBackground, subtleReactionsSummaryAndPicker, showAddReactionText, hideDefaultReactions, ProfileCardWrapper, onlyRenderPicker, isViewOnly, noWrap, noRelativeContainer, showSubtleDefaultReactions, reactionPickerTriggerTooltipContent, reactionPickerTriggerIcon, allowSelectFromSummaryView, useButtonAlignmentStyling, reactionPickerTriggerText, hoverableSummaryView, isListItem, reactionPickerPlacement, }: ReactionsProps) => JSX.Element>;
@@ -24,6 +24,11 @@ export declare const messages: {
24
24
  defaultMessage: string;
25
25
  description: string;
26
26
  };
27
+ reactWithEmojiAndCount: {
28
+ id: string;
29
+ defaultMessage: string;
30
+ description: string;
31
+ };
27
32
  summary: {
28
33
  id: string;
29
34
  defaultMessage: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/reactions",
3
- "version": "31.6.2",
3
+ "version": "31.7.0",
4
4
  "description": "Reactions component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -40,7 +40,7 @@
40
40
  "@atlaskit/css": "^0.10.0",
41
41
  "@atlaskit/emoji": "^69.1.0",
42
42
  "@atlaskit/heading": "^5.2.0",
43
- "@atlaskit/icon": "^25.7.0",
43
+ "@atlaskit/icon": "^25.8.0",
44
44
  "@atlaskit/modal-dialog": "^14.1.0",
45
45
  "@atlaskit/motion": "^5.1.0",
46
46
  "@atlaskit/platform-feature-flags": "^1.1.0",
@@ -48,7 +48,7 @@
48
48
  "@atlaskit/popper": "^7.0.0",
49
49
  "@atlaskit/popup": "^4.1.0",
50
50
  "@atlaskit/primitives": "^14.7.0",
51
- "@atlaskit/react-ufo": "^3.9.0",
51
+ "@atlaskit/react-ufo": "^3.10.0",
52
52
  "@atlaskit/spinner": "^18.0.0",
53
53
  "@atlaskit/tabs": "^18.0.0",
54
54
  "@atlaskit/theme": "^18.0.0",