@atlaskit/user-picker 9.7.4 → 10.0.1

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 (248) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/analytics.js +2 -53
  3. package/dist/cjs/clients/UserSourceProvider.js +11 -33
  4. package/dist/cjs/components/AddOptionAvatar.js +2 -9
  5. package/dist/cjs/components/AvatarItemOption.js +4 -29
  6. package/dist/cjs/components/BaseUserPicker.js +56 -156
  7. package/dist/cjs/components/ClearIndicator.js +4 -35
  8. package/dist/cjs/components/CustomOption/index.js +0 -7
  9. package/dist/cjs/components/CustomOption/main.js +4 -30
  10. package/dist/cjs/components/EmailOption/index.js +0 -7
  11. package/dist/cjs/components/EmailOption/main.js +2 -29
  12. package/dist/cjs/components/ExternalUserOption/ExternalAvatarItemOption.js +4 -15
  13. package/dist/cjs/components/ExternalUserOption/InfoIcon.js +4 -13
  14. package/dist/cjs/components/ExternalUserOption/SourcesTooltipContent.js +4 -20
  15. package/dist/cjs/components/ExternalUserOption/index.js +0 -7
  16. package/dist/cjs/components/ExternalUserOption/main.js +10 -48
  17. package/dist/cjs/components/ExternalUserSourcesContainer.js +5 -13
  18. package/dist/cjs/components/GroupOption/index.js +0 -7
  19. package/dist/cjs/components/GroupOption/main.js +4 -31
  20. package/dist/cjs/components/HighlightText.js +3 -27
  21. package/dist/cjs/components/Input.js +0 -23
  22. package/dist/cjs/components/MessagesIntlProvider.js +3 -20
  23. package/dist/cjs/components/MultiValue.js +21 -57
  24. package/dist/cjs/components/MultiValueContainer.js +8 -47
  25. package/dist/cjs/components/Option.js +5 -27
  26. package/dist/cjs/components/PopupControl.js +0 -22
  27. package/dist/cjs/components/PopupInput.js +0 -22
  28. package/dist/cjs/components/PopupUserPicker.js +10 -39
  29. package/dist/cjs/components/SingleValue.js +6 -17
  30. package/dist/cjs/components/SingleValueContainer.js +8 -37
  31. package/dist/cjs/components/SizeableAvatar.js +4 -20
  32. package/dist/cjs/components/TeamOption/index.js +0 -7
  33. package/dist/cjs/components/TeamOption/main.js +9 -37
  34. package/dist/cjs/components/UserOption.js +7 -34
  35. package/dist/cjs/components/UserPicker.js +14 -50
  36. package/dist/cjs/components/assets/github.js +0 -4
  37. package/dist/cjs/components/assets/google.js +0 -4
  38. package/dist/cjs/components/assets/microsoft.js +0 -4
  39. package/dist/cjs/components/assets/slack.js +0 -4
  40. package/dist/cjs/components/batch.js +0 -3
  41. package/dist/cjs/components/components.js +0 -17
  42. package/dist/cjs/components/creatable.js +2 -15
  43. package/dist/cjs/components/creatableEmailSuggestion.js +7 -18
  44. package/dist/cjs/components/emailValidation.js +0 -4
  45. package/dist/cjs/components/i18n.js +0 -2
  46. package/dist/cjs/components/popup.js +0 -3
  47. package/dist/cjs/components/styles.js +10 -26
  48. package/dist/cjs/components/utils.js +0 -53
  49. package/dist/cjs/i18n/cs.js +1 -1
  50. package/dist/cjs/i18n/da.js +1 -1
  51. package/dist/cjs/i18n/de.js +1 -1
  52. package/dist/cjs/i18n/en.js +31 -4
  53. package/dist/cjs/i18n/en_GB.js +31 -4
  54. package/dist/cjs/i18n/en_ZZ.js +1 -1
  55. package/dist/cjs/i18n/es.js +1 -1
  56. package/dist/cjs/i18n/et.js +0 -1
  57. package/dist/cjs/i18n/fi.js +1 -1
  58. package/dist/cjs/i18n/fr.js +1 -1
  59. package/dist/cjs/i18n/hu.js +1 -1
  60. package/dist/cjs/i18n/index.js +0 -31
  61. package/dist/cjs/i18n/it.js +1 -1
  62. package/dist/cjs/i18n/ja.js +1 -1
  63. package/dist/cjs/i18n/ko.js +1 -1
  64. package/dist/cjs/i18n/nb.js +1 -1
  65. package/dist/cjs/i18n/nl.js +1 -1
  66. package/dist/cjs/i18n/pl.js +1 -1
  67. package/dist/cjs/i18n/pt_BR.js +1 -1
  68. package/dist/cjs/i18n/pt_PT.js +0 -1
  69. package/dist/cjs/i18n/ru.js +1 -1
  70. package/dist/cjs/i18n/sk.js +0 -1
  71. package/dist/cjs/i18n/sv.js +1 -1
  72. package/dist/cjs/i18n/th.js +1 -1
  73. package/dist/cjs/i18n/tr.js +1 -1
  74. package/dist/cjs/i18n/uk.js +1 -1
  75. package/dist/cjs/i18n/vi.js +1 -1
  76. package/dist/cjs/i18n/zh.js +1 -1
  77. package/dist/cjs/i18n/zh_TW.js +1 -1
  78. package/dist/cjs/index.js +0 -5
  79. package/dist/cjs/util/i18n-util.js +0 -43
  80. package/dist/cjs/util/ufoExperiences.js +0 -17
  81. package/dist/cjs/version.json +1 -1
  82. package/dist/es2019/analytics.js +18 -35
  83. package/dist/es2019/clients/UserSourceProvider.js +0 -6
  84. package/dist/es2019/components/AddOptionAvatar.js +0 -2
  85. package/dist/es2019/components/AvatarItemOption.js +1 -10
  86. package/dist/es2019/components/BaseUserPicker.js +9 -84
  87. package/dist/es2019/components/ClearIndicator.js +5 -11
  88. package/dist/es2019/components/CustomOption/index.js +1 -3
  89. package/dist/es2019/components/CustomOption/main.js +0 -10
  90. package/dist/es2019/components/EmailOption/index.js +1 -3
  91. package/dist/es2019/components/EmailOption/main.js +0 -9
  92. package/dist/es2019/components/ExternalUserOption/ExternalAvatarItemOption.js +1 -4
  93. package/dist/es2019/components/ExternalUserOption/index.js +1 -3
  94. package/dist/es2019/components/ExternalUserOption/main.js +0 -15
  95. package/dist/es2019/components/ExternalUserSourcesContainer.js +0 -2
  96. package/dist/es2019/components/GroupOption/index.js +1 -3
  97. package/dist/es2019/components/GroupOption/main.js +0 -7
  98. package/dist/es2019/components/HighlightText.js +0 -11
  99. package/dist/es2019/components/Input.js +0 -5
  100. package/dist/es2019/components/MessagesIntlProvider.js +2 -4
  101. package/dist/es2019/components/MultiValue.js +3 -15
  102. package/dist/es2019/components/MultiValueContainer.js +4 -24
  103. package/dist/es2019/components/Option.js +0 -9
  104. package/dist/es2019/components/PopupControl.js +0 -4
  105. package/dist/es2019/components/PopupInput.js +0 -6
  106. package/dist/es2019/components/PopupUserPicker.js +0 -8
  107. package/dist/es2019/components/SingleValue.js +0 -1
  108. package/dist/es2019/components/SingleValueContainer.js +0 -8
  109. package/dist/es2019/components/SizeableAvatar.js +0 -1
  110. package/dist/es2019/components/TeamOption/index.js +1 -3
  111. package/dist/es2019/components/TeamOption/main.js +2 -12
  112. package/dist/es2019/components/UserOption.js +0 -9
  113. package/dist/es2019/components/UserPicker.js +6 -8
  114. package/dist/es2019/components/batch.js +0 -1
  115. package/dist/es2019/components/components.js +3 -4
  116. package/dist/es2019/components/creatable.js +2 -9
  117. package/dist/es2019/components/creatableEmailSuggestion.js +7 -12
  118. package/dist/es2019/components/emailValidation.js +0 -2
  119. package/dist/es2019/components/styles.js +30 -22
  120. package/dist/es2019/components/utils.js +2 -8
  121. package/dist/es2019/i18n/cs.js +1 -0
  122. package/dist/es2019/i18n/da.js +1 -0
  123. package/dist/es2019/i18n/de.js +1 -0
  124. package/dist/es2019/i18n/en.js +31 -4
  125. package/dist/es2019/i18n/en_GB.js +31 -4
  126. package/dist/es2019/i18n/en_ZZ.js +1 -0
  127. package/dist/es2019/i18n/es.js +1 -0
  128. package/dist/es2019/i18n/fi.js +1 -0
  129. package/dist/es2019/i18n/fr.js +1 -0
  130. package/dist/es2019/i18n/hu.js +1 -0
  131. package/dist/es2019/i18n/it.js +1 -0
  132. package/dist/es2019/i18n/ja.js +1 -0
  133. package/dist/es2019/i18n/ko.js +1 -0
  134. package/dist/es2019/i18n/nb.js +1 -0
  135. package/dist/es2019/i18n/nl.js +1 -0
  136. package/dist/es2019/i18n/pl.js +1 -0
  137. package/dist/es2019/i18n/pt_BR.js +1 -0
  138. package/dist/es2019/i18n/ru.js +1 -0
  139. package/dist/es2019/i18n/sv.js +1 -0
  140. package/dist/es2019/i18n/th.js +1 -0
  141. package/dist/es2019/i18n/tr.js +1 -0
  142. package/dist/es2019/i18n/uk.js +1 -0
  143. package/dist/es2019/i18n/vi.js +1 -0
  144. package/dist/es2019/i18n/zh.js +1 -0
  145. package/dist/es2019/i18n/zh_TW.js +1 -0
  146. package/dist/es2019/index.js +2 -1
  147. package/dist/es2019/util/i18n-util.js +30 -120
  148. package/dist/es2019/util/ufoExperiences.js +0 -3
  149. package/dist/es2019/version.json +1 -1
  150. package/dist/esm/analytics.js +2 -30
  151. package/dist/esm/clients/UserSourceProvider.js +11 -21
  152. package/dist/esm/components/AddOptionAvatar.js +1 -3
  153. package/dist/esm/components/AvatarItemOption.js +5 -18
  154. package/dist/esm/components/BaseUserPicker.js +56 -167
  155. package/dist/esm/components/ClearIndicator.js +5 -23
  156. package/dist/esm/components/CustomOption/index.js +1 -3
  157. package/dist/esm/components/CustomOption/main.js +4 -22
  158. package/dist/esm/components/EmailOption/index.js +1 -3
  159. package/dist/esm/components/EmailOption/main.js +2 -20
  160. package/dist/esm/components/ExternalUserOption/ExternalAvatarItemOption.js +5 -11
  161. package/dist/esm/components/ExternalUserOption/InfoIcon.js +3 -5
  162. package/dist/esm/components/ExternalUserOption/SourcesTooltipContent.js +3 -3
  163. package/dist/esm/components/ExternalUserOption/index.js +1 -3
  164. package/dist/esm/components/ExternalUserOption/main.js +10 -35
  165. package/dist/esm/components/ExternalUserSourcesContainer.js +5 -8
  166. package/dist/esm/components/GroupOption/index.js +1 -3
  167. package/dist/esm/components/GroupOption/main.js +4 -19
  168. package/dist/esm/components/HighlightText.js +3 -21
  169. package/dist/esm/components/Input.js +0 -14
  170. package/dist/esm/components/MessagesIntlProvider.js +3 -10
  171. package/dist/esm/components/MultiValue.js +21 -39
  172. package/dist/esm/components/MultiValueContainer.js +8 -37
  173. package/dist/esm/components/Option.js +5 -15
  174. package/dist/esm/components/PopupControl.js +0 -11
  175. package/dist/esm/components/PopupInput.js +0 -14
  176. package/dist/esm/components/PopupUserPicker.js +10 -28
  177. package/dist/esm/components/SingleValue.js +6 -8
  178. package/dist/esm/components/SingleValueContainer.js +8 -25
  179. package/dist/esm/components/SizeableAvatar.js +4 -12
  180. package/dist/esm/components/TeamOption/index.js +1 -3
  181. package/dist/esm/components/TeamOption/main.js +9 -27
  182. package/dist/esm/components/UserOption.js +7 -24
  183. package/dist/esm/components/UserPicker.js +14 -26
  184. package/dist/esm/components/batch.js +0 -2
  185. package/dist/esm/components/components.js +1 -6
  186. package/dist/esm/components/creatable.js +2 -9
  187. package/dist/esm/components/creatableEmailSuggestion.js +7 -12
  188. package/dist/esm/components/emailValidation.js +0 -2
  189. package/dist/esm/components/styles.js +10 -21
  190. package/dist/esm/components/utils.js +0 -11
  191. package/dist/esm/i18n/cs.js +1 -0
  192. package/dist/esm/i18n/da.js +1 -0
  193. package/dist/esm/i18n/de.js +1 -0
  194. package/dist/esm/i18n/en.js +31 -4
  195. package/dist/esm/i18n/en_GB.js +31 -4
  196. package/dist/esm/i18n/en_ZZ.js +1 -0
  197. package/dist/esm/i18n/es.js +1 -0
  198. package/dist/esm/i18n/fi.js +1 -0
  199. package/dist/esm/i18n/fr.js +1 -0
  200. package/dist/esm/i18n/hu.js +1 -0
  201. package/dist/esm/i18n/it.js +1 -0
  202. package/dist/esm/i18n/ja.js +1 -0
  203. package/dist/esm/i18n/ko.js +1 -0
  204. package/dist/esm/i18n/nb.js +1 -0
  205. package/dist/esm/i18n/nl.js +1 -0
  206. package/dist/esm/i18n/pl.js +1 -0
  207. package/dist/esm/i18n/pt_BR.js +1 -0
  208. package/dist/esm/i18n/ru.js +1 -0
  209. package/dist/esm/i18n/sv.js +1 -0
  210. package/dist/esm/i18n/th.js +1 -0
  211. package/dist/esm/i18n/tr.js +1 -0
  212. package/dist/esm/i18n/uk.js +1 -0
  213. package/dist/esm/i18n/vi.js +1 -0
  214. package/dist/esm/i18n/zh.js +1 -0
  215. package/dist/esm/i18n/zh_TW.js +1 -0
  216. package/dist/esm/index.js +2 -1
  217. package/dist/esm/util/i18n-util.js +30 -126
  218. package/dist/esm/util/ufoExperiences.js +0 -9
  219. package/dist/esm/version.json +1 -1
  220. package/dist/types/i18n/cs.d.ts +1 -0
  221. package/dist/types/i18n/da.d.ts +1 -0
  222. package/dist/types/i18n/de.d.ts +1 -0
  223. package/dist/types/i18n/en.d.ts +28 -1
  224. package/dist/types/i18n/en_GB.d.ts +28 -1
  225. package/dist/types/i18n/en_ZZ.d.ts +1 -0
  226. package/dist/types/i18n/es.d.ts +1 -0
  227. package/dist/types/i18n/fi.d.ts +1 -0
  228. package/dist/types/i18n/fr.d.ts +1 -0
  229. package/dist/types/i18n/hu.d.ts +1 -0
  230. package/dist/types/i18n/it.d.ts +1 -0
  231. package/dist/types/i18n/ja.d.ts +1 -0
  232. package/dist/types/i18n/ko.d.ts +1 -0
  233. package/dist/types/i18n/nb.d.ts +1 -0
  234. package/dist/types/i18n/nl.d.ts +1 -0
  235. package/dist/types/i18n/pl.d.ts +1 -0
  236. package/dist/types/i18n/pt_BR.d.ts +1 -0
  237. package/dist/types/i18n/ru.d.ts +1 -0
  238. package/dist/types/i18n/sv.d.ts +1 -0
  239. package/dist/types/i18n/th.d.ts +1 -0
  240. package/dist/types/i18n/tr.d.ts +1 -0
  241. package/dist/types/i18n/uk.d.ts +1 -0
  242. package/dist/types/i18n/vi.d.ts +1 -0
  243. package/dist/types/i18n/zh.d.ts +1 -0
  244. package/dist/types/i18n/zh_TW.d.ts +1 -0
  245. package/dist/types/types.d.ts +1 -1
  246. package/package.json +3 -2
  247. package/report.api.md +1 -4
  248. package/tmp/api-report-tmp.d.ts +1 -1
