@atlaskit/reactions 26.3.0 → 26.3.2
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 +15 -0
- package/dist/cjs/analytics/index.js +1 -1
- package/dist/cjs/components/ReactionPicker/ReactionPicker.js +26 -10
- package/dist/cjs/components/Reactions/Reactions.js +4 -2
- package/dist/cjs/components/Trigger/Trigger.js +5 -2
- package/dist/es2019/analytics/index.js +1 -1
- package/dist/es2019/components/ReactionPicker/ReactionPicker.js +15 -3
- package/dist/es2019/components/Reactions/Reactions.js +4 -2
- package/dist/es2019/components/Trigger/Trigger.js +5 -2
- package/dist/esm/analytics/index.js +1 -1
- package/dist/esm/components/ReactionPicker/ReactionPicker.js +27 -11
- package/dist/esm/components/Reactions/Reactions.js +4 -2
- package/dist/esm/components/Trigger/Trigger.js +5 -2
- package/dist/types/components/ReactionPicker/ReactionPicker.d.ts +5 -0
- package/dist/types/components/Reactions/Reactions.d.ts +6 -1
- package/dist/types/components/Trigger/Trigger.d.ts +5 -0
- package/dist/types-ts4.5/components/ReactionPicker/ReactionPicker.d.ts +5 -0
- package/dist/types-ts4.5/components/Reactions/Reactions.d.ts +6 -1
- package/dist/types-ts4.5/components/Trigger/Trigger.d.ts +5 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/reactions
|
|
2
2
|
|
|
3
|
+
## 26.3.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#118247](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/118247)
|
|
8
|
+
[`e1a483946dc0d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e1a483946dc0d) -
|
|
9
|
+
[ux] Passing additional prop named reactionPickerAdditionalStyle to enable selected state on the
|
|
10
|
+
reaction picker
|
|
11
|
+
|
|
12
|
+
## 26.3.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 26.3.0
|
|
4
19
|
|
|
5
20
|
### 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 = "26.3.
|
|
14
|
+
var packageVersion = "26.3.2";
|
|
15
15
|
/**
|
|
16
16
|
* TODO: move to utility package?
|
|
17
17
|
* A random sampling function
|
|
@@ -97,7 +97,9 @@ var ReactionPicker = exports.ReactionPicker = /*#__PURE__*/_react.default.memo(f
|
|
|
97
97
|
_props$showAddReactio = props.showAddReactionText,
|
|
98
98
|
showAddReactionText = _props$showAddReactio === void 0 ? false : _props$showAddReactio,
|
|
99
99
|
_props$showRoundTrigg = props.showRoundTrigger,
|
|
100
|
-
showRoundTrigger = _props$showRoundTrigg === void 0 ? false : _props$showRoundTrigg
|
|
100
|
+
showRoundTrigger = _props$showRoundTrigg === void 0 ? false : _props$showRoundTrigg,
|
|
101
|
+
_props$reactionPicker = props.reactionPickerAdditionalStyle,
|
|
102
|
+
reactionPickerAdditionalStyle = _props$reactionPicker === void 0 ? undefined : _props$reactionPicker;
|
|
101
103
|
var _useState = (0, _react.useState)(null),
|
|
102
104
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
103
105
|
triggerRef = _useState2[0],
|
|
@@ -107,8 +109,12 @@ var ReactionPicker = exports.ReactionPicker = /*#__PURE__*/_react.default.memo(f
|
|
|
107
109
|
* Container <div /> reference (used by custom hook to detect click outside)
|
|
108
110
|
*/
|
|
109
111
|
var wrapperRef = (0, _react.useRef)(null);
|
|
112
|
+
var _useState3 = (0, _react.useState)(undefined),
|
|
113
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
114
|
+
selectionStyle = _useState4[0],
|
|
115
|
+
setSelectionStyle = _useState4[1];
|
|
110
116
|
var updatePopper = (0, _react.useRef)();
|
|
111
|
-
var
|
|
117
|
+
var _useState5 = (0, _react.useState)({
|
|
112
118
|
/**
|
|
113
119
|
* Show the picker floating panel
|
|
114
120
|
*/
|
|
@@ -122,9 +128,9 @@ var ReactionPicker = exports.ReactionPicker = /*#__PURE__*/_react.default.memo(f
|
|
|
122
128
|
*/
|
|
123
129
|
useLeftPopperPlacement: showRoundTrigger
|
|
124
130
|
}),
|
|
125
|
-
|
|
126
|
-
settings =
|
|
127
|
-
setSettings =
|
|
131
|
+
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
132
|
+
settings = _useState6[0],
|
|
133
|
+
setSettings = _useState6[1];
|
|
128
134
|
|
|
129
135
|
/**
|
|
130
136
|
* Custom hook triggers when user clicks outside the reactions picker
|
|
@@ -199,6 +205,15 @@ var ReactionPicker = exports.ReactionPicker = /*#__PURE__*/_react.default.memo(f
|
|
|
199
205
|
// ufo reactions picker opened success
|
|
200
206
|
_ufo.PickerRender.success();
|
|
201
207
|
};
|
|
208
|
+
(0, _react.useEffect)(function () {
|
|
209
|
+
if (settings.isOpen) {
|
|
210
|
+
setSelectionStyle(reactionPickerAdditionalStyle);
|
|
211
|
+
}
|
|
212
|
+
return function () {
|
|
213
|
+
setSelectionStyle(undefined);
|
|
214
|
+
};
|
|
215
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
216
|
+
}, [settings.isOpen]);
|
|
202
217
|
var wrapperClassName = " ".concat(settings.isOpen ? 'isOpen' : '', " ").concat(miniMode ? 'miniMode' : '', " ").concat(className);
|
|
203
218
|
(0, _react.useLayoutEffect)(function () {
|
|
204
219
|
var _updatePopper$current;
|
|
@@ -231,6 +246,7 @@ var ReactionPicker = exports.ReactionPicker = /*#__PURE__*/_react.default.memo(f
|
|
|
231
246
|
setTriggerRef(node);
|
|
232
247
|
}
|
|
233
248
|
},
|
|
249
|
+
selectionStyle: selectionStyle,
|
|
234
250
|
onClick: onTriggerClick,
|
|
235
251
|
miniMode: miniMode,
|
|
236
252
|
disabled: disabled,
|
|
@@ -262,10 +278,10 @@ var ReactionPicker = exports.ReactionPicker = /*#__PURE__*/_react.default.memo(f
|
|
|
262
278
|
var PopperWrapper = exports.PopperWrapper = function PopperWrapper(props) {
|
|
263
279
|
var settings = props.settings,
|
|
264
280
|
children = props.children;
|
|
265
|
-
var
|
|
266
|
-
|
|
267
|
-
popupRef =
|
|
268
|
-
setPopupRef =
|
|
281
|
+
var _useState7 = (0, _react.useState)(null),
|
|
282
|
+
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
283
|
+
popupRef = _useState8[0],
|
|
284
|
+
setPopupRef = _useState8[1];
|
|
269
285
|
/**
|
|
270
286
|
* add focus lock to popup
|
|
271
287
|
*/
|
|
@@ -274,7 +290,7 @@ var PopperWrapper = exports.PopperWrapper = function PopperWrapper(props) {
|
|
|
274
290
|
targetRef: popupRef
|
|
275
291
|
});
|
|
276
292
|
return (0, _react2.jsx)(_popper.Popper, {
|
|
277
|
-
placement: settings.useLeftPopperPlacement ?
|
|
293
|
+
placement: settings.useLeftPopperPlacement ? 'left' : 'bottom-start',
|
|
278
294
|
modifiers: popperModifiers,
|
|
279
295
|
strategy: 'absolute'
|
|
280
296
|
}, function (_ref3) {
|
|
@@ -134,7 +134,8 @@ var Reactions = exports.Reactions = /*#__PURE__*/_react.default.memo(function (_
|
|
|
134
134
|
_ref$showRoundTrigger = _ref.showRoundTrigger,
|
|
135
135
|
showRoundTrigger = _ref$showRoundTrigger === void 0 ? false : _ref$showRoundTrigger,
|
|
136
136
|
_ref$isViewOnly = _ref.isViewOnly,
|
|
137
|
-
isViewOnly = _ref$isViewOnly === void 0 ? false : _ref$isViewOnly
|
|
137
|
+
isViewOnly = _ref$isViewOnly === void 0 ? false : _ref$isViewOnly,
|
|
138
|
+
reactionPickerAdditionalStyle = _ref.reactionPickerAdditionalStyle;
|
|
138
139
|
var _useState = (0, _react.useState)(),
|
|
139
140
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
140
141
|
selectedEmojiId = _useState2[0],
|
|
@@ -341,7 +342,8 @@ var Reactions = exports.Reactions = /*#__PURE__*/_react.default.memo(function (_
|
|
|
341
342
|
showOpaqueBackground: showOpaqueBackground,
|
|
342
343
|
showAddReactionText: showAddReactionText,
|
|
343
344
|
subtleReactionsSummaryAndPicker: subtleReactionsSummaryAndPicker,
|
|
344
|
-
showRoundTrigger: showRoundTrigger
|
|
345
|
+
showRoundTrigger: showRoundTrigger,
|
|
346
|
+
reactionPickerAdditionalStyle: reactionPickerAdditionalStyle
|
|
345
347
|
}), (0, _react2.jsx)(_modalDialog.ModalTransition, null, !!selectedEmojiId && (0, _react2.jsx)(_segment.default, {
|
|
346
348
|
name: "reactions-dialog"
|
|
347
349
|
}, (0, _react2.jsx)(_ReactionDialog.ReactionsDialog, {
|
|
@@ -116,7 +116,8 @@ var Trigger = exports.Trigger = /*#__PURE__*/_react.default.forwardRef(function
|
|
|
116
116
|
_props$subtleReaction = props.subtleReactionsSummaryAndPicker,
|
|
117
117
|
subtleReactionsSummaryAndPicker = _props$subtleReaction === void 0 ? false : _props$subtleReaction,
|
|
118
118
|
_props$showRoundTrigg = props.showRoundTrigger,
|
|
119
|
-
showRoundTrigger = _props$showRoundTrigg === void 0 ? false : _props$showRoundTrigg
|
|
119
|
+
showRoundTrigger = _props$showRoundTrigg === void 0 ? false : _props$showRoundTrigg,
|
|
120
|
+
selectionStyle = props.selectionStyle;
|
|
120
121
|
var handleMouseDown = function handleMouseDown(e, analyticsEvent) {
|
|
121
122
|
if (onClick && !disabled) {
|
|
122
123
|
onClick(e, analyticsEvent);
|
|
@@ -127,7 +128,9 @@ var Trigger = exports.Trigger = /*#__PURE__*/_react.default.forwardRef(function
|
|
|
127
128
|
content: tooltipContent
|
|
128
129
|
}, (0, _react2.jsx)(_primitives.Pressable, (0, _extends2.default)({
|
|
129
130
|
testId: RENDER_TRIGGER_BUTTON_TESTID,
|
|
130
|
-
xcss: [triggerStyles, subtleReactionsSummaryAndPicker && subtleTriggerStyles, showAddReactionText && expandedTriggerStyles, disabled ? disabledTriggerStyles : showOpaqueBackground ? opaqueEnabledTriggerStyles : transparentEnabledTriggerStyles, miniMode && miniModeStyles, (0, _platformFeatureFlags.fg)('platform-component-visual-refresh') && triggerStylesRefresh, showRoundTrigger && roundTriggerStyles
|
|
131
|
+
xcss: [triggerStyles, subtleReactionsSummaryAndPicker && subtleTriggerStyles, showAddReactionText && expandedTriggerStyles, disabled ? disabledTriggerStyles : showOpaqueBackground ? opaqueEnabledTriggerStyles : transparentEnabledTriggerStyles, miniMode && miniModeStyles, (0, _platformFeatureFlags.fg)('platform-component-visual-refresh') && triggerStylesRefresh, showRoundTrigger && roundTriggerStyles,
|
|
132
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
133
|
+
selectionStyle],
|
|
131
134
|
onClick: handleMouseDown,
|
|
132
135
|
isDisabled: disabled,
|
|
133
136
|
ref: ref
|
|
@@ -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 = "26.3.
|
|
4
|
+
const packageVersion = "26.3.2";
|
|
5
5
|
/**
|
|
6
6
|
* TODO: move to utility package?
|
|
7
7
|
* A random sampling function
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @jsxRuntime classic
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
|
-
import React, { useCallback, useLayoutEffect, useRef, useState } from 'react';
|
|
5
|
+
import React, { useCallback, useLayoutEffect, useRef, useState, useEffect } from 'react';
|
|
6
6
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
7
7
|
import { jsx } from '@emotion/react';
|
|
8
8
|
import { FormattedMessage } from 'react-intl-next';
|
|
@@ -79,7 +79,8 @@ export const ReactionPicker = /*#__PURE__*/React.memo(props => {
|
|
|
79
79
|
showOpaqueBackground = false,
|
|
80
80
|
subtleReactionsSummaryAndPicker = false,
|
|
81
81
|
showAddReactionText = false,
|
|
82
|
-
showRoundTrigger = false
|
|
82
|
+
showRoundTrigger = false,
|
|
83
|
+
reactionPickerAdditionalStyle = undefined
|
|
83
84
|
} = props;
|
|
84
85
|
const [triggerRef, setTriggerRef] = useState(null);
|
|
85
86
|
|
|
@@ -87,6 +88,7 @@ export const ReactionPicker = /*#__PURE__*/React.memo(props => {
|
|
|
87
88
|
* Container <div /> reference (used by custom hook to detect click outside)
|
|
88
89
|
*/
|
|
89
90
|
const wrapperRef = useRef(null);
|
|
91
|
+
const [selectionStyle, setSelectionStyle] = useState(undefined);
|
|
90
92
|
const updatePopper = useRef();
|
|
91
93
|
const [settings, setSettings] = useState({
|
|
92
94
|
/**
|
|
@@ -175,6 +177,15 @@ export const ReactionPicker = /*#__PURE__*/React.memo(props => {
|
|
|
175
177
|
// ufo reactions picker opened success
|
|
176
178
|
PickerRender.success();
|
|
177
179
|
};
|
|
180
|
+
useEffect(() => {
|
|
181
|
+
if (settings.isOpen) {
|
|
182
|
+
setSelectionStyle(reactionPickerAdditionalStyle);
|
|
183
|
+
}
|
|
184
|
+
return () => {
|
|
185
|
+
setSelectionStyle(undefined);
|
|
186
|
+
};
|
|
187
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
188
|
+
}, [settings.isOpen]);
|
|
178
189
|
const wrapperClassName = ` ${settings.isOpen ? 'isOpen' : ''} ${miniMode ? 'miniMode' : ''} ${className}`;
|
|
179
190
|
useLayoutEffect(() => {
|
|
180
191
|
var _updatePopper$current;
|
|
@@ -207,6 +218,7 @@ export const ReactionPicker = /*#__PURE__*/React.memo(props => {
|
|
|
207
218
|
setTriggerRef(node);
|
|
208
219
|
}
|
|
209
220
|
},
|
|
221
|
+
selectionStyle: selectionStyle,
|
|
210
222
|
onClick: onTriggerClick,
|
|
211
223
|
miniMode: miniMode,
|
|
212
224
|
disabled: disabled,
|
|
@@ -247,7 +259,7 @@ export const PopperWrapper = props => {
|
|
|
247
259
|
targetRef: popupRef
|
|
248
260
|
});
|
|
249
261
|
return jsx(Popper, {
|
|
250
|
-
placement: settings.useLeftPopperPlacement ?
|
|
262
|
+
placement: settings.useLeftPopperPlacement ? 'left' : 'bottom-start',
|
|
251
263
|
modifiers: popperModifiers,
|
|
252
264
|
strategy: 'absolute'
|
|
253
265
|
}, ({
|
|
@@ -100,7 +100,8 @@ export const Reactions = /*#__PURE__*/React.memo(({
|
|
|
100
100
|
ProfileCardWrapper,
|
|
101
101
|
onlyRenderPicker = false,
|
|
102
102
|
showRoundTrigger = false,
|
|
103
|
-
isViewOnly = false
|
|
103
|
+
isViewOnly = false,
|
|
104
|
+
reactionPickerAdditionalStyle
|
|
104
105
|
}) => {
|
|
105
106
|
const [selectedEmojiId, setSelectedEmojiId] = useState();
|
|
106
107
|
const {
|
|
@@ -292,7 +293,8 @@ export const Reactions = /*#__PURE__*/React.memo(({
|
|
|
292
293
|
showOpaqueBackground: showOpaqueBackground,
|
|
293
294
|
showAddReactionText: showAddReactionText,
|
|
294
295
|
subtleReactionsSummaryAndPicker: subtleReactionsSummaryAndPicker,
|
|
295
|
-
showRoundTrigger: showRoundTrigger
|
|
296
|
+
showRoundTrigger: showRoundTrigger,
|
|
297
|
+
reactionPickerAdditionalStyle: reactionPickerAdditionalStyle
|
|
296
298
|
}), jsx(ModalTransition, null, !!selectedEmojiId && jsx(UFOSegment, {
|
|
297
299
|
name: "reactions-dialog"
|
|
298
300
|
}, jsx(ReactionsDialog, {
|
|
@@ -104,7 +104,8 @@ export const Trigger = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
104
104
|
showOpaqueBackground = false,
|
|
105
105
|
showAddReactionText = false,
|
|
106
106
|
subtleReactionsSummaryAndPicker = false,
|
|
107
|
-
showRoundTrigger = false
|
|
107
|
+
showRoundTrigger = false,
|
|
108
|
+
selectionStyle
|
|
108
109
|
} = props;
|
|
109
110
|
const handleMouseDown = (e, analyticsEvent) => {
|
|
110
111
|
if (onClick && !disabled) {
|
|
@@ -116,7 +117,9 @@ export const Trigger = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
116
117
|
content: tooltipContent
|
|
117
118
|
}, jsx(Pressable, _extends({
|
|
118
119
|
testId: RENDER_TRIGGER_BUTTON_TESTID,
|
|
119
|
-
xcss: [triggerStyles, subtleReactionsSummaryAndPicker && subtleTriggerStyles, showAddReactionText && expandedTriggerStyles, disabled ? disabledTriggerStyles : showOpaqueBackground ? opaqueEnabledTriggerStyles : transparentEnabledTriggerStyles, miniMode && miniModeStyles, fg('platform-component-visual-refresh') && triggerStylesRefresh, showRoundTrigger && roundTriggerStyles
|
|
120
|
+
xcss: [triggerStyles, subtleReactionsSummaryAndPicker && subtleTriggerStyles, showAddReactionText && expandedTriggerStyles, disabled ? disabledTriggerStyles : showOpaqueBackground ? opaqueEnabledTriggerStyles : transparentEnabledTriggerStyles, miniMode && miniModeStyles, fg('platform-component-visual-refresh') && triggerStylesRefresh, showRoundTrigger && roundTriggerStyles,
|
|
121
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
122
|
+
selectionStyle],
|
|
120
123
|
onClick: handleMouseDown,
|
|
121
124
|
isDisabled: disabled,
|
|
122
125
|
ref: ref
|
|
@@ -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 = "26.3.
|
|
7
|
+
var packageVersion = "26.3.2";
|
|
8
8
|
/**
|
|
9
9
|
* TODO: move to utility package?
|
|
10
10
|
* A random sampling function
|
|
@@ -6,7 +6,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
6
6
|
* @jsxRuntime classic
|
|
7
7
|
* @jsx jsx
|
|
8
8
|
*/
|
|
9
|
-
import React, { useCallback, useLayoutEffect, useRef, useState } from 'react';
|
|
9
|
+
import React, { useCallback, useLayoutEffect, useRef, useState, useEffect } from 'react';
|
|
10
10
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
11
11
|
import { jsx } from '@emotion/react';
|
|
12
12
|
import { FormattedMessage } from 'react-intl-next';
|
|
@@ -90,7 +90,9 @@ export var ReactionPicker = /*#__PURE__*/React.memo(function (props) {
|
|
|
90
90
|
_props$showAddReactio = props.showAddReactionText,
|
|
91
91
|
showAddReactionText = _props$showAddReactio === void 0 ? false : _props$showAddReactio,
|
|
92
92
|
_props$showRoundTrigg = props.showRoundTrigger,
|
|
93
|
-
showRoundTrigger = _props$showRoundTrigg === void 0 ? false : _props$showRoundTrigg
|
|
93
|
+
showRoundTrigger = _props$showRoundTrigg === void 0 ? false : _props$showRoundTrigg,
|
|
94
|
+
_props$reactionPicker = props.reactionPickerAdditionalStyle,
|
|
95
|
+
reactionPickerAdditionalStyle = _props$reactionPicker === void 0 ? undefined : _props$reactionPicker;
|
|
94
96
|
var _useState = useState(null),
|
|
95
97
|
_useState2 = _slicedToArray(_useState, 2),
|
|
96
98
|
triggerRef = _useState2[0],
|
|
@@ -100,8 +102,12 @@ export var ReactionPicker = /*#__PURE__*/React.memo(function (props) {
|
|
|
100
102
|
* Container <div /> reference (used by custom hook to detect click outside)
|
|
101
103
|
*/
|
|
102
104
|
var wrapperRef = useRef(null);
|
|
105
|
+
var _useState3 = useState(undefined),
|
|
106
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
107
|
+
selectionStyle = _useState4[0],
|
|
108
|
+
setSelectionStyle = _useState4[1];
|
|
103
109
|
var updatePopper = useRef();
|
|
104
|
-
var
|
|
110
|
+
var _useState5 = useState({
|
|
105
111
|
/**
|
|
106
112
|
* Show the picker floating panel
|
|
107
113
|
*/
|
|
@@ -115,9 +121,9 @@ export var ReactionPicker = /*#__PURE__*/React.memo(function (props) {
|
|
|
115
121
|
*/
|
|
116
122
|
useLeftPopperPlacement: showRoundTrigger
|
|
117
123
|
}),
|
|
118
|
-
|
|
119
|
-
settings =
|
|
120
|
-
setSettings =
|
|
124
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
125
|
+
settings = _useState6[0],
|
|
126
|
+
setSettings = _useState6[1];
|
|
121
127
|
|
|
122
128
|
/**
|
|
123
129
|
* Custom hook triggers when user clicks outside the reactions picker
|
|
@@ -192,6 +198,15 @@ export var ReactionPicker = /*#__PURE__*/React.memo(function (props) {
|
|
|
192
198
|
// ufo reactions picker opened success
|
|
193
199
|
PickerRender.success();
|
|
194
200
|
};
|
|
201
|
+
useEffect(function () {
|
|
202
|
+
if (settings.isOpen) {
|
|
203
|
+
setSelectionStyle(reactionPickerAdditionalStyle);
|
|
204
|
+
}
|
|
205
|
+
return function () {
|
|
206
|
+
setSelectionStyle(undefined);
|
|
207
|
+
};
|
|
208
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
209
|
+
}, [settings.isOpen]);
|
|
195
210
|
var wrapperClassName = " ".concat(settings.isOpen ? 'isOpen' : '', " ").concat(miniMode ? 'miniMode' : '', " ").concat(className);
|
|
196
211
|
useLayoutEffect(function () {
|
|
197
212
|
var _updatePopper$current;
|
|
@@ -224,6 +239,7 @@ export var ReactionPicker = /*#__PURE__*/React.memo(function (props) {
|
|
|
224
239
|
setTriggerRef(node);
|
|
225
240
|
}
|
|
226
241
|
},
|
|
242
|
+
selectionStyle: selectionStyle,
|
|
227
243
|
onClick: onTriggerClick,
|
|
228
244
|
miniMode: miniMode,
|
|
229
245
|
disabled: disabled,
|
|
@@ -255,10 +271,10 @@ export var ReactionPicker = /*#__PURE__*/React.memo(function (props) {
|
|
|
255
271
|
export var PopperWrapper = function PopperWrapper(props) {
|
|
256
272
|
var settings = props.settings,
|
|
257
273
|
children = props.children;
|
|
258
|
-
var
|
|
259
|
-
|
|
260
|
-
popupRef =
|
|
261
|
-
setPopupRef =
|
|
274
|
+
var _useState7 = useState(null),
|
|
275
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
276
|
+
popupRef = _useState8[0],
|
|
277
|
+
setPopupRef = _useState8[1];
|
|
262
278
|
/**
|
|
263
279
|
* add focus lock to popup
|
|
264
280
|
*/
|
|
@@ -267,7 +283,7 @@ export var PopperWrapper = function PopperWrapper(props) {
|
|
|
267
283
|
targetRef: popupRef
|
|
268
284
|
});
|
|
269
285
|
return jsx(Popper, {
|
|
270
|
-
placement: settings.useLeftPopperPlacement ?
|
|
286
|
+
placement: settings.useLeftPopperPlacement ? 'left' : 'bottom-start',
|
|
271
287
|
modifiers: popperModifiers,
|
|
272
288
|
strategy: 'absolute'
|
|
273
289
|
}, function (_ref3) {
|
|
@@ -121,7 +121,8 @@ export var Reactions = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
121
121
|
_ref$showRoundTrigger = _ref.showRoundTrigger,
|
|
122
122
|
showRoundTrigger = _ref$showRoundTrigger === void 0 ? false : _ref$showRoundTrigger,
|
|
123
123
|
_ref$isViewOnly = _ref.isViewOnly,
|
|
124
|
-
isViewOnly = _ref$isViewOnly === void 0 ? false : _ref$isViewOnly
|
|
124
|
+
isViewOnly = _ref$isViewOnly === void 0 ? false : _ref$isViewOnly,
|
|
125
|
+
reactionPickerAdditionalStyle = _ref.reactionPickerAdditionalStyle;
|
|
125
126
|
var _useState = useState(),
|
|
126
127
|
_useState2 = _slicedToArray(_useState, 2),
|
|
127
128
|
selectedEmojiId = _useState2[0],
|
|
@@ -328,7 +329,8 @@ export var Reactions = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
328
329
|
showOpaqueBackground: showOpaqueBackground,
|
|
329
330
|
showAddReactionText: showAddReactionText,
|
|
330
331
|
subtleReactionsSummaryAndPicker: subtleReactionsSummaryAndPicker,
|
|
331
|
-
showRoundTrigger: showRoundTrigger
|
|
332
|
+
showRoundTrigger: showRoundTrigger,
|
|
333
|
+
reactionPickerAdditionalStyle: reactionPickerAdditionalStyle
|
|
332
334
|
}), jsx(ModalTransition, null, !!selectedEmojiId && jsx(UFOSegment, {
|
|
333
335
|
name: "reactions-dialog"
|
|
334
336
|
}, jsx(ReactionsDialog, {
|
|
@@ -108,7 +108,8 @@ export var Trigger = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
108
108
|
_props$subtleReaction = props.subtleReactionsSummaryAndPicker,
|
|
109
109
|
subtleReactionsSummaryAndPicker = _props$subtleReaction === void 0 ? false : _props$subtleReaction,
|
|
110
110
|
_props$showRoundTrigg = props.showRoundTrigger,
|
|
111
|
-
showRoundTrigger = _props$showRoundTrigg === void 0 ? false : _props$showRoundTrigg
|
|
111
|
+
showRoundTrigger = _props$showRoundTrigg === void 0 ? false : _props$showRoundTrigg,
|
|
112
|
+
selectionStyle = props.selectionStyle;
|
|
112
113
|
var handleMouseDown = function handleMouseDown(e, analyticsEvent) {
|
|
113
114
|
if (onClick && !disabled) {
|
|
114
115
|
onClick(e, analyticsEvent);
|
|
@@ -119,7 +120,9 @@ export var Trigger = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
119
120
|
content: tooltipContent
|
|
120
121
|
}, jsx(Pressable, _extends({
|
|
121
122
|
testId: RENDER_TRIGGER_BUTTON_TESTID,
|
|
122
|
-
xcss: [triggerStyles, subtleReactionsSummaryAndPicker && subtleTriggerStyles, showAddReactionText && expandedTriggerStyles, disabled ? disabledTriggerStyles : showOpaqueBackground ? opaqueEnabledTriggerStyles : transparentEnabledTriggerStyles, miniMode && miniModeStyles, fg('platform-component-visual-refresh') && triggerStylesRefresh, showRoundTrigger && roundTriggerStyles
|
|
123
|
+
xcss: [triggerStyles, subtleReactionsSummaryAndPicker && subtleTriggerStyles, showAddReactionText && expandedTriggerStyles, disabled ? disabledTriggerStyles : showOpaqueBackground ? opaqueEnabledTriggerStyles : transparentEnabledTriggerStyles, miniMode && miniModeStyles, fg('platform-component-visual-refresh') && triggerStylesRefresh, showRoundTrigger && roundTriggerStyles,
|
|
124
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
125
|
+
selectionStyle],
|
|
123
126
|
onClick: handleMouseDown,
|
|
124
127
|
isDisabled: disabled,
|
|
125
128
|
ref: ref
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import React, { type PropsWithChildren } from 'react';
|
|
6
6
|
import { jsx } from '@emotion/react';
|
|
7
7
|
import { type PickerSize } from '@atlaskit/emoji/types';
|
|
8
|
+
import { type XCSS } from '@atlaskit/primitives';
|
|
8
9
|
import { type EmojiProvider } from '@atlaskit/emoji/resource';
|
|
9
10
|
import { type ReactionSource } from '../../types';
|
|
10
11
|
import { type SelectorProps } from '../Selector';
|
|
@@ -72,6 +73,10 @@ export interface ReactionPickerProps extends Pick<SelectorProps, 'pickerQuickRea
|
|
|
72
73
|
* Optional prop for controlling if the picker hover border will be rounded
|
|
73
74
|
*/
|
|
74
75
|
showRoundTrigger?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Option prop for controlling the reaction picker selection style
|
|
78
|
+
*/
|
|
79
|
+
reactionPickerAdditionalStyle?: XCSS;
|
|
75
80
|
}
|
|
76
81
|
/**
|
|
77
82
|
* Picker component for adding reactions
|
|
@@ -6,6 +6,7 @@ import React from 'react';
|
|
|
6
6
|
import { jsx } from '@emotion/react';
|
|
7
7
|
import { type OnCloseHandler } from '@atlaskit/modal-dialog';
|
|
8
8
|
import { type Placement } from '@atlaskit/popper';
|
|
9
|
+
import { type XCSS } from '@atlaskit/primitives';
|
|
9
10
|
import { ReactionStatus, type ReactionClick, type ReactionSummary, type QuickReactionEmojiSummary, type ProfileCardWrapper } from '../../types';
|
|
10
11
|
import { type ReactionPickerProps } from '../ReactionPicker';
|
|
11
12
|
import { type SelectorProps } from '../Selector';
|
|
@@ -141,6 +142,10 @@ export interface ReactionsProps extends Pick<ReactionPickerProps, 'allowAllEmoji
|
|
|
141
142
|
* Optional prop for controlling if the reactions component is view only, disabling adding reactions
|
|
142
143
|
*/
|
|
143
144
|
isViewOnly?: boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Option prop for controlling the reaction picker selection style
|
|
147
|
+
*/
|
|
148
|
+
reactionPickerAdditionalStyle?: XCSS;
|
|
144
149
|
}
|
|
145
150
|
export interface OpenReactionsDialogOptions {
|
|
146
151
|
emojiId?: string;
|
|
@@ -153,4 +158,4 @@ export declare function getTooltip(status: ReactionStatus, errorMessage?: string
|
|
|
153
158
|
/**
|
|
154
159
|
* Renders list of reactions
|
|
155
160
|
*/
|
|
156
|
-
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, showRoundTrigger, isViewOnly, }: ReactionsProps) => jsx.JSX.Element>;
|
|
161
|
+
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, showRoundTrigger, isViewOnly, reactionPickerAdditionalStyle, }: ReactionsProps) => jsx.JSX.Element>;
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import React, { type AriaAttributes } from 'react';
|
|
6
6
|
import { type AnalyticsEvent } from '@atlaskit/analytics-next';
|
|
7
|
+
import { type XCSS } from '@atlaskit/primitives';
|
|
7
8
|
/**
|
|
8
9
|
* Test id for the tooltip
|
|
9
10
|
*/
|
|
@@ -48,6 +49,10 @@ export interface TriggerProps {
|
|
|
48
49
|
* Optional prop for controlling if the picker hover border will be rounded
|
|
49
50
|
*/
|
|
50
51
|
showRoundTrigger?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Option prop for controlling the reaction picker selection style
|
|
54
|
+
*/
|
|
55
|
+
selectionStyle?: XCSS;
|
|
51
56
|
}
|
|
52
57
|
/**
|
|
53
58
|
* Render an emoji button to open the reactions select picker
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import React, { type PropsWithChildren } from 'react';
|
|
6
6
|
import { jsx } from '@emotion/react';
|
|
7
7
|
import { type PickerSize } from '@atlaskit/emoji/types';
|
|
8
|
+
import { type XCSS } from '@atlaskit/primitives';
|
|
8
9
|
import { type EmojiProvider } from '@atlaskit/emoji/resource';
|
|
9
10
|
import { type ReactionSource } from '../../types';
|
|
10
11
|
import { type SelectorProps } from '../Selector';
|
|
@@ -72,6 +73,10 @@ export interface ReactionPickerProps extends Pick<SelectorProps, 'pickerQuickRea
|
|
|
72
73
|
* Optional prop for controlling if the picker hover border will be rounded
|
|
73
74
|
*/
|
|
74
75
|
showRoundTrigger?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Option prop for controlling the reaction picker selection style
|
|
78
|
+
*/
|
|
79
|
+
reactionPickerAdditionalStyle?: XCSS;
|
|
75
80
|
}
|
|
76
81
|
/**
|
|
77
82
|
* Picker component for adding reactions
|
|
@@ -6,6 +6,7 @@ import React from 'react';
|
|
|
6
6
|
import { jsx } from '@emotion/react';
|
|
7
7
|
import { type OnCloseHandler } from '@atlaskit/modal-dialog';
|
|
8
8
|
import { type Placement } from '@atlaskit/popper';
|
|
9
|
+
import { type XCSS } from '@atlaskit/primitives';
|
|
9
10
|
import { ReactionStatus, type ReactionClick, type ReactionSummary, type QuickReactionEmojiSummary, type ProfileCardWrapper } from '../../types';
|
|
10
11
|
import { type ReactionPickerProps } from '../ReactionPicker';
|
|
11
12
|
import { type SelectorProps } from '../Selector';
|
|
@@ -141,6 +142,10 @@ export interface ReactionsProps extends Pick<ReactionPickerProps, 'allowAllEmoji
|
|
|
141
142
|
* Optional prop for controlling if the reactions component is view only, disabling adding reactions
|
|
142
143
|
*/
|
|
143
144
|
isViewOnly?: boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Option prop for controlling the reaction picker selection style
|
|
147
|
+
*/
|
|
148
|
+
reactionPickerAdditionalStyle?: XCSS;
|
|
144
149
|
}
|
|
145
150
|
export interface OpenReactionsDialogOptions {
|
|
146
151
|
emojiId?: string;
|
|
@@ -153,4 +158,4 @@ export declare function getTooltip(status: ReactionStatus, errorMessage?: string
|
|
|
153
158
|
/**
|
|
154
159
|
* Renders list of reactions
|
|
155
160
|
*/
|
|
156
|
-
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, showRoundTrigger, isViewOnly, }: ReactionsProps) => jsx.JSX.Element>;
|
|
161
|
+
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, showRoundTrigger, isViewOnly, reactionPickerAdditionalStyle, }: ReactionsProps) => jsx.JSX.Element>;
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import React, { type AriaAttributes } from 'react';
|
|
6
6
|
import { type AnalyticsEvent } from '@atlaskit/analytics-next';
|
|
7
|
+
import { type XCSS } from '@atlaskit/primitives';
|
|
7
8
|
/**
|
|
8
9
|
* Test id for the tooltip
|
|
9
10
|
*/
|
|
@@ -48,6 +49,10 @@ export interface TriggerProps {
|
|
|
48
49
|
* Optional prop for controlling if the picker hover border will be rounded
|
|
49
50
|
*/
|
|
50
51
|
showRoundTrigger?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Option prop for controlling the reaction picker selection style
|
|
54
|
+
*/
|
|
55
|
+
selectionStyle?: XCSS;
|
|
51
56
|
}
|
|
52
57
|
/**
|
|
53
58
|
* Render an emoji button to open the reactions select picker
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/reactions",
|
|
3
|
-
"version": "26.3.
|
|
3
|
+
"version": "26.3.2",
|
|
4
4
|
"description": "Reactions component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@atlaskit/motion": "^5.0.0",
|
|
45
45
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
46
46
|
"@atlaskit/popper": "^7.0.0",
|
|
47
|
-
"@atlaskit/popup": "2.0.
|
|
47
|
+
"@atlaskit/popup": "2.0.1",
|
|
48
48
|
"@atlaskit/primitives": "^14.1.0",
|
|
49
49
|
"@atlaskit/react-ufo": "^3.1.0",
|
|
50
50
|
"@atlaskit/spinner": "^18.0.0",
|