@atlaskit/emoji 67.4.10 → 67.5.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 CHANGED
@@ -1,5 +1,21 @@
1
1
  # @atlaskit/emoji
2
2
 
3
+ ## 67.5.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`6900f89eb0e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6900f89eb0e) - Internal changes to use space tokens. There is no expected visual or behaviour change.
8
+
9
+ ## 67.5.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`630ece558fe`](https://bitbucket.org/atlassian/atlassian-frontend/commits/630ece558fe) - Added onlyFetchOnDemand config to disable fetching by default in EmojiCommonProvider
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies
18
+
3
19
  ## 67.4.10
4
20
 
5
21
  ### Patch Changes
@@ -55,6 +55,7 @@ var EmojiResource = /*#__PURE__*/function (_ref) {
55
55
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "initialLoaders", 0);
56
56
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "retries", new Map());
57
57
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isInitialised", false);
58
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "fetchOnDemand", false);
58
59
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getOptimisticImageURL", function (emojiId) {
59
60
  if (_this.emojiProviderConfig.optimisticImageApi) {
60
61
  return _this.emojiProviderConfig.optimisticImageApi.getUrl(emojiId);
@@ -76,6 +77,7 @@ var EmojiResource = /*#__PURE__*/function (_ref) {
76
77
  if (config.providers.length === 0) {
77
78
  throw new Error('No providers specified');
78
79
  }
80
+ _this.fetchOnDemand = !!config.options && !!config.options.onlyFetchOnDemand;
79
81
  _this.initialLoaders = _this.emojiProviderConfig.providers.length;
80
82
  _this.activeLoaders = _this.emojiProviderConfig.providers.length;
81
83
  _this.emojiResponses = [];
@@ -96,7 +98,7 @@ var EmojiResource = /*#__PURE__*/function (_ref) {
96
98
  while (1) switch (_context.prev = _context.next) {
97
99
  case 0:
98
100
  options = _args.length > 0 && _args[0] !== undefined ? _args[0] : {
99
- fetchAtStart: true
101
+ fetchAtStart: !this.fetchOnDemand
100
102
  };
101
103
  if (!options.fetchAtStart) {
102
104
  _context.next = 11;
@@ -219,6 +221,11 @@ var EmojiResource = /*#__PURE__*/function (_ref) {
219
221
  }
220
222
  return fetchEmojiProvider;
221
223
  }()
224
+ }, {
225
+ key: "onlyFetchOnDemand",
226
+ value: function onlyFetchOnDemand() {
227
+ return this.fetchOnDemand;
228
+ }
222
229
  }, {
223
230
  key: "fetchByEmojiId",
224
231
  value: function () {
@@ -34,8 +34,8 @@ var deleteButton = (0, _react.css)({
34
34
  visibility: 'hidden',
35
35
  display: 'flex',
36
36
  position: 'absolute',
37
- top: '-8px',
38
- right: '-8px',
37
+ top: "var(--ds-space-negative-100, -8px)",
38
+ right: "var(--ds-space-negative-100, -8px)",
39
39
  zIndex: 1
40
40
  });
41
41
  exports.deleteButton = deleteButton;
@@ -136,7 +136,7 @@ var emojiButton = (0, _react.css)((_css3 = {
136
136
  border: '0 none',
137
137
  padding: 0
138
138
  }), (0, _defineProperty2.default)(_css3, '&>span', (_span = {
139
- padding: '6px'
139
+ padding: "var(--ds-space-075, 6px)"
140
140
  }, (0, _defineProperty2.default)(_span, "&>.".concat(emojiSprite), {
141
141
  height: '24px',
142
142
  width: '24px'
@@ -172,7 +172,7 @@ var previewText = (0, _react.css)({
172
172
  display: 'flex',
173
173
  flexDirection: 'column',
174
174
  alignSelf: 'center',
175
- marginTop: '-2px',
175
+ marginTop: "var(--ds-space-negative-025, -2px)",
176
176
  marginLeft: '10px',
177
177
  maxWidth: '285px',
178
178
  width: '285px' /* IE */,
@@ -195,9 +195,9 @@ var emojiShortName = (0, _react.css)((0, _defineProperty2.default)({
195
195
  color: "var(--ds-text-subtle, ".concat(_colors.N200, ")"),
196
196
  fontSize: '12px',
197
197
  lineHeight: 1,
198
- marginBottom: '-2px',
198
+ marginBottom: "var(--ds-space-negative-025, -2px)",
199
199
  overflow: 'hidden',
200
- paddingBottom: '2px',
200
+ paddingBottom: "var(--ds-space-025, 2px)",
201
201
  textOverflow: 'ellipsis',
202
202
  whiteSpace: 'nowrap'
203
203
  }, '&:first-of-type', {
@@ -321,7 +321,7 @@ exports.uploadPreview = uploadPreview;
321
321
  var uploadPreviewText = (0, _react.css)({
322
322
  h5: {
323
323
  color: "var(--ds-text-subtle, ".concat(_colors.N300, ")"),
324
- paddingBottom: '4px',
324
+ paddingBottom: "var(--ds-space-050, 4px)",
325
325
  fontSize: '12px'
326
326
  },
327
327
  img: {
@@ -331,7 +331,7 @@ var uploadPreviewText = (0, _react.css)({
331
331
  });
332
332
  exports.uploadPreviewText = uploadPreviewText;
333
333
  var bigEmojiPreview = (0, _react.css)({
334
- paddingLeft: '4px',
334
+ paddingLeft: "var(--ds-space-050, 4px)",
335
335
  img: {
336
336
  maxHeight: '40px',
337
337
  maxWidth: '100px'
@@ -382,7 +382,7 @@ var headingH5 = (0, _react.css)({
382
382
  });
383
383
  exports.headingH5 = headingH5;
384
384
  var requiredSymbol = (0, _react.css)({
385
- paddingLeft: "".concat((0, _constants2.gridSize)() / 4, "px"),
385
+ paddingLeft: "var(--ds-space-025, 2px)",
386
386
  color: "var(--ds-text-danger, ".concat(_colors.R400, ")"),
387
387
  fontFamily: (0, _constants2.fontFamily)()
388
388
  });
@@ -404,7 +404,7 @@ var deleteFooter = (0, _react.css)((0, _defineProperty2.default)({
404
404
  }, ".".concat(submitDelete), {
405
405
  width: '84px',
406
406
  fontWeight: 'bold',
407
- marginRight: '4px'
407
+ marginRight: "var(--ds-space-050, 4px)"
408
408
  }));
409
409
  exports.deleteFooter = deleteFooter;
410
410
  var emojiDeleteErrorMessage = (0, _react.css)({
@@ -412,7 +412,7 @@ var emojiDeleteErrorMessage = (0, _react.css)({
412
412
  color: "var(--ds-text-danger, ".concat(_colors.R400, ")"),
413
413
  alignItems: 'center',
414
414
  justifyContent: 'flex-end',
415
- paddingRight: '4px'
415
+ paddingRight: "var(--ds-space-050, 4px)"
416
416
  });
417
417
  exports.emojiDeleteErrorMessage = emojiDeleteErrorMessage;
418
418
  var emojiChooseFileErrorMessage = (0, _react.css)({
@@ -438,7 +438,7 @@ var uploadRetryButton = (0, _react.css)({
438
438
  maxWidth: '172px',
439
439
  justifyContent: 'center',
440
440
  fontWeight: 'bold',
441
- marginRight: '4px',
441
+ marginRight: "var(--ds-space-050, 4px)",
442
442
  div: {
443
443
  display: 'flex'
444
444
  }
@@ -447,7 +447,7 @@ exports.uploadRetryButton = uploadRetryButton;
447
447
  var uploadEmojiButton = (0, _react.css)({
448
448
  maxWidth: '187px',
449
449
  justifyContent: 'center',
450
- marginRight: '4px',
450
+ marginRight: "var(--ds-space-050, 4px)",
451
451
  div: {
452
452
  display: 'flex'
453
453
  }
@@ -471,7 +471,7 @@ exports.emojiActionsWrapper = emojiActionsWrapper;
471
471
  var tooltipShortcutStyle = (0, _react.css)({
472
472
  borderRadius: '3px',
473
473
  backgroundColor: "var(--ds-background-inverse-subtle, ".concat(_colors.N400, ")"),
474
- padding: '0 2px',
474
+ padding: "0 ".concat("var(--ds-space-025, 2px)"),
475
475
  /* TODO: fix in develop: https://atlassian.slack.com/archives/CFG3PSQ9E/p1647395052443259?thread_ts=1647394572.556029&cid=CFG3PSQ9E */
476
476
  /* stylelint-disable-next-line */
477
477
  label: 'tooltip-shortcut'
@@ -16,10 +16,10 @@ var emojiUploadWidget = (0, _react.css)({
16
16
  background: "var(--ds-surface-overlay, white)",
17
17
  height: "120px",
18
18
  width: "".concat(_constants.emojiPickerWidth, "px"),
19
- marginBottom: '8px',
19
+ marginBottom: "var(--ds-space-100, 8px)",
20
20
  minWidth: "".concat(_constants.emojiPickerWidth, "px"),
21
21
  margin: '-10px',
22
- marginTop: '-16px'
22
+ marginTop: "var(--ds-space-negative-200, -16px)"
23
23
  });
24
24
 
25
25
  /// Footer
@@ -47,7 +47,14 @@ var EmojiContextProvider = function EmojiContextProvider(_ref) {
47
47
  }));
48
48
  return _fetchEmojiProvider.apply(this, arguments);
49
49
  }
50
- fetchEmojiProvider();
50
+ if (memoizedEmojiContextValue !== null && memoizedEmojiContextValue !== void 0 && memoizedEmojiContextValue.emoji.emojiProvider.onlyFetchOnDemand) {
51
+ var isFetchingOnDemand = memoizedEmojiContextValue === null || memoizedEmojiContextValue === void 0 ? void 0 : memoizedEmojiContextValue.emoji.emojiProvider.onlyFetchOnDemand();
52
+ if (!isFetchingOnDemand) {
53
+ fetchEmojiProvider();
54
+ }
55
+ } else {
56
+ fetchEmojiProvider();
57
+ }
51
58
  }, [memoizedEmojiContextValue]);
52
59
  return /*#__PURE__*/_react.default.createElement(_EmojiContext.EmojiContext.Provider, {
53
60
  value: memoizedEmojiContextValue
@@ -20,7 +20,7 @@ var createEvent = function createEvent(eventType, action, actionSubject, actionS
20
20
  actionSubjectId: actionSubjectId,
21
21
  attributes: _objectSpread({
22
22
  packageName: "@atlaskit/emoji",
23
- packageVersion: "67.4.10"
23
+ packageVersion: "67.5.1"
24
24
  }, attributes)
25
25
  };
26
26
  };
@@ -30,6 +30,7 @@ export class EmojiResource extends AbstractResource {
30
30
  _defineProperty(this, "initialLoaders", 0);
31
31
  _defineProperty(this, "retries", new Map());
32
32
  _defineProperty(this, "isInitialised", false);
33
+ _defineProperty(this, "fetchOnDemand", false);
33
34
  _defineProperty(this, "getOptimisticImageURL", emojiId => {
34
35
  if (this.emojiProviderConfig.optimisticImageApi) {
35
36
  return this.emojiProviderConfig.optimisticImageApi.getUrl(emojiId);
@@ -49,6 +50,7 @@ export class EmojiResource extends AbstractResource {
49
50
  if (config.providers.length === 0) {
50
51
  throw new Error('No providers specified');
51
52
  }
53
+ this.fetchOnDemand = !!config.options && !!config.options.onlyFetchOnDemand;
52
54
  this.initialLoaders = this.emojiProviderConfig.providers.length;
53
55
  this.activeLoaders = this.emojiProviderConfig.providers.length;
54
56
  this.emojiResponses = [];
@@ -59,7 +61,7 @@ export class EmojiResource extends AbstractResource {
59
61
  * @returns Promise<EmojiProvider>
60
62
  */
61
63
  async getEmojiProvider(options = {
62
- fetchAtStart: true
64
+ fetchAtStart: !this.fetchOnDemand
63
65
  }) {
64
66
  if (options.fetchAtStart) {
65
67
  try {
@@ -118,6 +120,9 @@ export class EmojiResource extends AbstractResource {
118
120
  }
119
121
  return Promise.resolve(this.emojiRepository);
120
122
  }
123
+ onlyFetchOnDemand() {
124
+ return this.fetchOnDemand;
125
+ }
121
126
  async fetchByEmojiId(emojiId, optimistic) {
122
127
  // Check if repository exists and emoji is defined.
123
128
  if (this.isLoaded() && this.isRepositoryAvailable(this.emojiRepository)) {
@@ -2,7 +2,7 @@ import { css, keyframes } from '@emotion/react';
2
2
  import { defaultEmojiHeight } from '../../util/constants';
3
3
  import { akEmojiSelectedBackgroundColor } from '../../util/shared-styles';
4
4
  import { B100, N20, N200, N20A, N300, N400, N900, R300, R400 } from '@atlaskit/theme/colors';
5
- import { fontFamily as getFontFamily, gridSize as getGridSize } from '@atlaskit/theme/constants';
5
+ import { fontFamily as getFontFamily } from '@atlaskit/theme/constants';
6
6
  export const commonSelectedStyles = 'emoji-common-selected';
7
7
  export const selectOnHoverStyles = 'emoji-common-select-on-hover';
8
8
  export const emojiSprite = 'emoji-common-emoji-sprite';
@@ -16,8 +16,8 @@ export const deleteButton = css({
16
16
  visibility: 'hidden',
17
17
  display: 'flex',
18
18
  position: 'absolute',
19
- top: '-8px',
20
- right: '-8px',
19
+ top: "var(--ds-space-negative-100, -8px)",
20
+ right: "var(--ds-space-negative-100, -8px)",
21
21
  zIndex: 1
22
22
  });
23
23
  export const emojiToneSelectorContainer = css({
@@ -128,7 +128,7 @@ export const emojiButton = css({
128
128
  padding: 0
129
129
  },
130
130
  '&>span': {
131
- padding: '6px',
131
+ padding: "var(--ds-space-075, 6px)",
132
132
  // Scale sprite to fit regardless of default emoji size
133
133
  [`&>.${emojiSprite}`]: {
134
134
  height: '24px',
@@ -167,7 +167,7 @@ export const previewText = css({
167
167
  display: 'flex',
168
168
  flexDirection: 'column',
169
169
  alignSelf: 'center',
170
- marginTop: '-2px',
170
+ marginTop: "var(--ds-space-negative-025, -2px)",
171
171
  marginLeft: '10px',
172
172
  maxWidth: '285px',
173
173
  width: '285px' /* IE */,
@@ -189,9 +189,9 @@ export const emojiShortName = css({
189
189
  color: `var(--ds-text-subtle, ${N200})`,
190
190
  fontSize: '12px',
191
191
  lineHeight: 1,
192
- marginBottom: '-2px',
192
+ marginBottom: "var(--ds-space-negative-025, -2px)",
193
193
  overflow: 'hidden',
194
- paddingBottom: '2px',
194
+ paddingBottom: "var(--ds-space-025, 2px)",
195
195
  textOverflow: 'ellipsis',
196
196
  whiteSpace: 'nowrap',
197
197
  ['&:first-of-type']: {
@@ -308,7 +308,7 @@ export const uploadPreview = css({
308
308
  export const uploadPreviewText = css({
309
309
  h5: {
310
310
  color: `var(--ds-text-subtle, ${N300})`,
311
- paddingBottom: '4px',
311
+ paddingBottom: "var(--ds-space-050, 4px)",
312
312
  fontSize: '12px'
313
313
  },
314
314
  img: {
@@ -317,7 +317,7 @@ export const uploadPreviewText = css({
317
317
  }
318
318
  });
319
319
  export const bigEmojiPreview = css({
320
- paddingLeft: '4px',
320
+ paddingLeft: "var(--ds-space-050, 4px)",
321
321
  img: {
322
322
  maxHeight: '40px',
323
323
  maxWidth: '100px'
@@ -362,7 +362,7 @@ export const headingH5 = css({
362
362
  }
363
363
  });
364
364
  export const requiredSymbol = css({
365
- paddingLeft: `${getGridSize() / 4}px`,
365
+ paddingLeft: "var(--ds-space-025, 2px)",
366
366
  color: `var(--ds-text-danger, ${R400})`,
367
367
  fontFamily: getFontFamily()
368
368
  });
@@ -382,7 +382,7 @@ export const deleteFooter = css({
382
382
  [`.${submitDelete}`]: {
383
383
  width: '84px',
384
384
  fontWeight: 'bold',
385
- marginRight: '4px'
385
+ marginRight: "var(--ds-space-050, 4px)"
386
386
  }
387
387
  });
388
388
  export const emojiDeleteErrorMessage = css({
@@ -390,7 +390,7 @@ export const emojiDeleteErrorMessage = css({
390
390
  color: `var(--ds-text-danger, ${R400})`,
391
391
  alignItems: 'center',
392
392
  justifyContent: 'flex-end',
393
- paddingRight: '4px'
393
+ paddingRight: "var(--ds-space-050, 4px)"
394
394
  });
395
395
  export const emojiChooseFileErrorMessage = css({
396
396
  display: 'flex',
@@ -412,7 +412,7 @@ export const uploadRetryButton = css({
412
412
  maxWidth: '172px',
413
413
  justifyContent: 'center',
414
414
  fontWeight: 'bold',
415
- marginRight: '4px',
415
+ marginRight: "var(--ds-space-050, 4px)",
416
416
  div: {
417
417
  display: 'flex'
418
418
  }
@@ -420,7 +420,7 @@ export const uploadRetryButton = css({
420
420
  export const uploadEmojiButton = css({
421
421
  maxWidth: '187px',
422
422
  justifyContent: 'center',
423
- marginRight: '4px',
423
+ marginRight: "var(--ds-space-050, 4px)",
424
424
  div: {
425
425
  display: 'flex'
426
426
  }
@@ -440,7 +440,7 @@ export const emojiActionsWrapper = css({
440
440
  export const tooltipShortcutStyle = css({
441
441
  borderRadius: '3px',
442
442
  backgroundColor: `var(--ds-background-inverse-subtle, ${N400})`,
443
- padding: '0 2px',
443
+ padding: `0 ${"var(--ds-space-025, 2px)"}`,
444
444
  /* TODO: fix in develop: https://atlassian.slack.com/archives/CFG3PSQ9E/p1647395052443259?thread_ts=1647394572.556029&cid=CFG3PSQ9E */
445
445
  /* stylelint-disable-next-line */
446
446
  label: 'tooltip-shortcut'
@@ -11,10 +11,10 @@ export const emojiUploadWidget = css({
11
11
  background: "var(--ds-surface-overlay, white)",
12
12
  height: `120px`,
13
13
  width: `${emojiPickerWidth}px`,
14
- marginBottom: '8px',
14
+ marginBottom: "var(--ds-space-100, 8px)",
15
15
  minWidth: `${emojiPickerWidth}px`,
16
16
  margin: '-10px',
17
- marginTop: '-16px'
17
+ marginTop: "var(--ds-space-negative-200, -16px)"
18
18
  });
19
19
 
20
20
  /// Footer
@@ -15,7 +15,14 @@ export const EmojiContextProvider = ({
15
15
  debug('fetchEmojiProvider error catched from outside', error);
16
16
  }
17
17
  }
18
- fetchEmojiProvider();
18
+ if (memoizedEmojiContextValue !== null && memoizedEmojiContextValue !== void 0 && memoizedEmojiContextValue.emoji.emojiProvider.onlyFetchOnDemand) {
19
+ const isFetchingOnDemand = memoizedEmojiContextValue === null || memoizedEmojiContextValue === void 0 ? void 0 : memoizedEmojiContextValue.emoji.emojiProvider.onlyFetchOnDemand();
20
+ if (!isFetchingOnDemand) {
21
+ fetchEmojiProvider();
22
+ }
23
+ } else {
24
+ fetchEmojiProvider();
25
+ }
19
26
  }, [memoizedEmojiContextValue]);
20
27
  return /*#__PURE__*/React.createElement(EmojiContext.Provider, {
21
28
  value: memoizedEmojiContextValue
@@ -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.4.10",
10
+ packageVersion: "67.5.1",
11
11
  ...attributes
12
12
  }
13
13
  });
@@ -47,6 +47,7 @@ export var EmojiResource = /*#__PURE__*/function (_ref) {
47
47
  _defineProperty(_assertThisInitialized(_this), "initialLoaders", 0);
48
48
  _defineProperty(_assertThisInitialized(_this), "retries", new Map());
49
49
  _defineProperty(_assertThisInitialized(_this), "isInitialised", false);
50
+ _defineProperty(_assertThisInitialized(_this), "fetchOnDemand", false);
50
51
  _defineProperty(_assertThisInitialized(_this), "getOptimisticImageURL", function (emojiId) {
51
52
  if (_this.emojiProviderConfig.optimisticImageApi) {
52
53
  return _this.emojiProviderConfig.optimisticImageApi.getUrl(emojiId);
@@ -68,6 +69,7 @@ export var EmojiResource = /*#__PURE__*/function (_ref) {
68
69
  if (config.providers.length === 0) {
69
70
  throw new Error('No providers specified');
70
71
  }
72
+ _this.fetchOnDemand = !!config.options && !!config.options.onlyFetchOnDemand;
71
73
  _this.initialLoaders = _this.emojiProviderConfig.providers.length;
72
74
  _this.activeLoaders = _this.emojiProviderConfig.providers.length;
73
75
  _this.emojiResponses = [];
@@ -88,7 +90,7 @@ export var EmojiResource = /*#__PURE__*/function (_ref) {
88
90
  while (1) switch (_context.prev = _context.next) {
89
91
  case 0:
90
92
  options = _args.length > 0 && _args[0] !== undefined ? _args[0] : {
91
- fetchAtStart: true
93
+ fetchAtStart: !this.fetchOnDemand
92
94
  };
93
95
  if (!options.fetchAtStart) {
94
96
  _context.next = 11;
@@ -211,6 +213,11 @@ export var EmojiResource = /*#__PURE__*/function (_ref) {
211
213
  }
212
214
  return fetchEmojiProvider;
213
215
  }()
216
+ }, {
217
+ key: "onlyFetchOnDemand",
218
+ value: function onlyFetchOnDemand() {
219
+ return this.fetchOnDemand;
220
+ }
214
221
  }, {
215
222
  key: "fetchByEmojiId",
216
223
  value: function () {
@@ -5,7 +5,7 @@ import { css, keyframes } from '@emotion/react';
5
5
  import { defaultEmojiHeight } from '../../util/constants';
6
6
  import { akEmojiSelectedBackgroundColor } from '../../util/shared-styles';
7
7
  import { B100, N20, N200, N20A, N300, N400, N900, R300, R400 } from '@atlaskit/theme/colors';
8
- import { fontFamily as getFontFamily, gridSize as getGridSize } from '@atlaskit/theme/constants';
8
+ import { fontFamily as getFontFamily } from '@atlaskit/theme/constants';
9
9
  export var commonSelectedStyles = 'emoji-common-selected';
10
10
  export var selectOnHoverStyles = 'emoji-common-select-on-hover';
11
11
  export var emojiSprite = 'emoji-common-emoji-sprite';
@@ -19,8 +19,8 @@ export var deleteButton = css({
19
19
  visibility: 'hidden',
20
20
  display: 'flex',
21
21
  position: 'absolute',
22
- top: '-8px',
23
- right: '-8px',
22
+ top: "var(--ds-space-negative-100, -8px)",
23
+ right: "var(--ds-space-negative-100, -8px)",
24
24
  zIndex: 1
25
25
  });
26
26
  export var emojiToneSelectorContainer = css({
@@ -113,7 +113,7 @@ export var emojiButton = css((_css3 = {
113
113
  border: '0 none',
114
114
  padding: 0
115
115
  }), _defineProperty(_css3, '&>span', (_span = {
116
- padding: '6px'
116
+ padding: "var(--ds-space-075, 6px)"
117
117
  }, _defineProperty(_span, "&>.".concat(emojiSprite), {
118
118
  height: '24px',
119
119
  width: '24px'
@@ -146,7 +146,7 @@ export var previewText = css({
146
146
  display: 'flex',
147
147
  flexDirection: 'column',
148
148
  alignSelf: 'center',
149
- marginTop: '-2px',
149
+ marginTop: "var(--ds-space-negative-025, -2px)",
150
150
  marginLeft: '10px',
151
151
  maxWidth: '285px',
152
152
  width: '285px' /* IE */,
@@ -167,9 +167,9 @@ export var emojiShortName = css(_defineProperty({
167
167
  color: "var(--ds-text-subtle, ".concat(N200, ")"),
168
168
  fontSize: '12px',
169
169
  lineHeight: 1,
170
- marginBottom: '-2px',
170
+ marginBottom: "var(--ds-space-negative-025, -2px)",
171
171
  overflow: 'hidden',
172
- paddingBottom: '2px',
172
+ paddingBottom: "var(--ds-space-025, 2px)",
173
173
  textOverflow: 'ellipsis',
174
174
  whiteSpace: 'nowrap'
175
175
  }, '&:first-of-type', {
@@ -281,7 +281,7 @@ export var uploadPreview = css({
281
281
  export var uploadPreviewText = css({
282
282
  h5: {
283
283
  color: "var(--ds-text-subtle, ".concat(N300, ")"),
284
- paddingBottom: '4px',
284
+ paddingBottom: "var(--ds-space-050, 4px)",
285
285
  fontSize: '12px'
286
286
  },
287
287
  img: {
@@ -290,7 +290,7 @@ export var uploadPreviewText = css({
290
290
  }
291
291
  });
292
292
  export var bigEmojiPreview = css({
293
- paddingLeft: '4px',
293
+ paddingLeft: "var(--ds-space-050, 4px)",
294
294
  img: {
295
295
  maxHeight: '40px',
296
296
  maxWidth: '100px'
@@ -335,7 +335,7 @@ export var headingH5 = css({
335
335
  }
336
336
  });
337
337
  export var requiredSymbol = css({
338
- paddingLeft: "".concat(getGridSize() / 4, "px"),
338
+ paddingLeft: "var(--ds-space-025, 2px)",
339
339
  color: "var(--ds-text-danger, ".concat(R400, ")"),
340
340
  fontFamily: getFontFamily()
341
341
  });
@@ -355,14 +355,14 @@ export var deleteFooter = css(_defineProperty({
355
355
  }, ".".concat(submitDelete), {
356
356
  width: '84px',
357
357
  fontWeight: 'bold',
358
- marginRight: '4px'
358
+ marginRight: "var(--ds-space-050, 4px)"
359
359
  }));
360
360
  export var emojiDeleteErrorMessage = css({
361
361
  display: 'flex',
362
362
  color: "var(--ds-text-danger, ".concat(R400, ")"),
363
363
  alignItems: 'center',
364
364
  justifyContent: 'flex-end',
365
- paddingRight: '4px'
365
+ paddingRight: "var(--ds-space-050, 4px)"
366
366
  });
367
367
  export var emojiChooseFileErrorMessage = css({
368
368
  display: 'flex',
@@ -384,7 +384,7 @@ export var uploadRetryButton = css({
384
384
  maxWidth: '172px',
385
385
  justifyContent: 'center',
386
386
  fontWeight: 'bold',
387
- marginRight: '4px',
387
+ marginRight: "var(--ds-space-050, 4px)",
388
388
  div: {
389
389
  display: 'flex'
390
390
  }
@@ -392,7 +392,7 @@ export var uploadRetryButton = css({
392
392
  export var uploadEmojiButton = css({
393
393
  maxWidth: '187px',
394
394
  justifyContent: 'center',
395
- marginRight: '4px',
395
+ marginRight: "var(--ds-space-050, 4px)",
396
396
  div: {
397
397
  display: 'flex'
398
398
  }
@@ -412,7 +412,7 @@ export var emojiActionsWrapper = css({
412
412
  export var tooltipShortcutStyle = css({
413
413
  borderRadius: '3px',
414
414
  backgroundColor: "var(--ds-background-inverse-subtle, ".concat(N400, ")"),
415
- padding: '0 2px',
415
+ padding: "0 ".concat("var(--ds-space-025, 2px)"),
416
416
  /* TODO: fix in develop: https://atlassian.slack.com/archives/CFG3PSQ9E/p1647395052443259?thread_ts=1647394572.556029&cid=CFG3PSQ9E */
417
417
  /* stylelint-disable-next-line */
418
418
  label: 'tooltip-shortcut'
@@ -11,10 +11,10 @@ export var emojiUploadWidget = css({
11
11
  background: "var(--ds-surface-overlay, white)",
12
12
  height: "120px",
13
13
  width: "".concat(emojiPickerWidth, "px"),
14
- marginBottom: '8px',
14
+ marginBottom: "var(--ds-space-100, 8px)",
15
15
  minWidth: "".concat(emojiPickerWidth, "px"),
16
16
  margin: '-10px',
17
- marginTop: '-16px'
17
+ marginTop: "var(--ds-space-negative-200, -16px)"
18
18
  });
19
19
 
20
20
  /// Footer
@@ -37,7 +37,14 @@ export var EmojiContextProvider = function EmojiContextProvider(_ref) {
37
37
  }));
38
38
  return _fetchEmojiProvider.apply(this, arguments);
39
39
  }
40
- fetchEmojiProvider();
40
+ if (memoizedEmojiContextValue !== null && memoizedEmojiContextValue !== void 0 && memoizedEmojiContextValue.emoji.emojiProvider.onlyFetchOnDemand) {
41
+ var isFetchingOnDemand = memoizedEmojiContextValue === null || memoizedEmojiContextValue === void 0 ? void 0 : memoizedEmojiContextValue.emoji.emojiProvider.onlyFetchOnDemand();
42
+ if (!isFetchingOnDemand) {
43
+ fetchEmojiProvider();
44
+ }
45
+ } else {
46
+ fetchEmojiProvider();
47
+ }
41
48
  }, [memoizedEmojiContextValue]);
42
49
  return /*#__PURE__*/React.createElement(EmojiContext.Provider, {
43
50
  value: memoizedEmojiContextValue
@@ -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.4.10"
15
+ packageVersion: "67.5.1"
16
16
  }, attributes)
17
17
  };
18
18
  };
@@ -3,7 +3,7 @@ import { CategoryId } from '../components/picker/categories';
3
3
  import { EmojiDescription, EmojiId, EmojiProvider, EmojiResponse, EmojiSearchResult, EmojiUpload, OptionalEmojiDescription, OptionalEmojiDescriptionWithVariations, OptionalUser, SearchOptions, ToneSelection, UploadingEmojiProvider, User } from '../types';
4
4
  import EmojiRepository from './EmojiRepository';
5
5
  import SiteEmojiResource from './media/SiteEmojiResource';
6
- import { OptimisticImageApiLoaderConfig, SingleEmojiApiLoaderConfig } from './EmojiUtils';
6
+ import { OptimisticImageApiLoaderConfig, Options, SingleEmojiApiLoaderConfig } from './EmojiUtils';
7
7
  interface GetEmojiProviderOptions {
8
8
  /**
9
9
  * Whether fetch emoji provider at start
@@ -23,6 +23,11 @@ export interface EmojiResourceConfig {
23
23
  * providers when performing shortName based look up.
24
24
  */
25
25
  providers: ServiceConfig[];
26
+ /**
27
+ * Additional configuration:
28
+ * * On-demand Fetching - Useful for when a product may prefer manually controlling when providers are fetched
29
+ */
30
+ options?: Options;
26
31
  /**
27
32
  * Must be set to true to enable upload support in the emoji components.
28
33
  *
@@ -80,6 +85,7 @@ export declare class EmojiResource extends AbstractResource<string, EmojiSearchR
80
85
  protected selectedTone: ToneSelection;
81
86
  protected currentUser?: User;
82
87
  protected isInitialised: boolean;
88
+ protected fetchOnDemand: boolean;
83
89
  protected emojiResponses: EmojiResponse[];
84
90
  emojiProviderConfig: EmojiResourceConfig;
85
91
  constructor(config: EmojiResourceConfig);
@@ -90,6 +96,7 @@ export declare class EmojiResource extends AbstractResource<string, EmojiSearchR
90
96
  getEmojiProvider(options?: GetEmojiProviderOptions): Promise<EmojiProvider>;
91
97
  private fetchIndividualProvider;
92
98
  fetchEmojiProvider(force?: boolean): Promise<EmojiRepository | undefined>;
99
+ onlyFetchOnDemand(): boolean;
93
100
  fetchByEmojiId(emojiId: EmojiId, optimistic: boolean): Promise<OptionalEmojiDescriptionWithVariations>;
94
101
  private getProviderType;
95
102
  protected initEmojiRepository(emojiResponses: EmojiResponse[]): void;
@@ -3,6 +3,9 @@ import { AltRepresentations, EmojiDescription, EmojiDescriptionWithVariations, E
3
3
  export interface EmojiLoaderConfig extends ServiceConfig {
4
4
  getRatio?: () => number;
5
5
  }
6
+ export interface Options {
7
+ onlyFetchOnDemand?: boolean;
8
+ }
6
9
  export interface SingleEmojiApiLoaderConfig extends Omit<ServiceConfig, 'url'> {
7
10
  getUrl: (emojiId: EmojiId) => string;
8
11
  }
@@ -121,6 +121,12 @@ export interface EmojiProvider extends Provider<string, EmojiSearchResult, any,
121
121
  * Returns a constructed URL to fetch emoji media asset if 'optimisticImageApi' config has been provided
122
122
  */
123
123
  getOptimisticImageURL(emojiId: EmojiId): string | undefined;
124
+ /**
125
+ * @return a boolean indicating whether providers should be fetched on-demand only, and automatic fetches prevented
126
+ *
127
+ * Optional.
128
+ */
129
+ onlyFetchOnDemand?(): boolean;
124
130
  }
125
131
  export interface UploadingEmojiProvider extends EmojiProvider {
126
132
  /**
@@ -3,7 +3,7 @@ import { CategoryId } from '../components/picker/categories';
3
3
  import { EmojiDescription, EmojiId, EmojiProvider, EmojiResponse, EmojiSearchResult, EmojiUpload, OptionalEmojiDescription, OptionalEmojiDescriptionWithVariations, OptionalUser, SearchOptions, ToneSelection, UploadingEmojiProvider, User } from '../types';
4
4
  import EmojiRepository from './EmojiRepository';
5
5
  import SiteEmojiResource from './media/SiteEmojiResource';
6
- import { OptimisticImageApiLoaderConfig, SingleEmojiApiLoaderConfig } from './EmojiUtils';
6
+ import { OptimisticImageApiLoaderConfig, Options, SingleEmojiApiLoaderConfig } from './EmojiUtils';
7
7
  interface GetEmojiProviderOptions {
8
8
  /**
9
9
  * Whether fetch emoji provider at start
@@ -23,6 +23,11 @@ export interface EmojiResourceConfig {
23
23
  * providers when performing shortName based look up.
24
24
  */
25
25
  providers: ServiceConfig[];
26
+ /**
27
+ * Additional configuration:
28
+ * * On-demand Fetching - Useful for when a product may prefer manually controlling when providers are fetched
29
+ */
30
+ options?: Options;
26
31
  /**
27
32
  * Must be set to true to enable upload support in the emoji components.
28
33
  *
@@ -80,6 +85,7 @@ export declare class EmojiResource extends AbstractResource<string, EmojiSearchR
80
85
  protected selectedTone: ToneSelection;
81
86
  protected currentUser?: User;
82
87
  protected isInitialised: boolean;
88
+ protected fetchOnDemand: boolean;
83
89
  protected emojiResponses: EmojiResponse[];
84
90
  emojiProviderConfig: EmojiResourceConfig;
85
91
  constructor(config: EmojiResourceConfig);
@@ -90,6 +96,7 @@ export declare class EmojiResource extends AbstractResource<string, EmojiSearchR
90
96
  getEmojiProvider(options?: GetEmojiProviderOptions): Promise<EmojiProvider>;
91
97
  private fetchIndividualProvider;
92
98
  fetchEmojiProvider(force?: boolean): Promise<EmojiRepository | undefined>;
99
+ onlyFetchOnDemand(): boolean;
93
100
  fetchByEmojiId(emojiId: EmojiId, optimistic: boolean): Promise<OptionalEmojiDescriptionWithVariations>;
94
101
  private getProviderType;
95
102
  protected initEmojiRepository(emojiResponses: EmojiResponse[]): void;
@@ -3,6 +3,9 @@ import { AltRepresentations, EmojiDescription, EmojiDescriptionWithVariations, E
3
3
  export interface EmojiLoaderConfig extends ServiceConfig {
4
4
  getRatio?: () => number;
5
5
  }
6
+ export interface Options {
7
+ onlyFetchOnDemand?: boolean;
8
+ }
6
9
  export interface SingleEmojiApiLoaderConfig extends Omit<ServiceConfig, 'url'> {
7
10
  getUrl: (emojiId: EmojiId) => string;
8
11
  }
@@ -121,6 +121,12 @@ export interface EmojiProvider extends Provider<string, EmojiSearchResult, any,
121
121
  * Returns a constructed URL to fetch emoji media asset if 'optimisticImageApi' config has been provided
122
122
  */
123
123
  getOptimisticImageURL(emojiId: EmojiId): string | undefined;
124
+ /**
125
+ * @return a boolean indicating whether providers should be fetched on-demand only, and automatic fetches prevented
126
+ *
127
+ * Optional.
128
+ */
129
+ onlyFetchOnDemand?(): boolean;
124
130
  }
125
131
  export interface UploadingEmojiProvider extends EmojiProvider {
126
132
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/emoji",
3
- "version": "67.4.10",
3
+ "version": "67.5.1",
4
4
  "description": "Fabric emoji React components",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -34,13 +34,13 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@atlaskit/analytics-next": "^9.1.0",
37
- "@atlaskit/button": "^16.9.0",
37
+ "@atlaskit/button": "^16.10.0",
38
38
  "@atlaskit/icon": "^21.12.0",
39
39
  "@atlaskit/media-client": "^24.0.0",
40
40
  "@atlaskit/spinner": "^15.5.0",
41
41
  "@atlaskit/textfield": "^5.6.0",
42
42
  "@atlaskit/theme": "^12.6.0",
43
- "@atlaskit/tokens": "^1.20.0",
43
+ "@atlaskit/tokens": "^1.21.0",
44
44
  "@atlaskit/tooltip": "^17.8.0",
45
45
  "@atlaskit/ufo": "^0.2.0",
46
46
  "@atlaskit/util-service-support": "^6.2.0",
package/report.api.md CHANGED
@@ -291,6 +291,7 @@ export interface EmojiProvider
291
291
  emoji: EmojiDescription,
292
292
  useAlt?: boolean,
293
293
  ): OptionalEmojiDescription | Promise<OptionalEmojiDescription>;
294
+ onlyFetchOnDemand?(): boolean;
294
295
  optimisticMediaRendering(emoji: EmojiDescription, useAlt?: boolean): boolean;
295
296
  recordSelection?(emoji: EmojiDescription): Promise<any>;
296
297
  setSelectedTone(tone: ToneSelection): void;
@@ -384,6 +385,8 @@ class EmojiResource_2
384
385
  // (undocumented)
385
386
  fetchEmojiProvider(force?: boolean): Promise<EmojiRepository | undefined>;
386
387
  // (undocumented)
388
+ protected fetchOnDemand: boolean;
389
+ // (undocumented)
387
390
  filter(query?: string, options?: SearchOptions): void;
388
391
  // (undocumented)
389
392
  findByEmojiId(
@@ -438,6 +441,8 @@ class EmojiResource_2
438
441
  // (undocumented)
439
442
  protected notifyResult(result: EmojiSearchResult): void;
440
443
  // (undocumented)
444
+ onlyFetchOnDemand(): boolean;
445
+ // (undocumented)
441
446
  optimisticMediaRendering(emoji: EmojiDescription, useAlt?: boolean): boolean;
442
447
  // (undocumented)
443
448
  protected recordConfig?: ServiceConfig;
@@ -461,6 +466,7 @@ export interface EmojiResourceConfig {
461
466
  allowUpload?: boolean;
462
467
  currentUser?: User;
463
468
  optimisticImageApi?: OptimisticImageApiLoaderConfig;
469
+ options?: Options;
464
470
  providers: ServiceConfig[];
465
471
  recordConfig?: ServiceConfig;
466
472
  singleEmojiApi?: SingleEmojiApiLoaderConfig;
@@ -978,6 +984,12 @@ export type OptionalEmojiDescriptionWithVariations =
978
984
  // @public (undocumented)
979
985
  export type OptionalUser = User | undefined;
980
986
 
987
+ // @public (undocumented)
988
+ interface Options {
989
+ // (undocumented)
990
+ onlyFetchOnDemand?: boolean;
991
+ }
992
+
981
993
  // @public (undocumented)
982
994
  interface PickerRefHandler {
983
995
  // (undocumented)
@@ -229,6 +229,7 @@ export interface EmojiProvider extends Provider<string, EmojiSearchResult, any,
229
229
  getOptimisticImageURL(emojiId: EmojiId): string | undefined;
230
230
  getSelectedTone(): ToneSelection;
231
231
  loadMediaEmoji(emoji: EmojiDescription, useAlt?: boolean): OptionalEmojiDescription | Promise<OptionalEmojiDescription>;
232
+ onlyFetchOnDemand?(): boolean;
232
233
  optimisticMediaRendering(emoji: EmojiDescription, useAlt?: boolean): boolean;
233
234
  recordSelection?(emoji: EmojiDescription): Promise<any>;
234
235
  setSelectedTone(tone: ToneSelection): void;
@@ -300,6 +301,8 @@ class EmojiResource_2 extends AbstractResource<string, EmojiSearchResult, any, u
300
301
  // (undocumented)
301
302
  fetchEmojiProvider(force?: boolean): Promise<EmojiRepository | undefined>;
302
303
  // (undocumented)
304
+ protected fetchOnDemand: boolean;
305
+ // (undocumented)
303
306
  filter(query?: string, options?: SearchOptions): void;
304
307
  // (undocumented)
305
308
  findByEmojiId(emojiId: EmojiId): OptionalEmojiDescription | Promise<OptionalEmojiDescription>;
@@ -338,6 +341,8 @@ class EmojiResource_2 extends AbstractResource<string, EmojiSearchResult, any, u
338
341
  // (undocumented)
339
342
  protected notifyResult(result: EmojiSearchResult): void;
340
343
  // (undocumented)
344
+ onlyFetchOnDemand(): boolean;
345
+ // (undocumented)
341
346
  optimisticMediaRendering(emoji: EmojiDescription, useAlt?: boolean): boolean;
342
347
  // (undocumented)
343
348
  protected recordConfig?: ServiceConfig;
@@ -361,6 +366,7 @@ export interface EmojiResourceConfig {
361
366
  allowUpload?: boolean;
362
367
  currentUser?: User;
363
368
  optimisticImageApi?: OptimisticImageApiLoaderConfig;
369
+ options?: Options;
364
370
  providers: ServiceConfig[];
365
371
  recordConfig?: ServiceConfig;
366
372
  singleEmojiApi?: SingleEmojiApiLoaderConfig;
@@ -855,6 +861,12 @@ export type OptionalEmojiDescriptionWithVariations = EmojiDescriptionWithVariati
855
861
  // @public (undocumented)
856
862
  export type OptionalUser = User | undefined;
857
863
 
864
+ // @public (undocumented)
865
+ interface Options {
866
+ // (undocumented)
867
+ onlyFetchOnDemand?: boolean;
868
+ }
869
+
858
870
  // @public (undocumented)
859
871
  interface PickerRefHandler {
860
872
  // (undocumented)