@atlaskit/quick-search 8.0.13 → 8.0.15

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 (66) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +1 -0
  3. package/dist/cjs/components/QuickSearch.js +65 -100
  4. package/dist/cjs/components/ResultItem/ResultItem.js +0 -22
  5. package/dist/cjs/components/ResultItem/ResultItemGroup.js +2 -20
  6. package/dist/cjs/components/ResultItem/styled.js +4 -27
  7. package/dist/cjs/components/Results/ContainerResult.js +6 -31
  8. package/dist/cjs/components/Results/ObjectResult.js +9 -36
  9. package/dist/cjs/components/Results/PersonResult.js +8 -34
  10. package/dist/cjs/components/Results/ResultBase.js +22 -52
  11. package/dist/cjs/components/Results/index.js +0 -5
  12. package/dist/cjs/components/Search/Search.js +7 -36
  13. package/dist/cjs/components/Search/styled.js +6 -31
  14. package/dist/cjs/components/constants.js +0 -1
  15. package/dist/cjs/components/context.js +0 -7
  16. package/dist/cjs/components/decorateWithAnalyticsData.js +0 -22
  17. package/dist/cjs/components/isReactElement.js +0 -2
  18. package/dist/cjs/index.js +0 -14
  19. package/dist/cjs/version.json +1 -1
  20. package/dist/es2019/components/QuickSearch.js +71 -95
  21. package/dist/es2019/components/ResultItem/ResultItem.js +0 -4
  22. package/dist/es2019/components/ResultItem/ResultItemGroup.js +0 -1
  23. package/dist/es2019/components/ResultItem/styled.js +6 -7
  24. package/dist/es2019/components/Results/ContainerResult.js +0 -5
  25. package/dist/es2019/components/Results/ObjectResult.js +0 -8
  26. package/dist/es2019/components/Results/PersonResult.js +0 -7
  27. package/dist/es2019/components/Results/ResultBase.js +5 -16
  28. package/dist/es2019/components/Search/Search.js +0 -9
  29. package/dist/es2019/components/Search/styled.js +7 -8
  30. package/dist/es2019/components/decorateWithAnalyticsData.js +0 -4
  31. package/dist/es2019/index.js +6 -3
  32. package/dist/es2019/version.json +1 -1
  33. package/dist/esm/components/QuickSearch.js +66 -104
  34. package/dist/esm/components/ResultItem/ResultItem.js +0 -11
  35. package/dist/esm/components/ResultItem/ResultItemGroup.js +2 -12
  36. package/dist/esm/components/ResultItem/styled.js +4 -7
  37. package/dist/esm/components/Results/ContainerResult.js +6 -22
  38. package/dist/esm/components/Results/ObjectResult.js +9 -27
  39. package/dist/esm/components/Results/PersonResult.js +8 -27
  40. package/dist/esm/components/Results/ResultBase.js +23 -44
  41. package/dist/esm/components/Search/Search.js +7 -28
  42. package/dist/esm/components/Search/styled.js +7 -10
  43. package/dist/esm/components/decorateWithAnalyticsData.js +0 -13
  44. package/dist/esm/index.js +6 -3
  45. package/dist/esm/version.json +1 -1
  46. package/dist/types/components/Search/styled.d.ts +1 -1
  47. package/package.json +8 -14
  48. package/report.api.md +33 -14
  49. package/tmp/api-report-tmp.d.ts +263 -0
  50. package/dist/types-ts4.0/components/QuickSearch.d.ts +0 -122
  51. package/dist/types-ts4.0/components/ResultItem/ResultItem.d.ts +0 -38
  52. package/dist/types-ts4.0/components/ResultItem/ResultItemGroup.d.ts +0 -11
  53. package/dist/types-ts4.0/components/ResultItem/styled.d.ts +0 -13
  54. package/dist/types-ts4.0/components/Results/ContainerResult.d.ts +0 -19
  55. package/dist/types-ts4.0/components/Results/ObjectResult.d.ts +0 -22
  56. package/dist/types-ts4.0/components/Results/PersonResult.d.ts +0 -20
  57. package/dist/types-ts4.0/components/Results/ResultBase.d.ts +0 -37
  58. package/dist/types-ts4.0/components/Results/index.d.ts +0 -4
  59. package/dist/types-ts4.0/components/Results/types.d.ts +0 -34
  60. package/dist/types-ts4.0/components/Search/Search.d.ts +0 -31
  61. package/dist/types-ts4.0/components/Search/styled.d.ts +0 -10
  62. package/dist/types-ts4.0/components/constants.d.ts +0 -6
  63. package/dist/types-ts4.0/components/context.d.ts +0 -22
  64. package/dist/types-ts4.0/components/decorateWithAnalyticsData.d.ts +0 -3
  65. package/dist/types-ts4.0/components/isReactElement.d.ts +0 -6
  66. package/dist/types-ts4.0/index.d.ts +0 -17
