@atlaskit/editor-plugin-type-ahead 1.4.4 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @atlaskit/editor-plugin-type-ahead
2
2
 
3
+ ## 1.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#122895](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/122895)
8
+ [`a2c733eaa3214`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a2c733eaa3214) -
9
+ [ED-24348] Change icon size for quick insert tyeahead to 32x32 when
10
+ platform_editor_more_elements_in_quick_insert_view is on
11
+ - [#122895](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/122895)
12
+ [`49b8c7658f3b5`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/49b8c7658f3b5) -
13
+ [ED-24173] bump @atlaskit/adf-schema to 40.3.0 and @atlassian/adf-schema-json to 1.18.0
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies
18
+
19
+ ## 1.4.5
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies
24
+
3
25
  ## 1.4.4
4
26
 
5
27
  ### Patch Changes
@@ -16,7 +16,10 @@ var _react = _interopRequireDefault(require("react"));
16
16
  var _react2 = require("@emotion/react");
17
17
  var _debounce = _interopRequireDefault(require("lodash/debounce"));
18
18
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
19
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /** @jsx jsx */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
19
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /**
20
+ * @jsxRuntime classic
21
+ * @jsx jsx
22
+ */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
20
23
  var statusDebounceMillis = 1400;
21
24
  var assitiveTextStyles = (0, _react2.css)({
22
25
  border: 0,
@@ -19,7 +19,10 @@ var _utils2 = require("../utils");
19
19
  var _AssistiveText = require("./AssistiveText");
20
20
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
21
21
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
22
- /** @jsx jsx */
22
+ /**
23
+ * @jsxRuntime classic
24
+ * @jsx jsx
25
+ */
23
26
 
24
27
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
25
28
 
@@ -21,7 +21,10 @@ var _AssistiveText = require("./AssistiveText");
21
21
  var _TypeAheadListItem = require("./TypeAheadListItem");
22
22
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
23
23
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
24
- /** @jsx jsx */
24
+ /**
25
+ * @jsxRuntime classic
26
+ * @jsx jsx
27
+ */
25
28
 
26
29
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
27
30
 
@@ -49,7 +52,8 @@ var TypeAheadListComponent = /*#__PURE__*/_react.default.memo(function (_ref2) {
49
52
  intl = _ref2.intl,
50
53
  fitHeight = _ref2.fitHeight,
51
54
  decorationElement = _ref2.decorationElement,
52
- triggerHandler = _ref2.triggerHandler;
55
+ triggerHandler = _ref2.triggerHandler,
56
+ moreElementsInQuickInsertViewEnabled = _ref2.moreElementsInQuickInsertViewEnabled;
53
57
  var listRef = (0, _react.useRef)();
54
58
  var listContainerRef = (0, _react.useRef)(null);
55
59
  var lastVisibleIndexes = (0, _react.useRef)({
@@ -252,7 +256,8 @@ var TypeAheadListComponent = /*#__PURE__*/_react.default.memo(function (_ref2) {
252
256
  itemIndex: index,
253
257
  selectedIndex: selectedIndex,
254
258
  onItemClick: actions.onItemClick,
255
- ariaLabel: (0, _utils.getTypeAheadListAriaLabels)(triggerHandler === null || triggerHandler === void 0 ? void 0 : triggerHandler.trigger, intl, currentItem).listItemAriaLabel
259
+ ariaLabel: (0, _utils.getTypeAheadListAriaLabels)(triggerHandler === null || triggerHandler === void 0 ? void 0 : triggerHandler.trigger, intl, currentItem).listItemAriaLabel,
260
+ moreElementsInQuickInsertViewEnabled: moreElementsInQuickInsertViewEnabled
256
261
  }))));
257
262
  };
258
263
  var popupAriaLabel = (0, _utils.getTypeAheadListAriaLabels)(triggerHandler === null || triggerHandler === void 0 ? void 0 : triggerHandler.trigger, intl).popupAriaLabel;
@@ -18,7 +18,10 @@ var _menu = require("@atlaskit/menu");
18
18
  var _colors = require("@atlaskit/theme/colors");
19
19
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5; // Disabling for ED-21403 fixing accessibility issue.
20
20
  /* eslint-disable jsx-a11y/role-supports-aria-props */
21
- /** @jsx jsx */
21
+ /**
22
+ * @jsxRuntime classic
23
+ * @jsx jsx
24
+ */
22
25
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
23
26
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
24
27
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -39,6 +42,23 @@ var itemIcon = exports.itemIcon = (0, _react2.css)({
39
42
  height: "var(--ds-space-500, 40px)"
40
43
  }
41
44
  });
45
+ var itemIconSize = (0, _react2.css)({
46
+ width: "var(--ds-space-400, 32px)",
47
+ height: "var(--ds-space-400, 32px)",
48
+ // Icon svgs may contain nested svg, which are likely smaller than 32px
49
+ // Hence only change the parent svg
50
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
51
+ 'svg:first-of-type': {
52
+ width: "var(--ds-space-400, 32px)",
53
+ height: "var(--ds-space-400, 32px)"
54
+ },
55
+ // AI icons may contain div as container of the icon
56
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
57
+ div: {
58
+ width: "var(--ds-space-400, 32px)",
59
+ height: "var(--ds-space-400, 32px)"
60
+ }
61
+ });
42
62
 
43
63
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
44
64
  var itemBody = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n\tdisplay: flex;\n\tflex-direction: row;\n\tflex-wrap: nowrap;\n\tjustify-content: space-between;\n"])));
@@ -122,7 +142,8 @@ var TypeAheadListItem = exports.TypeAheadListItem = /*#__PURE__*/_react.default.
122
142
  selectedIndex = _ref2.selectedIndex,
123
143
  onItemClick = _ref2.onItemClick,
124
144
  itemIndex = _ref2.itemIndex,
125
- ariaLabel = _ref2.ariaLabel;
145
+ ariaLabel = _ref2.ariaLabel,
146
+ moreElementsInQuickInsertViewEnabled = _ref2.moreElementsInQuickInsertViewEnabled;
126
147
  /**
127
148
  * To select and highlight the first Item when no item is selected
128
149
  * However selectedIndex remains -1, So that user does not skip the first item when down arrow key is used from typeahead query(inputQuery.tsx)
@@ -138,11 +159,11 @@ var TypeAheadListItem = exports.TypeAheadListItem = /*#__PURE__*/_react.default.
138
159
  customRenderItem = item.render;
139
160
  var elementIcon = (0, _react.useMemo)(function () {
140
161
  return (0, _react2.jsx)("div", {
141
- css: itemIcon
162
+ css: [itemIcon, moreElementsInQuickInsertViewEnabled && itemIconSize]
142
163
  }, icon ? icon() : (0, _react2.jsx)(FallbackIcon, {
143
164
  label: title
144
165
  }));
145
- }, [icon, title]);
166
+ }, [icon, title, moreElementsInQuickInsertViewEnabled]);
146
167
  var insertSelectedItem = (0, _react.useCallback)(function () {
147
168
  onItemClick(_typeAhead.SelectItemMode.SELECTED, itemIndex);
148
169
  }, [onItemClick, itemIndex]);