@@ -6,17 +6,11 @@ import _inherits from "@babel/runtime/helpers/inherits";
6
6
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
7
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
8
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
-
10
9
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
11
-
12
10
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
13
-
14
11
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
15
-
16
12
  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); }; }
17
-
18
13
  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; } }
19
-
20
14
  import { withAnalyticsEvents } from '@atlaskit/analytics-next';
21
15
  import { UFOExperienceState } from '@atlaskit/ufo';
22
16
  import debounce from 'lodash/debounce';
@@ -28,27 +22,19 @@ import { batchByKey } from './batch';
28
22
  import { messages } from './i18n';
29
23
  import { callCallback, extractOptionValue, getOptions, isIterable, isPopupUserPickerByComponent, isDefaultValuePopulated, isSingleValue, optionToSelectableOptions } from './utils';
30
24
  import { userPickerOptionsShownUfoExperience } from '../util/ufoExperiences';
31
-
32
25
  var loadingMessage = function loadingMessage() {
33
26
  return null;
34
27
  };
35
-
36
28
  export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component) {
37
29
  _inherits(BaseUserPickerWithoutAnalytics, _React$Component);
38
-
39
30
  var _super = _createSuper(BaseUserPickerWithoutAnalytics);
40
-
41
31
  function BaseUserPickerWithoutAnalytics(props) {
42
32
  var _this;
43
-
44
33
  _classCallCheck(this, BaseUserPickerWithoutAnalytics);
45
-
46
34
  _this = _super.call(this, props);
47
-
48
35
  _defineProperty(_assertThisInitialized(_this), "getSessionId", function () {
49
36
  return _this.session && _this.session.id ? _this.session.id : undefined;
50
37
  });
51
-
52
38
  _defineProperty(_assertThisInitialized(_this), "withSelectRef", function (callback) {
53
39
  return function () {
54
40
  if (_this.selectRef) {
@@ -56,109 +42,84 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
56
42
  }
57
43
  };
58
44
  });
59
-
60
45
  _defineProperty(_assertThisInitialized(_this), "nextOption", _this.withSelectRef(function (select) {
61
46
  return select.focusOption('down');
62
47
  }));
63
-
64
48
  _defineProperty(_assertThisInitialized(_this), "previousOption", _this.withSelectRef(function (select) {
65
49
  return select.focusOption('up');
66
50
  }));
67
-
68
51
  _defineProperty(_assertThisInitialized(_this), "focus", function () {
69
52
  if (_this.selectRef && _this.selectRef.focus) {
70
53
  _this.selectRef.focus();
71
54
  }
72
55
  });
73
-
74
56
  _defineProperty(_assertThisInitialized(_this), "blur", function () {
75
57
  if (_this.selectRef && _this.selectRef.blur) {
76
58
  _this.selectRef.blur();
77
59
  }
78
60
  });
79
-
80
61
  _defineProperty(_assertThisInitialized(_this), "selectOption", _this.withSelectRef(function (select) {
81
62
  var focusedOption = select.state.focusedOption;
82
63
  select.selectOption(focusedOption);
83
64
  }));
84
-
85
65
  _defineProperty(_assertThisInitialized(_this), "handleChange", function (value, _ref) {
86
66
  var action = _ref.action,
87
- removedValue = _ref.removedValue,
88
- option = _ref.option;
89
-
67
+ removedValue = _ref.removedValue,
68
+ option = _ref.option;
90
69
  if (removedValue && removedValue.data.fixed) {
91
70
  return;
92
71
  }
93
-
94
72
  _this.resetInputState();
95
-
96
73
  var _this$props = _this.props,
97
- onChange = _this$props.onChange,
98
- onSelection = _this$props.onSelection,
99
- onClear = _this$props.onClear,
100
- isMulti = _this$props.isMulti;
74
+ onChange = _this$props.onChange,
75
+ onSelection = _this$props.onSelection,
76
+ onClear = _this$props.onClear,
77
+ isMulti = _this$props.isMulti;
101
78
  callCallback(onChange, extractOptionValue(value), action);
102
-
103
79
  switch (action) {
104
80
  case 'select-option':
105
81
  if (value) {
106
82
  callCallback(onSelection, extractOptionValue(value), _this.getSessionId());
107
83
  }
108
-
109
84
  _this.fireEvent(selectEvent, isMulti ? option : value);
110
-
111
85
  _this.session = isMulti ? startSession() : undefined;
112
86
  break;
113
-
114
87
  case 'clear':
115
88
  callCallback(onClear);
116
-
117
89
  _this.fireEvent(clearEvent);
118
-
119
90
  break;
120
-
121
91
  case 'remove-value':
122
92
  case 'pop-value':
123
93
  if (removedValue) {
124
94
  _this.fireEvent(deleteEvent, removedValue.data);
125
95
  }
126
-
127
96
  break;
128
97
  }
129
-
130
98
  _this.fireEvent(searchedEvent);
131
-
132
99
  if (removedValue && _this.state.value && Array.isArray(_this.state.value)) {
133
100
  var remainingValues = _this.state.value.filter(function (val) {
134
101
  return val.data.id !== removedValue.data.id;
135
102
  });
136
-
137
103
  _this.setState({
138
104
  value: remainingValues ? remainingValues : [],
139
105
  menuIsOpen: true
140
106
  });
141
107
  }
142
-
143
108
  if (!_this.props.value) {
144
109
  _this.setState({
145
110
  value: value ? value : []
146
111
  });
147
112
  }
148
113
  });
149
-
150
114
  _defineProperty(_assertThisInitialized(_this), "handleSelectRef", function (ref) {
151
115
  _this.selectRef = ref;
152
116
  });
153
-
154
117
  _defineProperty(_assertThisInitialized(_this), "addOptions", batchByKey(function (request, newOptions) {
155
118
  var resolving = _this.state.resolving;
156
-
157
119
  _this.setState(function (_ref2) {
158
120
  var inflightRequest = _ref2.inflightRequest,
159
- options = _ref2.options,
160
- count = _ref2.count;
161
-
121
+ options = _ref2.options,
122
+ count = _ref2.count;
162
123
  if (inflightRequest.toString() === request) {
163
124
  return {
164
125
  options: (resolving ? options : []).concat(newOptions.reduce(function (nextOptions, item) {
@@ -168,40 +129,30 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
168
129
  resolving: count - newOptions.length !== 0
169
130
  };
170
131
  }
171
-
172
132
  return null;
173
133
  });
174
134
  }));
175
-
176
135
  _defineProperty(_assertThisInitialized(_this), "handleLoadOptionsError", function () {
177
136
  var count = _this.state.count;
178
137
  var newCount = count - 1;
179
-
180
138
  _this.setState({
181
139
  count: newCount,
182
140
  resolving: newCount !== 0
183
141
  });
184
-
185
142
  _this.fireEvent(failedEvent);
186
143
  });
187
-
188
144
  _defineProperty(_assertThisInitialized(_this), "debouncedLoadOptions", debounce(function (search) {
189
145
  var loadOptions = _this.props.loadOptions;
190
-
191
146
  if (loadOptions) {
192
147
  _this.setState(function (_ref3) {
193
148
  var previousRequest = _ref3.inflightRequest;
194
149
  var inflightRequest = previousRequest + 1;
195
150
  var result = _this.session && _this.session.id ? loadOptions(search, _this.session.id) : loadOptions(search);
196
-
197
151
  var addOptions = _this.addOptions.bind(_assertThisInitialized(_this), inflightRequest.toString());
198
-
199
152
  var count = 0;
200
-
201
153
  if (isIterable(result)) {
202
154
  var _iterator = _createForOfIteratorHelper(result),
203
- _step;
204
-
155
+ _step;
205
156
  try {
206
157
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
207
158
  var _value = _step.value;
@@ -217,7 +168,6 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
217
168
  Promise.resolve(result).then(addOptions).catch(_this.handleLoadOptionsError);
218
169
  count++;
219
170
  }
220
-
221
171
  return {
222
172
  inflightRequest: inflightRequest,
223
173
  count: count,
@@ -227,7 +177,6 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
227
177
  });
228
178
  }
229
179
  }, 200));
230
-
231
180
  _defineProperty(_assertThisInitialized(_this), "abortOptionsShownUfoExperience", function () {
232
181
  if (_this.optionsShownUfoExperienceInstance.state.id === UFOExperienceState.STARTED.id) {
233
182
  // There may be an existing UFO timing running from previous key entry or focus,
@@ -235,16 +184,12 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
235
184
  _this.optionsShownUfoExperienceInstance.abort();
236
185
  }
237
186
  });
238
-
239
187
  _defineProperty(_assertThisInitialized(_this), "startOptionsShownUfoExperience", function () {
240
188
  _this.abortOptionsShownUfoExperience();
241
-
242
189
  _this.optionsShownUfoExperienceInstance.start();
243
190
  });
244
-
245
191
  _defineProperty(_assertThisInitialized(_this), "executeLoadOptions", function (search) {
246
192
  var loadOptions = _this.props.loadOptions;
247
-
248
193
  if (loadOptions) {
249
194
  _this.setState({
250
195
  resolving: true
@@ -253,27 +198,20 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
253
198
  });
254
199
  }
255
200
  });
256
-
257
201
  _defineProperty(_assertThisInitialized(_this), "handleFocus", function (event) {
258
202
  var _this$state = _this.state,
259
- value = _this$state.value,
260
- menuIsOpen = _this$state.menuIsOpen;
261
-
203
+ value = _this$state.value,
204
+ menuIsOpen = _this$state.menuIsOpen;
262
205
  if (!menuIsOpen || !_this.session) {
263
206
  _this.startSession();
264
207
  }
265
-
266
208
  _this.startOptionsShownUfoExperience();
267
-
268
209
  callCallback(_this.props.onFocus, _this.getSessionId());
269
-
270
210
  _this.setState({
271
211
  menuIsOpen: true
272
212
  });
273
-
274
213
  if (!_this.props.isMulti && isSingleValue(value)) {
275
214
  var input = event.target;
276
-
277
215
  _this.setState({
278
216
  inputValue: value.label
279
217
  }, function () {
@@ -283,150 +221,117 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
283
221
  });
284
222
  }
285
223
  });
286
-
287
224
  _defineProperty(_assertThisInitialized(_this), "resetInputState", function () {
288
225
  // Prevent filter if query typed, then blurred with no selection
289
226
  _this.setState({
290
227
  inputValue: ''
291
228
  });
292
-
293
229
  callCallback(_this.props.onInputChange, '', _this.getSessionId());
294
230
  });
295
-
296
231
  _defineProperty(_assertThisInitialized(_this), "handleBlur", function () {
297
232
  callCallback(_this.props.onBlur, _this.getSessionId());
298
-
299
233
  if (isPopupUserPickerByComponent(_this.props.SelectComponent)) {
300
234
  return;
301
235
  }
302
-
303
236
  _this.resetInputState();
304
-
305
237
  _this.abortOptionsShownUfoExperience();
306
-
307
238
  _this.setState({
308
239
  menuIsOpen: false,
309
240
  options: []
310
241
  });
311
242
  });
312
-
313
243
  _defineProperty(_assertThisInitialized(_this), "handleClose", function () {
314
244
  _this.resetInputState();
315
-
316
245
  callCallback(_this.props.onClose, _this.getSessionId());
317
-
318
246
  _this.setState({
319
247
  menuIsOpen: false,
320
248
  options: []
321
249
  });
322
250
  });
323
-
324
251
  _defineProperty(_assertThisInitialized(_this), "handleInputChange", function (search, _ref4) {
325
252
  var action = _ref4.action;
326
-
327
253
  if (action === 'input-change' || action === 'set-value') {
328
254
  callCallback(_this.props.onInputChange, search, _this.getSessionId());
329
-
330
255
  _this.setState({
331
256
  inputValue: search
332
257
  });
333
-
334
258
  _this.startOptionsShownUfoExperience();
335
-
336
259
  _this.executeLoadOptions(search);
337
260
  }
338
261
  });
339
-
340
262
  _defineProperty(_assertThisInitialized(_this), "fireEvent", function (eventCreator) {
341
263
  var createAnalyticsEvent = _this.props.createAnalyticsEvent;
342
-
343
264
  if (createAnalyticsEvent) {
344
265
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
345
266
  args[_key - 1] = arguments[_key];
346
267
  }
347
-
348
268
  createAndFireEventInElementsChannel(eventCreator.apply(void 0, [_this.props, _this.state, _this.session, _this.journeyId].concat(args)))(createAnalyticsEvent);
349
269
  }
350
270
  });
351
-
352
271
  _defineProperty(_assertThisInitialized(_this), "startSession", function () {
353
272
  _this.session = startSession();
354
273
  _this.journeyId = _this.getSessionId();
355
-
356
274
  _this.fireEvent(focusEvent);
357
275
  });
358
-
359
276
  _defineProperty(_assertThisInitialized(_this), "handleKeyDown", function (event) {
360
277
  // Escape
361
278
  if (event.keyCode === 27) {
362
279
  _this.blur();
363
- } // Space
364
-
280
+ }
365
281
 
282
+ // Space
366
283
  if (event.keyCode === 32 && !_this.state.inputValue) {
367
284
  event.preventDefault();
368
285
  !_this.props.disableInput && _this.setState({
369
286
  inputValue: ' '
370
287
  });
371
288
  }
372
-
373
289
  if (_this.session) {
374
290
  _this.session.lastKey = event.keyCode;
375
-
376
291
  switch (event.keyCode) {
377
292
  // KeyUp 38
378
293
  case 38:
379
294
  _this.session.upCount++;
380
295
  break;
381
296
  // KeyDown 40
382
-
383
297
  case 40:
384
298
  _this.session.downCount++;
385
299
  break;
386
300
  }
387
301
  }
388
302
  });
389
-
390
303
  _defineProperty(_assertThisInitialized(_this), "handleClearIndicatorHover", function (hoveringClearIndicator) {
391
304
  _this.setState({
392
305
  hoveringClearIndicator: hoveringClearIndicator
393
306
  });
394
307
  });
395
-
396
308
  _defineProperty(_assertThisInitialized(_this), "getOptions", function () {
397
309
  var options = getOptions(_this.state.options) || [];
398
310
  var _this$props2 = _this.props,
399
- maxOptions = _this$props2.maxOptions,
400
- isMulti = _this$props2.isMulti;
401
-
311
+ maxOptions = _this$props2.maxOptions,
312
+ isMulti = _this$props2.isMulti;
402
313
  if (maxOptions === 0) {
403
314
  return [];
404
315
  }
405
-
406
316
  if (maxOptions && maxOptions > 0 && maxOptions < options.length) {
407
317
  var _value2 = _this.state.value;
408
- var filteredOptions = options; // Filter out previously selected options
409
-
318
+ var filteredOptions = options;
319
+ // Filter out previously selected options
410
320
  if (isMulti && Array.isArray(_value2)) {
411
321
  var valueIds = _value2.map(function (item) {
412
322
  return item.data.id;
413
323
  });
414
-
415
324
  filteredOptions = options.filter(function (option) {
416
325
  return valueIds.indexOf(option.data.id) === -1;
417
326
  });
418
327
  }
419
-
420
328
  return filteredOptions.slice(0, maxOptions);
421
329
  }
422
-
423
330
  return options;
424
331
  });
425
-
426
332
  _defineProperty(_assertThisInitialized(_this), "getAppearance", function () {
427
333
  return _this.props.appearance ? _this.props.appearance : 'normal';
428
334
  });
429
-
430
335
  _this.state = {
431
336
  options: [],
432
337
  isDefaultSet: false,
@@ -440,19 +345,17 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
440
345
  _this.optionsShownUfoExperienceInstance = userPickerOptionsShownUfoExperience.getInstance(uuidv4());
441
346
  return _this;
442
347
  }
443
-
444
348
  _createClass(BaseUserPickerWithoutAnalytics, [{
445
349
  key: "componentDidMount",
446
350
  value: function componentDidMount() {
447
351
  var _this$props3 = this.props,
448
- open = _this$props3.open,
449
- search = _this$props3.search; // load options when the picker open
450
-
352
+ open = _this$props3.open,
353
+ search = _this$props3.search;
354
+ // load options when the picker open
451
355
  if (open) {
452
356
  if (!this.session) {
453
357
  this.startSession();
454
358
  }
455
-
456
359
  this.executeLoadOptions(search);
457
360
  }
458
361
  }
@@ -460,35 +363,30 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
460
363
  key: "componentDidUpdate",
461
364
  value: function componentDidUpdate(_, prevState) {
462
365
  var _this$state2 = this.state,
463
- menuIsOpen = _this$state2.menuIsOpen,
464
- options = _this$state2.options,
465
- resolving = _this$state2.resolving,
466
- count = _this$state2.count; // load options when the picker open
467
-
366
+ menuIsOpen = _this$state2.menuIsOpen,
367
+ options = _this$state2.options,
368
+ resolving = _this$state2.resolving,
369
+ count = _this$state2.count;
370
+ // load options when the picker open
468
371
  if (menuIsOpen && !prevState.menuIsOpen) {
469
372
  if (!this.session) {
470
373
  // session should have been created onFocus
471
374
  this.startSession();
472
375
  }
473
-
474
376
  this.executeLoadOptions();
475
377
  }
476
-
477
378
  if (!menuIsOpen && prevState.menuIsOpen && this.session) {
478
379
  this.fireEvent(cancelEvent, prevState);
479
380
  this.session = undefined;
480
381
  }
481
-
482
382
  if (menuIsOpen && (!prevState.menuIsOpen && options.length > 0 || options.length !== prevState.options.length)) {
483
383
  this.fireEvent(searchedEvent);
484
384
  }
485
-
486
385
  if (this.state.inputValue !== prevState.inputValue) {
487
386
  if (this.session) {
488
387
  this.session.inputChangeTime = Date.now();
489
388
  }
490
389
  }
491
-
492
390
  if (menuIsOpen && (!_.loadOptions || prevState.menuIsOpen) && count === 0 && !resolving && [UFOExperienceState.STARTED.id, UFOExperienceState.IN_PROGRESS.id].includes(this.optionsShownUfoExperienceInstance.state.id)) {
493
391
  this.optionsShownUfoExperienceInstance.success();
494
392
  }
@@ -497,37 +395,37 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
497
395
  key: "render",
498
396
  value: function render() {
499
397
  var _this$props4 = this.props,
500
- isMulti = _this$props4.isMulti,
501
- isLoading = _this$props4.isLoading,
502
- subtle = _this$props4.subtle,
503
- noBorder = _this$props4.noBorder,
504
- placeholder = _this$props4.placeholder,
505
- isClearable = _this$props4.isClearable,
506
- isDisabled = _this$props4.isDisabled,
507
- clearValueLabel = _this$props4.clearValueLabel,
508
- menuMinWidth = _this$props4.menuMinWidth,
509
- menuPortalTarget = _this$props4.menuPortalTarget,
510
- addMoreMessage = _this$props4.addMoreMessage,
511
- noOptionsMessage = _this$props4.noOptionsMessage,
512
- disableInput = _this$props4.disableInput,
513
- components = _this$props4.components,
514
- pickerProps = _this$props4.pickerProps,
515
- SelectComponent = _this$props4.SelectComponent,
516
- styles = _this$props4.styles,
517
- autoFocus = _this$props4.autoFocus,
518
- fieldId = _this$props4.fieldId,
519
- inputId = _this$props4.inputId,
520
- maxPickerHeight = _this$props4.maxPickerHeight,
521
- textFieldBackgroundColor = _this$props4.textFieldBackgroundColor,
522
- ariaLabelledBy = _this$props4.ariaLabelledBy,
523
- ariaLive = _this$props4.ariaLive;
398
+ isMulti = _this$props4.isMulti,
399
+ isLoading = _this$props4.isLoading,
400
+ subtle = _this$props4.subtle,
401
+ noBorder = _this$props4.noBorder,
402
+ placeholder = _this$props4.placeholder,
403
+ isClearable = _this$props4.isClearable,
404
+ isDisabled = _this$props4.isDisabled,
405
+ clearValueLabel = _this$props4.clearValueLabel,
406
+ menuMinWidth = _this$props4.menuMinWidth,
407
+ menuPortalTarget = _this$props4.menuPortalTarget,
408
+ addMoreMessage = _this$props4.addMoreMessage,
409
+ noOptionsMessage = _this$props4.noOptionsMessage,
410
+ disableInput = _this$props4.disableInput,
411
+ components = _this$props4.components,
412
+ pickerProps = _this$props4.pickerProps,
413
+ SelectComponent = _this$props4.SelectComponent,
414
+ styles = _this$props4.styles,
415
+ autoFocus = _this$props4.autoFocus,
416
+ fieldId = _this$props4.fieldId,
417
+ inputId = _this$props4.inputId,
418
+ maxPickerHeight = _this$props4.maxPickerHeight,
419
+ textFieldBackgroundColor = _this$props4.textFieldBackgroundColor,
420
+ ariaLabelledBy = _this$props4.ariaLabelledBy,
421
+ ariaLive = _this$props4.ariaLive;
524
422
  var _this$state3 = this.state,
525
- count = _this$state3.count,
526
- hoveringClearIndicator = _this$state3.hoveringClearIndicator,
527
- menuIsOpen = _this$state3.menuIsOpen,
528
- value = _this$state3.value,
529
- inputValue = _this$state3.inputValue,
530
- resolving = _this$state3.resolving;
423
+ count = _this$state3.count,
424
+ hoveringClearIndicator = _this$state3.hoveringClearIndicator,
425
+ menuIsOpen = _this$state3.menuIsOpen,
426
+ value = _this$state3.value,
427
+ inputValue = _this$state3.inputValue,
428
+ resolving = _this$state3.resolving;
531
429
  var appearance = this.getAppearance();
532
430
  return /*#__PURE__*/React.createElement(SelectComponent, _extends({
533
431
  value: value,
@@ -571,7 +469,7 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
571
469
  onChange: this.handleChange,
572
470
  onFocus: this.handleFocus,
573
471
  onBlur: this.handleBlur,
574
- onClose: this.handleClose,
472
+ onMenuClose: this.handleClose,
575
473
  onInputChange: this.handleInputChange,
576
474
  onClearIndicatorHover: this.handleClearIndicatorHover,
577
475
  onKeyDown: this.handleKeyDown,
@@ -583,37 +481,29 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
583
481
  key: "getDerivedStateFromProps",
584
482
  value: function getDerivedStateFromProps(nextProps, prevState) {
585
483
  var derivedState = {};
586
-
587
484
  if (nextProps.isDisabled || nextProps.disableInput) {
588
485
  derivedState.menuIsOpen = false;
589
486
  }
590
-
591
487
  if (nextProps.open !== undefined) {
592
488
  derivedState.menuIsOpen = nextProps.open;
593
489
  }
594
-
595
490
  if (nextProps.value !== undefined) {
596
491
  derivedState.value = optionToSelectableOptions(nextProps.value);
597
492
  } else if (isDefaultValuePopulated(nextProps.defaultValue) && !prevState.isDefaultSet) {
598
493
  derivedState.value = optionToSelectableOptions(nextProps.defaultValue);
599
494
  derivedState.isDefaultSet = true;
600
495
  }
601
-
602
496
  if (nextProps.search !== undefined && nextProps.search !== prevState.inputValue) {
603
497
  derivedState.inputValue = nextProps.search;
604
498
  }
605
-
606
499
  if (nextProps.options !== undefined) {
607
500
  derivedState.options = nextProps.options;
608
501
  }
609
-
610
502
  return derivedState;
611
503
  }
612
504
  }]);
613
-
614
505
  return BaseUserPickerWithoutAnalytics;
615
506
  }(React.Component);
616
-
617
507
  _defineProperty(BaseUserPickerWithoutAnalytics, "defaultProps", {
618
508
  isMulti: false,
619
509
  subtle: false,
@@ -621,5 +511,4 @@ _defineProperty(BaseUserPickerWithoutAnalytics, "defaultProps", {
621
511
  textFieldBackgroundColor: false,
622
512
  isClearable: true
623
513
  });
624
-
625
514
  export var BaseUserPicker = withAnalyticsEvents()(BaseUserPickerWithoutAnalytics);
@@ -6,21 +6,14 @@ import _inherits from "@babel/runtime/helpers/inherits";
6
6
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
7
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
8
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
-
10
9
  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; }
11
-
12
10
  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; }
13
-
14
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); }; }
15
-
16
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; } }
17
-
18
13
  import React from 'react';
19
14
  import { components } from '@atlaskit/select';
20
15
  var AsyncTooltip = /*#__PURE__*/React.lazy(function () {
21
- return import(
22
- /* webpackChunkName: "@atlaskit-internal_@atlaskit/tooltip" */
23
- '@atlaskit/tooltip').then(function (module) {
16
+ return import( /* webpackChunkName: "@atlaskit-internal_@atlaskit/tooltip" */'@atlaskit/tooltip').then(function (module) {
24
17
  return {
25
18
  default: module.default
26
19
  };
@@ -28,39 +21,29 @@ var AsyncTooltip = /*#__PURE__*/React.lazy(function () {
28
21
  });
29
22
  export var ClearIndicator = /*#__PURE__*/function (_React$PureComponent) {
30
23
  _inherits(ClearIndicator, _React$PureComponent);
31
-
32
24
  var _super = _createSuper(ClearIndicator);
33
-
34
25
  function ClearIndicator() {
35
26
  var _this;
36
-
37
27
  _classCallCheck(this, ClearIndicator);
38
-
39
28
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
40
29
  args[_key] = arguments[_key];
41
30
  }
42
-
43
31
  _this = _super.call.apply(_super, [this].concat(args));
44
-
45
32
  _defineProperty(_assertThisInitialized(_this), "handleMouseDown", function (event) {
46
33
  if (event && event.type === 'mousedown' && event.button !== 0) {
47
34
  return;
48
- } // Prevent focus when clear on blurred state
49
-
50
-
35
+ }
36
+ // Prevent focus when clear on blurred state
51
37
  var _this$props = _this.props,
52
- clearValue = _this$props.clearValue,
53
- selectProps = _this$props.selectProps;
38
+ clearValue = _this$props.clearValue,
39
+ selectProps = _this$props.selectProps;
54
40
  clearValue();
55
-
56
41
  if (selectProps && !selectProps.isFocused) {
57
42
  event.stopPropagation();
58
43
  }
59
44
  });
60
-
61
45
  return _this;
62
46
  }
63
-
64
47
  _createClass(ClearIndicator, [{
65
48
  key: "render",
66
49
  value: function render() {
@@ -77,6 +60,5 @@ export var ClearIndicator = /*#__PURE__*/function (_React$PureComponent) {
77
60
  }, Indicator)) : Indicator;
78
61
  }
79
62
  }]);
80
-
81
63
  return ClearIndicator;
82
64
  }(React.PureComponent);