@@ -5,15 +5,10 @@ import _inherits from "@babel/runtime/helpers/inherits";
5
5
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
6
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
7
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
-
9
8
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
10
-
11
9
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
12
-
13
10
  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); }; }
14
-
15
11
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
16
-
17
12
  import React from 'react';
18
13
  import keycode from 'keycode';
19
14
  import { withAnalytics } from '@atlaskit/analytics';
@@ -21,7 +16,6 @@ import AkSearch from './Search/Search';
21
16
  import { ResultContext, SelectedResultIdContext } from './context';
22
17
  import decorateWithAnalyticsData from './decorateWithAnalyticsData';
23
18
  import { QS_ANALYTICS_EV_CLOSE, QS_ANALYTICS_EV_KB_CTRLS_USED, QS_ANALYTICS_EV_OPEN, QS_ANALYTICS_EV_QUERY_ENTERED, QS_ANALYTICS_EV_SUBMIT } from './constants';
24
-
25
19
  /**
26
20
  * Get the result ID of a result by its index in the flatResults array
27
21
  * Returns null for a failed index or if resultId is empty|undefined
@@ -30,168 +24,170 @@ var getResultIdByIndex = function getResultIdByIndex(array, index) {
30
24
  if (array && index !== null && array[index] && array[index].props && array[index].props.resultId) {
31
25
  return array[index].props.resultId;
32
26
  }
33
-
34
27
  return null;
35
28
  };
29
+
36
30
  /**
37
31
  * Find a result in the flatResults array by its ID
38
32
  * Returns the result object or null
39
33
  */
40
-
41
-
42
34
  var getResultById = function getResultById(array, id) {
43
35
  return array && array.find(function (result) {
44
36
  return result.props && result.props.resultId === id;
45
37
  }) || null;
46
38
  };
39
+
47
40
  /**
48
41
  * Get a result's index in the flatResults array by its ID
49
42
  * Returns a numeric index or null
50
43
  */
51
-
52
-
53
44
  var getResultIndexById = function getResultIndexById(array, id) {
54
45
  if (!array) {
55
46
  return null;
56
47
  }
57
-
58
48
  var result = getResultById(array, id);
59
-
60
49
  if (!result) {
61
50
  return null;
62
51
  }
63
-
64
52
  var index = array.indexOf(result);
65
53
  return index >= 0 ? index : null;
66
54
  };
67
-
68
55
  var adjustIndex = function adjustIndex(arrayLength, currentIndex, adjustment) {
69
56
  if (arrayLength === 0) {
70
57
  return null;
71
58
  }
72
-
73
59
  if (adjustment === 0) {
74
60
  return currentIndex;
75
- } // If nothing is selected, select the element on the end
76
-
61
+ }
77
62
 
63
+ // If nothing is selected, select the element on the end
78
64
  if (currentIndex === null) {
79
65
  return adjustment > 0 ? 0 : arrayLength - 1;
80
- } // Adjust current index, wrapping around if necessary
81
-
82
-
83
- var adjustedIndex = (currentIndex + adjustment) % arrayLength; // Correct for negative indices
84
-
66
+ }
67
+ // Adjust current index, wrapping around if necessary
68
+ var adjustedIndex = (currentIndex + adjustment) % arrayLength;
69
+ // Correct for negative indices
85
70
  return adjustedIndex >= 0 ? adjustedIndex : adjustedIndex + arrayLength;
86
71
  };