@@ -11,6 +11,8 @@ var _react = _interopRequireWildcard(require("react"));
11
11
  var _react2 = require("@emotion/react");
12
12
  var _rafSchd = _interopRequireDefault(require("raf-schd"));
13
13
  var _analytics = require("@atlaskit/editor-common/analytics");
14
+ var _hooks = require("@atlaskit/editor-common/hooks");
15
+ var _typeAhead = require("@atlaskit/editor-common/type-ahead");
14
16
  var _ui = require("@atlaskit/editor-common/ui");
15
17
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
16
18
  var _colors = require("@atlaskit/theme/colors");
@@ -18,7 +20,10 @@ var _constants = require("../constants");
18
20
  var _TypeAheadList = require("./TypeAheadList");
19
21
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
20
22
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
21
- /** @jsx jsx */
23
+ /**
24
+ * @jsxRuntime classic
25
+ * @jsx jsx
26
+ */
22
27
 
23
28
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
24
29
 
@@ -58,6 +63,8 @@ var TypeAheadPopup = exports.TypeAheadPopup = /*#__PURE__*/_react.default.memo(f
58
63
  cancel = props.cancel,
59
64
  api = props.api;
60
65
  var ref = (0, _react.useRef)(null);
66
+ var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['featureFlags']),
67
+ featureFlagsState = _useSharedPluginState.featureFlagsState;
61
68
  var startTime = (0, _react.useMemo)(function () {
62
69
  return performance.now();
63
70
  },
@@ -234,7 +241,8 @@ var TypeAheadPopup = exports.TypeAheadPopup = /*#__PURE__*/_react.default.memo(f
234
241
  fitHeight: fitHeight,
235
242
  editorView: editorView,
236
243
  decorationElement: anchorElement,
237
- triggerHandler: triggerHandler
244
+ triggerHandler: triggerHandler,
245
+ moreElementsInQuickInsertViewEnabled: (featureFlagsState === null || featureFlagsState === void 0 ? void 0 : featureFlagsState.moreElementsInQuickInsertView) && triggerHandler.id === _typeAhead.TypeAheadAvailableNodes.QUICK_INSERT
238
246
  })));
