@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
@@ -11,71 +11,54 @@ import { batchByKey } from './batch';
11
11
  import { messages } from './i18n';
12
12
  import { callCallback, extractOptionValue, getOptions, isIterable, isPopupUserPickerByComponent, isDefaultValuePopulated, isSingleValue, optionToSelectableOptions } from './utils';
13
13
  import { userPickerOptionsShownUfoExperience } from '../util/ufoExperiences';
14
-
15
14
  const loadingMessage = () => null;
16
-
17
15
  export class BaseUserPickerWithoutAnalytics extends React.Component {
18
16
  static getDerivedStateFromProps(nextProps, prevState) {
19
17
  const derivedState = {};
20
-
21
18
  if (nextProps.isDisabled || nextProps.disableInput) {
22
19
  derivedState.menuIsOpen = false;
23
20
  }
24
-
25
21
  if (nextProps.open !== undefined) {
26
22
  derivedState.menuIsOpen = nextProps.open;
27
23
  }
28
-
29
24
  if (nextProps.value !== undefined) {
30
25
  derivedState.value = optionToSelectableOptions(nextProps.value);
31
26
  } else if (isDefaultValuePopulated(nextProps.defaultValue) && !prevState.isDefaultSet) {
32
27
  derivedState.value = optionToSelectableOptions(nextProps.defaultValue);
33
28
  derivedState.isDefaultSet = true;
34
29
  }
35
-
36
30
  if (nextProps.search !== undefined && nextProps.search !== prevState.inputValue) {
37
31
  derivedState.inputValue = nextProps.search;
38
32
  }
39
-
40
33
  if (nextProps.options !== undefined) {
41
34
  derivedState.options = nextProps.options;
42
35
  }
43
-
44
36
  return derivedState;
45
37
  }
46
-
47
38
  constructor(props) {
48
39
  super(props);
49
-
50
40
  _defineProperty(this, "getSessionId", () => this.session && this.session.id ? this.session.id : undefined);
51
-
52
41
  _defineProperty(this, "withSelectRef", callback => () => {
53
42
  if (this.selectRef) {
54
43
  callback(this.selectRef);
55
44
  }
56
45
  });
57
-
58
46
  _defineProperty(this, "nextOption", this.withSelectRef(select => select.focusOption('down')));
59
-
60
47
  _defineProperty(this, "previousOption", this.withSelectRef(select => select.focusOption('up')));
61
-
62
48
  _defineProperty(this, "focus", () => {
63
49
  if (this.selectRef && this.selectRef.focus) {
64
50
  this.selectRef.focus();
65
51
  }
66
52
  });
67
-
68
53
  _defineProperty(this, "blur", () => {
69
54
  if (this.selectRef && this.selectRef.blur) {
70
55
  this.selectRef.blur();
71
56
  }
72
57
  });
73
-
74
58
  _defineProperty(this, "selectOption", this.withSelectRef(select => {
75
59
  const focusedOption = select.state.focusedOption;
76
60
  select.selectOption(focusedOption);
77
61
  }));
78
-
79
62
  _defineProperty(this, "handleChange", (value, {
80
63
  action,
81
64
  removedValue,
@@ -84,7 +67,6 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
84
67
  if (removedValue && removedValue.data.fixed) {
85
68
  return;
86
69
  }
87
-
88
70
  this.resetInputState();
89
71
  const {
90
72
  onChange,
@@ -93,33 +75,26 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
93
75
  isMulti
94
76
  } = this.props;
95
77
  callCallback(onChange, extractOptionValue(value), action);
96
-
97
78
  switch (action) {
98
79
  case 'select-option':
99
80
  if (value) {
100
81
  callCallback(onSelection, extractOptionValue(value), this.getSessionId());
101
82
  }
102
-
103
83
  this.fireEvent(selectEvent, isMulti ? option : value);
104
84
  this.session = isMulti ? startSession() : undefined;
105
85
  break;
106
-
107
86
  case 'clear':
108
87
  callCallback(onClear);
109
88
  this.fireEvent(clearEvent);
110
89
  break;
111
-
112
90
  case 'remove-value':
113
91
  case 'pop-value':
114
92
  if (removedValue) {
115
93
  this.fireEvent(deleteEvent, removedValue.data);
116
94
  }
117
-
118
95
  break;
119
96
  }
120
-
121
97
  this.fireEvent(searchedEvent);
122
-
123
98
  if (removedValue && this.state.value && Array.isArray(this.state.value)) {
124
99
  const remainingValues = this.state.value.filter(val => val.data.id !== removedValue.data.id);
125
100
  this.setState({
@@ -127,18 +102,15 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
127
102
  menuIsOpen: true
128
103
  });
129
104
  }
130
-
131
105
  if (!this.props.value) {
132
106
  this.setState({
133
107
  value: value ? value : []
134
108
  });
135
109
  }
136
110
  });
137
-
138
111
  _defineProperty(this, "handleSelectRef", ref => {
139
112
  this.selectRef = ref;
140
113
  });
141
-
142
114
  _defineProperty(this, "addOptions", batchByKey((request, newOptions) => {
143
115
  const {
144
116
  resolving
@@ -155,11 +127,9 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
155
127
  resolving: count - newOptions.length !== 0
156
128
  };
157
129
  }
158
-
159
130
  return null;
160
131
  });
161
132
  }));