87
-
88
72
  export var QuickSearch = /*#__PURE__*/function (_React$Component) {
89
73
  _inherits(QuickSearch, _React$Component);
90
-
91
74
  var _super = _createSuper(QuickSearch);
92
-
93
75
  function QuickSearch(props) {
94
76
  var _this;
95
-
96
77
  _classCallCheck(this, QuickSearch);
97
-
98
78
  _this = _super.call(this, props);
99
-
100
79
  _defineProperty(_assertThisInitialized(_this), "flatResults", []);
101
-
102
80
  _defineProperty(_assertThisInitialized(_this), "hasSearchQueryEventFired", false);
103
-
104
81
  _defineProperty(_assertThisInitialized(_this), "hasKeyDownEventFired", false);
105
-
106
82
  _defineProperty(_assertThisInitialized(_this), "lastKeyPressed", '');
107
-
83
+ /**
84
+ * Uses the virtual list, this.flatResults, to move the selection across grouped results as if
85
+ * results were in a single, circular list.
86
+ *
87
+ * Process:
88
+ * 1. Finds the index of the selected result in the flatResults array,
89
+ * 2. Increments or decrements this index by the supplied adjustment amount,
90
+ * 3. Sets the new selectedResultId based on the modifed index
91
+ */
108
92
  _defineProperty(_assertThisInitialized(_this), "adjustSelectedResultIndex", function (adjustment) {
109
93
  var currentIndex = getResultIndexById(_this.flatResults, _this.state.selectedResultId);
110
94
  var newIndex = adjustIndex(_this.flatResults.length, currentIndex, adjustment);
111
95
  var selectedResultId = getResultIdByIndex(_this.flatResults, newIndex);
112
-
113
96
  _this.setState({
114
97
  selectedResultId: selectedResultId
115
98
  });
116
-
117
99
  if (selectedResultId) {
118
100
  _this.fireKeyboardControlEvent(selectedResultId);
119
101
  }
120
-
121
102
  if (_this.props.onSelectedResultIdChanged) {
122
103
  _this.props.onSelectedResultIdChanged(selectedResultId);
123
104
  }
124
105
  });
125
-
106
+ /** Select next result */
126
107
  _defineProperty(_assertThisInitialized(_this), "selectNext", function () {
127
108
  _this.adjustSelectedResultIndex(+1);
128
109
  });
129
-
110
+ /** Select previous result */
130
111
  _defineProperty(_assertThisInitialized(_this), "selectPrevious", function () {
131
112
  _this.adjustSelectedResultIndex(-1);
132
113
  });
133
-
114
+ /**
115
+ * Callback for register results in flatResults
116
+ */
134
117
  _defineProperty(_assertThisInitialized(_this), "handleRegisterResult", function (result) {
135
118
  if (!getResultById(_this.flatResults, result.props.resultId)) {
136
119
  _this.flatResults.push(result);
137
120
  }
138
121
  });
139
-
122
+ /**
123
+ * Callback for unregister results in flatResults
124
+ * It will reconcile a list of results for keyboard navigation after every update.
125
+ * 1. Component starts with an empty list of results
126
+ * 2. componentDidMount / componentDidUpdate lifecycle methods in ResultBase will be invoked
127
+ * 3. All ResultBase components call registerResult() in order to register itself in quick search
128
+ * 4. All ResultBase components call unregisterResult() in order to unregister itself in quick search
129
+ */
140
130
  _defineProperty(_assertThisInitialized(_this), "handleUnregisterResult", function (result) {
141
131
  var resultIndex = getResultIndexById(_this.flatResults, result.props.resultId);
142
-
143
132
  if (resultIndex !== null && +resultIndex >= 0) {
144
133
  _this.flatResults.splice(resultIndex, 1);
145
134
  }
146
135
  });
147
-
136
+ /**
137
+ * Callback for mouseEnter events on individual results
138
+ * Move selection to hovered result
139
+ */
148
140
  _defineProperty(_assertThisInitialized(_this), "handleResultMouseEnter", function (resultData) {
149
141
  _this.setState({
150
142
  selectedResultId: resultData && resultData.resultId
151
143
  });
152
144
  });
153
-
145
+ /**
146
+ * Callback for mouseLeave events on individual results
147
+ * Clear result selection
148
+ */
154
149
  _defineProperty(_assertThisInitialized(_this), "handleResultMouseLeave", function () {
155
150
  _this.setState({
156
151
  selectedResultId: null
157
152
  });
158
153
  });
159
-
154
+ /**
155
+ * Clear result selection when search input is blurred
156
+ */
160
157
  _defineProperty(_assertThisInitialized(_this), "handleSearchBlur", function (event) {
161
158
  _this.props.onSearchBlur(event);
162
-
163
159
  _this.setState({
164
160
  selectedResultId: null
165
161
  });
166
162
  });
167
-
168
163
  _defineProperty(_assertThisInitialized(_this), "onInput", function (event) {
169
164
  var onSearchInput = _this.props.onSearchInput;
170
-
171
165
  _this.setState({
172
166
  value: event.currentTarget.value
173
167
  });
174
-
175
168
  if (onSearchInput) {
176
169
  onSearchInput(event);
177
170
  }
178
171
  });
179
-
172
+ /**
173
+ * Keyboard controls
174
+ * Up - Select previous result
175
+ * Down - Select next result
176
+ * Enter - Submit selected result
177
+ * Tab / ArrowRight - Accept autocomplete
178
+ */
180
179
  _defineProperty(_assertThisInitialized(_this), "handleSearchKeyDown", function (event) {
181
180
  var firePrivateAnalyticsEvent = _this.props.firePrivateAnalyticsEvent;
182
-
183
181
  _this.props.onSearchKeyDown(event);
182
+ _this.lastKeyPressed = event.key;
184
183
 
185
- _this.lastKeyPressed = event.key; // Need to check for keyCode for up/down/enter in case user is composing using an IME
184
+ // Need to check for keyCode for up/down/enter in case user is composing using an IME
186
185
  // fixes https://ecosystem.atlassian.net/browse/DS-6518
187
-
188
186
  if (event.key === 'ArrowUp' && event.keyCode === keycode('up')) {
189
187
  event.preventDefault(); // Don't move cursor around in search input field
190
-
191
188
  _this.selectPrevious();
192
189
  } else if (event.key === 'ArrowDown' && event.keyCode === keycode('down')) {
193
190
  event.preventDefault(); // Don't move cursor around in search input field
194
-
195
191
  _this.selectNext();
196
192
  } else if (event.key === 'Enter' && event.keyCode === keycode('enter')) {
197
193
  // shift key pressed or no result selected
@@ -204,21 +200,17 @@ export var QuickSearch = /*#__PURE__*/function (_React$Component) {
204
200
  method: 'shortcut'
205
201
  });
206
202
  }
207
-
208
203
  _this.props.onSearchSubmit(event);
209
204
  } else {
210
205
  event.preventDefault(); // Don't fire submit event from input
211
-
212
206
  var result = getResultById(_this.flatResults, _this.state.selectedResultId);
213
-
214
207
  if (!result || !result.props) {
215
208
  return;
216
- } // Capture when users are using the keyboard to submit
217
-
209
+ }
218
210
 
211
+ // Capture when users are using the keyboard to submit
219
212
  if (typeof firePrivateAnalyticsEvent === 'function') {
220
213
  _this.fireKeyboardControlEvent(_this.state.selectedResultId);
221
-
222
214
  firePrivateAnalyticsEvent(QS_ANALYTICS_EV_SUBMIT, _objectSpread(_objectSpread({}, result.getAnalyticsData()), {}, {
223
215
  method: 'returnKey',
224
216
  newTab: false,
@@ -226,9 +218,7 @@ export var QuickSearch = /*#__PURE__*/function (_React$Component) {
226
218
  resultCount: _this.flatResults.length
227
219
  }));
228
220
  }
229
-
230
221
  var _preventDefault = false;
231
-
232
222
  if (result.props.onClick) {
233
223
  result.props.onClick({
234
224
  resultId: result.props.resultId,
@@ -241,55 +231,47 @@ export var QuickSearch = /*#__PURE__*/function (_React$Component) {
241
231
  })
242
232
  });
243
233
  }
244
-
245
234
  if (result.props.href && !_preventDefault) {
246
235
  window.location.assign(result.props.href);
247
236
  }
248
237
  }
249
238
  } else if (event.key === 'Tab' || event.key === 'ArrowRight') {
250
239
  var autocompleteText = _this.props.autocompleteText;
251
-
252
- if (autocompleteText && autocompleteText.length > 0 && // multiple Tab or ArrowRight
240
+ if (autocompleteText && autocompleteText.length > 0 &&
241
+ // multiple Tab or ArrowRight
253
242
  autocompleteText.slice(-1) !== ' ') {
254
243
  _this.acceptAutocomplete(event, autocompleteText);
255
-
256
244
  event.preventDefault();
257
245
  }
258
246
  }
259
247
  });