239
247
  });
240
248
  TypeAheadPopup.displayName = 'TypeAheadPopup';
@@ -1,5 +1,8 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- /** @jsx jsx */
2
+ /**
3
+ * @jsxRuntime classic
4
+ * @jsx jsx
5
+ */
3
6
 
4
7
  import React from 'react';
5
8
 
@@ -1,4 +1,7 @@
1
- /** @jsx jsx */
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
2
5
  import React, { Fragment, useCallback, useLayoutEffect, useRef, useState } from 'react';
3
6
 
4
7
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
@@ -1,4 +1,7 @@
1
- /** @jsx jsx */
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
2
5
 
3
6
  import React, { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';
4
7
 
@@ -38,7 +41,8 @@ const TypeAheadListComponent = /*#__PURE__*/React.memo(({
38
41
  intl,
39
42
  fitHeight,
40
43
  decorationElement,
41
- triggerHandler
44
+ triggerHandler,
45
+ moreElementsInQuickInsertViewEnabled
42
46
  }) => {
43
47
  var _decorationElement$qu2;
44
48
  const listRef = useRef();
@@ -233,7 +237,8 @@ const TypeAheadListComponent = /*#__PURE__*/React.memo(({
233
237
  itemIndex: index,
234
238
  selectedIndex: selectedIndex,
235
239
  onItemClick: actions.onItemClick,
236
- ariaLabel: getTypeAheadListAriaLabels(triggerHandler === null || triggerHandler === void 0 ? void 0 : triggerHandler.trigger, intl, currentItem).listItemAriaLabel
240
+ ariaLabel: getTypeAheadListAriaLabels(triggerHandler === null || triggerHandler === void 0 ? void 0 : triggerHandler.trigger, intl, currentItem).listItemAriaLabel,
241
+ moreElementsInQuickInsertViewEnabled: moreElementsInQuickInsertViewEnabled
237
242
  }))));
238
243
  };
239
244
  const popupAriaLabel = getTypeAheadListAriaLabels(triggerHandler === null || triggerHandler === void 0 ? void 0 : triggerHandler.trigger, intl).popupAriaLabel;
@@ -1,6 +1,9 @@
1
1
  // Disabling for ED-21403 fixing accessibility issue.
2
2
  /* eslint-disable jsx-a11y/role-supports-aria-props */
3
- /** @jsx jsx */
3
+ /**
4
+ * @jsxRuntime classic
5
+ * @jsx jsx
6
+ */
4
7
  import React, { useCallback, useLayoutEffect, useMemo } from 'react';
5
8
 
6
9
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
@@ -29,6 +32,23 @@ export const itemIcon = css({
29
32
  height: "var(--ds-space-500, 40px)"
30
33
  }
31
34
  });