162
-
163
133
  _defineProperty(this, "handleLoadOptionsError", () => {
164
134
  const {
165
135
  count
@@ -171,12 +141,10 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
171
141
  });
172
142
  this.fireEvent(failedEvent);
173
143
  });
174
-
175
144
  _defineProperty(this, "debouncedLoadOptions", debounce(search => {
176
145
  const {
177
146
  loadOptions
178
147
  } = this.props;
179
-
180
148
  if (loadOptions) {
181
149
  this.setState(({
182
150
  inflightRequest: previousRequest
@@ -185,7 +153,6 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
185
153
  const result = this.session && this.session.id ? loadOptions(search, this.session.id) : loadOptions(search);
186
154
  const addOptions = this.addOptions.bind(this, inflightRequest.toString());
187
155
  let count = 0;
188
-
189
156
  if (isIterable(result)) {
190
157
  for (const value of result) {
191
158
  Promise.resolve(value).then(addOptions).catch(this.handleLoadOptionsError);
@@ -195,7 +162,6 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
195
162
  Promise.resolve(result).then(addOptions).catch(this.handleLoadOptionsError);
196
163
  count++;
197
164
  }
198
-
199
165
  return {
200
166
  inflightRequest,
201
167
  count,
@@ -205,7 +171,6 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
205
171
  });
206
172
  }
207
173
  }, 200));
208
-
209
174
  _defineProperty(this, "abortOptionsShownUfoExperience", () => {
210
175
  if (this.optionsShownUfoExperienceInstance.state.id === UFOExperienceState.STARTED.id) {
211
176
  // There may be an existing UFO timing running from previous key entry or focus,
@@ -213,40 +178,33 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
213
178
  this.optionsShownUfoExperienceInstance.abort();
214
179
  }
215
180
  });
216
-
217
181
  _defineProperty(this, "startOptionsShownUfoExperience", () => {
218
182
  this.abortOptionsShownUfoExperience();
219
183
  this.optionsShownUfoExperienceInstance.start();
220
184
  });
221
-
222
185
  _defineProperty(this, "executeLoadOptions", search => {
223
186
  const {
224
187
  loadOptions
225
188
  } = this.props;
226
-
227
189
  if (loadOptions) {
228
190
  this.setState({
229
191
  resolving: true
230
192
  }, () => this.debouncedLoadOptions(search));
231
193
  }
232
194
  });
233
-
234
195
  _defineProperty(this, "handleFocus", event => {
235
196
  const {
236
197
  value,
237
198
  menuIsOpen
238
199
  } = this.state;
239
-
240
200
  if (!menuIsOpen || !this.session) {
241
201
  this.startSession();
242
202
  }
243
-
244
203
  this.startOptionsShownUfoExperience();
245
204
  callCallback(this.props.onFocus, this.getSessionId());
246
205
  this.setState({
247
206
  menuIsOpen: true
248
207
  });
249
-
250
208
  if (!this.props.isMulti && isSingleValue(value)) {
251
209
  const input = event.target;
252
210
  this.setState({
@@ -258,7 +216,6 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
258
216
  });
259
217
  }
260
218
  });
261
-
262
219
  _defineProperty(this, "resetInputState", () => {
263
220
  // Prevent filter if query typed, then blurred with no selection
264
221
  this.setState({
@@ -266,14 +223,11 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
266
223
  });
267
224
  callCallback(this.props.onInputChange, '', this.getSessionId());
268
225
  });
269
-
270
226
  _defineProperty(this, "handleBlur", () => {
271
227
  callCallback(this.props.onBlur, this.getSessionId());
272
-
273
228
  if (isPopupUserPickerByComponent(this.props.SelectComponent)) {
274
229
  return;
275
230
  }
276
-
277
231
  this.resetInputState();
278
232
  this.abortOptionsShownUfoExperience();
279
233
  this.setState({
@@ -281,7 +235,6 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
281
235
  options: []
282
236
  });
283
237
  });
284
-
285
238
  _defineProperty(this, "handleClose", () => {
286
239
  this.resetInputState();
287
240
  callCallback(this.props.onClose, this.getSessionId());
@@ -290,7 +243,6 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
290
243
  options: []
291
244
  });
292
245
  });
293
-
294
246
  _defineProperty(this, "handleInputChange", (search, {
295
247
  action
296
248
  }) => {
@@ -303,90 +255,75 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
303
255
  this.executeLoadOptions(search);
304
256
  }
305
257
  });