260
-
261
248
  _defineProperty(_assertThisInitialized(_this), "acceptAutocomplete", function (event, text) {
262
249
  var onSearchInput = _this.props.onSearchInput;
263
250
  var newValue = "".concat(text, " ");
264
-
265
251
  if (_this.inputSearchRef) {
266
252
  _this.setState({
267
253
  value: newValue
268
- }); // @ts-ignore unchecked
269
-
270
-
254
+ });
255
+ // @ts-ignore unchecked
271
256
  _this.inputSearchRef.value = newValue;
272
257
  }
273
-
274
258
  if (onSearchInput) {
275
259
  onSearchInput(event, true);
276
260
  }
277
261
  });
278
-
279
262
  _defineProperty(_assertThisInitialized(_this), "setSearchInputRef", function (refs) {
280
263
  if (refs && refs.inputRef) {
281
264
  _this.inputSearchRef = refs.inputRef;
282
265
  }
283
266
  });
284
-
285
267
  _defineProperty(_assertThisInitialized(_this), "focusSearchInput", function () {
286
- if (_this.inputSearchRef && // @ts-ignore unchecked
268
+ if (_this.inputSearchRef &&
269
+ // @ts-ignore unchecked
287
270
  typeof _this.inputSearchRef.focus === 'function') {
288
271
  // @ts-ignore unchecked
289
272
  _this.inputSearchRef.focus();
290
273
  }
291
274
  });
292
-
293
275
  _this.state = {
294
276
  /** Select first result by default if `selectedResultId` prop is not provided */
295
277
  selectedResultId: _this.props.selectedResultId || null,
@@ -308,12 +290,10 @@ export var QuickSearch = /*#__PURE__*/function (_React$Component) {
308
290
  };
309
291
  return _this;
310
292
  }
311
-
312
293
  _createClass(QuickSearch, [{
313
294
  key: "componentDidMount",
314
295
  value: function componentDidMount() {
315
296
  var firePrivateAnalyticsEvent = this.props.firePrivateAnalyticsEvent;
316
-
317
297
  if (firePrivateAnalyticsEvent) {
318
298
  firePrivateAnalyticsEvent(QS_ANALYTICS_EV_OPEN, {});
319
299
  }
@@ -322,7 +302,6 @@ export var QuickSearch = /*#__PURE__*/function (_React$Component) {
322
302
  key: "componentWillUnmount",
323
303
  value: function componentWillUnmount() {
324
304
  var firePrivateAnalyticsEvent = this.props.firePrivateAnalyticsEvent;
325
-
326
305
  if (firePrivateAnalyticsEvent) {
327
306
  firePrivateAnalyticsEvent(QS_ANALYTICS_EV_CLOSE, {});
328
307
  }
@@ -338,13 +317,12 @@ export var QuickSearch = /*#__PURE__*/function (_React$Component) {
338
317
  this.setState({
339
318
  selectedResultId: nextProps.selectedResultId || null
340
319
  });
341
- } // keep context state in sync
342
-
320
+ }
343
321
 
322
+ // keep context state in sync
344
323
  var _this$state$context = this.state.context,
345
- sendAnalytics = _this$state$context.sendAnalytics,
346
- linkComponent = _this$state$context.linkComponent;
347
-
324
+ sendAnalytics = _this$state$context.sendAnalytics,
325
+ linkComponent = _this$state$context.linkComponent;
348
326
  if (sendAnalytics !== nextProps.firePrivateAnalyticsEvent || linkComponent !== nextProps.linkComponent) {
349
327
  this.setState({
350
328
  context: _objectSpread(_objectSpread({}, this.state.context), {}, {
@@ -353,17 +331,15 @@ export var QuickSearch = /*#__PURE__*/function (_React$Component) {
353
331
  })
354
332
  });
355
333
  }
334
+
356
335
  /**
357
336
  * Capture whether user needed to query in order to find their target result.
358
337
  * Only fire once per mount. Only fire when a search term is entered and the previous search
359
338
  * term was empty.
360
339
  */
361
-
362
-
363
340
  if (!this.hasSearchQueryEventFired && !this.props.value && nextProps.value) {
364
341
  this.hasSearchQueryEventFired = true;
365
342
  var firePrivateAnalyticsEvent = this.props.firePrivateAnalyticsEvent;
366
-
367
343
  if (firePrivateAnalyticsEvent) {
368
344
  firePrivateAnalyticsEvent(QS_ANALYTICS_EV_QUERY_ENTERED, {});
369
345
  }
@@ -373,10 +349,8 @@ export var QuickSearch = /*#__PURE__*/function (_React$Component) {
373
349
  key: "fireKeyboardControlEvent",
374
350
  value: function fireKeyboardControlEvent(selectedResultId) {
375
351
  var firePrivateAnalyticsEvent = this.props.firePrivateAnalyticsEvent;
376
-
377
352
  if (firePrivateAnalyticsEvent) {
378
353
  var result = getResultById(this.flatResults, selectedResultId);
379
-
380
354
  if (result) {
381
355
  firePrivateAnalyticsEvent(QS_ANALYTICS_EV_KB_CTRLS_USED, _objectSpread(_objectSpread({}, result.getAnalyticsData()), {}, {
382
356
  key: this.lastKeyPressed,
@@ -384,19 +358,8 @@ export var QuickSearch = /*#__PURE__*/function (_React$Component) {
384
358
  }));
385
359
  }
386
360
  }
387
-
388
361
  this.lastKeyPressed = '';
389
362
  }
390
- /**
391
- * Uses the virtual list, this.flatResults, to move the selection across grouped results as if
392
- * results were in a single, circular list.
393
- *
394
- * Process:
395
- * 1. Finds the index of the selected result in the flatResults array,
396
- * 2. Increments or decrements this index by the supplied adjustment amount,
397
- * 3. Sets the new selectedResultId based on the modifed index
398
- */
399
-
400
363
  }, {
401
364
  key: "render",
402
365
  value: function render() {
@@ -417,16 +380,15 @@ export var QuickSearch = /*#__PURE__*/function (_React$Component) {
417
380
  }, this.props.children)));
418
381
  }
419
382
  }]);
420
-
421
383
  return QuickSearch;
422
384
  }(React.Component);
385
+
423
386
  /**
424
387
  * HOCs:
425
388
  * `decorateWithAnalyticsData` - Wrapper that decorates analytics events with additional data.
426
389
  * `withAnalytics` - Injects analytics firing methods that are picked up by
427
390
  * @atlaskit/analytics/AnalyticsListener.
428
391
  */
429
-
430
392
  _defineProperty(QuickSearch, "defaultProps", {
431
393
  children: [],
432
394
  firePrivateAnalyticsEvent: function firePrivateAnalyticsEvent(_) {},
@@ -437,6 +399,6 @@ _defineProperty(QuickSearch, "defaultProps", {
437
399
  placeholder: 'Search',
438
400
  value: ''
439
401
  });
440
-
441
- export default decorateWithAnalyticsData( // @ts-ignore
402
+ export default decorateWithAnalyticsData(
403
+ // @ts-ignore
442
404
  withAnalytics(QuickSearch, {}, {}));
@@ -5,27 +5,19 @@ import _inherits from "@babel/runtime/helpers/inherits";
5
5
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
6
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
7
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
-
9
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); }; }
10
-
11
9
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
12
-
13
10
  import React from 'react';
14
11
  import baseItem, { withItemClick, withItemFocus } from '@atlaskit/item';
15
12
  import { ResultItemAfter, ResultItemAfterWrapper, ResultItemCaption, ResultItemIcon, ResultItemTextAfter, ResultItemSubText } from './styled';
16
13
  var Item = withItemClick(withItemFocus(baseItem));
17
-
18
14
  var ResultItem = /*#__PURE__*/function (_React$PureComponent) {
19
15
  _inherits(ResultItem, _React$PureComponent);
20
-
21
16
  var _super = _createSuper(ResultItem);
22
-
23
17
  function ResultItem() {
24
18
  _classCallCheck(this, ResultItem);
25
-
26
19
  return _super.apply(this, arguments);
27
20
  }
28
-
29
21
  _createClass(ResultItem, [{
30
22
  key: "render",
31
23
  value: function render() {
@@ -53,13 +45,10 @@ var ResultItem = /*#__PURE__*/function (_React$PureComponent) {
53
45
  }, interactiveWrapperProps), this.props.text, wrappedCaption);
54
46
  }
55
47
  }]);
56
-
57
48
  return ResultItem;
58
49
  }(React.PureComponent);
59
-
60
50
  _defineProperty(ResultItem, "defaultProps", {
61
51
  isSelected: false,
62
52
  isMouseSelected: false
63
53
  });
64
-
65
54
  export default ResultItem;
@@ -3,40 +3,30 @@ import _createClass from "@babel/runtime/helpers/createClass";
3
3
  import _inherits from "@babel/runtime/helpers/inherits";
4
4
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
5
5
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
-
7
6
  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); }; }
