@atlaskit/link-datasource 1.26.1 → 1.26.3

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 (117) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/ui/common/modal/basic-search-input/index.js +9 -18
  3. package/dist/cjs/ui/common/modal/popup-select/index.js +217 -0
  4. package/dist/cjs/ui/{jira-issues-modal/basic-filters/ui → common/modal/popup-select}/menu-list/errorMessage.js +3 -3
  5. package/dist/cjs/ui/{jira-issues-modal/basic-filters/ui → common/modal/popup-select}/menu-list/index.js +6 -5
  6. package/dist/cjs/ui/{jira-issues-modal/basic-filters/ui → common/modal/popup-select}/menu-list/messages.js +5 -0
  7. package/dist/cjs/ui/{jira-issues-modal/basic-filters/ui → common/modal/popup-select}/menu-list/noOptionsMessage.js +3 -3
  8. package/dist/cjs/ui/common/modal/popup-select/menu-list/showMoreButton.js +36 -0
  9. package/dist/cjs/ui/common/modal/popup-select/messages.js +19 -0
  10. package/dist/cjs/ui/{jira-issues-modal/basic-filters/ui/async-popup-select → common/modal/popup-select}/trigger.js +12 -13
  11. package/dist/cjs/ui/common/modal/popup-select/types.js +5 -0
  12. package/dist/cjs/ui/confluence-search-modal/basic-filters/index.js +22 -0
  13. package/dist/cjs/ui/confluence-search-modal/confluence-search-container/index.js +18 -3
  14. package/dist/cjs/ui/confluence-search-modal/modal/index.js +11 -2
  15. package/dist/cjs/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.js +27 -163
  16. package/dist/cjs/ui/jira-issues-modal/basic-filters/ui/async-popup-select/messages.js +0 -15
  17. package/dist/cjs/ui/jira-issues-modal/jira-search-container/index.js +2 -1
  18. package/dist/es2019/ui/common/modal/basic-search-input/index.js +2 -10
  19. package/dist/es2019/ui/common/modal/popup-select/index.js +170 -0
  20. package/dist/es2019/ui/{jira-issues-modal/basic-filters/ui → common/modal/popup-select}/menu-list/errorMessage.js +3 -3
  21. package/dist/es2019/ui/{jira-issues-modal/basic-filters/ui → common/modal/popup-select}/menu-list/index.js +6 -5
  22. package/dist/es2019/ui/{jira-issues-modal/basic-filters/ui → common/modal/popup-select}/menu-list/messages.js +5 -0
  23. package/dist/es2019/ui/{jira-issues-modal/basic-filters/ui → common/modal/popup-select}/menu-list/noOptionsMessage.js +3 -3
  24. package/dist/es2019/ui/common/modal/popup-select/menu-list/showMoreButton.js +29 -0
  25. package/dist/es2019/ui/common/modal/popup-select/messages.js +13 -0
  26. package/dist/es2019/ui/{jira-issues-modal/basic-filters/ui/async-popup-select → common/modal/popup-select}/trigger.js +10 -11
  27. package/dist/es2019/ui/common/modal/popup-select/types.js +1 -0
  28. package/dist/es2019/ui/confluence-search-modal/basic-filters/index.js +13 -0
  29. package/dist/es2019/ui/confluence-search-modal/confluence-search-container/index.js +19 -4
  30. package/dist/es2019/ui/confluence-search-modal/modal/index.js +12 -2
  31. package/dist/es2019/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.js +25 -145
  32. package/dist/es2019/ui/jira-issues-modal/basic-filters/ui/async-popup-select/messages.js +0 -15
  33. package/dist/es2019/ui/jira-issues-modal/jira-search-container/index.js +2 -1
  34. package/dist/esm/ui/common/modal/basic-search-input/index.js +2 -10
  35. package/dist/esm/ui/common/modal/popup-select/index.js +207 -0
  36. package/dist/esm/ui/{jira-issues-modal/basic-filters/ui → common/modal/popup-select}/menu-list/errorMessage.js +3 -3
  37. package/dist/esm/ui/{jira-issues-modal/basic-filters/ui → common/modal/popup-select}/menu-list/index.js +6 -5
  38. package/dist/esm/ui/{jira-issues-modal/basic-filters/ui → common/modal/popup-select}/menu-list/messages.js +5 -0
  39. package/dist/esm/ui/{jira-issues-modal/basic-filters/ui → common/modal/popup-select}/menu-list/noOptionsMessage.js +3 -3
  40. package/dist/esm/ui/common/modal/popup-select/menu-list/showMoreButton.js +26 -0
  41. package/dist/esm/ui/common/modal/popup-select/messages.js +13 -0
  42. package/dist/esm/ui/{jira-issues-modal/basic-filters/ui/async-popup-select → common/modal/popup-select}/trigger.js +12 -13
  43. package/dist/esm/ui/common/modal/popup-select/types.js +1 -0
  44. package/dist/esm/ui/confluence-search-modal/basic-filters/index.js +15 -0
  45. package/dist/esm/ui/confluence-search-modal/confluence-search-container/index.js +19 -4
  46. package/dist/esm/ui/confluence-search-modal/modal/index.js +12 -3
  47. package/dist/esm/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.js +27 -163
  48. package/dist/esm/ui/jira-issues-modal/basic-filters/ui/async-popup-select/messages.js +0 -15
  49. package/dist/esm/ui/jira-issues-modal/jira-search-container/index.js +2 -1
  50. package/dist/types/analytics/generated/analytics.types.d.ts +6 -6
  51. package/dist/types/ui/common/modal/basic-search-input/index.d.ts +1 -0
  52. package/dist/types/ui/{jira-issues-modal/basic-filters/ui/async-popup-select → common/modal/popup-select}/control.d.ts +1 -1
  53. package/dist/{types-ts4.5/ui/jira-issues-modal/basic-filters/ui/async-popup-select → types/ui/common/modal/popup-select}/dropdownIndicator.d.ts +1 -1
  54. package/dist/types/ui/{jira-issues-modal/basic-filters/ui/async-popup-select → common/modal/popup-select}/formatOptionLabel.d.ts +1 -1
  55. package/dist/types/ui/common/modal/popup-select/index.d.ts +21 -0
  56. package/dist/types/ui/common/modal/popup-select/menu-list/errorMessage.d.ts +6 -0
  57. package/dist/types/ui/common/modal/popup-select/menu-list/index.d.ts +15 -0
  58. package/dist/{types-ts4.5/ui/jira-issues-modal/basic-filters/ui → types/ui/common/modal/popup-select}/menu-list/messages.d.ts +5 -0
  59. package/dist/types/ui/common/modal/popup-select/menu-list/noOptionsMessage.d.ts +5 -0
  60. package/dist/{types-ts4.5/ui/jira-issues-modal/basic-filters/ui/async-popup-select → types/ui/common/modal/popup-select/menu-list}/showMoreButton.d.ts +2 -1
  61. package/dist/types/ui/common/modal/popup-select/messages.d.ts +12 -0
  62. package/dist/types/ui/{jira-issues-modal/basic-filters/ui/async-popup-select → common/modal/popup-select}/trigger.d.ts +3 -2
  63. package/dist/types/ui/common/modal/popup-select/types.d.ts +22 -0
  64. package/dist/types/ui/confluence-search-modal/basic-filters/index.d.ts +5 -0
  65. package/dist/types/ui/jira-issues-modal/basic-filters/types.d.ts +0 -2
  66. package/dist/types/ui/jira-issues-modal/basic-filters/ui/async-popup-select/messages.d.ts +0 -15
  67. package/dist/types-ts4.5/analytics/generated/analytics.types.d.ts +6 -6
  68. package/dist/types-ts4.5/ui/common/modal/basic-search-input/index.d.ts +1 -0
  69. package/dist/types-ts4.5/ui/{jira-issues-modal/basic-filters/ui/async-popup-select → common/modal/popup-select}/control.d.ts +1 -1
  70. package/dist/{types/ui/jira-issues-modal/basic-filters/ui/async-popup-select → types-ts4.5/ui/common/modal/popup-select}/dropdownIndicator.d.ts +1 -1
  71. package/dist/types-ts4.5/ui/{jira-issues-modal/basic-filters/ui/async-popup-select → common/modal/popup-select}/formatOptionLabel.d.ts +1 -1
  72. package/dist/types-ts4.5/ui/common/modal/popup-select/index.d.ts +21 -0
  73. package/dist/types-ts4.5/ui/common/modal/popup-select/menu-list/errorMessage.d.ts +6 -0
  74. package/dist/types-ts4.5/ui/common/modal/popup-select/menu-list/index.d.ts +15 -0
  75. package/dist/{types/ui/jira-issues-modal/basic-filters/ui → types-ts4.5/ui/common/modal/popup-select}/menu-list/messages.d.ts +5 -0
  76. package/dist/types-ts4.5/ui/common/modal/popup-select/menu-list/noOptionsMessage.d.ts +5 -0
  77. package/dist/{types/ui/jira-issues-modal/basic-filters/ui/async-popup-select → types-ts4.5/ui/common/modal/popup-select/menu-list}/showMoreButton.d.ts +2 -1
  78. package/dist/types-ts4.5/ui/common/modal/popup-select/messages.d.ts +12 -0
  79. package/dist/types-ts4.5/ui/{jira-issues-modal/basic-filters/ui/async-popup-select → common/modal/popup-select}/trigger.d.ts +3 -2
  80. package/dist/types-ts4.5/ui/common/modal/popup-select/types.d.ts +22 -0
  81. package/dist/types-ts4.5/ui/confluence-search-modal/basic-filters/index.d.ts +5 -0
  82. package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/types.d.ts +0 -2
  83. package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/ui/async-popup-select/messages.d.ts +0 -15
  84. package/package.json +6 -3
  85. package/dist/cjs/ui/jira-issues-modal/basic-filters/ui/async-popup-select/showMoreButton.js +0 -22
  86. package/dist/es2019/ui/jira-issues-modal/basic-filters/ui/async-popup-select/showMoreButton.js +0 -17
  87. package/dist/esm/ui/jira-issues-modal/basic-filters/ui/async-popup-select/showMoreButton.js +0 -15
  88. package/dist/types/ui/jira-issues-modal/basic-filters/ui/menu-list/errorMessage.d.ts +0 -8
  89. package/dist/types/ui/jira-issues-modal/basic-filters/ui/menu-list/index.d.ts +0 -5
  90. package/dist/types/ui/jira-issues-modal/basic-filters/ui/menu-list/noOptionsMessage.d.ts +0 -6
  91. package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/ui/menu-list/errorMessage.d.ts +0 -8
  92. package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/ui/menu-list/index.d.ts +0 -5
  93. package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/ui/menu-list/noOptionsMessage.d.ts +0 -6
  94. /package/dist/cjs/ui/{jira-issues-modal/basic-filters/ui/async-popup-select → common/modal/popup-select}/control.js +0 -0
  95. /package/dist/cjs/ui/{jira-issues-modal/basic-filters/ui/async-popup-select → common/modal/popup-select}/dropdownIndicator.js +0 -0
  96. /package/dist/cjs/ui/{jira-issues-modal/basic-filters/ui/async-popup-select → common/modal/popup-select}/footer.js +0 -0
  97. /package/dist/cjs/ui/{jira-issues-modal/basic-filters/ui/async-popup-select → common/modal/popup-select}/formatOptionLabel.js +0 -0
  98. /package/dist/cjs/ui/{jira-issues-modal/basic-filters/ui → common/modal/popup-select}/menu-list/loadingMessage.js +0 -0
  99. /package/dist/cjs/ui/{jira-issues-modal/basic-filters/ui → common/modal/popup-select}/menu-list/selectMessage.js +0 -0
  100. /package/dist/es2019/ui/{jira-issues-modal/basic-filters/ui/async-popup-select → common/modal/popup-select}/control.js +0 -0
  101. /package/dist/es2019/ui/{jira-issues-modal/basic-filters/ui/async-popup-select → common/modal/popup-select}/dropdownIndicator.js +0 -0
  102. /package/dist/es2019/ui/{jira-issues-modal/basic-filters/ui/async-popup-select → common/modal/popup-select}/footer.js +0 -0
  103. /package/dist/es2019/ui/{jira-issues-modal/basic-filters/ui/async-popup-select → common/modal/popup-select}/formatOptionLabel.js +0 -0
  104. /package/dist/es2019/ui/{jira-issues-modal/basic-filters/ui → common/modal/popup-select}/menu-list/loadingMessage.js +0 -0
  105. /package/dist/es2019/ui/{jira-issues-modal/basic-filters/ui → common/modal/popup-select}/menu-list/selectMessage.js +0 -0
  106. /package/dist/esm/ui/{jira-issues-modal/basic-filters/ui/async-popup-select → common/modal/popup-select}/control.js +0 -0
  107. /package/dist/esm/ui/{jira-issues-modal/basic-filters/ui/async-popup-select → common/modal/popup-select}/dropdownIndicator.js +0 -0
  108. /package/dist/esm/ui/{jira-issues-modal/basic-filters/ui/async-popup-select → common/modal/popup-select}/footer.js +0 -0
  109. /package/dist/esm/ui/{jira-issues-modal/basic-filters/ui/async-popup-select → common/modal/popup-select}/formatOptionLabel.js +0 -0
  110. /package/dist/esm/ui/{jira-issues-modal/basic-filters/ui → common/modal/popup-select}/menu-list/loadingMessage.js +0 -0
  111. /package/dist/esm/ui/{jira-issues-modal/basic-filters/ui → common/modal/popup-select}/menu-list/selectMessage.js +0 -0
  112. /package/dist/types/ui/{jira-issues-modal/basic-filters/ui/async-popup-select → common/modal/popup-select}/footer.d.ts +0 -0
  113. /package/dist/types/ui/{jira-issues-modal/basic-filters/ui → common/modal/popup-select}/menu-list/loadingMessage.d.ts +0 -0
  114. /package/dist/types/ui/{jira-issues-modal/basic-filters/ui → common/modal/popup-select}/menu-list/selectMessage.d.ts +0 -0
  115. /package/dist/types-ts4.5/ui/{jira-issues-modal/basic-filters/ui/async-popup-select → common/modal/popup-select}/footer.d.ts +0 -0
  116. /package/dist/types-ts4.5/ui/{jira-issues-modal/basic-filters/ui → common/modal/popup-select}/menu-list/loadingMessage.d.ts +0 -0
  117. /package/dist/types-ts4.5/ui/{jira-issues-modal/basic-filters/ui → common/modal/popup-select}/menu-list/selectMessage.d.ts +0 -0