306
-
307
258
  _defineProperty(this, "fireEvent", (eventCreator, ...args) => {
308
259
  const {
309
260
  createAnalyticsEvent
310
261
  } = this.props;
311
-
312
262
  if (createAnalyticsEvent) {
313
263
  createAndFireEventInElementsChannel(eventCreator(this.props, this.state, this.session, this.journeyId, ...args))(createAnalyticsEvent);
314
264
  }
315
265
  });
316
-
317
266
  _defineProperty(this, "startSession", () => {
318
267
  this.session = startSession();
319
268
  this.journeyId = this.getSessionId();
320
269
  this.fireEvent(focusEvent);
321
270
  });
322
-
323
271
  _defineProperty(this, "handleKeyDown", event => {
324
272
  // Escape
325
273
  if (event.keyCode === 27) {
326
274
  this.blur();
327
- } // Space
328
-
275
+ }
329
276
 
277
+ // Space
330
278
  if (event.keyCode === 32 && !this.state.inputValue) {
331
279
  event.preventDefault();
332
280
  !this.props.disableInput && this.setState({
333
281
  inputValue: ' '
334
282
  });
335
283
  }
336
-
337
284
  if (this.session) {
338
285
  this.session.lastKey = event.keyCode;
339
-
340
286
  switch (event.keyCode) {
341
287
  // KeyUp 38
342
288
  case 38:
343
289
  this.session.upCount++;
344
290
  break;
345
291
  // KeyDown 40
346
-
347
292
  case 40:
348
293
  this.session.downCount++;
349
294
  break;
350
295
  }
351
296
  }
352
297
  });
353
-
354
298
  _defineProperty(this, "handleClearIndicatorHover", hoveringClearIndicator => {
355
299
  this.setState({
356
300
  hoveringClearIndicator
357
301
  });
358
302
  });
359
-
360
303
  _defineProperty(this, "getOptions", () => {
361
304
  const options = getOptions(this.state.options) || [];
362
305
  const {
363
306
  maxOptions,
364
307
  isMulti
365
308
  } = this.props;
366
-
367
309
  if (maxOptions === 0) {
368
310
  return [];
369
311
  }
370
-
371
312
  if (maxOptions && maxOptions > 0 && maxOptions < options.length) {
372
313
  const {
373
314
  value
374
315
  } = this.state;
375
- let filteredOptions = options; // Filter out previously selected options
376
-
316
+ let filteredOptions = options;
317
+ // Filter out previously selected options
377
318
  if (isMulti && Array.isArray(value)) {
378
319
  const valueIds = value.map(item => item.data.id);
379
320
  filteredOptions = options.filter(option => valueIds.indexOf(option.data.id) === -1);
380
321
  }
381
-
382
322
  return filteredOptions.slice(0, maxOptions);
383
323
  }
384
-
385
324
  return options;
386
325
  });
387
-
388
326
  _defineProperty(this, "getAppearance", () => this.props.appearance ? this.props.appearance : 'normal');
389
-
390
327
  this.state = {
391
328
  options: [],
392
329
  isDefaultSet: false,
@@ -399,59 +336,50 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
399
336
  };
400
337
  this.optionsShownUfoExperienceInstance = userPickerOptionsShownUfoExperience.getInstance(uuidv4());
401
338
  }