8
-
9
7
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
10
-
11
8
  import React from 'react';
12
9
  import { ItemGroup } from '@atlaskit/item';
13
10
  import { ResultItemGroupTitle, ResultItemGroupHeader } from './styled';
14
-
15
11
  var ResultItemGroup = /*#__PURE__*/function (_React$Component) {
16
12
  _inherits(ResultItemGroup, _React$Component);
17
-
18
13
  var _super = _createSuper(ResultItemGroup);
19
-
20
14
  function ResultItemGroup() {
21
15
  _classCallCheck(this, ResultItemGroup);
22
-
23
16
  return _super.apply(this, arguments);
24
17
  }
25
-
26
18
  _createClass(ResultItemGroup, [{
27
19
  key: "render",
28
20
  value: function render() {
29
21
  var _this$props = this.props,
30
- title = _this$props.title,
31
- children = _this$props.children;
22
+ title = _this$props.title,
23
+ children = _this$props.children;
32
24
  var wrappedTitle = /*#__PURE__*/React.createElement(ResultItemGroupHeader, null, /*#__PURE__*/React.createElement(ResultItemGroupTitle, null, title));
33
25
  return /*#__PURE__*/React.createElement(ItemGroup, {
34
26
  title: wrappedTitle
35
27
  }, children);
36
28
  }
37
29
  }]);
38
-
39
30
  return ResultItemGroup;
40
31
  }(React.Component);
