@atlaskit/emoji 70.17.10 → 71.0.1
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 +34 -0
- package/afm-cc/tsconfig.json +3 -0
- package/afm-products/tsconfig.json +3 -0
- package/dist/cjs/components/common/Emoji.js +2 -1
- package/dist/cjs/components/common/EmojiActions.compiled.css +8 -0
- package/dist/cjs/components/common/EmojiActions.js +69 -3
- package/dist/cjs/components/common/Popup.js +20 -5
- package/dist/cjs/components/common/ProductivityColorSelector.compiled.css +59 -0
- package/dist/cjs/components/common/ProductivityColorSelector.js +112 -0
- package/dist/cjs/components/common/TonePreviewButton.js +4 -2
- package/dist/cjs/components/i18n.js +10 -0
- package/dist/cjs/components/picker/EmojiPickerComponent.js +51 -36
- package/dist/cjs/components/picker/EmojiPickerList.js +36 -14
- package/dist/cjs/components/picker/VirtualList.js +4 -5
- package/dist/cjs/util/analytics/analytics.js +1 -1
- package/dist/cjs/util/hidden-emojis.js +33 -0
- package/dist/cjs/util/productivity-colors.js +51 -0
- package/dist/es2019/components/common/Emoji.js +2 -1
- package/dist/es2019/components/common/EmojiActions.compiled.css +8 -0
- package/dist/es2019/components/common/EmojiActions.js +67 -3
- package/dist/es2019/components/common/Popup.js +19 -5
- package/dist/es2019/components/common/ProductivityColorSelector.compiled.css +59 -0
- package/dist/es2019/components/common/ProductivityColorSelector.js +98 -0
- package/dist/es2019/components/common/TonePreviewButton.js +3 -2
- package/dist/es2019/components/i18n.js +10 -0
- package/dist/es2019/components/picker/EmojiPickerComponent.js +26 -14
- package/dist/es2019/components/picker/EmojiPickerList.js +32 -14
- package/dist/es2019/components/picker/VirtualList.js +4 -5
- package/dist/es2019/util/analytics/analytics.js +1 -1
- package/dist/es2019/util/hidden-emojis.js +25 -0
- package/dist/es2019/util/productivity-colors.js +37 -0
- package/dist/esm/components/common/Emoji.js +2 -1
- package/dist/esm/components/common/EmojiActions.compiled.css +8 -0
- package/dist/esm/components/common/EmojiActions.js +70 -4
- package/dist/esm/components/common/Popup.js +20 -5
- package/dist/esm/components/common/ProductivityColorSelector.compiled.css +59 -0
- package/dist/esm/components/common/ProductivityColorSelector.js +103 -0
- package/dist/esm/components/common/TonePreviewButton.js +4 -2
- package/dist/esm/components/i18n.js +10 -0
- package/dist/esm/components/picker/EmojiPickerComponent.js +51 -36
- package/dist/esm/components/picker/EmojiPickerList.js +36 -14
- package/dist/esm/components/picker/VirtualList.js +4 -5
- package/dist/esm/util/analytics/analytics.js +1 -1
- package/dist/esm/util/hidden-emojis.js +27 -0
- package/dist/esm/util/productivity-colors.js +45 -0
- package/dist/types/components/common/EmojiActions.d.ts +6 -0
- package/dist/types/components/common/Popup.d.ts +1 -0
- package/dist/types/components/common/ProductivityColorSelector.d.ts +17 -0
- package/dist/types/components/common/TonePreviewButton.d.ts +1 -0
- package/dist/types/components/i18n.d.ts +10 -0
- package/dist/types/components/picker/EmojiPickerList.d.ts +3 -0
- package/dist/types/types.d.ts +7 -0
- package/dist/types/util/hidden-emojis.d.ts +3 -0
- package/dist/types/util/productivity-colors.d.ts +8 -0
- package/package.json +27 -34
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/* ProductivityColorSelector.tsx generated by @compiled/babel-plugin v0.39.1 */
|
|
2
|
+
import "./ProductivityColorSelector.compiled.css";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
+
import { memo, useContext, useRef } from 'react';
|
|
6
|
+
import { IntlContext } from 'react-intl';
|
|
7
|
+
import { Radio } from '@atlaskit/radio';
|
|
8
|
+
import { productivityColors } from '../../util/productivity-colors';
|
|
9
|
+
import { messages } from '../i18n';
|
|
10
|
+
import Emoji from './Emoji';
|
|
11
|
+
export var productivityColorSelectorTestId = 'productivity-color-selector';
|
|
12
|
+
export var productivityColorSelectorId = 'emoji-picker-productivity-color-selector';
|
|
13
|
+
var selectorGrid = null;
|
|
14
|
+
var visuallyHiddenLegend = null;
|
|
15
|
+
var colorOption = null;
|
|
16
|
+
var colorOptionEmoji = null;
|
|
17
|
+
var getColorLabel = function getColorLabel(color) {
|
|
18
|
+
return "".concat(color.charAt(0).toUpperCase()).concat(color.slice(1), " productivity emoji colour");
|
|
19
|
+
};
|
|
20
|
+
export var ProductivityColorSelector = function ProductivityColorSelector(_ref) {
|
|
21
|
+
var colorPreviewEmojis = _ref.colorPreviewEmojis,
|
|
22
|
+
onColorSelected = _ref.onColorSelected,
|
|
23
|
+
selectedColor = _ref.selectedColor;
|
|
24
|
+
var intl = useContext(IntlContext);
|
|
25
|
+
var radioRefs = useRef([]);
|
|
26
|
+
var hasFocusedSelectedColor = useRef(false);
|
|
27
|
+
var availableColors = productivityColors.filter(function (color) {
|
|
28
|
+
return colorPreviewEmojis[color];
|
|
29
|
+
});
|
|
30
|
+
var colorSelectorAriaLabel = intl ? intl.formatMessage(messages.emojiSelectColorListAriaLabelText) : messages.emojiSelectColorListAriaLabelText.defaultMessage;
|
|
31
|
+
if (!availableColors.length) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
var onArrowKey = function onArrowKey(currentIndex, direction) {
|
|
35
|
+
var _radioRefs$current$ne;
|
|
36
|
+
var nextIndex = (currentIndex + direction + availableColors.length) % availableColors.length;
|
|
37
|
+
(_radioRefs$current$ne = radioRefs.current[nextIndex]) === null || _radioRefs$current$ne === void 0 || _radioRefs$current$ne.focus();
|
|
38
|
+
};
|
|
39
|
+
var stopPickerDismissal = function stopPickerDismissal(event) {
|
|
40
|
+
event.stopPropagation();
|
|
41
|
+
};
|
|
42
|
+
return /*#__PURE__*/React.createElement("fieldset", {
|
|
43
|
+
id: productivityColorSelectorId,
|
|
44
|
+
"data-testid": productivityColorSelectorTestId,
|
|
45
|
+
className: ax(["_19itidpf _zulp1b66 _ca0qidpf _u5f3idpf _n3tdidpf _19bvidpf _1e0c11p5 _yv0e1bbt _2z051y6t _19pkze3t _2hwxze3t _otyrze3t _18u0ze3t _1ul9idpf"])
|
|
46
|
+
}, /*#__PURE__*/React.createElement("legend", {
|
|
47
|
+
className: ax(["_19itidpf _1reo15vq _18m915vq _ca0qidpf _u5f3idpf _n3tdidpf _19bvidpf _ogtohxbz _4t3it94y _kqswstnw _o5721q9c _1bsbt94y"])
|
|
48
|
+
}, colorSelectorAriaLabel), availableColors.map(function (color, index) {
|
|
49
|
+
var emoji = colorPreviewEmojis[color];
|
|
50
|
+
if (!emoji) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
var handleKeyDown = function handleKeyDown(event) {
|
|
54
|
+
if (event.key === 'ArrowLeft' || event.key === 'ArrowUp') {
|
|
55
|
+
event.preventDefault();
|
|
56
|
+
onArrowKey(index, -1);
|
|
57
|
+
}
|
|
58
|
+
if (event.key === 'ArrowRight' || event.key === 'ArrowDown') {
|
|
59
|
+
event.preventDefault();
|
|
60
|
+
onArrowKey(index, 1);
|
|
61
|
+
}
|
|
62
|
+
if (event.key === 'Enter') {
|
|
63
|
+
event.preventDefault();
|
|
64
|
+
onColorSelected(color);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
68
|
+
key: color,
|
|
69
|
+
className: ax(["_4t3izwfg _kqswh2mm _1bsbzwfg _1355fajl _soq51h6o _ngzz1txw _1030zwfg _6vsr1h6o _ecyuidpf _8qdiidpf _7kzvidpf _ev8ridpf _6rawzwfg _tnsm1r31 _hxs6glyw _13yj1o36 _1pi91y54 _1rgq13zc _1eq11h6o _1vzltlke _17muzwfg _1wqq1h6o _1p1fzwfg _12ultlke _pytkzwfg _2x4gze3t _12hvze3t _x5bdze3t _1rgfze3t _1e7sidpf _khufstnw _5hv9zwfg _1nn0kb7n _smb7plhp _szw2w5lj"])
|
|
70
|
+
}, /*#__PURE__*/React.createElement(Radio, {
|
|
71
|
+
ref: function ref(el) {
|
|
72
|
+
radioRefs.current[index] = el;
|
|
73
|
+
if (selectedColor === color) {
|
|
74
|
+
if (el && !hasFocusedSelectedColor.current) {
|
|
75
|
+
el.focus();
|
|
76
|
+
hasFocusedSelectedColor.current = true;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
ariaLabel: getColorLabel(color),
|
|
81
|
+
name: "productivity-emoji-colour",
|
|
82
|
+
isChecked: selectedColor === color,
|
|
83
|
+
onChange: function onChange() {
|
|
84
|
+
return onColorSelected(color);
|
|
85
|
+
},
|
|
86
|
+
onClick: stopPickerDismissal,
|
|
87
|
+
onKeyDown: handleKeyDown,
|
|
88
|
+
onMouseDown: stopPickerDismissal,
|
|
89
|
+
testId: "productivity-color-".concat(color),
|
|
90
|
+
value: color,
|
|
91
|
+
label: /*#__PURE__*/React.createElement("span", {
|
|
92
|
+
className: ax(["_4cvr1h6o _1e0c1txw _4t3izwfg _1bah1h6o _1bsbzwfg"])
|
|
93
|
+
}, /*#__PURE__*/React.createElement(Emoji, {
|
|
94
|
+
emoji: emoji,
|
|
95
|
+
shouldBeInteractive: false,
|
|
96
|
+
"aria-hidden": true,
|
|
97
|
+
fitToHeight: 24
|
|
98
|
+
}))
|
|
99
|
+
}));
|
|
100
|
+
}));
|
|
101
|
+
};
|
|
102
|
+
var _default_1 = /*#__PURE__*/memo(ProductivityColorSelector);
|
|
103
|
+
export default _default_1;
|
|
@@ -13,6 +13,8 @@ var emojiButtonOutline = null;
|
|
|
13
13
|
export var TonePreviewButton = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
14
14
|
var emoji = props.emoji,
|
|
15
15
|
selectOnHover = props.selectOnHover,
|
|
16
|
+
_props$ariaControls = props.ariaControls,
|
|
17
|
+
ariaControls = _props$ariaControls === void 0 ? 'emoji-picker-tone-selector' : _props$ariaControls,
|
|
16
18
|
ariaLabelText = props.ariaLabelText,
|
|
17
19
|
ariaExpanded = props.ariaExpanded,
|
|
18
20
|
onSelected = props.onSelected,
|
|
@@ -24,7 +26,7 @@ export var TonePreviewButton = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
24
26
|
onClick: onSelected,
|
|
25
27
|
"aria-label": ariaLabelText,
|
|
26
28
|
"aria-expanded": ariaExpanded,
|
|
27
|
-
"aria-controls":
|
|
29
|
+
"aria-controls": ariaControls
|
|
28
30
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
29
31
|
,
|
|
30
32
|
style: {
|
|
@@ -44,7 +46,7 @@ export var TonePreviewButton = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
44
46
|
onClick: onSelected,
|
|
45
47
|
"aria-label": ariaLabelText,
|
|
46
48
|
"aria-expanded": ariaExpanded,
|
|
47
|
-
"aria-controls":
|
|
49
|
+
"aria-controls": ariaControls
|
|
48
50
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
49
51
|
,
|
|
50
52
|
style: {
|
|
@@ -65,6 +65,16 @@ export var messages = defineMessages({
|
|
|
65
65
|
defaultMessage: 'Choose your skin tone, {selectedTone} selected',
|
|
66
66
|
description: 'Message indicating the purpose of the skin tone selection button and the selected tone'
|
|
67
67
|
},
|
|
68
|
+
emojiSelectColorButtonAriaLabelText: {
|
|
69
|
+
id: 'fabric.emoji.select.color.ariaLabel',
|
|
70
|
+
defaultMessage: 'Productivity emoji color selector',
|
|
71
|
+
description: 'Message indicating the purpose of the color selection button and the selected color'
|
|
72
|
+
},
|
|
73
|
+
emojiSelectColorListAriaLabelText: {
|
|
74
|
+
id: 'fabric.emoji.select.color.list.ariaLabel',
|
|
75
|
+
defaultMessage: 'Productivity emoji colour selector',
|
|
76
|
+
description: 'Message indicating the purpose of the productivity emoji color list selector'
|
|
77
|
+
},
|
|
68
78
|
emojiSelectSkinToneListAriaLabelText: {
|
|
69
79
|
id: 'fabric.emoji.select.skin.list.ariaLabel',
|
|
70
80
|
defaultMessage: 'Skin tone selector',
|
|
@@ -33,6 +33,8 @@ import { createAndFireEventInElementsChannel, categoryClickedEvent, closedPicker
|
|
|
33
33
|
import { useEmoji } from '../../hooks/useEmoji';
|
|
34
34
|
import { useIsMounted } from '../../hooks/useIsMounted';
|
|
35
35
|
import { messages } from '../i18n';
|
|
36
|
+
import { defaultProductivityColor } from '../../util/productivity-colors';
|
|
37
|
+
import { filterHiddenEmojis } from '../../util/hidden-emojis';
|
|
36
38
|
var emojiPickerBoxShadow = "var(--ds-shadow-overlay, 0px 8px 12px #1E1F2126, 0px 0px 1px #1E1F214f)";
|
|
37
39
|
var emojiPickerHeight = 295;
|
|
38
40
|
var emojiPickerHeightWithPreview = 349; // emojiPickerHeight + emojiPickerPreviewHeight;
|
|
@@ -83,6 +85,7 @@ var EmojiPickerComponent = function EmojiPickerComponent(_ref) {
|
|
|
83
85
|
var _useEmoji = useEmoji(),
|
|
84
86
|
emojiProvider = _useEmoji.emojiProvider,
|
|
85
87
|
isUploadSupported = _useEmoji.isUploadSupported;
|
|
88
|
+
var isTeamojiExperimentEnabled = FeatureGates.getExperimentValue('platform_teamoji_26_refresh_emoji_picker', 'isEnabled', false);
|
|
86
89
|
var _useState = useState([]),
|
|
87
90
|
_useState2 = _slicedToArray(_useState, 2),
|
|
88
91
|
filteredEmojis = _useState2[0],
|
|
@@ -107,38 +110,42 @@ var EmojiPickerComponent = function EmojiPickerComponent(_ref) {
|
|
|
107
110
|
_useState10 = _slicedToArray(_useState1, 2),
|
|
108
111
|
selectedTone = _useState10[0],
|
|
109
112
|
setSelectedTone = _useState10[1];
|
|
110
|
-
var _useState11 = useState(
|
|
113
|
+
var _useState11 = useState(defaultProductivityColor),
|
|
111
114
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
var _useState13 = useState(
|
|
115
|
+
selectedProductivityColor = _useState12[0],
|
|
116
|
+
setSelectedProductivityColor = _useState12[1];
|
|
117
|
+
var _useState13 = useState(true),
|
|
115
118
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
var _useState15 = useState(),
|
|
119
|
+
loading = _useState14[0],
|
|
120
|
+
setLoading = _useState14[1];
|
|
121
|
+
var _useState15 = useState(false),
|
|
119
122
|
_useState16 = _slicedToArray(_useState15, 2),
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
var _useState17 = useState(
|
|
123
|
+
uploading = _useState16[0],
|
|
124
|
+
setUploading = _useState16[1];
|
|
125
|
+
var _useState17 = useState(),
|
|
123
126
|
_useState18 = _slicedToArray(_useState17, 2),
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
var _useState19 = useState(
|
|
127
|
+
selectedEmoji = _useState18[0],
|
|
128
|
+
setSelectedEmoji = _useState18[1];
|
|
129
|
+
var _useState19 = useState(null),
|
|
127
130
|
_useState20 = _slicedToArray(_useState19, 2),
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
var _useState21 = useState(),
|
|
131
|
+
activeCategory = _useState20[0],
|
|
132
|
+
setActiveCategory = _useState20[1];
|
|
133
|
+
var _useState21 = useState(false),
|
|
131
134
|
_useState22 = _slicedToArray(_useState21, 2),
|
|
132
|
-
|
|
133
|
-
|
|
135
|
+
disableCategories = _useState22[0],
|
|
136
|
+
setDisableCategories = _useState22[1];
|
|
134
137
|
var _useState23 = useState(),
|
|
135
138
|
_useState24 = _slicedToArray(_useState23, 2),
|
|
136
|
-
|
|
137
|
-
|
|
139
|
+
uploadErrorMessage = _useState24[0],
|
|
140
|
+
setUploadErrorMessage = _useState24[1];
|
|
138
141
|
var _useState25 = useState(),
|
|
139
142
|
_useState26 = _slicedToArray(_useState25, 2),
|
|
140
|
-
|
|
141
|
-
|
|
143
|
+
emojiToDelete = _useState26[0],
|
|
144
|
+
setEmojiToDelete = _useState26[1];
|
|
145
|
+
var _useState27 = useState(),
|
|
146
|
+
_useState28 = _slicedToArray(_useState27, 2),
|
|
147
|
+
toneEmoji = _useState28[0],
|
|
148
|
+
setToneEmoji = _useState28[1];
|
|
142
149
|
var emojiPickerList = useMemo(function () {
|
|
143
150
|
return /*#__PURE__*/createRef();
|
|
144
151
|
}, []);
|
|
@@ -149,11 +156,11 @@ var EmojiPickerComponent = function EmojiPickerComponent(_ref) {
|
|
|
149
156
|
var isProgrammaticScroll = useRef(false);
|
|
150
157
|
var pickerRef = useRef(null);
|
|
151
158
|
var setPickerRef = useCallback(function (el) {
|
|
152
|
-
if (
|
|
159
|
+
if (isTeamojiExperimentEnabled) {
|
|
153
160
|
pickerRef.current = el;
|
|
154
161
|
}
|
|
155
162
|
onPickerRef === null || onPickerRef === void 0 || onPickerRef(el);
|
|
156
|
-
}, [onPickerRef]);
|
|
163
|
+
}, [isTeamojiExperimentEnabled, onPickerRef]);
|
|
157
164
|
var currentUser = useMemo(function () {
|
|
158
165
|
return emojiProvider.getCurrentUser();
|
|
159
166
|
}, [emojiProvider]);
|
|
@@ -254,7 +261,8 @@ var EmojiPickerComponent = function EmojiPickerComponent(_ref) {
|
|
|
254
261
|
}, [filteredEmojis.length, getDynamicCategories, onDynamicCategoryChange, selectedEmoji]);
|
|
255
262
|
var onFrequentEmojiResult = useCallback(function (frequentEmoji) {
|
|
256
263
|
// change the category of each of the featured emoji
|
|
257
|
-
var
|
|
264
|
+
var visibleFrequentEmoji = isTeamojiExperimentEnabled ? filterHiddenEmojis(frequentEmoji) : frequentEmoji;
|
|
265
|
+
var recategorised = visibleFrequentEmoji.map(function (emoji) {
|
|
258
266
|
var clone = JSON.parse(JSON.stringify(emoji));
|
|
259
267
|
clone.category = frequentCategory;
|
|
260
268
|
return clone;
|
|
@@ -262,10 +270,11 @@ var EmojiPickerComponent = function EmojiPickerComponent(_ref) {
|
|
|
262
270
|
setStateAfterEmojiChange({
|
|
263
271
|
frequentEmoji: recategorised
|
|
264
272
|
});
|
|
265
|
-
}, [setStateAfterEmojiChange]);
|
|
273
|
+
}, [isTeamojiExperimentEnabled, setStateAfterEmojiChange]);
|
|
266
274
|
var onSearchResult = useCallback(function (searchResults) {
|
|
267
275
|
var frequentlyUsedEmoji = frequentlyUsedEmojis || [];
|
|
268
276
|
var searchQuery = searchResults.query || '';
|
|
277
|
+
var visibleSearchEmojis = isTeamojiExperimentEnabled ? filterHiddenEmojis(searchResults.emojis) : searchResults.emojis;
|
|
269
278
|
|
|
270
279
|
/**
|
|
271
280
|
* If there is no user search in the EmojiPicker then it should display all emoji received from the EmojiRepository and should
|
|
@@ -274,20 +283,20 @@ var EmojiPickerComponent = function EmojiPickerComponent(_ref) {
|
|
|
274
283
|
*/
|
|
275
284
|
var emojiToRender;
|
|
276
285
|
if (!frequentlyUsedEmoji.length || query) {
|
|
277
|
-
emojiToRender =
|
|
286
|
+
emojiToRender = visibleSearchEmojis;
|
|
278
287
|
} else {
|
|
279
|
-
emojiToRender = [].concat(_toConsumableArray(
|
|
288
|
+
emojiToRender = [].concat(_toConsumableArray(visibleSearchEmojis), _toConsumableArray(frequentlyUsedEmoji));
|
|
280
289
|
}
|
|
281
290
|
setStateAfterEmojiChange({
|
|
282
291
|
searchQuery: searchQuery,
|
|
283
292
|
emojiToRender: emojiToRender,
|
|
284
|
-
searchEmoji:
|
|
293
|
+
searchEmoji: visibleSearchEmojis
|
|
285
294
|
});
|
|
286
295
|
fireAnalytics(pickerSearchedEvent({
|
|
287
296
|
queryLength: searchQuery.length,
|
|
288
|
-
numMatches:
|
|
297
|
+
numMatches: visibleSearchEmojis.length
|
|
289
298
|
}));
|
|
290
|
-
}, [frequentlyUsedEmojis, query, setStateAfterEmojiChange, fireAnalytics]);
|
|
299
|
+
}, [frequentlyUsedEmojis, isTeamojiExperimentEnabled, query, setStateAfterEmojiChange, fireAnalytics]);
|
|
291
300
|
var onProviderChange = useMemo(function () {
|
|
292
301
|
return {
|
|
293
302
|
result: onSearchResult
|
|
@@ -329,6 +338,9 @@ var EmojiPickerComponent = function EmojiPickerComponent(_ref) {
|
|
|
329
338
|
var onToneSelectorCancelled = useCallback(function () {
|
|
330
339
|
fireAnalytics(toneSelectorClosedEvent());
|
|
331
340
|
}, [fireAnalytics]);
|
|
341
|
+
var onProductivityColorSelected = useCallback(function (color) {
|
|
342
|
+
setSelectedProductivityColor(color);
|
|
343
|
+
}, []);
|
|
332
344
|
var onSelectWrapper = useCallback(function (emojiId, emoji, event) {
|
|
333
345
|
if (onSelection) {
|
|
334
346
|
onSelection(emojiId, emoji, event);
|
|
@@ -359,17 +371,18 @@ var EmojiPickerComponent = function EmojiPickerComponent(_ref) {
|
|
|
359
371
|
emojiProvider.findInCategory(categoryId).then(function (emojisInCategory) {
|
|
360
372
|
if (!disableCategories) {
|
|
361
373
|
var newSelectedEmoji;
|
|
362
|
-
|
|
363
|
-
|
|
374
|
+
var visibleEmojisInCategory = isTeamojiExperimentEnabled ? filterHiddenEmojis(emojisInCategory || []) : emojisInCategory || [];
|
|
375
|
+
if (visibleEmojisInCategory.length > 0) {
|
|
376
|
+
newSelectedEmoji = getEmojiVariation(visibleEmojisInCategory[0], {
|
|
364
377
|
skinTone: selectedTone
|
|
365
378
|
});
|
|
366
379
|
}
|
|
367
380
|
if (emojiPickerList.current) {
|
|
368
|
-
if (
|
|
381
|
+
if (isTeamojiExperimentEnabled) {
|
|
369
382
|
isProgrammaticScroll.current = true;
|
|
370
383
|
}
|
|
371
384
|
emojiPickerList.current.reveal(categoryId);
|
|
372
|
-
if (
|
|
385
|
+
if (isTeamojiExperimentEnabled) {
|
|
373
386
|
// Clear the flag after the scroll animation has settled.
|
|
374
387
|
setTimeout(function () {
|
|
375
388
|
isProgrammaticScroll.current = false;
|
|
@@ -385,7 +398,7 @@ var EmojiPickerComponent = function EmojiPickerComponent(_ref) {
|
|
|
385
398
|
}));
|
|
386
399
|
}
|
|
387
400
|
});
|
|
388
|
-
}, [disableCategories, emojiPickerList, emojiProvider, fireAnalytics, selectedTone, uploading, emojiToDelete]);
|
|
401
|
+
}, [disableCategories, emojiPickerList, emojiProvider, fireAnalytics, isTeamojiExperimentEnabled, selectedTone, uploading, emojiToDelete]);
|
|
389
402
|
var recordUsageOnSelection = useMemo(function () {
|
|
390
403
|
return createRecordSelectionDefault(emojiProvider, onSelectWrapper, function (analytic) {
|
|
391
404
|
return fireAnalytics(analytic(SearchSourceTypes.PICKER));
|
|
@@ -665,11 +678,13 @@ var EmojiPickerComponent = function EmojiPickerComponent(_ref) {
|
|
|
665
678
|
onSearch: onSearch,
|
|
666
679
|
query: query,
|
|
667
680
|
selectedTone: selectedTone,
|
|
681
|
+
selectedProductivityColor: isTeamojiExperimentEnabled ? selectedProductivityColor : undefined,
|
|
668
682
|
loading: loading,
|
|
669
683
|
ref: emojiPickerList,
|
|
670
684
|
initialUploadName: query,
|
|
671
685
|
onToneSelected: onToneSelected,
|
|
672
686
|
onToneSelectorCancelled: onToneSelectorCancelled,
|
|
687
|
+
onProductivityColorSelected: isTeamojiExperimentEnabled ? onProductivityColorSelected : undefined,
|
|
673
688
|
toneEmoji: toneEmoji,
|
|
674
689
|
uploading: uploading,
|
|
675
690
|
emojiToDelete: emojiToDelete,
|
|
@@ -4,6 +4,8 @@ import { useIntl } from 'react-intl';
|
|
|
4
4
|
import React, { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
5
5
|
import FeatureGates from '@atlaskit/feature-gate-js-client';
|
|
6
6
|
import { customCategory, defaultEmojiPickerSize, frequentCategory, searchCategory, userCustomTitle, yourUploadsCategory } from '../../util/constants';
|
|
7
|
+
import { filterProductivityEmojisByColor, getProductivityColorPreviewEmojis } from '../../util/productivity-colors';
|
|
8
|
+
import { filterHiddenEmojis } from '../../util/hidden-emojis';
|
|
7
9
|
import { CategoryDescriptionMap, CategoryDescriptionMapNew } from './categories';
|
|
8
10
|
import CategoryTracker from './CategoryTracker';
|
|
9
11
|
import { sizes } from './EmojiPickerSizes';
|
|
@@ -71,7 +73,9 @@ export var EmojiPickerVirtualListInternal = /*#__PURE__*/React.forwardRef(functi
|
|
|
71
73
|
onCloseDelete = props.onCloseDelete,
|
|
72
74
|
onFileChooserClicked = props.onFileChooserClicked,
|
|
73
75
|
onOpenUpload = props.onOpenUpload,
|
|
74
|
-
|
|
76
|
+
onProductivityColorSelected = props.onProductivityColorSelected,
|
|
77
|
+
activeCategoryId = props.activeCategoryId,
|
|
78
|
+
selectedProductivityColor = props.selectedProductivityColor;
|
|
75
79
|
var _useIntl = useIntl(),
|
|
76
80
|
formatMessage = _useIntl.formatMessage;
|
|
77
81
|
var listRef = useRef(null);
|
|
@@ -95,6 +99,12 @@ export var EmojiPickerVirtualListInternal = /*#__PURE__*/React.forwardRef(functi
|
|
|
95
99
|
categoriesChanged = _useState8[0],
|
|
96
100
|
setCategoriesChanged = _useState8[1];
|
|
97
101
|
var isTeamojiExperimentEnabled = FeatureGates.getExperimentValue(teamojiRefreshExperimentName, 'isEnabled', false);
|
|
102
|
+
var visibleEmojis = useMemo(function () {
|
|
103
|
+
return isTeamojiExperimentEnabled ? filterHiddenEmojis(emojis) : emojis;
|
|
104
|
+
}, [emojis, isTeamojiExperimentEnabled]);
|
|
105
|
+
var productivityColorPreviewEmojis = useMemo(function () {
|
|
106
|
+
return isTeamojiExperimentEnabled ? getProductivityColorPreviewEmojis(visibleEmojis) : {};
|
|
107
|
+
}, [isTeamojiExperimentEnabled, visibleEmojis]);
|
|
98
108
|
var addToCategoryMap = useCallback(function (categoryToGroupMap, emoji, category) {
|
|
99
109
|
if (!categoryToGroupMap[category]) {
|
|
100
110
|
var categoryDefinition = isTeamojiExperimentEnabled ? CategoryDescriptionMapNew[category] : CategoryDescriptionMap[category];
|
|
@@ -175,16 +185,23 @@ export var EmojiPickerVirtualListInternal = /*#__PURE__*/React.forwardRef(functi
|
|
|
175
185
|
setAllEmojiGroups(Object.keys(categoryToGroupMap).map(function (key) {
|
|
176
186
|
return categoryToGroupMap[key];
|
|
177
187
|
}).map(function (group) {
|
|
178
|
-
if (
|
|
188
|
+
if (isTeamojiExperimentEnabled && selectedProductivityColor) {
|
|
179
189
|
var _group$subcategories;
|
|
180
|
-
group.emojis.
|
|
190
|
+
group.emojis = filterProductivityEmojisByColor(group.emojis, selectedProductivityColor);
|
|
181
191
|
(_group$subcategories = group.subcategories) === null || _group$subcategories === void 0 || _group$subcategories.forEach(function (subcategory) {
|
|
192
|
+
subcategory.emojis = filterProductivityEmojisByColor(subcategory.emojis, selectedProductivityColor);
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
if (group.category !== frequentCategory) {
|
|
196
|
+
var _group$subcategories2;
|
|
197
|
+
group.emojis.sort(byOrder);
|
|
198
|
+
(_group$subcategories2 = group.subcategories) === null || _group$subcategories2 === void 0 || _group$subcategories2.forEach(function (subcategory) {
|
|
182
199
|
subcategory.emojis.sort(byOrder);
|
|
183
200
|
});
|
|
184
201
|
}
|
|
185
202
|
return group;
|
|
186
203
|
}).sort(byOrder));
|
|
187
|
-
}, [groupByCategory]);
|
|
204
|
+
}, [groupByCategory, isTeamojiExperimentEnabled, selectedProductivityColor]);
|
|
188
205
|
var buildEmojiRows = useCallback(function (items, category, title, emojis, showDelete) {
|
|
189
206
|
var remainingEmojis = emojis;
|
|
190
207
|
while (remainingEmojis.length > 0) {
|
|
@@ -204,9 +221,9 @@ export var EmojiPickerVirtualListInternal = /*#__PURE__*/React.forwardRef(functi
|
|
|
204
221
|
}
|
|
205
222
|
}, [isTeamojiExperimentEnabled, onEmojiActive, onEmojiDelete, onEmojiLeave, onEmojiSelected]);
|
|
206
223
|
var buildVirtualItemFromGroup = useCallback(function (group) {
|
|
207
|
-
var _group$
|
|
224
|
+
var _group$subcategories3;
|
|
208
225
|
var items = [];
|
|
209
|
-
var hasAtlassianSubcategories = isTeamojiExperimentEnabled && group.category === atlassianCategory && !!((_group$
|
|
226
|
+
var hasAtlassianSubcategories = isTeamojiExperimentEnabled && group.category === atlassianCategory && !!((_group$subcategories3 = group.subcategories) !== null && _group$subcategories3 !== void 0 && _group$subcategories3.length);
|
|
210
227
|
if (!hasAtlassianSubcategories) {
|
|
211
228
|
items.push(new CategoryHeadingItem({
|
|
212
229
|
id: group.category,
|
|
@@ -251,7 +268,7 @@ export var EmojiPickerVirtualListInternal = /*#__PURE__*/React.forwardRef(functi
|
|
|
251
268
|
} else {
|
|
252
269
|
if (query) {
|
|
253
270
|
var search = isTeamojiExperimentEnabled ? CategoryDescriptionMapNew.SEARCH : CategoryDescriptionMap.SEARCH;
|
|
254
|
-
if (
|
|
271
|
+
if (visibleEmojis.length === 0 && isTeamojiExperimentEnabled) {
|
|
255
272
|
// Show a "No results" category heading, then a no-results illustration below it
|
|
256
273
|
items.push(new CategoryHeadingItem({
|
|
257
274
|
id: searchCategory,
|
|
@@ -267,7 +284,7 @@ export var EmojiPickerVirtualListInternal = /*#__PURE__*/React.forwardRef(functi
|
|
|
267
284
|
items = [].concat(_toConsumableArray(items), _toConsumableArray(buildVirtualItemFromGroup({
|
|
268
285
|
category: searchCategory,
|
|
269
286
|
title: search.name,
|
|
270
|
-
emojis:
|
|
287
|
+
emojis: visibleEmojis,
|
|
271
288
|
order: search.order
|
|
272
289
|
})));
|
|
273
290
|
}
|
|
@@ -295,7 +312,7 @@ export var EmojiPickerVirtualListInternal = /*#__PURE__*/React.forwardRef(functi
|
|
|
295
312
|
}
|
|
296
313
|
}
|
|
297
314
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
298
|
-
}, [allEmojiGroups, buildVirtualItemFromGroup,
|
|
315
|
+
}, [allEmojiGroups, buildVirtualItemFromGroup, formatMessage, isTeamojiExperimentEnabled, loading, onOpenUpload, query, uploadEnabled, visibleEmojis]);
|
|
299
316
|
var findCategoryToActivate = function findCategoryToActivate(row) {
|
|
300
317
|
var category = null;
|
|
301
318
|
if (row instanceof CategoryHeadingItem) {
|
|
@@ -390,9 +407,9 @@ export var EmojiPickerVirtualListInternal = /*#__PURE__*/React.forwardRef(functi
|
|
|
390
407
|
});
|
|
391
408
|
useEffect(function () {
|
|
392
409
|
if (!query) {
|
|
393
|
-
buildEmojiGroupedByCategory(
|
|
410
|
+
buildEmojiGroupedByCategory(visibleEmojis, currentUser);
|
|
394
411
|
}
|
|
395
|
-
}, [
|
|
412
|
+
}, [visibleEmojis, selectedTone, selectedProductivityColor, loading, query, currentUser, buildEmojiGroupedByCategory]);
|
|
396
413
|
useEffect(function () {
|
|
397
414
|
buildVirtualItems();
|
|
398
415
|
}, [allEmojiGroups, buildVirtualItems]);
|
|
@@ -401,16 +418,17 @@ export var EmojiPickerVirtualListInternal = /*#__PURE__*/React.forwardRef(functi
|
|
|
401
418
|
onRowsRendered({
|
|
402
419
|
startIndex: 0
|
|
403
420
|
});
|
|
421
|
+
setCategoriesChanged(false);
|
|
404
422
|
}
|
|
405
423
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
406
424
|
}, [virtualItems, categoriesChanged]);
|
|
407
425
|
var virtualListHeight = useMemo(function () {
|
|
408
|
-
if (query &&
|
|
426
|
+
if (query && visibleEmojis.length === 0 && isTeamojiExperimentEnabled) {
|
|
409
427
|
// No-results state: expand the list height to fit heading + illustration without scrolling
|
|
410
428
|
return sizes.categoryHeadingHeight + sizes.noResultsHeight + emojiPickerHeightOffset(size);
|
|
411
429
|
}
|
|
412
430
|
return isTeamojiExperimentEnabled ? sizes.listHeightNew + emojiPickerHeightOffset(size) : sizes.listHeight + emojiPickerHeightOffset(size);
|
|
413
|
-
}, [size, query,
|
|
431
|
+
}, [size, query, visibleEmojis.length, isTeamojiExperimentEnabled]);
|
|
414
432
|
return /*#__PURE__*/React.createElement(EmojiPickerTabPanel, {
|
|
415
433
|
showSearchResults: !!query
|
|
416
434
|
}, /*#__PURE__*/React.createElement(EmojiActions, {
|
|
@@ -418,6 +436,9 @@ export var EmojiPickerVirtualListInternal = /*#__PURE__*/React.forwardRef(functi
|
|
|
418
436
|
onToneSelected: onToneSelected,
|
|
419
437
|
onToneSelectorCancelled: onToneSelectorCancelled,
|
|
420
438
|
toneEmoji: toneEmoji,
|
|
439
|
+
activeCategoryId: isTeamojiExperimentEnabled ? activeCategoryId : undefined,
|
|
440
|
+
productivityColorPreviewEmojis: isTeamojiExperimentEnabled ? productivityColorPreviewEmojis : undefined,
|
|
441
|
+
selectedProductivityColor: isTeamojiExperimentEnabled ? selectedProductivityColor : undefined,
|
|
421
442
|
uploading: uploading,
|
|
422
443
|
uploadEnabled: uploadEnabled,
|
|
423
444
|
emojiToDelete: emojiToDelete,
|
|
@@ -429,9 +450,10 @@ export var EmojiPickerVirtualListInternal = /*#__PURE__*/React.forwardRef(functi
|
|
|
429
450
|
onDeleteEmoji: onDeleteEmoji,
|
|
430
451
|
onFileChooserClicked: onFileChooserClicked,
|
|
431
452
|
onOpenUpload: onOpenUpload,
|
|
453
|
+
onProductivityColorSelected: isTeamojiExperimentEnabled ? onProductivityColorSelected : undefined,
|
|
432
454
|
query: query,
|
|
433
455
|
onChange: onSearch,
|
|
434
|
-
resultsCount:
|
|
456
|
+
resultsCount: visibleEmojis.length
|
|
435
457
|
}), /*#__PURE__*/React.createElement(EmojiPickerListContextProvider, {
|
|
436
458
|
initialEmojisFocus: {
|
|
437
459
|
rowIndex: 1,
|
|
@@ -8,6 +8,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
8
8
|
import React, { useCallback, useImperativeHandle } from 'react';
|
|
9
9
|
import { useVirtualizer } from '@tanstack/react-virtual';
|
|
10
10
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
|
+
import FeatureGates from '@atlaskit/feature-gate-js-client';
|
|
11
12
|
import { useEmojiPickerListContext } from '../../hooks/useEmojiPickerListContext';
|
|
12
13
|
import { EMOJIPICKERLIST_KEYBOARD_KEYS_SUPPORTED, EMOJI_LIST_COLUMNS, EMOJI_LIST_PAGE_COUNT, KeyboardNavigationDirection, KeyboardKeys } from '../../util/constants';
|
|
13
14
|
var virtualList = null;
|
|
@@ -55,13 +56,11 @@ export var VirtualList = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
55
56
|
var elemBottom = elementRect.bottom;
|
|
56
57
|
var parentTop = parentRect.top;
|
|
57
58
|
var parentBottom = parentRect.bottom;
|
|
58
|
-
|
|
59
|
-
// Only completely visible elements return true:
|
|
60
|
-
var isVisible = elemTop >= parentTop && elemBottom <= parentBottom;
|
|
59
|
+
var isVisible = FeatureGates.getExperimentValue('platform_teamoji_26_refresh_emoji_picker', 'isEnabled', false) ? elemTop >= parentTop && elemBottom <= parentBottom : elemBottom > parentTop && elemTop < parentBottom;
|
|
61
60
|
return isVisible;
|
|
62
61
|
};
|
|
63
62
|
var getFirstVisibleListElementIndex = useCallback(function () {
|
|
64
|
-
var _parentRef$current
|
|
63
|
+
var _parentRef$current, _virtualList$;
|
|
65
64
|
var virtualList = rowVirtualizer.getVirtualItems();
|
|
66
65
|
var renderedElements = (_parentRef$current = parentRef.current) === null || _parentRef$current === void 0 || (_parentRef$current = _parentRef$current.firstChild) === null || _parentRef$current === void 0 ? void 0 : _parentRef$current.childNodes;
|
|
67
66
|
if (virtualList.length === 0 || !renderedElements || renderedElements.length === 0) {
|
|
@@ -76,7 +75,7 @@ export var VirtualList = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
76
75
|
var _virtualList$firstVis;
|
|
77
76
|
return ((_virtualList$firstVis = virtualList[firstVisibleIndex]) === null || _virtualList$firstVis === void 0 ? void 0 : _virtualList$firstVis.index) || 0;
|
|
78
77
|
}
|
|
79
|
-
return 0;
|
|
78
|
+
return FeatureGates.getExperimentValue('platform_teamoji_26_refresh_emoji_picker', 'isEnabled', false) ? ((_virtualList$ = virtualList[0]) === null || _virtualList$ === void 0 ? void 0 : _virtualList$.index) || 0 : 0;
|
|
80
79
|
}, [rowVirtualizer]);
|
|
81
80
|
|
|
82
81
|
/**
|
|
@@ -14,7 +14,7 @@ var createEvent = function createEvent(eventType, action, actionSubject, actionS
|
|
|
14
14
|
actionSubjectId: actionSubjectId,
|
|
15
15
|
attributes: _objectSpread({
|
|
16
16
|
packageName: "@atlaskit/emoji",
|
|
17
|
-
packageVersion: "
|
|
17
|
+
packageVersion: "71.0.0"
|
|
18
18
|
}, attributes)
|
|
19
19
|
};
|
|
20
20
|
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
var hasHiddenTag = function hasHiddenTag(tags) {
|
|
2
|
+
var _tags$includes;
|
|
3
|
+
return (_tags$includes = tags === null || tags === void 0 ? void 0 : tags.includes('hidden')) !== null && _tags$includes !== void 0 ? _tags$includes : false;
|
|
4
|
+
};
|
|
5
|
+
var hasHiddenMetadataTag = function hasHiddenMetadataTag(emoji) {
|
|
6
|
+
var emojiWithMetadata = emoji;
|
|
7
|
+
var metadata = emojiWithMetadata.metadata;
|
|
8
|
+
if (typeof metadata === 'string') {
|
|
9
|
+
return metadata === 'hidden';
|
|
10
|
+
}
|
|
11
|
+
if (Array.isArray(metadata)) {
|
|
12
|
+
return hasHiddenTag(metadata);
|
|
13
|
+
}
|
|
14
|
+
return hasHiddenTag(metadata === null || metadata === void 0 ? void 0 : metadata.tags) || hasHiddenTag(emojiWithMetadata.tags);
|
|
15
|
+
};
|
|
16
|
+
export var isHiddenEmoji = function isHiddenEmoji(emoji) {
|
|
17
|
+
var emojiWithMetadata = emoji;
|
|
18
|
+
if (emojiWithMetadata.hidden) {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
return hasHiddenMetadataTag(emoji);
|
|
22
|
+
};
|
|
23
|
+
export var filterHiddenEmojis = function filterHiddenEmojis(emojis) {
|
|
24
|
+
return emojis.filter(function (emoji) {
|
|
25
|
+
return !isHiddenEmoji(emoji);
|
|
26
|
+
});
|
|
27
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export var productivityColors = ['gray', 'magenta', 'purple', 'blue', 'teal', 'green', 'lime', 'yellow', 'orange', 'red'];
|
|
2
|
+
var productivityColorSet = new Set(productivityColors);
|
|
3
|
+
var zeroSquareVariantParent = '0_zero_square_blue';
|
|
4
|
+
export var defaultProductivityColor = 'blue';
|
|
5
|
+
var getProductivityVariant = function getProductivityVariant(emoji) {
|
|
6
|
+
if (emoji.type !== 'ATLASSIAN' || !emoji.color || !productivityColorSet.has(emoji.color)) {
|
|
7
|
+
return undefined;
|
|
8
|
+
}
|
|
9
|
+
return {
|
|
10
|
+
color: emoji.color
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export var getProductivityColor = function getProductivityColor(emoji) {
|
|
14
|
+
var _getProductivityVaria;
|
|
15
|
+
return (_getProductivityVaria = getProductivityVariant(emoji)) === null || _getProductivityVaria === void 0 ? void 0 : _getProductivityVaria.color;
|
|
16
|
+
};
|
|
17
|
+
export var isProductivityNumberEmoji = function isProductivityNumberEmoji(emoji) {
|
|
18
|
+
return getProductivityColor(emoji) !== undefined;
|
|
19
|
+
};
|
|
20
|
+
export var filterProductivityEmojisByColor = function filterProductivityEmojisByColor(emojis, selectedColor) {
|
|
21
|
+
return emojis.filter(function (emoji) {
|
|
22
|
+
var variant = getProductivityVariant(emoji);
|
|
23
|
+
return !variant || variant.color === selectedColor;
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var isZeroSquareProductivityEmoji = function isZeroSquareProductivityEmoji(emoji) {
|
|
27
|
+
var _emoji$variantChildre, _emoji$keywords, _emoji$variantChildre2;
|
|
28
|
+
return emoji.variantParent === zeroSquareVariantParent || ((_emoji$variantChildre = emoji.variantChildren) === null || _emoji$variantChildre === void 0 ? void 0 : _emoji$variantChildre.some(function (variantChild) {
|
|
29
|
+
return variantChild.includes('0_zero_square_');
|
|
30
|
+
})) || !!(emoji.variantBase && (_emoji$keywords = emoji.keywords) !== null && _emoji$keywords !== void 0 && _emoji$keywords.includes('0') && (_emoji$variantChildre2 = emoji.variantChildren) !== null && _emoji$variantChildre2 !== void 0 && _emoji$variantChildre2.some(function (variantChild) {
|
|
31
|
+
return variantChild.includes('_square_');
|
|
32
|
+
}));
|
|
33
|
+
};
|
|
34
|
+
export var getProductivityColorPreviewEmojis = function getProductivityColorPreviewEmojis(emojis) {
|
|
35
|
+
return emojis.reduce(function (previewEmojis, emoji) {
|
|
36
|
+
var color = getProductivityColor(emoji);
|
|
37
|
+
if (!color) {
|
|
38
|
+
return previewEmojis;
|
|
39
|
+
}
|
|
40
|
+
if (isZeroSquareProductivityEmoji(emoji) || !previewEmojis[color]) {
|
|
41
|
+
previewEmojis[color] = emoji;
|
|
42
|
+
}
|
|
43
|
+
return previewEmojis;
|
|
44
|
+
}, {});
|
|
45
|
+
};
|
|
@@ -5,13 +5,16 @@
|
|
|
5
5
|
import { type ComponentType, type FC } from 'react';
|
|
6
6
|
import { type WithIntlProps, type WrappedComponentProps } from 'react-intl';
|
|
7
7
|
import type { EmojiDescription, EmojiDescriptionWithVariations, Message, OnToneSelected, OnToneSelectorCancelled, ToneSelection } from '../../types';
|
|
8
|
+
import type { CategoryId } from '../picker/categories';
|
|
8
9
|
import { type OnDeleteEmoji } from './EmojiDeletePreview';
|
|
9
10
|
import { type OnUploadEmoji } from './EmojiUploadPicker';
|
|
11
|
+
import type { ProductivityColor } from '../../util/productivity-colors';
|
|
10
12
|
export interface Props {
|
|
11
13
|
emojiToDelete?: EmojiDescription;
|
|
12
14
|
initialUploadName?: string;
|
|
13
15
|
onChange: (value: string) => void;
|
|
14
16
|
onCloseDelete: () => void;
|
|
17
|
+
onProductivityColorSelected?: (color: ProductivityColor) => void;
|
|
15
18
|
onDeleteEmoji: OnDeleteEmoji;
|
|
16
19
|
onFileChooserClicked?: () => void;
|
|
17
20
|
onOpenUpload: () => void;
|
|
@@ -21,6 +24,9 @@ export interface Props {
|
|
|
21
24
|
onUploadEmoji: OnUploadEmoji;
|
|
22
25
|
query?: string;
|
|
23
26
|
resultsCount?: number;
|
|
27
|
+
activeCategoryId?: CategoryId | null;
|
|
28
|
+
productivityColorPreviewEmojis?: Partial<Record<ProductivityColor, EmojiDescription>>;
|
|
29
|
+
selectedProductivityColor?: ProductivityColor;
|
|
24
30
|
selectedTone?: ToneSelection;
|
|
25
31
|
toneEmoji?: EmojiDescriptionWithVariations;
|
|
26
32
|
uploadEnabled: boolean;
|
|
@@ -2,6 +2,7 @@ import React, { type ReactElement } from 'react';
|
|
|
2
2
|
import type { RelativePosition } from '../../types';
|
|
3
3
|
export interface Props {
|
|
4
4
|
children: ReactElement<any>;
|
|
5
|
+
horizontalAlign?: 'start' | 'end' | 'end-to-start';
|
|
5
6
|
offsetX?: number;
|
|
6
7
|
offsetY?: number;
|
|
7
8
|
relativePosition?: RelativePosition;
|