402
-
403
339
  componentDidMount() {
404
340
  const {
405
341
  open,
406
342
  search
407
- } = this.props; // load options when the picker open
408
-
343
+ } = this.props;
344
+ // load options when the picker open
409
345
  if (open) {
410
346
  if (!this.session) {
411
347
  this.startSession();
412
348
  }
413
-
414
349
  this.executeLoadOptions(search);
415
350
  }
416
351
  }
417
-
418
352
  componentDidUpdate(_, prevState) {
419
353
  const {
420
354
  menuIsOpen,
421
355
  options,
422
356
  resolving,
423
357
  count
424
- } = this.state; // load options when the picker open
425
-
358
+ } = this.state;
359
+ // load options when the picker open
426
360
  if (menuIsOpen && !prevState.menuIsOpen) {
427
361
  if (!this.session) {
428
362
  // session should have been created onFocus
429
363
  this.startSession();
430
364
  }
431
-
432
365
  this.executeLoadOptions();
433
366
  }
434
-
435
367
  if (!menuIsOpen && prevState.menuIsOpen && this.session) {
436
368
  this.fireEvent(cancelEvent, prevState);
437
369
  this.session = undefined;
438
370
  }
439
-
440
371
  if (menuIsOpen && (!prevState.menuIsOpen && options.length > 0 || options.length !== prevState.options.length)) {
441
372
  this.fireEvent(searchedEvent);
442
373
  }
443
-
444
374
  if (this.state.inputValue !== prevState.inputValue) {
445
375
  if (this.session) {
446
376
  this.session.inputChangeTime = Date.now();
447
377
  }
448
378
  }
449
-
450
379
  if (menuIsOpen && (!_.loadOptions || prevState.menuIsOpen) && count === 0 && !resolving && [UFOExperienceState.STARTED.id, UFOExperienceState.IN_PROGRESS.id].includes(this.optionsShownUfoExperienceInstance.state.id)) {
451
380
  this.optionsShownUfoExperienceInstance.success();
452
381
  }
453
382
  }
454
-
455
383
  render() {
456
384
  const {
457
385
  isMulti,
@@ -530,7 +458,7 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
530
458
  onChange: this.handleChange,
531
459
  onFocus: this.handleFocus,
532
460
  onBlur: this.handleBlur,
533
- onClose: this.handleClose,
461
+ onMenuClose: this.handleClose,
534
462
  onInputChange: this.handleInputChange,
535
463
  onClearIndicatorHover: this.handleClearIndicatorHover,
536
464
  onKeyDown: this.handleKeyDown,
@@ -538,9 +466,7 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
538
466
  textFieldBackgroundColor: textFieldBackgroundColor
539
467
  }, pickerProps));
540
468
  }
541
-
542
469
  }
