@atlaskit/reactions 31.3.0 → 31.4.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 +22 -0
- package/dist/cjs/analytics/index.js +1 -1
- package/dist/cjs/components/ReactionSummaryView.js +20 -18
- package/dist/cjs/hooks/useDelayedState.js +37 -0
- package/dist/es2019/analytics/index.js +1 -1
- package/dist/es2019/components/ReactionSummaryView.js +12 -11
- package/dist/es2019/hooks/useDelayedState.js +25 -0
- package/dist/esm/analytics/index.js +1 -1
- package/dist/esm/components/ReactionSummaryView.js +20 -18
- package/dist/esm/hooks/useDelayedState.js +30 -0
- package/dist/types/components/ReactionSummaryView.d.ts +5 -1
- package/dist/types/hooks/useDelayedState.d.ts +3 -0
- package/dist/types-ts4.5/components/ReactionSummaryView.d.ts +5 -1
- package/dist/types-ts4.5/hooks/useDelayedState.d.ts +6 -0
- package/docs/0-intro.tsx +1 -1
- package/docs/1-connected-reaction-picker.tsx +1 -1
- package/docs/2-connected-reactions-view.tsx +1 -1
- package/docs/3-reactions-store.tsx +1 -1
- package/docs/5-graphql-support.tsx +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @atlaskit/reactions
|
|
2
2
|
|
|
3
|
+
## 31.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#144510](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/144510)
|
|
8
|
+
[`9d23464afe923`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9d23464afe923) -
|
|
9
|
+
[ux] adding delay to opening/closing the summary view tray when hovering is enabled via the
|
|
10
|
+
hoverableSummaryView prop
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
16
|
+
## 31.3.1
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- [#142842](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/142842)
|
|
21
|
+
[`63265d6000c11`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/63265d6000c11) -
|
|
22
|
+
Internal change to migrate to Compiled CSS-in-JS styling.
|
|
23
|
+
- Updated dependencies
|
|
24
|
+
|
|
3
25
|
## 31.3.0
|
|
4
26
|
|
|
5
27
|
### Minor 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.
|
|
14
|
+
var packageVersion = "31.4.0";
|
|
15
15
|
/**
|
|
16
16
|
* TODO: move to utility package?
|
|
17
17
|
* A random sampling function
|
|
@@ -14,6 +14,7 @@ var _runtime = require("@compiled/react/runtime");
|
|
|
14
14
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
15
15
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
16
16
|
var _popup = _interopRequireDefault(require("@atlaskit/popup"));
|
|
17
|
+
var _useDelayedState3 = require("../hooks/useDelayedState");
|
|
17
18
|
var _Reaction = require("./Reaction");
|
|
18
19
|
var _ReactionSummaryViewEmojiPicker = require("./ReactionSummaryViewEmojiPicker");
|
|
19
20
|
var _ReactionSummaryButton = require("./ReactionSummaryButton");
|
|
@@ -59,58 +60,59 @@ var ReactionSummaryView = exports.ReactionSummaryView = function ReactionSummary
|
|
|
59
60
|
useButtonAlignmentStyling = _ref.useButtonAlignmentStyling,
|
|
60
61
|
reactionPickerTriggerText = _ref.reactionPickerTriggerText,
|
|
61
62
|
_ref$hoverableSummary = _ref.hoverableSummaryView,
|
|
62
|
-
hoverableSummaryView = _ref$hoverableSummary === void 0 ? false : _ref$hoverableSummary
|
|
63
|
+
hoverableSummaryView = _ref$hoverableSummary === void 0 ? false : _ref$hoverableSummary,
|
|
64
|
+
_ref$hoverableSummary2 = _ref.hoverableSummaryViewDelay,
|
|
65
|
+
hoverableSummaryViewDelay = _ref$hoverableSummary2 === void 0 ? 300 : _ref$hoverableSummary2;
|
|
66
|
+
var _useDelayedState = (0, _useDelayedState3.useDelayedState)(false, hoverableSummaryViewDelay),
|
|
67
|
+
_useDelayedState2 = (0, _slicedToArray2.default)(_useDelayedState, 2),
|
|
68
|
+
isSummaryPopupOpen = _useDelayedState2[0],
|
|
69
|
+
setSummaryPopupOpen = _useDelayedState2[1];
|
|
63
70
|
var _useState = (0, _react.useState)(false),
|
|
64
71
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
65
|
-
|
|
66
|
-
|
|
72
|
+
isHoveringSummaryView = _useState2[0],
|
|
73
|
+
setIsHoveringSummaryView = _useState2[1];
|
|
67
74
|
var _useState3 = (0, _react.useState)(false),
|
|
68
75
|
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
var _useState5 = (0, _react.useState)(false),
|
|
72
|
-
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
73
|
-
isSummaryViewButtonHovered = _useState6[0],
|
|
74
|
-
setIsSummaryViewButtonHovered = _useState6[1];
|
|
76
|
+
isSummaryViewButtonHovered = _useState4[0],
|
|
77
|
+
setIsSummaryViewButtonHovered = _useState4[1];
|
|
75
78
|
var handlePopupClose = (0, _react.useCallback)(function () {
|
|
76
79
|
return setSummaryPopupOpen(false);
|
|
77
|
-
}, []);
|
|
80
|
+
}, [setSummaryPopupOpen]);
|
|
78
81
|
var handleSummaryClick = (0, _react.useCallback)(function () {
|
|
79
82
|
return setSummaryPopupOpen(!isSummaryPopupOpen);
|
|
80
|
-
}, [isSummaryPopupOpen]);
|
|
83
|
+
}, [isSummaryPopupOpen, setSummaryPopupOpen]);
|
|
81
84
|
var handleButtonMouseEnter = (0, _react.useCallback)(function () {
|
|
82
85
|
setIsSummaryViewButtonHovered(true);
|
|
83
86
|
if (hoverableSummaryView) {
|
|
84
87
|
setSummaryPopupOpen(true);
|
|
85
88
|
}
|
|
86
|
-
}, [hoverableSummaryView]);
|
|
89
|
+
}, [hoverableSummaryView, setSummaryPopupOpen]);
|
|
87
90
|
var handleButtonMouseLeave = (0, _react.useCallback)(function () {
|
|
88
91
|
setIsSummaryViewButtonHovered(false);
|
|
89
92
|
if (hoverableSummaryView && !isHoveringSummaryView) {
|
|
90
93
|
setSummaryPopupOpen(false);
|
|
91
94
|
}
|
|
92
|
-
}, [hoverableSummaryView, isHoveringSummaryView]);
|
|
95
|
+
}, [hoverableSummaryView, isHoveringSummaryView, setSummaryPopupOpen]);
|
|
93
96
|
var handleSummaryViewTrayMouseEnter = (0, _react.useCallback)(function () {
|
|
94
97
|
setIsHoveringSummaryView(true);
|
|
95
98
|
if (hoverableSummaryView) {
|
|
96
99
|
setSummaryPopupOpen(true);
|
|
97
100
|
}
|
|
98
|
-
}, [hoverableSummaryView]);
|
|
101
|
+
}, [hoverableSummaryView, setSummaryPopupOpen]);
|
|
99
102
|
var handleSummaryViewTrayMouseLeave = (0, _react.useCallback)(function () {
|
|
100
103
|
setIsHoveringSummaryView(false);
|
|
101
104
|
if (hoverableSummaryView && !isSummaryViewButtonHovered) {
|
|
102
105
|
setSummaryPopupOpen(false);
|
|
103
106
|
}
|
|
104
|
-
}, [hoverableSummaryView, isSummaryViewButtonHovered]);
|
|
107
|
+
}, [hoverableSummaryView, isSummaryViewButtonHovered, setSummaryPopupOpen]);
|
|
105
108
|
var handleEmojiSelection = (0, _react.useCallback)(function (emojiId, source) {
|
|
106
109
|
onSelection(emojiId, source);
|
|
107
110
|
if (hoverableSummaryView) {
|
|
108
|
-
setSummaryPopupOpen(false);
|
|
111
|
+
setSummaryPopupOpen(false, true);
|
|
109
112
|
}
|
|
110
|
-
}, [onSelection, hoverableSummaryView]);
|
|
113
|
+
}, [onSelection, hoverableSummaryView, setSummaryPopupOpen]);
|
|
111
114
|
return /*#__PURE__*/React.createElement(_popup.default, {
|
|
112
115
|
placement: placement,
|
|
113
|
-
offset: hoverableSummaryView ? [0, 0] : undefined,
|
|
114
116
|
content: function content() {
|
|
115
117
|
return /*#__PURE__*/React.createElement(_compiled.Box, {
|
|
116
118
|
testId: RENDER_SUMMARY_VIEW_POPUP_TESTID,
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useDelayedState = void 0;
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
+
var _react = require("react");
|
|
10
|
+
var useDelayedState = exports.useDelayedState = function useDelayedState(initialState, delay) {
|
|
11
|
+
var _useState = (0, _react.useState)(initialState),
|
|
12
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
13
|
+
state = _useState2[0],
|
|
14
|
+
setState = _useState2[1];
|
|
15
|
+
var timeoutRef = (0, _react.useRef)(null);
|
|
16
|
+
(0, _react.useEffect)(function () {
|
|
17
|
+
return function () {
|
|
18
|
+
if (timeoutRef.current) {
|
|
19
|
+
clearTimeout(timeoutRef.current);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}, []);
|
|
23
|
+
var handleDelayedStateChange = (0, _react.useCallback)(function (newState) {
|
|
24
|
+
var immediate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
25
|
+
if (timeoutRef.current) {
|
|
26
|
+
clearTimeout(timeoutRef.current);
|
|
27
|
+
}
|
|
28
|
+
if (immediate) {
|
|
29
|
+
setState(newState);
|
|
30
|
+
} else {
|
|
31
|
+
timeoutRef.current = setTimeout(function () {
|
|
32
|
+
setState(newState);
|
|
33
|
+
}, delay);
|
|
34
|
+
}
|
|
35
|
+
}, [delay]);
|
|
36
|
+
return [state, handleDelayedStateChange];
|
|
37
|
+
};
|
|
@@ -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.
|
|
4
|
+
const packageVersion = "31.4.0";
|
|
5
5
|
/**
|
|
6
6
|
* TODO: move to utility package?
|
|
7
7
|
* A random sampling function
|
|
@@ -5,6 +5,7 @@ import * as React from 'react';
|
|
|
5
5
|
import { ax, ix } from "@compiled/react/runtime";
|
|
6
6
|
import { useCallback, useState } from 'react';
|
|
7
7
|
import Popup from '@atlaskit/popup';
|
|
8
|
+
import { useDelayedState } from '../hooks/useDelayedState';
|
|
8
9
|
import { Reaction } from './Reaction';
|
|
9
10
|
import { ReactionSummaryViewEmojiPicker } from './ReactionSummaryViewEmojiPicker';
|
|
10
11
|
import { ReactionSummaryButton } from './ReactionSummaryButton';
|
|
@@ -40,46 +41,46 @@ export const ReactionSummaryView = ({
|
|
|
40
41
|
onOpen,
|
|
41
42
|
useButtonAlignmentStyling,
|
|
42
43
|
reactionPickerTriggerText,
|
|
43
|
-
hoverableSummaryView = false
|
|
44
|
+
hoverableSummaryView = false,
|
|
45
|
+
hoverableSummaryViewDelay = 300
|
|
44
46
|
}) => {
|
|
45
|
-
const [isSummaryPopupOpen, setSummaryPopupOpen] =
|
|
47
|
+
const [isSummaryPopupOpen, setSummaryPopupOpen] = useDelayedState(false, hoverableSummaryViewDelay);
|
|
46
48
|
const [isHoveringSummaryView, setIsHoveringSummaryView] = useState(false);
|
|
47
49
|
const [isSummaryViewButtonHovered, setIsSummaryViewButtonHovered] = useState(false);
|
|
48
|
-
const handlePopupClose = useCallback(() => setSummaryPopupOpen(false), []);
|
|
49
|
-
const handleSummaryClick = useCallback(() => setSummaryPopupOpen(!isSummaryPopupOpen), [isSummaryPopupOpen]);
|
|
50
|
+
const handlePopupClose = useCallback(() => setSummaryPopupOpen(false), [setSummaryPopupOpen]);
|
|
51
|
+
const handleSummaryClick = useCallback(() => setSummaryPopupOpen(!isSummaryPopupOpen), [isSummaryPopupOpen, setSummaryPopupOpen]);
|
|
50
52
|
const handleButtonMouseEnter = useCallback(() => {
|
|
51
53
|
setIsSummaryViewButtonHovered(true);
|
|
52
54
|
if (hoverableSummaryView) {
|
|
53
55
|
setSummaryPopupOpen(true);
|
|
54
56
|
}
|
|
55
|
-
}, [hoverableSummaryView]);
|
|
57
|
+
}, [hoverableSummaryView, setSummaryPopupOpen]);
|
|
56
58
|
const handleButtonMouseLeave = useCallback(() => {
|
|
57
59
|
setIsSummaryViewButtonHovered(false);
|
|
58
60
|
if (hoverableSummaryView && !isHoveringSummaryView) {
|
|
59
61
|
setSummaryPopupOpen(false);
|
|
60
62
|
}
|
|
61
|
-
}, [hoverableSummaryView, isHoveringSummaryView]);
|
|
63
|
+
}, [hoverableSummaryView, isHoveringSummaryView, setSummaryPopupOpen]);
|
|
62
64
|
const handleSummaryViewTrayMouseEnter = useCallback(() => {
|
|
63
65
|
setIsHoveringSummaryView(true);
|
|
64
66
|
if (hoverableSummaryView) {
|
|
65
67
|
setSummaryPopupOpen(true);
|
|
66
68
|
}
|
|
67
|
-
}, [hoverableSummaryView]);
|
|
69
|
+
}, [hoverableSummaryView, setSummaryPopupOpen]);
|
|
68
70
|
const handleSummaryViewTrayMouseLeave = useCallback(() => {
|
|
69
71
|
setIsHoveringSummaryView(false);
|
|
70
72
|
if (hoverableSummaryView && !isSummaryViewButtonHovered) {
|
|
71
73
|
setSummaryPopupOpen(false);
|
|
72
74
|
}
|
|
73
|
-
}, [hoverableSummaryView, isSummaryViewButtonHovered]);
|
|
75
|
+
}, [hoverableSummaryView, isSummaryViewButtonHovered, setSummaryPopupOpen]);
|
|
74
76
|
const handleEmojiSelection = useCallback((emojiId, source) => {
|
|
75
77
|
onSelection(emojiId, source);
|
|
76
78
|
if (hoverableSummaryView) {
|
|
77
|
-
setSummaryPopupOpen(false);
|
|
79
|
+
setSummaryPopupOpen(false, true);
|
|
78
80
|
}
|
|
79
|
-
}, [onSelection, hoverableSummaryView]);
|
|
81
|
+
}, [onSelection, hoverableSummaryView, setSummaryPopupOpen]);
|
|
80
82
|
return /*#__PURE__*/React.createElement(Popup, {
|
|
81
83
|
placement: placement,
|
|
82
|
-
offset: hoverableSummaryView ? [0, 0] : undefined,
|
|
83
84
|
content: () => /*#__PURE__*/React.createElement(Box, {
|
|
84
85
|
testId: RENDER_SUMMARY_VIEW_POPUP_TESTID,
|
|
85
86
|
onMouseEnter: handleSummaryViewTrayMouseEnter,
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useCallback, useRef, useEffect, useState } from 'react';
|
|
2
|
+
export const useDelayedState = (initialState, delay) => {
|
|
3
|
+
const [state, setState] = useState(initialState);
|
|
4
|
+
const timeoutRef = useRef(null);
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
return () => {
|
|
7
|
+
if (timeoutRef.current) {
|
|
8
|
+
clearTimeout(timeoutRef.current);
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
}, []);
|
|
12
|
+
const handleDelayedStateChange = useCallback((newState, immediate = false) => {
|
|
13
|
+
if (timeoutRef.current) {
|
|
14
|
+
clearTimeout(timeoutRef.current);
|
|
15
|
+
}
|
|
16
|
+
if (immediate) {
|
|
17
|
+
setState(newState);
|
|
18
|
+
} else {
|
|
19
|
+
timeoutRef.current = setTimeout(() => {
|
|
20
|
+
setState(newState);
|
|
21
|
+
}, delay);
|
|
22
|
+
}
|
|
23
|
+
}, [delay]);
|
|
24
|
+
return [state, handleDelayedStateChange];
|
|
25
|
+
};
|
|
@@ -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.
|
|
7
|
+
var packageVersion = "31.4.0";
|
|
8
8
|
/**
|
|
9
9
|
* TODO: move to utility package?
|
|
10
10
|
* A random sampling function
|
|
@@ -6,6 +6,7 @@ import * as React from 'react';
|
|
|
6
6
|
import { ax, ix } from "@compiled/react/runtime";
|
|
7
7
|
import { useCallback, useState } from 'react';
|
|
8
8
|
import Popup from '@atlaskit/popup';
|
|
9
|
+
import { useDelayedState } from '../hooks/useDelayedState';
|
|
9
10
|
import { Reaction } from './Reaction';
|
|
10
11
|
import { ReactionSummaryViewEmojiPicker } from './ReactionSummaryViewEmojiPicker';
|
|
11
12
|
import { ReactionSummaryButton } from './ReactionSummaryButton';
|
|
@@ -49,58 +50,59 @@ export var ReactionSummaryView = function ReactionSummaryView(_ref) {
|
|
|
49
50
|
useButtonAlignmentStyling = _ref.useButtonAlignmentStyling,
|
|
50
51
|
reactionPickerTriggerText = _ref.reactionPickerTriggerText,
|
|
51
52
|
_ref$hoverableSummary = _ref.hoverableSummaryView,
|
|
52
|
-
hoverableSummaryView = _ref$hoverableSummary === void 0 ? false : _ref$hoverableSummary
|
|
53
|
+
hoverableSummaryView = _ref$hoverableSummary === void 0 ? false : _ref$hoverableSummary,
|
|
54
|
+
_ref$hoverableSummary2 = _ref.hoverableSummaryViewDelay,
|
|
55
|
+
hoverableSummaryViewDelay = _ref$hoverableSummary2 === void 0 ? 300 : _ref$hoverableSummary2;
|
|
56
|
+
var _useDelayedState = useDelayedState(false, hoverableSummaryViewDelay),
|
|
57
|
+
_useDelayedState2 = _slicedToArray(_useDelayedState, 2),
|
|
58
|
+
isSummaryPopupOpen = _useDelayedState2[0],
|
|
59
|
+
setSummaryPopupOpen = _useDelayedState2[1];
|
|
53
60
|
var _useState = useState(false),
|
|
54
61
|
_useState2 = _slicedToArray(_useState, 2),
|
|
55
|
-
|
|
56
|
-
|
|
62
|
+
isHoveringSummaryView = _useState2[0],
|
|
63
|
+
setIsHoveringSummaryView = _useState2[1];
|
|
57
64
|
var _useState3 = useState(false),
|
|
58
65
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
var _useState5 = useState(false),
|
|
62
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
63
|
-
isSummaryViewButtonHovered = _useState6[0],
|
|
64
|
-
setIsSummaryViewButtonHovered = _useState6[1];
|
|
66
|
+
isSummaryViewButtonHovered = _useState4[0],
|
|
67
|
+
setIsSummaryViewButtonHovered = _useState4[1];
|
|
65
68
|
var handlePopupClose = useCallback(function () {
|
|
66
69
|
return setSummaryPopupOpen(false);
|
|
67
|
-
}, []);
|
|
70
|
+
}, [setSummaryPopupOpen]);
|
|
68
71
|
var handleSummaryClick = useCallback(function () {
|
|
69
72
|
return setSummaryPopupOpen(!isSummaryPopupOpen);
|
|
70
|
-
}, [isSummaryPopupOpen]);
|
|
73
|
+
}, [isSummaryPopupOpen, setSummaryPopupOpen]);
|
|
71
74
|
var handleButtonMouseEnter = useCallback(function () {
|
|
72
75
|
setIsSummaryViewButtonHovered(true);
|
|
73
76
|
if (hoverableSummaryView) {
|
|
74
77
|
setSummaryPopupOpen(true);
|
|
75
78
|
}
|
|
76
|
-
}, [hoverableSummaryView]);
|
|
79
|
+
}, [hoverableSummaryView, setSummaryPopupOpen]);
|
|
77
80
|
var handleButtonMouseLeave = useCallback(function () {
|
|
78
81
|
setIsSummaryViewButtonHovered(false);
|
|
79
82
|
if (hoverableSummaryView && !isHoveringSummaryView) {
|
|
80
83
|
setSummaryPopupOpen(false);
|
|
81
84
|
}
|
|
82
|
-
}, [hoverableSummaryView, isHoveringSummaryView]);
|
|
85
|
+
}, [hoverableSummaryView, isHoveringSummaryView, setSummaryPopupOpen]);
|
|
83
86
|
var handleSummaryViewTrayMouseEnter = useCallback(function () {
|
|
84
87
|
setIsHoveringSummaryView(true);
|
|
85
88
|
if (hoverableSummaryView) {
|
|
86
89
|
setSummaryPopupOpen(true);
|
|
87
90
|
}
|
|
88
|
-
}, [hoverableSummaryView]);
|
|
91
|
+
}, [hoverableSummaryView, setSummaryPopupOpen]);
|
|
89
92
|
var handleSummaryViewTrayMouseLeave = useCallback(function () {
|
|
90
93
|
setIsHoveringSummaryView(false);
|
|
91
94
|
if (hoverableSummaryView && !isSummaryViewButtonHovered) {
|
|
92
95
|
setSummaryPopupOpen(false);
|
|
93
96
|
}
|
|
94
|
-
}, [hoverableSummaryView, isSummaryViewButtonHovered]);
|
|
97
|
+
}, [hoverableSummaryView, isSummaryViewButtonHovered, setSummaryPopupOpen]);
|
|
95
98
|
var handleEmojiSelection = useCallback(function (emojiId, source) {
|
|
96
99
|
onSelection(emojiId, source);
|
|
97
100
|
if (hoverableSummaryView) {
|
|
98
|
-
setSummaryPopupOpen(false);
|
|
101
|
+
setSummaryPopupOpen(false, true);
|
|
99
102
|
}
|
|
100
|
-
}, [onSelection, hoverableSummaryView]);
|
|
103
|
+
}, [onSelection, hoverableSummaryView, setSummaryPopupOpen]);
|
|
101
104
|
return /*#__PURE__*/React.createElement(Popup, {
|
|
102
105
|
placement: placement,
|
|
103
|
-
offset: hoverableSummaryView ? [0, 0] : undefined,
|
|
104
106
|
content: function content() {
|
|
105
107
|
return /*#__PURE__*/React.createElement(Box, {
|
|
106
108
|
testId: RENDER_SUMMARY_VIEW_POPUP_TESTID,
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import { useCallback, useRef, useEffect, useState } from 'react';
|
|
3
|
+
export var useDelayedState = function useDelayedState(initialState, delay) {
|
|
4
|
+
var _useState = useState(initialState),
|
|
5
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
6
|
+
state = _useState2[0],
|
|
7
|
+
setState = _useState2[1];
|
|
8
|
+
var timeoutRef = useRef(null);
|
|
9
|
+
useEffect(function () {
|
|
10
|
+
return function () {
|
|
11
|
+
if (timeoutRef.current) {
|
|
12
|
+
clearTimeout(timeoutRef.current);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
}, []);
|
|
16
|
+
var handleDelayedStateChange = useCallback(function (newState) {
|
|
17
|
+
var immediate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
18
|
+
if (timeoutRef.current) {
|
|
19
|
+
clearTimeout(timeoutRef.current);
|
|
20
|
+
}
|
|
21
|
+
if (immediate) {
|
|
22
|
+
setState(newState);
|
|
23
|
+
} else {
|
|
24
|
+
timeoutRef.current = setTimeout(function () {
|
|
25
|
+
setState(newState);
|
|
26
|
+
}, delay);
|
|
27
|
+
}
|
|
28
|
+
}, [delay]);
|
|
29
|
+
return [state, handleDelayedStateChange];
|
|
30
|
+
};
|
|
@@ -57,6 +57,10 @@ interface ReactionSummaryViewProps extends Pick<ReactionsProps, 'emojiProvider'
|
|
|
57
57
|
* Optional prop to make the summary view open on hover
|
|
58
58
|
*/
|
|
59
59
|
hoverableSummaryView?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Optional prop to set a delay for the summary view when it opens/closes on hover
|
|
62
|
+
*/
|
|
63
|
+
hoverableSummaryViewDelay?: number;
|
|
60
64
|
}
|
|
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;
|
|
65
|
+
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, hoverableSummaryViewDelay, }: ReactionSummaryViewProps) => JSX.Element;
|
|
62
66
|
export {};
|
|
@@ -57,6 +57,10 @@ interface ReactionSummaryViewProps extends Pick<ReactionsProps, 'emojiProvider'
|
|
|
57
57
|
* Optional prop to make the summary view open on hover
|
|
58
58
|
*/
|
|
59
59
|
hoverableSummaryView?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Optional prop to set a delay for the summary view when it opens/closes on hover
|
|
62
|
+
*/
|
|
63
|
+
hoverableSummaryViewDelay?: number;
|
|
60
64
|
}
|
|
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;
|
|
65
|
+
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, hoverableSummaryViewDelay, }: ReactionSummaryViewProps) => JSX.Element;
|
|
62
66
|
export {};
|
package/docs/0-intro.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { md, Example, Props, code, AtlassianInternalWarning } from '@atlaskit/docs';
|
|
3
3
|
import SectionMessage from '@atlaskit/section-message';
|
|
4
|
-
import { Text } from '@atlaskit/primitives';
|
|
4
|
+
import { Text } from '@atlaskit/primitives/compiled';
|
|
5
5
|
|
|
6
6
|
import ReactionsExample from '../examples/01-connected-reactions-view';
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { md, Example, code, Props } from '@atlaskit/docs';
|
|
3
3
|
import SectionMessage from '@atlaskit/section-message';
|
|
4
|
-
import { Text } from '@atlaskit/primitives';
|
|
4
|
+
import { Text } from '@atlaskit/primitives/compiled';
|
|
5
5
|
|
|
6
6
|
import ConnectedReactionPickerExample from '../examples/00-connected-reaction-picker';
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { md, Example, code, Props } from '@atlaskit/docs';
|
|
3
3
|
import SectionMessage from '@atlaskit/section-message';
|
|
4
|
-
import { Text } from '@atlaskit/primitives';
|
|
4
|
+
import { Text } from '@atlaskit/primitives/compiled';
|
|
5
5
|
|
|
6
6
|
import ConnectedReactionsViewExample from '../examples/01-connected-reactions-view';
|
|
7
7
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/reactions",
|
|
3
|
-
"version": "31.
|
|
3
|
+
"version": "31.4.0",
|
|
4
4
|
"description": "Reactions component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@atlaskit/avatar": "^25.0.0",
|
|
39
39
|
"@atlaskit/button": "^23.0.0",
|
|
40
40
|
"@atlaskit/css": "^0.10.0",
|
|
41
|
-
"@atlaskit/emoji": "^69.
|
|
41
|
+
"@atlaskit/emoji": "^69.1.0",
|
|
42
42
|
"@atlaskit/heading": "^5.2.0",
|
|
43
43
|
"@atlaskit/icon": "^25.6.0",
|
|
44
44
|
"@atlaskit/modal-dialog": "^14.1.0",
|