@atlaskit/reactions 27.2.1 → 29.0.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 +20 -0
- package/afm-cc/tsconfig.json +3 -0
- package/afm-jira/tsconfig.json +3 -0
- package/afm-post-office/tsconfig.json +3 -0
- package/dist/cjs/analytics/index.js +1 -1
- package/dist/cjs/components/ReactionPicker/ReactionPicker.js +2 -5
- package/dist/cjs/components/ReactionSummary/ReactionSummaryViewEmojiPicker.js +7 -12
- package/dist/cjs/components/Reactions/Reactions.js +0 -3
- package/dist/cjs/components/Trigger/Trigger.js +1 -8
- package/dist/cjs/components/compiled/Counter.compiled.css +16 -0
- package/dist/cjs/components/compiled/Counter.js +102 -0
- package/dist/cjs/components/compiled/FlashAnimation.compiled.css +3 -0
- package/dist/cjs/components/compiled/FlashAnimation.js +35 -0
- package/dist/cjs/components/compiled/Reaction.compiled.css +9 -0
- package/dist/cjs/components/compiled/Reaction.js +185 -0
- package/dist/cjs/components/compiled/ReactionButton.compiled.css +37 -0
- package/dist/cjs/components/compiled/ReactionButton.js +70 -0
- package/dist/cjs/components/compiled/ReactionParticleEffect.compiled.css +17 -0
- package/dist/cjs/components/compiled/ReactionParticleEffect.js +41 -0
- package/dist/cjs/components/compiled/ReactionTooltip.compiled.css +29 -0
- package/dist/cjs/components/compiled/ReactionTooltip.js +77 -0
- package/dist/cjs/components/compiled/Reactions.compiled.css +11 -0
- package/dist/cjs/components/compiled/Reactions.js +374 -0
- package/dist/cjs/components/compiled/StaticReaction.compiled.css +17 -0
- package/dist/cjs/components/compiled/StaticReaction.js +34 -0
- package/dist/cjs/containers/ConnectedReactionsView/ConnectedReactionsView.js +6 -1
- package/dist/cjs/index.js +12 -15
- package/dist/es2019/analytics/index.js +1 -1
- package/dist/es2019/components/ReactionPicker/ReactionPicker.js +2 -4
- package/dist/es2019/components/ReactionSummary/ReactionSummaryViewEmojiPicker.js +4 -10
- package/dist/es2019/components/Reactions/Reactions.js +0 -2
- package/dist/es2019/components/Trigger/Trigger.js +1 -7
- package/dist/es2019/components/compiled/Counter.compiled.css +16 -0
- package/dist/es2019/components/compiled/Counter.js +86 -0
- package/dist/es2019/components/compiled/FlashAnimation.compiled.css +4 -0
- package/dist/es2019/components/compiled/FlashAnimation.js +21 -0
- package/dist/es2019/components/compiled/Reaction.compiled.css +9 -0
- package/dist/es2019/components/compiled/Reaction.js +151 -0
- package/dist/es2019/components/compiled/ReactionButton.compiled.css +37 -0
- package/dist/es2019/components/compiled/ReactionButton.js +56 -0
- package/dist/es2019/components/compiled/ReactionParticleEffect.compiled.css +19 -0
- package/dist/es2019/components/compiled/ReactionParticleEffect.js +26 -0
- package/dist/es2019/components/compiled/ReactionTooltip.compiled.css +29 -0
- package/dist/es2019/components/compiled/ReactionTooltip.js +62 -0
- package/dist/es2019/components/compiled/Reactions.compiled.css +11 -0
- package/dist/es2019/components/compiled/Reactions.js +323 -0
- package/dist/es2019/components/compiled/StaticReaction.compiled.css +17 -0
- package/dist/es2019/components/compiled/StaticReaction.js +24 -0
- package/dist/es2019/containers/ConnectedReactionsView/ConnectedReactionsView.js +7 -2
- package/dist/es2019/index.js +9 -1
- package/dist/esm/analytics/index.js +1 -1
- package/dist/esm/components/ReactionPicker/ReactionPicker.js +2 -5
- package/dist/esm/components/ReactionSummary/ReactionSummaryViewEmojiPicker.js +4 -10
- package/dist/esm/components/Reactions/Reactions.js +0 -3
- package/dist/esm/components/Trigger/Trigger.js +1 -8
- package/dist/esm/components/compiled/Counter.compiled.css +16 -0
- package/dist/esm/components/compiled/Counter.js +93 -0
- package/dist/esm/components/compiled/FlashAnimation.compiled.css +3 -0
- package/dist/esm/components/compiled/FlashAnimation.js +26 -0
- package/dist/esm/components/compiled/Reaction.compiled.css +9 -0
- package/dist/esm/components/compiled/Reaction.js +175 -0
- package/dist/esm/components/compiled/ReactionButton.compiled.css +37 -0
- package/dist/esm/components/compiled/ReactionButton.js +60 -0
- package/dist/esm/components/compiled/ReactionParticleEffect.compiled.css +17 -0
- package/dist/esm/components/compiled/ReactionParticleEffect.js +31 -0
- package/dist/esm/components/compiled/ReactionTooltip.compiled.css +29 -0
- package/dist/esm/components/compiled/ReactionTooltip.js +70 -0
- package/dist/esm/components/compiled/Reactions.compiled.css +11 -0
- package/dist/esm/components/compiled/Reactions.js +362 -0
- package/dist/esm/components/compiled/StaticReaction.compiled.css +17 -0
- package/dist/esm/components/compiled/StaticReaction.js +24 -0
- package/dist/esm/containers/ConnectedReactionsView/ConnectedReactionsView.js +7 -2
- package/dist/esm/index.js +9 -1
- package/dist/types/components/ReactionPicker/ReactionPicker.d.ts +1 -5
- package/dist/types/components/ReactionSummary/ReactionSummaryViewEmojiPicker.d.ts +2 -2
- package/dist/types/components/Reactions/Reactions.d.ts +2 -6
- package/dist/types/components/Trigger/Trigger.d.ts +0 -4
- package/dist/types/components/compiled/Counter.d.ts +52 -0
- package/dist/types/components/compiled/FlashAnimation.d.ts +23 -0
- package/dist/types/components/compiled/Reaction.d.ts +63 -0
- package/dist/types/components/compiled/ReactionButton.d.ts +20 -0
- package/dist/types/components/compiled/ReactionParticleEffect.d.ts +19 -0
- package/dist/types/components/compiled/ReactionTooltip.d.ts +43 -0
- package/dist/types/components/compiled/Reactions.d.ts +177 -0
- package/dist/types/components/compiled/StaticReaction.d.ts +12 -0
- package/dist/types/containers/ConnectedReactionsView/ConnectedReactionsView.d.ts +1 -1
- package/dist/types/index.d.ts +5 -1
- package/dist/types-ts4.5/components/ReactionPicker/ReactionPicker.d.ts +1 -5
- package/dist/types-ts4.5/components/ReactionSummary/ReactionSummaryViewEmojiPicker.d.ts +2 -2
- package/dist/types-ts4.5/components/Reactions/Reactions.d.ts +2 -6
- package/dist/types-ts4.5/components/Trigger/Trigger.d.ts +0 -4
- package/dist/types-ts4.5/components/compiled/Counter.d.ts +52 -0
- package/dist/types-ts4.5/components/compiled/FlashAnimation.d.ts +23 -0
- package/dist/types-ts4.5/components/compiled/Reaction.d.ts +63 -0
- package/dist/types-ts4.5/components/compiled/ReactionButton.d.ts +20 -0
- package/dist/types-ts4.5/components/compiled/ReactionParticleEffect.d.ts +19 -0
- package/dist/types-ts4.5/components/compiled/ReactionTooltip.d.ts +43 -0
- package/dist/types-ts4.5/components/compiled/Reactions.d.ts +177 -0
- package/dist/types-ts4.5/components/compiled/StaticReaction.d.ts +12 -0
- package/dist/types-ts4.5/containers/ConnectedReactionsView/ConnectedReactionsView.d.ts +1 -1
- package/dist/types-ts4.5/index.d.ts +5 -1
- package/package.json +13 -3
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
/* Reactions.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
2
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
|
+
import "./Reactions.compiled.css";
|
|
5
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
6
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
7
|
+
import { FormattedMessage } from 'react-intl-next';
|
|
8
|
+
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
9
|
+
import { ModalTransition } from '@atlaskit/modal-dialog';
|
|
10
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
|
+
import UFOSegment from '@atlaskit/react-ufo/segment';
|
|
12
|
+
import { createAndFireSafe, createPickerButtonClickedEvent, createPickerCancelledEvent, createPickerMoreClickedEvent, createReactionsRenderedEvent, createReactionSelectionEvent, isSampled } from '../../analytics';
|
|
13
|
+
import { SAMPLING_RATE_REACTIONS_RENDERED_EXP } from '../../shared/constants';
|
|
14
|
+
import { messages } from '../../shared/i18n';
|
|
15
|
+
import { ReactionStatus } from '../../types';
|
|
16
|
+
import { ReactionDialogOpened, ReactionDialogSelectedReactionChanged } from '../../ufo';
|
|
17
|
+
import { Reaction } from './Reaction';
|
|
18
|
+
import { ReactionsDialog } from '../ReactionDialog';
|
|
19
|
+
import { ReactionPicker } from '../ReactionPicker';
|
|
20
|
+
import { ReactionSummaryView } from '../ReactionSummary/';
|
|
21
|
+
var wrapperStyle = null;
|
|
22
|
+
var noFlexWrapStyles = null;
|
|
23
|
+
var noContainerPositionStyles = null;
|
|
24
|
+
var reactionPickerStyle = null;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Set of all available UFO experiences relating to Reactions Dialog
|
|
28
|
+
*/
|
|
29
|
+
export var ufoExperiences = {
|
|
30
|
+
/**
|
|
31
|
+
* Experience when a reaction dialog is opened
|
|
32
|
+
*/
|
|
33
|
+
openDialog: ReactionDialogOpened,
|
|
34
|
+
/**
|
|
35
|
+
* Experience when a reaction changed/fetched from inside the modal dialog
|
|
36
|
+
*/
|
|
37
|
+
selectedReactionChangeInsideDialog: ReactionDialogSelectedReactionChanged
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Test id for wrapper Reactions div
|
|
42
|
+
*/
|
|
43
|
+
export var RENDER_REACTIONS_TESTID = 'render-reactions';
|
|
44
|
+
/**
|
|
45
|
+
* Test id for the view all reacted user to trigger the dialog
|
|
46
|
+
*/
|
|
47
|
+
export var RENDER_VIEWALL_REACTED_USERS_DIALOG = 'viewall-reacted-users-dialog';
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Test id for summary view of reactions
|
|
51
|
+
*/
|
|
52
|
+
export var RENDER_REACTIONS_SUMMARY_TESTID = 'reaction-summary-view';
|
|
53
|
+
/**
|
|
54
|
+
* Get content of the tooltip
|
|
55
|
+
*/
|
|
56
|
+
export function getTooltip(status, errorMessage, tooltipContent) {
|
|
57
|
+
switch (status) {
|
|
58
|
+
case ReactionStatus.error:
|
|
59
|
+
return errorMessage || /*#__PURE__*/React.createElement(FormattedMessage, messages.unexpectedError);
|
|
60
|
+
// When reaction is not available don't show any tooltip (e.g. Archive page in Confluence)
|
|
61
|
+
case ReactionStatus.disabled:
|
|
62
|
+
return null;
|
|
63
|
+
case ReactionStatus.notLoaded:
|
|
64
|
+
case ReactionStatus.loading:
|
|
65
|
+
return /*#__PURE__*/React.createElement(FormattedMessage, messages.loadingReactions);
|
|
66
|
+
case ReactionStatus.ready:
|
|
67
|
+
return !!tooltipContent ? tooltipContent : /*#__PURE__*/React.createElement(FormattedMessage, messages.addReaction);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Renders list of reactions
|
|
73
|
+
*/
|
|
74
|
+
export var Reactions = /*#__PURE__*/React.memo(function (_ref) {
|
|
75
|
+
var _ref$flash = _ref.flash,
|
|
76
|
+
flash = _ref$flash === void 0 ? {} : _ref$flash,
|
|
77
|
+
_ref$particleEffectBy = _ref.particleEffectByEmoji,
|
|
78
|
+
particleEffectByEmoji = _ref$particleEffectBy === void 0 ? {} : _ref$particleEffectBy,
|
|
79
|
+
status = _ref.status,
|
|
80
|
+
errorMessage = _ref.errorMessage,
|
|
81
|
+
loadReaction = _ref.loadReaction,
|
|
82
|
+
quickReactionEmojis = _ref.quickReactionEmojis,
|
|
83
|
+
pickerQuickReactionEmojiIds = _ref.pickerQuickReactionEmojiIds,
|
|
84
|
+
_ref$getReactionDetai = _ref.getReactionDetails,
|
|
85
|
+
getReactionDetails = _ref$getReactionDetai === void 0 ? function () {} : _ref$getReactionDetai,
|
|
86
|
+
onSelection = _ref.onSelection,
|
|
87
|
+
_ref$reactions = _ref.reactions,
|
|
88
|
+
reactions = _ref$reactions === void 0 ? [] : _ref$reactions,
|
|
89
|
+
emojiProvider = _ref.emojiProvider,
|
|
90
|
+
allowAllEmojis = _ref.allowAllEmojis,
|
|
91
|
+
onReactionClick = _ref.onReactionClick,
|
|
92
|
+
allowUserDialog = _ref.allowUserDialog,
|
|
93
|
+
_ref$onDialogOpenCall = _ref.onDialogOpenCallback,
|
|
94
|
+
onDialogOpenCallback = _ref$onDialogOpenCall === void 0 ? function () {} : _ref$onDialogOpenCall,
|
|
95
|
+
_ref$onDialogCloseCal = _ref.onDialogCloseCallback,
|
|
96
|
+
onDialogCloseCallback = _ref$onDialogCloseCal === void 0 ? function () {} : _ref$onDialogCloseCal,
|
|
97
|
+
_ref$onDialogSelectRe = _ref.onDialogSelectReactionCallback,
|
|
98
|
+
onDialogSelectReactionCallback = _ref$onDialogSelectRe === void 0 ? function () {} : _ref$onDialogSelectRe,
|
|
99
|
+
_ref$onDialogPageChan = _ref.onDialogPageChangeCallback,
|
|
100
|
+
onDialogPageChangeCallback = _ref$onDialogPageChan === void 0 ? function () {} : _ref$onDialogPageChan,
|
|
101
|
+
_ref$emojiPickerSize = _ref.emojiPickerSize,
|
|
102
|
+
emojiPickerSize = _ref$emojiPickerSize === void 0 ? 'medium' : _ref$emojiPickerSize,
|
|
103
|
+
_ref$miniMode = _ref.miniMode,
|
|
104
|
+
miniMode = _ref$miniMode === void 0 ? false : _ref$miniMode,
|
|
105
|
+
_ref$summaryViewEnabl = _ref.summaryViewEnabled,
|
|
106
|
+
summaryViewEnabled = _ref$summaryViewEnabl === void 0 ? false : _ref$summaryViewEnabl,
|
|
107
|
+
_ref$summaryViewThres = _ref.summaryViewThreshold,
|
|
108
|
+
summaryViewThreshold = _ref$summaryViewThres === void 0 ? 3 : _ref$summaryViewThres,
|
|
109
|
+
summaryViewPlacement = _ref.summaryViewPlacement,
|
|
110
|
+
_ref$showOpaqueBackgr = _ref.showOpaqueBackground,
|
|
111
|
+
showOpaqueBackground = _ref$showOpaqueBackgr === void 0 ? false : _ref$showOpaqueBackgr,
|
|
112
|
+
_ref$subtleReactionsS = _ref.subtleReactionsSummaryAndPicker,
|
|
113
|
+
subtleReactionsSummaryAndPicker = _ref$subtleReactionsS === void 0 ? false : _ref$subtleReactionsS,
|
|
114
|
+
_ref$showAddReactionT = _ref.showAddReactionText,
|
|
115
|
+
showAddReactionText = _ref$showAddReactionT === void 0 ? false : _ref$showAddReactionT,
|
|
116
|
+
_ref$hideDefaultReact = _ref.hideDefaultReactions,
|
|
117
|
+
hideDefaultReactions = _ref$hideDefaultReact === void 0 ? false : _ref$hideDefaultReact,
|
|
118
|
+
ProfileCardWrapper = _ref.ProfileCardWrapper,
|
|
119
|
+
_ref$onlyRenderPicker = _ref.onlyRenderPicker,
|
|
120
|
+
onlyRenderPicker = _ref$onlyRenderPicker === void 0 ? false : _ref$onlyRenderPicker,
|
|
121
|
+
_ref$isViewOnly = _ref.isViewOnly,
|
|
122
|
+
isViewOnly = _ref$isViewOnly === void 0 ? false : _ref$isViewOnly,
|
|
123
|
+
reactionPickerAdditionalStyle = _ref.reactionPickerAdditionalStyle,
|
|
124
|
+
_ref$noWrap = _ref.noWrap,
|
|
125
|
+
noWrap = _ref$noWrap === void 0 ? false : _ref$noWrap,
|
|
126
|
+
_ref$noRelativeContai = _ref.noRelativeContainer,
|
|
127
|
+
noRelativeContainer = _ref$noRelativeContai === void 0 ? false : _ref$noRelativeContai,
|
|
128
|
+
showSubtleDefaultReactions = _ref.showSubtleDefaultReactions,
|
|
129
|
+
reactionPickerTriggerToolipContent = _ref.reactionPickerTriggerToolipContent,
|
|
130
|
+
reactionPickerTriggerIcon = _ref.reactionPickerTriggerIcon,
|
|
131
|
+
_ref$allowSelectFromS = _ref.allowSelectFromSummaryView,
|
|
132
|
+
allowSelectFromSummaryView = _ref$allowSelectFromS === void 0 ? false : _ref$allowSelectFromS,
|
|
133
|
+
_ref$useButtonAlignme = _ref.useButtonAlignmentStyling,
|
|
134
|
+
useButtonAlignmentStyling = _ref$useButtonAlignme === void 0 ? false : _ref$useButtonAlignme;
|
|
135
|
+
var _useState = useState(),
|
|
136
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
137
|
+
selectedEmojiId = _useState2[0],
|
|
138
|
+
setSelectedEmojiId = _useState2[1];
|
|
139
|
+
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
140
|
+
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
141
|
+
var openTime = useRef();
|
|
142
|
+
var renderTime = useRef();
|
|
143
|
+
useEffect(function () {
|
|
144
|
+
if (status === ReactionStatus.notLoaded) {
|
|
145
|
+
loadReaction();
|
|
146
|
+
}
|
|
147
|
+
}, [status, loadReaction]);
|
|
148
|
+
useEffect(function () {
|
|
149
|
+
if (status !== ReactionStatus.ready) {
|
|
150
|
+
renderTime.current = Date.now();
|
|
151
|
+
} else {
|
|
152
|
+
var isSSR = process.env.REACT_SSR && fg('platform_fix_analytics_error');
|
|
153
|
+
if (isSampled(SAMPLING_RATE_REACTIONS_RENDERED_EXP) && !isSSR) {
|
|
154
|
+
var _renderTime$current;
|
|
155
|
+
createAndFireSafe(createAnalyticsEvent, createReactionsRenderedEvent, (_renderTime$current = renderTime.current) !== null && _renderTime$current !== void 0 ? _renderTime$current : Date.now() //renderTime.current can be null during unit test cases
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
renderTime.current = undefined;
|
|
159
|
+
}
|
|
160
|
+
}, [createAnalyticsEvent, status]);
|
|
161
|
+
var handleReactionMouseEnter = useCallback(function (emojiId) {
|
|
162
|
+
getReactionDetails(emojiId);
|
|
163
|
+
}, [getReactionDetails]);
|
|
164
|
+
var handleReactionFocused = useCallback(function (emojiId) {
|
|
165
|
+
getReactionDetails(emojiId);
|
|
166
|
+
}, [getReactionDetails]);
|
|
167
|
+
var handlePickerOpen = useCallback(function () {
|
|
168
|
+
openTime.current = Date.now();
|
|
169
|
+
createAndFireSafe(createAnalyticsEvent, createPickerButtonClickedEvent, reactions.length);
|
|
170
|
+
}, [createAnalyticsEvent, reactions]);
|
|
171
|
+
var handleOnCancel = useCallback(function () {
|
|
172
|
+
createAndFireSafe(createAnalyticsEvent, createPickerCancelledEvent, openTime.current);
|
|
173
|
+
openTime.current = undefined;
|
|
174
|
+
}, [createAnalyticsEvent]);
|
|
175
|
+
var handleOnMore = useCallback(function () {
|
|
176
|
+
createAndFireSafe(createAnalyticsEvent, createPickerMoreClickedEvent, openTime.current);
|
|
177
|
+
}, [createAnalyticsEvent]);
|
|
178
|
+
var handleOnSelection = useCallback(function (emojiId, source) {
|
|
179
|
+
createAndFireSafe(createAnalyticsEvent, createReactionSelectionEvent, source, emojiId, reactions.find(function (reaction) {
|
|
180
|
+
return reaction.emojiId === emojiId;
|
|
181
|
+
}), openTime.current);
|
|
182
|
+
openTime.current = undefined;
|
|
183
|
+
onSelection(emojiId);
|
|
184
|
+
}, [createAnalyticsEvent, onSelection, reactions]);
|
|
185
|
+
var handleCloseReactionsDialog = function handleCloseReactionsDialog(e, analyticsEvent) {
|
|
186
|
+
setSelectedEmojiId('');
|
|
187
|
+
onDialogCloseCallback(e, analyticsEvent);
|
|
188
|
+
};
|
|
189
|
+
var handleSelectReactionInDialog = function handleSelectReactionInDialog(emojiId) {
|
|
190
|
+
// ufo selected reaction inside the modal dialog
|
|
191
|
+
ufoExperiences.selectedReactionChangeInsideDialog.start();
|
|
192
|
+
handleReactionMouseEnter(emojiId);
|
|
193
|
+
setSelectedEmojiId(emojiId);
|
|
194
|
+
onDialogSelectReactionCallback(emojiId);
|
|
195
|
+
|
|
196
|
+
// ufo selected reaction inside the modal dialog success
|
|
197
|
+
ufoExperiences.selectedReactionChangeInsideDialog.success({
|
|
198
|
+
metadata: {
|
|
199
|
+
emojiId: emojiId,
|
|
200
|
+
source: 'Reactions',
|
|
201
|
+
reason: 'Selected Emoji changed'
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
};
|
|
205
|
+
var handlePaginationChange = useCallback(function (emojiId, currentPage, maxPages) {
|
|
206
|
+
// fetch the latest active emoji from the new page
|
|
207
|
+
getReactionDetails(emojiId);
|
|
208
|
+
setSelectedEmojiId(emojiId);
|
|
209
|
+
onDialogPageChangeCallback(emojiId, currentPage, maxPages);
|
|
210
|
+
},
|
|
211
|
+
// Exclude unstable getReactionDetails to avoid extra re-renders
|
|
212
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
213
|
+
[setSelectedEmojiId]);
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Get the reactions that we want to render are any reactions with a count greater than zero as well as any default emoji not already shown
|
|
217
|
+
*/
|
|
218
|
+
var memorizedReactions = useMemo(function () {
|
|
219
|
+
//
|
|
220
|
+
/**
|
|
221
|
+
* If reactions not empty, don't show quick reactions Pre defined emoji or if its empty and default reactions not hidden => return the current list of reactions
|
|
222
|
+
*/
|
|
223
|
+
if (reactions.length === 0 && hideDefaultReactions || reactions.length > 0 || !quickReactionEmojis) {
|
|
224
|
+
return reactions;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// add any missing default reactions
|
|
228
|
+
var ari = quickReactionEmojis.ari,
|
|
229
|
+
containerAri = quickReactionEmojis.containerAri,
|
|
230
|
+
emojiIds = quickReactionEmojis.emojiIds;
|
|
231
|
+
var items = emojiIds.filter(function (emojiId) {
|
|
232
|
+
return !reactions.some(function (reaction) {
|
|
233
|
+
return reaction.emojiId === emojiId;
|
|
234
|
+
});
|
|
235
|
+
}).map(function (emojiId) {
|
|
236
|
+
return {
|
|
237
|
+
ari: ari,
|
|
238
|
+
containerAri: containerAri,
|
|
239
|
+
emojiId: emojiId,
|
|
240
|
+
count: 0,
|
|
241
|
+
reacted: false
|
|
242
|
+
};
|
|
243
|
+
});
|
|
244
|
+
return reactions.concat(items);
|
|
245
|
+
}, [quickReactionEmojis, reactions, hideDefaultReactions]);
|
|
246
|
+
var shouldShowSummaryView = summaryViewEnabled && memorizedReactions.length >= summaryViewThreshold && reactions.length > 0;
|
|
247
|
+
|
|
248
|
+
// criteria to show Reactions Dialog
|
|
249
|
+
var hasEmojiWithFivePlusReactions = reactions.some(function (reaction) {
|
|
250
|
+
return reaction.count >= 5;
|
|
251
|
+
});
|
|
252
|
+
var sortedReactions = useMemo(function () {
|
|
253
|
+
return _toConsumableArray(memorizedReactions).sort(function (a, b) {
|
|
254
|
+
return (b === null || b === void 0 ? void 0 : b.count) - (a === null || a === void 0 ? void 0 : a.count);
|
|
255
|
+
});
|
|
256
|
+
}, [memorizedReactions]);
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* event handler to open dialog with selected reaction
|
|
260
|
+
* @param emojiId initial emoji id to load dialog with
|
|
261
|
+
*/
|
|
262
|
+
var _handleOpenReactionsDialog = function handleOpenReactionsDialog() {
|
|
263
|
+
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
264
|
+
_ref2$emojiId = _ref2.emojiId,
|
|
265
|
+
emojiId = _ref2$emojiId === void 0 ? sortedReactions[0].emojiId : _ref2$emojiId,
|
|
266
|
+
_ref2$source = _ref2.source,
|
|
267
|
+
source = _ref2$source === void 0 ? 'endOfPageReactions' : _ref2$source;
|
|
268
|
+
// ufo start opening reaction dialog
|
|
269
|
+
ufoExperiences.openDialog.start();
|
|
270
|
+
getReactionDetails(emojiId);
|
|
271
|
+
setSelectedEmojiId(emojiId);
|
|
272
|
+
onDialogOpenCallback(emojiId, source);
|
|
273
|
+
|
|
274
|
+
// ufo opening reaction dialog success
|
|
275
|
+
ufoExperiences.openDialog.success({
|
|
276
|
+
metadata: {
|
|
277
|
+
emojiId: emojiId,
|
|
278
|
+
source: 'Reactions',
|
|
279
|
+
reason: 'Opening Reactions Dialog successfully'
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
};
|
|
283
|
+
return /*#__PURE__*/React.createElement(UFOSegment, {
|
|
284
|
+
name: "reactions"
|
|
285
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
286
|
+
"data-testid": RENDER_REACTIONS_TESTID,
|
|
287
|
+
className: ax(["_2rkoo7ao _1e0c1txw _1n261g80 _kqswh2mm _4cvr1h6o _19pkr5cr _13vtidpf", noWrap && "_1n261q9c", noRelativeContainer && "_kqswpfqs"])
|
|
288
|
+
}, !onlyRenderPicker && (shouldShowSummaryView ? /*#__PURE__*/React.createElement("div", {
|
|
289
|
+
"data-testid": RENDER_REACTIONS_SUMMARY_TESTID
|
|
290
|
+
}, /*#__PURE__*/React.createElement(ReactionSummaryView, {
|
|
291
|
+
reactions: sortedReactions,
|
|
292
|
+
emojiProvider: emojiProvider,
|
|
293
|
+
flash: flash,
|
|
294
|
+
particleEffectByEmoji: particleEffectByEmoji,
|
|
295
|
+
onSelection: handleOnSelection,
|
|
296
|
+
onReactionClick: onReactionClick,
|
|
297
|
+
onReactionFocused: handleReactionFocused,
|
|
298
|
+
onReactionMouseEnter: handleReactionMouseEnter,
|
|
299
|
+
placement: summaryViewPlacement,
|
|
300
|
+
showOpaqueBackground: showOpaqueBackground,
|
|
301
|
+
subtleReactionsSummaryAndPicker: subtleReactionsSummaryAndPicker,
|
|
302
|
+
handleOpenReactionsDialog: function handleOpenReactionsDialog() {
|
|
303
|
+
return _handleOpenReactionsDialog({
|
|
304
|
+
source: 'summaryView'
|
|
305
|
+
});
|
|
306
|
+
},
|
|
307
|
+
allowUserDialog: allowUserDialog && hasEmojiWithFivePlusReactions,
|
|
308
|
+
isViewOnly: isViewOnly,
|
|
309
|
+
allowSelectFromSummaryView: allowSelectFromSummaryView,
|
|
310
|
+
disabled: status !== ReactionStatus.ready,
|
|
311
|
+
reactionPickerTriggerIcon: reactionPickerTriggerIcon,
|
|
312
|
+
tooltipContent: getTooltip(status, errorMessage, reactionPickerTriggerToolipContent),
|
|
313
|
+
emojiPickerSize: emojiPickerSize,
|
|
314
|
+
onOpen: handlePickerOpen,
|
|
315
|
+
useButtonAlignmentStyling: useButtonAlignmentStyling
|
|
316
|
+
})) : memorizedReactions.map(function (reaction) {
|
|
317
|
+
return /*#__PURE__*/React.createElement(Reaction, {
|
|
318
|
+
key: reaction.emojiId,
|
|
319
|
+
reaction: reaction,
|
|
320
|
+
emojiProvider: emojiProvider,
|
|
321
|
+
onClick: onReactionClick,
|
|
322
|
+
onMouseEnter: handleReactionMouseEnter,
|
|
323
|
+
onFocused: handleReactionFocused,
|
|
324
|
+
flash: flash[reaction.emojiId],
|
|
325
|
+
showParticleEffect: particleEffectByEmoji[reaction.emojiId],
|
|
326
|
+
showOpaqueBackground: showOpaqueBackground,
|
|
327
|
+
allowUserDialog: allowUserDialog && hasEmojiWithFivePlusReactions,
|
|
328
|
+
handleOpenReactionsDialog: _handleOpenReactionsDialog,
|
|
329
|
+
isViewOnly: isViewOnly,
|
|
330
|
+
showSubtleStyle: showSubtleDefaultReactions && reactions.length === 0
|
|
331
|
+
});
|
|
332
|
+
})), isViewOnly || allowSelectFromSummaryView ? null : /*#__PURE__*/React.createElement(ReactionPicker, {
|
|
333
|
+
emojiProvider: emojiProvider,
|
|
334
|
+
allowAllEmojis: allowAllEmojis,
|
|
335
|
+
pickerQuickReactionEmojiIds: pickerQuickReactionEmojiIds,
|
|
336
|
+
disabled: status !== ReactionStatus.ready,
|
|
337
|
+
onSelection: handleOnSelection,
|
|
338
|
+
onOpen: handlePickerOpen,
|
|
339
|
+
onCancel: handleOnCancel,
|
|
340
|
+
onShowMore: handleOnMore,
|
|
341
|
+
tooltipContent: getTooltip(status, errorMessage, reactionPickerTriggerToolipContent),
|
|
342
|
+
emojiPickerSize: emojiPickerSize,
|
|
343
|
+
miniMode: miniMode,
|
|
344
|
+
showOpaqueBackground: showOpaqueBackground,
|
|
345
|
+
showAddReactionText: showAddReactionText,
|
|
346
|
+
subtleReactionsSummaryAndPicker: subtleReactionsSummaryAndPicker,
|
|
347
|
+
reactionPickerTriggerIcon: reactionPickerTriggerIcon,
|
|
348
|
+
reactionPickerAdditionalStyle: reactionPickerAdditionalStyle,
|
|
349
|
+
useButtonAlignmentStyling: useButtonAlignmentStyling,
|
|
350
|
+
className: ax(["_1e0c1o8l _19pk1b66"])
|
|
351
|
+
}), /*#__PURE__*/React.createElement(ModalTransition, null, !!selectedEmojiId && /*#__PURE__*/React.createElement(UFOSegment, {
|
|
352
|
+
name: "reactions-dialog"
|
|
353
|
+
}, /*#__PURE__*/React.createElement(ReactionsDialog, {
|
|
354
|
+
selectedEmojiId: selectedEmojiId,
|
|
355
|
+
reactions: sortedReactions,
|
|
356
|
+
emojiProvider: emojiProvider,
|
|
357
|
+
handleCloseReactionsDialog: handleCloseReactionsDialog,
|
|
358
|
+
handleSelectReaction: handleSelectReactionInDialog,
|
|
359
|
+
handlePaginationChange: handlePaginationChange,
|
|
360
|
+
ProfileCardWrapper: ProfileCardWrapper
|
|
361
|
+
})))));
|
|
362
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
._19itglyw{border:none}
|
|
3
|
+
._2rkoglpi{border-radius:var(--ds-border-radius,4px)}._12l21b66{margin-inline-end:var(--ds-space-050,4px)}
|
|
4
|
+
._18m915vq{overflow-y:hidden}
|
|
5
|
+
._19bvze3t{padding-left:var(--ds-space-0,0)}
|
|
6
|
+
._1e0c1txw{display:flex}
|
|
7
|
+
._1pfh1b66{margin-block-start:var(--ds-space-050,4px)}
|
|
8
|
+
._1reo15vq{overflow-x:hidden}
|
|
9
|
+
._1ul914no{min-width:36px}
|
|
10
|
+
._2lx2vrvc{flex-direction:row}
|
|
11
|
+
._4cvr1y6m{align-items:flex-start}
|
|
12
|
+
._4t3i1tcg{height:24px}
|
|
13
|
+
._ca0qze3t{padding-top:var(--ds-space-0,0)}
|
|
14
|
+
._n3tdze3t{padding-bottom:var(--ds-space-0,0)}
|
|
15
|
+
._syaz1gjq{color:var(--ds-text-subtle,#44546f)}
|
|
16
|
+
._u5f3ze3t{padding-right:var(--ds-space-0,0)}
|
|
17
|
+
._d0al73ad:hover{cursor:default}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/* StaticReaction.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import "./StaticReaction.compiled.css";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
6
|
+
import { Box } from '@atlaskit/primitives/compiled';
|
|
7
|
+
var styles = {
|
|
8
|
+
staticReaction: "_1reo15vq _18m915vq _19itglyw _2rkoglpi _1e0c1txw _2lx2vrvc _4cvr1y6m _1ul914no _4t3i1tcg _syaz1gjq _1pfh1b66 _12l21b66 _ca0qze3t _u5f3ze3t _n3tdze3t _19bvze3t _d0al73ad"
|
|
9
|
+
};
|
|
10
|
+
export var StaticReaction = function StaticReaction(_ref) {
|
|
11
|
+
var onMouseEnter = _ref.onMouseEnter,
|
|
12
|
+
onFocus = _ref.onFocus,
|
|
13
|
+
children = _ref.children,
|
|
14
|
+
testId = _ref.testId,
|
|
15
|
+
_ref$dataAttributes = _ref.dataAttributes,
|
|
16
|
+
dataAttributes = _ref$dataAttributes === void 0 ? {} : _ref$dataAttributes;
|
|
17
|
+
return /*#__PURE__*/React.createElement(Box, _extends({
|
|
18
|
+
onMouseEnter: onMouseEnter,
|
|
19
|
+
onFocus: onFocus,
|
|
20
|
+
testId: testId,
|
|
21
|
+
xcss: styles.staticReaction,
|
|
22
|
+
backgroundColor: "color.background.neutral.subtle"
|
|
23
|
+
}, dataAttributes), children);
|
|
24
|
+
};
|
|
@@ -7,9 +7,12 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
7
7
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
8
8
|
import { FabricElementsAnalyticsContext } from '@atlaskit/analytics-namespaced-context';
|
|
9
9
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
10
|
-
import {
|
|
10
|
+
import { UfoErrorBoundary } from '../../components';
|
|
11
|
+
import { Reactions as EmotionReactions } from '../../components/Reactions';
|
|
12
|
+
import { Reactions as CompiledReactions } from '../../components/compiled/Reactions';
|
|
11
13
|
import { ufoExperiences } from '../../store';
|
|
12
14
|
import { ReactionStatus } from '../../types';
|
|
15
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
16
|
|
|
14
17
|
/**
|
|
15
18
|
* State Props required for <Reactions />
|
|
@@ -211,7 +214,9 @@ export var ConnectedReactionsView = function ConnectedReactionsView(props) {
|
|
|
211
214
|
}
|
|
212
215
|
}, /*#__PURE__*/React.createElement(UfoErrorBoundary, {
|
|
213
216
|
experiences: experienceInstance.current ? [experienceInstance.current] : []
|
|
214
|
-
}, stateData && dispatchData ? /*#__PURE__*/React.createElement(
|
|
217
|
+
}, stateData && dispatchData && fg('platform_editor_css_migrate_reactions') ? /*#__PURE__*/React.createElement(CompiledReactions, _extends({
|
|
218
|
+
key: "".concat(containerAri, "|").concat(ari)
|
|
219
|
+
}, rest, dispatchData, stateData)) : null, stateData && dispatchData && !fg('platform_editor_css_migrate_reactions') ? /*#__PURE__*/React.createElement(EmotionReactions, _extends({
|
|
215
220
|
key: "".concat(containerAri, "|").concat(ari)
|
|
216
221
|
}, rest, dispatchData, stateData)) : null));
|
|
217
222
|
};
|
package/dist/esm/index.js
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import { DefaultReactions, DefaultReactionsByShortName, ExtendedReactions, ExtendedReactionsByShortName, NUMBER_OF_REACTIONS_TO_DISPLAY, SAMPLING_RATE_REACTIONS_RENDERED_EXP, TOOLTIP_USERS_LIMIT } from './shared/constants';
|
|
2
2
|
import { ComponentName, ExperienceName, PickerRender, ReactionsAdd, ReactionDetailsFetch, ReactionDialogOpened, ReactionDialogSelectedReactionChanged, ReactionsRemove, ReactionsRendered, sampledReactionsRendered } from './ufo';
|
|
3
|
+
import { Reaction as EmotionReaction } from './components/Reaction';
|
|
4
|
+
import { Reaction as CompiledReaction } from './components/compiled/Reaction';
|
|
5
|
+
import { Reactions as EmotionReactions } from './components/Reactions';
|
|
6
|
+
import { Reactions as CompiledReactions } from './components/compiled/Reactions';
|
|
7
|
+
import { componentWithFG } from '@atlaskit/platform-feature-flags-react';
|
|
8
|
+
var Reaction = componentWithFG('platform_editor_css_migrate_reactions', CompiledReaction, EmotionReaction);
|
|
9
|
+
var Reactions = componentWithFG('platform_editor_css_migrate_reactions', CompiledReactions, EmotionReactions);
|
|
3
10
|
export { ReactionServiceClient } from './client';
|
|
4
|
-
export { Reaction,
|
|
11
|
+
export { Reaction, Reactions };
|
|
12
|
+
export { ReactionPicker } from './components/ReactionPicker/ReactionPicker';
|
|
5
13
|
export { useCloseManager } from './hooks/useCloseManager';
|
|
6
14
|
export { ConnectedReactionPicker, ConnectedReactionsView } from './containers';
|
|
7
15
|
export { MemoryReactionsStore, ReactionConsumer } from './store';
|
|
@@ -71,11 +71,7 @@ export interface ReactionPickerProps extends Pick<SelectorProps, 'pickerQuickRea
|
|
|
71
71
|
*/
|
|
72
72
|
showAddReactionText?: boolean;
|
|
73
73
|
/**
|
|
74
|
-
* Optional prop for controlling
|
|
75
|
-
*/
|
|
76
|
-
showRoundTrigger?: boolean;
|
|
77
|
-
/**
|
|
78
|
-
* Optional prop for controlling the picker location, gets overrided by showRoundTrigger
|
|
74
|
+
* Optional prop for controlling the picker location
|
|
79
75
|
*/
|
|
80
76
|
reactionPickerPlacement?: Placement;
|
|
81
77
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { type ReactionPickerProps } from '../ReactionPicker';
|
|
3
3
|
interface ReactionSummaryViewEmojiPickerProps extends ReactionPickerProps {
|
|
4
4
|
}
|
|
5
|
-
export declare const ReactionSummaryViewEmojiPicker: ({ emojiProvider, onSelection, emojiPickerSize, disabled, reactionPickerTriggerIcon, tooltipContent, onOpen, }: ReactionSummaryViewEmojiPickerProps) =>
|
|
5
|
+
export declare const ReactionSummaryViewEmojiPicker: ({ emojiProvider, onSelection, emojiPickerSize, disabled, reactionPickerTriggerIcon, tooltipContent, onOpen, }: ReactionSummaryViewEmojiPickerProps) => React.JSX.Element;
|
|
6
6
|
export {};
|
|
@@ -139,11 +139,7 @@ export interface ReactionsProps extends Pick<ReactionPickerProps, 'allowAllEmoji
|
|
|
139
139
|
*/
|
|
140
140
|
onlyRenderPicker?: boolean;
|
|
141
141
|
/**
|
|
142
|
-
* Optional prop for controlling
|
|
143
|
-
*/
|
|
144
|
-
showRoundTrigger?: boolean;
|
|
145
|
-
/**
|
|
146
|
-
* Optional prop for controlling the placement of the reaction picker, is overriden by showRoundTrigger
|
|
142
|
+
* Optional prop for controlling the placement of the reaction picker
|
|
147
143
|
*/
|
|
148
144
|
reactionPickerPlacement?: Placement;
|
|
149
145
|
/**
|
|
@@ -187,4 +183,4 @@ export declare function getTooltip(status: ReactionStatus, errorMessage?: string
|
|
|
187
183
|
/**
|
|
188
184
|
* Renders list of reactions
|
|
189
185
|
*/
|
|
190
|
-
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,
|
|
186
|
+
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, reactionPickerPlacement, reactionsPickerPreventOverflowOptions, isViewOnly, reactionPickerAdditionalStyle, noWrap, noRelativeContainer, showSubtleDefaultReactions, reactionPickerTriggerToolipContent, reactionPickerTriggerIcon, allowSelectFromSummaryView, useButtonAlignmentStyling, }: ReactionsProps) => jsx.JSX.Element>;
|
|
@@ -45,10 +45,6 @@ export interface TriggerProps {
|
|
|
45
45
|
* Optional prop for applying subtle styling to reaction picker
|
|
46
46
|
*/
|
|
47
47
|
subtleReactionsSummaryAndPicker?: boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Optional prop for controlling if the picker hover border will be rounded
|
|
50
|
-
*/
|
|
51
|
-
showRoundTrigger?: boolean;
|
|
52
48
|
/**
|
|
53
49
|
* Option prop for controlling the reaction picker selection style
|
|
54
50
|
*/
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type Durations } from '@atlaskit/motion';
|
|
3
|
+
/**
|
|
4
|
+
* Test id for component top level div
|
|
5
|
+
*/
|
|
6
|
+
export declare const RENDER_COMPONENT_WRAPPER = "counter-wrapper";
|
|
7
|
+
/**
|
|
8
|
+
* Test id for wrapper div of the counter inside the slider
|
|
9
|
+
*/
|
|
10
|
+
export declare const RENDER_COUNTER_TESTID = "counter-container";
|
|
11
|
+
/**
|
|
12
|
+
* Counter label value wrapper div
|
|
13
|
+
*/
|
|
14
|
+
export declare const RENDER_LABEL_TESTID = "counter_label_wrapper";
|
|
15
|
+
export interface CounterProps {
|
|
16
|
+
/**
|
|
17
|
+
* Count of emoji been selected
|
|
18
|
+
*/
|
|
19
|
+
value: number;
|
|
20
|
+
/**
|
|
21
|
+
* Has the emoji been selected by given user (defaults to false)
|
|
22
|
+
*/
|
|
23
|
+
highlight?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Max threshold of selections to show before having a label (defaults to 1000)
|
|
26
|
+
*/
|
|
27
|
+
limit?: number;
|
|
28
|
+
/**
|
|
29
|
+
* Label to show when the value surpasses the limit value (defaults to "1k+")
|
|
30
|
+
*/
|
|
31
|
+
overLimitLabel?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Optional wrapper class name
|
|
34
|
+
*/
|
|
35
|
+
className?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Duration of how long the motion will take (defaults to "medium" from '@atlaskit/motion')
|
|
38
|
+
*/
|
|
39
|
+
animationDuration?: Durations;
|
|
40
|
+
/**
|
|
41
|
+
* Optional prop to use a darker text color for the counter
|
|
42
|
+
*/
|
|
43
|
+
useDarkerFont?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Optional prop to show updated styling for counter
|
|
46
|
+
*/
|
|
47
|
+
useUpdatedStyles?: boolean;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Display reaction count next to the emoji button
|
|
51
|
+
*/
|
|
52
|
+
export declare const Counter: ({ highlight, limit, overLimitLabel, className, value, animationDuration, useDarkerFont, useUpdatedStyles, }: CounterProps) => JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
import { type PropsWithChildren } from 'react';
|
|
6
|
+
export type FlashAnimationProps = PropsWithChildren<{
|
|
7
|
+
/**
|
|
8
|
+
* Optional wrapper div class anme
|
|
9
|
+
*/
|
|
10
|
+
className?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Show custom animation or render as standard without animation (defaults to false)
|
|
13
|
+
*/
|
|
14
|
+
flash?: boolean;
|
|
15
|
+
}>;
|
|
16
|
+
/**
|
|
17
|
+
* Test id for wrapper FlashAnimation div
|
|
18
|
+
*/
|
|
19
|
+
export declare const RENDER_FLASHANIMATION_TESTID = "flash-animation";
|
|
20
|
+
/**
|
|
21
|
+
* Flash animation background component. See Reaction component for usage.
|
|
22
|
+
*/
|
|
23
|
+
export declare const FlashAnimation: (props: FlashAnimationProps) => JSX.Element;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type EmojiProvider } from '@atlaskit/emoji';
|
|
3
|
+
import { type ReactionSummary, type ReactionClick, type ReactionMouseEnter } from '../../types';
|
|
4
|
+
import { type ReactionFocused } from '../../types/reaction';
|
|
5
|
+
import { type OpenReactionsDialogOptions } from '../Reactions';
|
|
6
|
+
/**
|
|
7
|
+
* Test id for Reaction item wrapper div
|
|
8
|
+
*/
|
|
9
|
+
export declare const RENDER_REACTION_TESTID = "render_reaction_wrapper";
|
|
10
|
+
export interface ReactionProps {
|
|
11
|
+
/**
|
|
12
|
+
* Data for the reaction
|
|
13
|
+
*/
|
|
14
|
+
reaction: ReactionSummary;
|
|
15
|
+
/**
|
|
16
|
+
* Provider for loading emojis
|
|
17
|
+
*/
|
|
18
|
+
emojiProvider: Promise<EmojiProvider>;
|
|
19
|
+
/**
|
|
20
|
+
* event handler when the emoji button is clicked
|
|
21
|
+
*/
|
|
22
|
+
onClick: ReactionClick;
|
|
23
|
+
/**
|
|
24
|
+
* Optional event when the mouse cursor hovers over the reaction
|
|
25
|
+
*/
|
|
26
|
+
onMouseEnter?: ReactionMouseEnter;
|
|
27
|
+
/**
|
|
28
|
+
* Optional event when focused the reaction
|
|
29
|
+
*/
|
|
30
|
+
onFocused?: ReactionFocused;
|
|
31
|
+
/**
|
|
32
|
+
* Show custom animation or render as standard without animation (defaults to false)
|
|
33
|
+
*/
|
|
34
|
+
flash?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Show a floating emoji particle effect (usually in response to a new reaction) (defaults to false)
|
|
37
|
+
*/
|
|
38
|
+
showParticleEffect?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Optional prop for using an opaque button background instead of a transparent background
|
|
41
|
+
*/
|
|
42
|
+
showOpaqueBackground?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Optional prop for enabling the Reactions Dialog
|
|
45
|
+
*/
|
|
46
|
+
allowUserDialog?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Optional function when the user wants to open the Reactions Dialog
|
|
49
|
+
*/
|
|
50
|
+
handleOpenReactionsDialog?: (options?: OpenReactionsDialogOptions) => void;
|
|
51
|
+
/**
|
|
52
|
+
* Optional prop for controlling if the reactions component is view only, disabling adding reactions
|
|
53
|
+
*/
|
|
54
|
+
isViewOnly?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Optional prop for controlling if the reaction displayed is a default one and should not have a border
|
|
57
|
+
*/
|
|
58
|
+
showSubtleStyle?: boolean;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Render an emoji reaction button
|
|
62
|
+
*/
|
|
63
|
+
export declare const Reaction: ({ emojiProvider, onClick, reaction, onMouseEnter, onFocused, flash, showParticleEffect, showOpaqueBackground, allowUserDialog, handleOpenReactionsDialog, isViewOnly, showSubtleStyle, }: ReactionProps) => JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type ReactionProps } from './Reaction';
|
|
3
|
+
interface ReactionButtonProps extends Pick<ReactionProps, 'flash'> {
|
|
4
|
+
onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
5
|
+
className?: string;
|
|
6
|
+
ariaLabel: string;
|
|
7
|
+
ariaPressed?: boolean;
|
|
8
|
+
onMouseEnter?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
9
|
+
onFocus?: (event: React.FocusEvent<HTMLButtonElement>) => void;
|
|
10
|
+
dataAttributes?: {
|
|
11
|
+
[key: string]: string;
|
|
12
|
+
};
|
|
13
|
+
testId?: string;
|
|
14
|
+
children?: React.ReactNode;
|
|
15
|
+
showSubtleStyle?: boolean;
|
|
16
|
+
showOpaqueBackground?: boolean;
|
|
17
|
+
reacted?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare const ReactionButton: ({ onClick, flash, showSubtleStyle, showOpaqueBackground, reacted, ariaLabel, ariaPressed, onMouseEnter, onFocus, children, dataAttributes, testId, }: ReactionButtonProps) => JSX.Element;
|
|
20
|
+
export {};
|