@atlaskit/editor-plugin-type-ahead 10.0.16 → 10.0.18

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,19 @@
1
1
  # @atlaskit/editor-plugin-type-ahead
2
2
 
3
+ ## 10.0.18
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 10.0.17
10
+
11
+ ### Patch Changes
12
+
13
+ - [`858c695a0a315`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/858c695a0a315) -
14
+ [EDITOR-6718] Show "Ask Rovo" action in the type-ahead empty search state
15
+ - Updated dependencies
16
+
3
17
  ## 10.0.16
4
18
 
5
19
  ### Patch Changes
@@ -18,6 +18,7 @@ var _typeAhead = require("@atlaskit/editor-common/type-ahead");
18
18
  var _ui = require("@atlaskit/editor-common/ui");
19
19
  var _menu = require("@atlaskit/menu");
20
20
  var _compiled = require("@atlaskit/primitives/compiled");
21
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
21
22
  var _closeTypeAhead = require("../pm-plugins/commands/close-type-ahead");
22
23
  var _updateSelectedIndex = require("../pm-plugins/commands/update-selected-index");
23
24
  var _constants = require("../pm-plugins/constants");
@@ -57,6 +58,7 @@ var TypeaheadAssistiveTextPureComponent = /*#__PURE__*/_react.default.memo(funct
57
58
  var TypeAheadListComponent = /*#__PURE__*/_react.default.memo(function (_ref2) {
58
59
  var _triggerHandler$getMo, _decorationElement$qu2;
59
60
  var items = _ref2.items,
61
+ emptyItem = _ref2.emptyItem,
60
62
  selectedIndex = _ref2.selectedIndex,
61
63
  editorView = _ref2.editorView,
62
64
  onItemClick = _ref2.onItemClick,
@@ -81,6 +83,7 @@ var TypeAheadListComponent = /*#__PURE__*/_react.default.memo(function (_ref2) {
81
83
 
82
84
  // Exclude view more item from the count
83
85
  var itemsLength = showMoreOptionsButton ? Math.max(items.length - 1, 0) : items.length;
86
+ var isEmptyStateActive = (0, _expValEquals.expValEquals)('platform_editor_insert_menu_ai', 'isEnabled', true) && !!emptyItem && itemsLength === 1 && items[0] === emptyItem;
84
87
  var estimatedHeight = itemsLength * LIST_ITEM_ESTIMATED_HEIGHT;
85
88
  var _useState = (0, _react.useState)(Math.min(estimatedHeight, fitHeight)),
86
89
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
@@ -355,7 +358,10 @@ var TypeAheadListComponent = /*#__PURE__*/_react.default.memo(function (_ref2) {
355
358
  }, intl.formatMessage(_typeAhead.typeAheadListMessages.emptySearchResults)), (0, _react2.jsx)(_compiled.Text, {
356
359
  align: "center",
357
360
  as: "p"
358
- }, intl.formatMessage(_typeAhead.typeAheadListMessages.emptySearchResultsSuggestion, {
361
+ }, intl.formatMessage((0, _expValEquals.expValEquals)('platform_editor_insert_menu_ai', 'isEnabled', true) ? _typeAhead.typeAheadListMessages.emptySearchResultsSuggestionNew : _typeAhead.typeAheadListMessages.emptySearchResultsSuggestion, {
362
+ askRovoName: (0, _react2.jsx)(_compiled.Text, {
363
+ weight: "medium"
364
+ }, intl.formatMessage(_messages.toolbarInsertBlockMessages.askRovo)),
359
365
  buttonName: (0, _react2.jsx)(_compiled.Text, {
360
366
  weight: "medium"
361
367
  }, intl.formatMessage(_messages.toolbarInsertBlockMessages.viewMore))
@@ -396,7 +402,7 @@ var TypeAheadListComponent = /*#__PURE__*/_react.default.memo(function (_ref2) {
396
402
  }, (0, _react2.jsx)("div", {
397
403
  id: menuGroupId,
398
404
  ref: listContainerRef
399
- }, !showMoreOptionsButton || itemsLength ? ListContent : EmptyResultView, showMoreOptionsButton && config && (0, _react2.jsx)(_MoreOptions.MoreOptions, {
405
+ }, isEmptyStateActive && EmptyResultView, isEmptyStateActive ? ListContent : !showMoreOptionsButton || itemsLength ? ListContent : EmptyResultView, showMoreOptionsButton && config && (0, _react2.jsx)(_MoreOptions.MoreOptions, {
400
406
  title: config.title,
401
407
  ariaLabel: config.ariaLabel,
402
408
  onClick: handleClick,
@@ -8,6 +8,7 @@ exports.TypeAheadMenu = void 0;
8
8
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
9
  var _react = _interopRequireDefault(require("react"));
10
10
  var _typeAhead = require("@atlaskit/editor-common/type-ahead");
11
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
11
12
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
12
13
  var _updateSelectedIndex = require("../pm-plugins/commands/update-selected-index");
13
14
  var _useItemInsert3 = require("./hooks/use-item-insert");
@@ -85,7 +86,13 @@ var TypeAheadMenu = exports.TypeAheadMenu = /*#__PURE__*/_react.default.memo(fun
85
86
  if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
86
87
  showMoreOptionsButton = !!(triggerHandler !== null && triggerHandler !== void 0 && triggerHandler.getMoreOptionsButtonConfig);
87
88
  }
88
- if (!isOpen || !triggerHandler || !(decorationElement instanceof HTMLElement) || !openElementBrowserModal && items.length === 0 && !errorInfo) {
89
+ var emptyItem = _react.default.useMemo(function () {
90
+ var _triggerHandler$getEm;
91
+ return (0, _expValEquals.expValEquals)('platform_editor_insert_menu_ai', 'isEnabled', true) ? triggerHandler === null || triggerHandler === void 0 || (_triggerHandler$getEm = triggerHandler.getEmptyItem) === null || _triggerHandler$getEm === void 0 ? void 0 : _triggerHandler$getEm.call(triggerHandler, {
92
+ editorState: editorView.state
93
+ }) : undefined;
94
+ }, [triggerHandler, editorView.state]);
95
+ if (!isOpen || !triggerHandler || !(decorationElement instanceof HTMLElement) || !openElementBrowserModal && items.length === 0 && !errorInfo && !emptyItem) {
89
96
  return null;
90
97
  }
91
98
  return /*#__PURE__*/_react.default.createElement(_TypeAheadPopup.TypeAheadPopup, {
@@ -96,6 +103,7 @@ var TypeAheadMenu = exports.TypeAheadMenu = /*#__PURE__*/_react.default.memo(fun
96
103
  anchorElement: decorationElement,
97
104
  triggerHandler: triggerHandler,
98
105
  items: items,
106
+ emptyItem: emptyItem,
99
107
  errorInfo: errorInfo,
100
108
  selectedIndex: selectedIndex,
101
109
  setSelectedItem: setSelectedItem,
@@ -70,6 +70,7 @@ var TypeAheadPopup = exports.TypeAheadPopup = /*#__PURE__*/_react.default.memo(f
70
70
  popupsBoundariesElement = props.popupsBoundariesElement,
71
71
  popupsScrollableElement = props.popupsScrollableElement,
72
72
  items = props.items,
73
+ emptyItem = props.emptyItem,
73
74
  errorInfo = props.errorInfo,
74
75
  selectedIndex = props.selectedIndex,
75
76
  onItemInsert = props.onItemInsert,
@@ -344,6 +345,7 @@ var TypeAheadPopup = exports.TypeAheadPopup = /*#__PURE__*/_react.default.memo(f
344
345
  triggerHandler: triggerHandler
345
346
  }), (0, _react2.jsx)(_TypeAheadList.TypeAheadList, {
346
347
  items: items,
348
+ emptyItem: emptyItem,
347
349
  selectedIndex: selectedIndex
348
350
  // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
349
351
  ,
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.useLoadItems = void 0;
8
8
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
9
  var _react = require("react");
10
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
10
11
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
11
12
  var _clearListError = require("../../pm-plugins/commands/clear-list-error");
12
13
  var _updateListError = require("../../pm-plugins/commands/update-list-error");
@@ -37,7 +38,13 @@ var useLoadItems = exports.useLoadItems = function useLoadItems(triggerHandler,
37
38
  });
38
39
  }
39
40
  getItems(options).then(function (result) {
40
- var list = result.length > 0 ? result : EMPTY_LIST_ITEM;
41
+ var _triggerHandler$getEm;
42
+ // Inject empty list item here so it flows through the normal list rendering and keyboard
43
+ // navigation paths
44
+ var emptyItem = result.length === 0 && (0, _expValEquals.expValEquals)('platform_editor_insert_menu_ai', 'isEnabled', true) ? (_triggerHandler$getEm = triggerHandler.getEmptyItem) === null || _triggerHandler$getEm === void 0 ? void 0 : _triggerHandler$getEm.call(triggerHandler, {
45
+ editorState: editorView.state
46
+ }) : undefined;
47
+ var list = result.length > 0 ? result : emptyItem ? [emptyItem] : EMPTY_LIST_ITEM;
41
48
  if (componentIsMounted.current) {
42
49
  setItems(list);
43
50
  }
@@ -16,6 +16,7 @@ import { SelectItemMode, typeAheadListMessages } from '@atlaskit/editor-common/t
16
16
  import { AssistiveText } from '@atlaskit/editor-common/ui';
17
17
  import { MenuGroup } from '@atlaskit/menu';
18
18
  import { Text, Box } from '@atlaskit/primitives/compiled';
19
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
19
20
  import { closeTypeAhead } from '../pm-plugins/commands/close-type-ahead';
20
21
  import { updateSelectedIndex } from '../pm-plugins/commands/update-selected-index';
21
22
  import { TYPE_AHEAD_DECORATION_ELEMENT_ID } from '../pm-plugins/constants';
@@ -47,6 +48,7 @@ const TypeaheadAssistiveTextPureComponent = /*#__PURE__*/React.memo(({
47
48
  });
48
49
  const TypeAheadListComponent = /*#__PURE__*/React.memo(({
49
50
  items,
51
+ emptyItem,
50
52
  selectedIndex,
51
53
  editorView,
52
54
  onItemClick,
@@ -73,6 +75,7 @@ const TypeAheadListComponent = /*#__PURE__*/React.memo(({
73
75
 
74
76
  // Exclude view more item from the count
75
77
  const itemsLength = showMoreOptionsButton ? Math.max(items.length - 1, 0) : items.length;
78
+ const isEmptyStateActive = expValEquals('platform_editor_insert_menu_ai', 'isEnabled', true) && !!emptyItem && itemsLength === 1 && items[0] === emptyItem;
76
79
  const estimatedHeight = itemsLength * LIST_ITEM_ESTIMATED_HEIGHT;
77
80
  const [height, setHeight] = useState(Math.min(estimatedHeight, fitHeight));
78
81
  const [cache, setCache] = useState(new CellMeasurerCache({
@@ -335,7 +338,10 @@ const TypeAheadListComponent = /*#__PURE__*/React.memo(({
335
338
  }, intl.formatMessage(typeAheadListMessages.emptySearchResults)), jsx(Text, {
336
339
  align: "center",
337
340
  as: "p"
338
- }, intl.formatMessage(typeAheadListMessages.emptySearchResultsSuggestion, {
341
+ }, intl.formatMessage(expValEquals('platform_editor_insert_menu_ai', 'isEnabled', true) ? typeAheadListMessages.emptySearchResultsSuggestionNew : typeAheadListMessages.emptySearchResultsSuggestion, {
342
+ askRovoName: jsx(Text, {
343
+ weight: "medium"
344
+ }, intl.formatMessage(messages.askRovo)),
339
345
  buttonName: jsx(Text, {
340
346
  weight: "medium"
341
347
  }, intl.formatMessage(messages.viewMore))
@@ -376,7 +382,7 @@ const TypeAheadListComponent = /*#__PURE__*/React.memo(({
376
382
  }, jsx("div", {
377
383
  id: menuGroupId,
378
384
  ref: listContainerRef
379
- }, !showMoreOptionsButton || itemsLength ? ListContent : EmptyResultView, showMoreOptionsButton && config && jsx(MoreOptions, {
385
+ }, isEmptyStateActive && EmptyResultView, isEmptyStateActive ? ListContent : !showMoreOptionsButton || itemsLength ? ListContent : EmptyResultView, showMoreOptionsButton && config && jsx(MoreOptions, {
380
386
  title: config.title,
381
387
  ariaLabel: config.ariaLabel,
382
388
  onClick: handleClick,
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
3
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
3
4
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
4
5
  import { updateSelectedIndex } from '../pm-plugins/commands/update-selected-index';
5
6
  import { useItemInsert } from './hooks/use-item-insert';
@@ -76,7 +77,13 @@ export const TypeAheadMenu = /*#__PURE__*/React.memo(({
76
77
  if (editorExperiment('platform_editor_controls', 'variant1')) {
77
78
  showMoreOptionsButton = !!(triggerHandler !== null && triggerHandler !== void 0 && triggerHandler.getMoreOptionsButtonConfig);
78
79
  }
79
- if (!isOpen || !triggerHandler || !(decorationElement instanceof HTMLElement) || !openElementBrowserModal && items.length === 0 && !errorInfo) {
80
+ const emptyItem = React.useMemo(() => {
81
+ var _triggerHandler$getEm;
82
+ return expValEquals('platform_editor_insert_menu_ai', 'isEnabled', true) ? triggerHandler === null || triggerHandler === void 0 ? void 0 : (_triggerHandler$getEm = triggerHandler.getEmptyItem) === null || _triggerHandler$getEm === void 0 ? void 0 : _triggerHandler$getEm.call(triggerHandler, {
83
+ editorState: editorView.state
84
+ }) : undefined;
85
+ }, [triggerHandler, editorView.state]);
86
+ if (!isOpen || !triggerHandler || !(decorationElement instanceof HTMLElement) || !openElementBrowserModal && items.length === 0 && !errorInfo && !emptyItem) {
80
87
  return null;
81
88
  }
82
89
  return /*#__PURE__*/React.createElement(TypeAheadPopup, {
@@ -87,6 +94,7 @@ export const TypeAheadMenu = /*#__PURE__*/React.memo(({
87
94
  anchorElement: decorationElement,
88
95
  triggerHandler: triggerHandler,
89
96
  items: items,
97
+ emptyItem: emptyItem,
90
98
  errorInfo: errorInfo,
91
99
  selectedIndex: selectedIndex,
92
100
  setSelectedItem: setSelectedItem,
@@ -61,6 +61,7 @@ export const TypeAheadPopup = /*#__PURE__*/React.memo(props => {
61
61
  popupsBoundariesElement,
62
62
  popupsScrollableElement,
63
63
  items,
64
+ emptyItem,
64
65
  errorInfo,
65
66
  selectedIndex,
66
67
  onItemInsert,
@@ -340,6 +341,7 @@ export const TypeAheadPopup = /*#__PURE__*/React.memo(props => {
340
341
  triggerHandler: triggerHandler
341
342
  }), jsx(TypeAheadList, {
342
343
  items: items,
344
+ emptyItem: emptyItem,
343
345
  selectedIndex: selectedIndex
344
346
  // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
345
347
  ,
@@ -1,4 +1,5 @@
1
1
  import { useEffect, useRef, useState } from 'react';
2
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
2
3
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
3
4
  import { clearListError } from '../../pm-plugins/commands/clear-list-error';
4
5
  import { updateListError } from '../../pm-plugins/commands/update-list-error';
@@ -28,7 +29,13 @@ export const useLoadItems = (triggerHandler, editorView, query, showViewMore, ap
28
29
  });
29
30
  }
30
31
  getItems(options).then(result => {
31
- const list = result.length > 0 ? result : EMPTY_LIST_ITEM;
32
+ var _triggerHandler$getEm;
33
+ // Inject empty list item here so it flows through the normal list rendering and keyboard
34
+ // navigation paths
35
+ const emptyItem = result.length === 0 && expValEquals('platform_editor_insert_menu_ai', 'isEnabled', true) ? (_triggerHandler$getEm = triggerHandler.getEmptyItem) === null || _triggerHandler$getEm === void 0 ? void 0 : _triggerHandler$getEm.call(triggerHandler, {
36
+ editorState: editorView.state
37
+ }) : undefined;
38
+ const list = result.length > 0 ? result : emptyItem ? [emptyItem] : EMPTY_LIST_ITEM;
32
39
  if (componentIsMounted.current) {
33
40
  setItems(list);
34
41
  }
@@ -17,6 +17,7 @@ import { SelectItemMode, typeAheadListMessages } from '@atlaskit/editor-common/t
17
17
  import { AssistiveText } from '@atlaskit/editor-common/ui';
18
18
  import { MenuGroup } from '@atlaskit/menu';
19
19
  import { Text, Box } from '@atlaskit/primitives/compiled';
20
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
20
21
  import { closeTypeAhead } from '../pm-plugins/commands/close-type-ahead';
21
22
  import { updateSelectedIndex } from '../pm-plugins/commands/update-selected-index';
22
23
  import { TYPE_AHEAD_DECORATION_ELEMENT_ID } from '../pm-plugins/constants';
@@ -48,6 +49,7 @@ var TypeaheadAssistiveTextPureComponent = /*#__PURE__*/React.memo(function (_ref
48
49
  var TypeAheadListComponent = /*#__PURE__*/React.memo(function (_ref2) {
49
50
  var _triggerHandler$getMo, _decorationElement$qu2;
50
51
  var items = _ref2.items,
52
+ emptyItem = _ref2.emptyItem,
51
53
  selectedIndex = _ref2.selectedIndex,
52
54
  editorView = _ref2.editorView,
53
55
  onItemClick = _ref2.onItemClick,
@@ -72,6 +74,7 @@ var TypeAheadListComponent = /*#__PURE__*/React.memo(function (_ref2) {
72
74
 
73
75
  // Exclude view more item from the count
74
76
  var itemsLength = showMoreOptionsButton ? Math.max(items.length - 1, 0) : items.length;
77
+ var isEmptyStateActive = expValEquals('platform_editor_insert_menu_ai', 'isEnabled', true) && !!emptyItem && itemsLength === 1 && items[0] === emptyItem;
75
78
  var estimatedHeight = itemsLength * LIST_ITEM_ESTIMATED_HEIGHT;
76
79
  var _useState = useState(Math.min(estimatedHeight, fitHeight)),
77
80
  _useState2 = _slicedToArray(_useState, 2),
@@ -346,7 +349,10 @@ var TypeAheadListComponent = /*#__PURE__*/React.memo(function (_ref2) {
346
349
  }, intl.formatMessage(typeAheadListMessages.emptySearchResults)), jsx(Text, {
347
350
  align: "center",
348
351
  as: "p"
349
- }, intl.formatMessage(typeAheadListMessages.emptySearchResultsSuggestion, {
352
+ }, intl.formatMessage(expValEquals('platform_editor_insert_menu_ai', 'isEnabled', true) ? typeAheadListMessages.emptySearchResultsSuggestionNew : typeAheadListMessages.emptySearchResultsSuggestion, {
353
+ askRovoName: jsx(Text, {
354
+ weight: "medium"
355
+ }, intl.formatMessage(messages.askRovo)),
350
356
  buttonName: jsx(Text, {
351
357
  weight: "medium"
352
358
  }, intl.formatMessage(messages.viewMore))
@@ -387,7 +393,7 @@ var TypeAheadListComponent = /*#__PURE__*/React.memo(function (_ref2) {
387
393
  }, jsx("div", {
388
394
  id: menuGroupId,
389
395
  ref: listContainerRef
390
- }, !showMoreOptionsButton || itemsLength ? ListContent : EmptyResultView, showMoreOptionsButton && config && jsx(MoreOptions, {
396
+ }, isEmptyStateActive && EmptyResultView, isEmptyStateActive ? ListContent : !showMoreOptionsButton || itemsLength ? ListContent : EmptyResultView, showMoreOptionsButton && config && jsx(MoreOptions, {
391
397
  title: config.title,
392
398
  ariaLabel: config.ariaLabel,
393
399
  onClick: handleClick,
@@ -1,6 +1,7 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import React from 'react';
3
3
  import { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
4
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
4
5
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
5
6
  import { updateSelectedIndex } from '../pm-plugins/commands/update-selected-index';
6
7
  import { useItemInsert } from './hooks/use-item-insert';
@@ -78,7 +79,13 @@ export var TypeAheadMenu = /*#__PURE__*/React.memo(function (_ref) {
78
79
  if (editorExperiment('platform_editor_controls', 'variant1')) {
79
80
  showMoreOptionsButton = !!(triggerHandler !== null && triggerHandler !== void 0 && triggerHandler.getMoreOptionsButtonConfig);
80
81
  }
81
- if (!isOpen || !triggerHandler || !(decorationElement instanceof HTMLElement) || !openElementBrowserModal && items.length === 0 && !errorInfo) {
82
+ var emptyItem = React.useMemo(function () {
83
+ var _triggerHandler$getEm;
84
+ return expValEquals('platform_editor_insert_menu_ai', 'isEnabled', true) ? triggerHandler === null || triggerHandler === void 0 || (_triggerHandler$getEm = triggerHandler.getEmptyItem) === null || _triggerHandler$getEm === void 0 ? void 0 : _triggerHandler$getEm.call(triggerHandler, {
85
+ editorState: editorView.state
86
+ }) : undefined;
87
+ }, [triggerHandler, editorView.state]);
88
+ if (!isOpen || !triggerHandler || !(decorationElement instanceof HTMLElement) || !openElementBrowserModal && items.length === 0 && !errorInfo && !emptyItem) {
82
89
  return null;
83
90
  }
84
91
  return /*#__PURE__*/React.createElement(TypeAheadPopup, {
@@ -89,6 +96,7 @@ export var TypeAheadMenu = /*#__PURE__*/React.memo(function (_ref) {
89
96
  anchorElement: decorationElement,
90
97
  triggerHandler: triggerHandler,
91
98
  items: items,
99
+ emptyItem: emptyItem,
92
100
  errorInfo: errorInfo,
93
101
  selectedIndex: selectedIndex,
94
102
  setSelectedItem: setSelectedItem,
@@ -60,6 +60,7 @@ export var TypeAheadPopup = /*#__PURE__*/React.memo(function (props) {
60
60
  popupsBoundariesElement = props.popupsBoundariesElement,
61
61
  popupsScrollableElement = props.popupsScrollableElement,
62
62
  items = props.items,
63
+ emptyItem = props.emptyItem,
63
64
  errorInfo = props.errorInfo,
64
65
  selectedIndex = props.selectedIndex,
65
66
  onItemInsert = props.onItemInsert,
@@ -334,6 +335,7 @@ export var TypeAheadPopup = /*#__PURE__*/React.memo(function (props) {
334
335
  triggerHandler: triggerHandler
335
336
  }), jsx(TypeAheadList, {
336
337
  items: items,
338
+ emptyItem: emptyItem,
337
339
  selectedIndex: selectedIndex
338
340
  // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
339
341
  ,
@@ -1,5 +1,6 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import { useEffect, useRef, useState } from 'react';
3
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
3
4
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
4
5
  import { clearListError } from '../../pm-plugins/commands/clear-list-error';
5
6
  import { updateListError } from '../../pm-plugins/commands/update-list-error';
@@ -30,7 +31,13 @@ export var useLoadItems = function useLoadItems(triggerHandler, editorView, quer
30
31
  });
31
32
  }
32
33
  getItems(options).then(function (result) {
33
- var list = result.length > 0 ? result : EMPTY_LIST_ITEM;
34
+ var _triggerHandler$getEm;
35
+ // Inject empty list item here so it flows through the normal list rendering and keyboard
36
+ // navigation paths
37
+ var emptyItem = result.length === 0 && expValEquals('platform_editor_insert_menu_ai', 'isEnabled', true) ? (_triggerHandler$getEm = triggerHandler.getEmptyItem) === null || _triggerHandler$getEm === void 0 ? void 0 : _triggerHandler$getEm.call(triggerHandler, {
38
+ editorState: editorView.state
39
+ }) : undefined;
40
+ var list = result.length > 0 ? result : emptyItem ? [emptyItem] : EMPTY_LIST_ITEM;
34
41
  if (componentIsMounted.current) {
35
42
  setItems(list);
36
43
  }
@@ -14,6 +14,7 @@ export declare const TypeAheadList: React.FC<WithIntlProps<{
14
14
  api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
15
15
  decorationElement: HTMLElement;
16
16
  editorView: EditorView;
17
+ emptyItem?: TypeAheadItem;
17
18
  fitHeight: number;
18
19
  items: Array<TypeAheadItem>;
19
20
  moreElementsInQuickInsertViewEnabled?: boolean;
@@ -27,6 +28,7 @@ export declare const TypeAheadList: React.FC<WithIntlProps<{
27
28
  api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
28
29
  decorationElement: HTMLElement;
29
30
  editorView: EditorView;
31
+ emptyItem?: TypeAheadItem;
30
32
  fitHeight: number;
31
33
  items: Array<TypeAheadItem>;
32
34
  moreElementsInQuickInsertViewEnabled?: boolean;
@@ -20,6 +20,7 @@ type TypeAheadPopupProps = {
20
20
  }) => void;
21
21
  decorationSet: DecorationSet;
22
22
  editorView: EditorView;
23
+ emptyItem?: TypeAheadItem;
23
24
  errorInfo: TypeAheadErrorInfo;
24
25
  isEmptyQuery: boolean;
25
26
  items: Array<TypeAheadItem>;
@@ -14,6 +14,7 @@ export declare const TypeAheadList: React.FC<WithIntlProps<{
14
14
  api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
15
15
  decorationElement: HTMLElement;
16
16
  editorView: EditorView;
17
+ emptyItem?: TypeAheadItem;
17
18
  fitHeight: number;
18
19
  items: Array<TypeAheadItem>;
19
20
  moreElementsInQuickInsertViewEnabled?: boolean;
@@ -27,6 +28,7 @@ export declare const TypeAheadList: React.FC<WithIntlProps<{
27
28
  api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
28
29
  decorationElement: HTMLElement;
29
30
  editorView: EditorView;
31
+ emptyItem?: TypeAheadItem;
30
32
  fitHeight: number;
31
33
  items: Array<TypeAheadItem>;
32
34
  moreElementsInQuickInsertViewEnabled?: boolean;
@@ -20,6 +20,7 @@ type TypeAheadPopupProps = {
20
20
  }) => void;
21
21
  decorationSet: DecorationSet;
22
22
  editorView: EditorView;
23
+ emptyItem?: TypeAheadItem;
23
24
  errorInfo: TypeAheadErrorInfo;
24
25
  isEmptyQuery: boolean;
25
26
  items: Array<TypeAheadItem>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-type-ahead",
3
- "version": "10.0.16",
3
+ "version": "10.0.18",
4
4
  "description": "Type-ahead plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -29,7 +29,7 @@
29
29
  ],
30
30
  "atlaskit:src": "src/index.ts",
31
31
  "dependencies": {
32
- "@atlaskit/adf-schema": "^52.10.0",
32
+ "@atlaskit/adf-schema": "^52.11.0",
33
33
  "@atlaskit/editor-plugin-analytics": "^10.0.0",
34
34
  "@atlaskit/editor-plugin-connectivity": "^10.0.0",
35
35
  "@atlaskit/editor-plugin-context-panel": "^12.0.0",
@@ -44,7 +44,7 @@
44
44
  "@atlaskit/primitives": "^19.0.0",
45
45
  "@atlaskit/prosemirror-history": "^0.2.0",
46
46
  "@atlaskit/prosemirror-input-rules": "^3.6.0",
47
- "@atlaskit/tmp-editor-statsig": "^78.0.0",
47
+ "@atlaskit/tmp-editor-statsig": "^79.0.0",
48
48
  "@atlaskit/tokens": "^13.0.0",
49
49
  "@atlaskit/visually-hidden": "^3.1.0",
50
50
  "@babel/runtime": "^7.0.0",
@@ -56,7 +56,7 @@
56
56
  "w3c-keyname": "^2.1.8"
57
57
  },
58
58
  "peerDependencies": {
59
- "@atlaskit/editor-common": "^114.26.0",
59
+ "@atlaskit/editor-common": "^114.29.0",
60
60
  "react": "^18.2.0",
61
61
  "react-dom": "^18.2.0",
62
62
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"