@atlaskit/user-picker 10.0.2 → 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 +12 -0
- package/dist/cjs/components/BaseUserPicker.js +19 -6
- package/dist/cjs/components/CustomOption/main.js +2 -1
- package/dist/cjs/components/EmailOption/main.js +2 -1
- package/dist/cjs/components/GroupOption/main.js +2 -1
- package/dist/cjs/components/PopupUserPicker.js +4 -4
- package/dist/cjs/components/TeamOption/main.js +2 -1
- package/dist/cjs/components/i18n.js +5 -0
- package/dist/cjs/components/styles.js +2 -2
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/BaseUserPicker.js +17 -6
- package/dist/es2019/components/CustomOption/main.js +2 -1
- package/dist/es2019/components/EmailOption/main.js +2 -1
- package/dist/es2019/components/GroupOption/main.js +2 -1
- package/dist/es2019/components/PopupUserPicker.js +4 -6
- package/dist/es2019/components/TeamOption/main.js +2 -1
- package/dist/es2019/components/i18n.js +5 -0
- package/dist/es2019/components/styles.js +2 -2
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/BaseUserPicker.js +19 -6
- package/dist/esm/components/CustomOption/main.js +2 -1
- package/dist/esm/components/EmailOption/main.js +2 -1
- package/dist/esm/components/GroupOption/main.js +2 -1
- package/dist/esm/components/PopupUserPicker.js +4 -4
- package/dist/esm/components/TeamOption/main.js +2 -1
- package/dist/esm/components/i18n.js +5 -0
- package/dist/esm/components/styles.js +2 -2
- package/dist/esm/version.json +1 -1
- package/dist/types/components/BaseUserPicker.d.ts +3 -1
- package/dist/types/components/PopupUserPicker.d.ts +1 -1
- package/dist/types/components/UserPicker.d.ts +1 -1
- package/dist/types/components/i18n.d.ts +5 -0
- package/dist/types/components/styles.d.ts +1 -1
- package/dist/types/types.d.ts +8 -0
- package/package.json +5 -3
- package/report.api.md +4 -0
- package/tmp/api-report-tmp.d.ts +6 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
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
|
+
|
|
9
|
+
## 10.0.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`62e83249cb2`](https://bitbucket.org/atlassian/atlassian-frontend/commits/62e83249cb2) - [ux] PopupUserPicker now supports user-defined styles prop for adding styling to PopupUserPicker.
|
|
14
|
+
|
|
3
15
|
## 10.0.2
|
|
4
16
|
|
|
5
17
|
### 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:
|
|
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;
|
|
@@ -43,7 +43,8 @@ var CustomOption = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
43
43
|
});
|
|
44
44
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getBylineComponent", function (isSelected, message) {
|
|
45
45
|
return (0, _react.jsx)("span", {
|
|
46
|
-
css: (0, _AvatarItemOption.textWrapper)(isSelected ? "var(--ds-text-selected, ".concat(_colors.B400, ")") : "var(--ds-text-subtlest, ".concat(_colors.N200, ")"))
|
|
46
|
+
css: (0, _AvatarItemOption.textWrapper)(isSelected ? "var(--ds-text-selected, ".concat(_colors.B400, ")") : "var(--ds-text-subtlest, ".concat(_colors.N200, ")")),
|
|
47
|
+
"data-testid": "user-picker-custom-secondary-text"
|
|
47
48
|
}, message);
|
|
48
49
|
});
|
|
49
50
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderByline", function () {
|
|
@@ -48,7 +48,8 @@ var EmailOption = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
48
48
|
});
|
|
49
49
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderSecondaryText", function (label) {
|
|
50
50
|
return (0, _react2.jsx)("span", {
|
|
51
|
-
css: (0, _AvatarItemOption.textWrapper)(_this.props.isSelected ? "var(--ds-text-selected, ".concat(_colors.B400, ")") : "var(--ds-text-subtlest, ".concat(_colors.N200, ")"))
|
|
51
|
+
css: (0, _AvatarItemOption.textWrapper)(_this.props.isSelected ? "var(--ds-text-selected, ".concat(_colors.B400, ")") : "var(--ds-text-subtlest, ".concat(_colors.N200, ")")),
|
|
52
|
+
"data-testid": "user-picker-email-secondary-text"
|
|
52
53
|
}, label);
|
|
53
54
|
});
|
|
54
55
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderOption", function (label) {
|
|
@@ -65,7 +65,8 @@ var GroupOption = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
65
65
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderByline", function () {
|
|
66
66
|
var isSelected = _this.props.isSelected;
|
|
67
67
|
return (0, _react2.jsx)("span", {
|
|
68
|
-
css: (0, _AvatarItemOption.textWrapper)(isSelected ? "var(--ds-text-selected, ".concat(_colors.B400, ")") : "var(--ds-text-subtlest, ".concat(_colors.N200, ")"))
|
|
68
|
+
css: (0, _AvatarItemOption.textWrapper)(isSelected ? "var(--ds-text-selected, ".concat(_colors.B400, ")") : "var(--ds-text-subtlest, ".concat(_colors.N200, ")")),
|
|
69
|
+
"data-testid": "user-picker-group-secondary-text"
|
|
69
70
|
}, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _i18n.messages.groupByline));
|
|
70
71
|
});
|
|
71
72
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getLozengeProps", function () {
|
|
@@ -61,14 +61,14 @@ var PopupUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component) {
|
|
|
61
61
|
offset = _this$props.offset,
|
|
62
62
|
placement = _this$props.placement,
|
|
63
63
|
rootBoundary = _this$props.rootBoundary,
|
|
64
|
-
shouldFlip = _this$props.shouldFlip
|
|
65
|
-
|
|
64
|
+
shouldFlip = _this$props.shouldFlip,
|
|
65
|
+
styles = _this$props.styles;
|
|
66
66
|
var width = this.props.width;
|
|
67
|
-
var
|
|
67
|
+
var selectStyles = (0, _styles.getPopupStyles)(width, isMulti, styles);
|
|
68
68
|
return /*#__PURE__*/_react.default.createElement(_BaseUserPicker.BaseUserPickerWithoutAnalytics, (0, _extends2.default)({}, this.props, {
|
|
69
69
|
SelectComponent: _select.PopupSelect,
|
|
70
70
|
width: width,
|
|
71
|
-
styles:
|
|
71
|
+
styles: selectStyles,
|
|
72
72
|
components: (0, _components.getPopupComponents)(!!popupTitle),
|
|
73
73
|
pickerProps: (0, _popup.getPopupProps)(width, target, this.handleFlipStyle, boundariesElement, offset, placement, rootBoundary, shouldFlip, popupTitle)
|
|
74
74
|
}));
|
|
@@ -80,7 +80,8 @@ var TeamOption = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
80
80
|
});
|
|
81
81
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getBylineComponent", function (isSelected, message) {
|
|
82
82
|
return (0, _react.jsx)("span", {
|
|
83
|
-
css: (0, _AvatarItemOption.textWrapper)(isSelected ? "var(--ds-text-selected, ".concat(_colors.B400, ")") : "var(--ds-text-subtlest, ".concat(_colors.N200, ")"))
|
|
83
|
+
css: (0, _AvatarItemOption.textWrapper)(isSelected ? "var(--ds-text-selected, ".concat(_colors.B400, ")") : "var(--ds-text-subtlest, ".concat(_colors.N200, ")")),
|
|
84
|
+
"data-testid": "user-picker-team-secondary-text"
|
|
84
85
|
}, message);
|
|
85
86
|
});
|
|
86
87
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderAvatar", function () {
|
|
@@ -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}}',
|
|
@@ -169,7 +169,7 @@ var getStyles = (0, _memoizeOne.default)(function (width, isMulti, isCompact, ov
|
|
|
169
169
|
return overrideStyles ? (0, _select.mergeStyles)(styles, overrideStyles) : styles;
|
|
170
170
|
});
|
|
171
171
|
exports.getStyles = getStyles;
|
|
172
|
-
var getPopupStyles = (0, _memoizeOne.default)(function (width,
|
|
173
|
-
return _objectSpread({}, getStyles(width, isMulti));
|
|
172
|
+
var getPopupStyles = (0, _memoizeOne.default)(function (width, isMulti, overrideStyles) {
|
|
173
|
+
return _objectSpread({}, getStyles(width, isMulti, false, overrideStyles));
|
|
174
174
|
});
|
|
175
175
|
exports.getPopupStyles = getPopupStyles;
|
package/dist/cjs/version.json
CHANGED
|
@@ -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
|
|
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);
|
|
@@ -24,7 +24,8 @@ export class CustomOption extends React.PureComponent {
|
|
|
24
24
|
}, name))];
|
|
25
25
|
});
|
|
26
26
|
_defineProperty(this, "getBylineComponent", (isSelected, message) => jsx("span", {
|
|
27
|
-
css: textWrapper(isSelected ? `var(--ds-text-selected, ${B400})` : `var(--ds-text-subtlest, ${N200})`)
|
|
27
|
+
css: textWrapper(isSelected ? `var(--ds-text-selected, ${B400})` : `var(--ds-text-subtlest, ${N200})`),
|
|
28
|
+
"data-testid": "user-picker-custom-secondary-text"
|
|
28
29
|
}, message));
|
|
29
30
|
_defineProperty(this, "renderByline", () => {
|
|
30
31
|
var _this$props$data;
|
|
@@ -27,7 +27,8 @@ export class EmailOption extends React.PureComponent {
|
|
|
27
27
|
});
|
|
28
28
|
_defineProperty(this, "renderSecondaryText", label => {
|
|
29
29
|
return jsx("span", {
|
|
30
|
-
css: textWrapper(this.props.isSelected ? `var(--ds-text-selected, ${B400})` : `var(--ds-text-subtlest, ${N200})`)
|
|
30
|
+
css: textWrapper(this.props.isSelected ? `var(--ds-text-selected, ${B400})` : `var(--ds-text-subtlest, ${N200})`),
|
|
31
|
+
"data-testid": "user-picker-email-secondary-text"
|
|
31
32
|
}, label);
|
|
32
33
|
});
|
|
33
34
|
_defineProperty(this, "renderOption", label => jsx(AvatarItemOption, {
|
|
@@ -45,7 +45,8 @@ export class GroupOption extends React.PureComponent {
|
|
|
45
45
|
isSelected
|
|
46
46
|
} = this.props;
|
|
47
47
|
return jsx("span", {
|
|
48
|
-
css: textWrapper(isSelected ? `var(--ds-text-selected, ${B400})` : `var(--ds-text-subtlest, ${N200})`)
|
|
48
|
+
css: textWrapper(isSelected ? `var(--ds-text-selected, ${B400})` : `var(--ds-text-subtlest, ${N200})`),
|
|
49
|
+
"data-testid": "user-picker-group-secondary-text"
|
|
49
50
|
}, jsx(FormattedMessage, messages.groupByline));
|
|
50
51
|
});
|
|
51
52
|
_defineProperty(this, "getLozengeProps", () => typeof this.props.group.lozenge === 'string' ? {
|
|
@@ -42,17 +42,15 @@ export class PopupUserPickerWithoutAnalytics extends React.Component {
|
|
|
42
42
|
offset,
|
|
43
43
|
placement,
|
|
44
44
|
rootBoundary,
|
|
45
|
-
shouldFlip
|
|
45
|
+
shouldFlip,
|
|
46
|
+
styles
|
|
46
47
|
} = this.props;
|
|
47
|
-
const {
|
|
48
|
-
flipped
|
|
49
|
-
} = this.state;
|
|
50
48
|
const width = this.props.width;
|
|
51
|
-
const
|
|
49
|
+
const selectStyles = getPopupStyles(width, isMulti, styles);
|
|
52
50
|
return /*#__PURE__*/React.createElement(BaseUserPickerWithoutAnalytics, _extends({}, this.props, {
|
|
53
51
|
SelectComponent: PopupSelect,
|
|
54
52
|
width: width,
|
|
55
|
-
styles:
|
|
53
|
+
styles: selectStyles,
|
|
56
54
|
components: getPopupComponents(!!popupTitle),
|
|
57
55
|
pickerProps: getPopupProps(width, target, this.handleFlipStyle, boundariesElement, offset, placement, rootBoundary, shouldFlip, popupTitle)
|
|
58
56
|
}));
|
|
@@ -63,7 +63,8 @@ export class TeamOption extends React.PureComponent {
|
|
|
63
63
|
}
|
|
64
64
|
});
|
|
65
65
|
_defineProperty(this, "getBylineComponent", (isSelected, message) => jsx("span", {
|
|
66
|
-
css: textWrapper(isSelected ? `var(--ds-text-selected, ${B400})` : `var(--ds-text-subtlest, ${N200})`)
|
|
66
|
+
css: textWrapper(isSelected ? `var(--ds-text-selected, ${B400})` : `var(--ds-text-subtlest, ${N200})`),
|
|
67
|
+
"data-testid": "user-picker-team-secondary-text"
|
|
67
68
|
}, message));
|
|
68
69
|
_defineProperty(this, "renderAvatar", () => {
|
|
69
70
|
const {
|
|
@@ -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}}',
|
|
@@ -149,6 +149,6 @@ export const getStyles = memoizeOne((width, isMulti, isCompact, overrideStyles)
|
|
|
149
149
|
};
|
|
150
150
|
return overrideStyles ? mergeStyles(styles, overrideStyles) : styles;
|
|
151
151
|
});
|
|
152
|
-
export const getPopupStyles = memoizeOne((width,
|
|
153
|
-
...getStyles(width, isMulti)
|
|
152
|
+
export const getPopupStyles = memoizeOne((width, isMulti, overrideStyles) => ({
|
|
153
|
+
...getStyles(width, isMulti, false, overrideStyles)
|
|
154
154
|
}));
|
package/dist/es2019/version.json
CHANGED
|
@@ -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:
|
|
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);
|
|
@@ -37,7 +37,8 @@ export var CustomOption = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
37
37
|
});
|
|
38
38
|
_defineProperty(_assertThisInitialized(_this), "getBylineComponent", function (isSelected, message) {
|
|
39
39
|
return jsx("span", {
|
|
40
|
-
css: textWrapper(isSelected ? "var(--ds-text-selected, ".concat(B400, ")") : "var(--ds-text-subtlest, ".concat(N200, ")"))
|
|
40
|
+
css: textWrapper(isSelected ? "var(--ds-text-selected, ".concat(B400, ")") : "var(--ds-text-subtlest, ".concat(N200, ")")),
|
|
41
|
+
"data-testid": "user-picker-custom-secondary-text"
|
|
41
42
|
}, message);
|
|
42
43
|
});
|
|
43
44
|
_defineProperty(_assertThisInitialized(_this), "renderByline", function () {
|
|
@@ -42,7 +42,8 @@ export var EmailOption = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
42
42
|
});
|
|
43
43
|
_defineProperty(_assertThisInitialized(_this), "renderSecondaryText", function (label) {
|
|
44
44
|
return jsx("span", {
|
|
45
|
-
css: textWrapper(_this.props.isSelected ? "var(--ds-text-selected, ".concat(B400, ")") : "var(--ds-text-subtlest, ".concat(N200, ")"))
|
|
45
|
+
css: textWrapper(_this.props.isSelected ? "var(--ds-text-selected, ".concat(B400, ")") : "var(--ds-text-subtlest, ".concat(N200, ")")),
|
|
46
|
+
"data-testid": "user-picker-email-secondary-text"
|
|
46
47
|
}, label);
|
|
47
48
|
});
|
|
48
49
|
_defineProperty(_assertThisInitialized(_this), "renderOption", function (label) {
|
|
@@ -58,7 +58,8 @@ export var GroupOption = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
58
58
|
_defineProperty(_assertThisInitialized(_this), "renderByline", function () {
|
|
59
59
|
var isSelected = _this.props.isSelected;
|
|
60
60
|
return jsx("span", {
|
|
61
|
-
css: textWrapper(isSelected ? "var(--ds-text-selected, ".concat(B400, ")") : "var(--ds-text-subtlest, ".concat(N200, ")"))
|
|
61
|
+
css: textWrapper(isSelected ? "var(--ds-text-selected, ".concat(B400, ")") : "var(--ds-text-subtlest, ".concat(N200, ")")),
|
|
62
|
+
"data-testid": "user-picker-group-secondary-text"
|
|
62
63
|
}, jsx(FormattedMessage, messages.groupByline));
|
|
63
64
|
});
|
|
64
65
|
_defineProperty(_assertThisInitialized(_this), "getLozengeProps", function () {
|
|
@@ -54,14 +54,14 @@ export var PopupUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compo
|
|
|
54
54
|
offset = _this$props.offset,
|
|
55
55
|
placement = _this$props.placement,
|
|
56
56
|
rootBoundary = _this$props.rootBoundary,
|
|
57
|
-
shouldFlip = _this$props.shouldFlip
|
|
58
|
-
|
|
57
|
+
shouldFlip = _this$props.shouldFlip,
|
|
58
|
+
styles = _this$props.styles;
|
|
59
59
|
var width = this.props.width;
|
|
60
|
-
var
|
|
60
|
+
var selectStyles = getPopupStyles(width, isMulti, styles);
|
|
61
61
|
return /*#__PURE__*/React.createElement(BaseUserPickerWithoutAnalytics, _extends({}, this.props, {
|
|
62
62
|
SelectComponent: PopupSelect,
|
|
63
63
|
width: width,
|
|
64
|
-
styles:
|
|
64
|
+
styles: selectStyles,
|
|
65
65
|
components: getPopupComponents(!!popupTitle),
|
|
66
66
|
pickerProps: getPopupProps(width, target, this.handleFlipStyle, boundariesElement, offset, placement, rootBoundary, shouldFlip, popupTitle)
|
|
67
67
|
}));
|
|
@@ -74,7 +74,8 @@ export var TeamOption = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
74
74
|
});
|
|
75
75
|
_defineProperty(_assertThisInitialized(_this), "getBylineComponent", function (isSelected, message) {
|
|
76
76
|
return jsx("span", {
|
|
77
|
-
css: textWrapper(isSelected ? "var(--ds-text-selected, ".concat(B400, ")") : "var(--ds-text-subtlest, ".concat(N200, ")"))
|
|
77
|
+
css: textWrapper(isSelected ? "var(--ds-text-selected, ".concat(B400, ")") : "var(--ds-text-subtlest, ".concat(N200, ")")),
|
|
78
|
+
"data-testid": "user-picker-team-secondary-text"
|
|
78
79
|
}, message);
|
|
79
80
|
});
|
|
80
81
|
_defineProperty(_assertThisInitialized(_this), "renderAvatar", function () {
|
|
@@ -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}}',
|
|
@@ -158,6 +158,6 @@ export var getStyles = memoizeOne(function (width, isMulti, isCompact, overrideS
|
|
|
158
158
|
};
|
|
159
159
|
return overrideStyles ? mergeStyles(styles, overrideStyles) : styles;
|
|
160
160
|
});
|
|
161
|
-
export var getPopupStyles = memoizeOne(function (width,
|
|
162
|
-
return _objectSpread({}, getStyles(width, isMulti));
|
|
161
|
+
export var getPopupStyles = memoizeOne(function (width, isMulti, overrideStyles) {
|
|
162
|
+
return _objectSpread({}, getStyles(width, isMulti, false, overrideStyles));
|
|
163
163
|
});
|
package/dist/esm/version.json
CHANGED
|
@@ -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>>;
|
|
@@ -39,4 +39,4 @@ export declare const getStyles: import("memoize-one").MemoizedFn<(width: string
|
|
|
39
39
|
singleValue?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("@atlaskit/select").SingleValueProps<import("@atlaskit/select").OptionType, false, import("@atlaskit/select").GroupType<import("@atlaskit/select").OptionType>>> | undefined;
|
|
40
40
|
valueContainer?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").ValueContainerProps<import("@atlaskit/select").OptionType, false, import("@atlaskit/select").GroupType<import("@atlaskit/select").OptionType>>> | undefined;
|
|
41
41
|
}>;
|
|
42
|
-
export declare const getPopupStyles: import("memoize-one").MemoizedFn<(width: string | number,
|
|
42
|
+
export declare const getPopupStyles: import("memoize-one").MemoizedFn<(width: string | number, isMulti?: boolean | undefined, overrideStyles?: StylesConfig<import("@atlaskit/select").OptionType, false> | undefined) => StylesConfig<import("@atlaskit/select").OptionType, false>>;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -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
|
+
"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.
|
|
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",
|
|
@@ -78,7 +78,9 @@
|
|
|
78
78
|
},
|
|
79
79
|
"techstack": {
|
|
80
80
|
"@repo/internal": {
|
|
81
|
-
"
|
|
81
|
+
"design-tokens": [
|
|
82
|
+
"color"
|
|
83
|
+
]
|
|
82
84
|
}
|
|
83
85
|
},
|
|
84
86
|
"keywords": [
|
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)
|
package/tmp/api-report-tmp.d.ts
CHANGED
|
@@ -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)
|