@atlaskit/emoji 67.6.8 → 67.6.9

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.
Files changed (25) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cjs/components/common/Emoji.js +19 -4
  3. package/dist/cjs/components/common/ResourcedEmojiComponent.js +4 -2
  4. package/dist/cjs/components/picker/EmojiPickerListSearch.js +19 -19
  5. package/dist/cjs/components/typeahead/EmojiTypeAheadComponent.js +20 -14
  6. package/dist/cjs/util/analytics/analytics.js +1 -1
  7. package/dist/es2019/components/common/Emoji.js +18 -3
  8. package/dist/es2019/components/common/ResourcedEmojiComponent.js +4 -2
  9. package/dist/es2019/components/picker/EmojiPickerListSearch.js +7 -7
  10. package/dist/es2019/components/typeahead/EmojiTypeAheadComponent.js +16 -9
  11. package/dist/es2019/util/analytics/analytics.js +1 -1
  12. package/dist/esm/components/common/Emoji.js +19 -4
  13. package/dist/esm/components/common/ResourcedEmojiComponent.js +4 -2
  14. package/dist/esm/components/picker/EmojiPickerListSearch.js +7 -7
  15. package/dist/esm/components/typeahead/EmojiTypeAheadComponent.js +16 -9
  16. package/dist/esm/util/analytics/analytics.js +1 -1
  17. package/dist/types/components/common/Emoji.d.ts +6 -0
  18. package/dist/types/components/common/ResourcedEmojiComponent.d.ts +6 -0
  19. package/dist/types/components/picker/EmojiPickerListSearch.d.ts +1 -1
  20. package/dist/types/components/typeahead/EmojiTypeAheadComponent.d.ts +1 -1
  21. package/dist/types-ts4.5/components/common/Emoji.d.ts +6 -0
  22. package/dist/types-ts4.5/components/common/ResourcedEmojiComponent.d.ts +6 -0
  23. package/dist/types-ts4.5/components/picker/EmojiPickerListSearch.d.ts +1 -1
  24. package/dist/types-ts4.5/components/typeahead/EmojiTypeAheadComponent.d.ts +1 -1
  25. package/package.json +6 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/emoji
2
2
 
