@atlaskit/emoji 71.0.0 → 71.1.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 +16 -0
- package/afm-cc/tsconfig.json +3 -0
- package/afm-products/tsconfig.json +3 -0
- package/dist/cjs/components/common/Emoji.js +141 -5
- 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/ResourcedEmojiComponent.js +4 -1
- 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 +115 -5
- 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/ResourcedEmojiComponent.js +3 -1
- 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 +142 -6
- 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/ResourcedEmojiComponent.js +4 -1
- 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/Emoji.d.ts +5 -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/ResourcedEmojiComponent.d.ts +6 -1
- 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 +3 -2
|
@@ -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.1"
|
|
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
|
+
};
|
|
@@ -59,6 +59,11 @@ export interface Props extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'onMo
|
|
|
59
59
|
* Called when an emoji is selected
|
|
60
60
|
*/
|
|
61
61
|
onSelected?: OnEmojiEvent;
|
|
62
|
+
/**
|
|
63
|
+
* Renders unicode emoji through an image representation when a fixed height is supplied.
|
|
64
|
+
* Defaults to `true`.
|
|
65
|
+
*/
|
|
66
|
+
renderUnicodeEmojiAsImage?: boolean;
|
|
62
67
|
/**
|
|
63
68
|
* Show the emoji as selected
|
|
64
69
|
*/
|
|
@@ -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;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
import { type MemoExoticComponent } from 'react';
|
|
6
|
+
import type { EmojiDescription } from '../../types';
|
|
7
|
+
import { type ProductivityColor } from '../../util/productivity-colors';
|
|
8
|
+
export declare const productivityColorSelectorTestId = "productivity-color-selector";
|
|
9
|
+
export declare const productivityColorSelectorId = "emoji-picker-productivity-color-selector";
|
|
10
|
+
export interface Props {
|
|
11
|
+
colorPreviewEmojis: Partial<Record<ProductivityColor, EmojiDescription>>;
|
|
12
|
+
onColorSelected: (color: ProductivityColor) => void;
|
|
13
|
+
selectedColor: ProductivityColor;
|
|
14
|
+
}
|
|
15
|
+
export declare const ProductivityColorSelector: ({ colorPreviewEmojis, onColorSelected, selectedColor, }: Props) => JSX.Element | null;
|
|
16
|
+
declare const _default_1: MemoExoticComponent<typeof ProductivityColorSelector>;
|
|
17
|
+
export default _default_1;
|
|
@@ -50,6 +50,11 @@ export interface BaseResourcedEmojiProps {
|
|
|
50
50
|
* allows custom styling to the placeholder component while the emoji is loading.
|
|
51
51
|
*/
|
|
52
52
|
placeholderXcss?: StrictXCSSProp<'backgroundColor', never>;
|
|
53
|
+
/**
|
|
54
|
+
* Renders unicode emoji through an image representation when a fixed height is supplied.
|
|
55
|
+
* Defaults to `true`.
|
|
56
|
+
*/
|
|
57
|
+
renderUnicodeEmojiAsImage?: boolean;
|
|
53
58
|
/**
|
|
54
59
|
* Allows to show the tooltip.
|
|
55
60
|
* Defaults to `false`.
|
|
@@ -70,5 +75,5 @@ export interface Props extends BaseResourcedEmojiProps {
|
|
|
70
75
|
*/
|
|
71
76
|
onEmojiLoadSuccess?: EmojiLoadSuccessCallback;
|
|
72
77
|
}
|
|
73
|
-
export declare const ResourcedEmojiComponent: ({ emojiProvider, emojiId, showTooltip, customFallback, fitToHeight, optimistic, optimisticImageURL, editorEmoji, pageTitleEmoji, placeholderXcss, onEmojiLoadSuccess, onEmojiLoadFail, }: Props) => React.JSX.Element;
|
|
78
|
+
export declare const ResourcedEmojiComponent: ({ emojiProvider, emojiId, showTooltip, customFallback, fitToHeight, optimistic, optimisticImageURL, editorEmoji, renderUnicodeEmojiAsImage, pageTitleEmoji, placeholderXcss, onEmojiLoadSuccess, onEmojiLoadFail, }: Props) => React.JSX.Element;
|
|
74
79
|
export default ResourcedEmojiComponent;
|
|
@@ -6,6 +6,7 @@ import { type ForwardRefExoticComponent, type MemoExoticComponent, type RefAttri
|
|
|
6
6
|
import type { EmojiDescription } from '../../types';
|
|
7
7
|
export declare const tonePreviewTestId = "tone-preview";
|
|
8
8
|
export interface Props {
|
|
9
|
+
ariaControls?: string;
|
|
9
10
|
ariaExpanded?: boolean;
|
|
10
11
|
ariaLabelText?: string;
|
|
11
12
|
emoji: EmojiDescription;
|
|
@@ -164,6 +164,16 @@ export declare const messages: {
|
|
|
164
164
|
description: string;
|
|
165
165
|
id: string;
|
|
166
166
|
};
|
|
167
|
+
emojiSelectColorButtonAriaLabelText: {
|
|
168
|
+
defaultMessage: string;
|
|
169
|
+
description: string;
|
|
170
|
+
id: string;
|
|
171
|
+
};
|
|
172
|
+
emojiSelectColorListAriaLabelText: {
|
|
173
|
+
defaultMessage: string;
|
|
174
|
+
description: string;
|
|
175
|
+
id: string;
|
|
176
|
+
};
|
|
167
177
|
emojiSelectSkinToneListAriaLabelText: {
|
|
168
178
|
defaultMessage: string;
|
|
169
179
|
description: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { EmojiDescription, EmojiDescriptionWithVariations, Message, OnCategory, OnEmojiEvent, OnToneSelected, OnToneSelectorCancelled, PickerSize, ToneSelection, User } from '../../types';
|
|
3
|
+
import { type ProductivityColor } from '../../util/productivity-colors';
|
|
3
4
|
import { type CategoryId } from './categories';
|
|
4
5
|
import type { OnUploadEmoji } from '../common/EmojiUploadPicker';
|
|
5
6
|
import type { OnDeleteEmoji } from '../common/EmojiDeletePreview';
|
|
@@ -26,12 +27,14 @@ export interface Props {
|
|
|
26
27
|
onEmojiSelected?: OnEmojiEvent;
|
|
27
28
|
onFileChooserClicked?: () => void;
|
|
28
29
|
onOpenUpload: () => void;
|
|
30
|
+
onProductivityColorSelected?: (color: ProductivityColor) => void;
|
|
29
31
|
onSearch?: OnSearch;
|
|
30
32
|
onToneSelected?: OnToneSelected;
|
|
31
33
|
onToneSelectorCancelled?: OnToneSelectorCancelled;
|
|
32
34
|
onUploadCancelled: () => void;
|
|
33
35
|
onUploadEmoji: OnUploadEmoji;
|
|
34
36
|
query?: string;
|
|
37
|
+
selectedProductivityColor?: ProductivityColor;
|
|
35
38
|
selectedTone?: ToneSelection;
|
|
36
39
|
size?: PickerSize;
|
|
37
40
|
toneEmoji?: EmojiDescriptionWithVariations;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -220,13 +220,20 @@ export interface EmojiDescription extends EmojiId {
|
|
|
220
220
|
altRepresentation?: EmojiRepresentation;
|
|
221
221
|
ascii?: string[];
|
|
222
222
|
category: string;
|
|
223
|
+
color?: string;
|
|
223
224
|
createdDate?: string;
|
|
224
225
|
creatorUserId?: string;
|
|
226
|
+
fallback?: string;
|
|
227
|
+
hidden?: boolean;
|
|
228
|
+
keywords?: string[];
|
|
225
229
|
name?: string;
|
|
226
230
|
order?: number;
|
|
227
231
|
representation: EmojiRepresentation;
|
|
228
232
|
searchable: boolean;
|
|
229
233
|
type: string;
|
|
234
|
+
variantBase?: boolean;
|
|
235
|
+
variantChildren?: string[];
|
|
236
|
+
variantParent?: string;
|
|
230
237
|
}
|
|
231
238
|
export interface EmojiDescriptionWithVariations extends EmojiDescription {
|
|
232
239
|
skinVariations?: EmojiDescription[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { EmojiDescription } from '../types';
|
|
2
|
+
export declare const productivityColors: readonly ["gray", "magenta", "purple", "blue", "teal", "green", "lime", "yellow", "orange", "red"];
|
|
3
|
+
export type ProductivityColor = (typeof productivityColors)[number];
|
|
4
|
+
export declare const defaultProductivityColor: ProductivityColor;
|
|
5
|
+
export declare const getProductivityColor: (emoji: EmojiDescription) => ProductivityColor | undefined;
|
|
6
|
+
export declare const isProductivityNumberEmoji: (emoji: EmojiDescription) => boolean;
|
|
7
|
+
export declare const filterProductivityEmojisByColor: (emojis: EmojiDescription[], selectedColor: ProductivityColor) => EmojiDescription[];
|
|
8
|
+
export declare const getProductivityColorPreviewEmojis: (emojis: EmojiDescription[]) => Partial<Record<ProductivityColor, EmojiDescription>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/emoji",
|
|
3
|
-
"version": "71.
|
|
3
|
+
"version": "71.1.0",
|
|
4
4
|
"description": "Fabric emoji React components",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -45,9 +45,10 @@
|
|
|
45
45
|
"@atlaskit/platform-feature-flags": "^2.0.0",
|
|
46
46
|
"@atlaskit/pragmatic-drag-and-drop": "^2.0.0",
|
|
47
47
|
"@atlaskit/primitives": "^20.0.0",
|
|
48
|
+
"@atlaskit/radio": "^9.0.0",
|
|
48
49
|
"@atlaskit/spinner": "^20.0.0",
|
|
49
50
|
"@atlaskit/textfield": "^9.0.0",
|
|
50
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
51
|
+
"@atlaskit/tmp-editor-statsig": "^105.0.0",
|
|
51
52
|
"@atlaskit/tokens": "^14.0.0",
|
|
52
53
|
"@atlaskit/tooltip": "^23.0.0",
|
|
53
54
|
"@atlaskit/ufo": "^1.0.0",
|