@atlaskit/jql-editor 5.4.6 → 5.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.
Files changed (50) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/cjs/analytics/util.js +1 -1
  3. package/dist/cjs/plugins/autocomplete/components/autocomplete-dropdown/index.js +118 -42
  4. package/dist/cjs/plugins/autocomplete/components/autocomplete-dropdown/styled.js +12 -8
  5. package/dist/es2019/analytics/util.js +1 -1
  6. package/dist/es2019/plugins/autocomplete/components/autocomplete-dropdown/index.js +87 -20
  7. package/dist/es2019/plugins/autocomplete/components/autocomplete-dropdown/styled.js +9 -5
  8. package/dist/esm/analytics/util.js +1 -1
  9. package/dist/esm/plugins/autocomplete/components/autocomplete-dropdown/index.js +119 -43
  10. package/dist/esm/plugins/autocomplete/components/autocomplete-dropdown/styled.js +12 -7
  11. package/dist/types/accessibility/styled.d.ts +2 -3
  12. package/dist/types/common/styled.d.ts +2 -3
  13. package/dist/types/hooks/use-editor-theme/index.d.ts +2 -3
  14. package/dist/types/plugins/autocomplete/components/autocomplete-dropdown/index.d.ts +1 -1
  15. package/dist/types/plugins/autocomplete/components/autocomplete-dropdown/styled.d.ts +9 -9
  16. package/dist/types/plugins/autocomplete/components/autocomplete-option/styled.d.ts +14 -15
  17. package/dist/types/plugins/rich-inline-nodes/nodes/user/styled.d.ts +6 -7
  18. package/dist/types/state/util.d.ts +3 -3
  19. package/dist/types/ui/index.d.ts +0 -1
  20. package/dist/types/ui/intl-provider/index.d.ts +1 -1
  21. package/dist/types/ui/jql-editor-controls-content/base-expand-toggle/styled.d.ts +2 -3
  22. package/dist/types/ui/jql-editor-controls-content/base-syntax-help/styled.d.ts +2 -3
  23. package/dist/types/ui/jql-editor-footer-content/jql-editor-help/styled.d.ts +2 -3
  24. package/dist/types/ui/jql-editor-footer-content/jql-messages/format/styled.d.ts +4 -5
  25. package/dist/types/ui/jql-editor-layout/index.d.ts +2 -2
  26. package/dist/types/ui/jql-editor-layout/styled.d.ts +19 -20
  27. package/dist/types/ui/jql-editor-portal-provider/context.d.ts +0 -1
  28. package/dist/types/ui/jql-editor-view/index.d.ts +1 -1
  29. package/dist/types/ui/tooltip-tag/styled.d.ts +2 -3
  30. package/dist/types-ts4.5/accessibility/styled.d.ts +2 -3
  31. package/dist/types-ts4.5/common/styled.d.ts +2 -3
  32. package/dist/types-ts4.5/hooks/use-editor-theme/index.d.ts +2 -3
  33. package/dist/types-ts4.5/plugins/autocomplete/components/autocomplete-dropdown/index.d.ts +1 -1
  34. package/dist/types-ts4.5/plugins/autocomplete/components/autocomplete-dropdown/styled.d.ts +9 -9
  35. package/dist/types-ts4.5/plugins/autocomplete/components/autocomplete-option/styled.d.ts +14 -15
  36. package/dist/types-ts4.5/plugins/rich-inline-nodes/nodes/user/styled.d.ts +6 -7
  37. package/dist/types-ts4.5/state/util.d.ts +3 -3
  38. package/dist/types-ts4.5/ui/index.d.ts +0 -1
  39. package/dist/types-ts4.5/ui/intl-provider/index.d.ts +1 -1
  40. package/dist/types-ts4.5/ui/jql-editor-controls-content/base-expand-toggle/styled.d.ts +2 -3
  41. package/dist/types-ts4.5/ui/jql-editor-controls-content/base-syntax-help/styled.d.ts +2 -3
  42. package/dist/types-ts4.5/ui/jql-editor-footer-content/jql-editor-help/styled.d.ts +2 -3
  43. package/dist/types-ts4.5/ui/jql-editor-footer-content/jql-messages/format/styled.d.ts +4 -5
  44. package/dist/types-ts4.5/ui/jql-editor-layout/index.d.ts +2 -2
  45. package/dist/types-ts4.5/ui/jql-editor-layout/styled.d.ts +19 -20
  46. package/dist/types-ts4.5/ui/jql-editor-portal-provider/context.d.ts +0 -1
  47. package/dist/types-ts4.5/ui/jql-editor-view/index.d.ts +1 -1
  48. package/dist/types-ts4.5/ui/tooltip-tag/styled.d.ts +2 -3
  49. package/i18n/package.json +1 -1
  50. package/package.json +9 -6
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlaskit/jql-editor
2
2
 
