@atlaskit/user-picker 10.0.3 → 10.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/user-picker
2
2
 
3
+ ## 10.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`6e27d7c6682`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6e27d7c6682) - [ux] UserPicker now shows an error message when there has been a Promise failure for the provided loadOptions prop. You can customize the error message by providing a loadOptionsErrorMessage prop.
8
+
3
9
  ## 10.0.3
4
10
 
5
11
  ### Patch Changes
@@ -142,9 +142,15 @@ var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component) {
142
142
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleLoadOptionsError", function () {
143
143
  var count = _this.state.count;
144
144
  var newCount = count - 1;
145
+ var resolving = newCount !== 0;
146
+ var showError = false;
147
+ if (!resolving) {
148
+ showError = true;
149
+ }
145
150
  _this.setState({
146
151
  count: newCount,
147
- resolving: newCount !== 0
152
+ resolving: resolving,
153
+ showError: showError
148
154
  });
149
155
  _this.fireEvent(_analytics.failedEvent);
150
156
  });
@@ -199,7 +205,8 @@ var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component) {
199
205
  var loadOptions = _this.props.loadOptions;
200
206
  if (loadOptions) {
201
207
  _this.setState({
202
- resolving: true
208
+ resolving: true,
209
+ showError: false
203
210
  }, function () {
204
211
  return _this.debouncedLoadOptions(search);
205
212
  });
@@ -352,7 +359,8 @@ var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component) {
352
359
  hoveringClearIndicator: false,
353
360
  menuIsOpen: !!_this.props.open,
354
361
  inputValue: props.search || '',
355
- resolving: false
362
+ resolving: false,
363
+ showError: false
356
364
  };
357
365
  _this.optionsShownUfoExperienceInstance = _ufoExperiences.userPickerOptionsShownUfoExperience.getInstance((0, _uuid.v4)());
358
366
  return _this;
@@ -417,6 +425,7 @@ var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component) {
417
425
  clearValueLabel = _this$props4.clearValueLabel,
418
426
  menuMinWidth = _this$props4.menuMinWidth,
419
427
  menuPortalTarget = _this$props4.menuPortalTarget,
428
+ loadOptionsErrorMessage = _this$props4.loadOptionsErrorMessage,
420
429
  addMoreMessage = _this$props4.addMoreMessage,
421
430
  noOptionsMessage = _this$props4.noOptionsMessage,
422
431
  disableInput = _this$props4.disableInput,
@@ -437,7 +446,8 @@ var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component) {
437
446
  menuIsOpen = _this$state3.menuIsOpen,
438
447
  value = _this$state3.value,
439
448
  inputValue = _this$state3.inputValue,
440
- resolving = _this$state3.resolving;
449
+ resolving = _this$state3.resolving,
450
+ showError = _this$state3.showError;
441
451
  var appearance = this.getAppearance();
442
452
  return /*#__PURE__*/_react.default.createElement(SelectComponent, (0, _extends2.default)({
443
453
  value: value,
@@ -465,7 +475,7 @@ var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component) {
465
475
  subtle: subtle,
466
476
  blurInputOnSelect: !isMulti,
467
477
  closeMenuOnSelect: !isMulti,
468
- noOptionsMessage: noOptionsMessage,
478
+ noOptionsMessage: showError ? loadOptionsErrorMessage : noOptionsMessage,
469
479
  openMenuOnFocus: true,
470
480
  isDisabled: isDisabled,
471
481
  isFocused: menuIsOpen,
@@ -523,7 +533,10 @@ exports.BaseUserPickerWithoutAnalytics = BaseUserPickerWithoutAnalytics;
523
533
  subtle: false,
524
534
  noBorder: false,
525
535
  textFieldBackgroundColor: false,
526
- isClearable: true
536
+ isClearable: true,
537
+ loadOptionsErrorMessage: function loadOptionsErrorMessage() {
538
+ return /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _i18n.messages.errorMessage);
539
+ }
527
540
  });
528
541
  var BaseUserPicker = (0, _analyticsNext.withAnalyticsEvents)()(BaseUserPickerWithoutAnalytics);
529
542
  exports.BaseUserPicker = BaseUserPicker;
@@ -26,6 +26,11 @@ var messages = (0, _reactIntlNext.defineMessages)({
26
26
  defaultMessage: 'Clear',
27
27
  description: 'Tooltip for clear button in the single user select field.'
28
28
  },
29
+ errorMessage: {
30
+ id: 'fabric.elements.user-picker.error.message',
31
+ defaultMessage: 'Something went wrong',
32
+ description: 'Error message to display when options fail to load.'
33
+ },
29
34
  memberCountWithoutYou: {
30
35
  id: 'fabric.elements.user-picker.team.member.count',
31
36
  defaultMessage: 'Team • {count} {count, plural, one {member} other {members}}',
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/user-picker",
3
- "version": "10.0.3",
3
+ "version": "10.1.0",
4
4
  "sideEffects": false
5
5
  }
@@ -135,9 +135,15 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
135
135
  count
136
136
  } = this.state;
137
137
  const newCount = count - 1;
138
+ const resolving = newCount !== 0;
139
+ let showError = false;
140
+ if (!resolving) {
141
+ showError = true;
142
+ }
138
143
  this.setState({
139
144
  count: newCount,
140
- resolving: newCount !== 0
145
+ resolving,
146
+ showError
141
147
  });
142
148
  this.fireEvent(failedEvent);
143
149
  });