543
-
544
470
  _defineProperty(BaseUserPickerWithoutAnalytics, "defaultProps", {
545
471
  isMulti: false,
546
472
  subtle: false,
@@ -548,5 +474,4 @@ _defineProperty(BaseUserPickerWithoutAnalytics, "defaultProps", {
548
474
  textFieldBackgroundColor: false,
549
475
  isClearable: true
550
476
  });
551
-
552
477
  export const BaseUserPicker = withAnalyticsEvents()(BaseUserPickerWithoutAnalytics);
@@ -2,9 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import React from 'react';
4
4
  import { components } from '@atlaskit/select';
5
- const AsyncTooltip = /*#__PURE__*/React.lazy(() => import(
6
- /* webpackChunkName: "@atlaskit-internal_@atlaskit/tooltip" */
7
- '@atlaskit/tooltip').then(module => {
5
+ const AsyncTooltip = /*#__PURE__*/React.lazy(() => import( /* webpackChunkName: "@atlaskit-internal_@atlaskit/tooltip" */'@atlaskit/tooltip').then(module => {
8
6
  return {
9
7
  default: module.default
10
8
  };
@@ -12,25 +10,21 @@ const AsyncTooltip = /*#__PURE__*/React.lazy(() => import(
12
10
  export class ClearIndicator extends React.PureComponent {
13
11
  constructor(...args) {
14
12
  super(...args);
15
-
16
13
  _defineProperty(this, "handleMouseDown", event => {
17
14
  if (event && event.type === 'mousedown' && event.button !== 0) {
18
15
  return;
19
- } // Prevent focus when clear on blurred state
20
-
21
-
16
+ }
17
+ // Prevent focus when clear on blurred state
22
18
  const {
23
19
  clearValue,
24
20
  selectProps
25
21
  } = this.props;
26
22
  clearValue();
27
-
28
23
  if (selectProps && !selectProps.isFocused) {
29
24
  event.stopPropagation();
30
25
  }
31
26
  });
32
27
  }
33
-
34
28
  render() {
35
29
  const {
36
30
  selectProps: {
@@ -38,7 +32,8 @@ export class ClearIndicator extends React.PureComponent {
38
32
  }
39
33
  } = this.props;
40
34
  const Indicator = /*#__PURE__*/React.createElement(components.ClearIndicator, _extends({}, this.props, {
41
- innerProps: { ...this.props.innerProps,
35
+ innerProps: {
36
+ ...this.props.innerProps,
42
37
  onMouseDown: this.handleMouseDown
43
38
  }
44
39
  }));
@@ -48,5 +43,4 @@ export class ClearIndicator extends React.PureComponent {
48
43
  content: clearValueLabel
49
44
  }, Indicator)) : Indicator;
50
45
  }
51
-
52
46
  }
@@ -1,7 +1,5 @@
1
1
  import React from 'react';
2
- const AsyncCustomOption = /*#__PURE__*/React.lazy(() => import(
3
- /* webpackChunkName: "@atlaskit-internal_@atlassian/user-picker/custom-option" */
4
- './main').then(module => {
2
+ const AsyncCustomOption = /*#__PURE__*/React.lazy(() => import( /* webpackChunkName: "@atlaskit-internal_@atlassian/user-picker/custom-option" */'./main').then(module => {
5
3
  return {
6
4
  default: module.CustomOption
7
5
  };
@@ -1,5 +1,4 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
-
3
2
  /** @jsx jsx */
4
3
  import { B400, N800, N200 } from '@atlaskit/theme/colors';
5
4
  import { jsx } from '@emotion/react';
@@ -10,7 +9,6 @@ import { SizeableAvatar } from '../SizeableAvatar';
10
9
  export class CustomOption extends React.PureComponent {
11
10
  constructor(...args) {
12
11
  super(...args);
13
-
14
12
  _defineProperty(this, "getPrimaryText", () => {
15
13
  const {
16
14
  data: {
@@ -25,21 +23,16 @@ export class CustomOption extends React.PureComponent {
25
23
  highlights: highlight && highlight.name
26
24
  }, name))];
27
25
  });
28
-
29
26
  _defineProperty(this, "getBylineComponent", (isSelected, message) => jsx("span", {
30
27
  css: textWrapper(isSelected ? `var(--ds-text-selected, ${B400})` : `var(--ds-text-subtlest, ${N200})`)
31
28
  }, message));
32
-
33
29
  _defineProperty(this, "renderByline", () => {
34
30
  var _this$props$data;
35
-
36
31
  if (!((_this$props$data = this.props.data) !== null && _this$props$data !== void 0 && _this$props$data.byline)) {
37
32
  return undefined;
38
33
  }
39
-
40
34
  return this.getBylineComponent(this.props.isSelected, this.props.data.byline);
41
35
  });
42
-
43
36
  _defineProperty(this, "renderAvatar", () => {
44
37
  const {
45
38
  data: {
@@ -53,12 +46,10 @@ export class CustomOption extends React.PureComponent {
53
46
  name: name
54
47
  });
55
48
  });
56
-
57
49
  _defineProperty(this, "getLozengeProps", () => typeof this.props.data.lozenge === 'string' ? {
58
50
  text: this.props.data.lozenge
59
51
  } : this.props.data.lozenge);
60
52
  }
61
-
62
53
  render() {
63
54
  return jsx(AvatarItemOption, {
64
55
  avatar: this.renderAvatar(),
@@ -68,5 +59,4 @@ export class CustomOption extends React.PureComponent {
68
59
  secondaryText: this.renderByline()
69
60
  });
70
61
  }
71
-
72
62
  }
@@ -1,7 +1,5 @@
1
1
  import React from 'react';
2
- const AsyncEmailOption = /*#__PURE__*/React.lazy(() => import(
3
- /* webpackChunkName: "@atlaskit-internal_@atlassian/user-picker/email-option" */
4
- './main').then(module => {
2
+ const AsyncEmailOption = /*#__PURE__*/React.lazy(() => import( /* webpackChunkName: "@atlaskit-internal_@atlassian/user-picker/email-option" */'./main').then(module => {
5
3
  return {
6
4
  default: module.EmailOption
7
5
  };
@@ -1,5 +1,4 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
-
3
2
  /** @jsx jsx */
4
3
  import React from 'react';
5
4
  import { FormattedMessage } from 'react-intl-next';
@@ -8,17 +7,13 @@ import { jsx } from '@emotion/react';
8
7
  import { AddOptionAvatar } from '../AddOptionAvatar';
9
8
  import { AvatarItemOption, textWrapper } from '../AvatarItemOption';
10
9
  import { messages } from '../i18n';
11
-
12
10
  const getAddEmailMessage = validity => validity === 'POTENTIAL' ? messages.continueToAddEmail : messages.selectToAddEmail;
13
-
14
11
  export class EmailOption extends React.PureComponent {
15
12
  constructor(...args) {
16
13
  super(...args);
17
-
18
14
  _defineProperty(this, "getLozengeProps", () => typeof this.props.email.lozenge === 'string' ? {
19
15
  text: this.props.email.lozenge
20
16
  } : this.props.email.lozenge);
21
-
22
17
  _defineProperty(this, "renderPrimaryText", () => {
23
18
  const {
24
19
  email: {
@@ -30,13 +25,11 @@ export class EmailOption extends React.PureComponent {
30
25
  css: textWrapper(this.props.isSelected ? `var(--ds-text-selected, ${B400})` : `var(--ds-text, ${N800})`)
31
26
  }, id);
32
27
  });
33
-
34
28
  _defineProperty(this, "renderSecondaryText", label => {
35
29
  return jsx("span", {
36
30
  css: textWrapper(this.props.isSelected ? `var(--ds-text-selected, ${B400})` : `var(--ds-text-subtlest, ${N200})`)
37
31
  }, label);
38
32
  });
39
-
40
33
  _defineProperty(this, "renderOption", label => jsx(AvatarItemOption, {
41
34
  avatar: jsx(AddOptionAvatar, {
42
35
  label: label
@@ -47,7 +40,6 @@ export class EmailOption extends React.PureComponent {
47
40
  secondaryText: this.renderSecondaryText(label)
48
41
  }));
49
42
  }
50
-
51
43
  render() {
52
44
  const {
53
45
  label,
@@ -55,5 +47,4 @@ export class EmailOption extends React.PureComponent {
55
47
  } = this.props;
56
48
  return label !== undefined ? this.renderOption(label) : jsx(FormattedMessage, getAddEmailMessage(emailValidity), label => this.renderOption(label));
57
49
  }
58
-
59
50
  }
@@ -1,7 +1,7 @@
1
1
  /** @jsx jsx */
2
+
2
3
  import { css, jsx } from '@emotion/react';
3
4
  import { B400 } from '@atlaskit/theme/colors';
4
-
5
5
  const outerWrapper = isDisabled => css({
6
6
  alignItems: 'center',
7
7
  boxSizing: 'border-box',
@@ -13,7 +13,6 @@ const outerWrapper = isDisabled => css({
13
13
  cursor: isDisabled ? 'not-allowed' : 'pointer',
14
14
  opacity: isDisabled ? "var(--ds-opacity-disabled, 0.4)" : undefined
15
15
  });
16
-
17
16
  const detailsWrapper = css({
18
17
  display: 'flex',
19
18
  maxWidth: '100%',
@@ -27,7 +26,6 @@ const textSection = css({
27
26
  width: 'calc(100% - 32px)',
28
27
  flex: 'auto'
29
28
  });
30
-
31
29
  const getTextStyle = isSecondary => {
32
30
  const secondaryCssArgs = isSecondary ? {
33
31
  color: `var(--ds-text-selected, ${B400})`,
@@ -47,7 +45,6 @@ const getTextStyle = isSecondary => {
47
45
  }
48
46
  });
49
47
  };
50
-
51
48
  export const ExternalAvatarItemOption = ({
52
49
  avatar,
53
50
  isDisabled,
@@ -1,7 +1,5 @@
1
1
  import React from 'react';
2
- const AsyncExternalUserOption = /*#__PURE__*/React.lazy(() => import(
3
- /* webpackChunkName: "@atlaskit-internal_@atlassian/user-picker/external-user-option" */
4
- './main').then(module => {
2
+ const AsyncExternalUserOption = /*#__PURE__*/React.lazy(() => import( /* webpackChunkName: "@atlaskit-internal_@atlassian/user-picker/external-user-option" */'./main').then(module => {
5
3
  return {
6
4
  default: module.ExternalUserOption
7
5
  };