@atlaskit/reactions 27.2.1 → 28.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 +12 -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/ReactionSummary/ReactionSummaryViewEmojiPicker.js +7 -12
- 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 +377 -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/ReactionSummary/ReactionSummaryViewEmojiPicker.js +4 -10
- 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 +325 -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/ReactionSummary/ReactionSummaryViewEmojiPicker.js +4 -10
- 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 +365 -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/ReactionSummary/ReactionSummaryViewEmojiPicker.d.ts +2 -2
- 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 +181 -0
- package/dist/types/components/compiled/StaticReaction.d.ts +12 -0
- package/dist/types/index.d.ts +5 -1
- package/dist/types-ts4.5/components/ReactionSummary/ReactionSummaryViewEmojiPicker.d.ts +2 -2
- 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 +181 -0
- package/dist/types-ts4.5/components/compiled/StaticReaction.d.ts +12 -0
- package/dist/types-ts4.5/index.d.ts +5 -1
- package/package.json +13 -3
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
|
|
3
|
-
* @jsxRuntime classic
|
|
4
|
-
* @jsx jsx
|
|
5
|
-
*/
|
|
6
|
-
import { useCallback, useState } from 'react';
|
|
7
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
|
-
import { jsx } from '@emotion/react';
|
|
2
|
+
import React, { useCallback, useState } from 'react';
|
|
9
3
|
import { EmojiPicker } from '@atlaskit/emoji/picker';
|
|
10
4
|
import Popup from '@atlaskit/popup';
|
|
11
5
|
import { PickerRender } from '../../ufo';
|
|
@@ -58,17 +52,17 @@ export const ReactionSummaryViewEmojiPicker = ({
|
|
|
58
52
|
onSelection(item.id, 'emojiPicker');
|
|
59
53
|
close(item.id);
|
|
60
54
|
}, [onSelection, close]);
|
|
61
|
-
return
|
|
55
|
+
return /*#__PURE__*/React.createElement(Popup, {
|
|
62
56
|
testId: "reaction-summary-view-emoji-picker",
|
|
63
57
|
isOpen: isOpen,
|
|
64
58
|
placement: "right",
|
|
65
59
|
onClose: () => close(),
|
|
66
|
-
content: () =>
|
|
60
|
+
content: () => /*#__PURE__*/React.createElement(EmojiPicker, {
|
|
67
61
|
emojiProvider: emojiProvider,
|
|
68
62
|
onSelection: onEmojiSelected,
|
|
69
63
|
size: emojiPickerSize
|
|
70
64
|
}),
|
|
71
|
-
trigger: triggerProps =>
|
|
65
|
+
trigger: triggerProps => /*#__PURE__*/React.createElement(Trigger, _extends({}, triggerProps, {
|
|
72
66
|
disabled: disabled,
|
|
73
67
|
reactionPickerTriggerIcon: reactionPickerTriggerIcon,
|
|
74
68
|
tooltipContent: tooltipContent,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
._11c81o8v{font:var(--ds-font-body-small,normal 400 11px/1pc ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
|
|
2
|
+
._18m915vq{overflow-y:hidden}
|
|
3
|
+
._19bvidpf{padding-left:0}
|
|
4
|
+
._19pk1b66{margin-top:var(--ds-space-050,4px)}
|
|
5
|
+
._1e0c1txw{display:flex}
|
|
6
|
+
._1reo15vq{overflow-x:hidden}
|
|
7
|
+
._1x821ts4{font-variant-numeric:tabular-nums}
|
|
8
|
+
._2lx21bp4{flex-direction:column}
|
|
9
|
+
._ca0q1b66{padding-top:var(--ds-space-050,4px)}
|
|
10
|
+
._kqswh2mm{position:relative}
|
|
11
|
+
._n3td1b66{padding-bottom:var(--ds-space-050,4px)}
|
|
12
|
+
._syaz1gjq{color:var(--ds-text-subtle,#44546f)}
|
|
13
|
+
._syaz1ifp{color:var(--ds-text-subtlest,#8993a4)}
|
|
14
|
+
._syaz1ldt{color:var(--ds-text-selected,#0052cc)}
|
|
15
|
+
._u5f3u2gc{padding-right:var(--ds-space-100,8px)}
|
|
16
|
+
._vwz4dlk8{line-height:14px}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/* Counter.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
2
|
+
import "./Counter.compiled.css";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
+
import { useEffect, useMemo, useRef } from 'react';
|
|
6
|
+
import { SlideIn, ExitingPersistence } from '@atlaskit/motion';
|
|
7
|
+
import { formatLargeNumber } from '../../shared/utils';
|
|
8
|
+
import { B400, N90 } from '@atlaskit/theme/colors';
|
|
9
|
+
const containerStyle = null;
|
|
10
|
+
const counterLabelStyle = null;
|
|
11
|
+
const countStyle = null;
|
|
12
|
+
const highlightStyle = null;
|
|
13
|
+
const darkerFontStyle = null;
|
|
14
|
+
const updatedStyles = null;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Test id for component top level div
|
|
18
|
+
*/
|
|
19
|
+
export const RENDER_COMPONENT_WRAPPER = 'counter-wrapper';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Test id for wrapper div of the counter inside the slider
|
|
23
|
+
*/
|
|
24
|
+
export const RENDER_COUNTER_TESTID = 'counter-container';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Counter label value wrapper div
|
|
28
|
+
*/
|
|
29
|
+
export const RENDER_LABEL_TESTID = 'counter_label_wrapper';
|
|
30
|
+
/**
|
|
31
|
+
* Display reaction count next to the emoji button
|
|
32
|
+
*/
|
|
33
|
+
export const Counter = ({
|
|
34
|
+
highlight = false,
|
|
35
|
+
limit,
|
|
36
|
+
overLimitLabel,
|
|
37
|
+
className,
|
|
38
|
+
value,
|
|
39
|
+
animationDuration = 'medium',
|
|
40
|
+
useDarkerFont,
|
|
41
|
+
useUpdatedStyles
|
|
42
|
+
}) => {
|
|
43
|
+
const getLabel = value => {
|
|
44
|
+
// Check if reached limit
|
|
45
|
+
if (limit && overLimitLabel && value >= limit) {
|
|
46
|
+
return overLimitLabel || '';
|
|
47
|
+
} else if (value === 0) {
|
|
48
|
+
return '';
|
|
49
|
+
} else {
|
|
50
|
+
return formatLargeNumber(value);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
const lastValue = useRef();
|
|
54
|
+
const label = getLabel(value);
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
lastValue.current = value;
|
|
57
|
+
}, [value]);
|
|
58
|
+
const isIncreasing = useMemo(() => {
|
|
59
|
+
return lastValue.current ? lastValue.current < value : false;
|
|
60
|
+
}, [value]);
|
|
61
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
62
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
63
|
+
className: ax(["_11c81o8v _1reo15vq _18m915vq _syaz1ifp _kqswh2mm _ca0q1b66 _u5f3u2gc _n3td1b66 _19bvidpf _vwz4dlk8", useDarkerFont && "_syaz1gjq", useUpdatedStyles && "_19pk1b66", className]),
|
|
64
|
+
"data-testid": RENDER_COMPONENT_WRAPPER
|
|
65
|
+
}, /*#__PURE__*/React.createElement(ExitingPersistence, null, /*#__PURE__*/React.createElement(SlideIn, {
|
|
66
|
+
enterFrom: isIncreasing ? 'top' : 'bottom',
|
|
67
|
+
exitTo: isIncreasing ? 'top' : 'bottom',
|
|
68
|
+
key: value,
|
|
69
|
+
duration: animationDuration
|
|
70
|
+
}, (motion, direction) => {
|
|
71
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
72
|
+
ref: motion.ref,
|
|
73
|
+
style: {
|
|
74
|
+
position: direction === 'exiting' ? 'absolute' : undefined
|
|
75
|
+
}
|
|
76
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
77
|
+
,
|
|
78
|
+
className: ax(["_1e0c1txw _2lx21bp4", motion.className]),
|
|
79
|
+
"data-testid": RENDER_COUNTER_TESTID
|
|
80
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
81
|
+
"data-testid": RENDER_LABEL_TESTID,
|
|
82
|
+
key: value,
|
|
83
|
+
className: ax(["_1x821ts4", highlight && "_syaz1ldt"])
|
|
84
|
+
}, label));
|
|
85
|
+
})));
|
|
86
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
|
|
2
|
+
._y44v1li1{animation:k1qrjcqm .7s ease-in-out}._1bsb1osq{width:100%}
|
|
3
|
+
._4t3i1osq{height:100%}
|
|
4
|
+
@keyframes k1qrjcqm{20%{border-color:var(--ds-border-selected,#0065ff);background-color:var(--ds-background-selected-pressed,#b3d4ff)}75%{border-color:var(--ds-border-selected,#0065ff);background-color:var(--ds-background-selected-pressed,#b3d4ff)}to{border-color:var(--ds-border-selected,#0065ff);background-color:var(--ds-background-selected-pressed,#b3d4ff)}0%{background-color:transparent}}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/* FlashAnimation.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
2
|
+
import "./FlashAnimation.compiled.css";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
+
import { B75, B300 } from '@atlaskit/theme/colors';
|
|
6
|
+
const flashTime = 700;
|
|
7
|
+
const flashAnimation = null;
|
|
8
|
+
const containerStyle = null;
|
|
9
|
+
const flashStyle = null;
|
|
10
|
+
/**
|
|
11
|
+
* Test id for wrapper FlashAnimation div
|
|
12
|
+
*/
|
|
13
|
+
export const RENDER_FLASHANIMATION_TESTID = 'flash-animation';
|
|
14
|
+
/**
|
|
15
|
+
* Flash animation background component. See Reaction component for usage.
|
|
16
|
+
*/
|
|
17
|
+
export const FlashAnimation = props => /*#__PURE__*/React.createElement("div", {
|
|
18
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
19
|
+
className: ax(["_1bsb1osq _4t3i1osq", props.flash && "", props.flash && "_y44v1li1", props.className]),
|
|
20
|
+
"data-testid": RENDER_FLASHANIMATION_TESTID
|
|
21
|
+
}, props.children);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
._19bv19bv{padding-left:10px}
|
|
2
|
+
._19bvu2gc{padding-left:var(--ds-space-100,8px)}
|
|
3
|
+
._8hrz1nam{transform-origin:center center 0}
|
|
4
|
+
._ca0q1b66{padding-top:var(--ds-space-050,4px)}
|
|
5
|
+
._kqswh2mm{position:relative}
|
|
6
|
+
._n3td1b66{padding-bottom:var(--ds-space-050,4px)}
|
|
7
|
+
._u5f31b66{padding-right:var(--ds-space-050,4px)}
|
|
8
|
+
._u5f3v77o{padding-right:var(--ds-space-025,2px)}
|
|
9
|
+
._vwz41crf{line-height:9pt}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/* Reaction.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
2
|
+
import "./Reaction.compiled.css";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
6
|
+
import { useIntl } from 'react-intl-next';
|
|
7
|
+
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
8
|
+
import { ResourcedEmoji } from '@atlaskit/emoji';
|
|
9
|
+
import { createAndFireSafe, createReactionClickedEvent, createReactionFocusedEvent, createReactionHoveredEvent } from '../../analytics';
|
|
10
|
+
import { Counter } from '../Counter';
|
|
11
|
+
import { ReactionParticleEffect } from './ReactionParticleEffect';
|
|
12
|
+
import { ReactionTooltip } from './ReactionTooltip';
|
|
13
|
+
import { messages } from '../../shared/i18n';
|
|
14
|
+
import { isLeftClick } from '../../shared/utils';
|
|
15
|
+
import { ReactionButton } from './ReactionButton';
|
|
16
|
+
import { StaticReaction } from './StaticReaction';
|
|
17
|
+
import { Box, Inline } from '@atlaskit/primitives/compiled';
|
|
18
|
+
const styles = {
|
|
19
|
+
container: "_kqswh2mm"
|
|
20
|
+
};
|
|
21
|
+
const emojiStyle = null;
|
|
22
|
+
const emojiNoReactionStyle = null;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Test id for Reaction item wrapper div
|
|
26
|
+
*/
|
|
27
|
+
export const RENDER_REACTION_TESTID = 'render_reaction_wrapper';
|
|
28
|
+
/**
|
|
29
|
+
* Render an emoji reaction button
|
|
30
|
+
*/
|
|
31
|
+
export const Reaction = ({
|
|
32
|
+
emojiProvider,
|
|
33
|
+
onClick,
|
|
34
|
+
reaction,
|
|
35
|
+
onMouseEnter = () => {},
|
|
36
|
+
onFocused = () => {},
|
|
37
|
+
flash = false,
|
|
38
|
+
showParticleEffect = false,
|
|
39
|
+
showOpaqueBackground = false,
|
|
40
|
+
allowUserDialog,
|
|
41
|
+
handleOpenReactionsDialog,
|
|
42
|
+
isViewOnly = false,
|
|
43
|
+
showSubtleStyle
|
|
44
|
+
}) => {
|
|
45
|
+
const intl = useIntl();
|
|
46
|
+
const hoverStart = useRef();
|
|
47
|
+
const focusStart = useRef();
|
|
48
|
+
const {
|
|
49
|
+
createAnalyticsEvent
|
|
50
|
+
} = useAnalyticsEvents();
|
|
51
|
+
const [emojiName, setEmojiName] = useState();
|
|
52
|
+
const [isTooltipEnabled, setIsTooltipEnabled] = useState(true);
|
|
53
|
+
const {
|
|
54
|
+
reacted
|
|
55
|
+
} = reaction;
|
|
56
|
+
const emojiId = {
|
|
57
|
+
id: reaction.emojiId,
|
|
58
|
+
shortName: ''
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
// TODO: Extract the flow to a custom hook to retrieve emoji detailed description from an id using a custom hook. This will benefit a better optimization instead of the emojiProvider resolving everytime.
|
|
62
|
+
// Also optimize in future version to fetch in batch several emojiIds
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
(async () => {
|
|
65
|
+
const emojiResource = await Promise.resolve(emojiProvider);
|
|
66
|
+
const foundEmoji = await emojiResource.findById(reaction.emojiId);
|
|
67
|
+
if (foundEmoji) {
|
|
68
|
+
setEmojiName(foundEmoji.name);
|
|
69
|
+
}
|
|
70
|
+
})();
|
|
71
|
+
}, [emojiProvider, reaction.emojiId]);
|
|
72
|
+
const handleClick = useCallback(event => {
|
|
73
|
+
event.preventDefault();
|
|
74
|
+
if (isLeftClick(event)) {
|
|
75
|
+
const {
|
|
76
|
+
reacted,
|
|
77
|
+
emojiId
|
|
78
|
+
} = reaction;
|
|
79
|
+
createAndFireSafe(createAnalyticsEvent, createReactionClickedEvent, !reacted, emojiId);
|
|
80
|
+
onClick(reaction.emojiId, event);
|
|
81
|
+
}
|
|
82
|
+
}, [createAnalyticsEvent, reaction, onClick]);
|
|
83
|
+
const handleMouseEnter = useCallback(event => {
|
|
84
|
+
event.preventDefault();
|
|
85
|
+
setIsTooltipEnabled(true);
|
|
86
|
+
if (!reaction.users || !reaction.users.length) {
|
|
87
|
+
focusStart.current = Date.now();
|
|
88
|
+
}
|
|
89
|
+
createAndFireSafe(createAnalyticsEvent, createReactionHoveredEvent, focusStart.current);
|
|
90
|
+
onMouseEnter(reaction.emojiId, event);
|
|
91
|
+
}, [createAnalyticsEvent, reaction, onMouseEnter]);
|
|
92
|
+
const handleFocused = useCallback(event => {
|
|
93
|
+
event.preventDefault();
|
|
94
|
+
setIsTooltipEnabled(true);
|
|
95
|
+
if (!reaction.users || !reaction.users.length) {
|
|
96
|
+
hoverStart.current = Date.now();
|
|
97
|
+
}
|
|
98
|
+
createAndFireSafe(createAnalyticsEvent, createReactionFocusedEvent, hoverStart.current);
|
|
99
|
+
onFocused(reaction.emojiId, event);
|
|
100
|
+
}, [createAnalyticsEvent, reaction, onFocused]);
|
|
101
|
+
const dismissTooltip = () => {
|
|
102
|
+
setIsTooltipEnabled(false);
|
|
103
|
+
};
|
|
104
|
+
const emojiAndCount = /*#__PURE__*/React.createElement(Inline, null, /*#__PURE__*/React.createElement("div", {
|
|
105
|
+
className: ax(["_8hrz1nam _vwz41crf _ca0q1b66 _u5f31b66 _n3td1b66 _19bvu2gc", reaction.count === 0 && "_ca0q1b66 _u5f3v77o _n3td1b66 _19bv19bv"])
|
|
106
|
+
}, /*#__PURE__*/React.createElement(ResourcedEmoji, {
|
|
107
|
+
emojiProvider: emojiProvider,
|
|
108
|
+
emojiId: emojiId,
|
|
109
|
+
fitToHeight: 16
|
|
110
|
+
})), /*#__PURE__*/React.createElement(Counter, {
|
|
111
|
+
value: reaction.count,
|
|
112
|
+
highlight: !isViewOnly && reaction.reacted
|
|
113
|
+
}));
|
|
114
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
115
|
+
xcss: styles.container
|
|
116
|
+
}, showParticleEffect && /*#__PURE__*/React.createElement(ReactionParticleEffect, {
|
|
117
|
+
emojiId: emojiId,
|
|
118
|
+
emojiProvider: emojiProvider
|
|
119
|
+
}), /*#__PURE__*/React.createElement(ReactionTooltip, {
|
|
120
|
+
emojiName: emojiName,
|
|
121
|
+
reaction: reaction,
|
|
122
|
+
isEnabled: isTooltipEnabled,
|
|
123
|
+
allowUserDialog: allowUserDialog,
|
|
124
|
+
handleOpenReactionsDialog: handleOpenReactionsDialog,
|
|
125
|
+
dismissTooltip: dismissTooltip
|
|
126
|
+
}, isViewOnly ? /*#__PURE__*/React.createElement(StaticReaction, {
|
|
127
|
+
onMouseEnter: handleMouseEnter,
|
|
128
|
+
onFocus: handleFocused,
|
|
129
|
+
testId: RENDER_REACTION_TESTID,
|
|
130
|
+
dataAttributes: {
|
|
131
|
+
'data-emoji-id': reaction.emojiId
|
|
132
|
+
}
|
|
133
|
+
}, emojiAndCount) : /*#__PURE__*/React.createElement(ReactionButton, {
|
|
134
|
+
onClick: handleClick,
|
|
135
|
+
flash: flash,
|
|
136
|
+
ariaLabel: intl.formatMessage(messages.reactWithEmoji, {
|
|
137
|
+
emoji: emojiName
|
|
138
|
+
}),
|
|
139
|
+
ariaPressed: reacted,
|
|
140
|
+
onMouseEnter: handleMouseEnter,
|
|
141
|
+
onFocus: handleFocused,
|
|
142
|
+
testId: RENDER_REACTION_TESTID,
|
|
143
|
+
dataAttributes: {
|
|
144
|
+
'data-emoji-id': reaction.emojiId,
|
|
145
|
+
'data-emoji-button-id': reaction.emojiId
|
|
146
|
+
},
|
|
147
|
+
showOpaqueBackground: showOpaqueBackground,
|
|
148
|
+
showSubtleStyle: showSubtleStyle,
|
|
149
|
+
reacted: reacted
|
|
150
|
+
}, emojiAndCount)));
|
|
151
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
|
|
2
|
+
._2rko14q2{border-radius:var(--ds-border-radius-circle,2002pc)}
|
|
3
|
+
._2rko19bv{border-radius:10px}
|
|
4
|
+
._2rkoglpi{border-radius:var(--ds-border-radius,4px)}
|
|
5
|
+
._2rkogqwt{border-radius:var(--ds-border-radius-050,2px)}
|
|
6
|
+
._189ee4h9{border-width:var(--ds-border-width,1px)}
|
|
7
|
+
._1dqonqa1{border-style:solid}
|
|
8
|
+
._1h6d1yqz{border-color:var(--ds-border-selected,#0c66e4)}
|
|
9
|
+
._1h6dmuej{border-color:var(--ds-border,#091e4224)}
|
|
10
|
+
._1kl7glyw{border-left:none}
|
|
11
|
+
._1s7zglyw{border-right:none}
|
|
12
|
+
._n7zlglyw{border-bottom:none}
|
|
13
|
+
._x3doglyw{border-top:none}._12l21b66{margin-inline-end:var(--ds-space-050,4px)}
|
|
14
|
+
._18m915vq{overflow-y:hidden}
|
|
15
|
+
._19bvze3t{padding-left:var(--ds-space-0,0)}
|
|
16
|
+
._1e0c1txw{display:flex}
|
|
17
|
+
._1pfh1b66{margin-block-start:var(--ds-space-050,4px)}
|
|
18
|
+
._1reo15vq{overflow-x:hidden}
|
|
19
|
+
._1ul914no{min-width:36px}
|
|
20
|
+
._2lx2vrvc{flex-direction:row}
|
|
21
|
+
._4cvr1h6o{align-items:center}
|
|
22
|
+
._4cvr1y6m{align-items:flex-start}
|
|
23
|
+
._4t3i1tcg{height:24px}
|
|
24
|
+
._4t3iqslr{height:22px}
|
|
25
|
+
._bfhkfg4m{background-color:var(--ds-background-selected,#e9f2ff)}
|
|
26
|
+
._bfhksm61{background-color:var(--ds-background-neutral-subtle,#00000000)}
|
|
27
|
+
._bfhkvuon{background-color:var(--ds-surface,#fff)}
|
|
28
|
+
._ca0qze3t{padding-top:var(--ds-space-0,0)}
|
|
29
|
+
._n3tdze3t{padding-bottom:var(--ds-space-0,0)}
|
|
30
|
+
._syaz1gjq{color:var(--ds-text-subtle,#44546f)}
|
|
31
|
+
._u5f3ze3t{padding-right:var(--ds-space-0,0)}
|
|
32
|
+
._irr3108i:hover{background-color:var(--ds-surface-hovered,#f1f2f4)}
|
|
33
|
+
._irr3166n:hover{background-color:var(--ds-background-neutral-subtle-hovered,#091e420f)}
|
|
34
|
+
._irr3i1yw:hover{background-color:var(--ds-background-selected-hovered,#cce0ff)}
|
|
35
|
+
._1di619ru:active{background-color:var(--ds-background-selected-pressed,#85b8ff)}
|
|
36
|
+
._1di61dty:active{background-color:var(--ds-background-neutral-subtle-pressed,#091e4224)}
|
|
37
|
+
._1di61ji5:active{background-color:var(--ds-surface-pressed,#dcdfe4)}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/* ReactionButton.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import "./ReactionButton.compiled.css";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
6
|
+
import { cx } from '@compiled/react';
|
|
7
|
+
import { FlashAnimation } from './FlashAnimation';
|
|
8
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
|
+
import { Pressable } from '@atlaskit/primitives/compiled';
|
|
10
|
+
const styles = {
|
|
11
|
+
reactionButton: "_2rko14q2 _1reo15vq _18m915vq _189ee4h9 _1dqonqa1 _1h6dmuej _1e0c1txw _2lx2vrvc _4cvr1y6m _1ul914no _4t3i1tcg _bfhksm61 _syaz1gjq _1pfh1b66 _12l21b66 _ca0qze3t _u5f3ze3t _n3tdze3t _19bvze3t _irr3166n _1di61dty",
|
|
12
|
+
reactionStylesRefresh: "_2rkoglpi",
|
|
13
|
+
borderless: "_x3doglyw _1kl7glyw _1s7zglyw _n7zlglyw",
|
|
14
|
+
reacted: "_1h6d1yqz _bfhkfg4m _irr3i1yw _1di619ru",
|
|
15
|
+
opaqueBackground: "_bfhkvuon _irr3108i _1di61ji5"
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Default styling px height for an emoji reaction
|
|
20
|
+
*/
|
|
21
|
+
const akHeight = 24;
|
|
22
|
+
const flashHeight = akHeight - 2; // height without the 1px border
|
|
23
|
+
|
|
24
|
+
const flashStyle = null;
|
|
25
|
+
const flashStyleOld = null;
|
|
26
|
+
export const ReactionButton = ({
|
|
27
|
+
onClick,
|
|
28
|
+
flash = false,
|
|
29
|
+
showSubtleStyle,
|
|
30
|
+
showOpaqueBackground,
|
|
31
|
+
reacted,
|
|
32
|
+
ariaLabel,
|
|
33
|
+
ariaPressed,
|
|
34
|
+
onMouseEnter,
|
|
35
|
+
onFocus,
|
|
36
|
+
children,
|
|
37
|
+
dataAttributes = {},
|
|
38
|
+
testId
|
|
39
|
+
}) => {
|
|
40
|
+
return /*#__PURE__*/React.createElement(Pressable, _extends({
|
|
41
|
+
onClick: onClick,
|
|
42
|
+
onMouseEnter: onMouseEnter,
|
|
43
|
+
onFocus: onFocus,
|
|
44
|
+
"aria-label": ariaLabel,
|
|
45
|
+
"aria-pressed": ariaPressed,
|
|
46
|
+
testId: testId,
|
|
47
|
+
xcss: cx(styles.reactionButton, reacted && styles.reacted, !reacted && showSubtleStyle && styles.borderless, !reacted && showOpaqueBackground && styles.opaqueBackground,
|
|
48
|
+
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
49
|
+
fg('platform-component-visual-refresh') && styles.reactionStylesRefresh)
|
|
50
|
+
}, dataAttributes), /*#__PURE__*/React.createElement(FlashAnimation, {
|
|
51
|
+
flash: flash
|
|
52
|
+
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
53
|
+
,
|
|
54
|
+
className: ax([fg('platform-component-visual-refresh') ? "_2rkogqwt _1e0c1txw _2lx2vrvc _4cvr1h6o _4t3iqslr" : "_2rko19bv _1e0c1txw _2lx2vrvc _4cvr1h6o _4t3iqslr"])
|
|
55
|
+
}, children));
|
|
56
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
._y44vik89{animation:k102rpwx ease-in-out,k4txmy4 ease}._154iidpf{top:0}
|
|
3
|
+
._1lac188d:nth-child(3){animation-delay:.3s}
|
|
4
|
+
._1ltvftgi{left:8px}
|
|
5
|
+
._1ltvidpf{left:0}
|
|
6
|
+
._1pbyifev{z-index:10000}
|
|
7
|
+
._1qen1lpd:nth-child(2){left:-5px}
|
|
8
|
+
._5sagpwmj{animation-duration:.7s}
|
|
9
|
+
._7vm81dfm:nth-child(4){animation-delay:.45s}
|
|
10
|
+
._91vyftgi:nth-child(3){left:8px}
|
|
11
|
+
._jsy51n1a:nth-child(4){left:-1px}
|
|
12
|
+
._kqswh2mm{position:relative}
|
|
13
|
+
._kqswstnw{position:absolute}
|
|
14
|
+
._lcxvglyw{pointer-events:none}
|
|
15
|
+
._tzy4idpf{opacity:0}
|
|
16
|
+
._xg4k6ebc:nth-child(2){animation-delay:.15s}
|
|
17
|
+
@keyframes k102rpwx{0%{opacity:0}20%{opacity:1}60%{opacity:1}to{opacity:0}}
|
|
18
|
+
@keyframes k4txmy4{0%{transform:translateY(0) scale(1)}to{transform:translateY(-90pt) scale(1.7)}}
|
|
19
|
+
@media (prefers-reduced-motion:reduce){._m602idpf{opacity:0}}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/* ReactionParticleEffect.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
2
|
+
import "./ReactionParticleEffect.compiled.css";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
+
import { ResourcedEmoji } from '@atlaskit/emoji';
|
|
6
|
+
import { layers } from '@atlaskit/theme/constants';
|
|
7
|
+
const fade = null;
|
|
8
|
+
const float = null;
|
|
9
|
+
const containerStyle = null;
|
|
10
|
+
const reactionParticleStyle = null;
|
|
11
|
+
export const PARTICLE_COUNT = 4;
|
|
12
|
+
export const ReactionParticleEffect = ({
|
|
13
|
+
emojiProvider,
|
|
14
|
+
emojiId
|
|
15
|
+
}) => /*#__PURE__*/React.createElement("div", {
|
|
16
|
+
className: ax(["_kqswh2mm _1ltvftgi _1pbyifev _m602idpf"])
|
|
17
|
+
}, [...Array(PARTICLE_COUNT)].map((_, index) => {
|
|
18
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
19
|
+
key: index,
|
|
20
|
+
className: ax(["_y44vik89 _kqswstnw _154iidpf _1ltvidpf _lcxvglyw _tzy4idpf _5sagpwmj _1qen1lpd _xg4k6ebc _91vyftgi _1lac188d _jsy51n1a _7vm81dfm"])
|
|
21
|
+
}, /*#__PURE__*/React.createElement(ResourcedEmoji, {
|
|
22
|
+
emojiProvider: emojiProvider,
|
|
23
|
+
emojiId: emojiId,
|
|
24
|
+
fitToHeight: 16
|
|
25
|
+
}));
|
|
26
|
+
}));
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
|
|
2
|
+
._d1n8glyw ul{list-style:none}._102oidpf ul{margin-top:0}
|
|
3
|
+
._17d4idpf ul{margin-left:0}
|
|
4
|
+
._18m915vq{overflow-y:hidden}
|
|
5
|
+
._1bto1l2s{text-overflow:ellipsis}
|
|
6
|
+
._1eg614y2 li{margin-top:5px}
|
|
7
|
+
._1hms8stv{text-decoration-line:underline}
|
|
8
|
+
._1hziidpf ul{padding-top:0}
|
|
9
|
+
._1kvxidpf ul{margin-right:0}
|
|
10
|
+
._1p1d1dk0{text-transform:capitalize}
|
|
11
|
+
._1pru15vq li{overflow-x:hidden}
|
|
12
|
+
._1reo15vq{overflow-x:hidden}
|
|
13
|
+
._1ysjidpf ul{margin-bottom:0}
|
|
14
|
+
._1ywo1e5h ul{text-align:left}
|
|
15
|
+
._3n4midpf ul{padding-right:0}
|
|
16
|
+
._4bfu1r31{text-decoration-color:currentColor}
|
|
17
|
+
._5qec1l2s li{text-overflow:ellipsis}
|
|
18
|
+
._80omtlke{cursor:pointer}
|
|
19
|
+
._ajmmnqa1{text-decoration-style:solid}
|
|
20
|
+
._k48p1pd9{font-weight:var(--ds-font-weight-semibold,600)}
|
|
21
|
+
._k7zyidpf ul{padding-left:0}
|
|
22
|
+
._ltofidpf ul{padding-bottom:0}
|
|
23
|
+
._o5721q9c{white-space:nowrap}
|
|
24
|
+
._otyr14y2{margin-bottom:5px}
|
|
25
|
+
._p12f1w81{max-width:150px}
|
|
26
|
+
._syaz6r0x{color:var(--ds-text-inverse,#8993a4)}
|
|
27
|
+
._u0h115vq li{overflow-y:hidden}
|
|
28
|
+
._30l315cr:hover{color:var(--ds-text-inverse,#fff)}
|
|
29
|
+
._irr3gkf6:hover{background-color:var(--ds-background-neutral-bold,#172b4d)}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/* ReactionTooltip.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import "./ReactionTooltip.compiled.css";
|
|
4
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import Tooltip from '@atlaskit/tooltip';
|
|
7
|
+
import { FormattedMessage } from 'react-intl-next';
|
|
8
|
+
import { TOOLTIP_USERS_LIMIT } from '../../shared/constants';
|
|
9
|
+
import { messages } from '../../shared/i18n';
|
|
10
|
+
import { N90, N800, N0 } from '@atlaskit/theme/colors';
|
|
11
|
+
export const verticalMargin = 5;
|
|
12
|
+
const tooltipStyle = null;
|
|
13
|
+
const emojiNameStyle = null;
|
|
14
|
+
const footerStyle = null;
|
|
15
|
+
const underlineStyle = null;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Test id for wrapper ReactionTooltip div
|
|
19
|
+
*/
|
|
20
|
+
export const RENDER_REACTIONTOOLTIP_TESTID = 'render-reactionTooltip';
|
|
21
|
+
export const ReactionTooltip = ({
|
|
22
|
+
children,
|
|
23
|
+
emojiName,
|
|
24
|
+
reaction: {
|
|
25
|
+
users = []
|
|
26
|
+
},
|
|
27
|
+
maxReactions = TOOLTIP_USERS_LIMIT,
|
|
28
|
+
isEnabled = true,
|
|
29
|
+
allowUserDialog,
|
|
30
|
+
handleOpenReactionsDialog,
|
|
31
|
+
dismissTooltip
|
|
32
|
+
}) => {
|
|
33
|
+
const handleClick = () => {
|
|
34
|
+
if (allowUserDialog && handleOpenReactionsDialog) {
|
|
35
|
+
dismissTooltip();
|
|
36
|
+
handleOpenReactionsDialog();
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const content = !users || users.length === 0 || !isEnabled ? null : /*#__PURE__*/React.createElement("div", {
|
|
40
|
+
tabIndex: 0,
|
|
41
|
+
className: ax(["_1reo15vq _18m915vq _p12f1w81 _1bto1l2s _o5721q9c _otyr14y2 _d1n8glyw _102oidpf _1kvxidpf _1ysjidpf _17d4idpf _1hziidpf _3n4midpf _ltofidpf _k7zyidpf _1ywo1e5h _1pru15vq _u0h115vq _5qec1l2s _1eg614y2"])
|
|
42
|
+
}, /*#__PURE__*/React.createElement("ul", null, emojiName ? /*#__PURE__*/React.createElement("li", {
|
|
43
|
+
className: ax(["_1p1d1dk0 _syaz6r0x _k48p1pd9"])
|
|
44
|
+
}, emojiName) : null, users.slice(0, maxReactions).map(user => {
|
|
45
|
+
return /*#__PURE__*/React.createElement("li", {
|
|
46
|
+
key: user.id
|
|
47
|
+
}, user.displayName);
|
|
48
|
+
}), /*#__PURE__*/React.createElement("li", {
|
|
49
|
+
onMouseDown: handleClick,
|
|
50
|
+
onClick: handleClick,
|
|
51
|
+
className: ax(["_syaz6r0x", allowUserDialog && "_4bfu1r31 _1hms8stv _ajmmnqa1 _80omtlke _irr3gkf6 _30l315cr"])
|
|
52
|
+
}, users.length > maxReactions && /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.otherUsers, {
|
|
53
|
+
values: {
|
|
54
|
+
count: users.length - maxReactions
|
|
55
|
+
}
|
|
56
|
+
})))));
|
|
57
|
+
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
58
|
+
content: content,
|
|
59
|
+
position: "bottom",
|
|
60
|
+
testId: RENDER_REACTIONTOOLTIP_TESTID
|
|
61
|
+
}, React.Children.only(children));
|
|
62
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
._2rkoo7ao{border-radius:15px}._13vtidpf >:first-of-type>:first-of-type{margin-left:0}
|
|
3
|
+
._19pk1b66{margin-top:var(--ds-space-050,4px)}
|
|
4
|
+
._19pkr5cr{margin-top:var(--ds-space-negative-050,-4px)}
|
|
5
|
+
._1e0c1o8l{display:inline-block}
|
|
6
|
+
._1e0c1txw{display:flex}
|
|
7
|
+
._1n261g80{flex-wrap:wrap}
|
|
8
|
+
._1n261q9c{flex-wrap:nowrap}
|
|
9
|
+
._4cvr1h6o{align-items:center}
|
|
10
|
+
._kqswh2mm{position:relative}
|
|
11
|
+
._kqswpfqs{position:static}
|