@@ -188,7 +194,8 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
188
194
  } = this.props;
189
195
  if (loadOptions) {
190
196
  this.setState({
191
- resolving: true
197
+ resolving: true,
198
+ showError: false
192
199
  }, () => this.debouncedLoadOptions(search));
193
200
  }
194
201
  });
@@ -337,7 +344,8 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
337
344
  hoveringClearIndicator: false,
338
345
  menuIsOpen: !!this.props.open,
339
346
  inputValue: props.search || '',
340
- resolving: false
347
+ resolving: false,
348
+ showError: false
341
349
  };
342
350
  this.optionsShownUfoExperienceInstance = userPickerOptionsShownUfoExperience.getInstance(uuidv4());
343
351
  }
@@ -397,6 +405,7 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
397
405
  clearValueLabel,
398
406
  menuMinWidth,
399
407
  menuPortalTarget,
408
+ loadOptionsErrorMessage,
400
409
  addMoreMessage,
401
410
  noOptionsMessage,
402
411
  disableInput,
@@ -418,7 +427,8 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
418
427
  menuIsOpen,
419
428
  value,
420
429
  inputValue,
421
- resolving
430
+ resolving,
431
+ showError
422
432
  } = this.state;
423
433
  const appearance = this.getAppearance();
424
434
  return /*#__PURE__*/React.createElement(SelectComponent, _extends({
@@ -447,7 +457,7 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
447
457
  subtle: subtle,
448
458
  blurInputOnSelect: !isMulti,
449
459
  closeMenuOnSelect: !isMulti,
450
- noOptionsMessage: noOptionsMessage,
460
+ noOptionsMessage: showError ? loadOptionsErrorMessage : noOptionsMessage,
451
461
  openMenuOnFocus: true,
452
462
  isDisabled: isDisabled,
453
463
  isFocused: menuIsOpen,
@@ -478,6 +488,7 @@ _defineProperty(BaseUserPickerWithoutAnalytics, "defaultProps", {
478
488
  subtle: false,
479
489
  noBorder: false,
480
490
  textFieldBackgroundColor: false,
481
- isClearable: true
491
+ isClearable: true,
492
+ loadOptionsErrorMessage: () => /*#__PURE__*/React.createElement(FormattedMessage, messages.errorMessage)
482
493
  });
483
494
  export const BaseUserPicker = withAnalyticsEvents()(BaseUserPickerWithoutAnalytics);
@@ -20,6 +20,11 @@ export const messages = defineMessages({
20
20
  defaultMessage: 'Clear',
21
21
  description: 'Tooltip for clear button in the single user select field.'
22
22
  },
23
+ errorMessage: {
24
+ id: 'fabric.elements.user-picker.error.message',
25
+ defaultMessage: 'Something went wrong',
26
+ description: 'Error message to display when options fail to load.'
27
+ },
23
28
  memberCountWithoutYou: {
24
29
  id: 'fabric.elements.user-picker.team.member.count',
25
30
  defaultMessage: 'Team • {count} {count, plural, one {member} other {members}}',
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/user-picker",
3
- "version": "10.0.3",
3
+ "version": "10.1.0",
4
4
  "sideEffects": false
5
5
  }
@@ -135,9 +135,15 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
135
135
  _defineProperty(_assertThisInitialized(_this), "handleLoadOptionsError", function () {
136
136
  var count = _this.state.count;
137
137
  var newCount = count - 1;
138
+ var resolving = newCount !== 0;
139
+ var showError = false;
140
+ if (!resolving) {
141
+ showError = true;
142
+ }
138
143
  _this.setState({
139
144
  count: newCount,
140
- resolving: newCount !== 0
145
+ resolving: resolving,
146
+ showError: showError
141
147
  });
142
148
  _this.fireEvent(failedEvent);
143
149
  });
@@ -192,7 +198,8 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
192
198
  var loadOptions = _this.props.loadOptions;
193
199
  if (loadOptions) {
194
200
  _this.setState({
195
- resolving: true
201
+ resolving: true,
202
+ showError: false
196
203
  }, function () {
197
204
  return _this.debouncedLoadOptions(search);
198
205
  });
@@ -345,7 +352,8 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
345
352
  hoveringClearIndicator: false,
346
353
  menuIsOpen: !!_this.props.open,
347
354
  inputValue: props.search || '',
348
- resolving: false
355
+ resolving: false,
356
+ showError: false
349
357
  };
350
358
  _this.optionsShownUfoExperienceInstance = userPickerOptionsShownUfoExperience.getInstance(uuidv4());
351
359
  return _this;
@@ -410,6 +418,7 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
410
418
  clearValueLabel = _this$props4.clearValueLabel,
411
419
  menuMinWidth = _this$props4.menuMinWidth,
412
420
  menuPortalTarget = _this$props4.menuPortalTarget,
421
+ loadOptionsErrorMessage = _this$props4.loadOptionsErrorMessage,
413
422
  addMoreMessage = _this$props4.addMoreMessage,
414
423
  noOptionsMessage = _this$props4.noOptionsMessage,
415
424
  disableInput = _this$props4.disableInput,
@@ -430,7 +439,8 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
430
439
  menuIsOpen = _this$state3.menuIsOpen,
431
440
  value = _this$state3.value,
432
441
  inputValue = _this$state3.inputValue,
433
- resolving = _this$state3.resolving;
442
+ resolving = _this$state3.resolving,
443
+ showError = _this$state3.showError;
434
444
  var appearance = this.getAppearance();
435
445
  return /*#__PURE__*/React.createElement(SelectComponent, _extends({
436
446
  value: value,
@@ -458,7 +468,7 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
458
468
  subtle: subtle,
459
469
  blurInputOnSelect: !isMulti,
460
470
  closeMenuOnSelect: !isMulti,
461
- noOptionsMessage: noOptionsMessage,
471
+ noOptionsMessage: showError ? loadOptionsErrorMessage : noOptionsMessage,
462
472
  openMenuOnFocus: true,
463
473
  isDisabled: isDisabled,
464
474
  isFocused: menuIsOpen,
@@ -515,6 +525,9 @@ _defineProperty(BaseUserPickerWithoutAnalytics, "defaultProps", {
515
525
  subtle: false,
516
526
  noBorder: false,
517
527
  textFieldBackgroundColor: false,
518
- isClearable: true
528
+ isClearable: true,
529
+ loadOptionsErrorMessage: function loadOptionsErrorMessage() {
530
+ return /*#__PURE__*/React.createElement(FormattedMessage, messages.errorMessage);
531
+ }
519
532
  });
520
533
  export var BaseUserPicker = withAnalyticsEvents()(BaseUserPickerWithoutAnalytics);
@@ -20,6 +20,11 @@ export var messages = defineMessages({
20
20
  defaultMessage: 'Clear',
21
21
  description: 'Tooltip for clear button in the single user select field.'
22
22
  },
23
+ errorMessage: {
24
+ id: 'fabric.elements.user-picker.error.message',
25
+ defaultMessage: 'Something went wrong',
26
+ description: 'Error message to display when options fail to load.'
27
+ },
23
28
  memberCountWithoutYou: {
24
29
  id: 'fabric.elements.user-picker.team.member.count',
25
30
  defaultMessage: 'Team • {count} {count, plural, one {member} other {members}}',
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/user-picker",
3
- "version": "10.0.3",
3
+ "version": "10.1.0",
4
4
  "sideEffects": false
5
5
  }
@@ -14,6 +14,7 @@ export declare class BaseUserPickerWithoutAnalytics extends React.Component<Base
14
14
  noBorder: boolean;
15
15
  textFieldBackgroundColor: boolean;
16
16
  isClearable: boolean;
17
+ loadOptionsErrorMessage: () => JSX.Element;
17
18
  };
18
19
  static getDerivedStateFromProps(nextProps: Partial<UserPickerProps>, prevState: UserPickerState): Partial<UserPickerState>;
19
20
  private selectRef;
@@ -52,10 +53,11 @@ export declare class BaseUserPickerWithoutAnalytics extends React.Component<Base
52
53
  private getAppearance;
53
54
  render(): JSX.Element;
54
55
  }
55
- export declare const BaseUserPicker: React.ForwardRefExoticComponent<Pick<Omit<BaseUserPickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "options" | "search" | "noOptionsMessage" | "placeholder" | "isDisabled" | "autoFocus" | "captureMenuScroll" | "closeMenuOnScroll" | "components" | "inputId" | "isLoading" | "menuPosition" | "menuPortalTarget" | "menuShouldBlockScroll" | "onBlur" | "onChange" | "onFocus" | "onInputChange" | "styles" | "value" | "defaultValue" | "fieldId" | "width" | "menuMinWidth" | "maxPickerHeight" | "loadOptions" | "loadUserSource" | "anchor" | "open" | "onSelection" | "onClear" | "onClose" | "appearance" | "addMoreMessage" | "clearValueLabel" | "allowEmail" | "suggestEmailsForDomain" | "emailLabel" | "disableInput" | "isValidEmail" | "maxOptions" | "ariaLabelledBy" | "ariaLive" | "SelectComponent" | "pickerProps"> & Partial<Pick<Omit<BaseUserPickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "isClearable" | "isMulti" | "textFieldBackgroundColor" | "subtle" | "noBorder">> & Partial<Pick<{
56
+ export declare const BaseUserPicker: React.ForwardRefExoticComponent<Pick<Omit<BaseUserPickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "options" | "search" | "noOptionsMessage" | "placeholder" | "isDisabled" | "autoFocus" | "captureMenuScroll" | "closeMenuOnScroll" | "components" | "inputId" | "isLoading" | "menuPosition" | "menuPortalTarget" | "menuShouldBlockScroll" | "onBlur" | "onChange" | "onFocus" | "onInputChange" | "styles" | "value" | "defaultValue" | "fieldId" | "width" | "menuMinWidth" | "maxPickerHeight" | "loadOptions" | "loadUserSource" | "anchor" | "open" | "onSelection" | "onClear" | "onClose" | "appearance" | "addMoreMessage" | "clearValueLabel" | "allowEmail" | "suggestEmailsForDomain" | "emailLabel" | "disableInput" | "isValidEmail" | "maxOptions" | "ariaLabelledBy" | "ariaLive" | "SelectComponent" | "pickerProps"> & Partial<Pick<Omit<BaseUserPickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "isClearable" | "isMulti" | "textFieldBackgroundColor" | "loadOptionsErrorMessage" | "subtle" | "noBorder">> & Partial<Pick<{
56
57
  isMulti: boolean;
57
58
  subtle: boolean;
58
59
  noBorder: boolean;
59
60
  textFieldBackgroundColor: boolean;
60
61
  isClearable: boolean;
62
+ loadOptionsErrorMessage: () => JSX.Element;
61
63
  }, never>> & React.RefAttributes<any>>;
@@ -27,7 +27,7 @@ export declare class PopupUserPickerWithoutAnalytics extends React.Component<Pop
27
27
  };
28
28
  render(): JSX.Element;
29
29
  }
30
- export declare const PopupUserPicker: React.ForwardRefExoticComponent<Pick<Omit<PopupUserPickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "options" | "search" | "noOptionsMessage" | "placeholder" | "isDisabled" | "autoFocus" | "captureMenuScroll" | "closeMenuOnScroll" | "inputId" | "isClearable" | "isLoading" | "menuPosition" | "menuPortalTarget" | "menuShouldBlockScroll" | "onBlur" | "onChange" | "onFocus" | "onInputChange" | "styles" | "value" | "target" | "defaultValue" | "fieldId" | "menuMinWidth" | "maxPickerHeight" | "textFieldBackgroundColor" | "loadOptions" | "loadUserSource" | "anchor" | "open" | "onSelection" | "onClear" | "onClose" | "appearance" | "subtle" | "noBorder" | "addMoreMessage" | "clearValueLabel" | "allowEmail" | "suggestEmailsForDomain" | "emailLabel" | "disableInput" | "isValidEmail" | "maxOptions" | "ariaLabelledBy" | "ariaLive" | "popupTitle"> & Partial<Pick<Omit<PopupUserPickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "offset" | "isMulti" | "width" | "rootBoundary" | "boundariesElement" | "placement" | "shouldFlip">> & Partial<Pick<{
30
+ export declare const PopupUserPicker: React.ForwardRefExoticComponent<Pick<Omit<PopupUserPickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "options" | "search" | "noOptionsMessage" | "placeholder" | "isDisabled" | "autoFocus" | "captureMenuScroll" | "closeMenuOnScroll" | "inputId" | "isClearable" | "isLoading" | "menuPosition" | "menuPortalTarget" | "menuShouldBlockScroll" | "onBlur" | "onChange" | "onFocus" | "onInputChange" | "styles" | "value" | "target" | "defaultValue" | "fieldId" | "menuMinWidth" | "maxPickerHeight" | "textFieldBackgroundColor" | "loadOptions" | "loadOptionsErrorMessage" | "loadUserSource" | "anchor" | "open" | "onSelection" | "onClear" | "onClose" | "appearance" | "subtle" | "noBorder" | "addMoreMessage" | "clearValueLabel" | "allowEmail" | "suggestEmailsForDomain" | "emailLabel" | "disableInput" | "isValidEmail" | "maxOptions" | "ariaLabelledBy" | "ariaLive" | "popupTitle"> & Partial<Pick<Omit<PopupUserPickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "offset" | "isMulti" | "width" | "rootBoundary" | "boundariesElement" | "placement" | "shouldFlip">> & Partial<Pick<{
31
31
  boundariesElement: string;
32
32
  width: number;
33
33
  isMulti: boolean;
@@ -10,7 +10,7 @@ export declare class UserPickerWithoutAnalytics extends React.Component<UserPick
10
10
  componentDidMount(): void;
11
11
  render(): JSX.Element;
12
12
  }
13
- export declare const UserPicker: React.ForwardRefExoticComponent<Pick<Omit<UserPickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "options" | "search" | "noOptionsMessage" | "placeholder" | "isDisabled" | "autoFocus" | "captureMenuScroll" | "closeMenuOnScroll" | "inputId" | "isClearable" | "isLoading" | "menuPosition" | "menuPortalTarget" | "menuShouldBlockScroll" | "onBlur" | "onChange" | "onFocus" | "onInputChange" | "styles" | "value" | "defaultValue" | "fieldId" | "menuMinWidth" | "maxPickerHeight" | "textFieldBackgroundColor" | "loadOptions" | "loadUserSource" | "anchor" | "open" | "onSelection" | "onClear" | "onClose" | "appearance" | "subtle" | "noBorder" | "addMoreMessage" | "clearValueLabel" | "allowEmail" | "suggestEmailsForDomain" | "emailLabel" | "disableInput" | "isValidEmail" | "maxOptions" | "ariaLabelledBy" | "ariaLive"> & Partial<Pick<Omit<UserPickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "isMulti" | "width">> & Partial<Pick<{
13
+ export declare const UserPicker: React.ForwardRefExoticComponent<Pick<Omit<UserPickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "options" | "search" | "noOptionsMessage" | "placeholder" | "isDisabled" | "autoFocus" | "captureMenuScroll" | "closeMenuOnScroll" | "inputId" | "isClearable" | "isLoading" | "menuPosition" | "menuPortalTarget" | "menuShouldBlockScroll" | "onBlur" | "onChange" | "onFocus" | "onInputChange" | "styles" | "value" | "defaultValue" | "fieldId" | "menuMinWidth" | "maxPickerHeight" | "textFieldBackgroundColor" | "loadOptions" | "loadOptionsErrorMessage" | "loadUserSource" | "anchor" | "open" | "onSelection" | "onClear" | "onClose" | "appearance" | "subtle" | "noBorder" | "addMoreMessage" | "clearValueLabel" | "allowEmail" | "suggestEmailsForDomain" | "emailLabel" | "disableInput" | "isValidEmail" | "maxOptions" | "ariaLabelledBy" | "ariaLive"> & Partial<Pick<Omit<UserPickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "isMulti" | "width">> & Partial<Pick<{
14
14
  width: number;
15
15
  isMulti: boolean;
16
16
  }, never>> & React.RefAttributes<any>>;
@@ -19,6 +19,11 @@ export declare const messages: {
19
19
  defaultMessage: string;
20
20
  description: string;
21
21
  };
22
+ errorMessage: {
23
+ id: string;
24
+ defaultMessage: string;
25
+ description: string;
26
+ };
22
27
  memberCountWithoutYou: {
23
28
  id: string;
24
29
  defaultMessage: string;
@@ -39,6 +39,13 @@ export declare type UserPickerProps = WithAnalyticsEventsProps & {
39
39
  * sessionId?: user picker session identifier, used to track success metric for users providers
40
40
  */
41
41
  loadOptions?: LoadOptions;
42
+ /**
43
+ * Function to generate the error message when there's a failure executing the loadOptions prop.
44
+ * If not provided, will default to a default error message.
45
+ */
46
+ loadOptionsErrorMessage?: (value: {
47
+ inputValue: string;
48
+ }) => string;
42
49
  /**
43
50
  * Function used to load user source if they are an external user.
44
51
  * accepts two params:
@@ -181,6 +188,7 @@ export declare type UserPickerState = {
181
188
  menuIsOpen: boolean;
182
189
  inputValue: string;
183
190
  resolving: boolean;
191
+ showError: boolean;
184
192
  };
185
193
  export interface HighlightRange {
186
194
  start: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/user-picker",
3
- "version": "10.0.3",
3
+ "version": "10.1.0",
4
4
  "description": "Fabric component for display a dropdown to select a user from",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -35,7 +35,7 @@
35
35
  "@atlaskit/select": "^16.1.0",
36
36
  "@atlaskit/spinner": "^15.3.0",
37
37
  "@atlaskit/theme": "^12.2.0",
38
- "@atlaskit/tokens": "^1.1.0",
38
+ "@atlaskit/tokens": "^1.2.0",
39
39
  "@atlaskit/tooltip": "^17.6.0",
40
40
  "@atlaskit/ufo": "^0.1.0",
41
41
  "@babel/runtime": "^7.0.0",
package/report.api.md CHANGED
@@ -255,6 +255,7 @@ export const PopupUserPicker: React_2.ForwardRefExoticComponent<
255
255
  | 'isLoading'
256
256
  | 'isValidEmail'
257
257
  | 'loadOptions'
258
+ | 'loadOptionsErrorMessage'
258
259
  | 'loadUserSource'
259
260
  | 'maxOptions'
260
261
  | 'maxPickerHeight'
@@ -421,6 +422,7 @@ const UserPicker: React_2.ForwardRefExoticComponent<
421
422
  | 'isLoading'
422
423
  | 'isValidEmail'
423
424
  | 'loadOptions'
425
+ | 'loadOptionsErrorMessage'
424
426
  | 'loadUserSource'
425
427
  | 'maxOptions'
426
428
  | 'maxPickerHeight'
@@ -475,6 +477,7 @@ export type UserPickerProps = WithAnalyticsEventsProps & {
475
477
  maxPickerHeight?: number;
476
478
  textFieldBackgroundColor?: boolean;
477
479
  loadOptions?: LoadOptions;
480
+ loadOptionsErrorMessage?: (value: { inputValue: string }) => string;
478
481
  loadUserSource?: LoadUserSource;
479
482
  onChange?: OnChange;
480
483
  isMulti?: boolean;
@@ -528,6 +531,7 @@ export type UserPickerState = {
528
531
  menuIsOpen: boolean;
529
532
  inputValue: string;
530
533
  resolving: boolean;
534
+ showError: boolean;
531
535
  };
532
536
 
533
537
  // @public (undocumented)
@@ -197,7 +197,7 @@ export interface OptionData {
197
197
  export type OptionIdentifier = Pick<OptionData, 'id' | 'isDisabled' | 'type'>;
198
198
 
199
199
  // @public (undocumented)
200
- export const PopupUserPicker: React_2.ForwardRefExoticComponent<Pick<Omit<PopupUserPickerProps, keyof WithAnalyticsEventsProps>, "addMoreMessage" | "allowEmail" | "anchor" | "appearance" | "ariaLabelledBy" | "ariaLive" | "autoFocus" | "captureMenuScroll" | "clearValueLabel" | "closeMenuOnScroll" | "defaultValue" | "disableInput" | "emailLabel" | "fieldId" | "inputId" | "isClearable" | "isDisabled" | "isLoading" | "isValidEmail" | "loadOptions" | "loadUserSource" | "maxOptions" | "maxPickerHeight" | "menuMinWidth" | "menuPortalTarget" | "menuPosition" | "menuShouldBlockScroll" | "noBorder" | "noOptionsMessage" | "onBlur" | "onChange" | "onClear" | "onClose" | "onFocus" | "onInputChange" | "onSelection" | "open" | "options" | "placeholder" | "popupTitle" | "search" | "styles" | "subtle" | "suggestEmailsForDomain" | "target" | "textFieldBackgroundColor" | "value"> & Partial<Pick<Omit<PopupUserPickerProps, keyof WithAnalyticsEventsProps>, "boundariesElement" | "isMulti" | "offset" | "placement" | "rootBoundary" | "shouldFlip" | "width">> & Partial<Pick<{
200
+ export const PopupUserPicker: React_2.ForwardRefExoticComponent<Pick<Omit<PopupUserPickerProps, keyof WithAnalyticsEventsProps>, "addMoreMessage" | "allowEmail" | "anchor" | "appearance" | "ariaLabelledBy" | "ariaLive" | "autoFocus" | "captureMenuScroll" | "clearValueLabel" | "closeMenuOnScroll" | "defaultValue" | "disableInput" | "emailLabel" | "fieldId" | "inputId" | "isClearable" | "isDisabled" | "isLoading" | "isValidEmail" | "loadOptions" | "loadOptionsErrorMessage" | "loadUserSource" | "maxOptions" | "maxPickerHeight" | "menuMinWidth" | "menuPortalTarget" | "menuPosition" | "menuShouldBlockScroll" | "noBorder" | "noOptionsMessage" | "onBlur" | "onChange" | "onClear" | "onClose" | "onFocus" | "onInputChange" | "onSelection" | "open" | "options" | "placeholder" | "popupTitle" | "search" | "styles" | "subtle" | "suggestEmailsForDomain" | "target" | "textFieldBackgroundColor" | "value"> & Partial<Pick<Omit<PopupUserPickerProps, keyof WithAnalyticsEventsProps>, "boundariesElement" | "isMulti" | "offset" | "placement" | "rootBoundary" | "shouldFlip" | "width">> & Partial<Pick<{
201
201
  boundariesElement: string;
202
202
  width: number;
203
203
  isMulti: boolean;
@@ -296,7 +296,7 @@ export interface UserHighlight {
296
296
  }
297
297
 
298
298
  // @public (undocumented)
299
- const UserPicker: React_2.ForwardRefExoticComponent<Pick<Omit<UserPickerProps, keyof WithAnalyticsEventsProps>, "addMoreMessage" | "allowEmail" | "anchor" | "appearance" | "ariaLabelledBy" | "ariaLive" | "autoFocus" | "captureMenuScroll" | "clearValueLabel" | "closeMenuOnScroll" | "defaultValue" | "disableInput" | "emailLabel" | "fieldId" | "inputId" | "isClearable" | "isDisabled" | "isLoading" | "isValidEmail" | "loadOptions" | "loadUserSource" | "maxOptions" | "maxPickerHeight" | "menuMinWidth" | "menuPortalTarget" | "menuPosition" | "menuShouldBlockScroll" | "noBorder" | "noOptionsMessage" | "onBlur" | "onChange" | "onClear" | "onClose" | "onFocus" | "onInputChange" | "onSelection" | "open" | "options" | "placeholder" | "search" | "styles" | "subtle" | "suggestEmailsForDomain" | "textFieldBackgroundColor" | "value"> & Partial<Pick<Omit<UserPickerProps, keyof WithAnalyticsEventsProps>, "isMulti" | "width">> & Partial<Pick<{
299
+ const UserPicker: React_2.ForwardRefExoticComponent<Pick<Omit<UserPickerProps, keyof WithAnalyticsEventsProps>, "addMoreMessage" | "allowEmail" | "anchor" | "appearance" | "ariaLabelledBy" | "ariaLive" | "autoFocus" | "captureMenuScroll" | "clearValueLabel" | "closeMenuOnScroll" | "defaultValue" | "disableInput" | "emailLabel" | "fieldId" | "inputId" | "isClearable" | "isDisabled" | "isLoading" | "isValidEmail" | "loadOptions" | "loadOptionsErrorMessage" | "loadUserSource" | "maxOptions" | "maxPickerHeight" | "menuMinWidth" | "menuPortalTarget" | "menuPosition" | "menuShouldBlockScroll" | "noBorder" | "noOptionsMessage" | "onBlur" | "onChange" | "onClear" | "onClose" | "onFocus" | "onInputChange" | "onSelection" | "open" | "options" | "placeholder" | "search" | "styles" | "subtle" | "suggestEmailsForDomain" | "textFieldBackgroundColor" | "value"> & Partial<Pick<Omit<UserPickerProps, keyof WithAnalyticsEventsProps>, "isMulti" | "width">> & Partial<Pick<{
300
300
  width: number;
301
301
  isMulti: boolean;
302
302
  }, never>> & React_2.RefAttributes<any>>;
@@ -311,6 +311,9 @@ export type UserPickerProps = WithAnalyticsEventsProps & {
311
311
  maxPickerHeight?: number;
312
312
  textFieldBackgroundColor?: boolean;
313
313
  loadOptions?: LoadOptions;
314
+ loadOptionsErrorMessage?: (value: {
315
+ inputValue: string;
316
+ }) => string;
314
317
  loadUserSource?: LoadUserSource;
315
318
  onChange?: OnChange;
316
319
  isMulti?: boolean;
@@ -366,6 +369,7 @@ export type UserPickerState = {
366
369
  menuIsOpen: boolean;
367
370
  inputValue: string;
368
371
  resolving: boolean;
372
+ showError: boolean;
369
373
  };
370
374
 
371
375
  // @public (undocumented)