@atlaskit/jql-editor 5.8.2 → 5.8.4

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,18 @@
1
1
  # @atlaskit/jql-editor
2
2
 
3
+ ## 5.8.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`d87f35a08c765`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d87f35a08c765) -
8
+ Add undefined checks for autocomplete dropdown keyboard navigation.
9
+
10
+ ## 5.8.3
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies
15
+
3
16
  ## 5.8.2
4
17
 
5
18
  ### 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", "0.0.0-development", _jqlEditorCommon.ANALYTICS_CHANNEL);
9
+ return (0, _jqlEditorCommon.useJqlPackageAnalytics)(analyticsSource, "@atlaskit/jql-editor", "5.8.3", _jqlEditorCommon.ANALYTICS_CHANNEL);
10
10
  };
@@ -22,13 +22,17 @@ var _styled = require("./styled");
22
22
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
23
23
  var getPreviousOptionId = function getPreviousOptionId(options, selectedOptionId) {
24
24
  if (!selectedOptionId) {
25
- return options[options.length - 1].id;
25
+ var _options;
26
+ // Options can be empty if the user presses arrow keys while results are loading
27
+ return (_options = options[options.length - 1]) === null || _options === void 0 ? void 0 : _options.id;
26
28
  }
27
29
  var index = options.findIndex(function (option) {
28
30
  return option.id === selectedOptionId;
29
31
  });
30
32
  if (index === -1) {
31
- return options[options.length - 1].id;
33
+ var _options2;
34
+ // Options can be empty if the user presses arrow keys while results are loading
35
+ return (_options2 = options[options.length - 1]) === null || _options2 === void 0 ? void 0 : _options2.id;
32
36
  }
33
37
  if (index > 0) {
34
38
  return options[index - 1].id;
@@ -37,13 +41,17 @@ var getPreviousOptionId = function getPreviousOptionId(options, selectedOptionId
37
41
  };
38
42
  var getNextOptionId = function getNextOptionId(options, selectedOptionId) {
39
43
  if (!selectedOptionId) {
40
- return options[0].id;
44
+ var _options$;
45
+ // Options can be empty if the user presses arrow keys while results are loading
46
+ return (_options$ = options[0]) === null || _options$ === void 0 ? void 0 : _options$.id;
41
47
  }
42
48
  var index = options.findIndex(function (option) {
43
49
  return option.id === selectedOptionId;
44
50
  });
45
51
  if (index === -1) {
46
- return options[0].id;
52
+ var _options$2;
53
+ // Options can be empty if the user presses arrow keys while results are loading
54
+ return (_options$2 = options[0]) === null || _options$2 === void 0 ? void 0 : _options$2.id;
47
55
  }
48
56
  if (index < options.length - 1) {
49
57
  return options[index + 1].id;
@@ -193,21 +201,21 @@ var AutocompleteDropdown = function AutocompleteDropdown(_ref) {
193
201
  return true;
194
202
  });
195
203
  keymap.bindMultipleKeys([_constants2.HOME_KEY, _constants2.CMD_ARROW_UP_KEY], function () {
196
- var _options$;
204
+ var _options$3;
197
205
  if (!isAutocompleteOpen) {
198
206
  return false;
199
207
  }
200
208
  !navigatingWithKeyboard && setNavigatingWithKeyboard(true);
201
- setSelectedAutocompleteOptionId((_options$ = options[0]) === null || _options$ === void 0 ? void 0 : _options$.id);
209
+ setSelectedAutocompleteOptionId((_options$3 = options[0]) === null || _options$3 === void 0 ? void 0 : _options$3.id);
202
210
  return true;
203
211
  });
204
212
  keymap.bindMultipleKeys([_constants2.END_KEY, _constants2.CMD_ARROW_DOWN_KEY], function () {
205
- var _options;
213
+ var _options3;
206
214
  if (!isAutocompleteOpen) {
207
215
  return false;
208
216
  }
209
217
  !navigatingWithKeyboard && setNavigatingWithKeyboard(true);
210
- setSelectedAutocompleteOptionId((_options = options[options.length - 1]) === null || _options === void 0 ? void 0 : _options.id);
218
+ setSelectedAutocompleteOptionId((_options3 = options[options.length - 1]) === null || _options3 === void 0 ? void 0 : _options3.id);
211
219
  return true;
212
220
  });
213
221
 
@@ -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", "0.0.0-development", ANALYTICS_CHANNEL);
3
+ return useJqlPackageAnalytics(analyticsSource, "@atlaskit/jql-editor", "5.8.3", ANALYTICS_CHANNEL);
4
4
  };
@@ -12,11 +12,15 @@ import AutocompleteOption from '../autocomplete-option';
12
12
  import { AutocompleteContainer, AutocompleteLoadingFooter, AutocompleteOptionsContainer, OptionList } from './styled';
13
13
  const getPreviousOptionId = (options, selectedOptionId) => {
14
14
  if (!selectedOptionId) {
15
- return options[options.length - 1].id;
15
+ var _options;
16
+ // Options can be empty if the user presses arrow keys while results are loading
17
+ return (_options = options[options.length - 1]) === null || _options === void 0 ? void 0 : _options.id;
16
18
  }
17
19
  const index = options.findIndex(option => option.id === selectedOptionId);
18
20
  if (index === -1) {
19
- return options[options.length - 1].id;
21
+ var _options2;
22
+ // Options can be empty if the user presses arrow keys while results are loading
23
+ return (_options2 = options[options.length - 1]) === null || _options2 === void 0 ? void 0 : _options2.id;
20
24
  }
21
25
  if (index > 0) {
22
26
  return options[index - 1].id;
@@ -25,11 +29,15 @@ const getPreviousOptionId = (options, selectedOptionId) => {
25
29
  };
26
30
  const getNextOptionId = (options, selectedOptionId) => {
27
31
  if (!selectedOptionId) {
28
- return options[0].id;
32
+ var _options$;
33
+ // Options can be empty if the user presses arrow keys while results are loading
34
+ return (_options$ = options[0]) === null || _options$ === void 0 ? void 0 : _options$.id;
29
35
  }
30
36
  const index = options.findIndex(option => option.id === selectedOptionId);
31
37
  if (index === -1) {
32
- return options[0].id;
38
+ var _options$2;
39
+ // Options can be empty if the user presses arrow keys while results are loading
40
+ return (_options$2 = options[0]) === null || _options$2 === void 0 ? void 0 : _options$2.id;
33
41
  }
34
42
  if (index < options.length - 1) {
35
43
  return options[index + 1].id;
@@ -161,21 +169,21 @@ const AutocompleteDropdown = ({
161
169
  return true;
162
170
  });
163
171
  keymap.bindMultipleKeys([HOME_KEY, CMD_ARROW_UP_KEY], () => {
164
- var _options$;
172
+ var _options$3;
165
173
  if (!isAutocompleteOpen) {
166
174
  return false;
167
175
  }
168
176
  !navigatingWithKeyboard && setNavigatingWithKeyboard(true);
169
- setSelectedAutocompleteOptionId((_options$ = options[0]) === null || _options$ === void 0 ? void 0 : _options$.id);
177
+ setSelectedAutocompleteOptionId((_options$3 = options[0]) === null || _options$3 === void 0 ? void 0 : _options$3.id);
170
178
  return true;
171
179
  });
172
180
  keymap.bindMultipleKeys([END_KEY, CMD_ARROW_DOWN_KEY], () => {
173
- var _options;
181
+ var _options3;
174
182
  if (!isAutocompleteOpen) {
175
183
  return false;
176
184
  }
177
185
  !navigatingWithKeyboard && setNavigatingWithKeyboard(true);
178
- setSelectedAutocompleteOptionId((_options = options[options.length - 1]) === null || _options === void 0 ? void 0 : _options.id);
186
+ setSelectedAutocompleteOptionId((_options3 = options[options.length - 1]) === null || _options3 === void 0 ? void 0 : _options3.id);
179
187
  return true;
180
188
  });
181
189
 
@@ -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", "0.0.0-development", ANALYTICS_CHANNEL);
3
+ return useJqlPackageAnalytics(analyticsSource, "@atlaskit/jql-editor", "5.8.3", ANALYTICS_CHANNEL);
4
4
  };
@@ -13,13 +13,17 @@ import AutocompleteOption from '../autocomplete-option';
13
13
  import { AutocompleteContainer, AutocompleteLoadingFooter, AutocompleteOptionsContainer, OptionList } from './styled';
14
14
  var getPreviousOptionId = function getPreviousOptionId(options, selectedOptionId) {
15
15
  if (!selectedOptionId) {
16
- return options[options.length - 1].id;
16
+ var _options;
17
+ // Options can be empty if the user presses arrow keys while results are loading
18
+ return (_options = options[options.length - 1]) === null || _options === void 0 ? void 0 : _options.id;
17
19
  }
18
20
  var index = options.findIndex(function (option) {
19
21
  return option.id === selectedOptionId;
20
22
  });
21
23
  if (index === -1) {
22
- return options[options.length - 1].id;
24
+ var _options2;
25
+ // Options can be empty if the user presses arrow keys while results are loading
26
+ return (_options2 = options[options.length - 1]) === null || _options2 === void 0 ? void 0 : _options2.id;
23
27
  }
24
28
  if (index > 0) {
25
29
  return options[index - 1].id;
@@ -28,13 +32,17 @@ var getPreviousOptionId = function getPreviousOptionId(options, selectedOptionId
28
32
  };
29
33
  var getNextOptionId = function getNextOptionId(options, selectedOptionId) {
30
34
  if (!selectedOptionId) {
31
- return options[0].id;
35
+ var _options$;
36
+ // Options can be empty if the user presses arrow keys while results are loading
37
+ return (_options$ = options[0]) === null || _options$ === void 0 ? void 0 : _options$.id;
32
38
  }
33
39
  var index = options.findIndex(function (option) {
34
40
  return option.id === selectedOptionId;
35
41
  });
36
42
  if (index === -1) {
37
- return options[0].id;
43
+ var _options$2;
44
+ // Options can be empty if the user presses arrow keys while results are loading
45
+ return (_options$2 = options[0]) === null || _options$2 === void 0 ? void 0 : _options$2.id;
38
46
  }
39
47
  if (index < options.length - 1) {
40
48
  return options[index + 1].id;
@@ -184,21 +192,21 @@ var AutocompleteDropdown = function AutocompleteDropdown(_ref) {
184
192
  return true;
185
193
  });
186
194
  keymap.bindMultipleKeys([HOME_KEY, CMD_ARROW_UP_KEY], function () {
187
- var _options$;
195
+ var _options$3;
188
196
  if (!isAutocompleteOpen) {
189
197
  return false;
190
198
  }
191
199
  !navigatingWithKeyboard && setNavigatingWithKeyboard(true);
192
- setSelectedAutocompleteOptionId((_options$ = options[0]) === null || _options$ === void 0 ? void 0 : _options$.id);
200
+ setSelectedAutocompleteOptionId((_options$3 = options[0]) === null || _options$3 === void 0 ? void 0 : _options$3.id);
193
201
  return true;
194
202
  });
195
203
  keymap.bindMultipleKeys([END_KEY, CMD_ARROW_DOWN_KEY], function () {
196
- var _options;
204
+ var _options3;
197
205
  if (!isAutocompleteOpen) {
198
206
  return false;
199
207
  }
200
208
  !navigatingWithKeyboard && setNavigatingWithKeyboard(true);
201
- setSelectedAutocompleteOptionId((_options = options[options.length - 1]) === null || _options === void 0 ? void 0 : _options.id);
209
+ setSelectedAutocompleteOptionId((_options3 = options[options.length - 1]) === null || _options3 === void 0 ? void 0 : _options3.id);
202
210
  return true;
203
211
  });
204
212
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/jql-editor",
3
- "version": "5.8.2",
3
+ "version": "5.8.4",
4
4
  "description": "This package allows consumers to render an advanced JQL editor component to enable autocomplete-assisted authoring and validation of JQL queries.",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,14 +32,14 @@
32
32
  ],
33
33
  "atlaskit:src": "src/index.ts",
34
34
  "dependencies": {
35
- "@atlaskit/afm-i18n-platform-jql-jql-editor": "2.7.0",
35
+ "@atlaskit/afm-i18n-platform-jql-jql-editor": "2.10.0",
36
36
  "@atlaskit/analytics-gas-types": "^5.1.0",
37
37
  "@atlaskit/analytics-next": "^11.1.0",
38
38
  "@atlaskit/avatar": "^25.5.0",
39
39
  "@atlaskit/button": "^23.6.0",
40
40
  "@atlaskit/editor-prosemirror": "7.0.0",
41
41
  "@atlaskit/form": "^14.2.0",
42
- "@atlaskit/icon": "^28.5.0",
42
+ "@atlaskit/icon": "^29.0.0",
43
43
  "@atlaskit/jql-ast": "^3.3.0",
44
44
  "@atlaskit/jql-autocomplete": "^2.0.0",
45
45
  "@atlaskit/jql-editor-common": "^3.0.0",