@atlaskit/editor-common 94.14.2 → 94.16.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.
Files changed (43) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/cjs/element-browser/ElementBrowser.js +4 -2
  3. package/dist/cjs/element-browser/components/ElementList/ElementList.js +366 -21
  4. package/dist/cjs/element-browser/components/StatelessElementBrowser.js +14 -7
  5. package/dist/cjs/element-browser/constants.js +1 -1
  6. package/dist/cjs/monitoring/error.js +1 -1
  7. package/dist/cjs/quick-insert/utils.js +10 -5
  8. package/dist/cjs/ui/DropList/index.js +1 -1
  9. package/dist/es2019/element-browser/ElementBrowser.js +4 -2
  10. package/dist/es2019/element-browser/components/ElementList/ElementList.js +351 -5
  11. package/dist/es2019/element-browser/components/StatelessElementBrowser.js +14 -7
  12. package/dist/es2019/element-browser/constants.js +1 -1
  13. package/dist/es2019/monitoring/error.js +1 -1
  14. package/dist/es2019/quick-insert/utils.js +10 -5
  15. package/dist/es2019/ui/DropList/index.js +1 -1
  16. package/dist/esm/element-browser/ElementBrowser.js +4 -2
  17. package/dist/esm/element-browser/components/ElementList/ElementList.js +365 -20
  18. package/dist/esm/element-browser/components/StatelessElementBrowser.js +14 -7
  19. package/dist/esm/element-browser/constants.js +1 -1
  20. package/dist/esm/monitoring/error.js +1 -1
  21. package/dist/esm/quick-insert/utils.js +10 -5
  22. package/dist/esm/ui/DropList/index.js +1 -1
  23. package/dist/types/analytics/index.d.ts +1 -0
  24. package/dist/types/element-browser/ElementBrowser.d.ts +2 -0
  25. package/dist/types/element-browser/components/ElementList/ElementList.d.ts +2 -0
  26. package/dist/types/element-browser/components/StatelessElementBrowser.d.ts +4 -1
  27. package/dist/types/element-browser/constants.d.ts +1 -1
  28. package/dist/types/extensibility/index.d.ts +1 -0
  29. package/dist/types/provider-factory.d.ts +1 -0
  30. package/dist/types/quick-insert/utils.d.ts +1 -1
  31. package/dist/types/types/index.d.ts +1 -1
  32. package/dist/types/types/quick-insert.d.ts +3 -3
  33. package/dist/types-ts4.5/analytics/index.d.ts +1 -0
  34. package/dist/types-ts4.5/element-browser/ElementBrowser.d.ts +2 -0
  35. package/dist/types-ts4.5/element-browser/components/ElementList/ElementList.d.ts +2 -0
  36. package/dist/types-ts4.5/element-browser/components/StatelessElementBrowser.d.ts +4 -1
  37. package/dist/types-ts4.5/element-browser/constants.d.ts +1 -1
  38. package/dist/types-ts4.5/extensibility/index.d.ts +1 -0
  39. package/dist/types-ts4.5/provider-factory.d.ts +1 -0
  40. package/dist/types-ts4.5/quick-insert/utils.d.ts +1 -1
  41. package/dist/types-ts4.5/types/index.d.ts +1 -1
  42. package/dist/types-ts4.5/types/quick-insert.d.ts +3 -3
  43. package/package.json +10 -7