3
+ ## 5.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`32bfbde8f1bc0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/32bfbde8f1bc0) -
8
+ [ux] Fix visual bug where auto select dropdown would go off screen, creating scrollbar, when
9
+ window was too small
10
+
3
11
  ## 5.4.6
4
12
 
5
13
  ### Patch Changes
@@ -6,5 +6,5 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.useJqlEditorAnalytics = void 0;
7
7
  var _jqlEditorCommon = require("@atlaskit/jql-editor-common");
8
8
  var useJqlEditorAnalytics = exports.useJqlEditorAnalytics = function useJqlEditorAnalytics(analyticsSource) {
9
- return (0, _jqlEditorCommon.useJqlPackageAnalytics)(analyticsSource, "@atlaskit/jql-editor", "5.4.5", _jqlEditorCommon.ANALYTICS_CHANNEL);
9
+ return (0, _jqlEditorCommon.useJqlPackageAnalytics)(analyticsSource, "@atlaskit/jql-editor", "5.4.6", _jqlEditorCommon.ANALYTICS_CHANNEL);
10
10
  };
@@ -9,6 +9,8 @@ exports.default = void 0;
9
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
10
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
11
  var _react = _interopRequireWildcard(require("react"));
12
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
13
+ var _popper = require("@atlaskit/popper");
12
14
  var _spinner = _interopRequireDefault(require("@atlaskit/spinner"));
13
15
  var _accessibility = require("../../../../accessibility");
14
16
  var _constants = require("../../../../common/constants");
@@ -63,6 +65,9 @@ var AutocompleteDropdown = function AutocompleteDropdown(_ref) {
63
65
  var _useIntl = (0, _state.useIntl)(),
64
66
  _useIntl2 = (0, _slicedToArray2.default)(_useIntl, 1),
65
67
  intl = _useIntl2[0];
68
+ var _useEditorView = (0, _state.useEditorView)(),
69
+ _useEditorView2 = (0, _slicedToArray2.default)(_useEditorView, 1),
70
+ editorView = _useEditorView2[0];
66
71
  var _useStoreActions = (0, _state.useStoreActions)(),
67
72
  _useStoreActions2 = (0, _slicedToArray2.default)(_useStoreActions, 2),
68
73
  _useStoreActions2$ = _useStoreActions2[1],
@@ -89,10 +94,42 @@ var AutocompleteDropdown = function AutocompleteDropdown(_ref) {
89
94
  var _useScopedId = (0, _state.useScopedId)(_constants.JQL_EDITOR_AUTOCOMPLETE_ID),
90
95
  _useScopedId2 = (0, _slicedToArray2.default)(_useScopedId, 1),
91
96
  autocompleteId = _useScopedId2[0];
97
+ var isPopperPositioningEnabled = (0, _platformFeatureFlags.fg)('jql_editor_autocomplete_use_popper');
98
+
99
+ // Create virtual reference element positioned at cursor location (for popper implementation)
100
+ var virtualReferenceElement = (0, _react.useMemo)(function () {
101
+ if (!isPopperPositioningEnabled || !editorView || !isAutocompleteOpen) {
102
+ return null;
103
+ }
104
+
105
+ // Create a virtual element that uses the same positioning logic as the old implementation
106
+ return {
107
+ getBoundingClientRect: function getBoundingClientRect() {
108
+ // Use the same top/left values that the old manual positioning uses
109
+ // This ensures consistency between old and new positioning
110
+ var rect = {
111
+ width: 0,
112
+ height: 0,
113
+ top: top,
114
+ left: left,
115
+ right: left,
116
+ bottom: top,
117
+ x: left,
118
+ y: top,
119
+ toJSON: function toJSON() {
120
+ return rect;
121
+ }
122
+ };
123
+ return rect;
124
+ }
125
+ };
126
+ }, [isPopperPositioningEnabled, editorView, isAutocompleteOpen, top, left]);
92
127
  var onContainerRef = (0, _react.useCallback)(function (container) {
93
128
  containerRef.current = container;
94
- setAutocompleteContainer(container);
95
- }, [containerRef, setAutocompleteContainer]);
129
+ if (!isPopperPositioningEnabled) {
130
+ setAutocompleteContainer(container);
131
+ }
132
+ }, [setAutocompleteContainer, isPopperPositioningEnabled]);
96
133
  var onScrollContainerRef = (0, _react.useCallback)(function (container) {
97
134
  scrollContainerRef.current = container;
98
135
  }, [scrollContainerRef]);
