@atlaskit/reactions 31.0.1 → 31.2.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.
Files changed (28) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/cjs/analytics/index.js +1 -1
  3. package/dist/cjs/components/ReactionButton.js +2 -0
  4. package/dist/cjs/components/ReactionSummaryButton.js +5 -1
  5. package/dist/cjs/components/ReactionSummaryView.js +48 -3
  6. package/dist/cjs/components/ReactionSummaryViewEmojiPicker.js +2 -1
  7. package/dist/cjs/components/Reactions.js +5 -2
  8. package/dist/es2019/analytics/index.js +1 -1
  9. package/dist/es2019/components/ReactionButton.js +2 -0
  10. package/dist/es2019/components/ReactionSummaryButton.js +5 -1
  11. package/dist/es2019/components/ReactionSummaryView.js +41 -3
  12. package/dist/es2019/components/ReactionSummaryViewEmojiPicker.js +2 -1
  13. package/dist/es2019/components/Reactions.js +4 -2
  14. package/dist/esm/analytics/index.js +1 -1
  15. package/dist/esm/components/ReactionButton.js +2 -0
  16. package/dist/esm/components/ReactionSummaryButton.js +5 -1
  17. package/dist/esm/components/ReactionSummaryView.js +48 -3
  18. package/dist/esm/components/ReactionSummaryViewEmojiPicker.js +2 -1
  19. package/dist/esm/components/Reactions.js +5 -2
  20. package/dist/types/components/ReactionButton.d.ts +2 -1
  21. package/dist/types/components/ReactionSummaryButton.d.ts +8 -0
  22. package/dist/types/components/ReactionSummaryView.d.ts +5 -1
  23. package/dist/types/components/Reactions.d.ts +5 -1
  24. package/dist/types-ts4.5/components/ReactionButton.d.ts +2 -1
  25. package/dist/types-ts4.5/components/ReactionSummaryButton.d.ts +8 -0
  26. package/dist/types-ts4.5/components/ReactionSummaryView.d.ts +5 -1
  27. package/dist/types-ts4.5/components/Reactions.d.ts +5 -1
  28. package/package.json +5 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @atlaskit/reactions
2
2
 