@@ -1,7 +1,8 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
- var _excluded = ["items", "mode", "selectedItemIndex", "focusedItemIndex", "columnCount", "setColumnCount", "createAnalyticsEvent", "emptyStateHandler", "selectedCategory", "selectedCategoryIndex", "searchTerm", "setFocusedCategoryIndex", "setFocusedItemIndex"];
4
+ var _excluded = ["items", "mode", "selectedItemIndex", "focusedItemIndex", "columnCount", "setColumnCount", "createAnalyticsEvent", "emptyStateHandler", "selectedCategory", "selectedCategoryIndex", "searchTerm", "setFocusedCategoryIndex", "setFocusedItemIndex"],
5
+ _excluded2 = ["items", "mode", "selectedItemIndex", "focusedItemIndex", "columnCount", "setColumnCount", "createAnalyticsEvent", "emptyStateHandler", "selectedCategory", "selectedCategoryIndex", "searchTerm", "setFocusedCategoryIndex", "setFocusedItemIndex"];
5
6
  /**
6
7
  * @jsxRuntime classic
7
8
  * @jsx jsx
@@ -10,7 +11,7 @@ import React, { Fragment, memo, useCallback, useEffect, useMemo, useState } from
10
11
 
11
12
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
12
13
  import { css, jsx } from '@emotion/react';
13
- import { Grid } from 'react-virtualized';
14
+ import { Grid, List } from 'react-virtualized';
14
15
  import { AutoSizer } from 'react-virtualized/dist/commonjs/AutoSizer';
15
16
  import { CellMeasurer, CellMeasurerCache } from 'react-virtualized/dist/commonjs/CellMeasurer';
16
17
  import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext';
@@ -49,7 +50,7 @@ export var itemIcon = css({
49
50
  height: "".concat(ICON_HEIGHT, "px")
50
51
  }
51
52
  });
52
- function ElementList(_ref) {
53
+ function ElementListOld(_ref) {
53
54
  var items = _ref.items,
54
55
  mode = _ref.mode,
55
56
  selectedItemIndex = _ref.selectedItemIndex,
@@ -98,8 +99,8 @@ function ElementList(_ref) {
98
99
  // eslint-disable-next-line react-hooks/exhaustive-deps
99
100
  var cache = new CellMeasurerCache({
100
101
  fixedWidth: true,
101
- defaultHeight: ELEMENT_ITEM_HEIGHT,
102
- minHeight: ELEMENT_ITEM_HEIGHT
102
+ defaultHeight: 75,
103
+ minHeight: 75
103
104
  });
104
105
  var columnWidth = (containerWidth - ELEMENT_ITEM_PADDING * 2) / columnCount;
105
106
  var rowCount = Math.ceil(items.length / columnCount);
@@ -107,7 +108,7 @@ function ElementList(_ref) {
107
108
  var index = _ref2.index;
108
109
  return cache.rowHeight({
109
110
  index: index
110
- }) <= ELEMENT_ITEM_HEIGHT ? ELEMENT_ITEM_HEIGHT : cache.rowHeight({
111
+ }) <= 75 ? 75 : cache.rowHeight({
111
112
  index: index
112
113
  }) + ELEMENT_ITEM_PADDING * 2;
113
114
  };
@@ -207,16 +208,301 @@ function ElementList(_ref) {
207
208
  }));
208
209
  }))));
209
210
  }
211
+ function ElementListNew(_ref5) {
212
+ var items = _ref5.items,
213
+ mode = _ref5.mode,
214
+ selectedItemIndex = _ref5.selectedItemIndex,
215
+ focusedItemIndex = _ref5.focusedItemIndex,
216
+ columnCount = _ref5.columnCount,
217
+ setColumnCount = _ref5.setColumnCount,
218
+ createAnalyticsEvent = _ref5.createAnalyticsEvent,
219
+ emptyStateHandler = _ref5.emptyStateHandler,
220
+ selectedCategory = _ref5.selectedCategory,
221
+ selectedCategoryIndex = _ref5.selectedCategoryIndex,
222
+ searchTerm = _ref5.searchTerm,
223
+ setFocusedCategoryIndex = _ref5.setFocusedCategoryIndex,
224
+ setFocusedItemIndex = _ref5.setFocusedItemIndex,
225
+ cache = _ref5.cache,
226
+ onInsertItem = _ref5.onInsertItem;
227
+ var _useContainerWidth2 = useContainerWidth(),
228
+ containerWidth = _useContainerWidth2.containerWidth,
229
+ ContainerWidthMonitor = _useContainerWidth2.ContainerWidthMonitor;
230
+ var _useState3 = useState(SCROLLBAR_WIDTH),
231
+ _useState4 = _slicedToArray(_useState3, 2),
232
+ scrollbarWidth = _useState4[0],
233
+ setScrollbarWidth = _useState4[1];
234
+ var fullMode = mode === Modes.full;
235
+ useEffect(function () {
236
+ /**
237
+ * More of an optimization condition.
238
+ * Initially the containerWidths are reported 0 twice.
239
+ **/
240
+ if (fullMode && containerWidth > 0) {
241
+ setColumnCount(getColumnCount(containerWidth));
242
+ var updatedScrollbarWidth = getScrollbarWidth();
243
+ if (updatedScrollbarWidth > 0) {
244
+ setScrollbarWidth(updatedScrollbarWidth);
245
+ }
246
+ }
247
+ }, [fullMode, containerWidth, setColumnCount, scrollbarWidth]);
248
+ var onExternalLinkClick = useCallback(function () {
249
+ fireAnalyticsEvent(createAnalyticsEvent)({
250
+ payload: {
251
+ action: ACTION.VISITED,
252
+ actionSubject: ACTION_SUBJECT.SMART_LINK,
253
+ eventType: EVENT_TYPE.TRACK
254
+ }
255
+ });
256
+ }, [createAnalyticsEvent]);
257
+
258
+ // eslint-disable-next-line react-hooks/exhaustive-deps
259
+ var listCache = cache !== null && cache !== void 0 ? cache : new CellMeasurerCache({
260
+ fixedWidth: true,
261
+ defaultHeight: ELEMENT_ITEM_HEIGHT,
262
+ minHeight: ELEMENT_ITEM_HEIGHT
263
+ });
264
+ useEffect(function () {
265
+ // need to recalculate values if we have the same items, but they're reordered
266
+ listCache.clearAll();
267
+ }, [listCache, searchTerm]);
268
+ var rowHeight = function rowHeight(_ref6) {
269
+ var index = _ref6.index;
270
+ return listCache.rowHeight({
271
+ index: index
272
+ });
273
+ };
274
+ return jsx(Fragment, null, jsx(ContainerWidthMonitor, null), jsx("div", {
275
+ css: elementItemsWrapper,
276
+ "data-testid": "element-items",
277
+ id: selectedCategory ? "browse-category-".concat(selectedCategory, "-tab") : 'browse-category-tab',
278
+ "aria-labelledby": selectedCategory ? "browse-category--".concat(selectedCategory, "-button") : 'browse-category-button',
279
+ role: "tabpanel",
280
+ tabIndex: items.length === 0 ? 0 : undefined
281
+ }, !items.length ? emptyStateHandler ? emptyStateHandler({
282
+ mode: mode,
283
+ selectedCategory: selectedCategory,
284
+ searchTerm: searchTerm
285
+ }) : jsx(EmptyState, {
286
+ onExternalLinkClick: onExternalLinkClick
287
+ }) : jsx(Fragment, null, containerWidth > 0 && jsx(AutoSizer, {
288
+ disableWidth: true
289
+ }, function (_ref7) {
290
+ var height = _ref7.height;
291
+ return columnCount === 1 ? jsx(ElementListSingleColumn, {
292
+ cache: listCache,
293
+ setFocusedCategoryIndex: setFocusedCategoryIndex,
294
+ selectedCategoryIndex: selectedCategoryIndex,
295
+ items: items,
296
+ setFocusedItemIndex: setFocusedItemIndex,
297
+ fullMode: fullMode,
298
+ selectedItemIndex: selectedItemIndex,
299
+ focusedItemIndex: focusedItemIndex,
300
+ rowHeight: rowHeight,
301
+ containerWidth: containerWidth,
302
+ height: height,
303
+ onInsertItem: onInsertItem
304
+ }) : jsx(ElementListMultipleColumns, {
305
+ columnCount: columnCount,
306
+ cache: listCache,
307
+ setFocusedCategoryIndex: setFocusedCategoryIndex,
308
+ selectedCategoryIndex: selectedCategoryIndex,
309
+ items: items,
310
+ setFocusedItemIndex: setFocusedItemIndex,
311
+ fullMode: fullMode,
312
+ selectedItemIndex: selectedItemIndex,
313
+ focusedItemIndex: focusedItemIndex,
314
+ rowHeight: rowHeight,
315
+ containerWidth: containerWidth,
316
+ height: height,
317
+ onInsertItem: onInsertItem
318
+ });
319
+ }))));
320
+ }
321
+ var ElementListSingleColumn = function ElementListSingleColumn(props) {
322
+ var items = props.items,
323
+ fullMode = props.fullMode,
324
+ setFocusedItemIndex = props.setFocusedItemIndex,
325
+ rowHeight = props.rowHeight,
326
+ containerWidth = props.containerWidth,
327
+ height = props.height,
328
+ onInsertItem = props.onInsertItem,
329
+ cache = props.cache,
330
+ focusedItemIndex = props.focusedItemIndex,
331
+ setFocusedCategoryIndex = props.setFocusedCategoryIndex,
332
+ selectedCategoryIndex = props.selectedCategoryIndex,
333
+ selectedItemIndex = props.selectedItemIndex;
334
+ var rowRenderer = useMemo(function () {
335
+ return function (_ref8) {
336
+ var index = _ref8.index,
337
+ key = _ref8.key,
338
+ style = _ref8.style,
339
+ parent = _ref8.parent;
340
+ return jsx(CellMeasurer, {
341
+ key: key,
342
+ cache: cache,
343
+ parent: parent,
344
+ columnIndex: 0,
345
+ rowIndex: index
346
+ }, jsx("div", {
347
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
348
+ style: style,
349
+ key: key
350
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766 -- Ignored via go/DSP-18766
351
+ ,
352
+ className: "element-item-wrapper",
353
+ css: elementItemWrapperSingle,
354
+ onKeyDown: function onKeyDown(e) {
355
+ if (e.key === 'Tab') {
356
+ if (e.shiftKey && index === 0) {
357
+ if (setFocusedCategoryIndex) {
358
+ if (!!selectedCategoryIndex) {
359
+ setFocusedCategoryIndex(selectedCategoryIndex);
360
+ } else {
361
+ setFocusedCategoryIndex(0);
362
+ }
363
+ e.preventDefault();
364
+ }
365
+ }
366
+ // before focus jumps from elements list we need to rerender react-virtualized grid.
367
+ // Otherwise on the next render 'scrollToCell' will have same cached value
368
+ // and grid will not be scrolled to top.
369
+ // So Tab press on category will not work anymore due to invisible 1-t element.
370
+ else if (index === items.length - 2) {
371
+ setFocusedItemIndex(items.length - 1);
372
+ }
373
+ }
374
+ }
375
+ }, jsx(MemoizedElementItem, {
376
+ inlineMode: !fullMode,
377
+ index: index,
378
+ item: items[index],
379
+ selected: selectedItemIndex === index,
380
+ focus: focusedItemIndex === index,
381
+ setFocusedItemIndex: setFocusedItemIndex,
382
+ onInsertItem: onInsertItem
383
+ })));
384
+ };
385
+ },
386
+ // eslint-disable-next-line react-hooks/exhaustive-deps
387
+ [cache, items, fullMode, selectedItemIndex, focusedItemIndex, selectedCategoryIndex, setFocusedCategoryIndex, setFocusedItemIndex, props]);
388
+ return jsx(List, _extends({
389
+ rowRenderer: rowRenderer,
390
+ rowCount: items.length,
391
+ rowHeight: rowHeight,
392
+ width: containerWidth - ELEMENT_LIST_PADDING * 2,
393
+ height: height,
394
+ overscanRowCount: 3,
395
+ containerRole: "presentation",
396
+ role: "listbox"
397
+ }, selectedItemIndex !== undefined && {
398
+ scrollToIndex: selectedItemIndex
399
+ }));
400
+ };
401
+ var ElementListMultipleColumns = function ElementListMultipleColumns(props) {
402
+ var columnCount = props.columnCount,
403
+ items = props.items,
404
+ fullMode = props.fullMode,
405
+ setFocusedItemIndex = props.setFocusedItemIndex,
406
+ rowHeight = props.rowHeight,
407
+ containerWidth = props.containerWidth,
408
+ height = props.height,
409
+ onInsertItem = props.onInsertItem,
410
+ cache = props.cache,
411
+ focusedItemIndex = props.focusedItemIndex,
412
+ setFocusedCategoryIndex = props.setFocusedCategoryIndex,
413
+ selectedCategoryIndex = props.selectedCategoryIndex,
414
+ selectedItemIndex = props.selectedItemIndex;
415
+ var columnWidth = (containerWidth - ELEMENT_ITEM_PADDING * 2) / columnCount;
416
+ var rowCount = Math.ceil(items.length / columnCount);
417
+ var cellRenderer = useMemo(function () {
418
+ return function (_ref9) {
419
+ var columnIndex = _ref9.columnIndex,
420
+ key = _ref9.key,
421
+ parent = _ref9.parent,
422
+ rowIndex = _ref9.rowIndex,
423
+ style = _ref9.style;
424
+ var index = rowIndex * columnCount + columnIndex;
425
+ if (items[index] == null) {
426
+ return;
427
+ }
428
+ return index > items.length - 1 ? null : jsx(CellMeasurer, {
429
+ cache: cache,
430
+ key: key,
431
+ rowIndex: rowIndex,
432
+ columnIndex: columnIndex,
433
+ parent: parent
434
+ }, jsx("div", {
435
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
436
+ style: style,
437
+ key: key
438
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766 -- Ignored via go/DSP-18766
439
+ ,
440
+ className: "element-item-wrapper",
441
+ css: elementItemWrapper,
442
+ onKeyDown: function onKeyDown(e) {
443
+ if (e.key === 'Tab') {
444
+ if (e.shiftKey && index === 0) {
445
+ if (setFocusedCategoryIndex) {
446
+ if (!!selectedCategoryIndex) {
447
+ setFocusedCategoryIndex(selectedCategoryIndex);
448
+ } else {
449
+ setFocusedCategoryIndex(0);
450
+ }
451
+ e.preventDefault();
452
+ }
453
+ }
454
+ // before focus jumps from elements list we need to rerender react-virtualized grid.
455
+ // Otherwise on the next render 'scrollToCell' will have same cached value
456
+ // and grid will not be scrolled to top.
457
+ // So Tab press on category will not work anymore due to invisible 1-t element.
458
+ else if (index === items.length - 2) {
459
+ setFocusedItemIndex(items.length - 1);
460
+ }
461
+ }
462
+ }
463
+ }, jsx(MemoizedElementItem, {
464
+ inlineMode: !fullMode,
465
+ index: index,
466
+ item: items[index],
467
+ selected: selectedItemIndex === index,
468
+ focus: focusedItemIndex === index,
469
+ setFocusedItemIndex: setFocusedItemIndex,
470
+ onInsertItem: onInsertItem
471
+ })));
472
+ };
473
+ },
474
+ // eslint-disable-next-line react-hooks/exhaustive-deps
475
+ [cache, items, fullMode, selectedItemIndex, columnCount, focusedItemIndex, selectedCategoryIndex, setFocusedCategoryIndex, setFocusedItemIndex, props]);
476
+ return jsx(Grid, _extends({
477
+ cellRenderer: cellRenderer,
478
+ height: height,
479
+ width: containerWidth - ELEMENT_LIST_PADDING * 2 // containerWidth - padding on Left/Right (for focus outline)
480
+ /**
481
+ * Refresh Grid on WidthObserver value change.
482
+ * Length of the items used to force re-render to solve Firefox bug with react-virtualized retaining
483
+ * scroll position after updating the data. If new data has different number of cells, a re-render
484
+ * is forced to prevent the scroll position render bug.
485
+ */,
486
+ key: containerWidth + items.length,
487
+ rowHeight: rowHeight,
488
+ rowCount: rowCount,
489
+ columnCount: columnCount,
490
+ columnWidth: columnWidth,
491
+ deferredMeasurementCache: cache
492
+ }, selectedItemIndex !== undefined && {
493
+ scrollToRow: Math.floor(selectedItemIndex / columnCount)
494
+ }));
495
+ };
210
496
  var MemoizedElementItem = /*#__PURE__*/memo(ElementItem);