@@ -199,13 +236,15 @@ var AutocompleteDropdown = function AutocompleteDropdown(_ref) {
199
236
  }
200
237
  }, [isAutocompleteOpen, options, selectedOptionId, setSelectedAutocompleteOptionId]);
201
238
  (0, _react.useLayoutEffect)(function () {
202
- requestAnimationFrame(function () {
203
- if (containerRef.current) {
204
- containerRef.current.style.top = "".concat(top, "px");
205
- containerRef.current.style.left = "".concat(left, "px");
206
- }
207
- });
208
- }, [top, left]);
239
+ if (!isPopperPositioningEnabled) {
240
+ requestAnimationFrame(function () {
241
+ if (containerRef.current) {
242
+ containerRef.current.style.top = "".concat(top, "px");
243
+ containerRef.current.style.left = "".concat(left, "px");
244
+ }
245
+ });
246
+ }
247
+ }, [top, left, isPopperPositioningEnabled]);
209
248
  (0, _react.useLayoutEffect)(function () {
210
249
  if (navigatingWithKeyboard) {
211
250
  var _selectedItemRef$curr;
@@ -231,45 +270,82 @@ var AutocompleteDropdown = function AutocompleteDropdown(_ref) {
231
270
  }
232
271
  return intl.formatMessage(_messages.messages.optionsFound);
233
272
  }, [isAutocompleteOpen, intl, options]);
234
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_styled.AutocompleteContainer, {
273
+ var renderAutocompleteContent = function renderAutocompleteContent() {
274
+ return /*#__PURE__*/_react.default.createElement(_styled.AutocompleteOptionsContainer, {
275
+ ref: onScrollContainerRef,
276
+ onMouseMove: onMouseMove
277
+ }, /*#__PURE__*/_react.default.createElement(_styled.OptionList, {
278
+ role: "listbox",
279
+ id: autocompleteId
280
+ }, options.map(function (option, index) {
281
+ var isSelected = option.id === selectedOptionId;
282
+ return /*#__PURE__*/_react.default.createElement(_autocompleteOption.default, (0, _extends2.default)({
283
+ key: option.value,
284
+ isSelected: isSelected
285
+ }, isSelected && {
286
+ ref: selectedItemRef
287
+ }, {
288
+ option: option,
289
+ onClick: function onClick() {
290
+ return handleClick(option, index, false);
291
+ },
292
+ onMouseMove: function onMouseMove() {
293
+ var _options$index;
294
+ if (((_options$index = options[index]) === null || _options$index === void 0 ? void 0 : _options$index.id) !== selectedOptionId) {
295
+ var _options$index2;
296
+ setSelectedAutocompleteOptionId((_options$index2 = options[index]) === null || _options$index2 === void 0 ? void 0 : _options$index2.id);
297
+ }
298
+ }
299
+ }));
300
+ })));
301
+ };
302
+ var renderLoadingFooter = function renderLoadingFooter() {
303
+ return loading && /*#__PURE__*/_react.default.createElement(_styled.AutocompleteLoadingFooter, {
304
+ "data-testid": "jql-editor-autocomplete-loading",
305
+ hasOptions: !!options.length
306
+ }, /*#__PURE__*/_react.default.createElement(_spinner.default, {
307
+ size: "small"
308
+ }));
309
+ };
310
+
311
+ // Early return if popper positioning is enabled but virtual reference element is not available
312
+ if (isPopperPositioningEnabled && !virtualReferenceElement) {
313
+ return null;
314
+ }
315
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, isPopperPositioningEnabled ?
316
+ /*#__PURE__*/
317
+ // New popper-based positioning
318
+ _react.default.createElement(_popper.Popper, {
319
+ referenceElement: virtualReferenceElement,
320
+ placement: "bottom-start",
321
+ shouldFitViewport: true
322
+ }, function (_ref2) {
323
+ var ref = _ref2.ref,
324
+ style = _ref2.style;
325
+ return /*#__PURE__*/_react.default.createElement(_styled.AutocompleteContainer, {
326
+ "data-testid": "jql-editor-autocomplete",
327
+ tabIndex: -1,
328
+ ref: ref
329
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Popper requires dynamic positioning via style prop
330
+ ,
331
+ style: style,
332
+ isOpen: isAutocompleteOpen,
333
+ usePopper: true,
334
+ onBlur: onEditorViewBlur,
335
+ onFocus: onEditorViewFocus
336
+ }, renderAutocompleteContent(), renderLoadingFooter());
337
+ }) :
338
+ /*#__PURE__*/
339
+ // Old manual positioning
340
+ _react.default.createElement(_styled.AutocompleteContainer, {
235
341
  "data-testid": "jql-editor-autocomplete",
236
342
  tabIndex: -1,
237
343
  ref: onContainerRef,
238
344
  isOpen: isAutocompleteOpen,
345
+ usePopper: false,
239
346
  onBlur: onEditorViewBlur,
240
347
  onFocus: onEditorViewFocus
241
- }, /*#__PURE__*/_react.default.createElement(_styled.AutocompleteOptionsContainer, {
242
- ref: onScrollContainerRef,
243
- onMouseMove: onMouseMove
244
- }, /*#__PURE__*/_react.default.createElement(_styled.OptionList, {
245
- role: "listbox",
246
- id: autocompleteId
247
- }, options.map(function (option, index) {
248
- var isSelected = option.id === selectedOptionId;
249
- return /*#__PURE__*/_react.default.createElement(_autocompleteOption.default, (0, _extends2.default)({
250
- key: option.value,
251
- isSelected: isSelected
252
- }, isSelected && {
253
- ref: selectedItemRef
254
- }, {
255
- option: option,
256
- onClick: function onClick() {
257
- return handleClick(option, index, false);
258
- },
259
- onMouseMove: function onMouseMove() {
260
- var _options$index;
261
- if (((_options$index = options[index]) === null || _options$index === void 0 ? void 0 : _options$index.id) !== selectedOptionId) {
262
- var _options$index2;
263
- setSelectedAutocompleteOptionId((_options$index2 = options[index]) === null || _options$index2 === void 0 ? void 0 : _options$index2.id);
264
- }
265
- }
266
- }));
267
- }))), loading && /*#__PURE__*/_react.default.createElement(_styled.AutocompleteLoadingFooter, {
268
- "data-testid": "jql-editor-autocomplete-loading",
269
- hasOptions: !!options.length
270
- }, /*#__PURE__*/_react.default.createElement(_spinner.default, {
271
- size: "small"
272
- }))), /*#__PURE__*/_react.default.createElement(_accessibility.ScreenReaderText, {
348
+ }, renderAutocompleteContent(), renderLoadingFooter()), /*#__PURE__*/_react.default.createElement(_accessibility.ScreenReaderText, {
273
349
  role: "status",
274
350
  "aria-live": "polite"
275
351
  }, announcedMessage));
@@ -5,14 +5,11 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.OptionList = exports.AutocompleteOptionsContainer = exports.AutocompleteLoadingFooter = exports.AutocompleteContainer = void 0;
8
- var _react = require("@emotion/react");
9
8
  var _styled = _interopRequireDefault(require("@emotion/styled"));
10
9
  var _colors = require("@atlaskit/theme/colors");
11
10
  var _constants = require("@atlaskit/theme/constants");
12
11
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
13
12
 
14
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
15
-
16
13
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-styled, @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
17
14
  var AutocompleteContainer = exports.AutocompleteContainer = _styled.default.div({
18
15
  position: 'absolute',
@@ -33,11 +30,18 @@ var AutocompleteContainer = exports.AutocompleteContainer = _styled.default.div(
33
30
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-dynamic-styles, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
34
31
  function (_ref) {
35
32
  var isOpen = _ref.isOpen;
36
- return isOpen ? (0, _react.css)({
33
+ return isOpen ? {
37
34
  visibility: 'visible'
38
- }) : (0, _react.css)({
35
+ } : {
39
36
  visibility: 'hidden'
40
- });
37
+ };
38
+ },
39
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-dynamic-styles, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
40
+ function (_ref2) {
41
+ var usePopper = _ref2.usePopper;
42
+ return usePopper && {
43
+ marginTop: "var(--ds-space-100, 8px)"
44
+ };
41
45
  });
42
46
 
43
47
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-styled, @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
@@ -63,8 +67,8 @@ var AutocompleteLoadingFooter = exports.AutocompleteLoadingFooter = _styled.defa
63
67
  textAlign: 'center'
64
68
  },
65
69
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-dynamic-styles -- Ignored via go/DSP-18766
66
- function (_ref2) {
67
- var hasOptions = _ref2.hasOptions;
70
+ function (_ref3) {
71
+ var hasOptions = _ref3.hasOptions;
68
72
  return hasOptions && {
69
73
  borderTop: "solid 1px ".concat("var(--ds-border, ".concat(_colors.N40, ")")),
70
74
  marginTop: "var(--ds-space-075, 6px)",
@@ -1,4 +1,4 @@
1
1
  import { ANALYTICS_CHANNEL, useJqlPackageAnalytics } from '@atlaskit/jql-editor-common';
2
2
  export const useJqlEditorAnalytics = analyticsSource => {
3
- return useJqlPackageAnalytics(analyticsSource, "@atlaskit/jql-editor", "5.4.5", ANALYTICS_CHANNEL);
3
+ return useJqlPackageAnalytics(analyticsSource, "@atlaskit/jql-editor", "5.4.6", ANALYTICS_CHANNEL);
4
4
  };
@@ -1,9 +1,11 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
3
+ import { fg } from '@atlaskit/platform-feature-flags';
4
+ import { Popper } from '@atlaskit/popper';
3
5
  import Spinner from '@atlaskit/spinner';
4
6
  import { ScreenReaderText } from '../../../../accessibility';
5
7
  import { JQL_EDITOR_AUTOCOMPLETE_ID } from '../../../../common/constants';
6
- import { useAutocomplete, useAutocompleteIsOpen, useAutocompletePosition, useIntl, useRichInlineNodesEnabled, useScopedId, useStoreActions } from '../../../../state';
8
+ import { useAutocomplete, useAutocompleteIsOpen, useAutocompletePosition, useEditorView, useIntl, useRichInlineNodesEnabled, useScopedId, useStoreActions } from '../../../../state';
7
9
  import { ARROW_DOWN_KEY, ARROW_UP_KEY, CMD_ARROW_DOWN_KEY, CMD_ARROW_UP_KEY, END_KEY, ENTER_KEY, ESCAPE_KEY, HOME_KEY, TAB_KEY } from '../../constants';
8
10
  import { messages } from '../../messages';
9
11
  import AutocompleteOption from '../autocomplete-option';
@@ -45,6 +47,7 @@ const AutocompleteDropdown = ({
45
47
  const selectedItemRef = useRef(null);
46
48
  const [navigatingWithKeyboard, setNavigatingWithKeyboard] = useState(false);
47
49
  const [intl] = useIntl();
50
+ const [editorView] = useEditorView();
48
51
  const [, {
49
52
  onEditorViewFocus,
50
53
  onEditorViewBlur
@@ -63,10 +66,40 @@ const AutocompleteDropdown = ({
63
66
  }] = useAutocompletePosition();
64
67
  const [areRichInlineNodesEnabled] = useRichInlineNodesEnabled();
65
68
  const [autocompleteId] = useScopedId(JQL_EDITOR_AUTOCOMPLETE_ID);
69
+ const isPopperPositioningEnabled = fg('jql_editor_autocomplete_use_popper');
70
+
71
+ // Create virtual reference element positioned at cursor location (for popper implementation)
72
+ const virtualReferenceElement = useMemo(() => {
73
+ if (!isPopperPositioningEnabled || !editorView || !isAutocompleteOpen) {
74
+ return null;
75
+ }
76
+
77
+ // Create a virtual element that uses the same positioning logic as the old implementation
78
+ return {
79
+ getBoundingClientRect: () => {
80
+ // Use the same top/left values that the old manual positioning uses
81
+ // This ensures consistency between old and new positioning
82
+ const rect = {
83
+ width: 0,
84
+ height: 0,
85
+ top: top,
86
+ left: left,
87
+ right: left,
88
+ bottom: top,
89
+ x: left,
90
+ y: top,
91
+ toJSON: () => rect
92
+ };
93
+ return rect;
94
+ }
95
+ };
96
+ }, [isPopperPositioningEnabled, editorView, isAutocompleteOpen, top, left]);
66
97
  const onContainerRef = useCallback(container => {
67
98
  containerRef.current = container;
68
- setAutocompleteContainer(container);
69
- }, [containerRef, setAutocompleteContainer]);
99
+ if (!isPopperPositioningEnabled) {
100
+ setAutocompleteContainer(container);
101
+ }
102
+ }, [setAutocompleteContainer, isPopperPositioningEnabled]);
70
103
  const onScrollContainerRef = useCallback(container => {
71
104
  scrollContainerRef.current = container;
72
105
  }, [scrollContainerRef]);
@@ -169,13 +202,15 @@ const AutocompleteDropdown = ({
169
202
  }
170
203
  }, [isAutocompleteOpen, options, selectedOptionId, setSelectedAutocompleteOptionId]);
171
204
  useLayoutEffect(() => {
172
- requestAnimationFrame(() => {
173
- if (containerRef.current) {
174
- containerRef.current.style.top = `${top}px`;
175
- containerRef.current.style.left = `${left}px`;
176
- }
177
- });
178
- }, [top, left]);
205
+ if (!isPopperPositioningEnabled) {
206
+ requestAnimationFrame(() => {
207
+ if (containerRef.current) {
208
+ containerRef.current.style.top = `${top}px`;
209
+ containerRef.current.style.left = `${left}px`;
210
+ }
211
+ });
212
+ }
213
+ }, [top, left, isPopperPositioningEnabled]);
179
214
  useLayoutEffect(() => {
180
215
  if (navigatingWithKeyboard) {
181
216
  var _selectedItemRef$curr;
@@ -201,14 +236,7 @@ const AutocompleteDropdown = ({
201
236
  }
202
237
  return intl.formatMessage(messages.optionsFound);
203
238
  }, [isAutocompleteOpen, intl, options]);
204
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(AutocompleteContainer, {
205
- "data-testid": "jql-editor-autocomplete",
206
- tabIndex: -1,
207
- ref: onContainerRef,
208
- isOpen: isAutocompleteOpen,
209
- onBlur: onEditorViewBlur,
210
- onFocus: onEditorViewFocus
211
- }, /*#__PURE__*/React.createElement(AutocompleteOptionsContainer, {
239
+ const renderAutocompleteContent = () => /*#__PURE__*/React.createElement(AutocompleteOptionsContainer, {
212
240
  ref: onScrollContainerRef,
213
241
  onMouseMove: onMouseMove
214
242
  }, /*#__PURE__*/React.createElement(OptionList, {
@@ -232,12 +260,51 @@ const AutocompleteDropdown = ({
232
260
  }
233
261
  }
234
262
  }));
235
- }))), loading && /*#__PURE__*/React.createElement(AutocompleteLoadingFooter, {
263
+ })));
264
+ const renderLoadingFooter = () => loading && /*#__PURE__*/React.createElement(AutocompleteLoadingFooter, {
236
265
  "data-testid": "jql-editor-autocomplete-loading",
237
266
  hasOptions: !!options.length
238
267
  }, /*#__PURE__*/React.createElement(Spinner, {
239
268
  size: "small"
240
- }))), /*#__PURE__*/React.createElement(ScreenReaderText, {
269
+ }));
270
+
271
+ // Early return if popper positioning is enabled but virtual reference element is not available
272
+ if (isPopperPositioningEnabled && !virtualReferenceElement) {
273
+ return null;
274
+ }
275
+ return /*#__PURE__*/React.createElement(React.Fragment, null, isPopperPositioningEnabled ?
276
+ /*#__PURE__*/
277
+ // New popper-based positioning
278
+ React.createElement(Popper, {
279
+ referenceElement: virtualReferenceElement,
280
+ placement: "bottom-start",
281
+ shouldFitViewport: true
282
+ }, ({
283
+ ref,
284
+ style
285
+ }) => /*#__PURE__*/React.createElement(AutocompleteContainer, {
286
+ "data-testid": "jql-editor-autocomplete",
287
+ tabIndex: -1,
288
+ ref: ref
289
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Popper requires dynamic positioning via style prop
290
+ ,
291
+ style: style,
292
+ isOpen: isAutocompleteOpen,
293
+ usePopper: true,
294
+ onBlur: onEditorViewBlur,
295
+ onFocus: onEditorViewFocus
296
+ }, renderAutocompleteContent(), renderLoadingFooter())) :
297
+ /*#__PURE__*/
298
+ // Old manual positioning
299
+ React.createElement(AutocompleteContainer, {
300
+ "data-testid": "jql-editor-autocomplete",
301
+ tabIndex: -1,
302
+ ref: onContainerRef,
303
+ isOpen: isAutocompleteOpen,
304
+ usePopper: false,
305
+ onBlur: onEditorViewBlur,
306
+ onFocus: onEditorViewFocus
307
+ }, renderAutocompleteContent(), renderLoadingFooter()), /*#__PURE__*/React.createElement(ScreenReaderText, {
241
308
  role: "status",
242
309
  "aria-live": "polite"
243
310
  }, announcedMessage));
@@ -1,6 +1,4 @@
1
1
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
2
- import { css } from '@emotion/react';
3
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
4
2
  import styled from '@emotion/styled';
5
3
  import { N200, N40, N50A, N60A } from '@atlaskit/theme/colors';
6
4
  import { layers } from '@atlaskit/theme/constants';
@@ -24,11 +22,17 @@ export const AutocompleteContainer = styled.div({
24
22
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-dynamic-styles, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
25
23
  ({
26
24
  isOpen
27
- }) => isOpen ? css({
25
+ }) => isOpen ? {
28
26
  visibility: 'visible'
29
- }) : css({
27
+ } : {
30
28
  visibility: 'hidden'
31
- }));
29
+ },
30
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-dynamic-styles, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
31
+ ({
32
+ usePopper
33
+ }) => usePopper && {
34
+ marginTop: "var(--ds-space-100, 8px)"
35
+ });
32
36
 
33
37
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-styled, @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
34
38
  export const AutocompleteOptionsContainer = styled.div({
@@ -1,4 +1,4 @@
1
1
  import { ANALYTICS_CHANNEL, useJqlPackageAnalytics } from '@atlaskit/jql-editor-common';
2
2
  export var useJqlEditorAnalytics = function useJqlEditorAnalytics(analyticsSource) {
3
- return useJqlPackageAnalytics(analyticsSource, "@atlaskit/jql-editor", "5.4.5", ANALYTICS_CHANNEL);
3
+ return useJqlPackageAnalytics(analyticsSource, "@atlaskit/jql-editor", "5.4.6", ANALYTICS_CHANNEL);
4
4
  };