41
-
42
32
  export { ResultItemGroup as default };
@@ -1,18 +1,15 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
-
3
2
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
4
-
5
3
  import styled from 'styled-components';
6
- import { gridSize } from '@atlaskit/theme/constants';
7
4
  import { N200 } from '@atlaskit/theme/colors';
8
- export var ResultItemGroupHeader = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n margin-left: -", "px;\n margin-top: ", "px;\n"])), gridSize() * 1.5, gridSize() * 1.5);
9
- export var ResultItemGroupTitle = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n font-size: 11px;\n line-height: ", "px;\n font-weight: 600;\n"])), gridSize() * 2);
5
+ export var ResultItemGroupHeader = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n margin-left: calc(-1 * ", ");\n margin-top: ", ";\n"])), "var(--ds-space-150, 12px)", "var(--ds-space-150, 12px)");
6
+ export var ResultItemGroupTitle = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n font-size: 11px;\n line-height: ", ";\n font-weight: 600;\n"])), "var(--ds-font-lineHeight-100, 16px)");
10
7
  export var ResultItemAfter = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n min-width: ", ";\n"])), function (_ref) {
11
8
  var shouldTakeSpace = _ref.shouldTakeSpace;
12
9
  return shouldTakeSpace ? '24px' : 0;
13
10
  });