@@ -1,28 +1,13 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
4
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
5
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
6
- var _excluded = ["isOpen"];
7
3
  import _regeneratorRuntime from "@babel/runtime/regenerator";
8
4
  import React, { useCallback, useEffect, useRef, useState } from 'react';
9
5
  import isEqual from 'lodash/isEqual';
10
6
  import { useIntl } from 'react-intl-next';
11
7
  import { useDebouncedCallback } from 'use-debounce';
12
- import { CheckboxOption, PopupSelect } from '@atlaskit/select';
13
- import { useDatasourceAnalyticsEvents } from '../../../../../analytics';
8
+ import { FilterPopupSelect } from '../../../../common/modal/popup-select';
14
9
  import { useFilterOptions } from '../../hooks/useFilterOptions';
15
- import CustomMenuList from '../menu-list';
16
- import CustomControl from './control';
17
- import CustomDropdownIndicator from './dropdownIndicator';
18
- import PopupFooter from './footer';
19
- import formatOptionLabel from './formatOptionLabel';
20
10
  import { asyncPopupSelectMessages } from './messages';
21
- import PopupTrigger from './trigger';
22
- // Needed to disable filtering from react-select
23
- var noFilterOptions = function noFilterOptions() {
24
- return true;
25
- };
26
11
  export var SEARCH_DEBOUNCE_MS = 350;