3
+ ## 67.6.9
4
+
5
+ ### Patch Changes
6
+
7
+ - [#64647](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/64647) [`f2cd17119b76`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f2cd17119b76) - [ECA11Y-15] Fixing screen reader announcement for Emoji
8
+
3
9
  ## 67.6.8
4
10
 
5
11
  ### Patch Changes
@@ -25,7 +25,7 @@ var _browserSupport = _interopRequireDefault(require("../../util/browser-support
25
25
  var _useInView3 = require("../../hooks/useInView");
26
26
  var _ufoExperiences = require("../../util/analytics/ufoExperiences");
27
27
  var _DeletableEmojiTooltipContent = require("./DeletableEmojiTooltipContent");
28
- var _excluded = ["emoji", "fitToHeight", "selected", "selectOnHover", "className", "showTooltip", "showDelete", "shouldBeInteractive", "tabIndex", "onSelected", "onMouseMove", "onFocus", "onDelete", "onLoadError", "onLoadSuccess", "disableLazyLoad", "autoWidth", "children", "type"];
28
+ var _excluded = ["emoji", "fitToHeight", "selected", "selectOnHover", "className", "showTooltip", "showDelete", "shouldBeInteractive", "tabIndex", "onSelected", "onMouseMove", "onFocus", "onDelete", "onLoadError", "onLoadSuccess", "disableLazyLoad", "autoWidth", "children", "type", "editorEmoji"];
29
29
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
30
30
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
31
31
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
@@ -286,13 +286,29 @@ var EmojiNodeWrapper = exports.EmojiNodeWrapper = /*#__PURE__*/(0, _react.forwar
286
286
  autoWidth = props.autoWidth,
287
287
  children = props.children,
288
288
  type = props.type,
289
+ editorEmoji = props.editorEmoji,
289
290
  other = (0, _objectWithoutProperties2.default)(props, _excluded);
290
- return (0, _react2.jsx)("span", (0, _extends2.default)({
291
+ var accessibilityProps;
292
+ if (editorEmoji) {
293
+ accessibilityProps = {
294
+ role: undefined
295
+ };
296
+ } else if (shouldBeInteractive) {
297
+ accessibilityProps = {
298
+ role: 'button',
299
+ 'aria-label': emoji.shortName
300
+ };
301
+ } else {
302
+ accessibilityProps = {
303
+ role: 'img',
304
+ 'aria-label': emoji.shortName
305
+ };
306
+ }
307
+ return (0, _react2.jsx)("span", (0, _extends2.default)({}, accessibilityProps, {
291
308
  ref: ref,
292
309
  "data-testid": "".concat(type, "-emoji-").concat(emoji.shortName),
293
310
  "data-emoji-type": type,
294
311
  tabIndex: shouldBeInteractive ? tabIndex || 0 : undefined,
295
- role: shouldBeInteractive ? 'button' : 'img',
296
312
  css: type === 'sprite' ? _styles.emojiSpriteContainer : _styles.emojiImageContainer,
297
313
  className: className,
298
314
  onKeyDown: function onKeyDown(event) {
@@ -307,7 +323,6 @@ var EmojiNodeWrapper = exports.EmojiNodeWrapper = /*#__PURE__*/(0, _react.forwar
307
323
  onFocus: function onFocus(event) {
308
324
  handleFocus(props, event);
309
325
  },
310
- "aria-label": emoji.shortName,
311
326
  title: showTooltip ? emoji.shortName : undefined // TODO: COLLAB-2351 - use @atlaskit/Tooltip in future for non-deletable emoji if enabled showTooltip
312
327
  }, other), children);
313
328
  });
@@ -41,7 +41,8 @@ var ResourcedEmojiComponent = exports.ResourcedEmojiComponent = function Resourc
41
41
  _props$optimistic = props.optimistic,
42
42
  optimistic = _props$optimistic === void 0 ? false : _props$optimistic,
43
43
  _props$optimisticImag = props.optimisticImageURL,
44
- optimisticImageURL = _props$optimisticImag === void 0 ? undefined : _props$optimisticImag;
44
+ optimisticImageURL = _props$optimisticImag === void 0 ? undefined : _props$optimisticImag,
45
+ editorEmoji = props.editorEmoji;
45
46
  var shortName = emojiId.shortName,
46
47
  id = emojiId.id,
47
48
  fallback = emojiId.fallback;
@@ -221,7 +222,8 @@ var ResourcedEmojiComponent = exports.ResourcedEmojiComponent = function Resourc
221
222
  onLoadError: handleOnLoadError,
222
223
  showTooltip: showTooltip,
223
224
  fitToHeight: fitToHeight,
224
- autoWidth: !!emoji ? false : true
225
+ autoWidth: !!emoji ? false : true,
226
+ editorEmoji: editorEmoji
225
227
  })));
226
228
  };
227
229
  var _default = exports.default = ResourcedEmojiComponent;
@@ -7,22 +7,22 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.emojiPickerSearchTestId = exports.EmojiPickerListSearch = void 0;
9
9
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
- var _react = _interopRequireWildcard(require("react"));
11
- var _react2 = require("@emotion/react");
12
- var _textfield = _interopRequireDefault(require("@atlaskit/textfield"));
13
10
  var _search = _interopRequireDefault(require("@atlaskit/icon/glyph/search"));
11
+ var _textfield = _interopRequireDefault(require("@atlaskit/textfield"));
14
12
  var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden"));
13
+ var _react = require("@emotion/react");
14
+ var _react2 = _interopRequireWildcard(require("react"));
15
15
  var _reactIntlNext = require("react-intl-next");
16
- var _i18n = require("../i18n");
17
- var _styles = require("./styles");
18
- var _constants = require("../../util/constants");
19
16
  var _useDebounce = require("use-debounce");
20
- var _styles2 = require("../common/styles");
17
+ var _constants = require("../../util/constants");
18
+ var _styles = require("../common/styles");
19
+ var _i18n = require("../i18n");
20
+ var _styles2 = require("./styles");
21
21
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
22
22
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
23
  /** @jsx jsx */
24
24
 
25
- var emojiPickerSearchTestId = exports.emojiPickerSearchTestId = 'emoji-picker-serach';
25
+ var emojiPickerSearchTestId = exports.emojiPickerSearchTestId = 'emoji-picker-search';
26
26
  var EmojiPickerListSearch = exports.EmojiPickerListSearch = function EmojiPickerListSearch(props) {
27
27
  var style = props.style,
28
28
  query = props.query,
@@ -30,8 +30,8 @@ var EmojiPickerListSearch = exports.EmojiPickerListSearch = function EmojiPicker
30
30
  isVisible = _props$isVisible === void 0 ? true : _props$isVisible,
31
31
  resultsCount = props.resultsCount,
32
32
  onChange = props.onChange;
33
- var textRef = (0, _react.useRef)(null);
34
- var _useState = (0, _react.useState)(false),
33
+ var textRef = (0, _react2.useRef)(null);
34
+ var _useState = (0, _react2.useState)(false),
35
35
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
36
36
  dirty = _useState2[0],
37
37
  setDirty = _useState2[1];
@@ -50,7 +50,7 @@ var EmojiPickerListSearch = exports.EmojiPickerListSearch = function EmojiPicker
50
50
  var handleOnChange = function handleOnChange(e) {
51
51
  debouncedSearch(e.target.value);
52
52
  };
53
- (0, _react.useLayoutEffect)(function () {
53
+ (0, _react2.useLayoutEffect)(function () {
54
54
  requestAnimationFrame(function () {
55
55
  if (textRef) {
56
56
  var _textRef$current;
@@ -58,26 +58,26 @@ var EmojiPickerListSearch = exports.EmojiPickerListSearch = function EmojiPicker
58
58
  }
59
59
  });
60
60
  }, []);
61
- return (0, _react2.jsx)("div", {
62
- css: [_styles.pickerSearch, !isVisible && _styles2.hidden],
61
+ return (0, _react.jsx)("div", {
62
+ css: [_styles2.pickerSearch, !isVisible && _styles.hidden],
63
63
  style: style
64
- }, (0, _react2.jsx)(_visuallyHidden.default, {
64
+ }, (0, _react.jsx)(_visuallyHidden.default, {
65
65
  id: "emoji-search-results-status",
66
66
  role: "status"
67
67
  }, dirty && query === '' && formatMessage(_i18n.messages.searchResultsStatusSeeAll), query !== '' && formatMessage(_i18n.messages.searchResultsStatus, {
68
68
  count: resultsCount
69
- })), (0, _react2.jsx)(_textfield.default, {
69
+ })), (0, _react.jsx)(_textfield.default, {
70
70
  role: "searchbox",
71
71
  "aria-label": formatMessage(_i18n.messages.searchLabel),
72
- css: _styles.input,
72
+ css: _styles2.input,
73
73
  autoComplete: "off",
74
74
  name: "search",
75
75
  placeholder: "".concat(formatMessage(_i18n.messages.searchPlaceholder), "..."),
76
76
  defaultValue: query || '',
77
77
  onChange: handleOnChange,
78
- elemBeforeInput: (0, _react2.jsx)("span", {
79
- css: _styles.searchIcon
80
- }, (0, _react2.jsx)(_search.default, {
78
+ elemBeforeInput: (0, _react.jsx)("span", {
79
+ css: _styles2.searchIcon
80
+ }, (0, _react.jsx)(_search.default, {
81
81
  label: ""
82
82
  })),
83
83
  testId: emojiPickerSearchTestId,
@@ -12,15 +12,16 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
12
12
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
13
13
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
14
14
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
- var _react = require("react");
15
+ var _react = require("@emotion/react");
16
+ var _react2 = require("react");
17
+ var _reactDom = require("react-dom");
16
18
  var _uuid = _interopRequireDefault(require("uuid"));
17
- var _react2 = require("@emotion/react");
18
- var _constants = require("../../util/constants");
19
- var _typeHelpers = require("../../util/type-helpers");
19
+ var _EmojiCommonProvider = require("../../context/EmojiCommonProvider");
20
20
  var _types = require("../../types");
21
- var _logger = _interopRequireDefault(require("../../util/logger"));
22
21
  var _analytics = require("../../util/analytics");
23
- var _EmojiCommonProvider = require("../../context/EmojiCommonProvider");
22
+ var _constants = require("../../util/constants");
23
+ var _logger = _interopRequireDefault(require("../../util/logger"));
24
+ var _typeHelpers = require("../../util/type-helpers");
24
25
  var _RecordSelectionDefault = require("../common/RecordSelectionDefault");
25
26
  var _EmojiTypeAheadList = _interopRequireDefault(require("./EmojiTypeAheadList"));
26
27
  var _styles = require("./styles");
@@ -100,10 +101,15 @@ var EmojiTypeAheadComponent = exports.default = /*#__PURE__*/function (_PureComp
100
101
  var visible = emojis.length > 0;
101
102
  _this.fireAnalyticsEvent((0, _analytics.typeaheadRenderedEvent)(Date.now() - _this.renderStartTime, query, emojis));
102
103
  (0, _logger.default)('emoji-typeahead.applyPropChanges', emojis.length, wasVisible, visible);
103
- _this.setState({
104
- emojis: emojis,
105
- visible: visible,
106
- loading: false
104
+
105
+ // Synchronously flush state update, because there is some analytics in fireSelectionEvent
106
+ // that relies on emojis being set to determine the position
107
+ (0, _reactDom.flushSync)(function () {
108
+ _this.setState({
109
+ emojis: emojis,
110
+ visible: visible,
111
+ loading: false
112
+ });
107
113
  });
108
114
  if (isFullShortName(query)) {
109
115
  var matchIndex = uniqueExactShortNameMatchIndex(result, query);
@@ -255,13 +261,13 @@ var EmojiTypeAheadComponent = exports.default = /*#__PURE__*/function (_PureComp
255
261
  var style = {
256
262
  display: visible ? 'block' : 'none'
257
263
  };
258
- return (0, _react2.jsx)(_EmojiCommonProvider.EmojiCommonProvider, {
264
+ return (0, _react.jsx)(_EmojiCommonProvider.EmojiCommonProvider, {
259
265
  emojiProvider: this.props.emojiProvider
260
- }, (0, _react2.jsx)("div", {
266
+ }, (0, _react.jsx)("div", {
261
267
  style: style,
262
268
  className: 'ak-emoji-typeahead',
263
269
  css: _styles.emojiTypeAhead
264
- }, (0, _react2.jsx)(_EmojiTypeAheadList.default, {
270
+ }, (0, _react.jsx)(_EmojiTypeAheadList.default, {
265
271
  emojis: emojis,
266
272
  onEmojiSelected: recordUsageOnSelection,
267
273
  ref: this.onEmojiListRef,
@@ -270,7 +276,7 @@ var EmojiTypeAheadComponent = exports.default = /*#__PURE__*/function (_PureComp
270
276
  }
271
277
  }]);
272
278
  return EmojiTypeAheadComponent;
273
- }(_react.PureComponent);
279
+ }(_react2.PureComponent);
274
280
  (0, _defineProperty2.default)(EmojiTypeAheadComponent, "defaultProps", {
275
281
  onSelection: function onSelection() {},
276
282
  onOpen: function onOpen() {},
@@ -19,7 +19,7 @@ var createEvent = function createEvent(eventType, action, actionSubject, actionS
19
19
  actionSubjectId: actionSubjectId,
20
20
  attributes: _objectSpread({
21
21
  packageName: "@atlaskit/emoji",
22
- packageVersion: "67.6.8"
22
+ packageVersion: "67.6.9"
23
23
  }, attributes)
24
24
  };
25
25
  };
@@ -279,14 +279,30 @@ export const EmojiNodeWrapper = /*#__PURE__*/forwardRef((props, ref) => {
279
279
  autoWidth,
280
280
  children,
281
281
  type,
282
+ editorEmoji,
282
283
  ...other
283
284
  } = props;
284
- return jsx("span", _extends({
285
+ let accessibilityProps;
286
+ if (editorEmoji) {
287
+ accessibilityProps = {
288
+ role: undefined
289
+ };
290
+ } else if (shouldBeInteractive) {
291
+ accessibilityProps = {
292
+ role: 'button',
293
+ 'aria-label': emoji.shortName
294
+ };
295
+ } else {
296
+ accessibilityProps = {
297
+ role: 'img',
298
+ 'aria-label': emoji.shortName
299
+ };
300
+ }
301
+ return jsx("span", _extends({}, accessibilityProps, {
285
302
  ref: ref,
286
303
  "data-testid": `${type}-emoji-${emoji.shortName}`,
287
304
  "data-emoji-type": type,
288
305
  tabIndex: shouldBeInteractive ? tabIndex || 0 : undefined,
289
- role: shouldBeInteractive ? 'button' : 'img',
290
306
  css: type === 'sprite' ? emojiSpriteContainer : emojiImageContainer,
291
307
  className: className,
292
308
  onKeyDown: event => handleKeyDown(props, event),
@@ -299,7 +315,6 @@ export const EmojiNodeWrapper = /*#__PURE__*/forwardRef((props, ref) => {
299
315
  onFocus: event => {
300
316
  handleFocus(props, event);
301
317
  },
302
- "aria-label": emoji.shortName,
303
318
  title: showTooltip ? emoji.shortName : undefined // TODO: COLLAB-2351 - use @atlaskit/Tooltip in future for non-deletable emoji if enabled showTooltip
304
319
  }, other), children);
305
320
  });
@@ -21,7 +21,8 @@ export const ResourcedEmojiComponent = props => {
21
21
  customFallback = undefined,
22
22
  fitToHeight = defaultEmojiHeight,
23
23
  optimistic = false,
24
- optimisticImageURL = undefined
24
+ optimisticImageURL = undefined,
25
+ editorEmoji
25
26
  } = props;
26
27
  const {
27
28
  shortName,
@@ -177,7 +178,8 @@ export const ResourcedEmojiComponent = props => {
177
178
  onLoadError: handleOnLoadError,
178
179
  showTooltip: showTooltip,
179
180
  fitToHeight: fitToHeight,
180
- autoWidth: !!emoji ? false : true
181
+ autoWidth: !!emoji ? false : true,
182
+ editorEmoji: editorEmoji
181
183
  })));
182
184
  };
183
185
  export default ResourcedEmojiComponent;
@@ -1,16 +1,16 @@
1
1
  /** @jsx jsx */
2
- import React, { useLayoutEffect, useRef, useState } from 'react';
3
- import { jsx } from '@emotion/react';
4
- import TextField from '@atlaskit/textfield';
5
2
  import SearchIcon from '@atlaskit/icon/glyph/search';
3
+ import TextField from '@atlaskit/textfield';
6
4
  import VisuallyHidden from '@atlaskit/visually-hidden';
5
+ import { jsx } from '@emotion/react';
6
+ import React, { useLayoutEffect, useRef, useState } from 'react';
7
7
  import { useIntl } from 'react-intl-next';
8
- import { messages } from '../i18n';
9
- import { input, pickerSearch, searchIcon } from './styles';
10
- import { EMOJI_SEARCH_DEBOUNCE } from '../../util/constants';
11
8
  import { useDebouncedCallback } from 'use-debounce';
9
+ import { EMOJI_SEARCH_DEBOUNCE } from '../../util/constants';
12
10
  import { hidden } from '../common/styles';
13
- export const emojiPickerSearchTestId = 'emoji-picker-serach';
11
+ import { messages } from '../i18n';
12
+ import { input, pickerSearch, searchIcon } from './styles';
13
+ export const emojiPickerSearchTestId = 'emoji-picker-search';
14
14
  export const EmojiPickerListSearch = props => {
15
15
  const {
16
16
  style,
@@ -1,14 +1,16 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  /** @jsx jsx */
3
+
4
+ import { jsx } from '@emotion/react';
3
5
  import { PureComponent } from 'react';
6
+ import { flushSync } from 'react-dom';
4
7
  import uuid from 'uuid';
5
- import { jsx } from '@emotion/react';
6
- import { defaultListLimit } from '../../util/constants';
7
- import { toEmojiId } from '../../util/type-helpers';
8
+ import { EmojiCommonProvider } from '../../context/EmojiCommonProvider';
8
9
  import { SearchSort } from '../../types';
10
+ import { typeaheadCancelledEvent, typeaheadRenderedEvent, typeaheadSelectedEvent, ufoExperiences } from '../../util/analytics';
11
+ import { defaultListLimit } from '../../util/constants';
9
12
  import debug from '../../util/logger';
10
- import { typeaheadCancelledEvent, typeaheadSelectedEvent, typeaheadRenderedEvent, ufoExperiences } from '../../util/analytics';
11
- import { EmojiCommonProvider } from '../../context/EmojiCommonProvider';
13
+ import { toEmojiId } from '../../util/type-helpers';
12
14
  import { createRecordSelectionDefault } from '../common/RecordSelectionDefault';
13
15
  import EmojiList from './EmojiTypeAheadList';
14
16
  import { emojiTypeAhead } from './styles';
@@ -72,10 +74,15 @@ export default class EmojiTypeAheadComponent extends PureComponent {
72
74
  const visible = emojis.length > 0;
73
75
  this.fireAnalyticsEvent(typeaheadRenderedEvent(Date.now() - this.renderStartTime, query, emojis));
74
76
  debug('emoji-typeahead.applyPropChanges', emojis.length, wasVisible, visible);
75
- this.setState({
76
- emojis: emojis,
77
- visible,
78
- loading: false
77
+
78
+ // Synchronously flush state update, because there is some analytics in fireSelectionEvent
79
+ // that relies on emojis being set to determine the position
80
+ flushSync(() => {
81
+ this.setState({
82
+ emojis: emojis,
83
+ visible,
84
+ loading: false
85
+ });
79
86
  });
80
87
  if (isFullShortName(query)) {
81
88
  const matchIndex = uniqueExactShortNameMatchIndex(result, query);
@@ -7,7 +7,7 @@ const createEvent = (eventType, action, actionSubject, actionSubjectId, attribut
7
7
  actionSubjectId,
8
8
  attributes: {
9
9
  packageName: "@atlaskit/emoji",
10
- packageVersion: "67.6.8",
10
+ packageVersion: "67.6.9",
11
11
  ...attributes
12
12
  }
13
13
  });
@@ -2,7 +2,7 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import _extends from "@babel/runtime/helpers/extends";
4
4
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
5
- var _excluded = ["emoji", "fitToHeight", "selected", "selectOnHover", "className", "showTooltip", "showDelete", "shouldBeInteractive", "tabIndex", "onSelected", "onMouseMove", "onFocus", "onDelete", "onLoadError", "onLoadSuccess", "disableLazyLoad", "autoWidth", "children", "type"];
5
+ var _excluded = ["emoji", "fitToHeight", "selected", "selectOnHover", "className", "showTooltip", "showDelete", "shouldBeInteractive", "tabIndex", "onSelected", "onMouseMove", "onFocus", "onDelete", "onLoadError", "onLoadSuccess", "disableLazyLoad", "autoWidth", "children", "type", "editorEmoji"];
6
6
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
7
7
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
8
8
  /** @jsx jsx */
@@ -277,13 +277,29 @@ export var EmojiNodeWrapper = /*#__PURE__*/forwardRef(function (props, ref) {
277
277
  autoWidth = props.autoWidth,
278
278
  children = props.children,
279
279
  type = props.type,
280
+ editorEmoji = props.editorEmoji,
280
281
  other = _objectWithoutProperties(props, _excluded);
281
- return jsx("span", _extends({
282
+ var accessibilityProps;
283
+ if (editorEmoji) {
284
+ accessibilityProps = {
285
+ role: undefined
286
+ };
287
+ } else if (shouldBeInteractive) {
288
+ accessibilityProps = {
289
+ role: 'button',
290
+ 'aria-label': emoji.shortName
291
+ };
292
+ } else {
293
+ accessibilityProps = {
294
+ role: 'img',
295
+ 'aria-label': emoji.shortName
296
+ };
297
+ }
298
+ return jsx("span", _extends({}, accessibilityProps, {
282
299
  ref: ref,
283
300
  "data-testid": "".concat(type, "-emoji-").concat(emoji.shortName),
284
301
  "data-emoji-type": type,
285
302
  tabIndex: shouldBeInteractive ? tabIndex || 0 : undefined,
286
- role: shouldBeInteractive ? 'button' : 'img',
287
303
  css: type === 'sprite' ? emojiSpriteContainer : emojiImageContainer,
288
304
  className: className,
289
305
  onKeyDown: function onKeyDown(event) {
@@ -298,7 +314,6 @@ export var EmojiNodeWrapper = /*#__PURE__*/forwardRef(function (props, ref) {
298
314
  onFocus: function onFocus(event) {
299
315
  handleFocus(props, event);
300
316
  },
301
- "aria-label": emoji.shortName,
302
317
  title: showTooltip ? emoji.shortName : undefined // TODO: COLLAB-2351 - use @atlaskit/Tooltip in future for non-deletable emoji if enabled showTooltip
303
318
  }, other), children);
304
319
  });
@@ -31,7 +31,8 @@ export var ResourcedEmojiComponent = function ResourcedEmojiComponent(props) {
31
31
  _props$optimistic = props.optimistic,
32
32
  optimistic = _props$optimistic === void 0 ? false : _props$optimistic,
33
33
  _props$optimisticImag = props.optimisticImageURL,
34
- optimisticImageURL = _props$optimisticImag === void 0 ? undefined : _props$optimisticImag;
34
+ optimisticImageURL = _props$optimisticImag === void 0 ? undefined : _props$optimisticImag,
35
+ editorEmoji = props.editorEmoji;
35
36
  var shortName = emojiId.shortName,
36
37
  id = emojiId.id,
37
38
  fallback = emojiId.fallback;
@@ -211,7 +212,8 @@ export var ResourcedEmojiComponent = function ResourcedEmojiComponent(props) {
211
212
  onLoadError: handleOnLoadError,
212
213
  showTooltip: showTooltip,
213
214
  fitToHeight: fitToHeight,
214
- autoWidth: !!emoji ? false : true
215
+ autoWidth: !!emoji ? false : true,
216
+ editorEmoji: editorEmoji
215
217
  })));
216
218
  };
217
219
  export default ResourcedEmojiComponent;
@@ -1,17 +1,17 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  /** @jsx jsx */
3
- import React, { useLayoutEffect, useRef, useState } from 'react';
4
- import { jsx } from '@emotion/react';
5
- import TextField from '@atlaskit/textfield';
6
3
  import SearchIcon from '@atlaskit/icon/glyph/search';
4
+ import TextField from '@atlaskit/textfield';
7
5
  import VisuallyHidden from '@atlaskit/visually-hidden';
6
+ import { jsx } from '@emotion/react';
7
+ import React, { useLayoutEffect, useRef, useState } from 'react';
8
8
  import { useIntl } from 'react-intl-next';
9
- import { messages } from '../i18n';
10
- import { input, pickerSearch, searchIcon } from './styles';
11
- import { EMOJI_SEARCH_DEBOUNCE } from '../../util/constants';
12
9
  import { useDebouncedCallback } from 'use-debounce';
10
+ import { EMOJI_SEARCH_DEBOUNCE } from '../../util/constants';
13
11
  import { hidden } from '../common/styles';
14
- export var emojiPickerSearchTestId = 'emoji-picker-serach';
12
+ import { messages } from '../i18n';
13
+ import { input, pickerSearch, searchIcon } from './styles';
14
+ export var emojiPickerSearchTestId = 'emoji-picker-search';
15
15
  export var EmojiPickerListSearch = function EmojiPickerListSearch(props) {
16
16
  var style = props.style,
17
17
  query = props.query,
@@ -11,15 +11,17 @@ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol
11
11
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
12
12
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
13
13
  /** @jsx jsx */
14
+
15
+ import { jsx } from '@emotion/react';
14
16
  import { PureComponent } from 'react';
17
+ import { flushSync } from 'react-dom';
15
18
  import uuid from 'uuid';
16
- import { jsx } from '@emotion/react';
17
- import { defaultListLimit } from '../../util/constants';
18
- import { toEmojiId } from '../../util/type-helpers';
19
+ import { EmojiCommonProvider } from '../../context/EmojiCommonProvider';
19
20
  import { SearchSort } from '../../types';
21
+ import { typeaheadCancelledEvent, typeaheadRenderedEvent, typeaheadSelectedEvent, ufoExperiences } from '../../util/analytics';
22
+ import { defaultListLimit } from '../../util/constants';
20
23
  import debug from '../../util/logger';
21
- import { typeaheadCancelledEvent, typeaheadSelectedEvent, typeaheadRenderedEvent, ufoExperiences } from '../../util/analytics';
22
- import { EmojiCommonProvider } from '../../context/EmojiCommonProvider';
24
+ import { toEmojiId } from '../../util/type-helpers';
23
25
  import { createRecordSelectionDefault } from '../common/RecordSelectionDefault';
24
26
  import EmojiList from './EmojiTypeAheadList';
25
27
  import { emojiTypeAhead } from './styles';
@@ -94,10 +96,15 @@ var EmojiTypeAheadComponent = /*#__PURE__*/function (_PureComponent) {
94
96
  var visible = emojis.length > 0;
95
97
  _this.fireAnalyticsEvent(typeaheadRenderedEvent(Date.now() - _this.renderStartTime, query, emojis));
96
98
  debug('emoji-typeahead.applyPropChanges', emojis.length, wasVisible, visible);
97
- _this.setState({
98
- emojis: emojis,
99
- visible: visible,
100
- loading: false
99
+
100
+ // Synchronously flush state update, because there is some analytics in fireSelectionEvent
101
+ // that relies on emojis being set to determine the position
102
+ flushSync(function () {
103
+ _this.setState({
104
+ emojis: emojis,
105
+ visible: visible,
106
+ loading: false
107
+ });
101
108
  });
102
109
  if (isFullShortName(query)) {
103
110
  var matchIndex = uniqueExactShortNameMatchIndex(result, query);
@@ -12,7 +12,7 @@ var createEvent = function createEvent(eventType, action, actionSubject, actionS
12
12
  actionSubjectId: actionSubjectId,
13
13
  attributes: _objectSpread({
14
14
  packageName: "@atlaskit/emoji",
15
- packageVersion: "67.6.8"
15
+ packageVersion: "67.6.9"
16
16
  }, attributes)
17
17
  };
18
18
  };
@@ -74,6 +74,12 @@ export interface Props extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'onMo
74
74
  * Used only for image based emojis
75
75
  */
76
76
  autoWidth?: boolean;
77
+ /**
78
+ * This should only be set when the emoji is being used in the Editor.
79
+ * Currently when set -- this prevents any aria labels being added.
80
+ * This is acceptable in Editor -- as it uses another technique to announce the emoji nodes.
81
+ */
82
+ editorEmoji?: true;
77
83
  }
78
84
  export declare const SpriteEmoji: (props: Props) => jsx.JSX.Element;
79
85
  export declare const ImageEmoji: (props: Props) => jsx.JSX.Element;
@@ -37,6 +37,12 @@ export interface BaseResourcedEmojiProps {
37
37
  * Defaults to `undefined`.
38
38
  */
39
39
  optimisticImageURL?: string;
40
+ /**
41
+ * This should only be set when the emoji is being used in the Editor.
42
+ * Currently when set -- this prevents any aria labels being added.
43
+ * This is acceptable in Editor -- as it uses another technique to announce the emoji nodes.
44
+ */
45
+ editorEmoji?: true;
40
46
  }
41
47
  export interface Props extends BaseResourcedEmojiProps {
42
48
  /**
@@ -7,5 +7,5 @@ export interface Props {
7
7
  onChange: (value: string) => void;
8
8
  resultsCount: number;
9
9
  }
10
- export declare const emojiPickerSearchTestId = "emoji-picker-serach";
10
+ export declare const emojiPickerSearchTestId = "emoji-picker-search";
11
11
  export declare const EmojiPickerListSearch: (props: Props) => jsx.JSX.Element;
@@ -1,7 +1,7 @@
1
1
  /** @jsx jsx */
2
- import { PureComponent } from 'react';
3
2
  import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
4
3
  import { jsx } from '@emotion/react';
4
+ import { PureComponent } from 'react';
5
5
  import type { EmojiProvider } from '../../api/EmojiResource';
6
6
  import { type EmojiDescription, type OnEmojiEvent } from '../../types';
7
7
  export interface OnLifecycle {
@@ -74,6 +74,12 @@ export interface Props extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'onMo
74
74
  * Used only for image based emojis
75
75
  */
76
76
  autoWidth?: boolean;
77
+ /**
78
+ * This should only be set when the emoji is being used in the Editor.
79
+ * Currently when set -- this prevents any aria labels being added.
80
+ * This is acceptable in Editor -- as it uses another technique to announce the emoji nodes.
81
+ */
82
+ editorEmoji?: true;
77
83
  }
78
84
  export declare const SpriteEmoji: (props: Props) => jsx.JSX.Element;
79
85
  export declare const ImageEmoji: (props: Props) => jsx.JSX.Element;
@@ -37,6 +37,12 @@ export interface BaseResourcedEmojiProps {
37
37
  * Defaults to `undefined`.
38
38
  */
39
39
  optimisticImageURL?: string;
40
+ /**
41
+ * This should only be set when the emoji is being used in the Editor.
42
+ * Currently when set -- this prevents any aria labels being added.
43
+ * This is acceptable in Editor -- as it uses another technique to announce the emoji nodes.
44
+ */
45
+ editorEmoji?: true;
40
46
  }
41
47
  export interface Props extends BaseResourcedEmojiProps {
42
48
  /**
@@ -7,5 +7,5 @@ export interface Props {
7
7
  onChange: (value: string) => void;
8
8
  resultsCount: number;
9
9
  }
10
- export declare const emojiPickerSearchTestId = "emoji-picker-serach";
10
+ export declare const emojiPickerSearchTestId = "emoji-picker-search";
11
11
  export declare const EmojiPickerListSearch: (props: Props) => jsx.JSX.Element;
@@ -1,7 +1,7 @@
1
1
  /** @jsx jsx */
2
- import { PureComponent } from 'react';
3
2
  import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
4
3
  import { jsx } from '@emotion/react';
4
+ import { PureComponent } from 'react';
5
5
  import type { EmojiProvider } from '../../api/EmojiResource';
6
6
  import { type EmojiDescription, type OnEmojiEvent } from '../../types';
7
7
  export interface OnLifecycle {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/emoji",
3
- "version": "67.6.8",
3
+ "version": "67.6.9",
4
4
  "description": "Fabric emoji React components",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -27,22 +27,23 @@
27
27
  "releaseModel": "continuous",
28
28
  "website": {
29
29
  "name": "Emoji"
30
- }
30
+ },
31
+ "runReact18": false
31
32
  },
32
33
  "config": {
33
34
  "access": "public"
34
35
  },
35
36
  "dependencies": {
36
37
  "@atlaskit/analytics-next": "^9.1.0",
37
- "@atlaskit/button": "^17.0.0",
38
+ "@atlaskit/button": "^17.2.0",
38
39
  "@atlaskit/icon": "^22.0.0",
39
40
  "@atlaskit/media-client": "^26.1.0",
40
41
  "@atlaskit/media-client-react": "^2.0.0",
41
42
  "@atlaskit/spinner": "^16.0.0",
42
43
  "@atlaskit/textfield": "^6.0.0",
43
44
  "@atlaskit/theme": "^12.6.0",
44
- "@atlaskit/tokens": "^1.30.0",
45
- "@atlaskit/tooltip": "^18.0.0",
45
+ "@atlaskit/tokens": "^1.33.0",
46
+ "@atlaskit/tooltip": "^18.1.0",
46
47
  "@atlaskit/ufo": "^0.2.0",
47
48
  "@atlaskit/util-service-support": "^6.2.0",
48
49
  "@atlaskit/visually-hidden": "^1.2.0",