3
+ ## 31.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#143535](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/143535)
8
+ [`a39ad7cdc2c99`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a39ad7cdc2c99) -
9
+ [ux] Adds hoverable reactions summary functionality behind a prop as part of byline reactions
10
+ changes
11
+
12
+ ## 31.1.0
13
+
14
+ ### Minor Changes
15
+
16
+ - [#142643](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/142643)
17
+ [`ec49a2c4909a4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ec49a2c4909a4) -
18
+ [ux] Updates the emoji picker positioning when opened from the summary view reaction picker
19
+ trigger
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies
24
+
3
25
  ## 31.0.1
4
26
 
5
27
  ### 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.0.1";
14
+ var packageVersion = "31.2.0";
15
15
  /**
16
16
  * TODO: move to utility package?
17
17
  * A random sampling function
@@ -45,6 +45,7 @@ var ReactionButton = exports.ReactionButton = function ReactionButton(_ref) {
45
45
  ariaLabel = _ref.ariaLabel,
46
46
  ariaPressed = _ref.ariaPressed,
47
47
  onMouseEnter = _ref.onMouseEnter,
48
+ onMouseLeave = _ref.onMouseLeave,
48
49
  onFocus = _ref.onFocus,
49
50
  children = _ref.children,
50
51
  _ref$dataAttributes = _ref.dataAttributes,
@@ -53,6 +54,7 @@ var ReactionButton = exports.ReactionButton = function ReactionButton(_ref) {
53
54
  return /*#__PURE__*/React.createElement(_compiled.Pressable, (0, _extends2.default)({
54
55
  onClick: onClick,
55
56
  onMouseEnter: onMouseEnter,
57
+ onMouseLeave: onMouseLeave,
56
58
  onFocus: onFocus,
57
59
  "aria-label": ariaLabel,
58
60
  "aria-pressed": ariaPressed,
@@ -49,7 +49,9 @@ var ReactionSummaryButton = exports.ReactionSummaryButton = /*#__PURE__*/(0, _re
49
49
  _ref$subtleReactionsS = _ref.subtleReactionsSummaryAndPicker,
50
50
  subtleReactionsSummaryAndPicker = _ref$subtleReactionsS === void 0 ? false : _ref$subtleReactionsS,
51
51
  _ref$useButtonAlignme = _ref.useButtonAlignmentStyling,
52
- useButtonAlignmentStyling = _ref$useButtonAlignme === void 0 ? false : _ref$useButtonAlignme;
52
+ useButtonAlignmentStyling = _ref$useButtonAlignme === void 0 ? false : _ref$useButtonAlignme,
53
+ onMouseEnter = _ref.onMouseEnter,
54
+ onMouseLeave = _ref.onMouseLeave;
53
55
  var intl = (0, _reactIntlNext.useIntl)();
54
56
 
55
57
  // Helper function to sort reactions by count and return top N
@@ -73,6 +75,8 @@ var ReactionSummaryButton = exports.ReactionSummaryButton = /*#__PURE__*/(0, _re
73
75
  justifyContent: "center"
74
76
  }, /*#__PURE__*/React.createElement(_ReactionButton.ReactionButton, {
75
77
  onClick: onClick,
78
+ onMouseEnter: onMouseEnter,
79
+ onMouseLeave: onMouseLeave,
76
80
  testId: RENDER_SUMMARY_BUTTON_TESTID,
77
81
  ariaLabel: intl.formatMessage(_i18n.messages.summary),
78
82
  showSubtleStyle: subtleReactionsSummaryAndPicker,
@@ -57,22 +57,65 @@ var ReactionSummaryView = exports.ReactionSummaryView = function ReactionSummary
57
57
  reactionPickerTriggerIcon = _ref.reactionPickerTriggerIcon,
58
58
  onOpen = _ref.onOpen,
59
59
  useButtonAlignmentStyling = _ref.useButtonAlignmentStyling,
60
- reactionPickerTriggerText = _ref.reactionPickerTriggerText;
60
+ reactionPickerTriggerText = _ref.reactionPickerTriggerText,
61
+ _ref$hoverableSummary = _ref.hoverableSummaryView,
62
+ hoverableSummaryView = _ref$hoverableSummary === void 0 ? false : _ref$hoverableSummary;
61
63
  var _useState = (0, _react.useState)(false),
62
64
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
63
65
  isSummaryPopupOpen = _useState2[0],
64
66
  setSummaryPopupOpen = _useState2[1];
67
+ var _useState3 = (0, _react.useState)(false),
68
+ _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
69
+ isHoveringSummaryView = _useState4[0],
70
+ setIsHoveringSummaryView = _useState4[1];
71
+ var _useState5 = (0, _react.useState)(false),
72
+ _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
73
+ isSummaryViewButtonHovered = _useState6[0],
74
+ setIsSummaryViewButtonHovered = _useState6[1];
65
75
  var handlePopupClose = (0, _react.useCallback)(function () {
66
76
  return setSummaryPopupOpen(false);
67
77
  }, []);
68
78
  var handleSummaryClick = (0, _react.useCallback)(function () {
69
79
  return setSummaryPopupOpen(!isSummaryPopupOpen);
70
80
  }, [isSummaryPopupOpen]);
81
+ var handleButtonMouseEnter = (0, _react.useCallback)(function () {
82
+ setIsSummaryViewButtonHovered(true);
83
+ if (hoverableSummaryView) {
84
+ setSummaryPopupOpen(true);
85
+ }
86
+ }, [hoverableSummaryView]);
87
+ var handleButtonMouseLeave = (0, _react.useCallback)(function () {
88
+ setIsSummaryViewButtonHovered(false);
89
+ if (hoverableSummaryView && !isHoveringSummaryView) {
90
+ setSummaryPopupOpen(false);
91
+ }
92
+ }, [hoverableSummaryView, isHoveringSummaryView]);
93
+ var handleSummaryViewTrayMouseEnter = (0, _react.useCallback)(function () {
94
+ setIsHoveringSummaryView(true);
95
+ if (hoverableSummaryView) {
96
+ setSummaryPopupOpen(true);
97
+ }
98
+ }, [hoverableSummaryView]);
99
+ var handleSummaryViewTrayMouseLeave = (0, _react.useCallback)(function () {
100
+ setIsHoveringSummaryView(false);
101
+ if (hoverableSummaryView && !isSummaryViewButtonHovered) {
102
+ setSummaryPopupOpen(false);
103
+ }
104
+ }, [hoverableSummaryView, isSummaryViewButtonHovered]);
105
+ var handleEmojiSelection = (0, _react.useCallback)(function (emojiId, source) {
106
+ onSelection(emojiId, source);
107
+ if (hoverableSummaryView) {
108
+ setSummaryPopupOpen(false);
109
+ }
110
+ }, [onSelection, hoverableSummaryView]);
71
111
  return /*#__PURE__*/React.createElement(_popup.default, {
72
112
  placement: placement,
113
+ offset: hoverableSummaryView ? [0, 0] : undefined,
73
114
  content: function content() {
74
115
  return /*#__PURE__*/React.createElement(_compiled.Box, {
75
- testId: RENDER_SUMMARY_VIEW_POPUP_TESTID
116
+ testId: RENDER_SUMMARY_VIEW_POPUP_TESTID,
117
+ onMouseEnter: handleSummaryViewTrayMouseEnter,
118
+ onMouseLeave: handleSummaryViewTrayMouseLeave
76
119
  }, /*#__PURE__*/React.createElement(_compiled.Inline, {
77
120
  xcss: styles.summaryPopup,
78
121
  space: "space.025",
@@ -97,7 +140,7 @@ var ReactionSummaryView = exports.ReactionSummaryView = function ReactionSummary
97
140
  }, /*#__PURE__*/React.createElement(_ReactionSummaryViewEmojiPicker.ReactionSummaryViewEmojiPicker, {
98
141
  emojiProvider: emojiProvider,
99
142
  disabled: disabled,
100
- onSelection: onSelection,
143
+ onSelection: handleEmojiSelection,
101
144
  emojiPickerSize: emojiPickerSize,
102
145
  tooltipContent: tooltipContent,
103
146
  reactionPickerTriggerIcon: reactionPickerTriggerIcon,
@@ -112,6 +155,8 @@ var ReactionSummaryView = exports.ReactionSummaryView = function ReactionSummary
112
155
  emojiProvider: emojiProvider,
113
156
  reactions: reactions,
114
157
  onClick: handleSummaryClick,
158
+ onMouseEnter: handleButtonMouseEnter,
159
+ onMouseLeave: handleButtonMouseLeave,
115
160
  showOpaqueBackground: showOpaqueBackground,
116
161
  subtleReactionsSummaryAndPicker: subtleReactionsSummaryAndPicker,
117
162
  useButtonAlignmentStyling: useButtonAlignmentStyling
@@ -71,7 +71,8 @@ var ReactionSummaryViewEmojiPicker = exports.ReactionSummaryViewEmojiPicker = fu
71
71
  return /*#__PURE__*/_react.default.createElement(_popup.default, {
72
72
  testId: "reaction-summary-view-emoji-picker",
73
73
  isOpen: isOpen,
74
- placement: "right",
74
+ placement: "bottom-start",
75
+ offset: [-10, -66],
75
76
  onClose: function onClose() {
76
77
  return close();
77
78
  },
@@ -143,7 +143,9 @@ var Reactions = exports.Reactions = /*#__PURE__*/_react.default.memo(function (_
143
143
  allowSelectFromSummaryView = _ref$allowSelectFromS === void 0 ? false : _ref$allowSelectFromS,
144
144
  _ref$useButtonAlignme = _ref.useButtonAlignmentStyling,
145
145
  useButtonAlignmentStyling = _ref$useButtonAlignme === void 0 ? false : _ref$useButtonAlignme,
146
- reactionPickerTriggerText = _ref.reactionPickerTriggerText;
146
+ reactionPickerTriggerText = _ref.reactionPickerTriggerText,
147
+ _ref$hoverableSummary = _ref.hoverableSummaryView,
148
+ hoverableSummaryView = _ref$hoverableSummary === void 0 ? false : _ref$hoverableSummary;
147
149
  var _useState = (0, _react.useState)(''),
148
150
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
149
151
  selectedEmojiId = _useState2[0],
@@ -325,7 +327,8 @@ var Reactions = exports.Reactions = /*#__PURE__*/_react.default.memo(function (_
325
327
  emojiPickerSize: emojiPickerSize,
326
328
  onOpen: handlePickerOpen,
327
329
  useButtonAlignmentStyling: useButtonAlignmentStyling,
328
- reactionPickerTriggerText: reactionPickerTriggerText
330
+ reactionPickerTriggerText: reactionPickerTriggerText,
331
+ hoverableSummaryView: hoverableSummaryView
329
332
  })) : memorizedReactions.map(function (reaction) {
330
333
  return /*#__PURE__*/_react.default.createElement(_Reaction.Reaction, {
331
334
  key: reaction.emojiId,
@@ -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.0.1";
4
+ const packageVersion = "31.2.0";
5
5
  /**
6
6
  * TODO: move to utility package?
7
7
  * A random sampling function
@@ -34,6 +34,7 @@ export const ReactionButton = ({
34
34
  ariaLabel,
35
35
  ariaPressed,
36
36
  onMouseEnter,
37
+ onMouseLeave,
37
38
  onFocus,
38
39
  children,
39
40
  dataAttributes = {},
@@ -42,6 +43,7 @@ export const ReactionButton = ({
42
43
  return /*#__PURE__*/React.createElement(Pressable, _extends({
43
44
  onClick: onClick,
44
45
  onMouseEnter: onMouseEnter,
46
+ onMouseLeave: onMouseLeave,
45
47
  onFocus: onFocus,
46
48
  "aria-label": ariaLabel,
47
49
  "aria-pressed": ariaPressed,
@@ -33,7 +33,9 @@ export const ReactionSummaryButton = /*#__PURE__*/forwardRef(({
33
33
  onClick,
34
34
  showOpaqueBackground = false,
35
35
  subtleReactionsSummaryAndPicker = false,
36
- useButtonAlignmentStyling = false
36
+ useButtonAlignmentStyling = false,
37
+ onMouseEnter,
38
+ onMouseLeave
37
39
  }, ref) => {
38
40
  const intl = useIntl();
39
41
 
@@ -54,6 +56,8 @@ export const ReactionSummaryButton = /*#__PURE__*/forwardRef(({
54
56
  justifyContent: "center"
55
57
  }, /*#__PURE__*/React.createElement(ReactionButton, {
56
58
  onClick: onClick,
59
+ onMouseEnter: onMouseEnter,
60
+ onMouseLeave: onMouseLeave,
57
61
  testId: RENDER_SUMMARY_BUTTON_TESTID,
58
62
  ariaLabel: intl.formatMessage(messages.summary),
59
63
  showSubtleStyle: subtleReactionsSummaryAndPicker,
@@ -39,15 +39,51 @@ export const ReactionSummaryView = ({
39
39
  reactionPickerTriggerIcon,
40
40
  onOpen,
41
41
  useButtonAlignmentStyling,
42
- reactionPickerTriggerText
42
+ reactionPickerTriggerText,
43
+ hoverableSummaryView = false
43
44
  }) => {
44
45
  const [isSummaryPopupOpen, setSummaryPopupOpen] = useState(false);
46
+ const [isHoveringSummaryView, setIsHoveringSummaryView] = useState(false);
47
+ const [isSummaryViewButtonHovered, setIsSummaryViewButtonHovered] = useState(false);
45
48
  const handlePopupClose = useCallback(() => setSummaryPopupOpen(false), []);
46
49
  const handleSummaryClick = useCallback(() => setSummaryPopupOpen(!isSummaryPopupOpen), [isSummaryPopupOpen]);
50
+ const handleButtonMouseEnter = useCallback(() => {
51
+ setIsSummaryViewButtonHovered(true);
52
+ if (hoverableSummaryView) {
53
+ setSummaryPopupOpen(true);
54
+ }
55
+ }, [hoverableSummaryView]);
56
+ const handleButtonMouseLeave = useCallback(() => {
57
+ setIsSummaryViewButtonHovered(false);
58
+ if (hoverableSummaryView && !isHoveringSummaryView) {
59
+ setSummaryPopupOpen(false);
60
+ }
61
+ }, [hoverableSummaryView, isHoveringSummaryView]);
62
+ const handleSummaryViewTrayMouseEnter = useCallback(() => {
63
+ setIsHoveringSummaryView(true);
64
+ if (hoverableSummaryView) {
65
+ setSummaryPopupOpen(true);
66
+ }
67
+ }, [hoverableSummaryView]);
68
+ const handleSummaryViewTrayMouseLeave = useCallback(() => {
69
+ setIsHoveringSummaryView(false);
70
+ if (hoverableSummaryView && !isSummaryViewButtonHovered) {
71
+ setSummaryPopupOpen(false);
72
+ }
73
+ }, [hoverableSummaryView, isSummaryViewButtonHovered]);
74
+ const handleEmojiSelection = useCallback((emojiId, source) => {
75
+ onSelection(emojiId, source);
76
+ if (hoverableSummaryView) {
77
+ setSummaryPopupOpen(false);
78
+ }
79
+ }, [onSelection, hoverableSummaryView]);
47
80
  return /*#__PURE__*/React.createElement(Popup, {
48
81
  placement: placement,
82
+ offset: hoverableSummaryView ? [0, 0] : undefined,
49
83
  content: () => /*#__PURE__*/React.createElement(Box, {
50
- testId: RENDER_SUMMARY_VIEW_POPUP_TESTID
84
+ testId: RENDER_SUMMARY_VIEW_POPUP_TESTID,
85
+ onMouseEnter: handleSummaryViewTrayMouseEnter,
86
+ onMouseLeave: handleSummaryViewTrayMouseLeave
51
87
  }, /*#__PURE__*/React.createElement(Inline, {
52
88
  xcss: styles.summaryPopup,
53
89
  space: "space.025",
@@ -70,7 +106,7 @@ export const ReactionSummaryView = ({
70
106
  }, /*#__PURE__*/React.createElement(ReactionSummaryViewEmojiPicker, {
71
107
  emojiProvider: emojiProvider,
72
108
  disabled: disabled,
73
- onSelection: onSelection,
109
+ onSelection: handleEmojiSelection,
74
110
  emojiPickerSize: emojiPickerSize,
75
111
  tooltipContent: tooltipContent,
76
112
  reactionPickerTriggerIcon: reactionPickerTriggerIcon,
@@ -83,6 +119,8 @@ export const ReactionSummaryView = ({
83
119
  emojiProvider: emojiProvider,
84
120
  reactions: reactions,
85
121
  onClick: handleSummaryClick,
122
+ onMouseEnter: handleButtonMouseEnter,
123
+ onMouseLeave: handleButtonMouseLeave,
86
124
  showOpaqueBackground: showOpaqueBackground,
87
125
  subtleReactionsSummaryAndPicker: subtleReactionsSummaryAndPicker,
88
126
  useButtonAlignmentStyling: useButtonAlignmentStyling
@@ -56,7 +56,8 @@ export const ReactionSummaryViewEmojiPicker = ({
56
56
  return /*#__PURE__*/React.createElement(Popup, {
57
57
  testId: "reaction-summary-view-emoji-picker",
58
58
  isOpen: isOpen,
59
- placement: "right",
59
+ placement: "bottom-start",
60
+ offset: [-10, -66],
60
61
  onClose: () => close(),
61
62
  content: () => /*#__PURE__*/React.createElement(EmojiPicker, {
62
63
  emojiProvider: emojiProvider,
@@ -107,7 +107,8 @@ export const Reactions = /*#__PURE__*/React.memo(({
107
107
  reactionPickerTriggerIcon,
108
108
  allowSelectFromSummaryView = false,
109
109
  useButtonAlignmentStyling = false,
110
- reactionPickerTriggerText
110
+ reactionPickerTriggerText,
111
+ hoverableSummaryView = false
111
112
  }) => {
112
113
  const [selectedEmojiId, setSelectedEmojiId] = useState('');
113
114
  const {
@@ -276,7 +277,8 @@ export const Reactions = /*#__PURE__*/React.memo(({
276
277
  emojiPickerSize: emojiPickerSize,
277
278
  onOpen: handlePickerOpen,
278
279
  useButtonAlignmentStyling: useButtonAlignmentStyling,
279
- reactionPickerTriggerText: reactionPickerTriggerText
280
+ reactionPickerTriggerText: reactionPickerTriggerText,
281
+ hoverableSummaryView: hoverableSummaryView
280
282
  })) : memorizedReactions.map(reaction => /*#__PURE__*/React.createElement(Reaction, {
281
283
  key: reaction.emojiId,
282
284
  reaction: reaction,
@@ -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.0.1";
7
+ var packageVersion = "31.2.0";
8
8
  /**
9
9
  * TODO: move to utility package?
10
10
  * A random sampling function
@@ -35,6 +35,7 @@ export var ReactionButton = function ReactionButton(_ref) {
35
35
  ariaLabel = _ref.ariaLabel,
36
36
  ariaPressed = _ref.ariaPressed,
37
37
  onMouseEnter = _ref.onMouseEnter,
38
+ onMouseLeave = _ref.onMouseLeave,
38
39
  onFocus = _ref.onFocus,
39
40
  children = _ref.children,
40
41
  _ref$dataAttributes = _ref.dataAttributes,
@@ -43,6 +44,7 @@ export var ReactionButton = function ReactionButton(_ref) {
43
44
  return /*#__PURE__*/React.createElement(Pressable, _extends({
44
45
  onClick: onClick,
45
46
  onMouseEnter: onMouseEnter,
47
+ onMouseLeave: onMouseLeave,
46
48
  onFocus: onFocus,
47
49
  "aria-label": ariaLabel,
48
50
  "aria-pressed": ariaPressed,
@@ -39,7 +39,9 @@ export var ReactionSummaryButton = /*#__PURE__*/forwardRef(function (_ref, ref)
39
39
  _ref$subtleReactionsS = _ref.subtleReactionsSummaryAndPicker,
40
40
  subtleReactionsSummaryAndPicker = _ref$subtleReactionsS === void 0 ? false : _ref$subtleReactionsS,
41
41
  _ref$useButtonAlignme = _ref.useButtonAlignmentStyling,
42
- useButtonAlignmentStyling = _ref$useButtonAlignme === void 0 ? false : _ref$useButtonAlignme;
42
+ useButtonAlignmentStyling = _ref$useButtonAlignme === void 0 ? false : _ref$useButtonAlignme,
43
+ onMouseEnter = _ref.onMouseEnter,
44
+ onMouseLeave = _ref.onMouseLeave;
43
45
  var intl = useIntl();
44
46
 
45
47
  // Helper function to sort reactions by count and return top N
@@ -63,6 +65,8 @@ export var ReactionSummaryButton = /*#__PURE__*/forwardRef(function (_ref, ref)
63
65
  justifyContent: "center"
64
66
  }, /*#__PURE__*/React.createElement(ReactionButton, {
65
67
  onClick: onClick,
68
+ onMouseEnter: onMouseEnter,
69
+ onMouseLeave: onMouseLeave,
66
70
  testId: RENDER_SUMMARY_BUTTON_TESTID,
67
71
  ariaLabel: intl.formatMessage(messages.summary),
68
72
  showSubtleStyle: subtleReactionsSummaryAndPicker,
@@ -47,22 +47,65 @@ export var ReactionSummaryView = function ReactionSummaryView(_ref) {
47
47
  reactionPickerTriggerIcon = _ref.reactionPickerTriggerIcon,
48
48
  onOpen = _ref.onOpen,
49
49
  useButtonAlignmentStyling = _ref.useButtonAlignmentStyling,
50
- reactionPickerTriggerText = _ref.reactionPickerTriggerText;
50
+ reactionPickerTriggerText = _ref.reactionPickerTriggerText,
51
+ _ref$hoverableSummary = _ref.hoverableSummaryView,
52
+ hoverableSummaryView = _ref$hoverableSummary === void 0 ? false : _ref$hoverableSummary;
51
53
  var _useState = useState(false),
52
54
  _useState2 = _slicedToArray(_useState, 2),
53
55
  isSummaryPopupOpen = _useState2[0],
54
56
  setSummaryPopupOpen = _useState2[1];
57
+ var _useState3 = useState(false),
58
+ _useState4 = _slicedToArray(_useState3, 2),
59
+ isHoveringSummaryView = _useState4[0],
60
+ setIsHoveringSummaryView = _useState4[1];
61
+ var _useState5 = useState(false),
62
+ _useState6 = _slicedToArray(_useState5, 2),
63
+ isSummaryViewButtonHovered = _useState6[0],
64
+ setIsSummaryViewButtonHovered = _useState6[1];
55
65
  var handlePopupClose = useCallback(function () {
56
66
  return setSummaryPopupOpen(false);
57
67
  }, []);
58
68
  var handleSummaryClick = useCallback(function () {
59
69
  return setSummaryPopupOpen(!isSummaryPopupOpen);
60
70
  }, [isSummaryPopupOpen]);
71
+ var handleButtonMouseEnter = useCallback(function () {
72
+ setIsSummaryViewButtonHovered(true);
73
+ if (hoverableSummaryView) {
74
+ setSummaryPopupOpen(true);
75
+ }
76
+ }, [hoverableSummaryView]);
77
+ var handleButtonMouseLeave = useCallback(function () {
78
+ setIsSummaryViewButtonHovered(false);
79
+ if (hoverableSummaryView && !isHoveringSummaryView) {
80
+ setSummaryPopupOpen(false);
81
+ }
82
+ }, [hoverableSummaryView, isHoveringSummaryView]);
83
+ var handleSummaryViewTrayMouseEnter = useCallback(function () {
84
+ setIsHoveringSummaryView(true);
85
+ if (hoverableSummaryView) {
86
+ setSummaryPopupOpen(true);
87
+ }
88
+ }, [hoverableSummaryView]);
89
+ var handleSummaryViewTrayMouseLeave = useCallback(function () {
90
+ setIsHoveringSummaryView(false);
91
+ if (hoverableSummaryView && !isSummaryViewButtonHovered) {
92
+ setSummaryPopupOpen(false);
93
+ }
94
+ }, [hoverableSummaryView, isSummaryViewButtonHovered]);
95
+ var handleEmojiSelection = useCallback(function (emojiId, source) {
96
+ onSelection(emojiId, source);
97
+ if (hoverableSummaryView) {
98
+ setSummaryPopupOpen(false);
99
+ }
100
+ }, [onSelection, hoverableSummaryView]);
61
101
  return /*#__PURE__*/React.createElement(Popup, {
62
102
  placement: placement,
103
+ offset: hoverableSummaryView ? [0, 0] : undefined,
63
104
  content: function content() {
64
105
  return /*#__PURE__*/React.createElement(Box, {
65
- testId: RENDER_SUMMARY_VIEW_POPUP_TESTID
106
+ testId: RENDER_SUMMARY_VIEW_POPUP_TESTID,
107
+ onMouseEnter: handleSummaryViewTrayMouseEnter,
108
+ onMouseLeave: handleSummaryViewTrayMouseLeave
66
109
  }, /*#__PURE__*/React.createElement(Inline, {
67
110
  xcss: styles.summaryPopup,
68
111
  space: "space.025",
@@ -87,7 +130,7 @@ export var ReactionSummaryView = function ReactionSummaryView(_ref) {
87
130
  }, /*#__PURE__*/React.createElement(ReactionSummaryViewEmojiPicker, {
88
131
  emojiProvider: emojiProvider,
89
132
  disabled: disabled,
90
- onSelection: onSelection,
133
+ onSelection: handleEmojiSelection,
91
134
  emojiPickerSize: emojiPickerSize,
92
135
  tooltipContent: tooltipContent,
93
136
  reactionPickerTriggerIcon: reactionPickerTriggerIcon,
@@ -102,6 +145,8 @@ export var ReactionSummaryView = function ReactionSummaryView(_ref) {
102
145
  emojiProvider: emojiProvider,
103
146
  reactions: reactions,
104
147
  onClick: handleSummaryClick,
148
+ onMouseEnter: handleButtonMouseEnter,
149
+ onMouseLeave: handleButtonMouseLeave,
105
150
  showOpaqueBackground: showOpaqueBackground,
106
151
  subtleReactionsSummaryAndPicker: subtleReactionsSummaryAndPicker,
107
152
  useButtonAlignmentStyling: useButtonAlignmentStyling
@@ -61,7 +61,8 @@ export var ReactionSummaryViewEmojiPicker = function ReactionSummaryViewEmojiPic
61
61
  return /*#__PURE__*/React.createElement(Popup, {
62
62
  testId: "reaction-summary-view-emoji-picker",
63
63
  isOpen: isOpen,
64
- placement: "right",
64
+ placement: "bottom-start",
65
+ offset: [-10, -66],
65
66
  onClose: function onClose() {
66
67
  return close();
67
68
  },
@@ -131,7 +131,9 @@ export var Reactions = /*#__PURE__*/React.memo(function (_ref) {
131
131
  allowSelectFromSummaryView = _ref$allowSelectFromS === void 0 ? false : _ref$allowSelectFromS,
132
132
  _ref$useButtonAlignme = _ref.useButtonAlignmentStyling,
133
133
  useButtonAlignmentStyling = _ref$useButtonAlignme === void 0 ? false : _ref$useButtonAlignme,
134
- reactionPickerTriggerText = _ref.reactionPickerTriggerText;
134
+ reactionPickerTriggerText = _ref.reactionPickerTriggerText,
135
+ _ref$hoverableSummary = _ref.hoverableSummaryView,
136
+ hoverableSummaryView = _ref$hoverableSummary === void 0 ? false : _ref$hoverableSummary;
135
137
  var _useState = useState(''),
136
138
  _useState2 = _slicedToArray(_useState, 2),
137
139
  selectedEmojiId = _useState2[0],
@@ -313,7 +315,8 @@ export var Reactions = /*#__PURE__*/React.memo(function (_ref) {
313
315
  emojiPickerSize: emojiPickerSize,
314
316
  onOpen: handlePickerOpen,
315
317
  useButtonAlignmentStyling: useButtonAlignmentStyling,
316
- reactionPickerTriggerText: reactionPickerTriggerText
318
+ reactionPickerTriggerText: reactionPickerTriggerText,
319
+ hoverableSummaryView: hoverableSummaryView
317
320
  })) : memorizedReactions.map(function (reaction) {
318
321
  return /*#__PURE__*/React.createElement(Reaction, {
319
322
  key: reaction.emojiId,
@@ -6,6 +6,7 @@ interface ReactionButtonProps extends Pick<ReactionProps, 'flash'> {
6
6
  ariaLabel: string;
7
7
  ariaPressed?: boolean;
8
8
  onMouseEnter?: (event: React.MouseEvent<HTMLButtonElement>) => void;
9
+ onMouseLeave?: (event: React.MouseEvent<HTMLButtonElement>) => void;
9
10
  onFocus?: (event: React.FocusEvent<HTMLButtonElement>) => void;
10
11
  dataAttributes?: {
11
12
  [key: string]: string;
@@ -17,5 +18,5 @@ interface ReactionButtonProps extends Pick<ReactionProps, 'flash'> {
17
18
  useCompactStyles?: boolean;
18
19
  reacted?: boolean;
19
20
  }
20
- export declare const ReactionButton: ({ onClick, flash, showSubtleStyle, showOpaqueBackground, useCompactStyles, reacted, ariaLabel, ariaPressed, onMouseEnter, onFocus, children, dataAttributes, testId, }: ReactionButtonProps) => JSX.Element;
21
+ export declare const ReactionButton: ({ onClick, flash, showSubtleStyle, showOpaqueBackground, useCompactStyles, reacted, ariaLabel, ariaPressed, onMouseEnter, onMouseLeave, onFocus, children, dataAttributes, testId, }: ReactionButtonProps) => JSX.Element;
21
22
  export {};
@@ -17,6 +17,14 @@ interface ReactionSummaryButtonProps extends Pick<ReactionsProps, 'emojiProvider
17
17
  * Optional prop for applying subtle styling to reaction summary button
18
18
  */
19
19
  subtleReactionsSummaryAndPicker?: boolean;
20
+ /**
21
+ * Optional event handler when mouse enters the button
22
+ */
23
+ onMouseEnter?: () => void;
24
+ /**
25
+ * Optional event handler when mouse leaves the button
26
+ */
27
+ onMouseLeave?: () => void;
20
28
  }
21
29
  /**
22
30
  * Test id for summary reaction wrapper button
@@ -53,6 +53,10 @@ interface ReactionSummaryViewProps extends Pick<ReactionsProps, 'emojiProvider'
53
53
  * Optional event handler when the emoji picker is opened
54
54
  */
55
55
  onOpen?: () => void;
56
+ /**
57
+ * Optional prop to make the summary view open on hover
58
+ */
59
+ hoverableSummaryView?: boolean;
56
60
  }
57
- export declare const ReactionSummaryView: ({ emojiProvider, reactions, flash, particleEffectByEmoji, placement, onReactionClick, onReactionFocused, onReactionMouseEnter, showOpaqueBackground, subtleReactionsSummaryAndPicker, allowUserDialog, handleOpenReactionsDialog, isViewOnly, allowSelectFromSummaryView, disabled, emojiPickerSize, onSelection, tooltipContent, reactionPickerTriggerIcon, onOpen, useButtonAlignmentStyling, reactionPickerTriggerText, }: ReactionSummaryViewProps) => JSX.Element;
61
+ export declare const ReactionSummaryView: ({ emojiProvider, reactions, flash, particleEffectByEmoji, placement, onReactionClick, onReactionFocused, onReactionMouseEnter, showOpaqueBackground, subtleReactionsSummaryAndPicker, allowUserDialog, handleOpenReactionsDialog, isViewOnly, allowSelectFromSummaryView, disabled, emojiPickerSize, onSelection, tooltipContent, reactionPickerTriggerIcon, onOpen, useButtonAlignmentStyling, reactionPickerTriggerText, hoverableSummaryView, }: ReactionSummaryViewProps) => JSX.Element;
58
62
  export {};
@@ -161,6 +161,10 @@ export interface ReactionsProps extends Pick<ReactionPickerProps, 'allowAllEmoji
161
161
  * Optional prop for controlling text of the trigger button
162
162
  */
163
163
  reactionPickerTriggerText?: string;
164
+ /**
165
+ * Optional prop for controlling if the summary view is hoverable
166
+ */
167
+ hoverableSummaryView?: boolean;
164
168
  }
165
169
  export interface OpenReactionsDialogOptions {
166
170
  emojiId?: string;
@@ -173,4 +177,4 @@ export declare function getTooltip(status: ReactionStatus, errorMessage?: string
173
177
  /**
174
178
  * Renders list of reactions
175
179
  */
176
- 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, }: ReactionsProps) => JSX.Element>;
180
+ 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, }: ReactionsProps) => JSX.Element>;
@@ -6,6 +6,7 @@ interface ReactionButtonProps extends Pick<ReactionProps, 'flash'> {
6
6
  ariaLabel: string;
7
7
  ariaPressed?: boolean;
8
8
  onMouseEnter?: (event: React.MouseEvent<HTMLButtonElement>) => void;
9
+ onMouseLeave?: (event: React.MouseEvent<HTMLButtonElement>) => void;
9
10
  onFocus?: (event: React.FocusEvent<HTMLButtonElement>) => void;
10
11
  dataAttributes?: {
11
12
  [key: string]: string;
@@ -17,5 +18,5 @@ interface ReactionButtonProps extends Pick<ReactionProps, 'flash'> {
17
18
  useCompactStyles?: boolean;
18
19
  reacted?: boolean;
19
20
  }
20
- export declare const ReactionButton: ({ onClick, flash, showSubtleStyle, showOpaqueBackground, useCompactStyles, reacted, ariaLabel, ariaPressed, onMouseEnter, onFocus, children, dataAttributes, testId, }: ReactionButtonProps) => JSX.Element;
21
+ export declare const ReactionButton: ({ onClick, flash, showSubtleStyle, showOpaqueBackground, useCompactStyles, reacted, ariaLabel, ariaPressed, onMouseEnter, onMouseLeave, onFocus, children, dataAttributes, testId, }: ReactionButtonProps) => JSX.Element;
21
22
  export {};
@@ -17,6 +17,14 @@ interface ReactionSummaryButtonProps extends Pick<ReactionsProps, 'emojiProvider
17
17
  * Optional prop for applying subtle styling to reaction summary button
18
18
  */
19
19
  subtleReactionsSummaryAndPicker?: boolean;
20
+ /**
21
+ * Optional event handler when mouse enters the button
22
+ */
23
+ onMouseEnter?: () => void;
24
+ /**
25
+ * Optional event handler when mouse leaves the button
26
+ */
27
+ onMouseLeave?: () => void;
20
28
  }
21
29
  /**
22
30
  * Test id for summary reaction wrapper button
@@ -53,6 +53,10 @@ interface ReactionSummaryViewProps extends Pick<ReactionsProps, 'emojiProvider'
53
53
  * Optional event handler when the emoji picker is opened
54
54
  */
55
55
  onOpen?: () => void;
56
+ /**
57
+ * Optional prop to make the summary view open on hover
58
+ */
59
+ hoverableSummaryView?: boolean;
56
60
  }
57
- export declare const ReactionSummaryView: ({ emojiProvider, reactions, flash, particleEffectByEmoji, placement, onReactionClick, onReactionFocused, onReactionMouseEnter, showOpaqueBackground, subtleReactionsSummaryAndPicker, allowUserDialog, handleOpenReactionsDialog, isViewOnly, allowSelectFromSummaryView, disabled, emojiPickerSize, onSelection, tooltipContent, reactionPickerTriggerIcon, onOpen, useButtonAlignmentStyling, reactionPickerTriggerText, }: ReactionSummaryViewProps) => JSX.Element;
61
+ export declare const ReactionSummaryView: ({ emojiProvider, reactions, flash, particleEffectByEmoji, placement, onReactionClick, onReactionFocused, onReactionMouseEnter, showOpaqueBackground, subtleReactionsSummaryAndPicker, allowUserDialog, handleOpenReactionsDialog, isViewOnly, allowSelectFromSummaryView, disabled, emojiPickerSize, onSelection, tooltipContent, reactionPickerTriggerIcon, onOpen, useButtonAlignmentStyling, reactionPickerTriggerText, hoverableSummaryView, }: ReactionSummaryViewProps) => JSX.Element;
58
62
  export {};
@@ -161,6 +161,10 @@ export interface ReactionsProps extends Pick<ReactionPickerProps, 'allowAllEmoji
161
161
  * Optional prop for controlling text of the trigger button
162
162
  */
163
163
  reactionPickerTriggerText?: string;
164
+ /**
165
+ * Optional prop for controlling if the summary view is hoverable
166
+ */
167
+ hoverableSummaryView?: boolean;
164
168
  }
165
169
  export interface OpenReactionsDialogOptions {
166
170
  emojiId?: string;
@@ -173,4 +177,4 @@ export declare function getTooltip(status: ReactionStatus, errorMessage?: string
173
177
  /**
174
178
  * Renders list of reactions
175
179
  */
176
- 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, }: ReactionsProps) => JSX.Element>;
180
+ 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, }: ReactionsProps) => JSX.Element>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/reactions",
3
- "version": "31.0.1",
3
+ "version": "31.2.0",
4
4
  "description": "Reactions component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -40,19 +40,19 @@
40
40
  "@atlaskit/css": "^0.10.0",
41
41
  "@atlaskit/emoji": "^69.0.0",
42
42
  "@atlaskit/heading": "^5.2.0",
43
- "@atlaskit/icon": "^25.5.0",
43
+ "@atlaskit/icon": "^25.6.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",
47
47
  "@atlaskit/platform-feature-flags-react": "^0.1.0",
48
48
  "@atlaskit/popper": "^7.0.0",
49
- "@atlaskit/popup": "^4.0.0",
49
+ "@atlaskit/popup": "^4.1.0",
50
50
  "@atlaskit/primitives": "^14.4.0",
51
- "@atlaskit/react-ufo": "^3.5.0",
51
+ "@atlaskit/react-ufo": "^3.6.0",
52
52
  "@atlaskit/spinner": "^18.0.0",
53
53
  "@atlaskit/tabs": "^18.0.0",
54
54
  "@atlaskit/theme": "^18.0.0",
55
- "@atlaskit/tokens": "^4.7.0",
55
+ "@atlaskit/tokens": "^4.8.0",
56
56
  "@atlaskit/tooltip": "^20.0.0",
57
57
  "@atlaskit/ufo": "^0.4.0",
58
58
  "@atlaskit/util-service-support": "^6.3.0",