27
12
  var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
28
13
  var filterType = _ref.filterType,
@@ -35,8 +20,6 @@ var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
35
20
  isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled;
36
21
  var _useIntl = useIntl(),
37
22
  formatMessage = _useIntl.formatMessage;
38
- var _useDatasourceAnalyti = useDatasourceAnalyticsEvents(),
39
- fireEvent = _useDatasourceAnalyti.fireEvent;
40
23
  var _useState = useState(''),
41
24
  _useState2 = _slicedToArray(_useState, 2),
42
25
  searchTerm = _useState2[0],
@@ -45,15 +28,9 @@ var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
45
28
  _useState4 = _slicedToArray(_useState3, 2),
46
29
  selectedOptions = _useState4[0],
47
30
  setSelectedOptions = _useState4[1];
48
- var _useState5 = useState([]),
49
- _useState6 = _slicedToArray(_useState5, 2),
50
- sortedOptions = _useState6[0],
51
- setSortedOptions = _useState6[1];
52
31
  var _ref2 = site || {},
53
32
  cloudId = _ref2.cloudId;
54
33
  var currentSiteCloudId = useRef(cloudId || '');
55
- var sortPaginatedResults = useRef(false); // this is to track pagination for sorting purpose
56
-
57
34
  var _useFilterOptions = useFilterOptions({
58
35
  filterType: filterType,
59
36
  site: site
@@ -73,123 +50,44 @@ var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
73
50
  _useDebouncedCallback2 = _slicedToArray(_useDebouncedCallback, 1),
74
51
  handleDebouncedFetchFilterOptions = _useDebouncedCallback2[0];
75
52
  var handleInputChange = useCallback( /*#__PURE__*/function () {
76
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(newSearchTerm, actionMeta) {
53
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(newSearchTerm) {
77
54
  return _regeneratorRuntime.wrap(function _callee$(_context) {
78
55
  while (1) switch (_context.prev = _context.next) {
79
56
  case 0:
80
- if (actionMeta.action === 'input-change' && newSearchTerm !== searchTerm) {
81
- setSearchTerm(newSearchTerm);
82
- handleDebouncedFetchFilterOptions(newSearchTerm);
83
- }
84
- case 1:
57
+ setSearchTerm(newSearchTerm);
58
+ handleDebouncedFetchFilterOptions(newSearchTerm);
59
+ case 2:
85
60
  case "end":
86
61
  return _context.stop();
87
62
  }
88
63
  }, _callee);
89
64
  }));
90
- return function (_x, _x2) {
65
+ return function (_x) {
91
66
  return _ref3.apply(this, arguments);
92
67
  };
93
- }(), [handleDebouncedFetchFilterOptions, searchTerm]);
68
+ }(), [handleDebouncedFetchFilterOptions]);
94
69
  var handleOptionSelection = useCallback(function (newValue) {
95
70
  onSelectionChange(filterType, newValue);
96
71
  }, [filterType, onSelectionChange]);