211
497
  MemoizedElementItem.displayName = 'MemoizedElementItem';
212
- export function ElementItem(_ref5) {
213
- var inlineMode = _ref5.inlineMode,
214
- selected = _ref5.selected,
215
- item = _ref5.item,
216
- index = _ref5.index,
217
- onInsertItem = _ref5.onInsertItem,
218
- focus = _ref5.focus,
219
- setFocusedItemIndex = _ref5.setFocusedItemIndex;
498
+ export function ElementItem(_ref10) {
499
+ var inlineMode = _ref10.inlineMode,
500
+ selected = _ref10.selected,
501
+ item = _ref10.item,
502
+ index = _ref10.index,
503
+ onInsertItem = _ref10.onInsertItem,
504
+ focus = _ref10.focus,
505
+ setFocusedItemIndex = _ref10.setFocusedItemIndex;
220
506
  var ref = useFocus(focus);
221
507
 
222
508
  /**
@@ -281,16 +567,16 @@ export function ElementItem(_ref5) {
281
567
  var itemStyleOverrides = {
282
568
  alignItems: 'flex-start'
283
569
  };
284
- var ElementBefore = /*#__PURE__*/memo(function (_ref6) {
285
- var icon = _ref6.icon;
570
+ var ElementBefore = /*#__PURE__*/memo(function (_ref11) {
571
+ var icon = _ref11.icon;
286
572
  return jsx("div", {
287
573
  css: [itemIcon, itemIconStyle]
288
574
  }, icon ? icon() : jsx(IconFallback, null));
289
575
  });
290
- var ItemContent = /*#__PURE__*/memo(function (_ref7) {
291
- var title = _ref7.title,
292
- description = _ref7.description,
293
- keyshortcut = _ref7.keyshortcut;
576
+ var ItemContent = /*#__PURE__*/memo(function (_ref12) {
577
+ var title = _ref12.title,
578
+ description = _ref12.description,
579
+ keyshortcut = _ref12.keyshortcut;
294
580
  if (fg('platform_editor_typography_ugc')) {
295
581
  return (
296
582
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
@@ -362,6 +648,17 @@ var elementItemsWrapper = css({
362
648
  }
363
649
  }
364
650
  });
651
+ var elementItemWrapperSingle = css({
652
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
653
+ div: {
654
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
655
+ button: {
656
+ minHeight: '60px',
657
+ alignItems: 'flex-start',
658
+ padding: "var(--ds-space-150, 12px)".concat(" ", "var(--ds-space-150, 12px)", " 11px")
659
+ }
660
+ }
661
+ });
365
662
  var elementItemWrapper = css({
366
663
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
367
664
  div: {
@@ -428,6 +725,54 @@ var itemIconStyle = css({
428
725
  objectFit: 'cover'
429
726
  }
430
727
  });
728
+ function ElementList(_ref13) {
729
+ var items = _ref13.items,
730
+ mode = _ref13.mode,
731
+ selectedItemIndex = _ref13.selectedItemIndex,
732
+ focusedItemIndex = _ref13.focusedItemIndex,
733
+ columnCount = _ref13.columnCount,
734
+ setColumnCount = _ref13.setColumnCount,
735
+ createAnalyticsEvent = _ref13.createAnalyticsEvent,
736
+ emptyStateHandler = _ref13.emptyStateHandler,
737
+ selectedCategory = _ref13.selectedCategory,
738
+ selectedCategoryIndex = _ref13.selectedCategoryIndex,
739
+ searchTerm = _ref13.searchTerm,
740
+ setFocusedCategoryIndex = _ref13.setFocusedCategoryIndex,
741
+ setFocusedItemIndex = _ref13.setFocusedItemIndex,
742
+ props = _objectWithoutProperties(_ref13, _excluded2);
743
+ if (fg('platform_editor_reduce_element_browser_padding')) {
744
+ return jsx(ElementListNew, _extends({
745
+ items: items,
746
+ mode: mode,
747
+ selectedItemIndex: selectedItemIndex,
748
+ focusedItemIndex: focusedItemIndex,
749
+ columnCount: columnCount,
750
+ setColumnCount: setColumnCount,
751
+ createAnalyticsEvent: createAnalyticsEvent,
752
+ emptyStateHandler: emptyStateHandler,
753
+ selectedCategory: selectedCategory,
754
+ selectedCategoryIndex: selectedCategoryIndex,
755
+ searchTerm: searchTerm,
756
+ setFocusedCategoryIndex: setFocusedCategoryIndex,
757
+ setFocusedItemIndex: setFocusedItemIndex
758
+ }, props));
759
+ }
760
+ return jsx(ElementListOld, _extends({
761
+ items: items,
762
+ mode: mode,
763
+ selectedItemIndex: selectedItemIndex,
764
+ focusedItemIndex: focusedItemIndex,
765
+ columnCount: columnCount,
766
+ setColumnCount: setColumnCount,
767
+ createAnalyticsEvent: createAnalyticsEvent,
768
+ emptyStateHandler: emptyStateHandler,
769
+ selectedCategory: selectedCategory,
770
+ selectedCategoryIndex: selectedCategoryIndex,
771
+ searchTerm: searchTerm,
772
+ setFocusedCategoryIndex: setFocusedCategoryIndex,
773
+ setFocusedItemIndex: setFocusedItemIndex
774
+ }, props));
775
+ }
431
776
  var MemoizedElementListWithAnalytics = /*#__PURE__*/memo(withAnalyticsContext({
432
777
  component: 'ElementList'
433
778
  })(ElementList));
@@ -121,7 +121,8 @@ function StatelessElementBrowser(props) {
121
121
  selectedCategory = props.selectedCategory,
122
122
  onSelectCategory = props.onSelectCategory,
123
123
  searchTerm = props.searchTerm,
124
- showCategories = props.showCategories;
124
+ showCategories = props.showCategories,
125
+ cache = props.cache;
125
126
  var _useContainerWidth = useContainerWidth(),
126
127
  containerWidth = _useContainerWidth.containerWidth,
127
128
  ContainerWidthMonitor = _useContainerWidth.ContainerWidthMonitor;
@@ -230,7 +231,8 @@ function StatelessElementBrowser(props) {
230
231
  onKeyPress: onItemsEnterTabKeyPress,
231
232
  onKeyDown: onKeyDown,
232
233
  viewMoreItem: viewMoreItem,
233
- focusOnViewMore: focusOnViewMore
234
+ focusOnViewMore: focusOnViewMore,
235
+ cache: cache
234
236
  })) : jsx(DesktopBrowser, _extends({}, props, {
235
237
  selectedItemIndex: selectedItemIndex,
236
238
  focusedItemIndex: focusedItemIndex,
@@ -244,7 +246,8 @@ function StatelessElementBrowser(props) {
244
246
  focusedCategoryIndex: focusedCategoryIndex,
245
247
  setFocusedCategoryIndex: setFocusedCategoryIndex,
246
248
  selectedCategoryIndex: selectedCategoryIndex,
247
- onSelectCategory: onSelectCategoryCB
249
+ onSelectCategory: onSelectCategoryCB,
250
+ cache: cache
248
251
  })));
249
252
  }
250
253
  function MobileBrowser(_ref) {
@@ -272,7 +275,8 @@ function MobileBrowser(_ref) {
272
275
  searchTerm = _ref.searchTerm,
273
276
  createAnalyticsEvent = _ref.createAnalyticsEvent,
274
277
  emptyStateHandler = _ref.emptyStateHandler,
275
- viewMoreItem = _ref.viewMoreItem;
278
+ viewMoreItem = _ref.viewMoreItem,
279
+ cache = _ref.cache;
276
280
  return (
277
281
  // eslint-disable-next-line jsx-a11y/no-static-element-interactions
278
282
  jsx("div", {
@@ -315,7 +319,8 @@ function MobileBrowser(_ref) {
315
319
  createAnalyticsEvent: createAnalyticsEvent,
316
320
  emptyStateHandler: emptyStateHandler,
317
321
  selectedCategory: selectedCategory,
318
- searchTerm: searchTerm
322
+ searchTerm: searchTerm,
323
+ cache: cache
319
324
  })), viewMoreItem && jsx(ViewMore, {
320
325
  item: viewMoreItem,
321
326
  focus: focusOnViewMore
@@ -346,7 +351,8 @@ function DesktopBrowser(_ref2) {
346
351
  onKeyDown = _ref2.onKeyDown,
347
352
  searchTerm = _ref2.searchTerm,
348
353
  createAnalyticsEvent = _ref2.createAnalyticsEvent,
349
- emptyStateHandler = _ref2.emptyStateHandler;
354
+ emptyStateHandler = _ref2.emptyStateHandler,
355
+ cache = _ref2.cache;
350
356
  return jsx("div", {
351
357
  css: elementBrowserContainer,
352
358
  "data-testid": "desktop__element-browser"
@@ -404,7 +410,8 @@ function DesktopBrowser(_ref2) {
404
410
  selectedCategory: selectedCategory,
405
411
  selectedCategoryIndex: selectedCategoryIndex,
406
412
  searchTerm: searchTerm,
407
- setFocusedCategoryIndex: showCategories ? setFocusedCategoryIndex : undefined
413
+ setFocusedCategoryIndex: showCategories ? setFocusedCategoryIndex : undefined,
414
+ cache: cache
408
415
  })));
409
416
  }
410
417
  var MemoizedElementBrowser = /*#__PURE__*/memo(withAnalyticsContext({
@@ -16,6 +16,6 @@ export var INLINE_SIDEBAR_HEIGHT = '54px';
16
16
  export var SEARCH_ITEM_HEIGHT_WIDTH = '20px';
17
17
  export var SCROLLBAR_WIDTH = 15;
18
18
  export var ELEMENT_LIST_PADDING = 2;
19
- export var ELEMENT_ITEM_HEIGHT = 75;
19
+ export var ELEMENT_ITEM_HEIGHT = 60;
20
20
  export var ELEMENT_ITEM_PADDING = 10;
21
21
  export var ELEMENT_BROWSER_ID = 'editor-element-browser';
@@ -7,7 +7,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
7
7
  import { isFedRamp } from './environment';
8
8
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
9
9
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
10
- var packageVersion = "94.14.2";
10
+ var packageVersion = "94.16.0";
11
11
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
12
12
  // Remove URL as it has UGC
13
13
  // TODO: Sanitise the URL instead of just removing it
@@ -58,17 +58,22 @@ var options = {
58
58
  * @returns {QuickInsertItem[]} - Returns a sorted array of QuickInsertItems based on the priority. If the query string is empty, it will return the array sorted by priority. If a query string is provided, it will return an array of QuickInsertItems that match the query string, sorted by relevance to the query.
59
59
  */
60
60
  export function find(query, items, prioritySortingFn) {
61
- var fuseOptions = _objectSpread({}, options);
62
- if (prioritySortingFn) {
63
- fuseOptions.sortFn = prioritySortingFn(items);
64
- }
65
- var fuse = new Fuse(items, fuseOptions);
66
61
  if (query === '') {
67
62
  // Copy and sort list by priority
68
63
  return items.slice(0).sort(function (a, b) {
69
64
  return (a.priority || Number.POSITIVE_INFINITY) - (b.priority || Number.POSITIVE_INFINITY);
70
65
  });
71
66
  }
67
+ var fuseOptions = _objectSpread({}, options);
68
+ if (prioritySortingFn) {
69
+ var sortFn = prioritySortingFn(items);
70
+ // prioritySortingFn will trigger the experiment exposure, but sortFn
71
+ // will be undefined for the control group.
72
+ if (sortFn) {
73
+ fuseOptions.sortFn = sortFn;
74
+ }
75
+ }
76
+ var fuse = new Fuse(items, fuseOptions);
72
77
  return fuse.search(query).map(function (result) {
73
78
  return result.item;
74
79
  });
@@ -21,7 +21,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
21
21
  import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
22
22
  import Layer from '../Layer';
23
23
  var packageName = "@atlaskit/editor-common";
24
- var packageVersion = "94.14.2";
24
+ var packageVersion = "94.16.0";
25
25
  var halfFocusRing = 1;
26
26
  var dropOffset = '0, 8';
27
27
  var DropList = /*#__PURE__*/function (_Component) {
@@ -5,3 +5,4 @@ export { editorAnalyticsChannel, fireAnalyticsEvent } from './fire-analytics-eve
5
5
  export { getAnalyticsEventsFromTransaction } from './utils';
6
6
  export { buildEditLinkPayload, buildVisitedLinkPayload, buildOpenedSettingsPayload, unlinkPayload, } from './linking-utils';
7
7
  export type { LinkType } from './linking-utils';
8
+ export type { RequestToEditAEP } from './types/general-events';
@@ -1,4 +1,5 @@
1
1
  import { PureComponent } from 'react';
2
+ import type { CellMeasurerCache } from 'react-virtualized/dist/commonjs/CellMeasurer';
2
3
  import type { QuickInsertItem } from '../provider-factory';
3
4
  import type { EmptyStateHandler } from '../types';
4
5
  import type { Category, Modes } from './types';
@@ -13,6 +14,7 @@ export interface Props {
13
14
  defaultCategory?: string;
14
15
  emptyStateHandler?: EmptyStateHandler;
15
16
  viewMoreItem?: QuickInsertItem;
17
+ cache?: CellMeasurerCache;
16
18
  }
17
19
  export interface State {
18
20
  items: QuickInsertItem[];
@@ -4,6 +4,7 @@
4
4
  */
5
5
  import React from 'react';
6
6
  import { jsx } from '@emotion/react';
7
+ import { CellMeasurerCache } from 'react-virtualized/dist/commonjs/CellMeasurer';
7
8
  import type { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
8
9
  import type { QuickInsertItem } from '../../../provider-factory';
9
10
  import type { EmptyStateHandler } from '../../../types';
@@ -24,6 +25,7 @@ export interface Props {
24
25
  selectedCategory?: string;
25
26
  selectedCategoryIndex?: number;
26
27
  searchTerm?: string;
28
+ cache?: CellMeasurerCache;
27
29
  }
28
30
  type ElementItemType = {
29
31
  inlineMode: boolean;
@@ -3,6 +3,7 @@
3
3
  * @jsx jsx
4
4
  */
5
5
  import React from 'react';
6
+ import type { CellMeasurerCache } from 'react-virtualized/dist/commonjs/CellMeasurer';
6
7
  import type { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
7
8
  import type { QuickInsertItem } from '../../provider-factory';
8
9
  import type { EmptyStateHandler } from '../../types';
@@ -21,6 +22,7 @@ export type StatelessElementBrowserProps = {
21
22
  searchTerm?: string;
22
23
  emptyStateHandler?: EmptyStateHandler;
23
24
  viewMoreItem?: QuickInsertItem;
25
+ cache?: CellMeasurerCache;
24
26
  } & WithAnalyticsEventsProps;
25
27
  declare const MemoizedElementBrowser: React.MemoExoticComponent<React.ForwardRefExoticComponent<Pick<Omit<{
26
28
  categories?: Category[] | undefined;
@@ -36,5 +38,6 @@ declare const MemoizedElementBrowser: React.MemoExoticComponent<React.ForwardRef
36
38
  searchTerm?: string | undefined;
37
39
  emptyStateHandler?: EmptyStateHandler | undefined;
38
40
  viewMoreItem?: QuickInsertItem | undefined;
39
- }, keyof WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "key" | "mode" | "analyticsContext" | "categories" | "onSelectCategory" | "selectedCategory" | "items" | "emptyStateHandler" | "searchTerm" | "onInsertItem" | "onSearch" | "onSelectItem" | "viewMoreItem" | "showCategories" | "showSearch"> & React.RefAttributes<any>>>;
41
+ cache?: CellMeasurerCache | undefined;
42
+ }, keyof WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "key" | "mode" | "analyticsContext" | "cache" | "categories" | "onSelectCategory" | "selectedCategory" | "items" | "emptyStateHandler" | "searchTerm" | "onInsertItem" | "onSearch" | "onSelectItem" | "viewMoreItem" | "showCategories" | "showSearch"> & React.RefAttributes<any>>>;
40
43
  export default MemoizedElementBrowser;
@@ -16,6 +16,6 @@ export declare const INLINE_SIDEBAR_HEIGHT = "54px";
16
16
  export declare const SEARCH_ITEM_HEIGHT_WIDTH = "20px";
17
17
  export declare const SCROLLBAR_WIDTH = 15;
18
18
  export declare const ELEMENT_LIST_PADDING = 2;
19
- export declare const ELEMENT_ITEM_HEIGHT = 75;
19
+ export declare const ELEMENT_ITEM_HEIGHT = 60;
20
20
  export declare const ELEMENT_ITEM_PADDING = 10;
21
21
  export declare const ELEMENT_BROWSER_ID = "editor-element-browser";
@@ -2,3 +2,4 @@ export { ExtensionNodeWrapper } from './ExtensionNodeWrapper';
2
2
  export { Extension } from './Extension';
3
3
  export { default as ExtensionNodeView, ExtensionNode } from './extensionNodeView';
4
4
  export { ExtensionComponent } from './ExtensionComponent';
5
+ export type { MacroInteractionDesignFeatureFlags } from './types';
@@ -11,3 +11,4 @@ export type { QuickInsertItem, QuickInsertItemId, QuickInsertActionInsert, Quick
11
11
  export type { TypeAheadItem, TypeAheadItemRenderProps } from './types/type-ahead';
12
12
  export type { AutoformatReplacement, AutoformattingProvider, AutoformatHandler, AutoformatRuleset, } from './provider-factory/autoformatting-provider';
13
13
  export type { ContextIdentifierProvider } from './provider-factory/context-identifier-provider';
14
+ export type { ProfilecardProvider } from './provider-factory/profile-card-provider';
@@ -11,4 +11,4 @@ export declare const memoProcessQuickInsertItems: (items: Array<QuickInsertHandl
11
11
  * @param {QuickInsertItem[]} items - An array of QuickInsertItems to be searched.
12
12
  * @returns {QuickInsertItem[]} - Returns a sorted array of QuickInsertItems based on the priority. If the query string is empty, it will return the array sorted by priority. If a query string is provided, it will return an array of QuickInsertItems that match the query string, sorted by relevance to the query.
13
13
  */
14
- export declare function find(query: string, items: QuickInsertItem[], prioritySortingFn?: (items: QuickInsertItem[]) => Fuse.FuseSortFunction): QuickInsertItem[];
14
+ export declare function find(query: string, items: QuickInsertItem[], prioritySortingFn?: (items: QuickInsertItem[]) => Fuse.FuseSortFunction | undefined): QuickInsertItem[];