35
+ const itemIconSize = css({
36
+ width: "var(--ds-space-400, 32px)",
37
+ height: "var(--ds-space-400, 32px)",
38
+ // Icon svgs may contain nested svg, which are likely smaller than 32px
39
+ // Hence only change the parent svg
40
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
41
+ 'svg:first-of-type': {
42
+ width: "var(--ds-space-400, 32px)",
43
+ height: "var(--ds-space-400, 32px)"
44
+ },
45
+ // AI icons may contain div as container of the icon
46
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
47
+ div: {
48
+ width: "var(--ds-space-400, 32px)",
49
+ height: "var(--ds-space-400, 32px)"
50
+ }
51
+ });
32
52
 
33
53
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
34
54
  const itemBody = css`
@@ -143,7 +163,8 @@ export const TypeAheadListItem = /*#__PURE__*/React.memo(({
143
163
  selectedIndex,
144
164
  onItemClick,
145
165
  itemIndex,
146
- ariaLabel
166
+ ariaLabel,
167
+ moreElementsInQuickInsertViewEnabled
147
168
  }) => {
148
169
  /**
149
170
  * To select and highlight the first Item when no item is selected
@@ -162,11 +183,11 @@ export const TypeAheadListItem = /*#__PURE__*/React.memo(({
162
183
  } = item;
163
184
  const elementIcon = useMemo(() => {
164
185
  return jsx("div", {
165
- css: itemIcon
186
+ css: [itemIcon, moreElementsInQuickInsertViewEnabled && itemIconSize]
166
187
  }, icon ? icon() : jsx(FallbackIcon, {
167
188
  label: title
168
189
  }));
169
- }, [icon, title]);
190
+ }, [icon, title, moreElementsInQuickInsertViewEnabled]);
170
191
  const insertSelectedItem = useCallback(() => {
171
192
  onItemClick(SelectItemMode.SELECTED, itemIndex);
172
193
  }, [onItemClick, itemIndex]);
@@ -1,10 +1,15 @@
1
- /** @jsx jsx */
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
2
5
  import React, { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
3
6
 
4
7
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
5
8
  import { css, jsx } from '@emotion/react';
6
9
  import rafSchedule from 'raf-schd';
7
10
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
11
+ import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
12
+ import { TypeAheadAvailableNodes } from '@atlaskit/editor-common/type-ahead';
8
13
  import { findOverflowScrollParent, Popup } from '@atlaskit/editor-common/ui';
9
14
  import { akEditorFloatingDialogZIndex } from '@atlaskit/editor-shared-styles';
10
15
  import { N0, N50A, N60A } from '@atlaskit/theme/colors';
@@ -49,6 +54,9 @@ export const TypeAheadPopup = /*#__PURE__*/React.memo(props => {
49
54
  api
50
55
  } = props;
51
56
  const ref = useRef(null);
57
+ const {
58
+ featureFlagsState
59
+ } = useSharedPluginState(api, ['featureFlags']);
52
60
  const startTime = useMemo(() => performance.now(),
53
61
  // In case those props changes
54
62
  // we need to recreate the startTime
@@ -228,7 +236,8 @@ export const TypeAheadPopup = /*#__PURE__*/React.memo(props => {
228
236
  fitHeight: fitHeight,
229
237
  editorView: editorView,
230
238
  decorationElement: anchorElement,
231
- triggerHandler: triggerHandler
239
+ triggerHandler: triggerHandler,
240
+ moreElementsInQuickInsertViewEnabled: (featureFlagsState === null || featureFlagsState === void 0 ? void 0 : featureFlagsState.moreElementsInQuickInsertView) && triggerHandler.id === TypeAheadAvailableNodes.QUICK_INSERT
232
241
  })));
233
242
  });
234
243
  TypeAheadPopup.displayName = 'TypeAheadPopup';
@@ -7,7 +7,10 @@ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
7
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
8
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
9
9
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
10
- /** @jsx jsx */
10
+ /**
11
+ * @jsxRuntime classic
12
+ * @jsx jsx
13
+ */
11
14
 
12
15
  import React from 'react';
13
16
 
@@ -1,5 +1,8 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- /** @jsx jsx */
2
+ /**
3
+ * @jsxRuntime classic
4
+ * @jsx jsx
5
+ */
3
6
  import React, { Fragment, useCallback, useLayoutEffect, useRef, useState } from 'react';
4
7
 
5
8
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
@@ -1,5 +1,8 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- /** @jsx jsx */
2
+ /**
3
+ * @jsxRuntime classic
4
+ * @jsx jsx
5
+ */
3
6
 
4
7
  import React, { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';
5
8
 
@@ -39,7 +42,8 @@ var TypeAheadListComponent = /*#__PURE__*/React.memo(function (_ref2) {
39
42
  intl = _ref2.intl,
40
43
  fitHeight = _ref2.fitHeight,
41
44
  decorationElement = _ref2.decorationElement,
42
- triggerHandler = _ref2.triggerHandler;
45
+ triggerHandler = _ref2.triggerHandler,
46
+ moreElementsInQuickInsertViewEnabled = _ref2.moreElementsInQuickInsertViewEnabled;
43
47
  var listRef = useRef();
44
48
  var listContainerRef = useRef(null);
45
49
  var lastVisibleIndexes = useRef({
@@ -242,7 +246,8 @@ var TypeAheadListComponent = /*#__PURE__*/React.memo(function (_ref2) {
242
246
  itemIndex: index,
243
247
  selectedIndex: selectedIndex,
244
248
  onItemClick: actions.onItemClick,
245
- ariaLabel: getTypeAheadListAriaLabels(triggerHandler === null || triggerHandler === void 0 ? void 0 : triggerHandler.trigger, intl, currentItem).listItemAriaLabel
249
+ ariaLabel: getTypeAheadListAriaLabels(triggerHandler === null || triggerHandler === void 0 ? void 0 : triggerHandler.trigger, intl, currentItem).listItemAriaLabel,
250
+ moreElementsInQuickInsertViewEnabled: moreElementsInQuickInsertViewEnabled
246
251
  }))));
247
252
  };
248
253
  var popupAriaLabel = getTypeAheadListAriaLabels(triggerHandler === null || triggerHandler === void 0 ? void 0 : triggerHandler.trigger, intl).popupAriaLabel;
@@ -2,7 +2,10 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
2
2
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
3
3
  // Disabling for ED-21403 fixing accessibility issue.
4
4
  /* eslint-disable jsx-a11y/role-supports-aria-props */
5
- /** @jsx jsx */
5
+ /**
6
+ * @jsxRuntime classic
7
+ * @jsx jsx
8
+ */
6
9
  import React, { useCallback, useLayoutEffect, useMemo } from 'react';
7
10
 
8
11
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
@@ -31,6 +34,23 @@ export var itemIcon = css({
31
34
  height: "var(--ds-space-500, 40px)"
32
35
  }
33
36
  });
37
+ var itemIconSize = css({
38
+ width: "var(--ds-space-400, 32px)",
39
+ height: "var(--ds-space-400, 32px)",
40
+ // Icon svgs may contain nested svg, which are likely smaller than 32px
41
+ // Hence only change the parent svg
42
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
43
+ 'svg:first-of-type': {
44
+ width: "var(--ds-space-400, 32px)",
45
+ height: "var(--ds-space-400, 32px)"
46
+ },
47
+ // AI icons may contain div as container of the icon
48
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
49
+ div: {
50
+ width: "var(--ds-space-400, 32px)",
51
+ height: "var(--ds-space-400, 32px)"
52
+ }
53
+ });
34
54
 
35
55
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
36
56
  var itemBody = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\tdisplay: flex;\n\tflex-direction: row;\n\tflex-wrap: nowrap;\n\tjustify-content: space-between;\n"])));
@@ -114,7 +134,8 @@ export var TypeAheadListItem = /*#__PURE__*/React.memo(function (_ref2) {
114
134
  selectedIndex = _ref2.selectedIndex,
115
135
  onItemClick = _ref2.onItemClick,
116
136
  itemIndex = _ref2.itemIndex,
117
- ariaLabel = _ref2.ariaLabel;
137
+ ariaLabel = _ref2.ariaLabel,
138
+ moreElementsInQuickInsertViewEnabled = _ref2.moreElementsInQuickInsertViewEnabled;
118
139
  /**
119
140
  * To select and highlight the first Item when no item is selected
120
141
  * However selectedIndex remains -1, So that user does not skip the first item when down arrow key is used from typeahead query(inputQuery.tsx)
@@ -130,11 +151,11 @@ export var TypeAheadListItem = /*#__PURE__*/React.memo(function (_ref2) {
130
151
  customRenderItem = item.render;
131
152
  var elementIcon = useMemo(function () {
132
153
  return jsx("div", {
133
- css: itemIcon
154
+ css: [itemIcon, moreElementsInQuickInsertViewEnabled && itemIconSize]
134
155
  }, icon ? icon() : jsx(FallbackIcon, {
135
156
  label: title
136
157
  }));
137
- }, [icon, title]);
158
+ }, [icon, title, moreElementsInQuickInsertViewEnabled]);
138
159
  var insertSelectedItem = useCallback(function () {
139
160
  onItemClick(SelectItemMode.SELECTED, itemIndex);
140
161
  }, [onItemClick, itemIndex]);
@@ -1,11 +1,16 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- /** @jsx jsx */
2
+ /**
3
+ * @jsxRuntime classic
4
+ * @jsx jsx
5
+ */
3
6
  import React, { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
4
7
 
5
8
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
6
9
  import { css, jsx } from '@emotion/react';
7
10
  import rafSchedule from 'raf-schd';
8
11
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
12
+ import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
13
+ import { TypeAheadAvailableNodes } from '@atlaskit/editor-common/type-ahead';
9
14
  import { findOverflowScrollParent, Popup } from '@atlaskit/editor-common/ui';
10
15
  import { akEditorFloatingDialogZIndex } from '@atlaskit/editor-shared-styles';
11
16
  import { N0, N50A, N60A } from '@atlaskit/theme/colors';
@@ -47,6 +52,8 @@ export var TypeAheadPopup = /*#__PURE__*/React.memo(function (props) {
47
52
  cancel = props.cancel,
48
53
  api = props.api;
49
54
  var ref = useRef(null);
55
+ var _useSharedPluginState = useSharedPluginState(api, ['featureFlags']),
56
+ featureFlagsState = _useSharedPluginState.featureFlagsState;
50
57
  var startTime = useMemo(function () {
51
58
  return performance.now();
52
59
  },
@@ -223,7 +230,8 @@ export var TypeAheadPopup = /*#__PURE__*/React.memo(function (props) {
223
230
  fitHeight: fitHeight,
224
231
  editorView: editorView,
225
232
  decorationElement: anchorElement,
226
- triggerHandler: triggerHandler
233
+ triggerHandler: triggerHandler,
234
+ moreElementsInQuickInsertViewEnabled: (featureFlagsState === null || featureFlagsState === void 0 ? void 0 : featureFlagsState.moreElementsInQuickInsertView) && triggerHandler.id === TypeAheadAvailableNodes.QUICK_INSERT
227
235
  })));
228
236
  });
229
237
  TypeAheadPopup.displayName = 'TypeAheadPopup';
@@ -2,6 +2,7 @@ import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
2
  import type { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
3
3
  import type { Command, NextEditorPlugin, OptionalPlugin, TypeAheadForceSelect, TypeAheadHandler, TypeAheadInsert, TypeAheadItem, TypeAheadItemRenderProps, TypeAheadSelectItem, TypeAheadStats, UiComponentFactoryParams } from '@atlaskit/editor-common/types';
4
4
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
5
+ import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
5
6
  import type { EditorState, ReadonlyTransaction, Transaction } from '@atlaskit/editor-prosemirror/state';
6
7
  import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
7
8
  import type { CloseSelectionOptions } from './constants';
@@ -99,7 +100,7 @@ export interface TypeAheadPluginSharedState {
99
100
  */
100
101
  export type TypeAheadPlugin = NextEditorPlugin<'typeAhead', {
101
102
  pluginConfiguration: TypeAheadPluginOptions | undefined;
102
- dependencies: [OptionalPlugin<AnalyticsPlugin>];
103
+ dependencies: [OptionalPlugin<AnalyticsPlugin>, OptionalPlugin<FeatureFlagsPlugin>];
103
104
  sharedState: TypeAheadPluginSharedState;
104
105
  actions: {
105
106
  isOpen: (editorState: EditorState) => boolean;
@@ -1,4 +1,7 @@
1
- /** @jsx jsx */
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
2
5
  /// <reference types="lodash" />
3
6
  import React from 'react';
4
7
  import { jsx } from '@emotion/react';
@@ -1,4 +1,7 @@
1
- /** @jsx jsx */
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
2
5
  import React from 'react';
3
6
  import { jsx } from '@emotion/react';
4
7
  import { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
@@ -1,4 +1,7 @@
1
- /** @jsx jsx */
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
2
5
  import React from 'react';
3
6
  import type { WrappedComponentProps } from 'react-intl-next';
4
7
  import { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
@@ -12,6 +15,7 @@ export declare const TypeAheadList: React.FC<import("react-intl-next").WithIntlP
12
15
  fitHeight: number;
13
16
  decorationElement: HTMLElement;
14
17
  triggerHandler?: TypeAheadHandler | undefined;
18
+ moreElementsInQuickInsertViewEnabled?: boolean | undefined;
15
19
  } & WrappedComponentProps>> & {
16
20
  WrappedComponent: React.ComponentType<{
17
21
  items: Array<TypeAheadItem>;
@@ -21,5 +25,6 @@ export declare const TypeAheadList: React.FC<import("react-intl-next").WithIntlP
21
25
  fitHeight: number;
22
26
  decorationElement: HTMLElement;
23
27
  triggerHandler?: TypeAheadHandler | undefined;
28
+ moreElementsInQuickInsertViewEnabled?: boolean | undefined;
24
29
  } & WrappedComponentProps>;
25
30
  };
@@ -1,4 +1,7 @@
1
- /** @jsx jsx */
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
2
5
  import React from 'react';
3
6
  import { jsx } from '@emotion/react';
4
7
  import { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
@@ -11,6 +14,7 @@ type TypeAheadListItemProps = {
11
14
  selectedIndex: number;
12
15
  ariaLabel?: string;
13
16
  onItemClick: (mode: SelectItemMode, index: number) => void;
17
+ moreElementsInQuickInsertViewEnabled?: boolean;
14
18
  };
15
- export declare const TypeAheadListItem: React.MemoExoticComponent<({ item, itemsLength, selectedIndex, onItemClick, itemIndex, ariaLabel, }: TypeAheadListItemProps) => jsx.JSX.Element>;
19
+ export declare const TypeAheadListItem: React.MemoExoticComponent<({ item, itemsLength, selectedIndex, onItemClick, itemIndex, ariaLabel, moreElementsInQuickInsertViewEnabled, }: TypeAheadListItemProps) => jsx.JSX.Element>;
16
20
  export {};
@@ -1,4 +1,7 @@
1
- /** @jsx jsx */
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
2
5
  import React from 'react';
3
6
  import { jsx } from '@emotion/react';
4
7
  import type { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
@@ -2,6 +2,7 @@ import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
2
  import type { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
3
3
  import type { Command, NextEditorPlugin, OptionalPlugin, TypeAheadForceSelect, TypeAheadHandler, TypeAheadInsert, TypeAheadItem, TypeAheadItemRenderProps, TypeAheadSelectItem, TypeAheadStats, UiComponentFactoryParams } from '@atlaskit/editor-common/types';
4
4
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
5
+ import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
5
6
  import type { EditorState, ReadonlyTransaction, Transaction } from '@atlaskit/editor-prosemirror/state';
6
7
  import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
7
8
  import type { CloseSelectionOptions } from './constants';
@@ -100,7 +101,8 @@ export interface TypeAheadPluginSharedState {
100
101
  export type TypeAheadPlugin = NextEditorPlugin<'typeAhead', {
101
102
  pluginConfiguration: TypeAheadPluginOptions | undefined;
102
103
  dependencies: [
103
- OptionalPlugin<AnalyticsPlugin>
104
+ OptionalPlugin<AnalyticsPlugin>,
105
+ OptionalPlugin<FeatureFlagsPlugin>
104
106
  ];
105
107
  sharedState: TypeAheadPluginSharedState;
106
108
  actions: {
@@ -1,5 +1,8 @@
1
1
  /// <reference types="lodash" />
2
- /** @jsx jsx */
2
+ /**
3
+ * @jsxRuntime classic
4
+ * @jsx jsx
5
+ */
3
6
  import React from 'react';
4
7
  import { jsx } from '@emotion/react';
5
8
  import debounce from 'lodash/debounce';
@@ -1,4 +1,7 @@
1
- /** @jsx jsx */
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
2
5
  import React from 'react';
3
6
  import { jsx } from '@emotion/react';
4
7
  import { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
@@ -1,4 +1,7 @@
1
- /** @jsx jsx */
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
2
5
  import React from 'react';
3
6
  import type { WrappedComponentProps } from 'react-intl-next';
4
7
  import { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
@@ -12,6 +15,7 @@ export declare const TypeAheadList: React.FC<import("react-intl-next").WithIntlP
12
15
  fitHeight: number;
13
16
  decorationElement: HTMLElement;
14
17
  triggerHandler?: TypeAheadHandler | undefined;
18
+ moreElementsInQuickInsertViewEnabled?: boolean | undefined;
15
19
  } & WrappedComponentProps>> & {
16
20
  WrappedComponent: React.ComponentType<{
17
21
  items: Array<TypeAheadItem>;
@@ -21,5 +25,6 @@ export declare const TypeAheadList: React.FC<import("react-intl-next").WithIntlP
21
25
  fitHeight: number;
22
26
  decorationElement: HTMLElement;
23
27
  triggerHandler?: TypeAheadHandler | undefined;
28
+ moreElementsInQuickInsertViewEnabled?: boolean | undefined;
24
29
  } & WrappedComponentProps>;
25
30
  };
@@ -1,4 +1,7 @@
1
- /** @jsx jsx */
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
2
5
  import React from 'react';
3
6
  import { jsx } from '@emotion/react';
4
7
  import { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
@@ -11,6 +14,7 @@ type TypeAheadListItemProps = {
11
14
  selectedIndex: number;
12
15
  ariaLabel?: string;
13
16
  onItemClick: (mode: SelectItemMode, index: number) => void;
17
+ moreElementsInQuickInsertViewEnabled?: boolean;
14
18
  };
15
- export declare const TypeAheadListItem: React.MemoExoticComponent<({ item, itemsLength, selectedIndex, onItemClick, itemIndex, ariaLabel, }: TypeAheadListItemProps) => jsx.JSX.Element>;
19
+ export declare const TypeAheadListItem: React.MemoExoticComponent<({ item, itemsLength, selectedIndex, onItemClick, itemIndex, ariaLabel, moreElementsInQuickInsertViewEnabled, }: TypeAheadListItemProps) => jsx.JSX.Element>;
16
20
  export {};
@@ -1,4 +1,7 @@
1
- /** @jsx jsx */
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
2
5
  import React from 'react';
3
6
  import { jsx } from '@emotion/react';
4
7
  import type { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-type-ahead",
3
- "version": "1.4.4",
3
+ "version": "1.5.0",
4
4
  "description": "Type-ahead plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,15 +32,15 @@
32
32
  ".": "./src/index.ts"
33
33
  },
34
34
  "dependencies": {
35
- "@atlaskit/adf-schema": "^39.0.3",
36
- "@atlaskit/editor-common": "^85.0.0",
37
- "@atlaskit/editor-plugin-analytics": "^1.4.0",
35
+ "@atlaskit/adf-schema": "^40.3.0",
36
+ "@atlaskit/editor-common": "^86.7.0",
37
+ "@atlaskit/editor-plugin-analytics": "^1.5.0",
38
38
  "@atlaskit/editor-prosemirror": "4.0.1",
39
39
  "@atlaskit/editor-shared-styles": "^2.13.0",
40
40
  "@atlaskit/menu": "^2.8.0",
41
41
  "@atlaskit/prosemirror-input-rules": "^3.1.0",
42
42
  "@atlaskit/theme": "^12.11.0",
43
- "@atlaskit/tokens": "^1.54.0",
43
+ "@atlaskit/tokens": "^1.56.0",
44
44
  "@babel/runtime": "^7.0.0",
45
45
  "@emotion/react": "^11.7.1",
46
46
  "lodash": "^4.17.21",