14
11
  export var ResultItemAfterWrapper = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: flex;\n"])));
15
- export var ResultItemCaption = styled.span(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n color: ", ";\n font-size: 12px;\n margin-left: ", "px;\n"])), N200, gridSize());
12
+ export var ResultItemCaption = styled.span(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n color: ", ";\n font-size: 12px;\n margin-left: ", ";\n"])), N200, "var(--ds-space-100, 8px)");
16
13
  export var ResultItemSubText = styled.span(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n font-size: 12px;\n color: ", ";\n"])), N200);
17
- export var ResultItemIcon = styled.div(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n transition: padding 200ms;\n\n > * {\n flex: 1 0 auto;\n }\n\n /* We need to ensure that any image passed in as a child (<img/>, <svg/>\n etc.) receives the correct width, height and border radius. We don't\n currently assume that the image passed in is the correct dimensions, or has\n width / height 100% */\n > img {\n height: ", "px;\n width: ", "px;\n }\n"])), gridSize() * 3, gridSize() * 3);
14
+ export var ResultItemIcon = styled.div(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n transition: padding 200ms;\n\n > * {\n flex: 1 0 auto;\n }\n\n /* We need to ensure that any image passed in as a child (<img/>, <svg/>\n etc.) receives the correct width, height and border radius. We don't\n currently assume that the image passed in is the correct dimensions, or has\n width / height 100% */\n > img {\n height: ", ";\n width: ", ";\n }\n"])), "var(--ds-space-300, 24px)", "var(--ds-space-300, 24px)");
18
15
  export var ResultItemTextAfter = styled.div(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n position: relative;\n z-index: 1;\n"])));
@@ -8,39 +8,28 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
8
8
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
9
9
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
10
10
  var _excluded = ["name", "isPrivate", "type", "subText"];
11
-
12
11
  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); }; }
13
-
14
12
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
15
-
16
13
  import React from 'react';
17
14
  import Avatar from '@atlaskit/avatar';
18
15
  import ResultBase from './ResultBase';
19
-
20
16
  /**
21
17
  * Generic result type for Atlassian containers.
22
18
  */
23
19
  var ContainerResult = /*#__PURE__*/function (_React$PureComponent) {
24
20
  _inherits(ContainerResult, _React$PureComponent);
25
-
26
21
  var _super = _createSuper(ContainerResult);
27
-
28
22
  function ContainerResult() {
29
23
  var _this;
30
-
31
24
  _classCallCheck(this, ContainerResult);
32
-
33
25
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
34
26
  args[_key] = arguments[_key];
35
27
  }
36
-
37
28
  _this = _super.call.apply(_super, [this].concat(args));
38
-
39
29
  _defineProperty(_assertThisInitialized(_this), "getAvatar", function () {
40
30
  if (_this.props.avatar) {
41
31
  return _this.props.avatar;
42
32
  }
43
-
44
33
  return /*#__PURE__*/React.createElement(Avatar, {
45
34
  borderColor: "transparent",
46
35
  src: _this.props.avatarUrl,
@@ -49,21 +38,18 @@ var ContainerResult = /*#__PURE__*/function (_React$PureComponent) {
49
38
  status: _this.props.isPrivate ? 'locked' : null
50
39
  });
51
40
  });
52
-
53
41
  return _this;
54
42
  }
55
-
56
43
  _createClass(ContainerResult, [{
57
44
  key: "render",
58
45
  value: function render() {
59
46
  var _this$props = this.props,
60
- name = _this$props.name,
61
- isPrivate = _this$props.isPrivate,
62
- _this$props$type = _this$props.type,
63
- type = _this$props$type === void 0 ? 'container' : _this$props$type,
64
- subText = _this$props.subText,
65
- commonResultProps = _objectWithoutProperties(_this$props, _excluded);
66
-
47
+ name = _this$props.name,
48
+ isPrivate = _this$props.isPrivate,
49
+ _this$props$type = _this$props.type,
50
+ type = _this$props$type === void 0 ? 'container' : _this$props$type,
51
+ subText = _this$props.subText,
52
+ commonResultProps = _objectWithoutProperties(_this$props, _excluded);
67
53
  return /*#__PURE__*/React.createElement(ResultBase, _extends({}, commonResultProps, {
68
54
  type: type,
69
55
  text: name,
@@ -72,8 +58,6 @@ var ContainerResult = /*#__PURE__*/function (_React$PureComponent) {
72
58
  }));
73
59
  }
74
60
  }]);
75
-
76
61
  return ContainerResult;
77
62
  }(React.PureComponent);
78
-
79
63
  export { ContainerResult as default };