97
- var sortOptionsOnPopupOpen = useCallback(function () {
98
- if (selectedOptions.length === 0) {
99
- return setSortedOptions(filterOptions);
100
- }
101
- var nonSelectedOptions = filterOptions.filter(function (option) {
102
- return !selectedOptions.find(function (selectedOption) {
103
- return selectedOption.value === option.value;
104
- });
105
- });
106
- var newOptions = [].concat(_toConsumableArray(selectedOptions), _toConsumableArray(nonSelectedOptions));
107
- if (!isEqual(newOptions, sortedOptions)) {
108
- setSortedOptions(newOptions);
109
- }
110
- }, [selectedOptions, filterOptions, sortedOptions]);
111
- var sortOptionsOnResolve = useCallback(function () {
112
- // when the user is searching, we want the search result to be displayed as it is, and the select component will take care of marking the selected items
113
- if (searchTerm) {
114
- sortPaginatedResults.current = false; // set to false to indicate pagination resolve action is completed from the sorting perspective
115
- return setSortedOptions(filterOptions);
116
- }
117
-
118
- // sortedOptions is empty initially, this will take care of setting the initial value and bring the selected items to the top
119
- if (sortedOptions.length === 0) {
120
- return sortOptionsOnPopupOpen();
121
- }
122
-
123
- // this block handles the pagination, where on pagination, we will just append newOptions to the current list
124
- if (sortPaginatedResults.current) {
125
- var newOptions = filterOptions.filter(function (option) {
126
- return !sortedOptions.find(function (sortedOption) {
127
- return sortedOption.value === option.value;
128
- });
129
- });
130
- if (newOptions.length > 0) {
131
- setSortedOptions([].concat(_toConsumableArray(sortedOptions), _toConsumableArray(newOptions)));
132
- }
133
- sortPaginatedResults.current = false; // set to false to indicate pagination resolve action is completed from the sorting perspective
134
- return;
135
- }
136
- sortPaginatedResults.current = false; // set to false to indicate pagination resolve action is completed from the sorting perspective
137
- sortOptionsOnPopupOpen();
138
- }, [filterOptions, searchTerm, sortOptionsOnPopupOpen, sortedOptions]);
139
72
  var handleShowMore = useCallback(function () {
140
73
  if (pageCursor) {
141
- sortPaginatedResults.current = true;
142
74
  fetchFilterOptions({
143
75
  pageCursor: pageCursor,
144
76
  searchString: searchTerm
145
77
  });
146
- fireEvent('ui.button.clicked.basicSearchDropdown', {
147
- filterType: filterType,
148
- type: 'showMore'
149
- });
150
78
  }
151
- }, [fetchFilterOptions, filterType, fireEvent, pageCursor, searchTerm]);
79
+ }, [fetchFilterOptions, pageCursor, searchTerm]);
152
80
  var handleMenuOpen = useCallback(function () {
153
81
  if (status === 'empty' || status === 'rejected') {
154
82
  // if user searches and gets status as rejected, we want the dropdown to try load the request with searchString when the user reopens the dropdown
155
83
  fetchFilterOptions({
156
84
  searchString: searchTerm
157
85
  });
158
- } else if (status === 'resolved') {
159
- sortOptionsOnPopupOpen();
160
86
  }
161
- fireEvent('ui.dropdown.opened.basicSearchDropdown', {
162
- filterType: filterType,
163
- selectionCount: selectedOptions.length
164
- });
165
- }, [fetchFilterOptions, filterType, fireEvent, searchTerm, selectedOptions.length, sortOptionsOnPopupOpen, status]);
166
- var handleMenuClose = useCallback(function () {
167
- /**
168
- * Clearing the search is to ensure that the sortOptionsOnPopupOpen logic does not mess up.
169
- * Without this, when the user opens, sortOptionsOnPopupOpen will inject the selected options to the list and the list count and values will be off
170
- */
171
- if (searchTerm) {
172
- handleInputChange('', {
173
- action: 'input-change',
174
- prevInputValue: searchTerm
175
- });
176
- }
177
- fireEvent('ui.dropdown.closed.basicSearchDropdown', {
178
- filterType: filterType,
179
- selectionCount: selectedOptions.length
180
- });
181
- }, [filterType, fireEvent, handleInputChange, searchTerm, selectedOptions.length]);
182
- useEffect(function () {
183
- if (status === 'resolved') {
184
- sortOptionsOnResolve();
185
- }
186
- // eslint-disable-next-line react-hooks/exhaustive-deps
187
- }, [status]); // we only want the sortOptionsOnResolve to run when there is a status change
188
-
87
+ }, [fetchFilterOptions, searchTerm, status]);
189
88
  useEffect(function () {
190
89
  if (cloudId && currentSiteCloudId.current !== cloudId) {
191
90
  currentSiteCloudId.current = cloudId;
192
- setSortedOptions([]);
193
91
  setSearchTerm('');
194
92
  resetHook();
195
93
  }
@@ -204,29 +102,27 @@ var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
204
102
  var isLoading = status === 'loading' || status === 'empty';
205
103
  var isLoadingMore = status === 'loadingMore';
206
104
  var isEmpty = status === 'resolved' && filterOptionsLength === 0;
207
- var popupSelectOptions = isLoading || isError ? [] : sortedOptions; // if not set to [], then on loading, no loading UI will be shown
105
+ var popupSelectOptions = isLoading || isError ? [] : filterOptions; // if not set to [], then on loading, no loading UI will be shown
208
106
  var areAllResultsLoaded = filterOptionsLength === totalCount;
209
107
  var shouldShowFooter = (status === 'resolved' || isLoadingMore) && filterOptionsLength > 0; // footer should not disappear when there is an inline spinner for loading more data
210
108
  var shouldDisplayShowMoreButton = status === 'resolved' && !!pageCursor && !areAllResultsLoaded;
211
- return /*#__PURE__*/React.createElement(PopupSelect, {
212
- isMulti: true,
213
- maxMenuWidth: 300,
214
- minMenuWidth: 300,
215
- testId: "jlol-basic-filter-popup-select",
216
- inputId: "jlol-basic-filter-popup-select--input"
217
- /*
218
- this threshold controls the display of the search control (input field for search)
219
- if this threshold is less than 0, when typing a search string that returns no results it will not remove the search control
220
- if this threshold is 0 or higher, it will remove the search control when there are no results, the user will be unable to clear the search to see more results
221
- */,
222
- searchThreshold: -1,
223
- inputValue: searchTerm,
224
- closeMenuOnSelect: false,
225
- hideSelectedOptions: false,
226
- isLoading: isLoading,
227
- placeholder: formatMessage(asyncPopupSelectMessages.selectPlaceholder),
109
+ var triggerButtonLabel = formatMessage(asyncPopupSelectMessages["".concat(filterType, "Label")]);
110
+ return /*#__PURE__*/React.createElement(FilterPopupSelect, {
111
+ filterName: "jlol-basic-filter-".concat(filterType),
112
+ status: status,
113
+ showLoading: isLoading,
114
+ showHydrating: isJQLHydrating,
115
+ isDisabled: isDisabled,
116
+ totalCount: totalCount,
117
+ shouldShowFooter: shouldShowFooter,
118
+ selectedOptions: selectedOptions,
119
+ options: popupSelectOptions,
120
+ buttonLabel: triggerButtonLabel,
121
+ onInputChange: handleInputChange,
122
+ onSelectionChange: handleOptionSelection,
123
+ onMenuOpen: handleMenuOpen,
228
124
  menuListProps: {
229
- filterType: filterType,
125
+ filterName: filterType,
230
126
  isError: isError,
231
127
  isEmpty: isEmpty,
232
128
  isLoading: isLoading,
@@ -234,39 +130,7 @@ var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
234
130
  handleShowMore: handleShowMore,
235
131
  errors: errors,
236
132
  showMore: shouldDisplayShowMoreButton
237
- },
238
- components: {
239
- Option: CheckboxOption,
240
- Control: CustomControl,
241
- MenuList: CustomMenuList,
242
- DropdownIndicator: CustomDropdownIndicator,
243
- LoadingIndicator: undefined,
244
- // disables the three ... indicator in the searchbox when picker is loading
245
- IndicatorSeparator: undefined // disables the | separator between search input and icon
246
- },
247
- options: popupSelectOptions,
248
- value: selectedOptions,
249
- filterOption: noFilterOptions,
250
- formatOptionLabel: formatOptionLabel,
251
- onChange: handleOptionSelection,
252
- onInputChange: handleInputChange,
253
- onOpen: handleMenuOpen,
254
- onClose: handleMenuClose,
255
- target: function target(_ref4) {
256
- var isOpen = _ref4.isOpen,
257
- triggerProps = _objectWithoutProperties(_ref4, _excluded);
258
- return /*#__PURE__*/React.createElement(PopupTrigger, _extends({}, triggerProps, {
259
- filterType: filterType,
260
- selectedOptions: selectedOptions,
261
- isSelected: isOpen,
262
- isDisabled: isDisabled,
263
- isLoading: isJQLHydrating
264
- }));
265
- },
266
- footer: shouldShowFooter && /*#__PURE__*/React.createElement(PopupFooter, {
267
- currentDisplayCount: popupSelectOptions.length,
268
- totalCount: totalCount
269
- })
133
+ }
270
134
  });
271
135
  };
272
136
  export default AsyncPopupSelect;
@@ -1,15 +1,5 @@
1
1
  import { defineMessages } from 'react-intl-next';
2
2
  export var asyncPopupSelectMessages = defineMessages({
3
- selectPlaceholder: {
4
- id: 'linkDataSource.basic-filter.dropdown.select.placeholder',
5
- description: 'Placeholder text to be displayed for the search input box.',
6
- defaultMessage: 'Search'
7
- },
8
- paginationDetails: {
9
- id: 'linkDataSource.basic-filter.footer.pagination-details',
10
- description: 'Text to indicate page count and total count information.',
11
- defaultMessage: '{currentDisplayCount} of {totalCount}'
12
- },
13
3
  projectLabel: {
14
4
  id: 'linkDataSource.basic-filter.project.label',
15
5
  description: 'Label to be displayed for project filter dropdown button.',
@@ -29,10 +19,5 @@ export var asyncPopupSelectMessages = defineMessages({
29
19
  id: 'linkDataSource.basic-filter.assignee.label',
30
20
  description: 'Label to be displayed for assignee filter dropdown button.',
31
21
  defaultMessage: 'Assignee'
32
- },
33
- showMoreMessage: {
34
- id: 'linkDataSource.basic-filter.showMoreButton',
35
- defaultMessage: 'Show more',
36
- description: 'The text to show more options in dropdown'
37
22
  }
38
23
  });
@@ -218,7 +218,8 @@ export var JiraSearchContainer = function JiraSearchContainer(props) {
218
218
  onSearch: handleSearch,
219
219
  searchTerm: basicSearchTerm,
220
220
  placeholder: basicSearchInputMessages.basicTextSearchLabel,
221
- testId: "jira-datasource-modal"
221
+ testId: "jira-datasource-modal",
222
+ fullWidth: !showBasicFilters
222
223
  }), showBasicFilters && jsx(BasicFilters, {
223
224
  jql: searchBarJql,
224
225
  site: site,
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Generates Typescript types for analytics events from analytics.spec.yaml
5
5
  *
6
- * @codegen <<SignedSource::e9179418960d1cbfd58428448cf63c82>>
6
+ * @codegen <<SignedSource::6518dea178189cd102e0ca6ce7eae059>>
7
7
  * @codegenCommand yarn workspace @atlassian/analytics-tooling run analytics:codegen link-datasource
8
8
  */
9
9
  export type ComponentMetaDataType = {
@@ -103,22 +103,22 @@ export type LinkViewedCountAttributesType = {
103
103
  extensionKey: string | null;
104
104
  };
105
105
  export type EmptyResultShownBasicSearchDropdownAttributesType = {
106
- filterType: 'project' | 'assignee' | 'type' | 'status';
106
+ filterName: string;
107
107
  };
108
108
  export type ErrorShownBasicSearchDropdownAttributesType = {
109
- filterType: 'project' | 'assignee' | 'type' | 'status';
109
+ filterName: string;
110
110
  reason: 'agg' | 'network' | 'unknown';
111
111
  };
112
112
  export type DropdownOpenedBasicSearchDropdownAttributesType = {
113
- filterType: 'project' | 'assignee' | 'type' | 'status';
113
+ filterName: string;
114
114
  selectionCount: number;
115
115
  };
116
116
  export type DropdownClosedBasicSearchDropdownAttributesType = {
117
- filterType: 'project' | 'assignee' | 'type' | 'status';
117
+ filterName: string;
118
118
  selectionCount: number;
119
119
  };
120
120
  export type ButtonClickedBasicSearchDropdownAttributesType = {
121
- filterType: 'project' | 'assignee' | 'type' | 'status';
121
+ filterName: string;
122
122
  type: 'showMore';
123
123
  };
124
124
  export type AqlEditorSearchedAttributesType = {};
@@ -1,3 +1,4 @@
1
+ /** @jsx jsx */
1
2
  /// <reference types="react" />
2
3
  import { jsx } from '@emotion/react';
3
4
  import { MessageDescriptor } from 'react-intl-next';
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import { ControlProps } from '@atlaskit/select';
3
- import { SelectOption } from '../../types';
3
+ import { SelectOption } from './types';
4
4
  export declare const CustomControl: ({ children, ...innerProps }: ControlProps<SelectOption, true>) => JSX.Element;
5
5
  export default CustomControl;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import { DropdownIndicatorProps } from '@atlaskit/select';
3
- import { SelectOption } from '../../types';
3
+ import { SelectOption } from './types';
4
4
  declare const CustomDropdownIndicator: (props: DropdownIndicatorProps<SelectOption, true>) => JSX.Element;
5
5
  export default CustomDropdownIndicator;
@@ -1,3 +1,3 @@
1
- import { FormatOptionLabel } from '../../types';
1
+ import { FormatOptionLabel } from './types';
2
2
  declare const formatOptionLabel: FormatOptionLabel;
3
3
  export default formatOptionLabel;
@@ -0,0 +1,21 @@
1
+ /// <reference types="react" />
2
+ import { InputActionMeta, ValueType } from '@atlaskit/select';
3
+ import { CustomMenuListProps } from './menu-list';
4
+ import { SelectOption } from './types';
5
+ export declare const FilterPopupSelect: ({ filterName, totalCount, status, buttonLabel, showLoading, isDisabled, showHydrating, shouldShowFooter, menuListProps, options, selectedOptions, onSelectionChange, onInputChange, onMenuClose, onMenuOpen, }: {
6
+ buttonLabel: string;
7
+ totalCount: number;
8
+ filterName: string;
9
+ isDisabled: boolean;
10
+ showLoading: boolean;
11
+ showHydrating: boolean;
12
+ shouldShowFooter: boolean;
13
+ status: 'empty' | 'loading' | 'resolved' | 'rejected' | 'loadingMore';
14
+ menuListProps: CustomMenuListProps;
15
+ options: ValueType<SelectOption, true>;
16
+ selectedOptions: ValueType<SelectOption, true>;
17
+ onSelectionChange: (newValue: ValueType<SelectOption, true>) => void;
18
+ onInputChange: (newValue: string, actionMeta: InputActionMeta) => void;
19
+ onMenuOpen?: (() => void) | undefined;
20
+ onMenuClose?: (() => void) | undefined;
21
+ }) => JSX.Element;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ declare const CustomErrorMessage: ({ filterName, errors, }: {
3
+ filterName: string;
4
+ errors?: unknown[] | undefined;
5
+ }) => JSX.Element;
6
+ export default CustomErrorMessage;
@@ -0,0 +1,15 @@
1
+ /// <reference types="react" />
2
+ import { MenuListComponentProps } from '@atlaskit/select';
3
+ import { SelectOption } from '../types';
4
+ export type CustomMenuListProps = {
5
+ isError?: boolean;
6
+ isLoading?: boolean;
7
+ isLoadingMore?: boolean;
8
+ isEmpty?: boolean;
9
+ showMore?: boolean;
10
+ handleShowMore: () => void;
11
+ filterName: string;
12
+ errors?: unknown[];
13
+ };
14
+ declare const CustomMenuList: ({ children, ...props }: MenuListComponentProps<SelectOption, true>) => JSX.Element;
15
+ export default CustomMenuList;
@@ -14,4 +14,9 @@ export declare const asyncPopupSelectMessages: {
14
14
  defaultMessage: string;
15
15
  description: string;
16
16
  };
17
+ showMoreMessage: {
18
+ id: string;
19
+ defaultMessage: string;
20
+ description: string;
21
+ };
17
22
  };
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ declare const CustomNoOptionsMessage: ({ filterName }: {
3
+ filterName: string;
4
+ }) => JSX.Element;
5
+ export default CustomNoOptionsMessage;
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  type ShowMoreButtonProps = {
3
3
  onShowMore: () => void;
4
+ filterName: string;
4
5
  };
5
- declare const ShowMoreButton: ({ onShowMore }: ShowMoreButtonProps) => JSX.Element;
6
+ declare const ShowMoreButton: ({ onShowMore, filterName }: ShowMoreButtonProps) => JSX.Element;
6
7
  export default ShowMoreButton;
@@ -0,0 +1,12 @@
1
+ export declare const asyncPopupSelectMessages: {
2
+ selectPlaceholder: {
3
+ id: string;
4
+ description: string;
5
+ defaultMessage: string;
6
+ };
7
+ paginationDetails: {
8
+ id: string;
9
+ description: string;
10
+ defaultMessage: string;
11
+ };
12
+ };
@@ -1,7 +1,8 @@
1
1
  import React from 'react';
2
- import { BasicFilterFieldType, SelectOption } from '../../types';
2
+ import { SelectOption } from './types';
3
3
  export interface PopupTriggerProps {
4
- filterType: BasicFilterFieldType;
4
+ label: string;
5
+ testId?: string;
5
6
  selectedOptions?: ReadonlyArray<SelectOption>;
6
7
  isSelected?: boolean;
7
8
  isDisabled?: boolean;
@@ -0,0 +1,22 @@
1
+ import { ReactElement } from 'react';
2
+ export interface OptionBase {
3
+ label: string;
4
+ value: string;
5
+ }
6
+ export type IconLabelOption = OptionBase & {
7
+ optionType: 'iconLabel';
8
+ icon: string;
9
+ };
10
+ export type LozengeLabelOption = OptionBase & {
11
+ optionType: 'lozengeLabel';
12
+ appearance?: LozengeAppearance;
13
+ };
14
+ export type LozengeAppearance = 'default' | 'inprogress' | 'moved' | 'new' | 'removed' | 'success';
15
+ export type AvatarLabelOption = OptionBase & {
16
+ optionType: 'avatarLabel';
17
+ avatar?: string;
18
+ isSquare?: boolean;
19
+ isGroup?: boolean;
20
+ };
21
+ export type SelectOption = IconLabelOption | LozengeLabelOption | AvatarLabelOption;
22
+ export type FormatOptionLabel = (option: SelectOption) => ReactElement;
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ export interface BasicFilterContainerProps {
3
+ }
4
+ declare const BasicFilterContainer: ({}: BasicFilterContainerProps) => JSX.Element;
5
+ export default BasicFilterContainer;
@@ -1,4 +1,3 @@
1
- import { ReactElement } from 'react';
2
1
  export type BasicFilterFieldType = 'project' | 'assignee' | 'type' | 'status';
3
2
  export interface OptionBase {
4
3
  label: string;
@@ -23,7 +22,6 @@ export type SelectOption = IconLabelOption | LozengeLabelOption | AvatarLabelOpt
23
22
  export type SelectedOptionsMap = {
24
23
  [key in BasicFilterFieldType]?: SelectOption[];
25
24
  };
26
- export type FormatOptionLabel = (option: SelectOption) => ReactElement;
27
25
  export declare const appearanceMap: {
28
26
  readonly BLUE_GRAY: "default";
29
27
  readonly MEDIUM_GRAY: "default";
@@ -1,14 +1,4 @@
1
1
  export declare const asyncPopupSelectMessages: {
2
- selectPlaceholder: {
3
- id: string;
4
- description: string;
5
- defaultMessage: string;
6
- };
7
- paginationDetails: {
8
- id: string;
9
- description: string;
10
- defaultMessage: string;
11
- };
12
2
  projectLabel: {
13
3
  id: string;
14
4
  description: string;
@@ -29,9 +19,4 @@ export declare const asyncPopupSelectMessages: {
29
19
  description: string;
30
20
  defaultMessage: string;
31
21
  };
32
- showMoreMessage: {
33
- id: string;
34
- defaultMessage: string;
35
- description: string;
36
- };
37
22
  };
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Generates Typescript types for analytics events from analytics.spec.yaml
5
5
  *
6
- * @codegen <<SignedSource::e9179418960d1cbfd58428448cf63c82>>
6
+ * @codegen <<SignedSource::6518dea178189cd102e0ca6ce7eae059>>
7
7
  * @codegenCommand yarn workspace @atlassian/analytics-tooling run analytics:codegen link-datasource
8
8
  */
9
9
  export type ComponentMetaDataType = {
@@ -103,22 +103,22 @@ export type LinkViewedCountAttributesType = {
103
103
  extensionKey: string | null;
104
104
  };
105
105
  export type EmptyResultShownBasicSearchDropdownAttributesType = {
106
- filterType: 'project' | 'assignee' | 'type' | 'status';
106
+ filterName: string;
107
107
  };
108
108
  export type ErrorShownBasicSearchDropdownAttributesType = {
109
- filterType: 'project' | 'assignee' | 'type' | 'status';
109
+ filterName: string;
110
110
  reason: 'agg' | 'network' | 'unknown';
111
111
  };
112
112
  export type DropdownOpenedBasicSearchDropdownAttributesType = {
113
- filterType: 'project' | 'assignee' | 'type' | 'status';
113
+ filterName: string;
114
114
  selectionCount: number;
115
115
  };
116
116
  export type DropdownClosedBasicSearchDropdownAttributesType = {
117
- filterType: 'project' | 'assignee' | 'type' | 'status';
117
+ filterName: string;
118
118
  selectionCount: number;
119
119
  };
120
120
  export type ButtonClickedBasicSearchDropdownAttributesType = {
121
- filterType: 'project' | 'assignee' | 'type' | 'status';
121
+ filterName: string;
122
122
  type: 'showMore';
123
123
  };
124
124
  export type AqlEditorSearchedAttributesType = {};
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ /** @jsx jsx */
2
3
  import { jsx } from '@emotion/react';
3
4
  import { MessageDescriptor } from 'react-intl-next';
4
5
  export interface BasicSearchInputProps {
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import { ControlProps } from '@atlaskit/select';
3
- import { SelectOption } from '../../types';
3
+ import { SelectOption } from './types';
4
4
  export declare const CustomControl: ({ children, ...innerProps }: ControlProps<SelectOption, true>) => JSX.Element;
5
5
  export default CustomControl;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import { DropdownIndicatorProps } from '@atlaskit/select';
3
- import { SelectOption } from '../../types';
3
+ import { SelectOption } from './types';
4
4
  declare const CustomDropdownIndicator: (props: DropdownIndicatorProps<SelectOption, true>) => JSX.Element;
5
5
  export default CustomDropdownIndicator;
@@ -1,3 +1,3 @@
1
- import { FormatOptionLabel } from '../../types';
1
+ import { FormatOptionLabel } from './types';
2
2
  declare const formatOptionLabel: FormatOptionLabel;
3
3
  export default formatOptionLabel;
@@ -0,0 +1,21 @@
1
+ /// <reference types="react" />
2
+ import { InputActionMeta, ValueType } from '@atlaskit/select';
3
+ import { CustomMenuListProps } from './menu-list';
4
+ import { SelectOption } from './types';
5
+ export declare const FilterPopupSelect: ({ filterName, totalCount, status, buttonLabel, showLoading, isDisabled, showHydrating, shouldShowFooter, menuListProps, options, selectedOptions, onSelectionChange, onInputChange, onMenuClose, onMenuOpen, }: {
6
+ buttonLabel: string;
7
+ totalCount: number;
8
+ filterName: string;
9
+ isDisabled: boolean;
10
+ showLoading: boolean;
11
+ showHydrating: boolean;
12
+ shouldShowFooter: boolean;
13
+ status: 'empty' | 'loading' | 'resolved' | 'rejected' | 'loadingMore';
14
+ menuListProps: CustomMenuListProps;
15
+ options: ValueType<SelectOption, true>;
16
+ selectedOptions: ValueType<SelectOption, true>;
17
+ onSelectionChange: (newValue: ValueType<SelectOption, true>) => void;
18
+ onInputChange: (newValue: string, actionMeta: InputActionMeta) => void;
19
+ onMenuOpen?: (() => void) | undefined;
20
+ onMenuClose?: (() => void) | undefined;
21
+ }) => JSX.Element;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ declare const CustomErrorMessage: ({ filterName, errors, }: {
3
+ filterName: string;
4
+ errors?: unknown[] | undefined;
5
+ }) => JSX.Element;
6
+ export default CustomErrorMessage;